[v6,5/6] ipa: rkisp1: algorithms: dpf: Add detailed config logging
diff mbox series

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

Commit Message

Rui Wang Dec. 18, 2025, 11:22 p.m. UTC
Add logConfig() helper function to log DPF configuration
updates when they occur. This provides visibility into the active
DPF parameters including:

- Control mode and denoise enable state
- Filter sizes (9x9 vs 13x9 for rb)
- NLL scale mode (linear vs logarithmic)
- Gain mode
- Strength values (r, g, b)
- Spatial filter coefficients (g and rb arrays)
- Noise level lookup table coefficients

The logging is triggered in prepareEnabledMode() whenever the
configuration is updated, helping with debugging and tuning.

Signed-off-by: Rui Wang <rui.wang@ideasonboard.com>
---
changelog since v5:  
 - remove curly bracket in single state if-else

 Reviewed-by tags from v5 are carried over (no function changes).
 
 src/ipa/rkisp1/algorithms/dpf.cpp | 44 +++++++++++++++++++++++++++++++
 src/ipa/rkisp1/algorithms/dpf.h   |  1 +
 2 files changed, 45 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp
index 2c28e38f..8e37b548 100644
--- a/src/ipa/rkisp1/algorithms/dpf.cpp
+++ b/src/ipa/rkisp1/algorithms/dpf.cpp
@@ -266,6 +266,47 @@  bool Dpf::loadReductionConfig(int32_t mode)
 	return true;
 }
 
+void Dpf::logConfig(const IPAFrameContext &frameContext)
+{
+	std::ostringstream ss;
+
+	ss << "DPF config update: ";
+	ss << " control mode=" << kModesMap.at(runningMode_);
+	ss << ", denoise=" << (frameContext.dpf.denoise ? "enabled" : "disabled");
+
+	ss << ", rb_fltsize="
+	   << (config_.rb_flt.fltsize == RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9 ? "13x9" : "9x9");
+	ss << ", nll_scale="
+	   << (config_.nll.scale_mode == RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC ? "log" : "linear");
+	ss << ", gain_mode=" << config_.gain.mode;
+	ss << ", strength=" << int(strengthConfig_.r) << ',' << int(strengthConfig_.g) << ',' << int(strengthConfig_.b);
+
+	ss << ", g=[";
+	for (size_t i = 0; i < RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS; ++i) {
+		if (i)
+			ss << ',';
+		ss << int(config_.g_flt.spatial_coeff[i]);
+	}
+	ss << "]";
+
+	ss << ", rb=[";
+	for (size_t i = 0; i < RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS; ++i) {
+		if (i)
+			ss << ',';
+		ss << int(config_.rb_flt.spatial_coeff[i]);
+	}
+	ss << "]";
+
+	ss << ", nll=[";
+	for (size_t i = 0; i < RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS; ++i) {
+		if (i)
+			ss << ',';
+		ss << int(config_.nll.coeff[i]);
+	}
+	ss << "]";
+	LOG(RkISP1Dpf, Debug) << ss.str();
+}
+
 /**
  * \copydoc libcamera::ipa::Algorithm::queueRequest
  */
@@ -374,6 +415,9 @@  void Dpf::prepareEnabledMode(IPAContext &context, [[maybe_unused]] const uint32_
 	auto strengthConfig = params->block<BlockType::DpfStrength>();
 	strengthConfig.setEnabled(true);
 	*strengthConfig = strengthConfig_;
+
+	if (frameContext.dpf.update)
+		logConfig(frameContext);
 }
 
 REGISTER_IPA_ALGORITHM(Dpf, "Dpf")
diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h
index fcf121cb..1821da39 100644
--- a/src/ipa/rkisp1/algorithms/dpf.h
+++ b/src/ipa/rkisp1/algorithms/dpf.h
@@ -43,6 +43,7 @@  private:
 			      rkisp1_cif_isp_dpf_strength_config &strengthConfig);
 
 	bool loadReductionConfig(int32_t mode);
+	void logConfig(const IPAFrameContext &frameContext);
 
 	void prepareDisabledMode(IPAContext &context, const uint32_t frame,
 				 IPAFrameContext &frameContext,