From 8b56a8a37c8eb801ab78d9bacd2ec6566a479107 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Thu, 12 Jan 2023 09:28:45 +0100 Subject: [WIP] camera_sensor: Do not consider FOV in getFormat() The CameraSensor::getFormat() function prioritizes formats with the same FOV ratio over formats closer in size. In order to make it easier to test different sensor modes by simply asking for a smaller size, remove the area ratio criteria from the format selection logic. Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 6d5c2317..3494b111 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -708,8 +708,6 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu { unsigned int desiredArea = size.width * size.height; unsigned int bestArea = UINT_MAX; - float desiredRatio = static_cast(size.width) / size.height; - float bestRatio = FLT_MAX; const Size *bestSize = nullptr; uint32_t bestCode = 0; @@ -724,16 +722,10 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu if (sz.width < size.width || sz.height < size.height) continue; - float ratio = static_cast(sz.width) / sz.height; - float ratioDiff = fabsf(ratio - desiredRatio); unsigned int area = sz.width * sz.height; unsigned int areaDiff = area - desiredArea; - if (ratioDiff > bestRatio) - continue; - - if (ratioDiff < bestRatio || areaDiff < bestArea) { - bestRatio = ratioDiff; + if (areaDiff < bestArea) { bestArea = areaDiff; bestSize = &sz; bestCode = code; -- cgit v1.2.1