summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-10 00:35:37 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-18 18:13:06 +0300
commit72afcbb0873215dd31de098e0461586ba913dcfb (patch)
treecc26f9a6e88bba71e832f09f51e98baa0b4fa340 /src
parente7f446e1edcc6afc47287d49030280e335fe6838 (diff)
libcamera: geometry: Use Size to store min and max in SizeRange
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/geometry.cpp26
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp17
2 files changed, 16 insertions, 27 deletions
diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
index 1f875bbe..c1c7daed 100644
--- a/src/libcamera/geometry.cpp
+++ b/src/libcamera/geometry.cpp
@@ -93,11 +93,11 @@ const std::string Rectangle::toString() const
/**
* \struct SizeRange
- * \brief Describe a range of image sizes
+ * \brief Describe a range of sizes
*
- * SizeRange describes a range of image sizes included in the (minWidth,
- * minHeight) - (maxWidth, maxHeight) interval. If the minimum and
- * maximum sizes are identical it represents a single image resolution.
+ * SizeRange describes a range of sizes included in the [min, max]
+ * interval for both the width and the height. If the minimum and
+ * maximum sizes are identical it represents a single size.
*/
/**
@@ -115,23 +115,13 @@ const std::string Rectangle::toString() const
*/
/**
- * \var SizeRange::minWidth
- * \brief The minimum image width
+ * \var SizeRange::min
+ * \brief The minimum size
*/
/**
- * \var SizeRange::minHeight
- * \brief The minimum image height
- */
-
-/**
- * \var SizeRange::maxWidth
- * \brief The maximum image width
- */
-
-/**
- * \var SizeRange::maxHeight
- * \brief The maximum image height
+ * \var SizeRange::max
+ * \brief The maximum size
*/
} /* namespace libcamera */
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;
}
}