[{"id":19483,"web_url":"https://patchwork.libcamera.org/comment/19483/","msgid":"<a047a7b1-b504-52ca-09e2-fc3667244fb2@ideasonboard.com>","date":"2021-09-06T23:32:44","subject":"Re: [libcamera-devel] [PATCH v3 05/30] libcamera: formats: Move\n\tplane info structure to PixelFormatInfo","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 06/09/2021 23:56, Laurent Pinchart wrote:\n> Move the PixelFormatPlaneInfo structure within the PixelFormatInfo class\n> definition and rename it to Plane, to align the naming scheme with other\n> parts of libcamera, such as FrameBuffer::Plane or FrameMetadata::Plane.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  include/libcamera/internal/formats.h | 13 ++++++-------\n>  src/libcamera/formats.cpp            | 12 ++++++------\n>  2 files changed, 12 insertions(+), 13 deletions(-)\n> \n> diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\n> index 51a8a6b8b0ae..a07de6bc6020 100644\n> --- a/include/libcamera/internal/formats.h\n> +++ b/include/libcamera/internal/formats.h\n> @@ -19,12 +19,6 @@\n>  \n>  namespace libcamera {\n>  \n> -struct PixelFormatPlaneInfo\n> -{\n> -\tunsigned int bytesPerGroup;\n> -\tunsigned int verticalSubSampling;\n> -};\n> -\n>  class PixelFormatInfo\n>  {\n>  public:\n> @@ -34,6 +28,11 @@ public:\n>  \t\tColourEncodingRAW,\n>  \t};\n>  \n> +\tstruct Plane {\n> +\t\tunsigned int bytesPerGroup;\n> +\t\tunsigned int verticalSubSampling;\n> +\t};\n> +\n>  \tbool isValid() const { return format.isValid(); }\n>  \n>  \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n> @@ -58,7 +57,7 @@ public:\n>  \n>  \tunsigned int pixelsPerGroup;\n>  \n> -\tstd::array<PixelFormatPlaneInfo, 3> planes;\n> +\tstd::array<Plane, 3> planes;\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index 603d88619fe0..c993960eb982 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -24,15 +24,15 @@ namespace libcamera {\n>  LOG_DEFINE_CATEGORY(Formats)\n>  \n>  /**\n> - * \\class PixelFormatPlaneInfo\n> + * \\class PixelFormatInfo::Plane\n\nIsn't this a struct ? But perhaps this is just a doxygenism because\nstructs and classes are very similar.\n\nAs long as there's no requirement to move this Plane documentation into\nClass PixelformatInfo or 'after' it?\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>   * \\brief Information about a single plane of a pixel format\n>   *\n> - * \\var PixelFormatPlaneInfo::bytesPerGroup\n> + * \\var PixelFormatInfo::Plane::bytesPerGroup\n>   * \\brief The number of bytes that a pixel group consumes\n>   *\n>   * \\sa PixelFormatInfo::pixelsPerGroup\n>   *\n> - * \\var PixelFormatPlaneInfo::verticalSubSampling\n> + * \\var PixelFormatInfo::Plane::verticalSubSampling\n>   * \\brief Vertical subsampling multiplier\n>   *\n>   * This value is the ratio between the number of rows of pixels in the frame\n> @@ -87,7 +87,7 @@ LOG_DEFINE_CATEGORY(Formats)\n>   *\n>   * A pixel group is defined as the minimum number of pixels (including padding)\n>   * necessary in a row when the image has only one column of effective pixels.\n> - * pixelsPerGroup refers to this value. PixelFormatPlaneInfo::bytesPerGroup,\n> + * pixelsPerGroup refers to this value. PixelFormatInfo::Plane::bytesPerGroup,\n>   * then, refers to the number of bytes that a pixel group consumes. This\n>   * definition of a pixel group allows simple calculation of stride, as\n>   * ceil(width / pixelsPerGroup) * bytesPerGroup. These values are determined\n> @@ -122,7 +122,7 @@ LOG_DEFINE_CATEGORY(Formats)\n>   * \\var PixelFormatInfo::planes\n>   * \\brief Information about pixels for each plane\n>   *\n> - * \\sa PixelFormatPlaneInfo\n> + * \\sa PixelFormatInfo::Plane\n>   */\n>  \n>  /**\n> @@ -869,7 +869,7 @@ unsigned int PixelFormatInfo::numPlanes() const\n>  {\n>  \tunsigned int count = 0;\n>  \n> -\tfor (const PixelFormatPlaneInfo &p : planes) {\n> +\tfor (const Plane &p : planes) {\n>  \t\tif (p.bytesPerGroup == 0)\n>  \t\t\tbreak;\n>  \n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4B77CBE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Sep 2021 23:32:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E49569167;\n\tTue,  7 Sep 2021 01:32:49 +0200 (CEST)","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 DB43960253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 01:32:47 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7746F891;\n\tTue,  7 Sep 2021 01:32:47 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LZT3oWIV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630971167;\n\tbh=FZNQDavxV4v2AXiuWisTFdb/72DI7JwDK3ygW3RDWm0=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=LZT3oWIVK+QAXryZxiNeyYKHbbWEozjq2tubgtHy++incRLGklTNoFg7sZpQF+ZON\n\tWX/9AjlV/qDDHK1iJBrXP/71Z1kwQLmvNPSBzlddMK9AkatKcVh4FbRykv8v3lTrEq\n\tsuk744WIx3Q/LzPnWGWcIZ9QcoNlNR5KSCopA/9c=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210906225420.13275-1-laurent.pinchart@ideasonboard.com>\n\t<20210906225636.14683-5-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<a047a7b1-b504-52ca-09e2-fc3667244fb2@ideasonboard.com>","Date":"Tue, 7 Sep 2021 00:32:44 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210906225636.14683-5-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 05/30] libcamera: formats: Move\n\tplane info structure to PixelFormatInfo","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19489,"web_url":"https://patchwork.libcamera.org/comment/19489/","msgid":"<YTasTiUQbykvAYTF@pendragon.ideasonboard.com>","date":"2021-09-07T00:03:26","subject":"Re: [libcamera-devel] [PATCH v3 05/30] libcamera: formats: Move\n\tplane info structure to PixelFormatInfo","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Tue, Sep 07, 2021 at 12:32:44AM +0100, Kieran Bingham wrote:\n> On 06/09/2021 23:56, Laurent Pinchart wrote:\n> > Move the PixelFormatPlaneInfo structure within the PixelFormatInfo class\n> > definition and rename it to Plane, to align the naming scheme with other\n> > parts of libcamera, such as FrameBuffer::Plane or FrameMetadata::Plane.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > Reviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  include/libcamera/internal/formats.h | 13 ++++++-------\n> >  src/libcamera/formats.cpp            | 12 ++++++------\n> >  2 files changed, 12 insertions(+), 13 deletions(-)\n> > \n> > diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\n> > index 51a8a6b8b0ae..a07de6bc6020 100644\n> > --- a/include/libcamera/internal/formats.h\n> > +++ b/include/libcamera/internal/formats.h\n> > @@ -19,12 +19,6 @@\n> >  \n> >  namespace libcamera {\n> >  \n> > -struct PixelFormatPlaneInfo\n> > -{\n> > -\tunsigned int bytesPerGroup;\n> > -\tunsigned int verticalSubSampling;\n> > -};\n> > -\n> >  class PixelFormatInfo\n> >  {\n> >  public:\n> > @@ -34,6 +28,11 @@ public:\n> >  \t\tColourEncodingRAW,\n> >  \t};\n> >  \n> > +\tstruct Plane {\n> > +\t\tunsigned int bytesPerGroup;\n> > +\t\tunsigned int verticalSubSampling;\n> > +\t};\n> > +\n> >  \tbool isValid() const { return format.isValid(); }\n> >  \n> >  \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n> > @@ -58,7 +57,7 @@ public:\n> >  \n> >  \tunsigned int pixelsPerGroup;\n> >  \n> > -\tstd::array<PixelFormatPlaneInfo, 3> planes;\n> > +\tstd::array<Plane, 3> planes;\n> >  };\n> >  \n> >  } /* namespace libcamera */\n> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> > index 603d88619fe0..c993960eb982 100644\n> > --- a/src/libcamera/formats.cpp\n> > +++ b/src/libcamera/formats.cpp\n> > @@ -24,15 +24,15 @@ namespace libcamera {\n> >  LOG_DEFINE_CATEGORY(Formats)\n> >  \n> >  /**\n> > - * \\class PixelFormatPlaneInfo\n> > + * \\class PixelFormatInfo::Plane\n> \n> Isn't this a struct ? But perhaps this is just a doxygenism because\n> structs and classes are very similar.\n> \n> As long as there's no requirement to move this Plane documentation into\n> Class PixelformatInfo or 'after' it?\n\nGood points, I'll use \\struct and move the documentation block to the\nright place.\n\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> >   * \\brief Information about a single plane of a pixel format\n> >   *\n> > - * \\var PixelFormatPlaneInfo::bytesPerGroup\n> > + * \\var PixelFormatInfo::Plane::bytesPerGroup\n> >   * \\brief The number of bytes that a pixel group consumes\n> >   *\n> >   * \\sa PixelFormatInfo::pixelsPerGroup\n> >   *\n> > - * \\var PixelFormatPlaneInfo::verticalSubSampling\n> > + * \\var PixelFormatInfo::Plane::verticalSubSampling\n> >   * \\brief Vertical subsampling multiplier\n> >   *\n> >   * This value is the ratio between the number of rows of pixels in the frame\n> > @@ -87,7 +87,7 @@ LOG_DEFINE_CATEGORY(Formats)\n> >   *\n> >   * A pixel group is defined as the minimum number of pixels (including padding)\n> >   * necessary in a row when the image has only one column of effective pixels.\n> > - * pixelsPerGroup refers to this value. PixelFormatPlaneInfo::bytesPerGroup,\n> > + * pixelsPerGroup refers to this value. PixelFormatInfo::Plane::bytesPerGroup,\n> >   * then, refers to the number of bytes that a pixel group consumes. This\n> >   * definition of a pixel group allows simple calculation of stride, as\n> >   * ceil(width / pixelsPerGroup) * bytesPerGroup. These values are determined\n> > @@ -122,7 +122,7 @@ LOG_DEFINE_CATEGORY(Formats)\n> >   * \\var PixelFormatInfo::planes\n> >   * \\brief Information about pixels for each plane\n> >   *\n> > - * \\sa PixelFormatPlaneInfo\n> > + * \\sa PixelFormatInfo::Plane\n> >   */\n> >  \n> >  /**\n> > @@ -869,7 +869,7 @@ unsigned int PixelFormatInfo::numPlanes() const\n> >  {\n> >  \tunsigned int count = 0;\n> >  \n> > -\tfor (const PixelFormatPlaneInfo &p : planes) {\n> > +\tfor (const Plane &p : planes) {\n> >  \t\tif (p.bytesPerGroup == 0)\n> >  \t\t\tbreak;\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A622BBE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 00:03:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 430356916A;\n\tTue,  7 Sep 2021 02:03:47 +0200 (CEST)","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 33F4660253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 02:03:46 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7EB00317;\n\tTue,  7 Sep 2021 02:03:45 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ArdaDRDZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630973025;\n\tbh=XSRX5KXE7lS1kmC8HmquuC20jnCF4n9qFEq91jf3a7Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ArdaDRDZDjbGv8s6uFRX48P/K9DzLZw8q42DHZPjcCKKCs2xRha0YdNqXg+DE3vvA\n\twl83oKS1GpuNaLIXcJ3RnOr8/jDbAquFhIL+x6TtHXpHgPYznuVFVKxw1iQ5tA7PHI\n\tdoP/5anH1V24Ic56gYUCOLXdelq/sacOxlF+koI4=","Date":"Tue, 7 Sep 2021 03:03:26 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YTasTiUQbykvAYTF@pendragon.ideasonboard.com>","References":"<20210906225420.13275-1-laurent.pinchart@ideasonboard.com>\n\t<20210906225636.14683-5-laurent.pinchart@ideasonboard.com>\n\t<a047a7b1-b504-52ca-09e2-fc3667244fb2@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<a047a7b1-b504-52ca-09e2-fc3667244fb2@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 05/30] libcamera: formats: Move\n\tplane info structure to PixelFormatInfo","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]