From 074fa98ac4ea903049ba9d7386cdb2f050ea3b48 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 24 Mar 2022 14:58:41 +0200 Subject: pipeline: rkisp1: Match sensor aspect ratio when generating configurations The RkISP1Path::generateConfiguration() function limits the maximum resolution to the sensor resolution, to avoid upscaling. It however doesn't take the sensor aspect ratio into account, which leads to a maximum (and default) resolution of 1920x1920 when using the self path with a sensor that has a higher resolution. Fix it by constraining the minimum and maximum resolutions to match the sensor's aspect ratio. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libcamera/pipeline') diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index f8d47120..f195f91e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -50,12 +50,13 @@ bool RkISP1Path::init(MediaDevice *media) StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution) { - Size maxResolution = resolution; - maxResolution.boundTo(maxResolution_); + Size maxResolution = maxResolution_.boundedToAspectRatio(resolution) + .boundedTo(resolution); + Size minResolution = minResolution_.expandedToAspectRatio(resolution); std::map> streamFormats; for (const PixelFormat &format : formats_) - streamFormats[format] = { { minResolution_, maxResolution } }; + streamFormats[format] = { { minResolution, maxResolution } }; StreamFormats formats(streamFormats); StreamConfiguration cfg(formats); -- cgit v1.2.1