<div dir="ltr"><div dir="ltr">Hi Naush<div><br></div><div>Oops, yes we should have spotted that! Thanks!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 2 Nov 2021 at 12:47, Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</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 aspect ratio calculation divides two integer values then casts to a double.<br>
This might reduce precision when scoring for aspect rato differences.<br>
<br>
Fix this by casting the integer to a double before the division.<br>
<br>
Reported-by: Coverity CID=361652<br>
Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br></blockquote><div><br></div><div>Reviewed-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>></div><div><br></div><div>Thanks</div><div>David</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/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index 44760093f7ab..5e1f227398a9 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -141,7 +141,7 @@ V4L2SubdeviceFormat findBestFormat(const SensorFormats &formatsMap, const Size &<br>
<br>
                for (const Size &size : iter.second) {<br>
                        double reqAr = static_cast<double>(req.width) / req.height;<br>
-                       double fmtAr = size.width / size.height;<br>
+                       double fmtAr = static_cast<double>(size.width) / size.height;<br>
<br>
                        /* Score the dimensions for closeness. */<br>
                        score = scoreFormat(req.width, size.width);<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div></div>