[{"id":20443,"web_url":"https://patchwork.libcamera.org/comment/20443/","msgid":"<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>","date":"2021-10-25T13:58:11","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> Add a BayerFormat::toPixelFormat() member function to convert a BayerFormat to a\n> PixelFormat type. This conversion uses the existing bayerToV4l2 conversion\n> table.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  include/libcamera/internal/bayer_format.h |  3 +++\n>  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n>  2 files changed, 16 insertions(+)\n> \n> diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> index 723382d4168d..247a60cf0e36 100644\n> --- a/include/libcamera/internal/bayer_format.h\n> +++ b/include/libcamera/internal/bayer_format.h\n> @@ -10,6 +10,8 @@\n>  #include <stdint.h>\n>  #include <string>\n>  \n> +#include <libcamera/pixel_format.h>\n> +\n>  #include \"libcamera/internal/v4l2_pixelformat.h\"\n>  \n>  namespace libcamera {\n> @@ -50,6 +52,7 @@ public:\n>  \n>  \tV4L2PixelFormat toV4L2PixelFormat() const;\n>  \tstatic BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n> +\tPixelFormat toPixelFormat() const;\n>  \tBayerFormat transform(Transform t) const;\n>  \n>  \tOrder order;\n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index 11355f144f66..c662ba36604c 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -269,6 +269,19 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n>  \treturn BayerFormat();\n>  }\n>  \n> +/**\n> + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> + * \\return The PixelFormat corresponding to this BayerFormat\n> + */\n> +PixelFormat BayerFormat::toPixelFormat() const\n> +{\n> +\tconst auto it = bayerToV4l2.find(*this);\n> +\tif (it != bayerToV4l2.end())\n> +\t\treturn PixelFormat(it->second);\n\nShould we store the PixelFormat in the bayerToV4l2 map to avoid a double\nlooking (one here, one in the PixelFormat constructor) ? The map should\nbe renamed to bayerToFormat, and be stored as either\n\nstd::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>, BayerFormatComparator>\n\nor\n\nstruct Formats {\n\tPixelFormat pixelFormat;\n\tV4L2PixelFormat v4l2Format;\n};\n\nstd::map<BayerFormat, Formats, BayerFormatComparator>\n\nIt could of course be argued that we'll then duplicate data, and that it\ncould get out of sync.\n\nI'm concerned about how the BayerFormat class is used to convert a media\nbus code to a pixel format or V4L2 pixel format, but I'll comment on\nthat where applicable in the rest of the series.\n\n> +\n> +\treturn PixelFormat();\n> +}\n> +\n>  /**\n>   * \\brief Apply a transform to this BayerFormat\n>   * \\param[in] t The transform to apply","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 57282BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Oct 2021 13:58:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A61F764870;\n\tMon, 25 Oct 2021 15:58:35 +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 DE5B360126\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Oct 2021 15:58:33 +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 6210BE0A;\n\tMon, 25 Oct 2021 15:58:33 +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=\"iw/AwCLA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635170313;\n\tbh=0uMlLCvcV9jMaCJEMbwTZh5RzSn/uaG67z6lJeI8wuM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iw/AwCLAhpgh8kyZ4TTA5/C2alg5vPanfixa2wIWE8YA0Xb+XOFoUzNrm6HrlRme7\n\tYHcubgA8UzxoO5JJdnk0LH40mM9ltunccVjf8d7Y8DiLHkS3KQaI5cf38lkTKG5X63\n\tPBUf/RBhxf7aB6KdUlSTpYlyFe0I/rmuJO7o4BcA=","Date":"Mon, 25 Oct 2021 16:58:11 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211022143907.3089419-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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>"}},{"id":20508,"web_url":"https://patchwork.libcamera.org/comment/20508/","msgid":"<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>","date":"2021-10-26T07:48:36","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nThank you for your feedback.\n\nOn Mon, 25 Oct 2021 at 14:58, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> Thank you for the patch.\n>\n> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> > Add a BayerFormat::toPixelFormat() member function to convert a\n> BayerFormat to a\n> > PixelFormat type. This conversion uses the existing bayerToV4l2\n> conversion\n> > table.\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > ---\n> >  include/libcamera/internal/bayer_format.h |  3 +++\n> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n> >  2 files changed, 16 insertions(+)\n> >\n> > diff --git a/include/libcamera/internal/bayer_format.h\n> b/include/libcamera/internal/bayer_format.h\n> > index 723382d4168d..247a60cf0e36 100644\n> > --- a/include/libcamera/internal/bayer_format.h\n> > +++ b/include/libcamera/internal/bayer_format.h\n> > @@ -10,6 +10,8 @@\n> >  #include <stdint.h>\n> >  #include <string>\n> >\n> > +#include <libcamera/pixel_format.h>\n> > +\n> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n> >\n> >  namespace libcamera {\n> > @@ -50,6 +52,7 @@ public:\n> >\n> >       V4L2PixelFormat toV4L2PixelFormat() const;\n> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n> > +     PixelFormat toPixelFormat() const;\n> >       BayerFormat transform(Transform t) const;\n> >\n> >       Order order;\n> > diff --git a/src/libcamera/bayer_format.cpp\n> b/src/libcamera/bayer_format.cpp\n> > index 11355f144f66..c662ba36604c 100644\n> > --- a/src/libcamera/bayer_format.cpp\n> > +++ b/src/libcamera/bayer_format.cpp\n> > @@ -269,6 +269,19 @@ BayerFormat\n> BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n> >       return BayerFormat();\n> >  }\n> >\n> > +/**\n> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> > + * \\return The PixelFormat corresponding to this BayerFormat\n> > + */\n> > +PixelFormat BayerFormat::toPixelFormat() const\n> > +{\n> > +     const auto it = bayerToV4l2.find(*this);\n> > +     if (it != bayerToV4l2.end())\n> > +             return PixelFormat(it->second);\n>\n> Should we store the PixelFormat in the bayerToV4l2 map to avoid a double\n> looking (one here, one in the PixelFormat constructor) ? The map should\n> be renamed to bayerToFormat, and be stored as either\n>\n> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n> BayerFormatComparator>\n>\n> or\n>\n> struct Formats {\n>         PixelFormat pixelFormat;\n>         V4L2PixelFormat v4l2Format;\n> };\n>\n> std::map<BayerFormat, Formats, BayerFormatComparator>\n>\n\nThis seems reasonable.  I will update the table with a std::pair for 2-way\nconversion.\n\nRegards,\nNaush\n\n\n>\n> It could of course be argued that we'll then duplicate data, and that it\n> could get out of sync.\n>\n> I'm concerned about how the BayerFormat class is used to convert a media\n> bus code to a pixel format or V4L2 pixel format, but I'll comment on\n> that where applicable in the rest of the series.\n>\n> > +\n> > +     return PixelFormat();\n> > +}\n> > +\n> >  /**\n> >   * \\brief Apply a transform to this BayerFormat\n> >   * \\param[in] t The transform to apply\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\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 92581BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Oct 2021 07:48:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5283D64878;\n\tTue, 26 Oct 2021 09:48:54 +0200 (CEST)","from mail-lj1-x235.google.com (mail-lj1-x235.google.com\n\t[IPv6:2a00:1450:4864:20::235])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45C4460123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Oct 2021 09:48:53 +0200 (CEST)","by mail-lj1-x235.google.com with SMTP id o26so18287234ljj.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Oct 2021 00:48:53 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"B0QcEBeY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=/tJLaJSRiO3FKDkRLpcH82RfFd1BGYkfOF7e+HiyUDk=;\n\tb=B0QcEBeY7D7HzDrv7JYfMtdF8PHRaBRlPk9KBVLLDex7S+UXjESfXOk29y/OTGSoCG\n\tyNGNd8WlaTVlw6yxBSFtE7buIFF+fh5AtIDJKYN5v++0A4dYZKiutXDr1SRMiI1saAsE\n\tQzVxc0bKh3WVt7T0ozupRVJqMVZft9Ul3mgrZ55RoJpF+c5lVNRsmgnMNQgbUJJvwFT0\n\tSF+52gmWhGOLikRliANZ/Ec2yJttgMarIbJfQvOZz7FKqv+pUFk1d4IFFYot9p8VMaGb\n\t/Ucsgqp0bDoPo60ow8FUqTchbnvz7JJ6J+4mn7D4VCJUSFf/yHdg+i8Z5i0JFCtAY96d\n\tIusA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=/tJLaJSRiO3FKDkRLpcH82RfFd1BGYkfOF7e+HiyUDk=;\n\tb=arkWb9eIACD7CNOUzmWQs1G8uzCM8Jy0goGJC4gpZ9eZXnvqLkIq3sIZjfwZZB7DpW\n\tZ+kyB7MWi5cuY7NS76Z1mRnCBTqgSLN+I6Cp30klNriAkDuBXdd+W+d/+LLGqw8FWsBJ\n\tZvFvN/eg6pkyzj5EKIoPVKJjd3lPBpP3o5LsFJWFYktR/2GTqJJExadSBInaWCZBh+Zq\n\tWYJ2+0xtVHYOF98ZuL1w20KGLcoi/zmCeNOv/yrtNdqyvB25bOZ1JjQC8mbuZhr+Q52J\n\t7Yg2ClIkz0BH2J/huTgaBLtwI2Y6sDWmR2Td+QafKY8R+WR32XA5qExdqazU9x/eBNIG\n\tFBMw==","X-Gm-Message-State":"AOAM533jRpC/r+2I9vkeYHIJW9ErJYtNOv/oNGUn7UvKhyRy+/FAeUtN\n\t7y4SV7E8a+GqeJLVEOaPvqhqdlj8K4H7x4oHnrOL6L9CKWSB2w==","X-Google-Smtp-Source":"ABdhPJyjr9ciDkdGP1YEEVNLtHwoh1zbuFcsKPTuEG4BSjgfDk77fox+UUss9ZB7CQpWLD3EcsqW7ka13UwQc6yuiPg=","X-Received":"by 2002:a2e:a595:: with SMTP id\n\tm21mr25345835ljp.372.1635234532547; \n\tTue, 26 Oct 2021 00:48:52 -0700 (PDT)","MIME-Version":"1.0","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>","In-Reply-To":"<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 26 Oct 2021 08:48:36 +0100","Message-ID":"<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000006fefc005cf3cb557\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20545,"web_url":"https://patchwork.libcamera.org/comment/20545/","msgid":"<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>","date":"2021-10-26T10:48:24","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nOn Tue, 26 Oct 2021 at 08:48, Naushir Patuck <naush@raspberrypi.com> wrote:\n\n> Hi Laurent,\n>\n> Thank you for your feedback.\n>\n> On Mon, 25 Oct 2021 at 14:58, Laurent Pinchart <\n> laurent.pinchart@ideasonboard.com> wrote:\n>\n>> Hi Naush,\n>>\n>> Thank you for the patch.\n>>\n>> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n>> > Add a BayerFormat::toPixelFormat() member function to convert a\n>> BayerFormat to a\n>> > PixelFormat type. This conversion uses the existing bayerToV4l2\n>> conversion\n>> > table.\n>> >\n>> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n>> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n>> > ---\n>> >  include/libcamera/internal/bayer_format.h |  3 +++\n>> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n>> >  2 files changed, 16 insertions(+)\n>> >\n>> > diff --git a/include/libcamera/internal/bayer_format.h\n>> b/include/libcamera/internal/bayer_format.h\n>> > index 723382d4168d..247a60cf0e36 100644\n>> > --- a/include/libcamera/internal/bayer_format.h\n>> > +++ b/include/libcamera/internal/bayer_format.h\n>> > @@ -10,6 +10,8 @@\n>> >  #include <stdint.h>\n>> >  #include <string>\n>> >\n>> > +#include <libcamera/pixel_format.h>\n>> > +\n>> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n>> >\n>> >  namespace libcamera {\n>> > @@ -50,6 +52,7 @@ public:\n>> >\n>> >       V4L2PixelFormat toV4L2PixelFormat() const;\n>> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat\n>> v4l2Format);\n>> > +     PixelFormat toPixelFormat() const;\n>> >       BayerFormat transform(Transform t) const;\n>> >\n>> >       Order order;\n>> > diff --git a/src/libcamera/bayer_format.cpp\n>> b/src/libcamera/bayer_format.cpp\n>> > index 11355f144f66..c662ba36604c 100644\n>> > --- a/src/libcamera/bayer_format.cpp\n>> > +++ b/src/libcamera/bayer_format.cpp\n>> > @@ -269,6 +269,19 @@ BayerFormat\n>> BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n>> >       return BayerFormat();\n>> >  }\n>> >\n>> > +/**\n>> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n>> > + * \\return The PixelFormat corresponding to this BayerFormat\n>> > + */\n>> > +PixelFormat BayerFormat::toPixelFormat() const\n>> > +{\n>> > +     const auto it = bayerToV4l2.find(*this);\n>> > +     if (it != bayerToV4l2.end())\n>> > +             return PixelFormat(it->second);\n>>\n>> Should we store the PixelFormat in the bayerToV4l2 map to avoid a double\n>> looking (one here, one in the PixelFormat constructor) ? The map should\n>> be renamed to bayerToFormat, and be stored as either\n>>\n>> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n>> BayerFormatComparator>\n>>\n>> or\n>>\n>> struct Formats {\n>>         PixelFormat pixelFormat;\n>>         V4L2PixelFormat v4l2Format;\n>> };\n>>\n>> std::map<BayerFormat, Formats, BayerFormatComparator>\n>>\n>\n> This seems reasonable.  I will update the table with a std::pair for 2-way\n> conversion.\n>\n\nUnfortunately this has hit an unexpected complication.  DRM formats, and\nsubsequently\nPixelFormat types do not define Mono Bayer formats.  The corresponding mbus\ncodes\nare MEDIA_BUS_FMT_Y8_1X8 and MEDIA_BUS_FMT_Y10_1X10.\n\nWould it be acceptable if the conversion regards these mono BayerFormat\ntypes as invalid\nPixelFormat types with a todo to add appropriate support in the future?\nMono sensor support\nis still usable as we go from mbus code -> V4L2 4CC correctly, but the\napplication can never\nrequest a mono output - which it can't do today anyway!\n\nNaush","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 B61AEBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Oct 2021 10:48:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 79AE160237;\n\tTue, 26 Oct 2021 12:48:42 +0200 (CEST)","from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com\n\t[IPv6:2a00:1450:4864:20::12b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52ADD60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Oct 2021 12:48:41 +0200 (CEST)","by mail-lf1-x12b.google.com with SMTP id bp15so18665995lfb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Oct 2021 03:48:41 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"WtKhh+Hz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=Adytu1MWajdo8z9SopyGldh7tSjEYFxErYJeptQiiuI=;\n\tb=WtKhh+HzaGLepao2nvlQAFZkH2C2ZRou+ZFS8R2Pzu51Qk2uV52hMro624fYiMoQ5d\n\tJoQitJxoy8zlR0RZS1Mg1zC8aMg/rTbPgvpuCo4GmeMufv2Prsqdth+b/bTuImYRhr0h\n\tjuvKRMnKnX30/ZthDnL8R4J4i5bqaaIzfENFkXD6yMS84N0jLOmcybRLkW4yh+213lSI\n\tnMKUgYAhq4zn3f/oxPFr1IQMpaQUe/ADOFd4r5HZKFMAa2aP39XQ5Xb62GtsN55f6qJj\n\t7hIRSXdllD1LvctnWM0OIcL4uoqiT26jBngc8NHIy5BVLH++UspU/Tr1GLHrAcZycKd8\n\tcYcw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=Adytu1MWajdo8z9SopyGldh7tSjEYFxErYJeptQiiuI=;\n\tb=4DmAUM5agqkZQd69PM9A69I/G4hwC/93rnArYwBaB/B5R7EgOEVJ2daKKWk/KEAeqT\n\t7ODHTZm5SRFNXutaWooc7xUBVlhaT5XI6diYGt7HVtPh2ZNXSKH8diIQuKrtIthfbRO3\n\tHryrYrzDLwb/tHXZiD8ucqKyZU/EDXWjZIycH0Kn0XrCdDA2stPhENtK+IyNmSs5gM6G\n\tlIaTb58O3vOZeW7d8WQpQVH0UuVMeE+lMqqfM2dX+Yn+d+k1DzXElBerbRKJmXqdNnPJ\n\tA+2nnzT5VVMI9DhGyvViuIhRyHjVaHBEM6XaouQMHR1UUXb0gwq12dzN0bvHO2XxagDG\n\ty2wA==","X-Gm-Message-State":"AOAM533ZKSWLHucVh6al3e/ZOB/MboB5Q0Gdmd6qSCCiuiztxJ2J6Ym5\n\tQ+ApYF5+hmc4u937dyNp/RmCuQQOknXMqmw4ooWc+g==","X-Google-Smtp-Source":"ABdhPJwf2hjDoEj7rvzvY6TS7UvckYyhzL5DQ/ruTeJa1HyGKFtV7PKdqqRNGymE5U+fpFQcvkGrS25jqrMqkFgyh7k=","X-Received":"by 2002:a05:6512:2118:: with SMTP id\n\tq24mr5239892lfr.315.1635245320492; \n\tTue, 26 Oct 2021 03:48:40 -0700 (PDT)","MIME-Version":"1.0","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>\n\t<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>","In-Reply-To":"<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 26 Oct 2021 11:48:24 +0100","Message-ID":"<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"00000000000072ecfa05cf3f385a\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20547,"web_url":"https://patchwork.libcamera.org/comment/20547/","msgid":"<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>","date":"2021-10-26T22:46:06","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Tue, Oct 26, 2021 at 11:48:24AM +0100, Naushir Patuck wrote:\n> On Tue, 26 Oct 2021 at 08:48, Naushir Patuck wrote:\n> > On Mon, 25 Oct 2021 at 14:58, Laurent Pinchart wrote:\n> >> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> >> > Add a BayerFormat::toPixelFormat() member function to convert a BayerFormat to a\n> >> > PixelFormat type. This conversion uses the existing bayerToV4l2 conversion\n> >> > table.\n> >> >\n> >> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> >> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> >> > ---\n> >> >  include/libcamera/internal/bayer_format.h |  3 +++\n> >> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n> >> >  2 files changed, 16 insertions(+)\n> >> >\n> >> > diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> >> > index 723382d4168d..247a60cf0e36 100644\n> >> > --- a/include/libcamera/internal/bayer_format.h\n> >> > +++ b/include/libcamera/internal/bayer_format.h\n> >> > @@ -10,6 +10,8 @@\n> >> >  #include <stdint.h>\n> >> >  #include <string>\n> >> >\n> >> > +#include <libcamera/pixel_format.h>\n> >> > +\n> >> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n> >> >\n> >> >  namespace libcamera {\n> >> > @@ -50,6 +52,7 @@ public:\n> >> >\n> >> >       V4L2PixelFormat toV4L2PixelFormat() const;\n> >> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n> >> > +     PixelFormat toPixelFormat() const;\n> >> >       BayerFormat transform(Transform t) const;\n> >> >\n> >> >       Order order;\n> >> > diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> >> > index 11355f144f66..c662ba36604c 100644\n> >> > --- a/src/libcamera/bayer_format.cpp\n> >> > +++ b/src/libcamera/bayer_format.cpp\n> >> > @@ -269,6 +269,19 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n> >> >       return BayerFormat();\n> >> >  }\n> >> >\n> >> > +/**\n> >> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> >> > + * \\return The PixelFormat corresponding to this BayerFormat\n> >> > + */\n> >> > +PixelFormat BayerFormat::toPixelFormat() const\n> >> > +{\n> >> > +     const auto it = bayerToV4l2.find(*this);\n> >> > +     if (it != bayerToV4l2.end())\n> >> > +             return PixelFormat(it->second);\n> >>\n> >> Should we store the PixelFormat in the bayerToV4l2 map to avoid a double\n> >> looking (one here, one in the PixelFormat constructor) ? The map should\n> >> be renamed to bayerToFormat, and be stored as either\n> >>\n> >> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n> >> BayerFormatComparator>\n> >>\n> >> or\n> >>\n> >> struct Formats {\n> >>         PixelFormat pixelFormat;\n> >>         V4L2PixelFormat v4l2Format;\n> >> };\n> >>\n> >> std::map<BayerFormat, Formats, BayerFormatComparator>\n> >\n> > This seems reasonable.  I will update the table with a std::pair for 2-way\n> > conversion.\n> \n> Unfortunately this has hit an unexpected complication. DRM formats, and subsequently\n> PixelFormat types do not define Mono Bayer formats. The corresponding mbus codes\n> are MEDIA_BUS_FMT_Y8_1X8 and MEDIA_BUS_FMT_Y10_1X10.\n\nDRM and V4L2 define greyscale formats (only 8-bit for DRM with\nDRM_FORMAT_R8, 10- and 12-bit formats could be easily added, and\nV4L2_PIX_FMT_GREY, V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 for V4L2).\nThey're not Bayer formats indeed, because Bayer filters are only for\ncolour formats.\n\nOn a side note, I think it was a historical mistake in V4L2 to add Bayer\nformats, we should have defined RAW8/10/12/14/16 formats with the CFA\npattern being carried out of band.\n\n> Would it be acceptable if the conversion regards these mono BayerFormat types as invalid\n> PixelFormat types with a todo to add appropriate support in the future? Mono sensor support\n> is still usable as we go from mbus code -> V4L2 4CC correctly, but the application can never\n> request a mono output - which it can't do today anyway!\n\nFor 8-bit I think you can simply use formats::R8. For 10- and 12-bit,\nwould https://git.libcamera.org/libcamera/pinchartl/libcamera.git/log/?h=simple/imx8\nhelp ?","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 B2879BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Oct 2021 22:46:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF7DC64881;\n\tWed, 27 Oct 2021 00:46:32 +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 A10B360125\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 00:46:30 +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 166AB596;\n\tWed, 27 Oct 2021 00:46:30 +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=\"BX+9nypJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635288390;\n\tbh=n7uM+T0TejwfE1nlflwayTqB5WpoA/U56R433DfYDws=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BX+9nypJSpKAxsGBceF1L93RD6wwKZmwYaN8I47bVKGOWejnMAgstIOdoCvnGhpIG\n\t5V0y6un5d59n1T7rgm71uIzyaIOHIJ8nxW7wrda1/fFj4z9aJUjy+oriCe2DJM86q1\n\tLD7m6zNq4MtynP78ijo11kXNTf4ctecVB+zcq03g=","Date":"Wed, 27 Oct 2021 01:46:06 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>\n\t<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>\n\t<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20548,"web_url":"https://patchwork.libcamera.org/comment/20548/","msgid":"<CAEmqJPqcYU+KTVxRugFVNwN8LR3ZHq06-7NksjOG-1kFN=vx8Q@mail.gmail.com>","date":"2021-10-27T07:26:19","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\n\nOn Tue, 26 Oct 2021 at 23:46, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On Tue, Oct 26, 2021 at 11:48:24AM +0100, Naushir Patuck wrote:\n> > On Tue, 26 Oct 2021 at 08:48, Naushir Patuck wrote:\n> > > On Mon, 25 Oct 2021 at 14:58, Laurent Pinchart wrote:\n> > >> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> > >> > Add a BayerFormat::toPixelFormat() member function to convert a\n> BayerFormat to a\n> > >> > PixelFormat type. This conversion uses the existing bayerToV4l2\n> conversion\n> > >> > table.\n> > >> >\n> > >> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > >> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > >> > ---\n> > >> >  include/libcamera/internal/bayer_format.h |  3 +++\n> > >> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n> > >> >  2 files changed, 16 insertions(+)\n> > >> >\n> > >> > diff --git a/include/libcamera/internal/bayer_format.h\n> b/include/libcamera/internal/bayer_format.h\n> > >> > index 723382d4168d..247a60cf0e36 100644\n> > >> > --- a/include/libcamera/internal/bayer_format.h\n> > >> > +++ b/include/libcamera/internal/bayer_format.h\n> > >> > @@ -10,6 +10,8 @@\n> > >> >  #include <stdint.h>\n> > >> >  #include <string>\n> > >> >\n> > >> > +#include <libcamera/pixel_format.h>\n> > >> > +\n> > >> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n> > >> >\n> > >> >  namespace libcamera {\n> > >> > @@ -50,6 +52,7 @@ public:\n> > >> >\n> > >> >       V4L2PixelFormat toV4L2PixelFormat() const;\n> > >> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat\n> v4l2Format);\n> > >> > +     PixelFormat toPixelFormat() const;\n> > >> >       BayerFormat transform(Transform t) const;\n> > >> >\n> > >> >       Order order;\n> > >> > diff --git a/src/libcamera/bayer_format.cpp\n> b/src/libcamera/bayer_format.cpp\n> > >> > index 11355f144f66..c662ba36604c 100644\n> > >> > --- a/src/libcamera/bayer_format.cpp\n> > >> > +++ b/src/libcamera/bayer_format.cpp\n> > >> > @@ -269,6 +269,19 @@ BayerFormat\n> BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n> > >> >       return BayerFormat();\n> > >> >  }\n> > >> >\n> > >> > +/**\n> > >> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> > >> > + * \\return The PixelFormat corresponding to this BayerFormat\n> > >> > + */\n> > >> > +PixelFormat BayerFormat::toPixelFormat() const\n> > >> > +{\n> > >> > +     const auto it = bayerToV4l2.find(*this);\n> > >> > +     if (it != bayerToV4l2.end())\n> > >> > +             return PixelFormat(it->second);\n> > >>\n> > >> Should we store the PixelFormat in the bayerToV4l2 map to avoid a\n> double\n> > >> looking (one here, one in the PixelFormat constructor) ? The map\n> should\n> > >> be renamed to bayerToFormat, and be stored as either\n> > >>\n> > >> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n> > >> BayerFormatComparator>\n> > >>\n> > >> or\n> > >>\n> > >> struct Formats {\n> > >>         PixelFormat pixelFormat;\n> > >>         V4L2PixelFormat v4l2Format;\n> > >> };\n> > >>\n> > >> std::map<BayerFormat, Formats, BayerFormatComparator>\n> > >\n> > > This seems reasonable.  I will update the table with a std::pair for\n> 2-way\n> > > conversion.\n> >\n> > Unfortunately this has hit an unexpected complication. DRM formats, and\n> subsequently\n> > PixelFormat types do not define Mono Bayer formats. The corresponding\n> mbus codes\n> > are MEDIA_BUS_FMT_Y8_1X8 and MEDIA_BUS_FMT_Y10_1X10.\n>\n> DRM and V4L2 define greyscale formats (only 8-bit for DRM with\n> DRM_FORMAT_R8, 10- and 12-bit formats could be easily added, and\n> V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 for V4L2).\n> They're not Bayer formats indeed, because Bayer filters are only for\n> colour formats.\n>\n\nI did sport the DRM_FORMAT_R8, but the comment of \"/* 8 bpp Red */\" make me\nthink it was not entirely correct to use that for mono sensors.  However, I\nam happy to do\nso now that you have suggested it :-)\n\n\n>\n> On a side note, I think it was a historical mistake in V4L2 to add Bayer\n> formats, we should have defined RAW8/10/12/14/16 formats with the CFA\n> pattern being carried out of band.\n>\n> > Would it be acceptable if the conversion regards these mono BayerFormat\n> types as invalid\n> > PixelFormat types with a todo to add appropriate support in the future?\n> Mono sensor support\n> > is still usable as we go from mbus code -> V4L2 4CC correctly, but the\n> application can never\n> > request a mono output - which it can't do today anyway!\n>\n> For 8-bit I think you can simply use formats::R8. For 10- and 12-bit,\n> would\n> https://git.libcamera.org/libcamera/pinchartl/libcamera.git/log/?h=simple/imx8\n> help ?\n>\n\nYes it would! I am happy to cherry-pick commits 26f0ce03 and 940d4df4 that\nadd R10 and R12 formats\nto this series if you like?\n\nThanks,\nNaush\n\n\n> --\n> Regards,\n>\n> Laurent Pinchart\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 23D3FBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 07:26:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 20FD664883;\n\tWed, 27 Oct 2021 09:26:39 +0200 (CEST)","from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com\n\t[IPv6:2a00:1450:4864:20::12b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C2AC060122\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 09:26:36 +0200 (CEST)","by mail-lf1-x12b.google.com with SMTP id j9so4179378lfu.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 00:26:36 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"t6IXTm66\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=2fh7s+gimaB3Pv1nS6xC0JPHXBUMtu8OD6R5alHo+5Y=;\n\tb=t6IXTm66is4NG52lTHxLAYiX4eGrg+XMFPWWo2X8a5CBlud71+JgGizCs0P1TIFBFI\n\tmI0l/Hpkj5ZGC7UjW537dBdRYEKT3R/sc5/twIPbhkaSNZp4pJNQmxY6mcVQmGztNN37\n\twUHMBZS5emymcbVbSr2whrz0P4Hbqu0DFoXGcMKxha388WvZ3yZNKVSfRZW+75HdqwnB\n\t5eCdw5/yFHEDKKFbIh/N/kQMaPhwED4d8XE6ouimX4Vu0n0uidvXGiY/rinF8u2Qo1t4\n\tOiVDgQrLov9MnOAv9qaDeMEs4Gc94dMnpHSC6td7JmD+r/XaYfSqy+o0o2r/2x/X78L0\n\trj8w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=2fh7s+gimaB3Pv1nS6xC0JPHXBUMtu8OD6R5alHo+5Y=;\n\tb=Tl07uNdNRGN7FzZw6Sss6oipdFStXqebjyykEQTAAwx38effhCHiVgG1I3KciFrW55\n\tsC35iZSAZ8x0jFvdkFY7hyF/0RYdf41Z/NjVInoVzq/gyex7o2efuJTx367uCvHzYKJ6\n\tS+gYgEeAB1RG0YKo4oLTfP21B72YrnH5iOoRBnp7/ViOYsQY/uHGKdkERjlOtxOzI8Y8\n\t32Lp1Wa50eL4GxP7vYsuQJ7NuU4ROgzX5c4PwivzBcfl7MWo12RRL/8uhAvdDd7ttLW4\n\ta36O+SXEOBGJzWOHDpBuUJceiZPp8/Egax065zVPkO1HXo2A8FpbBhy4e44918paVo/N\n\tM0HQ==","X-Gm-Message-State":"AOAM5321kFQdz+/rbaXh97249zXHMVhYwCCLzrA+yeyfJjp4a/Y6S1Kc\n\tL1JbmAtlYx15dZHG7Ug2icBnSq+r8cVlHx7FNQAAAHRkLq9oMeR0","X-Google-Smtp-Source":"ABdhPJxpYXEhJOPLDusk/sFGV0I/3YZUx65zDqqfQ5xe2qiBaNlcCvCX4VHyz4E3TRNw3CSK75jK94NroY13pRZQaj8=","X-Received":"by 2002:a19:ad0d:: with SMTP id\n\tt13mr28434399lfc.161.1635319595645; \n\tWed, 27 Oct 2021 00:26:35 -0700 (PDT)","MIME-Version":"1.0","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>\n\t<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>\n\t<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>\n\t<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>","In-Reply-To":"<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 27 Oct 2021 08:26:19 +0100","Message-ID":"<CAEmqJPqcYU+KTVxRugFVNwN8LR3ZHq06-7NksjOG-1kFN=vx8Q@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"00000000000097d53a05cf508314\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20549,"web_url":"https://patchwork.libcamera.org/comment/20549/","msgid":"<YXkQnOpzyIWnFKw3@pendragon.ideasonboard.com>","date":"2021-10-27T08:41:00","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Wed, Oct 27, 2021 at 08:26:19AM +0100, Naushir Patuck wrote:\n> On Tue, 26 Oct 2021 at 23:46, Laurent Pinchart wrote:\n> > On Tue, Oct 26, 2021 at 11:48:24AM +0100, Naushir Patuck wrote:\n> > > On Tue, 26 Oct 2021 at 08:48, Naushir Patuck wrote:\n> > > > On Mon, 25 Oct 2021 at 14:58, Laurent Pinchart wrote:\n> > > >> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> > > >> > Add a BayerFormat::toPixelFormat() member function to convert a BayerFormat to a\n> > > >> > PixelFormat type. This conversion uses the existing bayerToV4l2 conversion\n> > > >> > table.\n> > > >> >\n> > > >> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > >> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > > >> > ---\n> > > >> >  include/libcamera/internal/bayer_format.h |  3 +++\n> > > >> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n> > > >> >  2 files changed, 16 insertions(+)\n> > > >> >\n> > > >> > diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> > > >> > index 723382d4168d..247a60cf0e36 100644\n> > > >> > --- a/include/libcamera/internal/bayer_format.h\n> > > >> > +++ b/include/libcamera/internal/bayer_format.h\n> > > >> > @@ -10,6 +10,8 @@\n> > > >> >  #include <stdint.h>\n> > > >> >  #include <string>\n> > > >> >\n> > > >> > +#include <libcamera/pixel_format.h>\n> > > >> > +\n> > > >> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n> > > >> >\n> > > >> >  namespace libcamera {\n> > > >> > @@ -50,6 +52,7 @@ public:\n> > > >> >\n> > > >> >       V4L2PixelFormat toV4L2PixelFormat() const;\n> > > >> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n> > > >> > +     PixelFormat toPixelFormat() const;\n> > > >> >       BayerFormat transform(Transform t) const;\n> > > >> >\n> > > >> >       Order order;\n> > > >> > diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> > > >> > index 11355f144f66..c662ba36604c 100644\n> > > >> > --- a/src/libcamera/bayer_format.cpp\n> > > >> > +++ b/src/libcamera/bayer_format.cpp\n> > > >> > @@ -269,6 +269,19 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n> > > >> >       return BayerFormat();\n> > > >> >  }\n> > > >> >\n> > > >> > +/**\n> > > >> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> > > >> > + * \\return The PixelFormat corresponding to this BayerFormat\n> > > >> > + */\n> > > >> > +PixelFormat BayerFormat::toPixelFormat() const\n> > > >> > +{\n> > > >> > +     const auto it = bayerToV4l2.find(*this);\n> > > >> > +     if (it != bayerToV4l2.end())\n> > > >> > +             return PixelFormat(it->second);\n> > > >>\n> > > >> Should we store the PixelFormat in the bayerToV4l2 map to avoid a double\n> > > >> looking (one here, one in the PixelFormat constructor) ? The map should\n> > > >> be renamed to bayerToFormat, and be stored as either\n> > > >>\n> > > >> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n> > > >> BayerFormatComparator>\n> > > >>\n> > > >> or\n> > > >>\n> > > >> struct Formats {\n> > > >>         PixelFormat pixelFormat;\n> > > >>         V4L2PixelFormat v4l2Format;\n> > > >> };\n> > > >>\n> > > >> std::map<BayerFormat, Formats, BayerFormatComparator>\n> > > >\n> > > > This seems reasonable.  I will update the table with a std::pair for 2-way\n> > > > conversion.\n> > >\n> > > Unfortunately this has hit an unexpected complication. DRM formats, and subsequently\n> > > PixelFormat types do not define Mono Bayer formats. The corresponding mbus codes\n> > > are MEDIA_BUS_FMT_Y8_1X8 and MEDIA_BUS_FMT_Y10_1X10.\n> >\n> > DRM and V4L2 define greyscale formats (only 8-bit for DRM with\n> > DRM_FORMAT_R8, 10- and 12-bit formats could be easily added, and\n> > V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 for V4L2).\n> > They're not Bayer formats indeed, because Bayer filters are only for\n> > colour formats.\n> \n> I did sport the DRM_FORMAT_R8, but the comment of \"/* 8 bpp Red */\" make me\n> think it was not entirely correct to use that for mono sensors.  However, I\n> am happy to do so now that you have suggested it :-)\n\nThe naming is a bit unfortunate, it comes from OpenGL I think.\n\n> > On a side note, I think it was a historical mistake in V4L2 to add Bayer\n> > formats, we should have defined RAW8/10/12/14/16 formats with the CFA\n> > pattern being carried out of band.\n> >\n> > > Would it be acceptable if the conversion regards these mono BayerFormat types as invalid\n> > > PixelFormat types with a todo to add appropriate support in the future? Mono sensor support\n> > > is still usable as we go from mbus code -> V4L2 4CC correctly, but the application can never\n> > > request a mono output - which it can't do today anyway!\n> >\n> > For 8-bit I think you can simply use formats::R8. For 10- and 12-bit, would\n> > https://git.libcamera.org/libcamera/pinchartl/libcamera.git/log/?h=simple/imx8\n> > help ?\n> \n> Yes it would! I am happy to cherry-pick commits 26f0ce03 and 940d4df4 that add R10 and R12 formats\n> to this series if you like?\n\nFine with me. I need to send the first patch to the dri-devel mailing\nlist, I'll try to do that today.","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 14C26BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 08:41:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C11F64881;\n\tWed, 27 Oct 2021 10:41:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2853760122\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 10:41:24 +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 B35D7596;\n\tWed, 27 Oct 2021 10:41:23 +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=\"mHPaoqc5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635324083;\n\tbh=cb7M1hgsGXNzGsMSq6OHCE6g5IvvwzZu1iXGS6bTc1E=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mHPaoqc5IkXK0+zgcqkQ3day3RZBp+IxqM7lGNJFteFxBegB/q7s3LJhPTg+L8qQr\n\tPcSZrP5CGG5yyScze/ZbhqPCHH7eG8/erT8tBQ2fgac9NqYlgS803dZObS/pPDPI6d\n\tb31boFSppPixCi3RQZvbdO968utsjE2X7AI2VgqY=","Date":"Wed, 27 Oct 2021 11:41:00 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YXkQnOpzyIWnFKw3@pendragon.ideasonboard.com>","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>\n\t<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>\n\t<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>\n\t<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>\n\t<CAEmqJPqcYU+KTVxRugFVNwN8LR3ZHq06-7NksjOG-1kFN=vx8Q@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPqcYU+KTVxRugFVNwN8LR3ZHq06-7NksjOG-1kFN=vx8Q@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20597,"web_url":"https://patchwork.libcamera.org/comment/20597/","msgid":"<YXniRJjcZSzYp53f@pendragon.ideasonboard.com>","date":"2021-10-27T23:35:32","subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Oct 27, 2021 at 11:41:02AM +0300, Laurent Pinchart wrote:\n> On Wed, Oct 27, 2021 at 08:26:19AM +0100, Naushir Patuck wrote:\n> > On Tue, 26 Oct 2021 at 23:46, Laurent Pinchart wrote:\n> > > On Tue, Oct 26, 2021 at 11:48:24AM +0100, Naushir Patuck wrote:\n> > > > On Tue, 26 Oct 2021 at 08:48, Naushir Patuck wrote:\n> > > > > On Mon, 25 Oct 2021 at 14:58, Laurent Pinchart wrote:\n> > > > >> On Fri, Oct 22, 2021 at 03:39:02PM +0100, Naushir Patuck wrote:\n> > > > >> > Add a BayerFormat::toPixelFormat() member function to convert a BayerFormat to a\n> > > > >> > PixelFormat type. This conversion uses the existing bayerToV4l2 conversion\n> > > > >> > table.\n> > > > >> >\n> > > > >> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > >> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > > > >> > ---\n> > > > >> >  include/libcamera/internal/bayer_format.h |  3 +++\n> > > > >> >  src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n> > > > >> >  2 files changed, 16 insertions(+)\n> > > > >> >\n> > > > >> > diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> > > > >> > index 723382d4168d..247a60cf0e36 100644\n> > > > >> > --- a/include/libcamera/internal/bayer_format.h\n> > > > >> > +++ b/include/libcamera/internal/bayer_format.h\n> > > > >> > @@ -10,6 +10,8 @@\n> > > > >> >  #include <stdint.h>\n> > > > >> >  #include <string>\n> > > > >> >\n> > > > >> > +#include <libcamera/pixel_format.h>\n> > > > >> > +\n> > > > >> >  #include \"libcamera/internal/v4l2_pixelformat.h\"\n> > > > >> >\n> > > > >> >  namespace libcamera {\n> > > > >> > @@ -50,6 +52,7 @@ public:\n> > > > >> >\n> > > > >> >       V4L2PixelFormat toV4L2PixelFormat() const;\n> > > > >> >       static BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n> > > > >> > +     PixelFormat toPixelFormat() const;\n> > > > >> >       BayerFormat transform(Transform t) const;\n> > > > >> >\n> > > > >> >       Order order;\n> > > > >> > diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> > > > >> > index 11355f144f66..c662ba36604c 100644\n> > > > >> > --- a/src/libcamera/bayer_format.cpp\n> > > > >> > +++ b/src/libcamera/bayer_format.cpp\n> > > > >> > @@ -269,6 +269,19 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n> > > > >> >       return BayerFormat();\n> > > > >> >  }\n> > > > >> >\n> > > > >> > +/**\n> > > > >> > + * \\brief Convert a BayerFormat into the corresponding PixelFormat\n> > > > >> > + * \\return The PixelFormat corresponding to this BayerFormat\n> > > > >> > + */\n> > > > >> > +PixelFormat BayerFormat::toPixelFormat() const\n> > > > >> > +{\n> > > > >> > +     const auto it = bayerToV4l2.find(*this);\n> > > > >> > +     if (it != bayerToV4l2.end())\n> > > > >> > +             return PixelFormat(it->second);\n> > > > >>\n> > > > >> Should we store the PixelFormat in the bayerToV4l2 map to avoid a double\n> > > > >> looking (one here, one in the PixelFormat constructor) ? The map should\n> > > > >> be renamed to bayerToFormat, and be stored as either\n> > > > >>\n> > > > >> std::map<BayerFormat, std::pair<PixelFormat, V4L2PixelFormat>,\n> > > > >> BayerFormatComparator>\n> > > > >>\n> > > > >> or\n> > > > >>\n> > > > >> struct Formats {\n> > > > >>         PixelFormat pixelFormat;\n> > > > >>         V4L2PixelFormat v4l2Format;\n> > > > >> };\n> > > > >>\n> > > > >> std::map<BayerFormat, Formats, BayerFormatComparator>\n> > > > >\n> > > > > This seems reasonable.  I will update the table with a std::pair for 2-way\n> > > > > conversion.\n> > > >\n> > > > Unfortunately this has hit an unexpected complication. DRM formats, and subsequently\n> > > > PixelFormat types do not define Mono Bayer formats. The corresponding mbus codes\n> > > > are MEDIA_BUS_FMT_Y8_1X8 and MEDIA_BUS_FMT_Y10_1X10.\n> > >\n> > > DRM and V4L2 define greyscale formats (only 8-bit for DRM with\n> > > DRM_FORMAT_R8, 10- and 12-bit formats could be easily added, and\n> > > V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 for V4L2).\n> > > They're not Bayer formats indeed, because Bayer filters are only for\n> > > colour formats.\n> > \n> > I did sport the DRM_FORMAT_R8, but the comment of \"/* 8 bpp Red */\" make me\n> > think it was not entirely correct to use that for mono sensors.  However, I\n> > am happy to do so now that you have suggested it :-)\n> \n> The naming is a bit unfortunate, it comes from OpenGL I think.\n> \n> > > On a side note, I think it was a historical mistake in V4L2 to add Bayer\n> > > formats, we should have defined RAW8/10/12/14/16 formats with the CFA\n> > > pattern being carried out of band.\n> > >\n> > > > Would it be acceptable if the conversion regards these mono BayerFormat types as invalid\n> > > > PixelFormat types with a todo to add appropriate support in the future? Mono sensor support\n> > > > is still usable as we go from mbus code -> V4L2 4CC correctly, but the application can never\n> > > > request a mono output - which it can't do today anyway!\n> > >\n> > > For 8-bit I think you can simply use formats::R8. For 10- and 12-bit, would\n> > > https://git.libcamera.org/libcamera/pinchartl/libcamera.git/log/?h=simple/imx8\n> > > help ?\n> > \n> > Yes it would! I am happy to cherry-pick commits 26f0ce03 and 940d4df4 that add R10 and R12 formats\n> > to this series if you like?\n> \n> Fine with me. I need to send the first patch to the dri-devel mailing\n> list, I'll try to do that today.\n\nhttps://lore.kernel.org/dri-devel/20211027233140.12268-1-laurent.pinchart@ideasonboard.com/T/#u","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 12B19BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 23:35:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C35426000B;\n\tThu, 28 Oct 2021 01:35:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 879F360006\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 01:35:56 +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 1419493;\n\tThu, 28 Oct 2021 01:35:56 +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=\"fGYX+Nb6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635377756;\n\tbh=3AohPMy/a7XsYtDow8Tli1ddn1WyFcLpDLYi7W6/VSA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fGYX+Nb6/XpaxRecWoSBjYzzNBm5cOKUQCSsCpyLitde4XRj/xKFnPhdZOEq7+bPe\n\tFCDHprf5eqGJsQ1cLGMir5puGRR88HCTX1+eiQMDltPVp3mtmnyTvvYX7gl+T+d25y\n\t9Vi2GX9NxpMmdy9B4t+OZvT029icfqXIlD+QEvyo=","Date":"Thu, 28 Oct 2021 02:35:32 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YXniRJjcZSzYp53f@pendragon.ideasonboard.com>","References":"<20211022143907.3089419-1-naush@raspberrypi.com>\n\t<20211022143907.3089419-2-naush@raspberrypi.com>\n\t<YXa387lwYc/+A1Na@pendragon.ideasonboard.com>\n\t<CAEmqJPq2mBqA24QUEKcuXhZ3L61UwZn_nSMU26zTUUdqD5+2Zg@mail.gmail.com>\n\t<CAEmqJPruLxbFUKWQ1QnsNf8p4StS+1qWCSDyRMnt01K30ump3g@mail.gmail.com>\n\t<YXiFLuAfCuKg+OTZ@pendragon.ideasonboard.com>\n\t<CAEmqJPqcYU+KTVxRugFVNwN8LR3ZHq06-7NksjOG-1kFN=vx8Q@mail.gmail.com>\n\t<YXkQnOpzyIWnFKw3@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YXkQnOpzyIWnFKw3@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]