ipa: simple: agc: Make sure activeState.agc expo/again are always initialized
If the first frame of a stream is bad, the IPA will not get called with
frame == 0, leaving activeState.agc expo/again uninitialized. This causes
the agc algorithm to set a very low gain and exposure on the next run
(where it will hit the if (!stats->valid) {} path) resulting in starting
with a black image.
Fix this by using a valid flag instead of checking for frame == 0.
The entire activeState gets cleared to 0 on configure() resetting the new
valid flag.
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
98e5e56150
commit
03fc5f6c94
@@ -100,7 +100,7 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou
|
||||
}
|
||||
|
||||
void Agc::process(IPAContext &context,
|
||||
const uint32_t frame,
|
||||
[[maybe_unused]] const uint32_t frame,
|
||||
IPAFrameContext &frameContext,
|
||||
const SwIspStats *stats,
|
||||
ControlList &metadata)
|
||||
@@ -110,13 +110,14 @@ void Agc::process(IPAContext &context,
|
||||
metadata.set(controls::ExposureTime, exposureTime.get<std::micro>());
|
||||
metadata.set(controls::AnalogueGain, frameContext.sensor.gain);
|
||||
|
||||
if (frame == 0) {
|
||||
if (!context.activeState.agc.valid) {
|
||||
/*
|
||||
* Init active-state from sensor values in case updateExposure()
|
||||
* does not run for the first frame.
|
||||
*/
|
||||
context.activeState.agc.exposure = frameContext.sensor.exposure;
|
||||
context.activeState.agc.again = frameContext.sensor.gain;
|
||||
context.activeState.agc.valid = true;
|
||||
}
|
||||
|
||||
if (!stats->valid) {
|
||||
|
||||
@@ -40,6 +40,7 @@ struct IPAActiveState {
|
||||
struct {
|
||||
int32_t exposure;
|
||||
double again;
|
||||
bool valid;
|
||||
} agc;
|
||||
|
||||
struct {
|
||||
|
||||
Reference in New Issue
Block a user