{"id":24902,"url":"https://patchwork.libcamera.org/api/patches/24902/?format=json","web_url":"https://patchwork.libcamera.org/patch/24902/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20251029172439.1513907-14-kieran.bingham@ideasonboard.com>","date":"2025-10-29T17:24:38","name":"[v2,13/13] DNI: test: libipa: fixedpoint: Validate extra types","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0066b5b2ae0c3dea129fdca861dfbf4b623fc7fb","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24902/mbox/","series":[{"id":5544,"url":"https://patchwork.libcamera.org/api/series/5544/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5544","date":"2025-10-29T17:24:25","name":"libipa: Introduce a Quantized type","version":2,"mbox":"https://patchwork.libcamera.org/series/5544/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24902/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24902/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 BA81BC3335\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Oct 2025 17:25:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63F9B608CA;\n\tWed, 29 Oct 2025 18:25:09 +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 94E6F608C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Oct 2025 18:24:49 +0100 (CET)","from Monstersaurus.hippo-penny.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C1004E45;\n\tWed, 29 Oct 2025 18:23:00 +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=\"DQ+7QCV6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761758580;\n\tbh=zUiPKTtmmpRi8Hr6zoav5cWPwz3HCSmysAqavYZInCY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DQ+7QCV6j6WoViQO6JF9aKTjP8eEtM/dYfIKXapOYuOqs9jnxOaj/1fQELCIhKGkb\n\tLJc4t5dLWqNnPG9hCDuewW7T02bVjJnRu6IeBfk1bn5p/yJ9S3zl5tJlF+xFPETRdz\n\tem1YLZKCIDoefQq1e4z3MrvSvCCv0ez8zssCiFSQ=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v2 13/13] DNI: test: libipa: fixedpoint: Validate extra types","Date":"Wed, 29 Oct 2025 17:24:38 +0000","Message-ID":"<20251029172439.1513907-14-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<20251029172439.1513907-1-kieran.bingham@ideasonboard.com>","References":"<20251029172439.1513907-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":"Check that the Cproc manual types can be directly served by the new\nfixed point types.\n\nDNI: This patch is just here to validate that my conversions are using\nthe right types and work as the original code did. I don't expect this\none to be merged.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/ipa/libipa/fixedpoint.cpp | 68 ++++++++++++++++++++++++++++++++++\n 1 file changed, 68 insertions(+)","diff":"diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\nindex f8be1e4bf70f..ffab9638fa29 100644\n--- a/test/ipa/libipa/fixedpoint.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -247,6 +247,71 @@ protected:\n \t\treturn fails ? TestFail : TestPass;\n \t}\n \n+\tstruct BrightnessTraits {\n+\t\tusing quantized_type = int8_t;\n+\t\tstatic constexpr quantized_type fromFloat(float v)\n+\t\t{\n+\t\t\tint quantized = std::lround(v * 128.0f);\n+\t\t\treturn static_cast<int8_t>(std::clamp<int>(quantized, -128, 127));\n+\t\t}\n+\t\tstatic float toFloat(quantized_type v)\n+\t\t{\n+\t\t\treturn static_cast<float>(v) / 128.0f;\n+\t\t}\n+\t};\n+\n+\tusing BrightnessQOriginal = Quantized<BrightnessTraits>;\n+\n+\tstruct ContrastSaturationTraits {\n+\t\tusing quantized_type = uint8_t;\n+\t\tstatic constexpr quantized_type fromFloat(float v)\n+\t\t{\n+\t\t\tint quantized = std::lround(v * 128.0f);\n+\t\t\treturn static_cast<uint8_t>(std::clamp<int>(quantized, 0, 255));\n+\t\t}\n+\t\tstatic float toFloat(quantized_type v)\n+\t\t{\n+\t\t\treturn static_cast<float>(v) / 128.0f;\n+\t\t}\n+\t};\n+\n+\tusing ContrastQOriginal = Quantized<ContrastSaturationTraits>;\n+\n+\t/* FixedPoint equivalents to validate */\n+\tusing BrightnessQ = Quantized<FixedPointQTraits<1, 7, int8_t>>;\n+\tusing ContrastQ = Quantized<FixedPointQTraits<1, 7, uint8_t>>;\n+\n+\ttemplate<typename T1, typename T2>\n+\tint testTwoIdenticalTypes(float v)\n+\t{\n+\t\tT1 a(v);\n+\t\tT2 b(v);\n+\n+\t\tstd::cout << \"  Checking \" << a.toString()\n+\t\t\t  << \" == \" << b.toString()\n+\t\t\t  << std::endl;\n+\n+\t\t/* 0/false success, 1/true fail */\n+\t\treturn (a.quantized() != b.quantized());\n+\t}\n+\n+\tint testCprocFixedPointConversion()\n+\t{\n+\t\tunsigned int fails = 0;\n+\n+\t\tstd::cout << std::endl\n+\t\t\t  << \"CPROC Fixed-Point Quantizer conversion tests:\"\n+\t\t\t  << std::endl;\n+\n+\t\tfails += testTwoIdenticalTypes<BrightnessQOriginal, BrightnessQ>(BrightnessQ::TraitsType::min);\n+\t\tfails += testTwoIdenticalTypes<BrightnessQOriginal, BrightnessQ>(BrightnessQ::TraitsType::max);\n+\n+\t\tfails += testTwoIdenticalTypes<ContrastQOriginal, ContrastQ>(ContrastQ::TraitsType::min);\n+\t\tfails += testTwoIdenticalTypes<ContrastQOriginal, ContrastQ>(ContrastQ::TraitsType::max);\n+\n+\t\treturn fails ? TestFail : TestPass;\n+\t}\n+\n \tint run()\n \t{\n \t\tunsigned int fails = 0;\n@@ -261,6 +326,9 @@ protected:\n \t\tif (testScaledFixedPointQuantizers() != TestPass)\n \t\t\tfails++;\n \n+\t\tif (testCprocFixedPointConversion() != TestPass)\n+\t\t\tfails++;\n+\n \t\treturn fails ? TestFail : TestPass;\n \t}\n };\n","prefixes":["v2","13/13"]}