[{"id":32271,"web_url":"https://patchwork.libcamera.org/comment/32271/","msgid":"<20241119110309.GH31681@pendragon.ideasonboard.com>","date":"2024-11-19T11:03:09","subject":"Re: [PATCH v2 1/9] ipa: rpi: Rename Matrix to Matrix3x3","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Stefan,\n\nThank you for the patch.\n\nOn Tue, Nov 19, 2024 at 11:37:28AM +0100, Stefan Klug wrote:\n> The upcoming patches will introduce a Matrix class into\n> libcamera/internal. That name clashes with the Matrix class from the\n> RaspeberryPi ccm implementation. Rename the rpi version to Matrix3x3 to\n\ns/RaspeberryPi/RaspberryPi/\n\n> prevent the name clash. Matrix3x3 will be replaced by the generic\n> implementation later.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/rpi/controller/rpi/ccm.cpp | 18 +++++++++---------\n>  src/ipa/rpi/controller/rpi/ccm.h   | 20 ++++++++++----------\n>  2 files changed, 19 insertions(+), 19 deletions(-)\n> \n> diff --git a/src/ipa/rpi/controller/rpi/ccm.cpp b/src/ipa/rpi/controller/rpi/ccm.cpp\n> index aefa580c9a4b..7f63f3fdb702 100644\n> --- a/src/ipa/rpi/controller/rpi/ccm.cpp\n> +++ b/src/ipa/rpi/controller/rpi/ccm.cpp\n> @@ -29,17 +29,17 @@ LOG_DEFINE_CATEGORY(RPiCcm)\n>  \n>  #define NAME \"rpi.ccm\"\n>  \n> -Matrix::Matrix()\n> +Matrix3x3::Matrix3x3()\n>  {\n>  \tmemset(m, 0, sizeof(m));\n>  }\n> -Matrix::Matrix(double m0, double m1, double m2, double m3, double m4, double m5,\n> +Matrix3x3::Matrix3x3(double m0, double m1, double m2, double m3, double m4, double m5,\n>  \t       double m6, double m7, double m8)\n>  {\n>  \tm[0][0] = m0, m[0][1] = m1, m[0][2] = m2, m[1][0] = m3, m[1][1] = m4,\n>  \tm[1][2] = m5, m[2][0] = m6, m[2][1] = m7, m[2][2] = m8;\n>  }\n> -int Matrix::read(const libcamera::YamlObject &params)\n> +int Matrix3x3::read(const libcamera::YamlObject &params)\n>  {\n>  \tdouble *ptr = (double *)m;\n>  \n> @@ -125,7 +125,7 @@ bool getLocked(Metadata *metadata, std::string const &tag, T &value)\n>  \treturn true;\n>  }\n>  \n> -Matrix calculateCcm(std::vector<CtCcm> const &ccms, double ct)\n> +Matrix3x3 calculateCcm(std::vector<CtCcm> const &ccms, double ct)\n>  {\n>  \tif (ct <= ccms.front().ct)\n>  \t\treturn ccms.front().ccm;\n> @@ -141,13 +141,13 @@ Matrix calculateCcm(std::vector<CtCcm> const &ccms, double ct)\n>  \t}\n>  }\n>  \n> -Matrix applySaturation(Matrix const &ccm, double saturation)\n> +Matrix3x3 applySaturation(Matrix3x3 const &ccm, double saturation)\n>  {\n> -\tMatrix RGB2Y(0.299, 0.587, 0.114, -0.169, -0.331, 0.500, 0.500, -0.419,\n> +\tMatrix3x3 RGB2Y(0.299, 0.587, 0.114, -0.169, -0.331, 0.500, 0.500, -0.419,\n>  \t\t     -0.081);\n> -\tMatrix Y2RGB(1.000, 0.000, 1.402, 1.000, -0.345, -0.714, 1.000, 1.771,\n> +\tMatrix3x3 Y2RGB(1.000, 0.000, 1.402, 1.000, -0.345, -0.714, 1.000, 1.771,\n>  \t\t     0.000);\n> -\tMatrix S(1, 0, 0, 0, saturation, 0, 0, 0, saturation);\n> +\tMatrix3x3 S(1, 0, 0, 0, saturation, 0, 0, 0, saturation);\n>  \treturn Y2RGB * S * RGB2Y * ccm;\n>  }\n>  \n> @@ -170,7 +170,7 @@ void Ccm::prepare(Metadata *imageMetadata)\n>  \t\tLOG(RPiCcm, Warning) << \"no colour temperature found\";\n>  \tif (!luxOk)\n>  \t\tLOG(RPiCcm, Warning) << \"no lux value found\";\n> -\tMatrix ccm = calculateCcm(config_.ccms, awb.temperatureK);\n> +\tMatrix3x3 ccm = calculateCcm(config_.ccms, awb.temperatureK);\n>  \tdouble saturation = saturation_;\n>  \tstruct CcmStatus ccmStatus;\n>  \tccmStatus.saturation = saturation;\n> diff --git a/src/ipa/rpi/controller/rpi/ccm.h b/src/ipa/rpi/controller/rpi/ccm.h\n> index 4e5b33fefa4e..8e7f9616c2ab 100644\n> --- a/src/ipa/rpi/controller/rpi/ccm.h\n> +++ b/src/ipa/rpi/controller/rpi/ccm.h\n> @@ -16,22 +16,22 @@ namespace RPiController {\n>  \n>  /* Algorithm to calculate colour matrix. Should be placed after AWB. */\n>  \n> -struct Matrix {\n> -\tMatrix(double m0, double m1, double m2, double m3, double m4, double m5,\n> +struct Matrix3x3 {\n> +\tMatrix3x3(double m0, double m1, double m2, double m3, double m4, double m5,\n>  \t       double m6, double m7, double m8);\n> -\tMatrix();\n> +\tMatrix3x3();\n>  \tdouble m[3][3];\n>  \tint read(const libcamera::YamlObject &params);\n>  };\n> -static inline Matrix operator*(double d, Matrix const &m)\n> +static inline Matrix3x3 operator*(double d, Matrix3x3 const &m)\n>  {\n> -\treturn Matrix(m.m[0][0] * d, m.m[0][1] * d, m.m[0][2] * d,\n> +\treturn Matrix3x3(m.m[0][0] * d, m.m[0][1] * d, m.m[0][2] * d,\n>  \t\t      m.m[1][0] * d, m.m[1][1] * d, m.m[1][2] * d,\n>  \t\t      m.m[2][0] * d, m.m[2][1] * d, m.m[2][2] * d);\n>  }\n> -static inline Matrix operator*(Matrix const &m1, Matrix const &m2)\n> +static inline Matrix3x3 operator*(Matrix3x3 const &m1, Matrix3x3 const &m2)\n>  {\n> -\tMatrix m;\n> +\tMatrix3x3 m;\n>  \tfor (int i = 0; i < 3; i++)\n>  \t\tfor (int j = 0; j < 3; j++)\n>  \t\t\tm.m[i][j] = m1.m[i][0] * m2.m[0][j] +\n> @@ -39,9 +39,9 @@ static inline Matrix operator*(Matrix const &m1, Matrix const &m2)\n>  \t\t\t\t    m1.m[i][2] * m2.m[2][j];\n>  \treturn m;\n>  }\n> -static inline Matrix operator+(Matrix const &m1, Matrix const &m2)\n> +static inline Matrix3x3 operator+(Matrix3x3 const &m1, Matrix3x3 const &m2)\n>  {\n> -\tMatrix m;\n> +\tMatrix3x3 m;\n>  \tfor (int i = 0; i < 3; i++)\n>  \t\tfor (int j = 0; j < 3; j++)\n>  \t\t\tm.m[i][j] = m1.m[i][j] + m2.m[i][j];\n> @@ -50,7 +50,7 @@ static inline Matrix operator+(Matrix const &m1, Matrix const &m2)\n>  \n>  struct CtCcm {\n>  \tdouble ct;\n> -\tMatrix ccm;\n> +\tMatrix3x3 ccm;\n>  };\n>  \n>  struct CcmConfig {","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 96FAEC32F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 11:03:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CA3BC65EE4;\n\tTue, 19 Nov 2024 12:03:24 +0100 (CET)","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 218D065898\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 12:03:23 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 35E4475A;\n\tTue, 19 Nov 2024 12:03:03 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tGRwacWL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732014184;\n\tbh=Pd2Jyy/6Gk9KnKn3B9XigzZjWVPyQTZcaRuUMvP452Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tGRwacWLGIaPZCMdW5V8ZJKnlUA0KWcuDHi9lr4DscJYG23Lc7j+JDjeKb/CLAQ+C\n\tS3z5x1lGrr/9rncFr6xBAngzZOx9H4AKqZ7woGLLjdGpGh0tiMVn8+egOIoD3CaCGq\n\tBM4RV8+9Xv9LpgSxpKMj2Z+U9DfCy9F1sdNl/rvI=","Date":"Tue, 19 Nov 2024 13:03:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 1/9] ipa: rpi: Rename Matrix to Matrix3x3","Message-ID":"<20241119110309.GH31681@pendragon.ideasonboard.com>","References":"<20241119103740.1919807-1-stefan.klug@ideasonboard.com>\n\t<20241119103740.1919807-2-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241119103740.1919807-2-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>"}}]