Message ID | 20250403154925.382973-17-stefan.klug@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On Thu, Apr 03, 2025 at 05:49:21PM +0200, Stefan Klug wrote: > As the gains can also be specified manually, the regulation can run into > numeric instabilities by dividing by near zero. Mitigate that by > applying a small minium value. > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> > > --- > > Changes in v2: > - Collected tag > --- > src/ipa/rkisp1/algorithms/awb.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp > index 03449e87e1a0..84aa1d29419d 100644 > --- a/src/ipa/rkisp1/algorithms/awb.cpp > +++ b/src/ipa/rkisp1/algorithms/awb.cpp > @@ -406,9 +406,9 @@ RGB<double> Awb::calculateRgbMeans(const IPAFrameContext &frameContext, const rk > /* > * The ISP computes the AWB means after applying the colour gains, > * divide by the gains that were used to get the raw means from the > - * sensor. > + * sensor. Apply a minimum value to avoid divisions by near-zero. > */ > - rgbMeans /= frameContext.awb.gains; > + rgbMeans /= frameContext.awb.gains.max(0.01); > > return rgbMeans; > } > -- > 2.43.0 >
diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 03449e87e1a0..84aa1d29419d 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -406,9 +406,9 @@ RGB<double> Awb::calculateRgbMeans(const IPAFrameContext &frameContext, const rk /* * The ISP computes the AWB means after applying the colour gains, * divide by the gains that were used to get the raw means from the - * sensor. + * sensor. Apply a minimum value to avoid divisions by near-zero. */ - rgbMeans /= frameContext.awb.gains; + rgbMeans /= frameContext.awb.gains.max(0.01); return rgbMeans; }