[libcamera-devel] [PATCH] libcamera: pipeline: raspberrypi: Fix initial value for scoring routine

Naushir Patuck naush at raspberrypi.com
Mon Jul 6 15:52:54 CEST 2020


Use std::numerical_limits to initialise the best score instead of an
arbitrary value. This fixes a failure in v4l2-conformance when using
the Raspberry Pi pipeline handler and v4l2-compatibility libcamera
layer.

Reported-by: Paul Elder <paul.elder at ideasonboard.com>
Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index f4966f86..bd2ed671 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -69,7 +69,7 @@ double scoreFormat(double desired, double actual)
 
 V4L2DeviceFormat findBestMode(V4L2PixFmtMap &formatsMap, const Size &req)
 {
-	double bestScore = 9e9, score;
+	double bestScore = std::numeric_limits<double>::max(), score;
 	V4L2DeviceFormat bestMode = {};
 
 #define PENALTY_AR		1500.0
-- 
2.25.1



More information about the libcamera-devel mailing list