[libcamera-devel] [PATCH] libcamera: ipu3: Use std::max() instead of expandTo() to get the max resolution

Han-Lin Chen hanlinchen at chromium.org
Thu Aug 4 14:06:20 CEST 2022


Using Size::expandTo() to find the max resolution might generate a non-existent
resolution. For example, when application request streams for 1920x1080 and
1600x1200, the max resolution will be wrongly 1920x1200 and fails the
configuration.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=139
Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 75231156..335b6c94 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -254,7 +254,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
 			rawSize.expandTo(cfg.size);
 		} else {
 			yuvCount++;
-			maxYuvSize.expandTo(cfg.size);
+			maxYuvSize = std::max(maxYuvSize, cfg.size);
 		}
 	}
 
-- 
2.37.1.455.g008518b4e5-goog



More information about the libcamera-devel mailing list