[{"id":30253,"web_url":"https://patchwork.libcamera.org/comment/30253/","msgid":"<ZoU2GlcHBQNNxShr@pyrite.rasen.tech>","date":"2024-07-03T11:29:30","subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Wed, Jul 03, 2024 at 12:39:51PM +0200, Stefan Klug wrote:\n> Add sensor black levels to the metadata of the rkisp1 pipeline.\n> \n> Additionally enable raw support for this algorithm and add it to\n> uncalibrated.yaml, so that black levels get reported when capturing\n> tuning images. This is a bit of a hack, because no actual black level\n> correction is taking place in raw mode, but it is the easiest way to get\n> blacklevel reported for raw streams.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/blc.cpp     | 28 +++++++++++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n>  src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n>  3 files changed, 33 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> index 87025e4f8c72..71c62b009707 100644\n> --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> @@ -9,6 +9,8 @@\n>  \n>  #include <libcamera/base/log.h>\n>  \n> +#include <libcamera/control_ids.h>\n> +\n>  #include \"libcamera/internal/yaml_parser.h\"\n>  \n>  /**\n> @@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n>  BlackLevelCorrection::BlackLevelCorrection()\n>  \t: tuningParameters_(false)\n>  {\n> +\t/*\n> +\t * This is a bit of a hack. In raw mode no black level correction\n> +\t * happens. This flag is used to ensure the metadata gets populated with\n> +\t * the black level which is needed to capture proper raw images for\n> +\t * tuning.\n> +\t */\n> +\tsupportsRaw_ = true;\n>  }\n>  \n>  /**\n> @@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n>  \t\t\t\t   [[maybe_unused]] IPAFrameContext &frameContext,\n>  \t\t\t\t   rkisp1_params_cfg *params)\n>  {\n> +\tif (context.configuration.raw)\n> +\t\treturn;\n> +\n>  \tif (frame > 0)\n>  \t\treturn;\n>  \n> @@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n>  \tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n>  }\n>  \n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::process\n> + */\n> +void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n> +\t\t\t\t   [[maybe_unused]] const uint32_t frame,\n> +\t\t\t\t   [[maybe_unused]] IPAFrameContext &frameContext,\n> +\t\t\t\t   [[maybe_unused]] const rkisp1_stat_buffer *stats,\n> +\t\t\t\t   [[maybe_unused]] ControlList &metadata)\n> +{\n> +\tmetadata.set(controls::SensorBlackLevels,\n> +\t\t     { static_cast<int32_t>(blackLevelRed_),\n> +\t\t       static_cast<int32_t>(blackLevelGreenR_),\n> +\t\t       static_cast<int32_t>(blackLevelGreenB_),\n> +\t\t       static_cast<int32_t>(blackLevelBlue_) });\n> +}\n> +\n>  REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n>  \n>  } /* namespace ipa::rkisp1::algorithms */\n> diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\n> index 460ebcc15739..4ecac233f88b 100644\n> --- a/src/ipa/rkisp1/algorithms/blc.h\n> +++ b/src/ipa/rkisp1/algorithms/blc.h\n> @@ -23,7 +23,10 @@ public:\n>  \tvoid prepare(IPAContext &context, const uint32_t frame,\n>  \t\t     IPAFrameContext &frameContext,\n>  \t\t     rkisp1_params_cfg *params) override;\n> -\n> +\tvoid process(IPAContext &context, const uint32_t frame,\n> +\t\t     IPAFrameContext &frameContext,\n> +\t\t     const rkisp1_stat_buffer *stats,\n> +\t\t     ControlList &metadata) override;\n>  private:\n>  \tbool tuningParameters_;\n>  \tint16_t blackLevelRed_;\n> diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\n> index a7bbd8d84263..609012967e02 100644\n> --- a/src/ipa/rkisp1/data/uncalibrated.yaml\n> +++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n> @@ -5,4 +5,5 @@ version: 1\n>  algorithms:\n>    - Agc:\n>    - Awb:\n> +  - BlackLevelCorrection:\n>  ...\n> -- \n> 2.43.0\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 72184BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 11:29:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 703D162E27;\n\tWed,  3 Jul 2024 13:29:38 +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 0484662C99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 13:29:36 +0200 (CEST)","from pyrite.rasen.tech (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E9BC14CA;\n\tWed,  3 Jul 2024 13:29:07 +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=\"pbWAn2zX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720006148;\n\tbh=D+ol97G4UzDavwtp/knIHlPPQg/jDJR0ViNGNSTkjYo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pbWAn2zXeJl4O6/+eQ+hr/0RR5M7VYkNwN9tIoWieylrOT4aC0qHyh5xcJp4g76B0\n\tl0eGsaSBe2RVwa02QyNJyN5tiXiRhB+T9cF/oRTMEbdDdoX+iiDnZQ3FrkwDMSMBqp\n\t85jSCoMHk0U8MqGxUAhFZ6oRi2Ypmyf9OWAYfwh0=","Date":"Wed, 3 Jul 2024 20:29:30 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","Message-ID":"<ZoU2GlcHBQNNxShr@pyrite.rasen.tech>","References":"<20240703104004.184783-1-stefan.klug@ideasonboard.com>\n\t<20240703104004.184783-5-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240703104004.184783-5-stefan.klug@ideasonboard.com>","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":30256,"web_url":"https://patchwork.libcamera.org/comment/30256/","msgid":"<172000895542.3353312.2287624000234476924@ping.linuxembedded.co.uk>","date":"2024-07-03T12:15:55","subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-07-03 11:39:51)\n> Add sensor black levels to the metadata of the rkisp1 pipeline.\n> \n> Additionally enable raw support for this algorithm and add it to\n> uncalibrated.yaml, so that black levels get reported when capturing\n> tuning images. This is a bit of a hack, because no actual black level\n> correction is taking place in raw mode, but it is the easiest way to get\n> blacklevel reported for raw streams.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/blc.cpp     | 28 +++++++++++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n>  src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n>  3 files changed, 33 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> index 87025e4f8c72..71c62b009707 100644\n> --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> @@ -9,6 +9,8 @@\n>  \n>  #include <libcamera/base/log.h>\n>  \n> +#include <libcamera/control_ids.h>\n> +\n>  #include \"libcamera/internal/yaml_parser.h\"\n>  \n>  /**\n> @@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n>  BlackLevelCorrection::BlackLevelCorrection()\n>         : tuningParameters_(false)\n>  {\n> +       /*\n> +        * This is a bit of a hack. In raw mode no black level correction\n> +        * happens. This flag is used to ensure the metadata gets populated with\n> +        * the black level which is needed to capture proper raw images for\n> +        * tuning.\n> +        */\n> +       supportsRaw_ = true;\n>  }\n>  \n>  /**\n> @@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n>                                    [[maybe_unused]] IPAFrameContext &frameContext,\n>                                    rkisp1_params_cfg *params)\n>  {\n> +       if (context.configuration.raw)\n> +               return;\n> +\n>         if (frame > 0)\n>                 return;\n>  \n> @@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n>         params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n>  }\n>  \n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::process\n> + */\n> +void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n> +                                  [[maybe_unused]] const uint32_t frame,\n> +                                  [[maybe_unused]] IPAFrameContext &frameContext,\n> +                                  [[maybe_unused]] const rkisp1_stat_buffer *stats,\n> +                                  [[maybe_unused]] ControlList &metadata)\n> +{\n\nHrm. ... now ... should we report SensorBlackLevels at a bit-depth that\nmatches the bit-depth of the image?\n\nI.e ... do we need to scale these 16 bit numbers to 8,10,12 bit\ndepending on the sensor configuration and output file bit-depth?\n\n> +       metadata.set(controls::SensorBlackLevels,\n> +                    { static_cast<int32_t>(blackLevelRed_),\n> +                      static_cast<int32_t>(blackLevelGreenR_),\n> +                      static_cast<int32_t>(blackLevelGreenB_),\n> +                      static_cast<int32_t>(blackLevelBlue_) });\n> +}\n> +\n>  REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n>  \n>  } /* namespace ipa::rkisp1::algorithms */\n> diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\n> index 460ebcc15739..4ecac233f88b 100644\n> --- a/src/ipa/rkisp1/algorithms/blc.h\n> +++ b/src/ipa/rkisp1/algorithms/blc.h\n> @@ -23,7 +23,10 @@ public:\n>         void prepare(IPAContext &context, const uint32_t frame,\n>                      IPAFrameContext &frameContext,\n>                      rkisp1_params_cfg *params) override;\n> -\n> +       void process(IPAContext &context, const uint32_t frame,\n> +                    IPAFrameContext &frameContext,\n> +                    const rkisp1_stat_buffer *stats,\n> +                    ControlList &metadata) override;\n>  private:\n>         bool tuningParameters_;\n>         int16_t blackLevelRed_;\n> diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\n> index a7bbd8d84263..609012967e02 100644\n> --- a/src/ipa/rkisp1/data/uncalibrated.yaml\n> +++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n> @@ -5,4 +5,5 @@ version: 1\n>  algorithms:\n>    - Agc:\n>    - Awb:\n> +  - BlackLevelCorrection:\n>  ...\n> -- \n> 2.43.0\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 D75A4BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 12:16:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A5D6262E23;\n\tWed,  3 Jul 2024 14:15:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 39B9262C95\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 14:15:58 +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 E9DA23E6;\n\tWed,  3 Jul 2024 14:15:29 +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=\"LRd+X85x\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720008930;\n\tbh=2TRnigKz+Hm/KE5zGMsVni1kxH8+CDftQiTRUp8Z+78=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=LRd+X85xrpRYkbGeCgJK7V36XGBBXjEmDpkK2QtxMEEbcAoLPch0PxZQTUjoZlygp\n\tAxklitB+x+tiehh2yZh1+mIZgUrUaXslZsk+Eu6Ru9ltZfJNi8FIGUTYmN//LL5Gwn\n\t9Gn4JuAV3V1TeRbKnpPgBtLz9jxKoWBRoOMhE7ek=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240703104004.184783-5-stefan.klug@ideasonboard.com>","References":"<20240703104004.184783-1-stefan.klug@ideasonboard.com>\n\t<20240703104004.184783-5-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 03 Jul 2024 13:15:55 +0100","Message-ID":"<172000895542.3353312.2287624000234476924@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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":30259,"web_url":"https://patchwork.libcamera.org/comment/30259/","msgid":"<7r44i4au5fedtafhqkd5s7ehappg5v3jhc5y7kmbbu6nzklxcn@m3ak7vkzscr2>","date":"2024-07-03T12:22:49","subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Wed, Jul 03, 2024 at 01:15:55PM +0100, Kieran Bingham wrote:\n> Quoting Stefan Klug (2024-07-03 11:39:51)\n> > Add sensor black levels to the metadata of the rkisp1 pipeline.\n> > \n> > Additionally enable raw support for this algorithm and add it to\n> > uncalibrated.yaml, so that black levels get reported when capturing\n> > tuning images. This is a bit of a hack, because no actual black level\n> > correction is taking place in raw mode, but it is the easiest way to get\n> > blacklevel reported for raw streams.\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/blc.cpp     | 28 +++++++++++++++++++++++++++\n> >  src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n> >  src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n> >  3 files changed, 33 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> > index 87025e4f8c72..71c62b009707 100644\n> > --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> > @@ -9,6 +9,8 @@\n> >  \n> >  #include <libcamera/base/log.h>\n> >  \n> > +#include <libcamera/control_ids.h>\n> > +\n> >  #include \"libcamera/internal/yaml_parser.h\"\n> >  \n> >  /**\n> > @@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n> >  BlackLevelCorrection::BlackLevelCorrection()\n> >         : tuningParameters_(false)\n> >  {\n> > +       /*\n> > +        * This is a bit of a hack. In raw mode no black level correction\n> > +        * happens. This flag is used to ensure the metadata gets populated with\n> > +        * the black level which is needed to capture proper raw images for\n> > +        * tuning.\n> > +        */\n> > +       supportsRaw_ = true;\n> >  }\n> >  \n> >  /**\n> > @@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> >                                    [[maybe_unused]] IPAFrameContext &frameContext,\n> >                                    rkisp1_params_cfg *params)\n> >  {\n> > +       if (context.configuration.raw)\n> > +               return;\n> > +\n> >         if (frame > 0)\n> >                 return;\n> >  \n> > @@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> >         params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n> >  }\n> >  \n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::process\n> > + */\n> > +void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n> > +                                  [[maybe_unused]] const uint32_t frame,\n> > +                                  [[maybe_unused]] IPAFrameContext &frameContext,\n> > +                                  [[maybe_unused]] const rkisp1_stat_buffer *stats,\n> > +                                  [[maybe_unused]] ControlList &metadata)\n> > +{\n> \n> Hrm. ... now ... should we report SensorBlackLevels at a bit-depth that\n> matches the bit-depth of the image?\n> \n> I.e ... do we need to scale these 16 bit numbers to 8,10,12 bit\n> depending on the sensor configuration and output file bit-depth?\n\nNo, that is specified in the control description: ... These values are\nreturned as numbers out of a 16-bit pixel range (as if pixels ranged\nfrom 0 to 65535)...\n\nThat's the reason why I believe it makes sense to unify that all over\nlibcamera. And I believe it is sensible as otherwise you would have to\nexplain that the sensor bitwidth and the output bitwidth can be\ndifferent and to wich one the black level relates...\n\nRegards,\nStefan\n\n> \n> > +       metadata.set(controls::SensorBlackLevels,\n> > +                    { static_cast<int32_t>(blackLevelRed_),\n> > +                      static_cast<int32_t>(blackLevelGreenR_),\n> > +                      static_cast<int32_t>(blackLevelGreenB_),\n> > +                      static_cast<int32_t>(blackLevelBlue_) });\n> > +}\n> > +\n> >  REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n> >  \n> >  } /* namespace ipa::rkisp1::algorithms */\n> > diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\n> > index 460ebcc15739..4ecac233f88b 100644\n> > --- a/src/ipa/rkisp1/algorithms/blc.h\n> > +++ b/src/ipa/rkisp1/algorithms/blc.h\n> > @@ -23,7 +23,10 @@ public:\n> >         void prepare(IPAContext &context, const uint32_t frame,\n> >                      IPAFrameContext &frameContext,\n> >                      rkisp1_params_cfg *params) override;\n> > -\n> > +       void process(IPAContext &context, const uint32_t frame,\n> > +                    IPAFrameContext &frameContext,\n> > +                    const rkisp1_stat_buffer *stats,\n> > +                    ControlList &metadata) override;\n> >  private:\n> >         bool tuningParameters_;\n> >         int16_t blackLevelRed_;\n> > diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > index a7bbd8d84263..609012967e02 100644\n> > --- a/src/ipa/rkisp1/data/uncalibrated.yaml\n> > +++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > @@ -5,4 +5,5 @@ version: 1\n> >  algorithms:\n> >    - Agc:\n> >    - Awb:\n> > +  - BlackLevelCorrection:\n> >  ...\n> > -- \n> > 2.43.0\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 6ABC7BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 12:22:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 41F6162E22;\n\tWed,  3 Jul 2024 14:22:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2001A62C96\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 14:22:52 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:9263:c199:9587:576])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCA1F3E6;\n\tWed,  3 Jul 2024 14:22: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=\"fxUu4Zve\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720009344;\n\tbh=YRUgbJHcglByoFzAQ2rBlcZ8PUx3vca5ceCHowfx+IM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fxUu4ZvexgLf9Cjc5OPGTFin6yl5/W4gMIN2kbdaSiPAjJ0AXFfcQ/K4DhXUwYQw1\n\tSQiwHinBfHnMBuB8+/4Rel3rdjTi2A1ceZsLiQusdQkuPehgm18YFt3QXUh9umAJfv\n\tIpqS1DGoF3G0ssNUwkkLE0WLTp8K2ACP1j6wk/nA=","Date":"Wed, 3 Jul 2024 14:22:49 +0200","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","Message-ID":"<7r44i4au5fedtafhqkd5s7ehappg5v3jhc5y7kmbbu6nzklxcn@m3ak7vkzscr2>","References":"<20240703104004.184783-1-stefan.klug@ideasonboard.com>\n\t<20240703104004.184783-5-stefan.klug@ideasonboard.com>\n\t<172000895542.3353312.2287624000234476924@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<172000895542.3353312.2287624000234476924@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>"}},{"id":30263,"web_url":"https://patchwork.libcamera.org/comment/30263/","msgid":"<172000985871.3353312.10782235867523317465@ping.linuxembedded.co.uk>","date":"2024-07-03T12:30:58","subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-07-03 13:22:49)\n> Hi Kieran,\n> \n> On Wed, Jul 03, 2024 at 01:15:55PM +0100, Kieran Bingham wrote:\n> > Quoting Stefan Klug (2024-07-03 11:39:51)\n> > > Add sensor black levels to the metadata of the rkisp1 pipeline.\n> > > \n> > > Additionally enable raw support for this algorithm and add it to\n> > > uncalibrated.yaml, so that black levels get reported when capturing\n> > > tuning images. This is a bit of a hack, because no actual black level\n> > > correction is taking place in raw mode, but it is the easiest way to get\n> > > blacklevel reported for raw streams.\n> > > \n> > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > > ---\n> > >  src/ipa/rkisp1/algorithms/blc.cpp     | 28 +++++++++++++++++++++++++++\n> > >  src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n> > >  src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n> > >  3 files changed, 33 insertions(+), 1 deletion(-)\n> > > \n> > > diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> > > index 87025e4f8c72..71c62b009707 100644\n> > > --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> > > +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> > > @@ -9,6 +9,8 @@\n> > >  \n> > >  #include <libcamera/base/log.h>\n> > >  \n> > > +#include <libcamera/control_ids.h>\n> > > +\n> > >  #include \"libcamera/internal/yaml_parser.h\"\n> > >  \n> > >  /**\n> > > @@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n> > >  BlackLevelCorrection::BlackLevelCorrection()\n> > >         : tuningParameters_(false)\n> > >  {\n> > > +       /*\n> > > +        * This is a bit of a hack. In raw mode no black level correction\n> > > +        * happens. This flag is used to ensure the metadata gets populated with\n> > > +        * the black level which is needed to capture proper raw images for\n> > > +        * tuning.\n> > > +        */\n> > > +       supportsRaw_ = true;\n> > >  }\n> > >  \n> > >  /**\n> > > @@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> > >                                    [[maybe_unused]] IPAFrameContext &frameContext,\n> > >                                    rkisp1_params_cfg *params)\n> > >  {\n> > > +       if (context.configuration.raw)\n> > > +               return;\n> > > +\n> > >         if (frame > 0)\n> > >                 return;\n> > >  \n> > > @@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> > >         params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n> > >  }\n> > >  \n> > > +/**\n> > > + * \\copydoc libcamera::ipa::Algorithm::process\n> > > + */\n> > > +void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n> > > +                                  [[maybe_unused]] const uint32_t frame,\n> > > +                                  [[maybe_unused]] IPAFrameContext &frameContext,\n> > > +                                  [[maybe_unused]] const rkisp1_stat_buffer *stats,\n> > > +                                  [[maybe_unused]] ControlList &metadata)\n> > > +{\n> > \n> > Hrm. ... now ... should we report SensorBlackLevels at a bit-depth that\n> > matches the bit-depth of the image?\n> > \n> > I.e ... do we need to scale these 16 bit numbers to 8,10,12 bit\n> > depending on the sensor configuration and output file bit-depth?\n> \n> No, that is specified in the control description: ... These values are\n> returned as numbers out of a 16-bit pixel range (as if pixels ranged\n> from 0 to 65535)...\n> \n> That's the reason why I believe it makes sense to unify that all over\n> libcamera. And I believe it is sensible as otherwise you would have to\n> explain that the sensor bitwidth and the output bitwidth can be\n> different and to wich one the black level relates...\n\nAck, in that case:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nI presume it would then be up to the application writing a dng for\ninstance to know the correct way to write the black level. I \"assume\"\nany black level in a dng file is expected to match the sensor bit-depth,\nbut I'm absolutely fine with the metadata being stipulated by us, as\nthat's libcamera metadata and matching the value that would be set on a\ncontrol certainly makes sense.\n\n\n\n> \n> Regards,\n> Stefan\n> \n> > \n> > > +       metadata.set(controls::SensorBlackLevels,\n> > > +                    { static_cast<int32_t>(blackLevelRed_),\n> > > +                      static_cast<int32_t>(blackLevelGreenR_),\n> > > +                      static_cast<int32_t>(blackLevelGreenB_),\n> > > +                      static_cast<int32_t>(blackLevelBlue_) });\n> > > +}\n> > > +\n> > >  REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n> > >  \n> > >  } /* namespace ipa::rkisp1::algorithms */\n> > > diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\n> > > index 460ebcc15739..4ecac233f88b 100644\n> > > --- a/src/ipa/rkisp1/algorithms/blc.h\n> > > +++ b/src/ipa/rkisp1/algorithms/blc.h\n> > > @@ -23,7 +23,10 @@ public:\n> > >         void prepare(IPAContext &context, const uint32_t frame,\n> > >                      IPAFrameContext &frameContext,\n> > >                      rkisp1_params_cfg *params) override;\n> > > -\n> > > +       void process(IPAContext &context, const uint32_t frame,\n> > > +                    IPAFrameContext &frameContext,\n> > > +                    const rkisp1_stat_buffer *stats,\n> > > +                    ControlList &metadata) override;\n> > >  private:\n> > >         bool tuningParameters_;\n> > >         int16_t blackLevelRed_;\n> > > diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > index a7bbd8d84263..609012967e02 100644\n> > > --- a/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > +++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > @@ -5,4 +5,5 @@ version: 1\n> > >  algorithms:\n> > >    - Agc:\n> > >    - Awb:\n> > > +  - BlackLevelCorrection:\n> > >  ...\n> > > -- \n> > > 2.43.0\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 A40F2BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 12:31:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C55C063331;\n\tWed,  3 Jul 2024 14:31:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AE06862E22\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 14:31:01 +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 71D1E3E6;\n\tWed,  3 Jul 2024 14:30: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=\"SojX90CU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720009833;\n\tbh=626cO5Pv9gnfzmLVDRx1EwErNBNuuI4ZtPFZjRANum8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=SojX90CUml5W7YW+ipwFSJ6LpNDrVOomjXgG+jGG2Tn+beb2UUko/avEu6MvT7bum\n\tMdITHl0avLXDhNe3ptcoGtDK9VmiQ4b9xwV5ngzAuTAUdGzWDProT8bQLvCXgs2ATr\n\t54GxnxMPsQgdBRm/7k9/kvXOg7U3XaFF8+ADTARw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<7r44i4au5fedtafhqkd5s7ehappg5v3jhc5y7kmbbu6nzklxcn@m3ak7vkzscr2>","References":"<20240703104004.184783-1-stefan.klug@ideasonboard.com>\n\t<20240703104004.184783-5-stefan.klug@ideasonboard.com>\n\t<172000895542.3353312.2287624000234476924@ping.linuxembedded.co.uk>\n\t<7r44i4au5fedtafhqkd5s7ehappg5v3jhc5y7kmbbu6nzklxcn@m3ak7vkzscr2>","Subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Date":"Wed, 03 Jul 2024 13:30:58 +0100","Message-ID":"<172000985871.3353312.10782235867523317465@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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":30268,"web_url":"https://patchwork.libcamera.org/comment/30268/","msgid":"<20240703124449.GC27927@pendragon.ideasonboard.com>","date":"2024-07-03T12:44:49","subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Jul 03, 2024 at 01:30:58PM +0100, Kieran Bingham wrote:\n> Quoting Stefan Klug (2024-07-03 13:22:49)\n> > On Wed, Jul 03, 2024 at 01:15:55PM +0100, Kieran Bingham wrote:\n> > > Quoting Stefan Klug (2024-07-03 11:39:51)\n> > > > Add sensor black levels to the metadata of the rkisp1 pipeline.\n> > > > \n> > > > Additionally enable raw support for this algorithm and add it to\n> > > > uncalibrated.yaml, so that black levels get reported when capturing\n> > > > tuning images. This is a bit of a hack, because no actual black level\n> > > > correction is taking place in raw mode, but it is the easiest way to get\n> > > > blacklevel reported for raw streams.\n> > > > \n> > > > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > > > ---\n> > > >  src/ipa/rkisp1/algorithms/blc.cpp     | 28 +++++++++++++++++++++++++++\n> > > >  src/ipa/rkisp1/algorithms/blc.h       |  5 ++++-\n> > > >  src/ipa/rkisp1/data/uncalibrated.yaml |  1 +\n> > > >  3 files changed, 33 insertions(+), 1 deletion(-)\n> > > > \n> > > > diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\n> > > > index 87025e4f8c72..71c62b009707 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/blc.cpp\n> > > > +++ b/src/ipa/rkisp1/algorithms/blc.cpp\n> > > > @@ -9,6 +9,8 @@\n> > > >  \n> > > >  #include <libcamera/base/log.h>\n> > > >  \n> > > > +#include <libcamera/control_ids.h>\n> > > > +\n> > > >  #include \"libcamera/internal/yaml_parser.h\"\n> > > >  \n> > > >  /**\n> > > > @@ -38,6 +40,13 @@ LOG_DEFINE_CATEGORY(RkISP1Blc)\n> > > >  BlackLevelCorrection::BlackLevelCorrection()\n> > > >         : tuningParameters_(false)\n> > > >  {\n> > > > +       /*\n> > > > +        * This is a bit of a hack. In raw mode no black level correction\n> > > > +        * happens. This flag is used to ensure the metadata gets populated with\n> > > > +        * the black level which is needed to capture proper raw images for\n> > > > +        * tuning.\n> > > > +        */\n> > > > +       supportsRaw_ = true;\n> > > >  }\n> > > >  \n> > > >  /**\n> > > > @@ -107,6 +116,9 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> > > >                                    [[maybe_unused]] IPAFrameContext &frameContext,\n> > > >                                    rkisp1_params_cfg *params)\n> > > >  {\n> > > > +       if (context.configuration.raw)\n> > > > +               return;\n> > > > +\n> > > >         if (frame > 0)\n> > > >                 return;\n> > > >  \n> > > > @@ -125,6 +137,22 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,\n> > > >         params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_BLS;\n> > > >  }\n> > > >  \n> > > > +/**\n> > > > + * \\copydoc libcamera::ipa::Algorithm::process\n> > > > + */\n> > > > +void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context,\n> > > > +                                  [[maybe_unused]] const uint32_t frame,\n> > > > +                                  [[maybe_unused]] IPAFrameContext &frameContext,\n> > > > +                                  [[maybe_unused]] const rkisp1_stat_buffer *stats,\n> > > > +                                  [[maybe_unused]] ControlList &metadata)\n\nDrop [[maybe_unused]] for metadata.\n\n> > > > +{\n> > > \n> > > Hrm. ... now ... should we report SensorBlackLevels at a bit-depth that\n> > > matches the bit-depth of the image?\n> > > \n> > > I.e ... do we need to scale these 16 bit numbers to 8,10,12 bit\n> > > depending on the sensor configuration and output file bit-depth?\n> > \n> > No, that is specified in the control description: ... These values are\n> > returned as numbers out of a 16-bit pixel range (as if pixels ranged\n> > from 0 to 65535)...\n> > \n> > That's the reason why I believe it makes sense to unify that all over\n> > libcamera. And I believe it is sensible as otherwise you would have to\n> > explain that the sensor bitwidth and the output bitwidth can be\n> > different and to wich one the black level relates...\n> \n> Ack, in that case:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> I presume it would then be up to the application writing a dng for\n> instance to know the correct way to write the black level. I \"assume\"\n> any black level in a dng file is expected to match the sensor bit-depth,\n> but I'm absolutely fine with the metadata being stipulated by us, as\n> that's libcamera metadata and matching the value that would be set on a\n> control certainly makes sense.\n\nSee dng_writer.cpp:\n\n\t/* Map the 16-bit value to the bits per sample range. */\n\tblackLevel[i] = level >> (16 - info->bitsPerSample);\n\n:-)\n\n> > > > +       metadata.set(controls::SensorBlackLevels,\n> > > > +                    { static_cast<int32_t>(blackLevelRed_),\n> > > > +                      static_cast<int32_t>(blackLevelGreenR_),\n> > > > +                      static_cast<int32_t>(blackLevelGreenB_),\n> > > > +                      static_cast<int32_t>(blackLevelBlue_) });\n> > > > +}\n> > > > +\n> > > >  REGISTER_IPA_ALGORITHM(BlackLevelCorrection, \"BlackLevelCorrection\")\n> > > >  \n> > > >  } /* namespace ipa::rkisp1::algorithms */\n> > > > diff --git a/src/ipa/rkisp1/algorithms/blc.h b/src/ipa/rkisp1/algorithms/blc.h\n> > > > index 460ebcc15739..4ecac233f88b 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/blc.h\n> > > > +++ b/src/ipa/rkisp1/algorithms/blc.h\n> > > > @@ -23,7 +23,10 @@ public:\n> > > >         void prepare(IPAContext &context, const uint32_t frame,\n> > > >                      IPAFrameContext &frameContext,\n> > > >                      rkisp1_params_cfg *params) override;\n> > > > -\n> > > > +       void process(IPAContext &context, const uint32_t frame,\n> > > > +                    IPAFrameContext &frameContext,\n> > > > +                    const rkisp1_stat_buffer *stats,\n> > > > +                    ControlList &metadata) override;\n> > > >  private:\n> > > >         bool tuningParameters_;\n> > > >         int16_t blackLevelRed_;\n> > > > diff --git a/src/ipa/rkisp1/data/uncalibrated.yaml b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > > index a7bbd8d84263..609012967e02 100644\n> > > > --- a/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > > +++ b/src/ipa/rkisp1/data/uncalibrated.yaml\n> > > > @@ -5,4 +5,5 @@ version: 1\n> > > >  algorithms:\n> > > >    - Agc:\n> > > >    - Awb:\n> > > > +  - BlackLevelCorrection:\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 A6E99BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 12:45:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DFA5C62C99;\n\tWed,  3 Jul 2024 14:45:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A02462C95\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 14:45:11 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E7D383E6;\n\tWed,  3 Jul 2024 14:44:42 +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=\"ExUzx+fc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720010683;\n\tbh=8rwZZ7RILbicuv95REP1F4PUFzlQyiaZeWVpykxZnZY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ExUzx+fct9XRGK4nTrrod9PGprzFtD6OWfLY+7cb1ssytzDB5RvGAQ8PPrfbwJeZq\n\t6fFqvPRIacKHhDy0Tn8vO+uXvHR4Gh2vWMpjEd6Zo5oKwxSiDm1qZcNuRQExXhfjRN\n\tbQvDi7hfGI/Z/PkodTErdK4VpAn6EgvbPAOVUePA=","Date":"Wed, 3 Jul 2024 15:44:49 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 4/6] ipa: rkisp1: blc: Report sensor black levels in\n\tmetadata","Message-ID":"<20240703124449.GC27927@pendragon.ideasonboard.com>","References":"<20240703104004.184783-1-stefan.klug@ideasonboard.com>\n\t<20240703104004.184783-5-stefan.klug@ideasonboard.com>\n\t<172000895542.3353312.2287624000234476924@ping.linuxembedded.co.uk>\n\t<7r44i4au5fedtafhqkd5s7ehappg5v3jhc5y7kmbbu6nzklxcn@m3ak7vkzscr2>\n\t<172000985871.3353312.10782235867523317465@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<172000985871.3353312.10782235867523317465@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>"}}]