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

paul.elder at ideasonboard.com paul.elder at ideasonboard.com
Tue Jul 7 14:30:04 CEST 2020


Hi Naush,

Thank you for the patch.

On Mon, Jul 06, 2020 at 02:52:54PM +0100, Naushir Patuck wrote:
> 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

This doesn't quite fix the issue I was having (I'll follow you up on
that), but I think this fix is still necessary.

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>


More information about the libcamera-devel mailing list