{"id":26155,"url":"https://patchwork.libcamera.org/api/1.1/patches/26155/?format=json","web_url":"https://patchwork.libcamera.org/patch/26155/","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":"<20260213-kbingham-quantizers-v7-14-1626b9aaabf1@ideasonboard.com>","date":"2026-02-13T16:57:53","name":"[v7,14/15] test: libipa: Remove legacy fixed point conversion test","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0667b594e2499d08be16d6b007b6165c3d4af75a","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/26155/mbox/","series":[{"id":5789,"url":"https://patchwork.libcamera.org/api/1.1/series/5789/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5789","date":"2026-02-13T16:57:39","name":"libipa: Introduce a Quantized type","version":7,"mbox":"https://patchwork.libcamera.org/series/5789/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26155/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26155/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 476FCC32F8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Feb 2026 16:58:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B82156221C;\n\tFri, 13 Feb 2026 17:58:19 +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 6C277621F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Feb 2026 17:58:07 +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 9CC93348;\n\tFri, 13 Feb 2026 17:57:18 +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=\"vxY9Sdjc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1771001838;\n\tbh=+IO/802O96hLg6PYvR6XkamXQga74HE7o+TKfn9O1Hc=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=vxY9SdjcwxymHzRFM3arKNPkbEFegcsOajjWJ/l31HrqEbztvSAqzKlDrvVjWCqRy\n\tAfAI9cHytClw202QmueHMPXZkoiTtc/PdpPaCAsR79z7XazWXehYwFpiOI27/yZkDK\n\t/9DYBPateq6++qrQUUtxpvMlEyI0zlSnyELP4gyw=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Date":"Fri, 13 Feb 2026 16:57:53 +0000","Subject":"[PATCH v7 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":"<20260213-kbingham-quantizers-v7-14-1626b9aaabf1@ideasonboard.com>","References":"<20260213-kbingham-quantizers-v7-0-1626b9aaabf1@ideasonboard.com>","In-Reply-To":"<20260213-kbingham-quantizers-v7-0-1626b9aaabf1@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>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=ed25519-sha256; t=1771001883; l=5073;\n\ti=kieran.bingham@ideasonboard.com; s=20260207;\n\th=from:subject:message-id; \n\tbh=+IO/802O96hLg6PYvR6XkamXQga74HE7o+TKfn9O1Hc=;\n\tb=TP849ZalGGVFnxR+0LbC/ioH8FUKIeHg1752fYcqWb7/sVUX2HU3XWug8Jn/kEjOwWy0p6wyz\n\t3MVWS+TZVQyD64NINRyNLzt8bpP9agGiFEdkjKTHlteMT7ICLXFsQU0","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>\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---\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":["v7","14/15"]}