{"id":27278,"url":"https://patchwork.libcamera.org/api/1.1/patches/27278/?format=json","web_url":"https://patchwork.libcamera.org/patch/27278/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260708-libipa-algorithms-v4-13-f0e99f035294@ideasonboard.com>","date":"2026-07-08T09:25:00","name":"[v4,13/35] ipa: libipa: lsc_polynomial: Do not inline functions","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2737beed2c3b6c7d729347a3e3a80bf63948537e","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27278/mbox/","series":[{"id":6046,"url":"https://patchwork.libcamera.org/api/1.1/series/6046/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6046","date":"2026-07-08T09:24:47","name":"ipa: libipa: Introduce libipa algorithms","version":4,"mbox":"https://patchwork.libcamera.org/series/6046/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27278/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27278/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 563B5C3318\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 09:25:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC6DE66093;\n\tWed,  8 Jul 2026 11:25:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1699466073\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 11:25:09 +0200 (CEST)","from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 700711F14;\n\tWed,  8 Jul 2026 11:24:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"epgyJxfK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783502659;\n\tbh=7XkAt6FRI8LhqnI83clJrAZRF1EQa6l6JYmohhS5970=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=epgyJxfKPUlpG6kBddSOLkWRfAR/FfQyXYpHoYfwnyY0ZGl4kSD4aNbtvUdKEcoQe\n\tl9St7QOxVkSEH2V0CleZuNhuugCBGltYxZRZ+tPVG39IGznPl241Qry27U5+tXnyjm\n\tee2dCWUlClzw5xQJpYg82bbuTkIVWuS9wnjJ+onw=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 08 Jul 2026 11:25:00 +0200","Subject":"[PATCH v4 13/35] ipa: libipa: lsc_polynomial: Do not inline\n\tfunctions","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","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, \n\tStefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=4030;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=7XkAt6FRI8LhqnI83clJrAZRF1EQa6l6JYmohhS5970=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqThdtKrRz5y+XiD+z2U7x4axhch7uvDYiov8ib\n\tE6rAKaMAWSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak4XbQAKCRByNAaPFqFW\n\tPJ7HEAC0+x+dgWTtd/y1SnVuBLJP/uPCVVEy6o68E7YsyOkgaDa1SS0NeKOHPrf8iEa45gw0nf3\n\tJPVmwEkQoa6ce50LK9LLW+cdGazp3lC63AmotmShYjPRcAW6K7h8CRBLnxuTp5EZuL8jQiY5ymY\n\t95sBDj5Kb66PkeLb+1gYUo0p7Ic84KRY6cfHSoUwHUrgjJhZeUTcyidY5UlBkmdlXNQN4HH/lfy\n\t8x5lDiivYBmv7uhcnxl08sB2Y4div5o9Frkee0qmnq2nQo3CDyI75adRZGX5JQ+Nji7uXsog2FX\n\txEnotFbKv7aFdAiLoKFiOuBAEBbCkTT011Iy4OTGLLxfExyiThV9bkAtoGPt0t4YRqgWZcI8bkg\n\tNc+k6sRsGJ9AcBKJvaXYedLH4x4R245PQYzrBDi7va4HnoeA1Ok4NaqEJbL+wCRLfs0hNpXCilR\n\t3tfse4SJs6GKQaRFALxgqWc+uOsmWjTBbjwzLsoTGeaxSAjuOGeeFIpd9WmtSn6wVuw6vIbGdpE\n\tkPestP5hdKVqEUZNkQggH4wEjBBkmu15CTIlgHDIrvtjIkmzAQHOOk93xv+Dt2WCZNk9P0HM2kl\n\tr3+tH8wXZyy9RHjzKJXGPyJMnK0t10iN2H7FLInlneNDBREQoLyb2N2zBbs/DpRz6rDXB+a8wo0\n\t58bW7tGwNcITx9g==","X-Developer-Key":"i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There is no reason to inline the Polynomial class implementation.\n\nMove functions implementation to the corresponding .cpp file.\n\nWhile at it remove a rougue empty line between class members\ndefinitions.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/lsc_polynomial.cpp | 34 +++++++++++++++++++++++++++++++---\n src/ipa/libipa/lsc_polynomial.h   | 36 +++---------------------------------\n 2 files changed, 34 insertions(+), 36 deletions(-)","diff":"diff --git a/src/ipa/libipa/lsc_polynomial.cpp b/src/ipa/libipa/lsc_polynomial.cpp\nindex d8981bd8a26a..a845d8b1783b 100644\n--- a/src/ipa/libipa/lsc_polynomial.cpp\n+++ b/src/ipa/libipa/lsc_polynomial.cpp\n@@ -47,7 +47,6 @@ namespace lsc {\n  */\n \n /**\n- * \\fn Polynomial::sampleAtNormalizedPixelPos(double x, double y)\n  * \\brief Sample the polynomial at the given normalized pixel position\n  *\n  * This functions samples the polynomial at the given pixel position divided by\n@@ -57,9 +56,20 @@ namespace lsc {\n  * \\param y y position in normalized coordinates\n  * \\return The sampled value\n  */\n+double Polynomial::sampleAtNormalizedPixelPos(double x, double y) const\n+{\n+\tdouble dx = x - cnx_;\n+\tdouble dy = y - cny_;\n+\tdouble r = sqrt(dx * dx + dy * dy);\n+\tdouble res = 1.0;\n+\n+\tfor (unsigned int i = 0; i < coefficients_.size(); i++)\n+\t\tres += coefficients_[i] * std::pow(r, (i + 1) * 2);\n+\n+\treturn res;\n+}\n \n /**\n- * \\fn Polynomial::getM()\n  * \\brief Get the value m as described in the dng specification\n  *\n  * Returns m according to dng spec. m represents the Euclidean distance\n@@ -68,9 +78,17 @@ namespace lsc {\n  *\n  * \\return The sampled value\n  */\n+double Polynomial::getM() const\n+{\n+\tdouble cpx = imageSize_.width * cx_;\n+\tdouble cpy = imageSize_.height * cy_;\n+\tdouble mx = std::max(cpx, std::fabs(imageSize_.width - cpx));\n+\tdouble my = std::max(cpy, std::fabs(imageSize_.height - cpy));\n+\n+\treturn sqrt(mx * mx + my * my);\n+}\n \n /**\n- * \\fn Polynomial::setReferenceImageSize(const Size &size)\n  * \\brief Set the reference image size\n  *\n  * Set the reference image size that is used for subsequent calls to getM() and\n@@ -78,6 +96,16 @@ namespace lsc {\n  *\n  * \\param size The size of the reference image\n  */\n+void Polynomial::setReferenceImageSize(const Size &size)\n+{\n+\tassert(!size.isNull());\n+\timageSize_ = size;\n+\n+\t/* Calculate normalized centers */\n+\tdouble m = getM();\n+\tcnx_ = (size.width * cx_) / m;\n+\tcny_ = (size.height * cy_) / m;\n+}\n \n } /* namespace lsc */\n \ndiff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h\nindex 3be33edfe7d8..2caf46d2d759 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -37,38 +37,9 @@ public:\n \t{\n \t}\n \n-\tdouble sampleAtNormalizedPixelPos(double x, double y) const\n-\t{\n-\t\tdouble dx = x - cnx_;\n-\t\tdouble dy = y - cny_;\n-\t\tdouble r = sqrt(dx * dx + dy * dy);\n-\t\tdouble res = 1.0;\n-\t\tfor (unsigned int i = 0; i < coefficients_.size(); i++) {\n-\t\t\tres += coefficients_[i] * std::pow(r, (i + 1) * 2);\n-\t\t}\n-\t\treturn res;\n-\t}\n-\n-\tdouble getM() const\n-\t{\n-\t\tdouble cpx = imageSize_.width * cx_;\n-\t\tdouble cpy = imageSize_.height * cy_;\n-\t\tdouble mx = std::max(cpx, std::fabs(imageSize_.width - cpx));\n-\t\tdouble my = std::max(cpy, std::fabs(imageSize_.height - cpy));\n-\n-\t\treturn sqrt(mx * mx + my * my);\n-\t}\n-\n-\tvoid setReferenceImageSize(const Size &size)\n-\t{\n-\t\tassert(!size.isNull());\n-\t\timageSize_ = size;\n-\n-\t\t/* Calculate normalized centers */\n-\t\tdouble m = getM();\n-\t\tcnx_ = (size.width * cx_) / m;\n-\t\tcny_ = (size.height * cy_) / m;\n-\t}\n+\tdouble sampleAtNormalizedPixelPos(double x, double y) const;\n+\tdouble getM() const;\n+\tvoid setReferenceImageSize(const Size &size);\n \n private:\n \tdouble cx_;\n@@ -76,7 +47,6 @@ private:\n \tdouble cnx_;\n \tdouble cny_;\n \tstd::array<double, 5> coefficients_;\n-\n \tSize imageSize_;\n };\n \n","prefixes":["v4","13/35"]}