[{"id":35079,"web_url":"https://patchwork.libcamera.org/comment/35079/","msgid":"<175334361127.560048.15955071034672998757@ping.linuxembedded.co.uk>","date":"2025-07-24T07:53:31","subject":"Re: [PATCH 03/10] libcamera: bayer_format: Add \"NONE\" to\n\tBayerFormat::Order enum","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2025-07-24 07:52:49)\n> Add a NONE entry to BayerFormat::Order enumeration to denote pixel\n> formats encoding bayer data but which do not correspond to a specific\n> order.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  include/libcamera/internal/bayer_format.h     | 3 ++-\n>  src/libcamera/bayer_format.cpp                | 3 +++\n>  src/libcamera/sensor/camera_sensor_legacy.cpp | 6 ++++++\n>  3 files changed, 11 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> index 5c14bb5f..9b6b5b58 100644\n> --- a/include/libcamera/internal/bayer_format.h\n> +++ b/include/libcamera/internal/bayer_format.h\n> @@ -27,7 +27,8 @@ public:\n>                 GBRG = 1,\n>                 GRBG = 2,\n>                 RGGB = 3,\n> -               MONO = 4\n> +               MONO = 4,\n> +               NONE = 5\n>         };\n>  \n>         enum class Packing : uint16_t {\n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index 3dab91fc..89fe10ed 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -49,6 +49,9 @@ namespace libcamera {\n>   * \\brief R then G on the first row, G then B on the second row.\n>   * \\var BayerFormat::MONO\n>   * \\brief Monochrome image data, there is no colour filter array.\n> + * \\var BayerFormat::NONE\n> + * \\brief Bayer-formatted data but without a specific order, which will have to\n> + * be discerned through other means.\n>   */\n>  \n>  /**\n> diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> index 32989c19..232a8525 100644\n> --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n> +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> @@ -641,6 +641,12 @@ int CameraSensorLegacy::initProperties()\n>                 case BayerFormat::MONO:\n>                         cfa = properties::draft::MONO;\n>                         break;\n> +               case BayerFormat::NONE:\n> +                       LOG(CameraSensor, Warning)\n\nMaybe this should be Error then ?\n\n> +                               << \"Sensor declares no CFA pattern. This is extremely unlikely \"\n> +                               << \"and should be investigated as a likely error.\";\n> +                       cfa = properties::draft::MONO;\n> +                       break;\n\nAnd as far as things go for things that can't happen it looks like a\nsafe way to continue.\n\nIf it could only represent a development time bug - we could make it\nFatal ... but I think this is good.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>                 }\n>  \n>                 properties_.set(properties::draft::ColorFilterArrangement, cfa);\n> -- \n> 2.30.2\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 6820AC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Jul 2025 07:53:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0915E690AA;\n\tThu, 24 Jul 2025 09:53:36 +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 3D7316909B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jul 2025 09:53:34 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5E678C79;\n\tThu, 24 Jul 2025 09:52:55 +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=\"HgsFErX5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753343575;\n\tbh=itfWomPRNTkrH2bJwxotqBWQqDe3SQ7OUveOxO+MlMk=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=HgsFErX58tmYnx7/tYlPONeVSbTMgfpH/JHawLibHlbXBN+nD2O74g10hVBl2RUFB\n\t5nbbG7TmH8VK3BGUBLRGtP2UVPRqNUf8hVM4fwD54H0fYS28FpdeSDVmgQ2c5L3JeT\n\t9rTPrXEFwRr4nYB2elLtKTcD9hWY4+4uq1K66e0s=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250724065256.75175-4-dan.scally@ideasonboard.com>","References":"<20250724065256.75175-1-dan.scally@ideasonboard.com>\n\t<20250724065256.75175-4-dan.scally@ideasonboard.com>","Subject":"Re: [PATCH 03/10] libcamera: bayer_format: Add \"NONE\" to\n\tBayerFormat::Order enum","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 24 Jul 2025 08:53:31 +0100","Message-ID":"<175334361127.560048.15955071034672998757@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":37213,"web_url":"https://patchwork.libcamera.org/comment/37213/","msgid":"<jb2vwio7zeouyyzenz7mrlj27hl42x47lyto2stwg5eksoofex@33pk7tiktnlq>","date":"2025-12-04T16:38:04","subject":"Re: [PATCH 03/10] libcamera: bayer_format: Add \"NONE\" to\n\tBayerFormat::Order enum","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Kieran, Dan\n\nOn Thu, Jul 24, 2025 at 08:53:31AM +0100, Kieran Bingham wrote:\n> Quoting Daniel Scally (2025-07-24 07:52:49)\n> > Add a NONE entry to BayerFormat::Order enumeration to denote pixel\n> > formats encoding bayer data but which do not correspond to a specific\n> > order.\n> >\n> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> > ---\n> >  include/libcamera/internal/bayer_format.h     | 3 ++-\n> >  src/libcamera/bayer_format.cpp                | 3 +++\n> >  src/libcamera/sensor/camera_sensor_legacy.cpp | 6 ++++++\n> >  3 files changed, 11 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> > index 5c14bb5f..9b6b5b58 100644\n> > --- a/include/libcamera/internal/bayer_format.h\n> > +++ b/include/libcamera/internal/bayer_format.h\n> > @@ -27,7 +27,8 @@ public:\n> >                 GBRG = 1,\n> >                 GRBG = 2,\n> >                 RGGB = 3,\n> > -               MONO = 4\n> > +               MONO = 4,\n> > +               NONE = 5\n> >         };\n> >\n> >         enum class Packing : uint16_t {\n> > diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> > index 3dab91fc..89fe10ed 100644\n> > --- a/src/libcamera/bayer_format.cpp\n> > +++ b/src/libcamera/bayer_format.cpp\n> > @@ -49,6 +49,9 @@ namespace libcamera {\n> >   * \\brief R then G on the first row, G then B on the second row.\n> >   * \\var BayerFormat::MONO\n> >   * \\brief Monochrome image data, there is no colour filter array.\n> > + * \\var BayerFormat::NONE\n> > + * \\brief Bayer-formatted data but without a specific order, which will have to\n> > + * be discerned through other means.\n> >   */\n> >\n> >  /**\n> > diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> > index 32989c19..232a8525 100644\n> > --- a/src/libcamera/sensor/camera_sensor_legacy.cpp\n> > +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp\n> > @@ -641,6 +641,12 @@ int CameraSensorLegacy::initProperties()\n> >                 case BayerFormat::MONO:\n> >                         cfa = properties::draft::MONO;\n> >                         break;\n> > +               case BayerFormat::NONE:\n> > +                       LOG(CameraSensor, Warning)\n>\n> Maybe this should be Error then ?\n>\n> > +                               << \"Sensor declares no CFA pattern. This is extremely unlikely \"\n> > +                               << \"and should be investigated as a likely error.\";\n> > +                       cfa = properties::draft::MONO;\n> > +                       break;\n>\n> And as far as things go for things that can't happen it looks like a\n> safe way to continue.\n>\n> If it could only represent a development time bug - we could make it\n> Fatal ... but I think this is good.\n\nI think the reasoning is that generic RAW bayer formats will only be\nused by sensor drivers supporting the long-awaited RAW camera sensor\nmodel.\n\nIf a \"legacy\" driver (one that doesn't register an INTERNAL pad) reports\na generic RAW format, this is likely an error that shouldn't happen for a\nmainline sensor driver. However, downstream drivers can get this\nwrong, so I guess we should report this loudly, but not abort\ncompletely.\n\nIs s/Warning/Error a good compromise here ?\n>\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >                 }\n> >\n> >                 properties_.set(properties::draft::ColorFilterArrangement, cfa);\n> > --\n> > 2.30.2\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 6EAFCC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Dec 2025 16:38:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF1B7610B3;\n\tThu,  4 Dec 2025 17:38:09 +0100 (CET)","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 3EC33609E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Dec 2025 17:38:08 +0100 (CET)","from ideasonboard.com (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 79B72C9;\n\tThu,  4 Dec 2025 17:35:52 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Afqh6CDV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764866152;\n\tbh=QJFNWhpJ4IW4AK8NynG667940K4DzN8SwmHRXG5egHs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Afqh6CDVL5fWiNBJmnfRB6J+d2h5Bwl6lNFrobmiNdxqVmmW7vsaPxx9TRWGLm4ma\n\thn3C0l84KqXH0zUG+rCwDpuUQwhHUwx4AwuJUbSP63LbGFPlsJAnNx4UpbyqaeQeBo\n\thUsnB0T6SkqYzAZqcGcUDGZL3IgCZKlSALXsbRpw=","Date":"Thu, 4 Dec 2025 17:38:04 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 03/10] libcamera: bayer_format: Add \"NONE\" to\n\tBayerFormat::Order enum","Message-ID":"<jb2vwio7zeouyyzenz7mrlj27hl42x47lyto2stwg5eksoofex@33pk7tiktnlq>","References":"<20250724065256.75175-1-dan.scally@ideasonboard.com>\n\t<20250724065256.75175-4-dan.scally@ideasonboard.com>\n\t<175334361127.560048.15955071034672998757@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<175334361127.560048.15955071034672998757@ping.linuxembedded.co.uk>","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>"}}]