libcamera: software_isp: Update black level only on exposure changes

The black level is likely to get updated, if ever, only after exposure
or gain changes.  Don't compute its possible updates if exposure and
gain are unchanged.

It's probably not worth trying to implement something more
sophisticated.  Better to spend the effort on supporting tuning files.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal
2024-09-27 15:46:24 +02:00
committed by Kieran Bingham
parent fb8ad13dc3
commit 6c0aefdaf9
2 changed files with 12 additions and 1 deletions

View File

@@ -30,10 +30,15 @@ int BlackLevel::configure(IPAContext &context,
void BlackLevel::process(IPAContext &context,
[[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
IPAFrameContext &frameContext,
const SwIspStats *stats,
[[maybe_unused]] ControlList &metadata)
{
if (frameContext.sensor.exposure == exposure_ &&
frameContext.sensor.gain == gain_) {
return;
}
const SwIspStats::Histogram &histogram = stats->yHistogram;
/*
@@ -54,6 +59,8 @@ void BlackLevel::process(IPAContext &context,
seen += histogram[i];
if (seen >= pixelThreshold) {
context.activeState.blc.level = i * histogramRatio;
exposure_ = frameContext.sensor.exposure;
gain_ = frameContext.sensor.gain;
LOG(IPASoftBL, Debug)
<< "Auto-set black level: "
<< i << "/" << SwIspStats::kYHistogramSize

View File

@@ -24,6 +24,10 @@ public:
IPAFrameContext &frameContext,
const SwIspStats *stats,
ControlList &metadata) override;
private:
uint32_t exposure_;
double gain_;
};
} /* namespace ipa::soft::algorithms */