{"id":21251,"url":"https://patchwork.libcamera.org/api/1.1/patches/21251/?format=json","web_url":"https://patchwork.libcamera.org/patch/21251/","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":"<20240913075750.35115-3-stefan.klug@ideasonboard.com>","date":"2024-09-13T07:57:20","name":"[v2,2/9] test: ipa: libipa: Add tets for Interpolator","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"77e8ddd3fbafeefedb9cd1e404b8671c37b68bc6","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21251/mbox/","series":[{"id":4587,"url":"https://patchwork.libcamera.org/api/1.1/series/4587/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4587","date":"2024-09-13T07:57:18","name":"Implement polynomial lsc support","version":2,"mbox":"https://patchwork.libcamera.org/series/4587/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21251/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21251/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 DF09AC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Sep 2024 07:58:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 93165634F8;\n\tFri, 13 Sep 2024 09:58:03 +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 279D4634F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Sep 2024 09:58:00 +0200 (CEST)","from ideasonboard.com (213-229-8-243.static.upcbusiness.at\n\t[213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5B95E1011;\n\tFri, 13 Sep 2024 09:56:41 +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=\"b82OH/Xj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726214201;\n\tbh=tjh4IHdZhV9Q/6JixLvDs4zZHFCRZQIr5+oEcwpDoeo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=b82OH/Xj0wKhef/cUWqcg8e+pe5t2RTkyI8Q2sO27EETgGmvy8UiofAv0RbofKpin\n\tnd1VvvUDtIsBhSqamtUrJj1J++flT0PVoIC4ZaPGcfgwHmMcpr6aj/7K18QNSg5xsA\n\tqpM7TzVGBgFo4JAMTYJuQHXPQUx8mdmrlcinaaXw=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 2/9] test: ipa: libipa: Add tets for Interpolator","Date":"Fri, 13 Sep 2024 09:57:20 +0200","Message-ID":"<20240913075750.35115-3-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240913075750.35115-1-stefan.klug@ideasonboard.com>","References":"<20240913075750.35115-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":"Add tests for the Interpolator class.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n test/ipa/libipa/interpolator.cpp | 55 ++++++++++++++++++++++++++++++++\n test/ipa/libipa/meson.build      | 15 +++++++++\n test/ipa/meson.build             |  1 +\n 3 files changed, 71 insertions(+)\n create mode 100644 test/ipa/libipa/interpolator.cpp\n create mode 100644 test/ipa/libipa/meson.build","diff":"diff --git a/test/ipa/libipa/interpolator.cpp b/test/ipa/libipa/interpolator.cpp\nnew file mode 100644\nindex 000000000000..adb215386f0e\n--- /dev/null\n+++ b/test/ipa/libipa/interpolator.cpp\n@@ -0,0 +1,55 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2024, Paul Elder <paul.elder@ideasonboard.com>\n+ *\n+ * Miscellaneous utility tests\n+ */\n+\n+#include <cmath>\n+#include <iostream>\n+#include <map>\n+#include <stdint.h>\n+#include <stdio.h>\n+\n+#include \"../src/ipa/libipa/interpolator.h\"\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+using namespace ipa;\n+\n+#define ASSERT_EQ(a, b) \\\n+\tif((a) != (b)) { printf(#a  \" != \" #b \"\\n\"); \\\n+\t\treturn TestFail; \\\n+\t}\n+\n+class InterpolatorTest : public Test\n+{\n+protected:\n+\n+\tint run()\n+\t{\n+\t\tInterpolator<int> interpolator;\n+\t\tinterpolator.setData({{10,100},{20,200},{30,300}});\n+\n+\t\tASSERT_EQ(interpolator.getInterpolated(0), 100);\n+\t\tASSERT_EQ(interpolator.getInterpolated(10), 100);\n+\t\tASSERT_EQ(interpolator.getInterpolated(20), 200);\n+\t\tASSERT_EQ(interpolator.getInterpolated(25), 250);\n+\t\tASSERT_EQ(interpolator.getInterpolated(30), 300);\n+\t\tASSERT_EQ(interpolator.getInterpolated(40), 300);\n+\n+\t\tinterpolator.setQuantization(10);\n+\t\tunsigned int q = 0;\n+\t\tASSERT_EQ(interpolator.getInterpolated(25, &q), 300);\n+\t\tASSERT_EQ(q, 30);\n+\t\tASSERT_EQ(interpolator.getInterpolated(24, &q), 200);\n+\t\tASSERT_EQ(q, 20);\n+\t\t\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(InterpolatorTest)\ndiff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build\nnew file mode 100644\nindex 000000000000..4d2427dbd4e7\n--- /dev/null\n+++ b/test/ipa/libipa/meson.build\n@@ -0,0 +1,15 @@\n+# SPDX-License-Identifier: CC0-1.0\n+\n+libipa_test = [\n+    {'name': 'interpolator', 'sources': ['interpolator.cpp']},\n+]\n+\n+foreach test : libipa_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/libipa/'])\n+\n+    test(test['name'], exe, suite : 'ipa')\n+endforeach\ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nindex e9871aba44ee..63820de54899 100644\n--- a/test/ipa/meson.build\n+++ b/test/ipa/meson.build\n@@ -1,5 +1,6 @@\n # SPDX-License-Identifier: CC0-1.0\n \n+subdir('libipa')\n subdir('rkisp1')\n \n ipa_test = [\n","prefixes":["v2","2/9"]}