From 72afcbb0873215dd31de098e0461586ba913dcfb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 10 Apr 2019 00:35:37 +0300 Subject: libcamera: geometry: Use Size to store min and max in SizeRange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of storing four integers for the minimum and maximum width and height in the SizeRange class, use two instance of the Size class for the minimum and maximum sizes. While it at replace the mention of image size with size in the SizeRange documentation, as the Size class isn't limited to image sizes. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/libcamera/pipeline/ipu3/ipu3.cpp') diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f2306efb..fb9ee0af 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1058,10 +1058,9 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) continue; for (const SizeRange &size : it.second) { - if (maxSize_.width < size.maxWidth && - maxSize_.height < size.maxHeight) { - maxSize_.width = size.maxWidth; - maxSize_.height = size.maxHeight; + if (maxSize_.width < size.max.width && + maxSize_.height < size.max.height) { + maxSize_ = size.max; mbusCode_ = mbusCode; } } @@ -1116,19 +1115,19 @@ int CIO2Device::configure(const StreamConfiguration &config, * as possible. This will need to be revisited when * implementing the scaling policy. */ - if (size.maxWidth < config.width || - size.maxHeight < config.height) + if (size.max.width < config.width || + size.max.height < config.height) continue; - unsigned int diff = size.maxWidth * size.maxHeight + unsigned int diff = size.max.width * size.max.height - imageSize; if (diff >= best) continue; best = diff; - sensorFormat.width = size.maxWidth; - sensorFormat.height = size.maxHeight; + sensorFormat.width = size.max.width; + sensorFormat.height = size.max.height; sensorFormat.mbus_code = it.first; } } -- cgit v1.2.1