{"id":27322,"url":"https://patchwork.libcamera.org/api/1.1/patches/27322/?format=json","web_url":"https://patchwork.libcamera.org/patch/27322/","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-v5-14-0759d0359f52@ideasonboard.com>","date":"2026-07-08T15:50:56","name":"[v5,14/36] 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/27322/mbox/","series":[{"id":6048,"url":"https://patchwork.libcamera.org/api/1.1/series/6048/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6048","date":"2026-07-08T15:50:42","name":"ipa: libipa: Introduce libipa algorithms","version":5,"mbox":"https://patchwork.libcamera.org/series/6048/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27322/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27322/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 8C991C331D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 15:51:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0977E660F1;\n\tWed,  8 Jul 2026 17:51:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8EE35660C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 17:51:16 +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 A2FAC3F97;\n\tWed,  8 Jul 2026 17:50:26 +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=\"ikdKjuiu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783525826;\n\tbh=5k891vikBPfm1WiwjQEALqn9lIwdCnR+t4kgIvPiJug=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=ikdKjuiuSRIWBczLBkMOQUi/1mqgWi557N2AToYv0AmI5n74TwFnn3Nt9Jai16LKJ\n\tBMfLivG8u7ZgeVlAL+z+tO5d8P2EsN5yfpUswTMPuklRpa1GZgg5qi6xvG1swEUXJw\n\t8iVkGpo80cv4i4kE4R67OHykachly7rpPfcpxB2U=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 08 Jul 2026 17:50:56 +0200","Subject":"[PATCH v5 14/36] 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-v5-14-0759d0359f52@ideasonboard.com>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>","In-Reply-To":"<20260708-libipa-algorithms-v5-0-0759d0359f52@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=5k891vikBPfm1WiwjQEALqn9lIwdCnR+t4kgIvPiJug=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHlOrZTfGplGpQgZZ9fC/QNgULvQKTvN3gyx\n\tUfSHEM1SOeJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x5QAKCRByNAaPFqFW\n\tPK8UD/4zAqVMdaWDDmb779sW672QzNXARSZYSDHIaEo9OSfZctWi5MPIZ+bS31b4Nij23ljiTCw\n\tjc+p3rw0oybMPc5saSaZE2NJcrIQZQDvYcILRu0zAwrasyYEOaMFR4yccWuXcDy9dlyxgazQPtO\n\t1lefqwjapj5PEq7XiUSJTsUpyoKsFg8hBhW0DLi/koNB+1P3CZ+ErI8qoLZZS+nzeQ8NVWQDwQ+\n\t0Juo8HboKCr2KklNwx+nGCdAi13gjH8z8hCTabU1iXGwFKiiKqAtRmziS6Is8MYNaehq6R5yT2+\n\tMAkeRAz5hhIlM7aRiWc+lR1QAvXFbWIZ8NluFaC90gcnY1tGAIEbaXIrjAFGMYKN7bgTPIaKImb\n\tdZrzFMcjL8idVwlsNcQyrFWHZtDley8Zz69HlT2X77SCVI/0SN7tBOm2J8BL0rpVWEFcBT5ICfE\n\tLnNoXvteNB/qjONf7IkuIUgLeQTUbmFX3/Ix1x9Vhzkkn0/xzmzeE4szfNqprS9dCVzbao7hbMF\n\tVRy2gg7itjGFqL1fjB6WVTuupJeCk2sTpX01f/t/AH5g9vva7XYTE5x1eiXzCiAb5MS+/T3gzzq\n\t00El+rYyTGfRNzPqSxRlMz0z03gxZSB/ViijXg9pFKIl7vz8qtthOpUSKsG0Eu0zr+CbjDTrCLy\n\tNxHxdU3/8yMRjIQ==","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 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":["v5","14/36"]}