Patch Detail
Show a patch.
GET /api/patches/21919/?format=api
{ "id": 21919, "url": "https://patchwork.libcamera.org/api/patches/21919/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21919/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20241115122540.478103-2-dan.scally@ideasonboard.com>", "date": "2024-11-15T12:25:30", "name": "[v4,01/11] libipa: Centralise Fixed / Floating point convertors", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "fc58b0f9ed5bee12a5a9c6cd4bc008b8dc357ba3", "submitter": { "id": 156, "url": "https://patchwork.libcamera.org/api/people/156/?format=api", "name": "Dan Scally", "email": "dan.scally@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21919/mbox/", "series": [ { "id": 4794, "url": "https://patchwork.libcamera.org/api/series/4794/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4794", "date": "2024-11-15T12:25:29", "name": "Add Mali-C55 IPA Module and Algorithms", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4794/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21919/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21919/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 5DB21C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Nov 2024 12:26:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 71F0D6588F;\n\tFri, 15 Nov 2024 13:26:36 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AA53B65873\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Nov 2024 13:26:33 +0100 (CET)", "from mail.ideasonboard.com\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E7D3F6BE;\n\tFri, 15 Nov 2024 13:26:18 +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=\"dBbn7nfr\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731673579;\n\tbh=1liQx5U3JHim55RmFMwMm6sFU4F/Op3o8ZvItLzLXZg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=dBbn7nfrVZtXeJKX/lJBu3oED/pT8wcBI85kuexQCaXKzxWxht9iu1yZXjlprqs5w\n\tV7s0ZPYdq+sY7sg/Sn5arqDA2If6ZPxRe9n6hV/Aufd+VgLRFUhjV1vTiWrr+wuQ1a\n\tYJcD2HZckcSu/grjRBIiM4gGd76vCc3jEdE3iNsw=", "From": "Daniel Scally <dan.scally@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Anthony.McGivern@arm.com,\n\tDaniel Scally <dan.scally@ideasonboard.com>", "Subject": "[PATCH v4 01/11] libipa: Centralise Fixed / Floating point\n\tconvertors", "Date": "Fri, 15 Nov 2024 12:25:30 +0000", "Message-Id": "<20241115122540.478103-2-dan.scally@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20241115122540.478103-1-dan.scally@ideasonboard.com>", "References": "<20241115122540.478103-1-dan.scally@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": "The rkisp1 IPA has some utility functions to convert between fixed\nand floating point numbers. Move those to libipa so they're available\nfor use in other IPA modules too.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\nChanges in v4:\n\n\t- New patch\n\n .../{rkisp1/utils.cpp => libipa/fixedpoint.cpp} | 10 +++++-----\n src/ipa/{rkisp1/utils.h => libipa/fixedpoint.h} | 6 +++---\n src/ipa/libipa/meson.build | 2 ++\n src/ipa/rkisp1/algorithms/ccm.cpp | 4 ++--\n src/ipa/rkisp1/meson.build | 1 -\n .../rkisp1-utils.cpp => libipa/fixedpoint.cpp} | 16 ++++++++--------\n test/ipa/libipa/meson.build | 1 +\n test/ipa/meson.build | 1 -\n test/ipa/rkisp1/meson.build | 15 ---------------\n 9 files changed, 21 insertions(+), 35 deletions(-)\n rename src/ipa/{rkisp1/utils.cpp => libipa/fixedpoint.cpp} (87%)\n rename src/ipa/{rkisp1/utils.h => libipa/fixedpoint.h} (93%)\n rename test/ipa/{rkisp1/rkisp1-utils.cpp => libipa/fixedpoint.cpp} (85%)\n delete mode 100644 test/ipa/rkisp1/meson.build", "diff": "diff --git a/src/ipa/rkisp1/utils.cpp b/src/ipa/libipa/fixedpoint.cpp\nsimilarity index 87%\nrename from src/ipa/rkisp1/utils.cpp\nrename to src/ipa/libipa/fixedpoint.cpp\nindex 960ec64e..6b698fc5 100644\n--- a/src/ipa/rkisp1/utils.cpp\n+++ b/src/ipa/libipa/fixedpoint.cpp\n@@ -2,18 +2,18 @@\n /*\n * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n *\n- * Miscellaneous utility functions specific to rkisp1\n+ * Fixed / floating point conversions\n */\n \n-#include \"utils.h\"\n+#include \"fixedpoint.h\"\n \n /**\n- * \\file utils.h\n+ * \\file fixedpoint.h\n */\n \n namespace libcamera {\n \n-namespace ipa::rkisp1::utils {\n+namespace ipa {\n \n /**\n * \\fn R floatingToFixedPoint(T number)\n@@ -37,6 +37,6 @@ namespace ipa::rkisp1::utils {\n * \\return The converted value\n */\n \n-} /* namespace ipa::rkisp1::utils */\n+} /* namespace ipa */\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/utils.h b/src/ipa/libipa/fixedpoint.h\nsimilarity index 93%\nrename from src/ipa/rkisp1/utils.h\nrename to src/ipa/libipa/fixedpoint.h\nindex 5f38b50b..709cf50f 100644\n--- a/src/ipa/rkisp1/utils.h\n+++ b/src/ipa/libipa/fixedpoint.h\n@@ -2,7 +2,7 @@\n /*\n * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n *\n- * Miscellaneous utility functions specific to rkisp1\n+ * Fixed / floating point conversions\n */\n \n #pragma once\n@@ -12,7 +12,7 @@\n \n namespace libcamera {\n \n-namespace ipa::rkisp1::utils {\n+namespace ipa {\n \n #ifndef __DOXYGEN__\n template<unsigned int I, unsigned int F, typename R, typename T,\n@@ -60,6 +60,6 @@ constexpr R fixedToFloatingPoint(T number)\n \treturn static_cast<R>(t) / static_cast<R>(1 << F);\n }\n \n-} /* namespace ipa::rkisp1::utils */\n+} /* namespace ipa */\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/libipa/meson.build b/src/ipa/libipa/meson.build\nindex 788d037a..a1d662c9 100644\n--- a/src/ipa/libipa/meson.build\n+++ b/src/ipa/libipa/meson.build\n@@ -7,6 +7,7 @@ libipa_headers = files([\n 'colours.h',\n 'exposure_mode_helper.h',\n 'fc_queue.h',\n+ 'fixedpoint.h',\n 'histogram.h',\n 'interpolator.h',\n 'lsc_polynomial.h',\n@@ -23,6 +24,7 @@ libipa_sources = files([\n 'colours.cpp',\n 'exposure_mode_helper.cpp',\n 'fc_queue.cpp',\n+ 'fixedpoint.cpp',\n 'histogram.cpp',\n 'interpolator.cpp',\n 'lsc_polynomial.cpp',\ndiff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp\nindex 6b7d2e2c..e2b5cf4d 100644\n--- a/src/ipa/rkisp1/algorithms/ccm.cpp\n+++ b/src/ipa/rkisp1/algorithms/ccm.cpp\n@@ -18,7 +18,7 @@\n \n #include \"libcamera/internal/yaml_parser.h\"\n \n-#include \"../utils.h\"\n+#include \"libipa/fixedpoint.h\"\n #include \"libipa/interpolator.h\"\n \n /**\n@@ -72,7 +72,7 @@ void Ccm::setParameters(struct rkisp1_cif_isp_ctk_config &config,\n \tfor (unsigned int i = 0; i < 3; i++) {\n \t\tfor (unsigned int j = 0; j < 3; j++)\n \t\t\tconfig.coeff[i][j] =\n-\t\t\t\tutils::floatingToFixedPoint<4, 7, uint16_t, double>(matrix[i][j]);\n+\t\t\t\tfloatingToFixedPoint<4, 7, uint16_t, double>(matrix[i][j]);\n \t}\n \n \tfor (unsigned int i = 0; i < 3; i++)\ndiff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build\nindex 34844f14..26a9fa40 100644\n--- a/src/ipa/rkisp1/meson.build\n+++ b/src/ipa/rkisp1/meson.build\n@@ -9,7 +9,6 @@ rkisp1_ipa_sources = files([\n 'ipa_context.cpp',\n 'params.cpp',\n 'rkisp1.cpp',\n- 'utils.cpp',\n ])\n \n rkisp1_ipa_sources += rkisp1_ipa_algorithms\ndiff --git a/test/ipa/rkisp1/rkisp1-utils.cpp b/test/ipa/libipa/fixedpoint.cpp\nsimilarity index 85%\nrename from test/ipa/rkisp1/rkisp1-utils.cpp\nrename to test/ipa/libipa/fixedpoint.cpp\nindex b1863894..99eb662d 100644\n--- a/test/ipa/rkisp1/rkisp1-utils.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -2,7 +2,7 @@\n /*\n * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n *\n- * Miscellaneous utility tests\n+ * Fixed / Floating point utility tests\n */\n \n #include <cmath>\n@@ -10,22 +10,22 @@\n #include <map>\n #include <stdint.h>\n \n-#include \"../src/ipa/rkisp1/utils.h\"\n+#include \"../src/ipa/libipa/fixedpoint.h\"\n \n #include \"test.h\"\n \n using namespace std;\n using namespace libcamera;\n-using namespace ipa::rkisp1;\n+using namespace ipa;\n \n-class RkISP1UtilsTest : public Test\n+class FixedPointUtilsTest : public Test\n {\n protected:\n \t/* R for real, I for integer */\n \ttemplate<unsigned int IntPrec, unsigned int FracPrec, typename I, typename R>\n \tint testFixedToFloat(I input, R expected)\n \t{\n-\t\tR out = utils::fixedToFloatingPoint<IntPrec, FracPrec, R>(input);\n+\t\tR out = fixedToFloatingPoint<IntPrec, FracPrec, R>(input);\n \t\tR prec = 1.0 / (1 << FracPrec);\n \t\tif (std::abs(out - expected) > prec) {\n \t\t\tcerr << \"Reverse conversion expected \" << input\n@@ -40,7 +40,7 @@ protected:\n \ttemplate<unsigned int IntPrec, unsigned int FracPrec, typename T>\n \tint testSingleFixedPoint(double input, T expected)\n \t{\n-\t\tT ret = utils::floatingToFixedPoint<IntPrec, FracPrec, T>(input);\n+\t\tT ret = floatingToFixedPoint<IntPrec, FracPrec, T>(input);\n \t\tif (ret != expected) {\n \t\t\tcerr << \"Expected \" << input << \" to convert to \"\n \t\t\t << expected << \", got \" << ret << std::endl;\n@@ -51,7 +51,7 @@ protected:\n \t\t * The precision check is fairly arbitrary but is based on what\n \t\t * the rkisp1 is capable of in the crosstalk module.\n \t\t */\n-\t\tdouble f = utils::fixedToFloatingPoint<IntPrec, FracPrec, double>(ret);\n+\t\tdouble f = fixedToFloatingPoint<IntPrec, FracPrec, double>(ret);\n \t\tif (std::abs(f - input) > 0.005) {\n \t\t\tcerr << \"Reverse conversion expected \" << ret\n \t\t\t << \" to convert to \" << input\n@@ -105,4 +105,4 @@ protected:\n \t}\n };\n \n-TEST_REGISTER(RkISP1UtilsTest)\n+TEST_REGISTER(FixedPointUtilsTest)\ndiff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\nindex 4d2427db..281e6b1f 100644\n--- a/test/ipa/libipa/meson.build\n+++ b/test/ipa/libipa/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libipa_test = [\n+ {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},\n {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n ]\n \ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nindex 63820de5..ceed15ba 100644\n--- a/test/ipa/meson.build\n+++ b/test/ipa/meson.build\n@@ -1,7 +1,6 @@\n # SPDX-License-Identifier: CC0-1.0\n \n subdir('libipa')\n-subdir('rkisp1')\n \n ipa_test = [\n {'name': 'ipa_module_test', 'sources': ['ipa_module_test.cpp']},\ndiff --git a/test/ipa/rkisp1/meson.build b/test/ipa/rkisp1/meson.build\ndeleted file mode 100644\nindex 894523da..00000000\n--- a/test/ipa/rkisp1/meson.build\n+++ /dev/null\n@@ -1,15 +0,0 @@\n-# SPDX-License-Identifier: CC0-1.0\n-\n-rkisp1_ipa_test = [\n- {'name': 'rkisp1-utils', 'sources': ['rkisp1-utils.cpp']},\n-]\n-\n-foreach test : rkisp1_ipa_test\n- exe = executable(test['name'], test['sources'],\n- dependencies : [libcamera_private, libipa_dep],\n- link_with : [test_libraries],\n- include_directories : [test_includes_internal,\n- '../../../src/ipa/rkisp1/'])\n-\n- test(test['name'], exe, suite : 'ipa')\n-endforeach\n", "prefixes": [ "v4", "01/11" ] }