libcamera: software_isp: Add control to disable statistic collection
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
3211c8dc13
commit
2a0c002ea9
8 changed files with 123 additions and 6 deletions
65
src/ipa/simple/algorithms/stat.cpp
Normal file
65
src/ipa/simple/algorithms/stat.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* 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 */
|
Loading…
Add table
Add a link
Reference in a new issue