[{"id":1885,"web_url":"https://patchwork.libcamera.org/comment/1885/","msgid":"<20190613143122.eahomvs3kbckucp3@uno.localdomain>","date":"2019-06-13T14:31:22","subject":"Re: [libcamera-devel] [PATCH v2 02/16] libcamera: geometry:\n\tSizeRange: Extend with step information","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n   two minor nits\n\n\nOn Wed, Jun 12, 2019 at 02:43:45AM +0200, Niklas Söderlund wrote:\n> The size range described might be subject to certain step\n> limitations. Make it possible to record this information.\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  include/libcamera/geometry.h | 13 +++++++++--\n>  src/libcamera/geometry.cpp   | 44 +++++++++++++++++++++++++++++++++---\n>  2 files changed, 52 insertions(+), 5 deletions(-)\n>\n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index ec5ed2bee196c82d..b2a8e5b0e005e4db 100644\n> --- a/include/libcamera/geometry.h\n> +++ b/include/libcamera/geometry.h\n> @@ -73,18 +73,27 @@ struct SizeRange {\n>  \t}\n>\n>  \tSizeRange(unsigned int width, unsigned int height)\n> -\t\t: min(width, height), max(width, height)\n> +\t\t: min(width, height), max(width, height), 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)\n> +\t\t: min(minW, minH), max(maxW, maxH), 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  unsigned int hstep, unsigned int vstep)\n> +\t\t: min(minW, minH), max(maxW, maxH), hStep(hstep), vStep(vstep)\n>  \t{\n>  \t}\n>\n>  \tSize min;\n>  \tSize max;\n> +\tunsigned int hStep;\n> +\tunsigned int vStep;\n>  };\n>\n>  bool operator==(const SizeRange &lhs, const SizeRange &rhs);\n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 26a05b9e7d800077..c56c4e399ef307f5 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -186,9 +186,24 @@ bool operator<(const Size &lhs, const Size &rhs)\n>   * \\struct SizeRange\n>   * \\brief Describe a range of sizes\n>   *\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> + * SizeRange describes a range of sizes included in the [min, max] interval\n> + * for both the width and the height. If the minimum and maximum sizes are\n> + * identical it represents a single size.\n> + *\n> + * The SizeRange may also describe a vertical and horizontal step. The step\n> + * describes the value in pixels the width/height size can be incremented with,\n\ns/size can be incremented with/size gets incremented by\n\n\"can\" sounds like a conditional statement to me. If that's intended,\nit's fine.\n\n> + * starting from the minimum size.\n> + *\n> + *\twidth = min.width + hStep * x\n> + *\theight = min.height + vStep * y\n> + *\n> + *\tWhere:\n> + *\n> + *\twidth <= max.width\n> + *\theight < max.height\n> + *\n> + * For SizeRanges describing a single size the incremental step values are fixed\n\nI think we don't make plurals with class names, so I would rather\ns/SizeRanges/SizeRange instances/ or start the phrase with \"When a\nSizeRange desribes ... \"\n\nNits apart\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n\n> + * to 1.\n>   */\n>\n>  /**\n> @@ -213,6 +228,19 @@ bool operator<(const Size &lhs, const Size &rhs)\n>   * \\param[in] maxH The maximum height\n>   */\n>\n> +/**\n> + * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH,\n> + *\t\t\t    unsigned int maxW, unsigned int maxH,\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> + * \\param[in] hstep The horizontal step\n> + * \\param[in] vstep The vertical step\n> + */\n> +\n>  /**\n>   * \\var SizeRange::min\n>   * \\brief The minimum size\n> @@ -223,6 +251,16 @@ bool operator<(const Size &lhs, const Size &rhs)\n>   * \\brief The maximum size\n>   */\n>\n> +/**\n> + * \\var SizeRange::hStep\n> + * \\brief The horizontal step\n> + */\n> +\n> +/**\n> + * \\var SizeRange::vStep\n> + * \\brief The vertical step\n> + */\n> +\n>  /**\n>   * \\brief Compare size ranges for equality\n>   * \\return True if the two size ranges are equal, false otherwise\n> --\n> 2.21.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F1E03637D2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2019 16:30:09 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 7CF2BFF811;\n\tThu, 13 Jun 2019 14:30:09 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Thu, 13 Jun 2019 16:31:22 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190613143122.eahomvs3kbckucp3@uno.localdomain>","References":"<20190612004359.15772-1-niklas.soderlund@ragnatech.se>\n\t<20190612004359.15772-3-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"tw3aqrxoniom3j3y\"","Content-Disposition":"inline","In-Reply-To":"<20190612004359.15772-3-niklas.soderlund@ragnatech.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v2 02/16] libcamera: geometry:\n\tSizeRange: Extend with step information","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, 13 Jun 2019 14:30:10 -0000"}}]