[{"id":33739,"web_url":"https://patchwork.libcamera.org/comment/33739/","msgid":"<174302458223.1701483.17871880305656655895@ping.linuxembedded.co.uk>","date":"2025-03-26T21:29:42","subject":"Re: [PATCH v5 5/6] ipa: simple: Report contrast in metadata","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2025-03-26 12:48:54)\n> Provide the requested contrast value, if any, in the metadata to add to\n> the completed requests.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/simple/algorithms/lut.cpp | 15 ++++++++++++++-\n>  src/ipa/simple/algorithms/lut.h   |  5 +++++\n>  src/ipa/simple/ipa_context.h      |  1 +\n>  3 files changed, 20 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\n> index a06cdeba..e8638f27 100644\n> --- a/src/ipa/simple/algorithms/lut.cpp\n> +++ b/src/ipa/simple/algorithms/lut.cpp\n> @@ -87,9 +87,11 @@ int16_t Lut::ccmValue(unsigned int i, float ccm) const\n>  \n>  void Lut::prepare(IPAContext &context,\n>                   [[maybe_unused]] const uint32_t frame,\n> -                 [[maybe_unused]] IPAFrameContext &frameContext,\n> +                 IPAFrameContext &frameContext,\n>                   DebayerParams *params)\n>  {\n> +       frameContext.contrast = context.activeState.knobs.contrast;\n> +\n>         /*\n>          * Update the gamma table if needed. This means if black level changes\n>          * and since the black level gets updated only if a lower value is\n> @@ -139,6 +141,17 @@ void Lut::prepare(IPAContext &context,\n>         }\n>  }\n>  \n> +void Lut::process([[maybe_unused]] IPAContext &context,\n> +                 [[maybe_unused]] const uint32_t frame,\n> +                 [[maybe_unused]] IPAFrameContext &frameContext,\n> +                 [[maybe_unused]] const SwIspStats *stats,\n> +                 ControlList &metadata)\n> +{\n> +       const auto &contrast = frameContext.contrast;\n> +       if (contrast)\n> +               metadata.set(controls::Contrast, contrast.value());\n> +}\n> +\n>  REGISTER_IPA_ALGORITHM(Lut, \"Lut\")\n>  \n>  } /* namespace ipa::soft::algorithms */\n> diff --git a/src/ipa/simple/algorithms/lut.h b/src/ipa/simple/algorithms/lut.h\n> index 77324800..ba8b9021 100644\n> --- a/src/ipa/simple/algorithms/lut.h\n> +++ b/src/ipa/simple/algorithms/lut.h\n> @@ -30,6 +30,11 @@ public:\n>                      const uint32_t frame,\n>                      IPAFrameContext &frameContext,\n>                      DebayerParams *params) override;\n> +       void process(IPAContext &context,\n> +                    const uint32_t frame,\n> +                    IPAFrameContext &frameContext,\n> +                    const SwIspStats *stats,\n> +                    ControlList &metadata) override;\n>  \n>  private:\n>         void updateGammaTable(IPAContext &context);\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index bfac835b..10d539f5 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -74,6 +74,7 @@ struct IPAFrameContext : public FrameContext {\n>                 double red;\n>                 double blue;\n>         } gains;\n> +       std::optional<double> contrast;\n>  };\n>  \n>  struct IPAContext {\n> -- \n> 2.49.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 93B0FC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 21:29:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B7EA96896D;\n\tWed, 26 Mar 2025 22:29:47 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96B9568950\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 22:29:45 +0100 (CET)","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 62AA5475;\n\tWed, 26 Mar 2025 22:27:57 +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=\"ozftHfp7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743024477;\n\tbh=3/GTpzzHJ6EOSOv/6P0hNsZI7hhrQds8L1uaYJyZdRQ=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=ozftHfp7OCt/Ccd2My8U72bYnkVWDe5UA+LDLVcja1ZzOvwCeQfPbRcoZc/JUzpJ0\n\tQJ7yYo3hsO4L13ZKYUeRSjXa13Vay++u0ND2D8S0kjZWZp2e3XX5HlWo7Fd887e4Nt\n\tMrSbEFf2j1Z7D6ZhngRgfjRCABxgXebfHy/oFs68=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250326124856.75709-6-mzamazal@redhat.com>","References":"<20250326124856.75709-1-mzamazal@redhat.com>\n\t<20250326124856.75709-6-mzamazal@redhat.com>","Subject":"Re: [PATCH v5 5/6] ipa: simple: Report contrast in metadata","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Wed, 26 Mar 2025 21:29:42 +0000","Message-ID":"<174302458223.1701483.17871880305656655895@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":33745,"web_url":"https://patchwork.libcamera.org/comment/33745/","msgid":"<20250326233009.GE21053@pendragon.ideasonboard.com>","date":"2025-03-26T23:30:09","subject":"Re: [PATCH v5 5/6] ipa: simple: Report contrast in metadata","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch.\n\nOn Wed, Mar 26, 2025 at 01:48:54PM +0100, Milan Zamazal wrote:\n> Provide the requested contrast value, if any, in the metadata to add to\n> the completed requests.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/simple/algorithms/lut.cpp | 15 ++++++++++++++-\n>  src/ipa/simple/algorithms/lut.h   |  5 +++++\n>  src/ipa/simple/ipa_context.h      |  1 +\n>  3 files changed, 20 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/simple/algorithms/lut.cpp b/src/ipa/simple/algorithms/lut.cpp\n> index a06cdeba..e8638f27 100644\n> --- a/src/ipa/simple/algorithms/lut.cpp\n> +++ b/src/ipa/simple/algorithms/lut.cpp\n> @@ -87,9 +87,11 @@ int16_t Lut::ccmValue(unsigned int i, float ccm) const\n>  \n>  void Lut::prepare(IPAContext &context,\n>  \t\t  [[maybe_unused]] const uint32_t frame,\n> -\t\t  [[maybe_unused]] IPAFrameContext &frameContext,\n> +\t\t  IPAFrameContext &frameContext,\n>  \t\t  DebayerParams *params)\n>  {\n> +\tframeContext.contrast = context.activeState.knobs.contrast;\n> +\n>  \t/*\n>  \t * Update the gamma table if needed. This means if black level changes\n>  \t * and since the black level gets updated only if a lower value is\n> @@ -139,6 +141,17 @@ void Lut::prepare(IPAContext &context,\n>  \t}\n>  }\n>  \n> +void Lut::process([[maybe_unused]] IPAContext &context,\n> +\t\t  [[maybe_unused]] const uint32_t frame,\n> +\t\t  [[maybe_unused]] IPAFrameContext &frameContext,\n> +\t\t  [[maybe_unused]] const SwIspStats *stats,\n> +\t\t  ControlList &metadata)\n> +{\n> +\tconst auto &contrast = frameContext.contrast;\n> +\tif (contrast)\n> +\t\tmetadata.set(controls::Contrast, contrast.value());\n> +}\n> +\n>  REGISTER_IPA_ALGORITHM(Lut, \"Lut\")\n>  \n>  } /* namespace ipa::soft::algorithms */\n> diff --git a/src/ipa/simple/algorithms/lut.h b/src/ipa/simple/algorithms/lut.h\n> index 77324800..ba8b9021 100644\n> --- a/src/ipa/simple/algorithms/lut.h\n> +++ b/src/ipa/simple/algorithms/lut.h\n> @@ -30,6 +30,11 @@ public:\n>  \t\t     const uint32_t frame,\n>  \t\t     IPAFrameContext &frameContext,\n>  \t\t     DebayerParams *params) override;\n> +\tvoid process(IPAContext &context,\n> +\t\t     const uint32_t frame,\n> +\t\t     IPAFrameContext &frameContext,\n> +\t\t     const SwIspStats *stats,\n> +\t\t     ControlList &metadata) override;\n>  \n>  private:\n>  \tvoid updateGammaTable(IPAContext &context);\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index bfac835b..10d539f5 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -74,6 +74,7 @@ struct IPAFrameContext : public FrameContext {\n>  \t\tdouble red;\n>  \t\tdouble blue;\n>  \t} gains;\n> +\tstd::optional<double> contrast;\n>  };\n>  \n>  struct IPAContext {","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 B26C0C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 23:30:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F3E856896B;\n\tThu, 27 Mar 2025 00:30:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F0A45600EB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Mar 2025 00:30:32 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 880711D5;\n\tThu, 27 Mar 2025 00:28:44 +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=\"tqapAmFY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743031724;\n\tbh=qrGc4NB7j15EIFuoncwnMrAkVq8y85VhcN+BTrfi2O8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tqapAmFYbDeTxsMr2owxFC+MIJYMzYEyrap6litm4BFEcjIX4UVwBSYVJpge1TuD8\n\t/1Tqe6tzgjRiMQ5XGjIKTh1H09gQVLCK7y/QiMoSadgHPaCEHOtuHFpanlL+K17Nnf\n\tyfXRzckoXfGuwR7rGAZFYcYe7834pvq4gipwQ2V0=","Date":"Thu, 27 Mar 2025 01:30:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v5 5/6] ipa: simple: Report contrast in metadata","Message-ID":"<20250326233009.GE21053@pendragon.ideasonboard.com>","References":"<20250326124856.75709-1-mzamazal@redhat.com>\n\t<20250326124856.75709-6-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250326124856.75709-6-mzamazal@redhat.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>"}}]