<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thanks for fixing this.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 2 Mar 2023 at 12:57, David Plowman via libcamera-devel <<a href="mailto:libcamera-devel@lists.libcamera.org">libcamera-devel@lists.libcamera.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The maxVal variable in the computeInitialY function needs to be a<br>
uint64_t, otherwise the subsequent multiplications in the function<br>
can overflow on relatively high resolution images (when the counts in<br>
the regions go over 16 bits).<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></div><div><br></div><div>PS: patchwork does seem to have correctly recognised Kieran's tag (<a href="https://patchwork.libcamera.org/patch/18330/">https://patchwork.libcamera.org/patch/18330/</a>)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
src/ipa/raspberrypi/controller/rpi/agc.cpp | 2 +-<br>
1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
index ea0c82b5..4ea0dd41 100644<br>
--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp<br>
@@ -584,7 +584,7 @@ void Agc::fetchAwbStatus(Metadata *imageMetadata)<br>
static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,<br>
double weights[], double gain)<br>
{<br>
- constexpr unsigned int maxVal = 1 << Statistics::NormalisationFactorPow2;<br>
+ constexpr uint64_t maxVal = 1 << Statistics::NormalisationFactorPow2;<br>
/*<br>
* Note how the calculation below means that equal weights give you<br>
* "average" metering (i.e. all pixels equally important).<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>