| Message ID | 20251028211751.2761420-9-rui.wang@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Rui Wang (2025-10-28 21:17:42) > Implement handleEnableControl() to process the DpfEnable control and > synchronize the enable state across context and frame state. Update > queueRequest() to call this handler, clearing the update flag first. > > The enable control allows applications to globally enable/disable DPF > processing without changing other configuration. Changes are logged > and trigger frame updates. > > This replaces the previous draft::NoiseReductionMode handling with > the new RkISP1-specific DpfEnable control. > > Signed-off-by: Rui Wang <rui.wang@ideasonboard.com> > --- > src/ipa/rkisp1/algorithms/denoise.h | 1 + > src/ipa/rkisp1/algorithms/dpf.cpp | 48 ++++++++++------------------- > src/ipa/rkisp1/algorithms/dpf.h | 1 + > 3 files changed, 18 insertions(+), 32 deletions(-) > > diff --git a/src/ipa/rkisp1/algorithms/denoise.h b/src/ipa/rkisp1/algorithms/denoise.h > index 5fc78588..5bc3f941 100644 > --- a/src/ipa/rkisp1/algorithms/denoise.h > +++ b/src/ipa/rkisp1/algorithms/denoise.h > @@ -37,6 +37,7 @@ protected: > template<typename LevelContainer> > int selectIsoBand(unsigned iso, const LevelContainer &levels) const; > virtual bool parseConfig(const YamlObject &tuningData) = 0; > + virtual void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) = 0; > > private: > bool manualMode_ = false; /**< Current manual/auto mode state */ > diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp > index a5059741..d0bed3e4 100644 > --- a/src/ipa/rkisp1/algorithms/dpf.cpp > +++ b/src/ipa/rkisp1/algorithms/dpf.cpp > @@ -229,6 +229,20 @@ bool Dpf::parseSingleConfig(const YamlObject &config, > return true; > } > > +void Dpf::handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) > +{ > + if (const auto &c = controls.get(controls::rkisp1::DpfEnable); c) { > + bool requested = *c != 0; > + if (requested != enableDpf_) { > + enableDpf_ = requested; > + frameContext.dpf.update = true; > + LOG(RkISP1Dpf, Info) << "DPF global " << (enableDpf_ ? "enabled" : "disabled"); > + } > + } > + context.activeState.dpf.denoise = enableDpf_; > + frameContext.dpf.denoise = enableDpf_; > +} > + > /** > * \copydoc libcamera::ipa::Algorithm::queueRequest > */ > @@ -237,38 +251,8 @@ void Dpf::queueRequest(IPAContext &context, > IPAFrameContext &frameContext, > const ControlList &controls) > { > - auto &dpf = context.activeState.dpf; > - bool update = false; > - > - const auto &denoise = controls.get(controls::draft::NoiseReductionMode); > - if (denoise) { > - LOG(RkISP1Dpf, Debug) << "Set denoise to " << *denoise; > - > - switch (*denoise) { > - case controls::draft::NoiseReductionModeOff: > - if (dpf.denoise) { > - dpf.denoise = false; > - update = true; > - } > - break; > - case controls::draft::NoiseReductionModeMinimal: > - case controls::draft::NoiseReductionModeHighQuality: > - case controls::draft::NoiseReductionModeFast: How do we handle and map these high level use cases now ? I don't think we can just have RKISP1 specific denoise controls - we need to ensure we have something at the libcamera level which can be applied to platforms generically. > - if (!dpf.denoise) { > - dpf.denoise = true; > - update = true; > - } > - break; > - default: > - LOG(RkISP1Dpf, Error) > - << "Unsupported denoise value " > - << *denoise; > - break; > - } > - } > - > - frameContext.dpf.denoise = dpf.denoise; > - frameContext.dpf.update = update; > + frameContext.dpf.update = false; > + handleEnableControl(controls, frameContext, context); > } > > /** > diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h > index faeb6c27..c01f711c 100644 > --- a/src/ipa/rkisp1/algorithms/dpf.h > +++ b/src/ipa/rkisp1/algorithms/dpf.h > @@ -50,6 +50,7 @@ private: > bool useIsoLevels_ = false; > bool enableDpf_ = true; /* YAML master enable */ > > + void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) override; > bool parseConfig(const YamlObject &tuningData) override; > bool parseSingleConfig(const YamlObject &config, > rkisp1_cif_isp_dpf_config &cfg, > -- > 2.43.0 >
diff --git a/src/ipa/rkisp1/algorithms/denoise.h b/src/ipa/rkisp1/algorithms/denoise.h index 5fc78588..5bc3f941 100644 --- a/src/ipa/rkisp1/algorithms/denoise.h +++ b/src/ipa/rkisp1/algorithms/denoise.h @@ -37,6 +37,7 @@ protected: template<typename LevelContainer> int selectIsoBand(unsigned iso, const LevelContainer &levels) const; virtual bool parseConfig(const YamlObject &tuningData) = 0; + virtual void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) = 0; private: bool manualMode_ = false; /**< Current manual/auto mode state */ diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index a5059741..d0bed3e4 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -229,6 +229,20 @@ bool Dpf::parseSingleConfig(const YamlObject &config, return true; } +void Dpf::handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) +{ + if (const auto &c = controls.get(controls::rkisp1::DpfEnable); c) { + bool requested = *c != 0; + if (requested != enableDpf_) { + enableDpf_ = requested; + frameContext.dpf.update = true; + LOG(RkISP1Dpf, Info) << "DPF global " << (enableDpf_ ? "enabled" : "disabled"); + } + } + context.activeState.dpf.denoise = enableDpf_; + frameContext.dpf.denoise = enableDpf_; +} + /** * \copydoc libcamera::ipa::Algorithm::queueRequest */ @@ -237,38 +251,8 @@ void Dpf::queueRequest(IPAContext &context, IPAFrameContext &frameContext, const ControlList &controls) { - auto &dpf = context.activeState.dpf; - bool update = false; - - const auto &denoise = controls.get(controls::draft::NoiseReductionMode); - if (denoise) { - LOG(RkISP1Dpf, Debug) << "Set denoise to " << *denoise; - - switch (*denoise) { - case controls::draft::NoiseReductionModeOff: - if (dpf.denoise) { - dpf.denoise = false; - update = true; - } - break; - case controls::draft::NoiseReductionModeMinimal: - case controls::draft::NoiseReductionModeHighQuality: - case controls::draft::NoiseReductionModeFast: - if (!dpf.denoise) { - dpf.denoise = true; - update = true; - } - break; - default: - LOG(RkISP1Dpf, Error) - << "Unsupported denoise value " - << *denoise; - break; - } - } - - frameContext.dpf.denoise = dpf.denoise; - frameContext.dpf.update = update; + frameContext.dpf.update = false; + handleEnableControl(controls, frameContext, context); } /** diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index faeb6c27..c01f711c 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -50,6 +50,7 @@ private: bool useIsoLevels_ = false; bool enableDpf_ = true; /* YAML master enable */ + void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) override; bool parseConfig(const YamlObject &tuningData) override; bool parseSingleConfig(const YamlObject &config, rkisp1_cif_isp_dpf_config &cfg,
Implement handleEnableControl() to process the DpfEnable control and synchronize the enable state across context and frame state. Update queueRequest() to call this handler, clearing the update flag first. The enable control allows applications to globally enable/disable DPF processing without changing other configuration. Changes are logged and trigger frame updates. This replaces the previous draft::NoiseReductionMode handling with the new RkISP1-specific DpfEnable control. Signed-off-by: Rui Wang <rui.wang@ideasonboard.com> --- src/ipa/rkisp1/algorithms/denoise.h | 1 + src/ipa/rkisp1/algorithms/dpf.cpp | 48 ++++++++++------------------- src/ipa/rkisp1/algorithms/dpf.h | 1 + 3 files changed, 18 insertions(+), 32 deletions(-)