[v10,3/7] ipa: rkisp1: algorithms: register noise reduction controls
diff mbox series

Message ID 20260120153057.1703714-4-rui.wang@ideasonboard.com
State New
Headers show
Series
  • refactor DPF parsing and initialization
Related show

Commit Message

Rui Wang Jan. 20, 2026, 3:30 p.m. UTC
Register NoiseReductionMode controls based on the tuning data and default
to the active DPF mode. Remove the static NoiseReductionMode entry from
the IPA control map now that DPF owns its registration.

Signed-off-by: Rui Wang <rui.wang@ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/dpf.cpp | 21 +++++++++++++++++++++
 src/ipa/rkisp1/algorithms/dpf.h   |  1 +
 src/ipa/rkisp1/rkisp1.cpp         |  1 -
 3 files changed, 22 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp
index 659a1a82..21ce8ace 100644
--- a/src/ipa/rkisp1/algorithms/dpf.cpp
+++ b/src/ipa/rkisp1/algorithms/dpf.cpp
@@ -77,6 +77,9 @@  int Dpf::init([[maybe_unused]] IPAContext &context,
 	if (ret)
 		return ret;
 
+	/* Register available controls. */
+	registerControls(context);
+
 	return 0;
 }
 
@@ -136,6 +139,24 @@  int Dpf::parseConfig(const YamlObject &tuningData)
 	return 0;
 }
 
+void Dpf::registerControls(IPAContext &context)
+{
+	/*
+	 * Populate the control map with the available noise reduction modes.
+	 * This allows applications to query and select from the modes defined
+	 * in the tuning data.
+	 */
+	std::vector<ControlValue> modes{ controls::draft::NoiseReductionModeOff };
+	for (const auto &mode : noiseReductionModes_) {
+		modes.emplace_back(mode.modeValue);
+	}
+	/*
+	 * Set the default mode to the active mode.
+	 */
+	context.ctrlMap[&controls::draft::NoiseReductionMode] =
+		ControlInfo(modes, activeMode_->modeValue);
+}
+
 int Dpf::parseSingleConfig(const YamlObject &tuningData,
 			   rkisp1_cif_isp_dpf_config &config,
 			   rkisp1_cif_isp_dpf_strength_config &strengthConfig)
diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h
index 11fc88e4..43effcbe 100644
--- a/src/ipa/rkisp1/algorithms/dpf.h
+++ b/src/ipa/rkisp1/algorithms/dpf.h
@@ -37,6 +37,7 @@  private:
 	};
 
 	int parseConfig(const YamlObject &tuningData);
+	void registerControls(IPAContext &context);
 	int parseSingleConfig(const YamlObject &tuningData,
 			      rkisp1_cif_isp_dpf_config &config,
 			      rkisp1_cif_isp_dpf_strength_config &strengthConfig);
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index fbcc3910..402ed62c 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -120,7 +120,6 @@  const IPAHwSettings ipaHwSettingsV12{
 /* List of controls handled by the RkISP1 IPA */
 const ControlInfoMap::Map rkisp1Controls{
 	{ &controls::DebugMetadataEnable, ControlInfo(false, true, false) },
-	{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
 };
 
 } /* namespace */