From patchwork Tue Oct 28 17:08:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 24863 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id EAF44BE080 for ; Tue, 28 Oct 2025 17:09:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2560F6085B; Tue, 28 Oct 2025 18:09:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RxZT9WRz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A966760840 for ; Tue, 28 Oct 2025 18:09:18 +0100 (CET) Received: from rui-Precision-7560.local (unknown [209.216.122.90]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B97D016A7; Tue, 28 Oct 2025 18:07:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761671250; bh=QPqeJ3qV3kxcVH0Yz7W/FsO3VOQKFjM7mgOFJmo0700=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RxZT9WRznN5vs+QKLowacY6Sz4M8qrbxNjL+VgV+t8vpZT1WMsjLZh2dMcXBvp6Wt Xc4tWJLG/WJPI+qFh4tFq9I2xvIULnyjCWnfPcVlJiCkde2n/5jyXfCHi+yRcLsX9v ZjcN6jtQqfewy1e8PU8qCJ08YfZ5yrBgIJNebmpY= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 11/16] ipa: rkisp1: algorithms: dpf: detect DPF dev overrides Date: Tue, 28 Oct 2025 13:08:40 -0400 Message-ID: <20251028170847.2673396-11-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251028170847.2673396-1-rui.wang@ideasonboard.com> References: <20251028170847.2673396-1-rui.wang@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- src/ipa/rkisp1/algorithms/dpf.cpp | 51 +++++++++++++++++++++++++++++++ src/ipa/rkisp1/algorithms/dpf.h | 5 +++ 2 files changed, 56 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index 145f10b7..cefa5da5 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -290,6 +290,54 @@ void Dpf::collectManualOverrides(const ControlList &controls) } } +bool Dpf::checkDevModeOverridesChanged() +{ + if (!isDevMode()) + return false; + + bool changed = false; + if (overrides_.spatialGreen) { + bool coeffsChanged = false; + for (unsigned i = 0; i < RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS; ++i) { + if (overrides_.spatialGreen->coeffs[i] != config_.g_flt.spatial_coeff[i]) { + coeffsChanged = true; + break; + } + } + if (coeffsChanged) { + changed = true; + } + } + if (overrides_.spatialRb) { + bool coeffsChanged = false; + for (unsigned i = 0; i < RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS; ++i) { + if (overrides_.spatialRb->coeffs[i] != config_.rb_flt.spatial_coeff[i]) { + coeffsChanged = true; + break; + } + } + if (coeffsChanged) { + changed = true; + } + } + if (overrides_.rbSize && *overrides_.rbSize != (config_.rb_flt.fltsize == RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9 ? 1 : 0)) { + changed = true; + } + if (overrides_.nll) { + bool coeffsChanged = false; + for (unsigned i = 0; i < RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS; ++i) { + if (overrides_.nll->coeffs[i] != config_.nll.coeff[i]) { + coeffsChanged = true; + break; + } + } + if (coeffsChanged || overrides_.nll->scaleMode != (config_.nll.scale_mode == RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC ? 1 : 0)) { + changed = true; + } + } + return changed; +} + /** * \copydoc libcamera::ipa::Algorithm::queueRequest */ @@ -310,6 +358,9 @@ void Dpf::queueRequest(IPAContext &context, overrides_.strength->b != strengthConfig_.b)) { frameContext.dpf.update = true; } + if (checkDevModeOverridesChanged()) { + frameContext.dpf.update = true; + } } } diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index 1a33a8c4..b971619b 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -80,8 +80,13 @@ private: bool enableDpf_ = true; /* YAML master enable */ void handleEnableControl(const ControlList &controls, IPAFrameContext &frameContext, IPAContext &context) override; + void collectManualOverrides(const ControlList &controls) override; + + bool checkDevModeOverridesChanged(); + bool parseConfig(const YamlObject &tuningData) override; + bool parseSingleConfig(const YamlObject &config, rkisp1_cif_isp_dpf_config &cfg, rkisp1_cif_isp_dpf_strength_config &strength);