From patchwork Wed Jan 14 11:58:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 25790 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 8C027C3226 for ; Wed, 14 Jan 2026 11:58:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 52B9C61FD8; Wed, 14 Jan 2026 12:58:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LsIgyXlQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E699B61FC1 for ; Wed, 14 Jan 2026 12:58:28 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b781:dff2:957:7831]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 3BFD26A8; Wed, 14 Jan 2026 12:58:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768391882; bh=MOI5N6IRma7MhEbzHhWpvQFpFqWsD3F/bk/CxbcJ024=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LsIgyXlQfq9qzR5RrvfO9y+Dh2YqkAMiETjhsMBXqc8zRTs0ndg9jFBydn7KzG5bQ GHZUgelz+JVPxMZtEcdkpCHa8O8Id8DxqiiR7S/ptBFMWUshoRSE/7evxt9f3VQ9Ef qUsJP7YLWKOs88WVuSEo6tLsEMV3MQOY9hguzdmU= From: Stefan Klug Date: Wed, 14 Jan 2026 12:58:03 +0100 Subject: [PATCH v3 10/15] ipa: libipa: interpolator: Drop key quantization MIME-Version: 1.0 Message-Id: <20260114-sklug-lsc-resampling-v2-dev-v3-10-80cd24f4dd61@ideasonboard.com> References: <20260114-sklug-lsc-resampling-v2-dev-v3-0-80cd24f4dd61@ideasonboard.com> In-Reply-To: <20260114-sklug-lsc-resampling-v2-dev-v3-0-80cd24f4dd61@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Mailer: b4 0.14.2 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" The quantization of the interpolation key was only used by the LSC algorithm. There it lead to difficult to read code was removed. As there is no remaining user of it, drop it from the Interpolator class. While at it, cleanup the includes. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham Reviewed-by: Barnabás Pőcze --- Changes in v3: - Collected tags Changes in v2: - Added this patch --- src/ipa/libipa/interpolator.cpp | 25 +------------------------ src/ipa/libipa/interpolator.h | 14 +------------- test/ipa/libipa/interpolator.cpp | 7 ------- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/ipa/libipa/interpolator.cpp b/src/ipa/libipa/interpolator.cpp index f901a86e4c74db6708a61e5491aa68f231e4a318..00bf66b6c2af3ce2cd9a94d5e02290c14fa3ba50 100644 --- a/src/ipa/libipa/interpolator.cpp +++ b/src/ipa/libipa/interpolator.cpp @@ -6,15 +6,8 @@ */ #include "interpolator.h" -#include -#include - #include -#include "libcamera/internal/yaml_parser.h" - -#include "interpolator.h" - /** * \file interpolator.h * \brief Helper class for linear interpolating a set of objects @@ -104,20 +97,6 @@ namespace ipa { * \return Zero on success, negative error code otherwise */ -/** - * \fn void Interpolator::setQuantization(const unsigned int q) - * \brief Set the quantization value - * \param[in] q The quantization value - * - * Sets the quantization value. When this is set, 'key' gets quantized to this - * size, before doing the interpolation. This can help in reducing the number of - * updates pushed to the hardware. - * - * Note that normally a threshold needs to be combined with quantization. - * Otherwise a value that swings around the edge of the quantization step will - * lead to constant updates. - */ - /** * \fn void Interpolator::setData(std::map &&data) * \brief Set the internal map @@ -136,10 +115,8 @@ namespace ipa { * \fn const T& Interpolator::getInterpolated() * \brief Retrieve an interpolated value for the given key * \param[in] key The unsigned integer key of the object to retrieve - * \param[out] quantizedKey If provided, the key value after quantization * \return The object corresponding to the key. The object is cached internally, - * so on successive calls with the same key (after quantization) interpolation - * is not recalculated. + * so on successive calls with the same key interpolation is not recalculated. */ /** diff --git a/src/ipa/libipa/interpolator.h b/src/ipa/libipa/interpolator.h index 7880db6976d15aa033678f4aeb4934f5cd785bd9..fb2c611d186ed2bc8a733bdbb4273fca47942565 100644 --- a/src/ipa/libipa/interpolator.h +++ b/src/ipa/libipa/interpolator.h @@ -70,11 +70,6 @@ public: return 0; } - void setQuantization(const unsigned int q) - { - quantization_ = q; - } - void setData(std::map &&data) { data_ = std::move(data); @@ -86,16 +81,10 @@ public: return data_; } - const T &getInterpolated(unsigned int key, unsigned int *quantizedKey = nullptr) + const T &getInterpolated(unsigned int key) { ASSERT(data_.size() > 0); - if (quantization_ > 0) - key = std::lround(key / static_cast(quantization_)) * quantization_; - - if (quantizedKey) - *quantizedKey = key; - if (lastInterpolatedKey_.has_value() && *lastInterpolatedKey_ == key) return lastInterpolatedValue_; @@ -128,7 +117,6 @@ private: std::map data_; T lastInterpolatedValue_; std::optional lastInterpolatedKey_; - unsigned int quantization_ = 0; }; } /* namespace ipa */ diff --git a/test/ipa/libipa/interpolator.cpp b/test/ipa/libipa/interpolator.cpp index 6abb776060d43b8339cf9b632cac1806a9c5f9b0..03b7089a7a05fb1a2b6ee568ad8e92ad7ac716ee 100644 --- a/test/ipa/libipa/interpolator.cpp +++ b/test/ipa/libipa/interpolator.cpp @@ -40,13 +40,6 @@ protected: ASSERT_EQ(interpolator.getInterpolated(30), 300); ASSERT_EQ(interpolator.getInterpolated(40), 300); - interpolator.setQuantization(10); - unsigned int q = 0; - ASSERT_EQ(interpolator.getInterpolated(25, &q), 300); - ASSERT_EQ(q, 30); - ASSERT_EQ(interpolator.getInterpolated(24, &q), 200); - ASSERT_EQ(q, 20); - return TestPass; } };