[{"id":36596,"web_url":"https://patchwork.libcamera.org/comment/36596/","msgid":"<176201954428.3925733.1986828762974343251@ping.linuxembedded.co.uk>","date":"2025-11-01T17:52:24","subject":"Re: [PATCH v1 09/17] ipa: rkisp1: algorithms: dpf: handle DPF enable\n\ttoggle","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Rui Wang (2025-10-28 21:17:42)\n> Implement handleEnableControl() to process the DpfEnable control and\n> synchronize the enable state across context and frame state. Update\n> queueRequest() to call this handler, clearing the update flag first.\n> \n> The enable control allows applications to globally enable/disable DPF\n> processing without changing other configuration. Changes are logged\n> and trigger frame updates.\n> \n> This replaces the previous draft::NoiseReductionMode handling with\n> the new RkISP1-specific DpfEnable control.\n> \n> Signed-off-by: Rui Wang <rui.wang@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/denoise.h |  1 +\n>  src/ipa/rkisp1/algorithms/dpf.cpp   | 48 ++++++++++-------------------\n>  src/ipa/rkisp1/algorithms/dpf.h     |  1 +\n>  3 files changed, 18 insertions(+), 32 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/denoise.h b/src/ipa/rkisp1/algorithms/denoise.h\n> index 5fc78588..5bc3f941 100644\n> --- a/src/ipa/rkisp1/algorithms/denoise.h\n> +++ b/src/ipa/rkisp1/algorithms/denoise.h\n> @@ -37,6 +37,7 @@ protected:\n>         template<typename LevelContainer>\n>         int selectIsoBand(unsigned iso, const LevelContainer &levels) const;\n>         virtual bool parseConfig(const YamlObject &tuningData) = 0;\n> +       virtual void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) = 0;\n>  \n>  private:\n>         bool manualMode_ = false; /**< Current manual/auto mode state */\n> diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp\n> index a5059741..d0bed3e4 100644\n> --- a/src/ipa/rkisp1/algorithms/dpf.cpp\n> +++ b/src/ipa/rkisp1/algorithms/dpf.cpp\n> @@ -229,6 +229,20 @@ bool Dpf::parseSingleConfig(const YamlObject &config,\n>         return true;\n>  }\n>  \n> +void Dpf::handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context)\n> +{\n> +       if (const auto &c = controls.get(controls::rkisp1::DpfEnable); c) {\n> +               bool requested = *c != 0;\n> +               if (requested != enableDpf_) {\n> +                       enableDpf_ = requested;\n> +                       frameContext.dpf.update = true;\n> +                       LOG(RkISP1Dpf, Info) << \"DPF global \" << (enableDpf_ ? \"enabled\" : \"disabled\");\n> +               }\n> +       }\n> +       context.activeState.dpf.denoise = enableDpf_;\n> +       frameContext.dpf.denoise = enableDpf_;\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::queueRequest\n>   */\n> @@ -237,38 +251,8 @@ void Dpf::queueRequest(IPAContext &context,\n>                        IPAFrameContext &frameContext,\n>                        const ControlList &controls)\n>  {\n> -       auto &dpf = context.activeState.dpf;\n> -       bool update = false;\n> -\n> -       const auto &denoise = controls.get(controls::draft::NoiseReductionMode);\n> -       if (denoise) {\n> -               LOG(RkISP1Dpf, Debug) << \"Set denoise to \" << *denoise;\n> -\n> -               switch (*denoise) {\n> -               case controls::draft::NoiseReductionModeOff:\n> -                       if (dpf.denoise) {\n> -                               dpf.denoise = false;\n> -                               update = true;\n> -                       }\n> -                       break;\n> -               case controls::draft::NoiseReductionModeMinimal:\n> -               case controls::draft::NoiseReductionModeHighQuality:\n> -               case controls::draft::NoiseReductionModeFast:\n\nHow do we handle and map these high level use cases now ?\n\nI don't think we can just have RKISP1 specific denoise controls - we\nneed to ensure we have something at the libcamera level which can be\napplied to platforms generically.\n\n\n\n> -                       if (!dpf.denoise) {\n> -                               dpf.denoise = true;\n> -                               update = true;\n> -                       }\n> -                       break;\n> -               default:\n> -                       LOG(RkISP1Dpf, Error)\n> -                               << \"Unsupported denoise value \"\n> -                               << *denoise;\n> -                       break;\n> -               }\n> -       }\n> -\n> -       frameContext.dpf.denoise = dpf.denoise;\n> -       frameContext.dpf.update = update;\n> +       frameContext.dpf.update = false;\n> +       handleEnableControl(controls, frameContext, context);\n>  }\n>  \n>  /**\n> diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h\n> index faeb6c27..c01f711c 100644\n> --- a/src/ipa/rkisp1/algorithms/dpf.h\n> +++ b/src/ipa/rkisp1/algorithms/dpf.h\n> @@ -50,6 +50,7 @@ private:\n>         bool useIsoLevels_ = false;\n>         bool enableDpf_ = true; /* YAML master enable */\n>  \n> +       void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) override;\n>         bool parseConfig(const YamlObject &tuningData) override;\n>         bool parseSingleConfig(const YamlObject &config,\n>                                rkisp1_cif_isp_dpf_config &cfg,\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 499C1BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  1 Nov 2025 17:52:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B80460A7B;\n\tSat,  1 Nov 2025 18:52:28 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 24D96606D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  1 Nov 2025 18:52:27 +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 8A97E524;\n\tSat,  1 Nov 2025 18:50:35 +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=\"c6LrKXH9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762019435;\n\tbh=SIo3yQ2uKf9QToNFQlOa6Upcgj5J8TlRdqYcF7wiz6s=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=c6LrKXH9AhdrpFq2CCzVdTAd53gTCI396rkLpDZ+Skz8XE4EVG42Fg7B+xy75CEBc\n\tfEhVR9zaVD1dbOo0NTPx3Pa93BdtjVtC7+sn35PRWBzjMbpfpJir/YEy7eyEXZvhyQ\n\tTCnCIfzz9p8hGzgskujqT77t2bAmIJVRrBoWOP0Y=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251028211751.2761420-9-rui.wang@ideasonboard.com>","References":"<20251028211751.2761420-1-rui.wang@ideasonboard.com>\n\t<20251028211751.2761420-9-rui.wang@ideasonboard.com>","Subject":"Re: [PATCH v1 09/17] ipa: rkisp1: algorithms: dpf: handle DPF enable\n\ttoggle","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Rui Wang <rui.wang@ideasonboard.com>","To":"Rui Wang <rui.wang@ideasonboard.com>, libcamera-devel@lists.libcamera.org","Date":"Sat, 01 Nov 2025 17:52:24 +0000","Message-ID":"<176201954428.3925733.1986828762974343251@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>"}}]