diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2023-01-12 09:28:45 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-01-28 15:37:50 +0100 |
commit | 8b56a8a37c8eb801ab78d9bacd2ec6566a479107 (patch) | |
tree | fa8bdbfe5b13cdbe9e8722c3d218fa337a12283b | |
parent | bb847603d2af3292d4c02c6703602f0c2514c2be (diff) |
[WIP] camera_sensor: Do not consider FOV in getFormat()jmondi/pinephonepro
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 <jacopo@jmondi.org>
-rw-r--r-- | src/libcamera/camera_sensor.cpp | 10 |
1 files changed, 1 insertions, 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<unsigned int> &mbu { unsigned int desiredArea = size.width * size.height; unsigned int bestArea = UINT_MAX; - float desiredRatio = static_cast<float>(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<unsigned int> &mbu if (sz.width < size.width || sz.height < size.height) continue; - float ratio = static_cast<float>(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; |