{"id":25921,"url":"https://patchwork.libcamera.org/api/patches/25921/?format=json","web_url":"https://patchwork.libcamera.org/patch/25921/","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":"<20260121173737.376113-15-kieran.bingham@ideasonboard.com>","date":"2026-01-21T17:37:33","name":"[v6,14/16] test: libipa: Remove legacy fixed point conversion test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0667b594e2499d08be16d6b007b6165c3d4af75a","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/25921/mbox/","series":[{"id":5730,"url":"https://patchwork.libcamera.org/api/series/5730/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5730","date":"2026-01-21T17:37:19","name":"libipa: Introduce a Quantized type","version":6,"mbox":"https://patchwork.libcamera.org/series/5730/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25921/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25921/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 EAF1DC32EF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 17:38:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8CBFA61FE4;\n\tWed, 21 Jan 2026 18:38:02 +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 DA0A961FD7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 18:37:45 +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 D7FCE26D1;\n\tWed, 21 Jan 2026 18:37:13 +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=\"D1SeOthU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769017034;\n\tbh=QqV1Pm3Ln94l1+dNT3bkPFFh6SKbjiUcfq4ZU94517g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=D1SeOthUsdiBGQHnAp7cX+qwiHdpOMJvwgFzKTcPMq8lOStGfr8yPt2VCMug0+OZ/\n\tU2Vh2sNaYJAFVYGxf9f/pWdQ7rYkXEE1nimmHqgaHP5XU1pvU7zPNATXRkjqj3qKfp\n\tcev+q+bItdS3KPtRUi2Uz/9vtDCQX32UYypvKniE=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tIsaac Scott <isaac.scott@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[PATCH v6 14/16] test: libipa: Remove legacy fixed point conversion\n\ttest","Date":"Wed, 21 Jan 2026 17:37:33 +0000","Message-ID":"<20260121173737.376113-15-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260121173737.376113-1-kieran.bingham@ideasonboard.com>","References":"<20260121173737.376113-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":"Now that the fixed point conversions are equally covered by the new Q types,\nthe legacy tests for fixedToFloatingPoint and floatingToFixedPoint are\nredundant.\n\nRemove them, and replace the existing test cases with equivalant tests\nusing the new Q4.7 type directly to maintain identical test coverage.\n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nv4:\n- Remove redundant \"No Sign Extension\" comment\n\nv5:\n- Simplify to new Q<4, 7>\n- Squash two patches together\n  - test: libipa: Remove legacy fixed point conversion test\n  - test: libipa: Add Q4.7 type and tests to match existing use case tests\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/ipa/libipa/fixedpoint.cpp | 93 ++++++----------------------------\n 1 file changed, 15 insertions(+), 78 deletions(-)","diff":"diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\nindex 500cd308be98..bf7c1947cf36 100644\n--- a/test/ipa/libipa/fixedpoint.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -23,80 +23,6 @@ using namespace ipa;\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 = 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-\t\t\t     << \" to convert to \" << expected\n-\t\t\t     << \", got \" << out << std::endl;\n-\t\t\treturn TestFail;\n-\t\t}\n-\n-\t\treturn TestPass;\n-\t}\n-\n-\ttemplate<unsigned int IntPrec, unsigned int FracPrec, typename T>\n-\tint testSingleFixedPoint(double input, T expected)\n-\t{\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-\t\t\treturn TestFail;\n-\t\t}\n-\n-\t\t/*\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 = 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-\t\t\t     << \", got \" << f << std::endl;\n-\t\t\treturn TestFail;\n-\t\t}\n-\n-\t\treturn TestPass;\n-\t}\n-\n-\tint testFixedPoint()\n-\t{\n-\t\t/*\n-\t\t * The second 7.992 test is to test that unused bits don't\n-\t\t * affect the result.\n-\t\t */\n-\t\tstd::map<double, int16_t> testCases = {\n-\t\t\t{ 7.992, 0x3ff },\n-\t\t\t{   0.2, 0x01a },\n-\t\t\t{  -0.2, 0x7e6 },\n-\t\t\t{  -0.8, 0x79a },\n-\t\t\t{  -0.4, 0x7cd },\n-\t\t\t{  -1.4, 0x74d },\n-\t\t\t{    -8, 0x400 },\n-\t\t\t{     0, 0 },\n-\t\t};\n-\n-\t\tint ret;\n-\t\tfor (const auto &testCase : testCases) {\n-\t\t\tret = testSingleFixedPoint<4, 7, int16_t>(testCase.first,\n-\t\t\t\t\t\t\t\t   testCase.second);\n-\t\t\tif (ret != TestPass)\n-\t\t\t\treturn ret;\n-\t\t}\n-\n-\t\t/* Special case with a superfluous one in the unused bits */\n-\t\tret = testFixedToFloat<4, 7, int16_t, double>(0xbff, 7.992);\n-\t\tif (ret != TestPass)\n-\t\t\treturn ret;\n-\n-\t\treturn TestPass;\n-\t}\n-\n \ttemplate<typename Q>\n \tint quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n \t{\n@@ -184,6 +110,21 @@ protected:\n \t\tfails += quantizedCheck<UQ<1, 7>>( 1.992f, 0b1'1111111, 1.99219f);\t/* Max */\n \t\tfails += quantizedCheck<UQ<1, 7>>( 2.000f, 0b1'1111111, 1.99219f);\t/* Clamped to Max */\n \n+\t\t/* Q4.7(-8 .. 7.99219)  Min: [0x0400:-8] -- Max: [0x03ff:7.99219] Step:0.0078125 */\n+\t\tintroduce<Q<4, 7>>(\"Q4.7\");\n+\t\tfails += quantizedCheck<Q<4, 7>>(-8.0f,   0b1000'0000000, -8.0f);\t/* Min */\n+\t\tfails += quantizedCheck<Q<4, 7>>(-0.008f, 0b1111'1111111, -0.0078125);\t/* -1 step */\n+\t\tfails += quantizedCheck<Q<4, 7>>( 0.0f,   0b0000'0000000,  0.0f);\t/* Zero */\n+\t\tfails += quantizedCheck<Q<4, 7>>( 0.008f, 0b0000'0000001,  0.0078125f);\t/* +1 step */\n+\t\tfails += quantizedCheck<Q<4, 7>>( 7.992f, 0b0111'1111111,  7.99219f);\t/* Max */\n+\n+\t\t/* Retain additional tests from original testFixedPoint() */\n+\t\tfails += quantizedCheck<Q<4, 7>>( 0.2f, 0b0000'0011010,  0.203125f);\t/* 0x01a */\n+\t\tfails += quantizedCheck<Q<4, 7>>(-0.2f, 0b1111'1100110, -0.203125f);\t/* 0x7e6 */\n+\t\tfails += quantizedCheck<Q<4, 7>>(-0.8f, 0b1111'0011010, -0.796875f);\t/* 0x79a */\n+\t\tfails += quantizedCheck<Q<4, 7>>(-0.4f, 0b1111'1001101, -0.398438f);\t/* 0x7cd */\n+\t\tfails += quantizedCheck<Q<4, 7>>(-1.4f, 0b1110'1001101, -1.39844f);\t/* 0x74d */\n+\n \t\t/* UQ4.8(0 .. 15.9961)  Min: [0x0000:0] -- Max: [0x0fff:15.9961] Step:0.00390625 */\n \t\tintroduce<UQ<4, 8>>(\"UQ4.8\");\n \t\tfails += quantizedCheck<UQ<4, 8>>( 0.0f, 0b0000'00000000,  0.00f);\n@@ -248,10 +189,6 @@ protected:\n \t{\n \t\tunsigned int fails = 0;\n \n-\t\t/* fixed point conversion test */\n-\t\tif (testFixedPoint() != TestPass)\n-\t\t\tfails++;\n-\n \t\tif (testFixedPointQuantizers() != TestPass)\n \t\t\tfails++;\n \n","prefixes":["v6","14/16"]}