[{"id":4086,"web_url":"https://patchwork.libcamera.org/comment/4086/","msgid":"<20200319001132.GF3042581@oden.dyn.berto.se>","date":"2020-03-19T00:11:32","subject":"Re: [libcamera-devel] [PATCH] libcamera: geometry: Construct\n\tSizeRange from Size","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-03-18 19:23:37 +0200, Laurent Pinchart wrote:\n> The SizeRange constructors take minimum and maximum width and height\n> values as separate arguments. We have a Size class to convey size\n> information, use it in the constructors, and update the callers.\n\nI like it, it's clear in the users which values are one 'group' of width \nand height.\n\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\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(-)\n> \n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index 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>  \n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 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>   */\n> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n> index 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}\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index 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;\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 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) {\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 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;\n> diff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\n> index 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> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 18FEF60419\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 01:11:34 +0100 (CET)","by mail-lf1-x143.google.com with SMTP id j17so165685lfe.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 17:11:34 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\tk20sm149836lfm.11.2020.03.18.17.11.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 18 Mar 2020 17:11:32 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=fTLXRyXIdR+fq9RXcED0yLldyheQJopCWxsIiMiumE8=;\n\tb=jmomqnq23OrLjaf+ErAq6YBKOpvxxPHTkjrNRXJ112utFj7b49bI1fZprnsCDLe1OY\n\tV7Oc2okKbSxwAwPgUHmW0Tp4fqX4YVOfNY7Izu4kDv+M23q7gJKnU693TToE1CcL8RE6\n\t5+3RWGH2dV0un5Y9JuMw6IG1EM0tbvc4SSD2PKSIJKO1xFQ1DpC/1AtpzdxPsQIoaa/8\n\tWSAe8BXwrKZyL+sSNH0zDNDoQyxNNytLItUZClA7Um2bIlg3spJ/xMqBkNUSlje0NRb9\n\txzHtb2PLQCmzPJpxVYPYtk/l2sy8iE+yxNFFPlnKM24n98IDDCCr6r81/TJHHHVupc5D\n\tiEQg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=fTLXRyXIdR+fq9RXcED0yLldyheQJopCWxsIiMiumE8=;\n\tb=jqbABPj1ZXsRSW5GbzK7xu1G7MOiOgFSYBWbNmnadAWH5k4eO8iJ1weshOFOfOK17d\n\tHivrRIIFk9JYoDEZmAXx0CQJYA/ZTNBiifK7QRd/XofA2lCQ0LSa1Zol+ei03e6M9DhN\n\th7NrsWlbd3Co9aKTi5wyiYhIzhsLMmBMNroIePsLvfPa/iAIUcg0VlYo2MJaJ9WXTsYj\n\tJiy2JJ006a89yyaECJu7MTr5tQjyT8BjMQZxm2Ye/eZw2lDfYCGFyY0mh12ae4AqSDfM\n\tnFEL2AnaefwA4DhRvkosiNLxNr2JX6ciXzsiRnVP/KE+o3sAMqEvD2q8JBQbbD2AddO3\n\tpZgQ==","X-Gm-Message-State":"ANhLgQ1kCRcbXTqOIOGBfFZFE+/CVmA6FZil+A6uqR37PZday2hPziTy\n\tM+4a47WKgh0mOCfUKrwBNn7lMQ==","X-Google-Smtp-Source":"ADFU+vvaFtdeXO3tINkJQQ4dmF0ubLbm5QIm6DiSrapvYWJsFqjPoNWR/KDl4RSVbhwyDQLkRh/N4Q==","X-Received":"by 2002:ac2:5e62:: with SMTP id a2mr379617lfr.162.1584576693366; \n\tWed, 18 Mar 2020 17:11:33 -0700 (PDT)","Date":"Thu, 19 Mar 2020 01:11:32 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200319001132.GF3042581@oden.dyn.berto.se>","References":"<20200318172337.7715-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200318172337.7715-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] libcamera: geometry: Construct\n\tSizeRange from 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":"Thu, 19 Mar 2020 00:11:34 -0000"}},{"id":4088,"web_url":"https://patchwork.libcamera.org/comment/4088/","msgid":"<31992362-ffda-8040-74bb-d380c5af4733@ideasonboard.com>","date":"2020-03-19T11:11:00","subject":"Re: [libcamera-devel] [PATCH] libcamera: geometry: Construct\n\tSizeRange from Size","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 19/03/2020 00:11, Niklas Söderlund wrote:\n> Hi Laurent,\n> \n> Thanks for your patch.\n> \n> On 2020-03-18 19:23:37 +0200, Laurent Pinchart wrote:\n>> The SizeRange constructors take minimum and maximum width and height\n>> values as separate arguments. We have a Size class to convey size\n>> information, use it in the constructors, and update the callers.\n> \n> I like it, it's clear in the users which values are one 'group' of width \n> and height.\n\nStrongly seconded!\n\nThis:\n-\t\t\tSizeRange{ 48, 48, 4096, 2160 }\n+\t\t\tSizeRange{ { 48, 48 }, { 4096, 2160 } }\n\nIs *so* much better!\n\n> \n>>\n>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> \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(-)\n>>\n>> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n>> index 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>>  \n>> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n>> index 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\nThat sounds a little odd, probably because of the two 'and's, and no\nseparator. Is it the specified min, with max and steps of 1? (of course not)\n\nMaybe:\n\n> \\brief Construct a size range with specified min and max, and steps of 1\nor\n> \\brief Construct a size range with specified min and max with steps of 1\nor\n> \\brief Construct a size range with specified min and max with a step of 1\n\nOr just leave out the step...?\n\n\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>>   */\n>> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n>> index 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\nI really love this.\n4 consecutive numbers have suddenly got meaning.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>>  \t\t};\n>>  \t\tformats[pixelformat] = sizes;\n>>  \t}\n>> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n>> index 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;\n>> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n>> index 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) {\n>> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n>> index 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;\n>> diff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\n>> index 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>> -- \n>> Regards,\n>>\n>> Laurent Pinchart\n>>\n>> _______________________________________________\n>> libcamera-devel mailing list\n>> libcamera-devel@lists.libcamera.org\n>> https://lists.libcamera.org/listinfo/libcamera-devel\n>","headers":{"Return-Path":"<kieran.bingham@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 8F16860417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 12:11:04 +0100 (CET)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DDA2CA53;\n\tThu, 19 Mar 2020 12:11:03 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584616264;\n\tbh=wlxDucqyvjyUSOTUfUbvnALoYnWQYEtQELHF6ctOMxk=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=MvksKz7bYhhd9G7Sq8f9zLrCqVJNN8DtvSP504UoFGLdjXdsXlToNjOZJSqu9hMbm\n\tQE4r4y0tcZAS+S5hZTZvZRSWpbFHkLBhFwOM/TsZCi/1B++VwmwL6NBlquH4/Half+\n\t2HqUqwMDc66D0OpczSYluOGc1Z7cjZs66av7vA6Q=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20200318172337.7715-1-laurent.pinchart@ideasonboard.com>\n\t<20200319001132.GF3042581@oden.dyn.berto.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+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OPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz\n\tPZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp\n\tECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<31992362-ffda-8040-74bb-d380c5af4733@ideasonboard.com>","Date":"Thu, 19 Mar 2020 11:11:00 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.9.1","MIME-Version":"1.0","In-Reply-To":"<20200319001132.GF3042581@oden.dyn.berto.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH] libcamera: geometry: Construct\n\tSizeRange from 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":"Thu, 19 Mar 2020 11:11:04 -0000"}}]