Patch Detail
Show a patch.
GET /api/1.1/patches/3177/?format=api
{ "id": 3177, "url": "https://patchwork.libcamera.org/api/1.1/patches/3177/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3177/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200318172337.7715-1-laurent.pinchart@ideasonboard.com>", "date": "2020-03-18T17:23:37", "name": "[libcamera-devel] libcamera: geometry: Construct SizeRange from Size", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7d01a6ae9bd852a159589cf96ac8102b170a0998", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3177/mbox/", "series": [ { "id": 735, "url": "https://patchwork.libcamera.org/api/1.1/series/735/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=735", "date": "2020-03-18T17:23:37", "name": "[libcamera-devel] libcamera: geometry: Construct SizeRange from Size", "version": 1, "mbox": "https://patchwork.libcamera.org/series/735/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3177/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3177/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 EDC1B60418\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 18:23:49 +0100 (CET)", "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 A47D85F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 18:23:48 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584552228;\n\tbh=1T2jq580Zv43hoLCoQ4Ff5dgWvUllnT4kjSdRLfonYo=;\n\th=From:To:Subject:Date:From;\n\tb=CPU/vj15fuLQgROs/0nAbb5CAKQEEHicto7z7q4myxFBWMYJl5s2lk+gJIuT+mW6Z\n\t93EBOhtHXkdXNUckOKxwvxb0tmxKkuENwWbMle/0Ce1bV6iUnJzCnGFliZAIVKcSRR\n\twB2NSJd1E28JhXORkgBemrCcIx/1bfT5Wby/s+ws=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 18 Mar 2020 19:23:37 +0200", "Message-Id": "<20200318172337.7715-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: geometry: Construct SizeRange\n\tfrom Size", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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": "Wed, 18 Mar 2020 17:23:50 -0000" }, "content": "The SizeRange constructors take minimum and maximum width and height\nvalues as separate arguments. We have a Size class to convey size\ninformation, use it in the constructors, and update the callers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/geometry.h | 14 ++++++--------\n src/libcamera/geometry.cpp | 27 ++++++++++-----------------\n src/libcamera/pipeline/vimc.cpp | 2 +-\n src/libcamera/stream.cpp | 2 +-\n src/libcamera/v4l2_subdevice.cpp | 4 ++--\n src/libcamera/v4l2_videodevice.cpp | 20 ++++++++++----------\n test/stream/stream_formats.cpp | 12 ++++++------\n 7 files changed, 36 insertions(+), 45 deletions(-)", "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 52f4d010de76..7f1b29fe8c19 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -74,21 +74,19 @@ public:\n \t{\n \t}\n \n-\tSizeRange(unsigned int width, unsigned int height)\n-\t\t: min(width, height), max(width, height), hStep(1), vStep(1)\n+\tSizeRange(const Size &size)\n+\t\t: min(size), max(size), hStep(1), vStep(1)\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: min(minW, minH), max(maxW, maxH), hStep(1), vStep(1)\n+\tSizeRange(const Size &minSize, const Size &maxSize)\n+\t\t: min(minSize), max(maxSize), hStep(1), vStep(1)\n \t{\n \t}\n \n-\tSizeRange(unsigned int minW, unsigned int minH,\n-\t\t unsigned int maxW, unsigned int maxH,\n+\tSizeRange(const Size &minSize, const Size &maxSize,\n \t\t unsigned int hstep, unsigned int vstep)\n-\t\t: min(minW, minH), max(maxW, maxH), hStep(hstep), vStep(vstep)\n+\t\t: min(minSize), max(maxSize), hStep(hstep), vStep(vstep)\n \t{\n \t}\n \ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 92c53f64a58b..75cdcc7c42f1 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -217,31 +217,24 @@ bool operator<(const Size &lhs, const Size &rhs)\n */\n \n /**\n- * \\fn SizeRange::SizeRange(unsigned int width, unsigned int height)\n+ * \\fn SizeRange::SizeRange(const Size &size)\n * \\brief Construct a size range representing a single size\n- * \\param[in] width The size width\n- * \\param[in] height The size height\n+ * \\param[in] size The size\n */\n \n /**\n- * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH,\n- *\t\t\t unsigned int maxW, unsigned int maxH)\n- * \\brief Construct an initialized size range\n- * \\param[in] minW The minimum width\n- * \\param[in] minH The minimum height\n- * \\param[in] maxW The maximum width\n- * \\param[in] maxH The maximum height\n+ * \\fn SizeRange::SizeRange(const Size &minSize, const Size &maxSize)\n+ * \\brief Construct a size range with specified min and max and steps of 1\n+ * \\param[in] minSize The minimum size\n+ * \\param[in] maxSize The maximum size\n */\n \n /**\n- * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH,\n- *\t\t\t unsigned int maxW, unsigned int maxH,\n+ * \\fn SizeRange::SizeRange(const Size &minSize, const Size &maxSize,\n *\t\t\t unsigned int hstep, unsigned int vstep)\n- * \\brief Construct an initialized size range\n- * \\param[in] minW The minimum width\n- * \\param[in] minH The minimum height\n- * \\param[in] maxW The maximum width\n- * \\param[in] maxH The maximum height\n+ * \\brief Construct a size range with specified min, max and step\n+ * \\param[in] minSize The minimum size\n+ * \\param[in] maxSize The maximum size\n * \\param[in] hstep The horizontal step\n * \\param[in] vstep The vertical step\n */\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex fa84f0c1b20d..cbf330614bd6 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -177,7 +177,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,\n \tfor (PixelFormat pixelformat : pixelformats) {\n \t\t/* The scaler hardcodes a x3 scale-up ratio. */\n \t\tstd::vector<SizeRange> sizes{\n-\t\t\tSizeRange{ 48, 48, 4096, 2160 }\n+\t\t\tSizeRange{ { 48, 48 }, { 4096, 2160 } }\n \t\t};\n \t\tformats[pixelformat] = sizes;\n \t}\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex e61484caf715..ea3d214271ad 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -251,7 +251,7 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const\n \t\treturn ranges[0];\n \n \tLOG(Stream, Debug) << \"Building range from discrete sizes\";\n-\tSizeRange range(UINT_MAX, UINT_MAX, 0, 0);\n+\tSizeRange range({ UINT_MAX, UINT_MAX }, { 0, 0 });\n \tfor (const SizeRange &limit : ranges) {\n \t\tif (limit.min < range.min)\n \t\t\trange.min = limit.min;\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex f2bcd7f73c5c..8b9da81e8ab3 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -313,8 +313,8 @@ std::vector<SizeRange> V4L2Subdevice::enumPadSizes(unsigned int pad,\n \t\tif (ret)\n \t\t\tbreak;\n \n-\t\tsizes.emplace_back(sizeEnum.min_width, sizeEnum.min_height,\n-\t\t\t\t sizeEnum.max_width, sizeEnum.max_height);\n+\t\tsizes.emplace_back(Size{ sizeEnum.min_width, sizeEnum.min_height },\n+\t\t\t\t Size{ sizeEnum.max_width, sizeEnum.max_height });\n \t}\n \n \tif (ret < 0 && ret != -EINVAL && ret != -ENOTTY) {\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex fde8bd88e254..56251a465807 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -971,20 +971,20 @@ std::vector<SizeRange> V4L2VideoDevice::enumSizes(unsigned int pixelFormat)\n \n \t\tswitch (frameSize.type) {\n \t\tcase V4L2_FRMSIZE_TYPE_DISCRETE:\n-\t\t\tsizes.emplace_back(frameSize.discrete.width,\n-\t\t\t\t\t frameSize.discrete.height);\n+\t\t\tsizes.emplace_back(Size{ frameSize.discrete.width,\n+\t\t\t\t\t\t frameSize.discrete.height });\n \t\t\tbreak;\n \t\tcase V4L2_FRMSIZE_TYPE_CONTINUOUS:\n-\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n-\t\t\t\t\t frameSize.stepwise.min_height,\n-\t\t\t\t\t frameSize.stepwise.max_width,\n-\t\t\t\t\t frameSize.stepwise.max_height);\n+\t\t\tsizes.emplace_back(Size{ frameSize.stepwise.min_width,\n+\t\t\t\t\t\t frameSize.stepwise.min_height },\n+\t\t\t\t\t Size{ frameSize.stepwise.max_width,\n+\t\t\t\t\t\t frameSize.stepwise.max_height });\n \t\t\tbreak;\n \t\tcase V4L2_FRMSIZE_TYPE_STEPWISE:\n-\t\t\tsizes.emplace_back(frameSize.stepwise.min_width,\n-\t\t\t\t\t frameSize.stepwise.min_height,\n-\t\t\t\t\t frameSize.stepwise.max_width,\n-\t\t\t\t\t frameSize.stepwise.max_height,\n+\t\t\tsizes.emplace_back(Size{ frameSize.stepwise.min_width,\n+\t\t\t\t\t\t frameSize.stepwise.min_height },\n+\t\t\t\t\t Size{ frameSize.stepwise.max_width,\n+\t\t\t\t\t\t frameSize.stepwise.max_height },\n \t\t\t\t\t frameSize.stepwise.step_width,\n \t\t\t\t\t frameSize.stepwise.step_height);\n \t\t\tbreak;\ndiff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\nindex 92f1574b8a0b..9353d0085e19 100644\n--- a/test/stream/stream_formats.cpp\n+++ b/test/stream/stream_formats.cpp\n@@ -55,8 +55,8 @@ protected:\n \t{\n \t\t/* Test discrete sizes */\n \t\tStreamFormats discrete({\n-\t\t\t{ PixelFormat(1), { SizeRange(100, 100), SizeRange(200, 200) } },\n-\t\t\t{ PixelFormat(2), { SizeRange(300, 300), SizeRange(400, 400) } },\n+\t\t\t{ PixelFormat(1), { SizeRange({ 100, 100 }), SizeRange({ 200, 200 }) } },\n+\t\t\t{ PixelFormat(2), { SizeRange({ 300, 300 }), SizeRange({ 400, 400 }) } },\n \t\t});\n \n \t\tif (testSizes(\"discrete 1\", discrete.sizes(PixelFormat(1)),\n@@ -68,10 +68,10 @@ protected:\n \n \t\t/* Test range sizes */\n \t\tStreamFormats range({\n-\t\t\t{ PixelFormat(1), { SizeRange(640, 480, 640, 480) } },\n-\t\t\t{ PixelFormat(2), { SizeRange(640, 480, 800, 600, 8, 8) } },\n-\t\t\t{ PixelFormat(3), { SizeRange(640, 480, 800, 600, 16, 16) } },\n-\t\t\t{ PixelFormat(4), { SizeRange(128, 128, 4096, 4096, 128, 128) } },\n+\t\t\t{ PixelFormat(1), { SizeRange({ 640, 480 }, { 640, 480 }) } },\n+\t\t\t{ PixelFormat(2), { SizeRange({ 640, 480 }, { 800, 600 }, 8, 8) } },\n+\t\t\t{ PixelFormat(3), { SizeRange({ 640, 480 }, { 800, 600 }, 16, 16) } },\n+\t\t\t{ PixelFormat(4), { SizeRange({ 128, 128 }, { 4096, 4096 }, 128, 128) } },\n \t\t});\n \n \t\tif (testSizes(\"range 1\", range.sizes(PixelFormat(1)), { Size(640, 480) }))\n", "prefixes": [ "libcamera-devel" ] }