ipa: rkisp1: algorithms: agc: Check for correct stats type

Sometimes the ISP produces statistics only with a subset of statistic
types being valid. It doesn't happen normally, but was observed in the
wild. Check for the RKISP1_CIF_ISP_STAT_AUTOEXP bit to prevent using
invalid or outdated data. As it doesn't happen regularly add an error
message to get notified when it happens.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Stefan Klug 2024-10-18 18:06:30 +02:00 committed by Kieran Bingham
parent c8d261608a
commit 0e0e32b189

View file

@ -402,6 +402,12 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
fillMetadata(context, frameContext, metadata);
return;
}
if (!(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP)) {
fillMetadata(context, frameContext, metadata);
LOG(RkISP1Agc, Error) << "AUTOEXP data is missing in statistics";
return;
}
/*
* \todo Verify that the exposure and gain applied by the sensor for
@ -412,7 +418,6 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
*/
const rkisp1_cif_isp_stat *params = &stats->params;
ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);
/* The lower 4 bits are fractional and meant to be discarded. */
Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },