[v1,06/11] ipa: rkisp1: algorithms: dpf: detect DPF dev overrides
diff mbox series

Message ID 20251125000848.4103786-7-rui.wang@ideasonboard.com
State New
Headers show
Series
  • ipa: rkisp1: DPF refactor and tuning improvements
Related show

Commit Message

Rui Wang Nov. 25, 2025, 12:08 a.m. UTC
Introduce checkDevModeOverridesChanged() to detect when developer-mode
controls have been modified. This function compares override values against
the current hardware configuration for:
- Spatial coefficients (green and RB)
- RB filter size
- NLL coefficients and scale mode

Updates queueRequest() to trigger hardware updates whenever dev-mode
overrides differ from active settings. This ensures spatial kernels, NLL
tables, and filter size changes are applied immediately in manual mode.

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

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp
index 2d7d6414..0b070206 100644
--- a/src/ipa/rkisp1/algorithms/dpf.cpp
+++ b/src/ipa/rkisp1/algorithms/dpf.cpp
@@ -424,6 +424,56 @@  void Dpf::collectManualOverrides(const ControlList &controls)
 	}
 }
 
+bool Dpf::checkOverridesChanged()
+{
+	/* Check strength always (not dev-mode specific) */
+	if (overrides_.strength) {
+		if (overrides_.strength->r != strengthConfig_.r ||
+		    overrides_.strength->g != strengthConfig_.g ||
+		    overrides_.strength->b != strengthConfig_.b) {
+			return true;
+		}
+	}
+
+	if (!isDevMode())
+		return false;
+
+	if (overrides_.spatialGreen &&
+	    !std::equal(overrides_.spatialGreen->coeffs.begin(), overrides_.spatialGreen->coeffs.end(),
+			config_.g_flt.spatial_coeff)) {
+		return true;
+	}
+	if (overrides_.spatialRb &&
+	    !std::equal(overrides_.spatialRb->coeffs.begin(), overrides_.spatialRb->coeffs.end(),
+			config_.rb_flt.spatial_coeff)) {
+		return true;
+	}
+	if (overrides_.rbSize) {
+		bool currentRbSize =
+			(config_.rb_flt.fltsize == RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9)
+				? 1
+				: 0;
+		if (*overrides_.rbSize != currentRbSize) {
+			return true;
+		}
+	}
+	if (overrides_.nll) {
+		bool coeffsChanged =
+			!std::equal(overrides_.nll->coeffs.begin(),
+				    overrides_.nll->coeffs.end(),
+				    config_.nll.coeff);
+		bool scaleChanged =
+			overrides_.nll->scaleMode !=
+			(config_.nll.scale_mode == RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC
+				 ? 1
+				 : 0);
+		if (coeffsChanged || scaleChanged) {
+			return true;
+		}
+	}
+	return false;
+}
+
 /**
  * \copydoc libcamera::ipa::Algorithm::queueRequest
  */
diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h
index 4cbd7414..d6707d34 100644
--- a/src/ipa/rkisp1/algorithms/dpf.h
+++ b/src/ipa/rkisp1/algorithms/dpf.h
@@ -79,6 +79,7 @@  private:
 					uint32_t frame) override;
 	void loadReductionModeConfig(IPAFrameContext &frameContext);
 	void collectManualOverrides(const ControlList &controls) override;
+	bool checkOverridesChanged();
 	bool parseConfig(const YamlObject &tuningData) override;
 	bool parseSingleConfig(const YamlObject &tuningData,
 			       rkisp1_cif_isp_dpf_config &config,