Message ID | 20250429115934.3551701-1-stefan.klug@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi Stefan On 29/04/2025 12:59, Stefan Klug wrote: > When the AWB engine doesn't find a valid pixel because all pixels lie > outside the configured colour range it returns an AWB measurement value > of 255, 255, 255. This leaves the regulation in an unrecoverable state > noticeable by a completely green image. Fix that by skipping the AWB > calculation in case there were no valid pixels. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>. Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> > --- > src/ipa/rkisp1/algorithms/awb.cpp | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp > index eafe93081bb1..2b8b41ecccbe 100644 > --- a/src/ipa/rkisp1/algorithms/awb.cpp > +++ b/src/ipa/rkisp1/algorithms/awb.cpp > @@ -296,6 +296,11 @@ void Awb::process(IPAContext &context, > const rkisp1_cif_isp_stat *params = &stats->params; > const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; > > + if (awb->awb_mean[0].cnt == 0) { > + LOG(RkISP1Awb, Warning) << "AWB statistics are empty"; > + return; > + } > + > RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb); > > /*
Quoting Stefan Klug (2025-04-29 12:59:19) > When the AWB engine doesn't find a valid pixel because all pixels lie > outside the configured colour range it returns an AWB measurement value > of 255, 255, 255. This leaves the regulation in an unrecoverable state > noticeable by a completely green image. Fix that by skipping the AWB > calculation in case there were no valid pixels. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>. > --- > src/ipa/rkisp1/algorithms/awb.cpp | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp > index eafe93081bb1..2b8b41ecccbe 100644 > --- a/src/ipa/rkisp1/algorithms/awb.cpp > +++ b/src/ipa/rkisp1/algorithms/awb.cpp > @@ -296,6 +296,11 @@ void Awb::process(IPAContext &context, > const rkisp1_cif_isp_stat *params = &stats->params; > const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; > > + if (awb->awb_mean[0].cnt == 0) { > + LOG(RkISP1Awb, Warning) << "AWB statistics are empty"; > + return; So I think this is definitely a valid thing to do - but I can conjour up conditions where 'every frame' is invalid - and that then becomes very noisy on this log. I suspect just making it a Debug level log instead might be better. Anyway, I'll leave that to you - I think catching this is a good thing - we shouldn't try to calculate any means from no data ... Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + } > + > RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb); > > /* > -- > 2.43.0 >
diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index eafe93081bb1..2b8b41ecccbe 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -296,6 +296,11 @@ void Awb::process(IPAContext &context, const rkisp1_cif_isp_stat *params = &stats->params; const rkisp1_cif_isp_awb_stat *awb = ¶ms->awb; + if (awb->awb_mean[0].cnt == 0) { + LOG(RkISP1Awb, Warning) << "AWB statistics are empty"; + return; + } + RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb); /*
When the AWB engine doesn't find a valid pixel because all pixels lie outside the configured colour range it returns an AWB measurement value of 255, 255, 255. This leaves the regulation in an unrecoverable state noticeable by a completely green image. Fix that by skipping the AWB calculation in case there were no valid pixels. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>. --- src/ipa/rkisp1/algorithms/awb.cpp | 5 +++++ 1 file changed, 5 insertions(+)