From patchwork Sun Feb 8 17:44:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 26104 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 734A0BD78E for ; Sun, 8 Feb 2026 17:45:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B03A66209D; Sun, 8 Feb 2026 18:45:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rZVKJSyh"; 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 6984D61FC6 for ; Sun, 8 Feb 2026 18:45:43 +0100 (CET) Received: from rui-Precision-7560.tail5b760b.ts.net (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 94B3516AE; Sun, 8 Feb 2026 18:44:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770572698; bh=Tn4eHwTeLZtRNw3dLTBBXMQ5eWqhoyRAk65CZtNdcoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZVKJSyhDRWCjkTu0zxWXYnUhQPte54S43SF7gRLPJau275CyhtXELOFP21GNqxLR 6TsTUWNm7Xq/DD1F2RRBdQRin64gdUG5BTNSEK9zXgGMwB72pzmTsUt32qZ56I3IuM 5qQNMYZG6tAk/HoeQwwJ/TQQsbj/WABhOwT9lrLc= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 1/4] libcamera: rkisp1: Define Denoise Pre-Filter (DPF) controls Date: Sun, 8 Feb 2026 12:44:47 -0500 Message-ID: <20260208174450.416314-2-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260208174450.416314-1-rui.wang@ideasonboard.com> References: <20260208174450.416314-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 vendor-specific controls for the Rockchip ISP1 Denoise Pre-Filter (DPF) algorithm. These controls allow detailed configuration of the DPF block, including: - DpfEnable: Enable/disable DPF processing. - DpfChannelStrengths: Per-channel filter strength configuration. - DpfGreenSpatialCoefficients: Spatial kernel coefficients for the Green channel. - DpfRedBlueSpatialCoefficients: Spatial kernel coefficients for Red/Blue channels. - DpfRedBlueFilterSize: Filter size selection (9x9 or 13x9). - DpfNoiseLevelLookupCoefficients: Noise Level Lookup (NLL) table coefficients. - DpfNoiseLevelLookupScaleMode: NLL scaling mode (Linear/Logarithmic). Add 'NoiseReductionModeManual' to the draft control definitions to support manual control of noise reduction parameters. The 'rkisp1' vendor controls are registered in the build system with a dedicated control ID range. Signed-off-by: Rui Wang --- include/libcamera/meson.build | 1 + src/libcamera/control_ids_draft.yaml | 4 ++ src/libcamera/control_ids_rkisp1.yaml | 93 +++++++++++++++++++++++++++ src/libcamera/control_ranges.yaml | 4 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 src/libcamera/control_ids_rkisp1.yaml diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 30ea76f9..3fd7ef94 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -39,6 +39,7 @@ controls_map = { 'draft': 'control_ids_draft.yaml', 'rpi/pisp': 'control_ids_rpi.yaml', 'rpi/vc4': 'control_ids_rpi.yaml', + 'rkisp1': 'control_ids_rkisp1.yaml', }, 'properties': { diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml index 03309eea..97ccda1c 100644 --- a/src/libcamera/control_ids_draft.yaml +++ b/src/libcamera/control_ids_draft.yaml @@ -58,6 +58,10 @@ controls: value: 4 description: | Noise reduction is applied at different levels to different streams. + - name: NoiseReductionModeManual + value: 5 + description: | + Manual control all noise reduction parameters. - ColorCorrectionAberrationMode: type: int32_t diff --git a/src/libcamera/control_ids_rkisp1.yaml b/src/libcamera/control_ids_rkisp1.yaml new file mode 100644 index 00000000..7ce9533a --- /dev/null +++ b/src/libcamera/control_ids_rkisp1.yaml @@ -0,0 +1,93 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Copyright (C) 2026, Ideas On Board +# +# RkISP1 specific control definitions +--- +vendor: rkisp1 +controls: + - DpfEnable: + type: int32_t + direction: inout + description: | + Enable or disable the Denoise Pre-Filter (DPF) processing. + When disabled (false) the hardware DPF is forced off regardless of + denoise mode selection. When enabled (true) the algorithm may + program parameters and adapt them from manual mode overrides. + Reported in metadata as an int32_t. + enum: + - name: DpfEnableOff + value: 0 + description: The DPF is disabled. + - name: DpfEnableOn + value: 1 + description: The DPF is enabled. + + - DpfChannelStrengths: + type: int32_t + direction: inout + description: | + Sets the filter strength for Red, Green, and Blue channels respectively. + Values map to hardware strength registers (typically 0..255). + Size must be exactly 3 when set. Order: R, G, B. + size: [3] + + - DpfGreenSpatialCoefficients: + type: int32_t + direction: inout + description: | + Sets the 6 spatial kernel coefficients for the Green channel (9x9 kernel). + Order must follow the hardware expectation. + Each value corresponds to a coefficient (typically 0..16). + All 6 values are required when provided; otherwise ignored. + size: [6] + + - DpfRedBlueSpatialCoefficients: + type: int32_t + direction: inout + description: | + Sets the spatial kernel coefficients for the Red and Blue channels. + Applies to either 9x9 or 13x9 filter size. + For 9x9 mode, the 6th value is ignored by the driver if 6 are provided, + or pass 5 values if supported. + Values correspond to coefficients (typically 0..16). + size: [6] + + - DpfRedBlueFilterSize: + type: int32_t + direction: inout + description: | + Sets the filter size for the Red and Blue channels. + Values correspond to hardware filter size settings. + enum: + - name: DpfRedBlueFilterSize9x9 + value: 0 + description: 9x9 filter size. + - name: DpfRedBlueFilterSize13x9 + value: 1 + description: 13x9 filter size. + + - DpfNoiseLevelLookupCoefficients: + type: int32_t + direction: inout + description: | + Sets the 17 coefficients for the Noise Level Lookup (NLL) table. + The table defines a piecewise-linear function characterizing sensor noise. + Must supply the full set of 17 values when used. + Values correspond to coefficients (typically 1..1023). + size: [17] + + - DpfNoiseLevelLookupScaleMode: + type: int32_t + direction: inout + description: | + Sets the NLL scale mode (0=linear, 1=logarithmic). + Matches hardware RKISP1_CIF_ISP_NLL_SCALE_* constants. + enum: + - name: DpfNoiseLevelLookupScaleLinear + value: 0 + description: Linear scale. + - name: DpfNoiseLevelLookupScaleLogarithmic + value: 1 + description: Logarithmic scale. +... \ No newline at end of file diff --git a/src/libcamera/control_ranges.yaml b/src/libcamera/control_ranges.yaml index 6752eb98..4964894b 100644 --- a/src/libcamera/control_ranges.yaml +++ b/src/libcamera/control_ranges.yaml @@ -15,6 +15,8 @@ ranges: rpi: 20000 # Controls for debug metadata debug: 30000 - # Next range starts at 40000 + # Rockchip ISP1 vendor controls + rkisp1: 40000 + # Next range starts at 50000 ... From patchwork Sun Feb 8 17:44:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 26105 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 08D57BD78E for ; Sun, 8 Feb 2026 17:45:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8B551620B8; Sun, 8 Feb 2026 18:45:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SpaxgjD0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B85D620A3 for ; Sun, 8 Feb 2026 18:45:44 +0100 (CET) Received: from rui-Precision-7560.tail5b760b.ts.net (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B4CB6E72; Sun, 8 Feb 2026 18:44:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770572699; bh=9Lz7WXkX5zZBIll/anol1T/awTSdG+P6YmmQZ1GcNVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SpaxgjD0enaK/sAnisRqvsIlgdwwUR9fCxQxd7e/3b42CjK8Pbksb9Z+DPpleQc7c X2+jZnbQnMAeaqRt3fjCrPl27iYrLbz5fFiiOKApAq/oJKJBTO/OFGBSR8yw3lF6QY NXi7igsDtQtIlhcUY+C7Go5eX9jdnjmhtcKxWmlA= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 2/4] ipa: rkisp1: dpf: Implement manual noise reduction mode Date: Sun, 8 Feb 2026 12:44:48 -0500 Message-ID: <20260208174450.416314-3-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260208174450.416314-1-rui.wang@ideasonboard.com> References: <20260208174450.416314-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" Support manual control of the Denoise Pre-Filter (DPF) parameters. - When the manual noise reduction mode is selected, apply the control values to the DPF configuration and enable the hardware block if requested. - DPF register values can be applied manually from controls. Register the DPF vendor controls with appropriate limits and defaults. Signed-off-by: Rui Wang --- src/ipa/rkisp1/algorithms/dpf.cpp | 116 +++++++++++++++++++++++++++++- src/ipa/rkisp1/algorithms/dpf.h | 1 + 2 files changed, 116 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index df6bef87..c232f2ad 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -135,6 +135,49 @@ void Dpf::registerControls(IPAContext &context) */ context.ctrlMap[&controls::draft::NoiseReductionMode] = ControlInfo(modes, activeMode_->modeValue); + if (noiseReductionModes_.empty()) + return; + /* if active mode is setted, set active mode config to control map + else set first mode config to control map + */ + const ModeConfig *config = nullptr; + if (activeMode_->modeValue != controls::draft::NoiseReductionModeOff) + config = &(*activeMode_); + else + config = &noiseReductionModes_[0]; + /* Set the default enable value to the active mode */ + context.ctrlMap[&controls::rkisp1::DpfEnable] = ControlInfo(0, 1, config->modeValue == controls::draft::NoiseReductionModeOff ? 0 : 1); + + std::array strengthDefault = { + static_cast(config->strength.r), + static_cast(config->strength.g), + static_cast(config->strength.b) + }; + context.ctrlMap[&controls::rkisp1::DpfChannelStrengths] = + ControlInfo(1, 255, Span(strengthDefault)); + + std::array greenCoeffs; + std::copy(std::begin(config->dpf.g_flt.spatial_coeff), std::end(config->dpf.g_flt.spatial_coeff), greenCoeffs.begin()); + context.ctrlMap[&controls::rkisp1::DpfGreenSpatialCoefficients] = + ControlInfo(0, 16, Span(greenCoeffs)); + + context.ctrlMap[&controls::rkisp1::DpfRedBlueFilterSize] = + ControlInfo(controls::rkisp1::DpfRedBlueFilterSizeValues, + ControlValue(static_cast(config->dpf.rb_flt.fltsize))); + + std::array redBlueCoeffs; + std::copy(std::begin(config->dpf.rb_flt.spatial_coeff), std::end(config->dpf.rb_flt.spatial_coeff), redBlueCoeffs.begin()); + context.ctrlMap[&controls::rkisp1::DpfRedBlueSpatialCoefficients] = + ControlInfo(0, 16, Span(redBlueCoeffs)); + + std::array nllCoeffs; + std::copy(std::begin(config->dpf.nll.coeff), std::end(config->dpf.nll.coeff), nllCoeffs.begin()); + context.ctrlMap[&controls::rkisp1::DpfNoiseLevelLookupCoefficients] = + ControlInfo(1, 1023, Span(nllCoeffs)); + + context.ctrlMap[&controls::rkisp1::DpfNoiseLevelLookupScaleMode] = + ControlInfo(controls::rkisp1::DpfNoiseLevelLookupScaleModeValues, + ControlValue(static_cast(config->dpf.nll.scale_mode))); } int Dpf::parseSingleConfig(const YamlObject &tuningData, @@ -339,7 +382,8 @@ void Dpf::queueRequest(IPAContext &context, bool update = false; const auto &denoise = controls.get(controls::draft::NoiseReductionMode); - if (denoise) { + /* only update denoise mode when it has changed */ + if (denoise && activeMode_->modeValue != *denoise) { switch (*denoise) { case controls::draft::NoiseReductionModeOff: if (dpf.denoise) { @@ -351,6 +395,7 @@ void Dpf::queueRequest(IPAContext &context, case controls::draft::NoiseReductionModeHighQuality: case controls::draft::NoiseReductionModeFast: case controls::draft::NoiseReductionModeZSL: + case controls::draft::NoiseReductionModeManual: if (loadConfig(*denoise)) { update = true; dpf.denoise = true; @@ -365,6 +410,24 @@ void Dpf::queueRequest(IPAContext &context, if (update) LOG(RkISP1Dpf, Debug) << "Set denoise to " << *denoise; } + /* handle manual mode, collect all dpf config from controls */ + if (activeMode_->modeValue == controls::draft::NoiseReductionModeManual) { + /* + * In manual mode, if DpfEnable is present and true, we enable DPF. + * If DpfEnable is present and false, we disable DPF. + * If DpfEnable is not present, we keep the previous state (or default). + */ + const auto &enable = controls.get(controls::rkisp1::DpfEnable); + if (*enable) { + dpf.denoise = true; + update = true; + } + bool ret = parseControls(controls); + if (!ret) { + LOG(RkISP1Dpf, Error) << "Failed to collect manual overrides"; + return; + } + } frameContext.dpf.denoise = dpf.denoise; frameContext.dpf.update = update; @@ -437,6 +500,57 @@ void Dpf::prepareEnabledMode(IPAContext &context, IPAFrameContext &frameContext, logConfig(frameContext, *config, *strengthConfig); } +bool Dpf::parseControls(const ControlList &controls) +{ + /* + * activeMode_ is a const_iterator, so we need to find the mutable element + * in noiseReductionModes_, and parse the controls values into manualMode + * config + */ + const auto it = std::find_if(noiseReductionModes_.begin(), noiseReductionModes_.end(), + [](const ModeConfig &mode) { + return mode.modeValue == controls::draft::NoiseReductionModeManual; + }); + + if (it == noiseReductionModes_.end()) { + LOG(RkISP1Dpf, Error) << "Manual mode not found in configuration"; + return false; + } + + ModeConfig &config = *it; + + if (const auto &c = controls.get(controls::rkisp1::DpfGreenSpatialCoefficients); c) + if (c->size() == RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS) + std::copy(c->begin(), c->end(), std::begin(config.dpf.g_flt.spatial_coeff)); + + config.dpf.rb_flt.r_enable = true; + config.dpf.rb_flt.b_enable = true; + + if (const auto &c = controls.get(controls::rkisp1::DpfRedBlueSpatialCoefficients); c) { + if (c->size() == RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS || c->size() == RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS - 1) + std::copy(c->begin(), c->end(), std::begin(config.dpf.rb_flt.spatial_coeff)); + } + + if (const auto &c = controls.get(controls::rkisp1::DpfRedBlueFilterSize); c) + config.dpf.rb_flt.fltsize = *c; + + if (const auto &c = controls.get(controls::rkisp1::DpfNoiseLevelLookupCoefficients); c) + if (c->size() == RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS) + std::copy(c->begin(), c->end(), std::begin(config.dpf.nll.coeff)); + + if (const auto &c = controls.get(controls::rkisp1::DpfNoiseLevelLookupScaleMode); c) + config.dpf.nll.scale_mode = *c; + + if (const auto &c = controls.get(controls::rkisp1::DpfChannelStrengths); c) + if (c->size() == 3) { + config.strength.r = (*c)[0]; + config.strength.g = (*c)[1]; + config.strength.b = (*c)[2]; + } + + return true; +} + REGISTER_IPA_ALGORITHM(Dpf, "Dpf") } /* namespace ipa::rkisp1::algorithms */ diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index 66d3f302..e3dea97b 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -41,6 +41,7 @@ private: int parseSingleConfig(const YamlObject &tuningData, rkisp1_cif_isp_dpf_config &config, rkisp1_cif_isp_dpf_strength_config &strengthConfig); + bool parseControls(const ControlList &controls); bool loadConfig(int32_t mode); void logConfig(const IPAFrameContext &frameContext, From patchwork Sun Feb 8 17:44:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 26106 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 257FFC32E7 for ; Sun, 8 Feb 2026 17:45:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A86FB620E1; Sun, 8 Feb 2026 18:45:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ln7tv3TR"; 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 A91826209C for ; Sun, 8 Feb 2026 18:45:45 +0100 (CET) Received: from rui-Precision-7560.tail5b760b.ts.net (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EB57C16AE; Sun, 8 Feb 2026 18:44:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770572700; bh=YQePkAKvhcHED6tBDFRhHRcfhr9Wk5UlqB7GdP2lgWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ln7tv3TRkpQDPJ72JRLdrnIj05qWG2OLdoooUnTJDqBGZEe66BVtJlIjMiH7M5XbY IwLZYSSnoz36+OJ2hxkaoSYK0exiy2gvngxmCTP7eiwggXPNzcrCAViF1/ncPKf65y JFVCC7O4G9HTU6RwIyQK/44R6iFq5CNvmtUTA1nw= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 3/4] ipa: rkisp1: dpf: Report DPF configuration in metadata Date: Sun, 8 Feb 2026 12:44:49 -0500 Message-ID: <20260208174450.416314-4-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260208174450.416314-1-rui.wang@ideasonboard.com> References: <20260208174450.416314-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" - Populate the request metadata with the current DPF configuration values. - Including channel strengths, spatial coefficients, filter sizes, and noise level lookup table parameters. This allows applications to inspect the state of the DPF algorithm for each frame. - The metadata post only after controls are initilized Signed-off-by: Rui Wang --- src/ipa/rkisp1/algorithms/dpf.cpp | 42 +++++++++++++++++++++++++++++++ src/ipa/rkisp1/algorithms/dpf.h | 6 +++++ 2 files changed, 48 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/dpf.cpp b/src/ipa/rkisp1/algorithms/dpf.cpp index c232f2ad..174c4160 100644 --- a/src/ipa/rkisp1/algorithms/dpf.cpp +++ b/src/ipa/rkisp1/algorithms/dpf.cpp @@ -551,6 +551,48 @@ bool Dpf::parseControls(const ControlList &controls) return true; } +void Dpf::fillMetadata([[maybe_unused]] IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext, ControlList &metadata) +{ + /* Strength (R,G,B) */ + std::array strength{ activeMode_->strength.r, activeMode_->strength.g, activeMode_->strength.b }; + metadata.set(controls::rkisp1::DpfChannelStrengths, Span(strength)); + + /* Spatial kernels */ + std::array greenCoeffs; + std::copy(std::begin(activeMode_->dpf.g_flt.spatial_coeff), std::end(activeMode_->dpf.g_flt.spatial_coeff), greenCoeffs.begin()); + metadata.set(controls::rkisp1::DpfGreenSpatialCoefficients, + Span(greenCoeffs)); + + std::array redBlueCoeffs; + std::copy(std::begin(activeMode_->dpf.rb_flt.spatial_coeff), std::end(activeMode_->dpf.rb_flt.spatial_coeff), redBlueCoeffs.begin()); + metadata.set(controls::rkisp1::DpfRedBlueSpatialCoefficients, + Span(redBlueCoeffs)); + + metadata.set(controls::rkisp1::DpfRedBlueFilterSize, + static_cast(activeMode_->dpf.rb_flt.fltsize)); + + /* NLL coefficients and scale */ + std::array nllCoeffs; + std::copy(std::begin(activeMode_->dpf.nll.coeff), std::end(activeMode_->dpf.nll.coeff), nllCoeffs.begin()); + metadata.set(controls::rkisp1::DpfNoiseLevelLookupCoefficients, + Span(nllCoeffs)); + metadata.set(controls::rkisp1::DpfNoiseLevelLookupScaleMode, activeMode_->dpf.nll.scale_mode); +} + +/** + * \copydoc libcamera::ipa::Algorithm::process + */ +void Dpf::process(IPAContext &context, const uint32_t frame [[maybe_unused]], + IPAFrameContext &frameContext, + const rkisp1_stat_buffer *stats [[maybe_unused]], + ControlList &metadata) +{ + if (noiseReductionModes_.empty()) + return; + + fillMetadata(context, frameContext, metadata); +} + REGISTER_IPA_ALGORITHM(Dpf, "Dpf") } /* namespace ipa::rkisp1::algorithms */ diff --git a/src/ipa/rkisp1/algorithms/dpf.h b/src/ipa/rkisp1/algorithms/dpf.h index e3dea97b..62f5e2f7 100644 --- a/src/ipa/rkisp1/algorithms/dpf.h +++ b/src/ipa/rkisp1/algorithms/dpf.h @@ -28,6 +28,10 @@ public: void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, RkISP1Params *params) override; + void process(IPAContext &context, const uint32_t frame, + IPAFrameContext &frameContext, + const rkisp1_stat_buffer *stats, + ControlList &metadata) override; private: struct ModeConfig { @@ -51,6 +55,8 @@ private: void prepareDisabledMode(RkISP1Params *params); void prepareEnabledMode(IPAContext &context, IPAFrameContext &frameContext, RkISP1Params *params); + void fillMetadata(IPAContext &context, IPAFrameContext &frameContext, + ControlList &metadata); std::vector noiseReductionModes_; std::vector::const_iterator activeMode_; From patchwork Sun Feb 8 17:44:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 26107 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 F1719BD78E for ; Sun, 8 Feb 2026 17:45:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74A76620C6; Sun, 8 Feb 2026 18:45:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZnPEwZSV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DE67862084 for ; Sun, 8 Feb 2026 18:45:46 +0100 (CET) Received: from rui-Precision-7560.tail5b760b.ts.net (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 159F9E72; Sun, 8 Feb 2026 18:45:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770572701; bh=KHs09+N78NeNO/zmhRdUoLG+GTk62GEFQNQWPOpaq5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnPEwZSVlHzSpBS6Dlpc8GCcc0kI+NX3rC5Nlao+NXEhz0/yFlFxjWGPCItgQjFMa eUDyqkAbLHGOpcvxCLA/CfLYHmlzHl/p59qpHGGkf5l506rGFdCcfCktQwQn0CDy2s RUjIh63wa8GDoO7mHAI5I6Li5yySPxJgYIEe8fE8= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v1 4/4] ipa: rkisp1: data: imx219: Add Manual DPF tuning Date: Sun, 8 Feb 2026 12:44:50 -0500 Message-ID: <20260208174450.416314-5-rui.wang@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260208174450.416314-1-rui.wang@ideasonboard.com> References: <20260208174450.416314-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" - Update the IMX219 dpf tuning data - Add NoiseReductionModeManual configurations - Set Manual mode configuration as default mode Signed-off-by: Rui Wang --- src/ipa/rkisp1/data/imx219.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ipa/rkisp1/data/imx219.yaml b/src/ipa/rkisp1/data/imx219.yaml index e8d2acbb..98fb5d5f 100644 --- a/src/ipa/rkisp1/data/imx219.yaml +++ b/src/ipa/rkisp1/data/imx219.yaml @@ -126,8 +126,8 @@ algorithms: b: 60 NoiseReductionModeHighQuality: DomainFilter: - g: [ 22, 18, 13, 8, 5, 2 ] - rb: [ 20, 18, 16, 11, 7, 3 ] + g: [ 15, 12, 9, 6, 3, 1 ] + rb: [ 15, 12, 9, 6, 3, 1 ] NoiseLevelFunction: coeff: [ 0, 26, 52, 78, 106, 138, 172, 208, 248, 292, 340, 392, 448, 508, 572, 640, 712 ] scale-mode: "linear" @@ -135,5 +135,16 @@ algorithms: r: 130 g: 130 b: 130 - activeMode: "NoiseReductionModeHighQuality" + NoiseReductionModeManual: + DomainFilter: + g: [ 10, 8, 6, 4, 2, 1 ] + rb: [ 10, 8, 6, 4, 2, 1 ] + NoiseLevelFunction: + coeff: [ 0, 26, 52, 78, 106, 138, 172, 208, 248, 292, 340, 392, 448, 508, 572, 640, 712 ] + scale-mode: "linear" + FilterStrength: + r: 130 + g: 130 + b: 130 + activeMode: "NoiseReductionModeManual" ...