{"id":19530,"url":"https://patchwork.libcamera.org/api/1.1/patches/19530/?format=json","web_url":"https://patchwork.libcamera.org/patch/19530/","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":"<20240223155954.4139705-3-kieran.bingham@ideasonboard.com>","date":"2024-02-23T15:59:53","name":"[RFC,2/3] test: ipa: libipa: Add CameraSensorHelper Gain Model tests","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5fc7f82031f4a66e664e9dab3b816dbc773f51aa","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19530/mbox/","series":[{"id":4177,"url":"https://patchwork.libcamera.org/api/1.1/series/4177/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4177","date":"2024-02-23T15:59:51","name":"libipa: Fix CameraSensorHelper gain helpers","version":1,"mbox":"https://patchwork.libcamera.org/series/4177/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19530/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19530/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 329F1BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Feb 2024 16:00:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3811B62835;\n\tFri, 23 Feb 2024 17:00:01 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CBE0361CA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Feb 2024 16:59:58 +0100 (CET)","from Monstersaurus.local\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A1AEFF1;\n\tFri, 23 Feb 2024 16:59:49 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WougIg0m\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1708703989;\n\tbh=M1BJxsefQk31tFj5FM4OIHvyizXIEYug3nhJCQZkPrE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WougIg0myKzjYr1r+djfXFOocfGYpMjFkwE6R6FB8NfXI056XpVzNnY/larQ4YCMu\n\twWxx8DawMFVIpuK8mOqCW4lrCZFV8+TkKuFtJJ1J7M2LYsPq5/TLTGdfxIm/73atFd\n\tS0oyBp9wMfMxQuvJEpWutzM+eXtgkSBajY+tn9KE=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"[RFC PATCH 2/3] test: ipa: libipa: Add CameraSensorHelper Gain Model\n\ttests","Date":"Fri, 23 Feb 2024 15:59:53 +0000","Message-Id":"<20240223155954.4139705-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240223155954.4139705-1-kieran.bingham@ideasonboard.com>","References":"<20240223155954.4139705-1-kieran.bingham@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":"Introduce a test that validates conversion of the gain model\nin each CameraSensorHelper.\n\nIt should be expected that if a gainCode produces a given gain\nvalue, then converting that gain back should produce the same\nresult.\n\nThis test fails on the following CameraSensorHelpers:\n - imx219 imx258 imx283 imx290 imx296 imx327 imx335 imx477\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nThis test also fails on the ar0521 helper as that has a defined code\nlimit of '63', which the test does not yet have a way to infer.\n\nAdding a 'maxCode' helper to the base class may be the way to go here,\nand would also let us define a maximum value for other helpers directly.\n\n test/ipa/camera_sensor_helper.cpp | 69 +++++++++++++++++++++++++++++++\n test/ipa/meson.build              |  1 +\n 2 files changed, 70 insertions(+)\n create mode 100644 test/ipa/camera_sensor_helper.cpp","diff":"diff --git a/test/ipa/camera_sensor_helper.cpp b/test/ipa/camera_sensor_helper.cpp\nnew file mode 100644\nindex 000000000000..2d37628f87c4\n--- /dev/null\n+++ b/test/ipa/camera_sensor_helper.cpp\n@@ -0,0 +1,69 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2024, Ideas on Board Oy.\n+ */\n+\n+#include \"libipa/camera_sensor_helper.h\"\n+\n+#include <iostream>\n+#include <string.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+using namespace libcamera::ipa;\n+\n+class CameraSensorHelperTest : public Test\n+{\n+protected:\n+\tint testGainModel(std::string model)\n+\t{\n+\t\tint ret = TestPass;\n+\n+\t\tstd::unique_ptr<CameraSensorHelper> camHelper_;\n+\n+\t\tcamHelper_ = CameraSensorHelperFactoryBase::create(model);\n+\t\tif (!camHelper_) {\n+\t\t\tstd::cout\n+\t\t\t\t<< \"Failed to create camera sensor helper for \"\n+\t\t\t\t<< model;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tfor (unsigned int i = 0; i < 240; i++) {\n+\t\t\tfloat gain = camHelper_->gain(i);\n+\t\t\tuint32_t gainCode = camHelper_->gainCode(gain);\n+\n+\t\t\tif (i != gainCode) {\n+\t\t\t\tstd::cout << model << \": Gain conversions failed: \"\n+\t\t\t\t\t  << i << \" : \" << gain << \" : \"\n+\t\t\t\t\t  << gainCode << std::endl;\n+\n+\t\t\t\tret = TestFail;\n+\t\t\t}\n+\t\t};\n+\n+\t\treturn ret;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tunsigned int failures = 0;\n+\n+\t\tstd::vector<CameraSensorHelperFactoryBase *> factories;\n+\n+\t\tfor (auto factory : CameraSensorHelperFactoryBase::factories()) {\n+\t\t\tconst std::string &model = factory->name();\n+\n+\t\t\tcout << \"Testing CameraSensorHelper for \" << model << endl;\n+\n+\t\t\tif (testGainModel(factory->name()) == TestFail)\n+\t\t\t\tfailures++;\n+\t\t}\n+\n+\t\treturn failures ? TestFail : TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(CameraSensorHelperTest)\ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nindex 180b0da0a51a..c99385a7cb8b 100644\n--- a/test/ipa/meson.build\n+++ b/test/ipa/meson.build\n@@ -1,6 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n ipa_test = [\n+    {'name': 'camera_sensor_helper', 'sources': ['camera_sensor_helper.cpp']},\n     {'name': 'ipa_module_test', 'sources': ['ipa_module_test.cpp']},\n     {'name': 'ipa_interface_test', 'sources': ['ipa_interface_test.cpp']},\n ]\n","prefixes":["RFC","2/3"]}