[{"id":31204,"web_url":"https://patchwork.libcamera.org/comment/31204/","msgid":"<172621881871.3474483.2128208435886004265@ping.linuxembedded.co.uk>","date":"2024-09-13T09:13:38","subject":"Re: [PATCH v2 3/9] ipa: rkisp1: Use generic Interpolator class","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-09-13 08:57:21)\n> Replace all occurrences of the MatrixInterpolator with the generic one.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/ccm.cpp | 18 ++++++------------\n>  src/ipa/rkisp1/algorithms/ccm.h   |  6 +++---\n>  2 files changed, 9 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp\n> index 1ca0e73f81ad..6b7d2e2cd5b3 100644\n> --- a/src/ipa/rkisp1/algorithms/ccm.cpp\n> +++ b/src/ipa/rkisp1/algorithms/ccm.cpp\n> @@ -19,7 +19,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> @@ -46,7 +46,7 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData\n>                 LOG(RkISP1Ccm, Warning)\n>                         << \"Failed to parse 'ccm' \"\n>                         << \"parameter from tuning file; falling back to unit matrix\";\n> -               ccm_.reset();\n> +               ccm_.setData({ { 0, Matrix<float, 3, 3>::identity() } });\n>         }\n>  \n>         ret = offsets_.readYaml(tuningData[\"ccms\"], \"ct\", \"offsets\");\n> @@ -54,14 +54,8 @@ int Ccm::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData\n>                 LOG(RkISP1Ccm, Warning)\n>                         << \"Failed to parse 'offsets' \"\n>                         << \"parameter from tuning file; falling back to zero offsets\";\n> -               /*\n> -                * MatrixInterpolator::reset() resets to identity matrices\n> -                * while here we need zero matrices so we need to construct it\n> -                * ourselves.\n> -                */\n> -               Matrix<int16_t, 3, 1> m({ 0, 0, 0 });\n> -               std::map<unsigned int, Matrix<int16_t, 3, 1>> matrices = { { 0, m } };\n> -               offsets_ = MatrixInterpolator<int16_t, 3, 1>(matrices);\n> +\n> +               offsets_.setData({ { 0, Matrix<int16_t, 3, 1>({ 0, 0, 0 }) } });\n>         }\n>  \n>         return 0;\n> @@ -106,8 +100,8 @@ void Ccm::prepare(IPAContext &context, const uint32_t frame,\n>         }\n>  \n>         ct_ = ct;\n> -       Matrix<float, 3, 3> ccm = ccm_.get(ct);\n> -       Matrix<int16_t, 3, 1> offsets = offsets_.get(ct);\n> +       Matrix<float, 3, 3> ccm = ccm_.getInterpolated(ct);\n> +       Matrix<int16_t, 3, 1> offsets = offsets_.getInterpolated(ct);\n>  \n>         context.activeState.ccm.ccm = ccm;\n>         frameContext.ccm.ccm = ccm;\n> diff --git a/src/ipa/rkisp1/algorithms/ccm.h b/src/ipa/rkisp1/algorithms/ccm.h\n> index 9daadb6834b1..46a1416e6be5 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>                            const Matrix<int16_t, 3, 1> &offsets);\n>  \n>         unsigned int ct_;\n> -       MatrixInterpolator<float, 3, 3> ccm_;\n> -       MatrixInterpolator<int16_t, 3, 1> offsets_;\n> +       Interpolator<Matrix<float, 3, 3>> ccm_;\n> +       Interpolator<Matrix<int16_t, 3, 1>> offsets_;\n\nI like this.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>  };\n>  \n>  } /* namespace ipa::rkisp1::algorithms */\n> -- \n> 2.43.0\n>","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 52A4DC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Sep 2024 09:13:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E2E96634FD;\n\tFri, 13 Sep 2024 11:13:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E1E3634F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Sep 2024 11:13:42 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6F035A5;\n\tFri, 13 Sep 2024 11: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=\"S72vLapn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726218742;\n\tbh=WyHJ/s3zNcdtpxIROsdEx5baYcnx+w9J5GGYm+2Z/bk=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=S72vLapnX9wjS9dYYxqbOGoEezSnxCWFXrDEnLHLTxVDKzN8OQvc/B6h67DQ5ZUIp\n\tLaqoZkUTKt8RWsl5PawA6Hqvm+XYpcd9m3eSQHNlJ3KGnbuRpvFFgmAML55xpmicn7\n\tpgbZqxJ8umQUhdtCGViKjCWEgm7mwpC/aLvPhDjo=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240913075750.35115-4-stefan.klug@ideasonboard.com>","References":"<20240913075750.35115-1-stefan.klug@ideasonboard.com>\n\t<20240913075750.35115-4-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 3/9] ipa: rkisp1: Use generic Interpolator class","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 13 Sep 2024 10:13:38 +0100","Message-ID":"<172621881871.3474483.2128208435886004265@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":31212,"web_url":"https://patchwork.libcamera.org/comment/31212/","msgid":"<ZuQRmFDotzgpS3aB@pyrite.rasen.tech>","date":"2024-09-13T10:19:04","subject":"Re: [PATCH v2 3/9] ipa: rkisp1: Use generic Interpolator class","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Fri, Sep 13, 2024 at 09:57:21AM +0200, Stefan Klug wrote:\n> Replace all occurrences of the MatrixInterpolator with the generic one.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/ccm.cpp | 18 ++++++------------\n>  src/ipa/rkisp1/algorithms/ccm.h   |  6 +++---\n>  2 files changed, 9 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp\n> index 1ca0e73f81ad..6b7d2e2cd5b3 100644\n> --- a/src/ipa/rkisp1/algorithms/ccm.cpp\n> +++ b/src/ipa/rkisp1/algorithms/ccm.cpp\n> @@ -19,7 +19,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> @@ -46,7 +46,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> @@ -54,14 +54,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> @@ -106,8 +100,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;\n> diff --git a/src/ipa/rkisp1/algorithms/ccm.h b/src/ipa/rkisp1/algorithms/ccm.h\n> index 9daadb6834b1..46a1416e6be5 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> -- \n> 2.43.0\n>","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 441BAC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Sep 2024 10:19:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E8643634FC;\n\tFri, 13 Sep 2024 12:19:10 +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 D045D634F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Sep 2024 12:19:08 +0200 (CEST)","from pyrite.rasen.tech (213-229-8-243.static.upcbusiness.at\n\t[213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D9EF94AD;\n\tFri, 13 Sep 2024 12:17:49 +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=\"C+UjzGuF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726222670;\n\tbh=zb5DvM3Fgqq+TqKVE5DXDC06dbpTs4baLwjVprnp45M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=C+UjzGuFTyt18uqCBQ6mR24dfA775MZ6VTz7gc5wwjlz93W/kZKztCohMojmTrYJt\n\tlXs/8iBpbrYChVAFdJgBQSrG6AafxxltS3hHE1JhHivCWD3Svnl6sc2NXHc2YAeWxF\n\teRpWWsg/ndaa5l5BykJDWlPkgEkl+uvdCuUN+asw=","Date":"Fri, 13 Sep 2024 12:19:04 +0200","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 3/9] ipa: rkisp1: Use generic Interpolator class","Message-ID":"<ZuQRmFDotzgpS3aB@pyrite.rasen.tech>","References":"<20240913075750.35115-1-stefan.klug@ideasonboard.com>\n\t<20240913075750.35115-4-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240913075750.35115-4-stefan.klug@ideasonboard.com>","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>"}}]