{"id":21297,"url":"https://patchwork.libcamera.org/api/1.1/patches/21297/?format=json","web_url":"https://patchwork.libcamera.org/patch/21297/","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":"<20240920133941.90629-3-stefan.klug@ideasonboard.com>","date":"2024-09-20T13:39:17","name":"[v3,2/9] test: ipa: libipa: Add tets for Interpolator","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ec9e8a05ad90340c578eef9e129c8259eed4f613","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/21297/mbox/","series":[{"id":4609,"url":"https://patchwork.libcamera.org/api/1.1/series/4609/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4609","date":"2024-09-20T13:39:15","name":"Implement polynomial lsc support","version":3,"mbox":"https://patchwork.libcamera.org/series/4609/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21297/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21297/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 C2245C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Sep 2024 13:39:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5388D63504;\n\tFri, 20 Sep 2024 15:39:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E097D634F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Sep 2024 15:39:51 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:8ade:938d:48b1:cede])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 031F24CE;\n\tFri, 20 Sep 2024 15:38: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=\"a6wzyUE0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726839508;\n\tbh=SUnWlOhmwR6l9+epK/dD3PuK4kwZCJnKspqBgbcvbjU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=a6wzyUE0H2wOQ57CSq3bjFtixEkZDp0eGTHkJUqqapjfo9gcYH5fX0qkL/HtKOV9x\n\tZOmOub70ZpGOZdxUi0HmrvSzQZVgSm2vmZnsdLL2EIglCjP7AOgEnB3gcWuC/+SZaW\n\t/zQ1ygnM0HKlrakr1B7zbzmMun98dBhQuF0ff6Hk=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v3 2/9] test: ipa: libipa: Add tets for Interpolator","Date":"Fri, 20 Sep 2024 15:39:17 +0200","Message-ID":"<20240920133941.90629-3-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20240920133941.90629-1-stefan.klug@ideasonboard.com>","References":"<20240920133941.90629-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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- Stylefixes\n- Collected tags\n- Fixed copyright\n---\n test/ipa/libipa/interpolator.cpp | 54 ++++++++++++++++++++++++++++++++\n test/ipa/libipa/meson.build      | 15 +++++++++\n test/ipa/meson.build             |  1 +\n 3 files changed, 70 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..6abb776060d4\n--- /dev/null\n+++ b/test/ipa/libipa/interpolator.cpp\n@@ -0,0 +1,54 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2024, Ideas on Board Oy\n+ *\n+ * Interpolator tests\n+ */\n+\n+#include \"../src/ipa/libipa/interpolator.h\"\n+\n+#include <cmath>\n+#include <iostream>\n+#include <map>\n+#include <stdint.h>\n+#include <stdio.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)) {                  \\\n+\t\tprintf(#a \" != \" #b \"\\n\"); \\\n+\t\treturn TestFail;           \\\n+\t}\n+\n+class InterpolatorTest : public Test\n+{\n+protected:\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+\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":["v3","2/9"]}