[{"id":1707,"web_url":"https://patchwork.libcamera.org/comment/1707/","msgid":"<20190527093503.bulstigwhjdtrucs@uno.localdomain>","date":"2019-05-27T09:35:03","subject":"Re: [libcamera-devel] [PATCH 03/17] libcamera: geometry: SizeRange:\n\tExtend with stepping information","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Mon, May 27, 2019 at 02:15:29AM +0200, Niklas Söderlund wrote:\n> The size range described might be subject to certain stepping\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   | 37 ++++++++++++++++++++++++++++++++++++\n>  2 files changed, 48 insertions(+), 2 deletions(-)\n>\n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index ec5ed2bee196c82d..1c9267b14274cb5d 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(0), vStep(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: 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 cc25b816e6796ba1..e7f1bafd40e944f5 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -189,6 +189,20 @@ bool operator<(const Size &lhs, const Size &rhs)\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> + * The SizeRange may also contain a vertical and horizontal stepping.\n> + * The stepping values add additional constrains to the width and height\n> + * values described by the range.\n\nnit: I would write\n\n  * The SizeRange may also describe a size increment stepping value,\n  * which represents the size increment unit of both the vertical and\n  * horizontal sizes.\n  *\n  * The stepping value is used as size multiplication factor when\n  * calculating a the actual sizes when expressed in pixel units:\n\n> + *\n> + *\twidth = min.width + min.hStep * x\n> + *\theight = min.height + min.vStep * y\n\nNot sure 'min.h/vStep' is right, it should be just 'hStep' and 'vStep'\nif I got this right. And I would let 'min' out of the example and just\nprovide:\n\n        width = w * hStep;\n        height = h * hStep;\n\nUp to you..\n\n> + *\n> + *\tWhere:\n> + *\n> + *\twidth <= max.width\n> + *\theight < max.height\n> + *\n> + * For SizeRanges describing a single size the step values have no effect.\n\n\"the size increment step value is fixed to 0\"\n\n>   */\n>\n>  /**\n> @@ -212,6 +226,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> @@ -222,6 +249,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\"horizontal size increment step\"\n\n> + */\n> +\n> +/**\n> + * \\var SizeRange::vStep\n> + * \\brief The vertical step\n\nlikewise.\n\nDocumentation apart, the patch is fine\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n\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 relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3BB88600EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 May 2019 11:33:59 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BDB28E0013;\n\tMon, 27 May 2019 09:33:55 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Mon, 27 May 2019 11:35:03 +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":"<20190527093503.bulstigwhjdtrucs@uno.localdomain>","References":"<20190527001543.13593-1-niklas.soderlund@ragnatech.se>\n\t<20190527001543.13593-4-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"too2ryz35e46f3ej\"","Content-Disposition":"inline","In-Reply-To":"<20190527001543.13593-4-niklas.soderlund@ragnatech.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 03/17] libcamera: geometry: SizeRange:\n\tExtend with stepping 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":"Mon, 27 May 2019 09:33:59 -0000"}},{"id":1816,"web_url":"https://patchwork.libcamera.org/comment/1816/","msgid":"<20190610072142.GH4806@pendragon.ideasonboard.com>","date":"2019-06-10T07:21:42","subject":"Re: [libcamera-devel] [PATCH 03/17] libcamera: geometry: SizeRange:\n\tExtend with stepping information","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Mon, May 27, 2019 at 11:35:03AM +0200, Jacopo Mondi wrote:\n> On Mon, May 27, 2019 at 02:15:29AM +0200, Niklas Söderlund wrote:\n> > The size range described might be subject to certain stepping\n> > limitations. Make it possible to record this information.\n\nThe word \"stepping\" (here and in all other patches) sounds weird to me.\nIs it just me, or should we talk about \"step\" instead ?\n\n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  include/libcamera/geometry.h | 13 +++++++++++--\n> >  src/libcamera/geometry.cpp   | 37 ++++++++++++++++++++++++++++++++++++\n> >  2 files changed, 48 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> > index ec5ed2bee196c82d..1c9267b14274cb5d 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(0), vStep(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: 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 cc25b816e6796ba1..e7f1bafd40e944f5 100644\n> > --- a/src/libcamera/geometry.cpp\n> > +++ b/src/libcamera/geometry.cpp\n> > @@ -189,6 +189,20 @@ bool operator<(const Size &lhs, const Size &rhs)\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> > + * The SizeRange may also contain a vertical and horizontal stepping.\n> > + * The stepping values add additional constrains to the width and height\n> > + * values described by the range.\n> \n> nit: I would write\n> \n>   * The SizeRange may also describe a size increment stepping value,\n>   * which represents the size increment unit of both the vertical and\n>   * horizontal sizes.\n>   *\n>   * The stepping value is used as size multiplication factor when\n>   * calculating a the actual sizes when expressed in pixel units:\n> \n> > + *\n> > + *\twidth = min.width + min.hStep * x\n> > + *\theight = min.height + min.vStep * y\n> \n> Not sure 'min.h/vStep' is right, it should be just 'hStep' and 'vStep'\n> if I got this right. And I would let 'min' out of the example and just\n> provide:\n> \n>         width = w * hStep;\n>         height = h * hStep;\n> \n> Up to you..\n> \n> > + *\n> > + *\tWhere:\n> > + *\n> > + *\twidth <= max.width\n> > + *\theight < max.height\n> > + *\n> > + * For SizeRanges describing a single size the step values have no effect.\n> \n> \"the size increment step value is fixed to 0\"\n\nIf we have ranges with steps set to 0 it should indeed be explicitly\ndocumented, otherwise applications will crash with a division by 0 at\nsome point. We should also be very careful with this, and it may be best\nto set the steps to 1 in this case to avoid this issue.\n\n> >   */\n> >\n> >  /**\n> > @@ -212,6 +226,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> > @@ -222,6 +249,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> \"horizontal size increment step\"\n> \n> > + */\n> > +\n> > +/**\n> > + * \\var SizeRange::vStep\n> > + * \\brief The vertical step\n> \n> likewise.\n> \n> Documentation apart, the patch is fine\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > + */\n> > +\n> >  /**\n> >   * \\brief Compare size ranges for equality\n> >   * \\return True if the two size ranges are equal, false otherwise","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 829CD6376F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jun 2019 09:21:59 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-134-17-nat.elisa-mobile.fi\n\t[85.76.134.17])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C502569;\n\tMon, 10 Jun 2019 09:21:58 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1560151319;\n\tbh=Dvew16iRzNhHe5lZsVBifkb1yiEZMgRPSqwb5fztvr4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=P4WZxaIJAR7CincA7vTpVhGiqDbkoK9iIiKjHgv3x3msAXsZFrK3mBLwJkBuQ7AOY\n\tr2afNUcY2+TYGT3WYcuDm+vrQ/0ANrgdEQgUlYcQ9DPbOyao3eFVpxsD2xS3hpMdJX\n\tzdvzybwkiWWAEZQPd2nbXnlE4I4JNoQSgJwe8pL8=","Date":"Mon, 10 Jun 2019 10:21:42 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190610072142.GH4806@pendragon.ideasonboard.com>","References":"<20190527001543.13593-1-niklas.soderlund@ragnatech.se>\n\t<20190527001543.13593-4-niklas.soderlund@ragnatech.se>\n\t<20190527093503.bulstigwhjdtrucs@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190527093503.bulstigwhjdtrucs@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 03/17] libcamera: geometry: SizeRange:\n\tExtend with stepping 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":"Mon, 10 Jun 2019 07:21:59 -0000"}}]