65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2025 Vasiliy Doylov <nekodevelopper@gmail.com>
|
|
*
|
|
* Debayer statistic controls
|
|
*/
|
|
|
|
#include "stat.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <libcamera/base/log.h>
|
|
|
|
#include "control_ids.h"
|
|
|
|
namespace libcamera {
|
|
|
|
LOG_DEFINE_CATEGORY(IPASoftStatistic)
|
|
|
|
namespace ipa::soft::algorithms {
|
|
|
|
Stat::Stat()
|
|
{
|
|
}
|
|
|
|
int Stat::init(IPAContext &context,
|
|
[[maybe_unused]] const YamlObject &tuningData)
|
|
{
|
|
context.ctrlMap[&controls::DebugMetadataEnable] = ControlInfo(false, true, true);
|
|
return 0;
|
|
}
|
|
|
|
int Stat::configure(IPAContext &context,
|
|
[[maybe_unused]] const IPAConfigInfo &configInfo)
|
|
{
|
|
context.activeState.knobs.stats_enabled = std::optional<bool>();
|
|
|
|
return 0;
|
|
}
|
|
|
|
void Stat::queueRequest([[maybe_unused]] typename Module::Context &context,
|
|
[[maybe_unused]] const uint32_t frame,
|
|
[[maybe_unused]] typename Module::FrameContext &frameContext,
|
|
const ControlList &controls)
|
|
{
|
|
const auto &stats_enabled = controls.get(controls::DebugMetadataEnable);
|
|
if (stats_enabled.has_value()) {
|
|
context.activeState.knobs.stats_enabled = stats_enabled;
|
|
LOG(IPASoftStatistic, Debug) << "Setting debayer enabled to " << stats_enabled.value();
|
|
}
|
|
}
|
|
|
|
void Stat::prepare([[maybe_unused]]IPAContext &context,
|
|
[[maybe_unused]] const uint32_t frame,
|
|
[[maybe_unused]]IPAFrameContext &frameContext,
|
|
[[maybe_unused]] DebayerParams *params)
|
|
{
|
|
params->collect_stats = context.activeState.knobs.stats_enabled.value_or(true);
|
|
}
|
|
|
|
REGISTER_IPA_ALGORITHM(Stat, "Stat")
|
|
|
|
} /* namespace ipa::soft::algorithms */
|
|
|
|
} /* namespace libcamera */
|