{"id":1052,"url":"https://patchwork.libcamera.org/api/1.1/patches/1052/?format=json","web_url":"https://patchwork.libcamera.org/patch/1052/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190418141437.14014-6-laurent.pinchart@ideasonboard.com>","date":"2019-04-18T14:14:29","name":"[libcamera-devel,v3,05/13] libcamera: geometry: Use Size to store min and max in SizeRange","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"30ffde17c2f9e288b73661487af0f623b05bfad6","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1052/mbox/","series":[{"id":256,"url":"https://patchwork.libcamera.org/api/1.1/series/256/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=256","date":"2019-04-18T14:14:24","name":"Rockchip ISP pipeline handler","version":3,"mbox":"https://patchwork.libcamera.org/series/256/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1052/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1052/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 83F0E60DC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 16:14:56 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 07AB49D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Apr 2019 16:14:55 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555596896;\n\tbh=OGux1LxX1DkklAo1PNNeUYQrQHDpjDw+WM73yR2TIYA=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=oxk5PrFv8q3BS1sbAGjnwKQ81812sP4d+NBrOEhaNna+m8mSQXiEW9isj0lZWHtwg\n\tGlffbIkUDPfsEn19XnEiveQciLNg7XZagdqMk0LtF3JRKGUL7zfD0GlOMYAiHJPrC0\n\t2c1Yyrt91WI0bGdK17rVpv1K5qT3rBXqXAJlz7iM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 18 Apr 2019 17:14:29 +0300","Message-Id":"<20190418141437.14014-6-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190418141437.14014-1-laurent.pinchart@ideasonboard.com>","References":"<20190418141437.14014-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 05/13] libcamera: geometry: Use Size to\n\tstore min and max in SizeRange","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 18 Apr 2019 14:14:57 -0000"},"content":"Instead of storing four integers for the minimum and maximum width and\nheight in the SizeRange class, use two instance of the Size class for\nthe minimum and maximum sizes.\n\nWhile it at replace the mention of image size with size in the SizeRange\ndocumentation, as the Size class isn't limited to image sizes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/geometry.h         | 10 +++-------\n src/libcamera/geometry.cpp           | 26 ++++++++------------------\n src/libcamera/pipeline/ipu3/ipu3.cpp | 17 ++++++++---------\n test/v4l2_subdevice/list_formats.cpp |  8 ++++----\n 4 files changed, 23 insertions(+), 38 deletions(-)","diff":"diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 7704ab5add21..80f79c6ba2d3 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -38,21 +38,17 @@ struct Size {\n \n struct SizeRange {\n \tSizeRange()\n-\t\t: SizeRange(0, 0, 0, 0)\n \t{\n \t}\n \n \tSizeRange(unsigned int minW, unsigned int minH,\n \t\t  unsigned int maxW, unsigned int maxH)\n-\t\t: minWidth(minW), minHeight(minH), maxWidth(maxW),\n-\t\t  maxHeight(maxH)\n+\t\t: min(minW, minH), max(maxW, maxH)\n \t{\n \t}\n \n-\tunsigned int minWidth;\n-\tunsigned int minHeight;\n-\tunsigned int maxWidth;\n-\tunsigned int maxHeight;\n+\tSize min;\n+\tSize max;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 1f875bbe5f48..c1c7daed7259 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -93,11 +93,11 @@ const std::string Rectangle::toString() const\n \n /**\n  * \\struct SizeRange\n- * \\brief Describe a range of image sizes\n+ * \\brief Describe a range of sizes\n  *\n- * SizeRange describes a range of image sizes included in the (minWidth,\n- * minHeight) - (maxWidth, maxHeight) interval. If the minimum and\n- * maximum sizes are identical it represents a single image resolution.\n+ * SizeRange describes a range of sizes included in the [min, max]\n+ * interval for both the width and the height. If the minimum and\n+ * maximum sizes are identical it represents a single size.\n  */\n \n /**\n@@ -115,23 +115,13 @@ const std::string Rectangle::toString() const\n  */\n \n /**\n- * \\var SizeRange::minWidth\n- * \\brief The minimum image width\n+ * \\var SizeRange::min\n+ * \\brief The minimum size\n  */\n \n /**\n- * \\var SizeRange::minHeight\n- * \\brief The minimum image height\n- */\n-\n-/**\n- * \\var SizeRange::maxWidth\n- * \\brief The maximum image width\n- */\n-\n-/**\n- * \\var SizeRange::maxHeight\n- * \\brief The maximum image height\n+ * \\var SizeRange::max\n+ * \\brief The maximum size\n  */\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f2306efba3bf..fb9ee0af6c3a 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -1058,10 +1058,9 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \t\t\tcontinue;\n \n \t\tfor (const SizeRange &size : it.second) {\n-\t\t\tif (maxSize_.width < size.maxWidth &&\n-\t\t\t    maxSize_.height < size.maxHeight) {\n-\t\t\t\tmaxSize_.width = size.maxWidth;\n-\t\t\t\tmaxSize_.height = size.maxHeight;\n+\t\t\tif (maxSize_.width < size.max.width &&\n+\t\t\t    maxSize_.height < size.max.height) {\n+\t\t\t\tmaxSize_ = size.max;\n \t\t\t\tmbusCode_ = mbusCode;\n \t\t\t}\n \t\t}\n@@ -1116,19 +1115,19 @@ int CIO2Device::configure(const StreamConfiguration &config,\n \t\t\t * as possible. This will need to be revisited when\n \t\t\t * implementing the scaling policy.\n \t\t\t */\n-\t\t\tif (size.maxWidth < config.width ||\n-\t\t\t    size.maxHeight < config.height)\n+\t\t\tif (size.max.width < config.width ||\n+\t\t\t    size.max.height < config.height)\n \t\t\t\tcontinue;\n \n-\t\t\tunsigned int diff = size.maxWidth * size.maxHeight\n+\t\t\tunsigned int diff = size.max.width * size.max.height\n \t\t\t\t\t  - imageSize;\n \t\t\tif (diff >= best)\n \t\t\t\tcontinue;\n \n \t\t\tbest = diff;\n \n-\t\t\tsensorFormat.width = size.maxWidth;\n-\t\t\tsensorFormat.height = size.maxHeight;\n+\t\t\tsensorFormat.width = size.max.width;\n+\t\t\tsensorFormat.height = size.max.height;\n \t\t\tsensorFormat.mbus_code = it.first;\n \t\t}\n \t}\ndiff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp\nindex 47ae3a1c1a28..09dec9abe854 100644\n--- a/test/v4l2_subdevice/list_formats.cpp\n+++ b/test/v4l2_subdevice/list_formats.cpp\n@@ -37,10 +37,10 @@ void ListFormatsTest::printFormats(unsigned int pad,\n \tfor (SizeRange &size : sizes) {\n \t\tcout << \"\tmbus code: 0x\" << setfill('0') << setw(4)\n \t\t     << hex << code << endl;\n-\t\tcout << \"\tmin width: \" << dec << size.minWidth << endl;\n-\t\tcout << \"\tmin height: \" << dec << size.minHeight << endl;\n-\t\tcout << \"\tmax width: \" << dec << size.maxWidth << endl;\n-\t\tcout << \"\tmax height: \" << dec << size.maxHeight << endl;\n+\t\tcout << \"\tmin width: \" << dec << size.min.width << endl;\n+\t\tcout << \"\tmin height: \" << dec << size.min.height << endl;\n+\t\tcout << \"\tmax width: \" << dec << size.max.width << endl;\n+\t\tcout << \"\tmax height: \" << dec << size.max.height << endl;\n \t}\n }\n \n","prefixes":["libcamera-devel","v3","05/13"]}