[libcamera-devel] [PATCH] camera_sensor: Remove redundant aspect-ratio check

Umang Jain umang.jain at ideasonboard.com
Tue Jul 6 12:29:18 CEST 2021


While trying to find the best sensor resolution,
CameraSensor::getFormat() tracks best aspect-ratio of the sensor-format
it has seen beforehand, among other things. If a better aspect-ratio is
found, the code shall proceed to check other best-fit parameters.
However, the check for aspect-ratio is occuring twice, eliminate one of
them.

This commit does not introduces any functional changes.

Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
---
 src/libcamera/camera_sensor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index cde431cc..1bf42acf 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -572,7 +572,7 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu
 			if (ratioDiff > bestRatio)
 				continue;
 
-			if (ratioDiff < bestRatio || areaDiff < bestArea) {
+			if (areaDiff < bestArea) {
 				bestRatio = ratioDiff;
 				bestArea = areaDiff;
 				bestSize = &sz;
-- 
2.31.1



More information about the libcamera-devel mailing list