{"id":26210,"url":"https://patchwork.libcamera.org/api/patches/26210/?format=json","web_url":"https://patchwork.libcamera.org/patch/26210/","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":"<20260219-kbingham-quantizers-v8-14-2b6ff68ead26@ideasonboard.com>","date":"2026-02-19T15:05:15","name":"[v8,14/15] test: libipa: Remove legacy fixed point conversion test","commit_ref":"f05aab5aca1166803d804f70202591583a88de95","pull_url":null,"state":"accepted","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/26210/mbox/","series":[{"id":5802,"url":"https://patchwork.libcamera.org/api/series/5802/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5802","date":"2026-02-19T15:05:01","name":"libipa: Introduce a Quantized type","version":8,"mbox":"https://patchwork.libcamera.org/series/5802/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26210/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26210/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 314CBC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Feb 2026 15:05:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9226B6226E;\n\tThu, 19 Feb 2026 16:05:25 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 97DBB62273\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Feb 2026 16:05:12 +0100 (CET)","from ping.linuxembedded.co.uk\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 7370527F9;\n\tThu, 19 Feb 2026 16:04:19 +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=\"RlBmCUin\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1771513459;\n\tbh=gvIg/krgeAKVXjFC9J/b5MWuAj3gObmd6jfe4R6IQlg=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=RlBmCUinmw6i1cGj9u9YD940SDZZpxgPF85Sr7DNwY63nI4hWhD3OPTWLSVuaa0rI\n\t8fiPm/Myw141VaCiKyXXxNgIp+Fo0Hk2icVnGbAtFbpKcQ9i6LeJ+2GAwl/HVTtWaX\n\thoPpBATZRQoCYmQz5z6rpJc6RwMPqYdbBEhE+7UY=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Date":"Thu, 19 Feb 2026 15:05:15 +0000","Subject":"[PATCH v8 14/15] test: libipa: Remove legacy fixed point\n\tconversion test","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260219-kbingham-quantizers-v8-14-2b6ff68ead26@ideasonboard.com>","References":"<20260219-kbingham-quantizers-v8-0-2b6ff68ead26@ideasonboard.com>","In-Reply-To":"<20260219-kbingham-quantizers-v8-0-2b6ff68ead26@ideasonboard.com>","To":"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>, \n\tPaul Elder <paul.elder@ideasonboard.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1771513507; l=4866;\n\ti=kieran.bingham@ideasonboard.com; s=20260207;\n\th=from:subject:message-id; \n\tbh=gvIg/krgeAKVXjFC9J/b5MWuAj3gObmd6jfe4R6IQlg=;\n\tb=tMktmhb5PMirbXXnx2fzI45bJhe6HkwGuaU1pDfMlP30uGLb6fwdJRH8XZiNNrNYzvS5u0gls\n\tLGQTLR8WVH7BzduQL4kV1rFwc3URttjmJrKVVeg4hHCTI1jmewJ9sSD","X-Developer-Key":"i=kieran.bingham@ideasonboard.com; a=ed25519;\n\tpk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY=","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>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\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 2907426b7a69..316d9f8f1b7d 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@@ -219,6 +145,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@@ -295,10 +236,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":["v8","14/15"]}