{"id":21012,"url":"https://patchwork.libcamera.org/api/patches/21012/?format=json","web_url":"https://patchwork.libcamera.org/patch/21012/","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":"<20240826152224.362773-3-stefan.klug@ideasonboard.com>","date":"2024-08-26T15:22:00","name":"[v1,2/8] ipa: rkisp1: Use generic Interpolator class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ab41be6a1dec7b3192d3c989c115031a6462b782","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21012/mbox/","series":[{"id":4540,"url":"https://patchwork.libcamera.org/api/series/4540/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4540","date":"2024-08-26T15:21:58","name":"Implement polynomial lsc loader","version":1,"mbox":"https://patchwork.libcamera.org/series/4540/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21012/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21012/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 00B8FC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Aug 2024 15:22:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 43CB5633CF;\n\tMon, 26 Aug 2024 17:22:37 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 479CB633D3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Aug 2024 17:22:34 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:58b7:f3d:c9d4:defa])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 04092741;\n\tMon, 26 Aug 2024 17:21:27 +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=\"gMpvL65Z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1724685688;\n\tbh=gGbKCUnL0zdjVvdtW3FyYzk6c9CQehRnjgwIVoMvyuM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gMpvL65Z/pjq3XXSNHYQIfhteZ9vP9IWlPvZ60UMFoIT93ToLGoUJd/4xMjmzF4xM\n\tnvXO85Ff8Nrj3a+B9KKXa3KMvhzifF2vZmbId0dVWjkLmI/LIS+mrf5v9/pu26UTe2\n\tVThqP8r1SjzwwjIe94wvqXvvAiKPHpyP4o0TVDhQ=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v1 2/8] ipa: rkisp1: Use generic Interpolator class","Date":"Mon, 26 Aug 2024 17:22:00 +0200","Message-ID":"<20240826152224.362773-3-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240826152224.362773-1-stefan.klug@ideasonboard.com>","References":"<20240826152224.362773-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"Replace all occurrences of the MatrixInterpolator with the generic one.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/awb.cpp |  4 ++--\n src/ipa/rkisp1/algorithms/awb.h   |  5 +++--\n src/ipa/rkisp1/algorithms/ccm.cpp | 18 ++++++------------\n src/ipa/rkisp1/algorithms/ccm.h   |  6 +++---\n 4 files changed, 14 insertions(+), 19 deletions(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex d482eda5b541..9b181c163e0b 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -53,7 +53,7 @@ int Awb::init(IPAContext &context, const YamlObject &tuningData)\n \t\t\t\t\t\t\t kMaxColourTemperature,\n \t\t\t\t\t\t\t kDefaultColourTemperature);\n \n-\tMatrixInterpolator<double, 2, 1> gains;\n+\tInterpolator<Matrix<double, 2, 1>> gains;\n \tint ret = gains.readYaml(tuningData[\"gains\"], \"ct\", \"gains\");\n \tif (ret < 0)\n \t\tLOG(RkISP1Awb, Warning)\n@@ -124,7 +124,7 @@ void Awb::queueRequest(IPAContext &context,\n \n \tconst auto &colourTemperature = controls.get(controls::ColourTemperature);\n \tif (colourTemperature && !awb.autoEnabled && gains_ && !colourGains) {\n-\t\tMatrix<double, 2, 1> gains = gains_->get(*colourTemperature);\n+\t\tMatrix<double, 2, 1> gains = gains_->getInterpolated(*colourTemperature);\n \t\tawb.gains.manual.red = gains[0][0];\n \t\tawb.gains.manual.blue = gains[1][0];\n \ndiff --git a/src/ipa/rkisp1/algorithms/awb.h b/src/ipa/rkisp1/algorithms/awb.h\nindex a010e6d1cb3c..9e44f1c278ab 100644\n--- a/src/ipa/rkisp1/algorithms/awb.h\n+++ b/src/ipa/rkisp1/algorithms/awb.h\n@@ -9,7 +9,8 @@\n \n #include <optional>\n \n-#include \"libipa/matrix_interpolator.h\"\n+#include \"libipa/interpolator.h\"\n+#include \"libipa/matrix.h\"\n \n #include \"algorithm.h\"\n \n@@ -39,7 +40,7 @@ public:\n private:\n \tuint32_t estimateCCT(double red, double green, double blue);\n \n-\tstd::optional<MatrixInterpolator<double, 2, 1>> gains_;\n+\tstd::optional<Interpolator<Matrix<double, 2, 1>>> gains_;\n \tbool rgbMode_;\n };\n \ndiff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp\nindex fe7246f8b185..5a29d20e6cdb 100644\n--- a/src/ipa/rkisp1/algorithms/ccm.cpp\n+++ b/src/ipa/rkisp1/algorithms/ccm.cpp\n@@ -23,7 +23,7 @@\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"../utils.h\"\n-#include \"libipa/matrix_interpolator.h\"\n+#include \"libipa/interpolator.h\"\n \n /**\n  * \\file ccm.h\n@@ -50,7 +50,7 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData\n \t\tLOG(RkISP1Ccm, Warning)\n \t\t\t<< \"Failed to parse 'ccm' \"\n \t\t\t<< \"parameter from tuning file; falling back to unit matrix\";\n-\t\tccm_.reset();\n+\t\tccm_.setData({ { 0, Matrix<float, 3, 3>::identity() } });\n \t}\n \n \tret = offsets_.readYaml(tuningData[\"ccms\"], \"ct\", \"offsets\");\n@@ -58,14 +58,8 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData\n \t\tLOG(RkISP1Ccm, Warning)\n \t\t\t<< \"Failed to parse 'offsets' \"\n \t\t\t<< \"parameter from tuning file; falling back to zero offsets\";\n-\t\t/*\n-\t\t * MatrixInterpolator::reset() resets to identity matrices\n-\t\t * while here we need zero matrices so we need to construct it\n-\t\t * ourselves.\n-\t\t */\n-\t\tMatrix<int16_t, 3, 1> m({ 0, 0, 0 });\n-\t\tstd::map<unsigned int, Matrix<int16_t, 3, 1>> matrices = { { 0, m } };\n-\t\toffsets_ = MatrixInterpolator<int16_t, 3, 1>(matrices);\n+\n+\t\toffsets_.setData({ { 0, Matrix<int16_t, 3, 1>({ 0, 0, 0 }) } });\n \t}\n \n \treturn 0;\n@@ -117,8 +111,8 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,\n \t}\n \n \tct_ = ct;\n-\tMatrix<float, 3, 3> ccm = ccm_.get(ct);\n-\tMatrix<int16_t, 3, 1> offsets = offsets_.get(ct);\n+\tMatrix<float, 3, 3> ccm = ccm_.getInterpolated(ct);\n+\tMatrix<int16_t, 3, 1> offsets = offsets_.getInterpolated(ct);\n \n \tcontext.activeState.ccm.ccm = ccm;\n \tframeContext.ccm.ccm = ccm;\ndiff --git a/src/ipa/rkisp1/algorithms/ccm.h b/src/ipa/rkisp1/algorithms/ccm.h\nindex 30cb882180cc..4efe9c00c3c9 100644\n--- a/src/ipa/rkisp1/algorithms/ccm.h\n+++ b/src/ipa/rkisp1/algorithms/ccm.h\n@@ -9,8 +9,8 @@\n \n #include <linux/rkisp1-config.h>\n \n+#include \"libipa/interpolator.h\"\n #include \"libipa/matrix.h\"\n-#include \"libipa/matrix_interpolator.h\"\n \n #include \"algorithm.h\"\n \n@@ -40,8 +40,8 @@ private:\n \t\t\t   const Matrix<int16_t, 3, 1> &offsets);\n \n \tunsigned int ct_;\n-\tMatrixInterpolator<float, 3, 3> ccm_;\n-\tMatrixInterpolator<int16_t, 3, 1> offsets_;\n+\tInterpolator<Matrix<float, 3, 3>> ccm_;\n+\tInterpolator<Matrix<int16_t, 3, 1>> offsets_;\n };\n \n } /* namespace ipa::rkisp1::algorithms */\n","prefixes":["v1","2/8"]}