[PATCH v3 1/4] ipa: rkisp1: algorithms: agc: Check for correct stats type
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Oct 18 17:50:35 CEST 2024
On Fri, Oct 18, 2024 at 05:30:57PM +0200, Stefan Klug wrote:
> 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 at ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
>
> ---
> Changes in v3:
> - Split check for stats and type, to silence messages in raw mode
>
> Changes in v2:
> - Added error message
> - Made condition more readable
> - Collected tags
> ---
> src/ipa/rkisp1/algorithms/agc.cpp | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
> index 17d074d9c03e..281c404902a0 100644
> --- a/src/ipa/rkisp1/algorithms/agc.cpp
> +++ b/src/ipa/rkisp1/algorithms/agc.cpp
> @@ -402,6 +402,11 @@ 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)) {
> + LOG(RkISP1Agc, Error) << "AUTOEXP data is missing in statistics";
No need to call fillMetadata() here ?
> + return;
> + }
>
> /*
> * \todo Verify that the exposure and gain applied by the sensor for
> @@ -412,7 +417,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 },
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list