{"id":27637,"url":"https://patchwork.libcamera.org/api/patches/27637/?format=json","web_url":"https://patchwork.libcamera.org/patch/27637/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20260805-libipa-algorithms-v7-14-7425b5b795d4@ideasonboard.com>","date":"2026-08-05T16:12:56","name":"[v7,14/32] 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/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27637/mbox/","series":[{"id":6110,"url":"https://patchwork.libcamera.org/api/series/6110/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6110","date":"2026-08-05T16:12:42","name":"ipa: libipa: Introduce libipa algorithms","version":7,"mbox":"https://patchwork.libcamera.org/series/6110/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27637/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27637/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 45772C3340\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Aug 2026 16:13:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF34C68148;\n\tWed,  5 Aug 2026 18:13:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF02868131\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Aug 2026 18:13:33 +0200 (CEST)","from [192.168.125.177] (mob-109-113-25-35.net.vodafone.it\n\t[109.113.25.35])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D6C2339AA;\n\tWed,  5 Aug 2026 18:12:22 +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=\"p8fwBCvM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1785946343;\n\tbh=+BLekKS2khj7QSEHhQsHfSrQMgwm055rzcXMP/0cFSk=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=p8fwBCvMTms+97fQ4ei/HqAZZfmCpzb44KRFukY9TjDr3H1yNG1A/zxpkZW9ctrXC\n\tDm4kjoQG7swvLkDWe1nvU1Gxb9vklPaVEuIgftSLVUcBF59DvZp+86zRDzAfpt0OEa\n\tHjumqInVnGgEqfeih5cNs+7+dfsOS87kPmC3NsOw=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 05 Aug 2026 18:12:56 +0200","Subject":"[PATCH v7 14/32] 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":"<20260805-libipa-algorithms-v7-14-7425b5b795d4@ideasonboard.com>","References":"<20260805-libipa-algorithms-v7-0-7425b5b795d4@ideasonboard.com>","In-Reply-To":"<20260805-libipa-algorithms-v7-0-7425b5b795d4@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>, \n\tMilan Zamazal <mzamazal@redhat.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","X-Mailer":"b4 0.16-dev","X-Developer-Signature":"v=1; a=openpgp-sha256; l=4087;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=+BLekKS2khj7QSEHhQsHfSrQMgwm055rzcXMP/0cFSk=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqc2Edvqe9kapT6BzUoVl8SAbfXSPDB0eKBmDD6\n\tSI+7ideX6GJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCanNhHQAKCRByNAaPFqFW\n\tPKCrD/9jpR8CYPdWMjN30pO43lDur4X82n/rADY5zF2U+lUjloOZIvnvZS7N9XiP+WKN5n4XYvN\n\tjAAUM48RMlJU5Wmkk0lM+o8YSdTm+8cCHiO1YK0rXlhVb4XgPJl73yAnvT06I/hfquPleqGmYoz\n\t/yGd3fAdnDfVx4SgkopC7nxrLH+C9C+5Rh1U8TDTxZiPpGOaqyBsI1zzCHLXDExWPgk/9dCgbqP\n\thU70kYLHbjqxW8ISHZjCQpY032hrt2U8tb01/yx45ZCnh6v4Njsp35bD+8gilYd4AXpa9c3PtdS\n\t95sklilyQGSqgRSQL4bZWJ6rytBZOMvU0+cKOpxNVcNkiPLEds/kbl8Wz8PPmBhUOjxZE4n5rZD\n\tQGrzDp2YWmyqsGlWNa+IMMUTFSIe3a0Z4tEECHFpbkjkFBRbEhdAYd6tFAov+2hk/CdGCtX3RGX\n\tJbKL6EiVQdMc5Ks2Vf/SWtZlZiXAE/4wuW4l+TjF6ZV87/TssLP2B27wLVE8NCJkuKagn2QmJnU\n\tBFNEzhfuWjBYChcgkJuySHsEAmYXOyoXclKjGmH2+ZRifTeBbGlKNLQUdPLS5eTyHFSHn76Dx5Q\n\teAAl8tgi4zOEASdP53V48tKbab8PD70W+MtKXnlqzi1ZrfdQDc9nc3hKAdBA7nMQSxxIwB3bti1\n\tHxV8I+lqqTEQjRQ==","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>\nReviewed-by: Stefan Klug <stefan.klug@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 b93063bf8bc7..fb6f959e5a09 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":["v7","14/32"]}