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_;