From patchwork Wed Jul 8 09:25:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 27278 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 563B5C3318 for ; Wed, 8 Jul 2026 09:25:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CC6DE66093; Wed, 8 Jul 2026 11:25:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="epgyJxfK"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1699466073 for ; Wed, 8 Jul 2026 11:25:09 +0200 (CEST) Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 700711F14; Wed, 8 Jul 2026 11:24:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1783502659; bh=7XkAt6FRI8LhqnI83clJrAZRF1EQa6l6JYmohhS5970=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=epgyJxfKPUlpG6kBddSOLkWRfAR/FfQyXYpHoYfwnyY0ZGl4kSD4aNbtvUdKEcoQe l9St7QOxVkSEH2V0CleZuNhuugCBGltYxZRZ+tPVG39IGznPl241Qry27U5+tXnyjm ee2dCWUlClzw5xQJpYg82bbuTkIVWuS9wnjJ+onw= From: Jacopo Mondi Date: Wed, 08 Jul 2026 11:25:00 +0200 Subject: [PATCH v4 13/35] ipa: libipa: lsc_polynomial: Do not inline functions MIME-Version: 1.0 Message-Id: <20260708-libipa-algorithms-v4-13-f0e99f035294@ideasonboard.com> References: <20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com> In-Reply-To: <20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com> To: libcamera-devel@lists.libcamera.org, Stefan Klug Cc: Jacopo Mondi , Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4030; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=7XkAt6FRI8LhqnI83clJrAZRF1EQa6l6JYmohhS5970=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqThdtKrRz5y+XiD+z2U7x4axhch7uvDYiov8ib E6rAKaMAWSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak4XbQAKCRByNAaPFqFW PJ7HEAC0+x+dgWTtd/y1SnVuBLJP/uPCVVEy6o68E7YsyOkgaDa1SS0NeKOHPrf8iEa45gw0nf3 JPVmwEkQoa6ce50LK9LLW+cdGazp3lC63AmotmShYjPRcAW6K7h8CRBLnxuTp5EZuL8jQiY5ymY 95sBDj5Kb66PkeLb+1gYUo0p7Ic84KRY6cfHSoUwHUrgjJhZeUTcyidY5UlBkmdlXNQN4HH/lfy 8x5lDiivYBmv7uhcnxl08sB2Y4div5o9Frkee0qmnq2nQo3CDyI75adRZGX5JQ+Nji7uXsog2FX xEnotFbKv7aFdAiLoKFiOuBAEBbCkTT011Iy4OTGLLxfExyiThV9bkAtoGPt0t4YRqgWZcI8bkg Nc+k6sRsGJ9AcBKJvaXYedLH4x4R245PQYzrBDi7va4HnoeA1Ok4NaqEJbL+wCRLfs0hNpXCilR 3tfse4SJs6GKQaRFALxgqWc+uOsmWjTBbjwzLsoTGeaxSAjuOGeeFIpd9WmtSn6wVuw6vIbGdpE kPestP5hdKVqEUZNkQggH4wEjBBkmu15CTIlgHDIrvtjIkmzAQHOOk93xv+Dt2WCZNk9P0HM2kl r3+tH8wXZyy9RHjzKJXGPyJMnK0t10iN2H7FLInlneNDBREQoLyb2N2zBbs/DpRz6rDXB+a8wo0 58bW7tGwNcITx9g== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" There is no reason to inline the Polynomial class implementation. Move functions implementation to the corresponding .cpp file. While at it remove a rougue empty line between class members definitions. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/libipa/lsc_polynomial.cpp | 34 +++++++++++++++++++++++++++++++--- src/ipa/libipa/lsc_polynomial.h | 36 +++--------------------------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/ipa/libipa/lsc_polynomial.cpp b/src/ipa/libipa/lsc_polynomial.cpp index d8981bd8a26a..a845d8b1783b 100644 --- a/src/ipa/libipa/lsc_polynomial.cpp +++ b/src/ipa/libipa/lsc_polynomial.cpp @@ -47,7 +47,6 @@ namespace lsc { */ /** - * \fn Polynomial::sampleAtNormalizedPixelPos(double x, double y) * \brief Sample the polynomial at the given normalized pixel position * * This functions samples the polynomial at the given pixel position divided by @@ -57,9 +56,20 @@ namespace lsc { * \param y y position in normalized coordinates * \return The sampled value */ +double Polynomial::sampleAtNormalizedPixelPos(double x, double y) const +{ + double dx = x - cnx_; + double dy = y - cny_; + double r = sqrt(dx * dx + dy * dy); + double res = 1.0; + + for (unsigned int i = 0; i < coefficients_.size(); i++) + res += coefficients_[i] * std::pow(r, (i + 1) * 2); + + return res; +} /** - * \fn Polynomial::getM() * \brief Get the value m as described in the dng specification * * Returns m according to dng spec. m represents the Euclidean distance @@ -68,9 +78,17 @@ namespace lsc { * * \return The sampled value */ +double Polynomial::getM() const +{ + double cpx = imageSize_.width * cx_; + double cpy = imageSize_.height * cy_; + double mx = std::max(cpx, std::fabs(imageSize_.width - cpx)); + double my = std::max(cpy, std::fabs(imageSize_.height - cpy)); + + return sqrt(mx * mx + my * my); +} /** - * \fn Polynomial::setReferenceImageSize(const Size &size) * \brief Set the reference image size * * Set the reference image size that is used for subsequent calls to getM() and @@ -78,6 +96,16 @@ namespace lsc { * * \param size The size of the reference image */ +void Polynomial::setReferenceImageSize(const Size &size) +{ + assert(!size.isNull()); + imageSize_ = size; + + /* Calculate normalized centers */ + double m = getM(); + cnx_ = (size.width * cx_) / m; + cny_ = (size.height * cy_) / m; +} } /* namespace lsc */ diff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h index 3be33edfe7d8..2caf46d2d759 100644 --- a/src/ipa/libipa/lsc_polynomial.h +++ b/src/ipa/libipa/lsc_polynomial.h @@ -37,38 +37,9 @@ public: { } - double sampleAtNormalizedPixelPos(double x, double y) const - { - double dx = x - cnx_; - double dy = y - cny_; - double r = sqrt(dx * dx + dy * dy); - double res = 1.0; - for (unsigned int i = 0; i < coefficients_.size(); i++) { - res += coefficients_[i] * std::pow(r, (i + 1) * 2); - } - return res; - } - - double getM() const - { - double cpx = imageSize_.width * cx_; - double cpy = imageSize_.height * cy_; - double mx = std::max(cpx, std::fabs(imageSize_.width - cpx)); - double my = std::max(cpy, std::fabs(imageSize_.height - cpy)); - - return sqrt(mx * mx + my * my); - } - - void setReferenceImageSize(const Size &size) - { - assert(!size.isNull()); - imageSize_ = size; - - /* Calculate normalized centers */ - double m = getM(); - cnx_ = (size.width * cx_) / m; - cny_ = (size.height * cy_) / m; - } + double sampleAtNormalizedPixelPos(double x, double y) const; + double getM() const; + void setReferenceImageSize(const Size &size); private: double cx_; @@ -76,7 +47,6 @@ private: double cnx_; double cny_; std::array coefficients_; - Size imageSize_; };