[{"id":37681,"web_url":"https://patchwork.libcamera.org/comment/37681/","msgid":"<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>","date":"2026-01-15T16:28:27","subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 01. 14. 18:39 keltezéssel, Kieran Bingham írta:\n> Provide tests to validate the conditions of FixedPoint types used\n> within libcamera explicitly.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> ---\n> v3:\n> - Rename quantized_type to QuantizedType\n> \n> v5:\n> \n> - Use string_view for introduction of type\n> - move min/max check to static assert\n> - Squash down all tests into a single implementation and remove extra\n>    type proliferation.\n> - Use Q/UQ types directly.\n> - use std::cout consistently\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>   test/ipa/libipa/fixedpoint.cpp | 126 +++++++++++++++++++++++++++++++--\n>   1 file changed, 122 insertions(+), 4 deletions(-)\n> \n> diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\n> index 4b017e86a74f..9fa7fa688c24 100644\n> --- a/test/ipa/libipa/fixedpoint.cpp\n> +++ b/test/ipa/libipa/fixedpoint.cpp\n> @@ -5,12 +5,14 @@\n>    * Fixed / Floating point utility tests\n>    */\n>   \n> +#include \"../src/ipa/libipa/fixedpoint.h\"\n> +\n>   #include <cmath>\n>   #include <iostream>\n>   #include <map>\n>   #include <stdint.h>\n>   \n> -#include \"../src/ipa/libipa/fixedpoint.h\"\n> +#include <libcamera/base/utils.h>\n>   \n>   #include \"test.h\"\n>   \n> @@ -95,14 +97,130 @@ protected:\n>   \t\treturn TestPass;\n>   \t}\n>   \n> -\tint run()\n> +\ttemplate<typename Q>\n> +\tint quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n>   \t{\n> -\t\t/* fixed point conversion test */\n> -\t\tif (testFixedPoint() != TestPass)\n> +\t\tQ q(input);\n> +\t\tusing T = typename Q::QuantizedType;\n> +\n> +\t\tstd::cout << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n\n`toString()` can be omitted here and later.\n\n\n> +\n> +\t\tT quantized = q.quantized();\n> +\t\tif (quantized != expected) {\n> +\t\t\tstd::cout << \"    ** Q Expected \" << input\n> +\t\t\t\t  << \" to quantize to \" << utils::hex(expected)\n> +\t\t\t\t  << \", got \" << utils::hex(quantized)\n> +\t\t\t\t  << \" - (\" << q.toString() << \")\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn 1;\n> +\t\t}\n> +\n> +\t\tif ((std::abs(q.value() - value)) > 0.0001f) {\n> +\t\t\tstd::cout << \"    ** V Expected \" << input\n> +\t\t\t\t  << \" to quantize to \" << value\n> +\t\t\t\t  << \", got \" << q.value()\n> +\t\t\t\t  << \" - (\" << q.toString() << \")\"\n> +\t\t\t\t  << std::endl;\n> +\t\t\treturn 1;\n> +\t\t}\n> +\n> +\t\treturn 0;\n> +\t}\n> [...]\n> +\tint testFixedPointQuantizers()\n> +\t{\n> +\t\tunsigned int fails = 0;\n> +\n> +\t\t/* clang-format off */\n> +\n> +\t\t[...]\n> +\n> +\t\t/* UQ12.4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n> +\t\tintroduce<UQ<12, 4>>(\"UQ12.4\");\n> +\t\tfails += quantizedCheck<UQ<12, 4>>(0.0f, 0b000000000000'0000, 0.0f);\n> +\t\tfails += quantizedCheck<UQ<12, 4>>(7.5f, 0b000000000111'1000, 7.5f);\n> +\n> +\t\t/* Validate that exceeding limits clamps to type range */\n> +\t\tstd::cout << std::endl << \"Range validation:\" << std::endl;\n> +\t\tfails += quantizedCheck<Q<1, 7>>(-100.0f, 0b1'0000000, -1.0f);\n> +\t\tfails += quantizedCheck<Q<1, 7>>(+100.0f, 0b0'1111111, 0.992188f);\n> +\t\tfails += quantizedCheck<UQ<1, 7>>(-100.0f, 0b0'0000000, 0.0f);\n> +\t\tfails += quantizedCheck<UQ<1, 7>>(+100.0f, 0b1'1111111, 1.99219f);\n\nWould it be possible to add some tests that use 32 and 64 bit underlying types?\n\n\n> [...]","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 2450AC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Jan 2026 16:28:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7CF9C61FA3;\n\tThu, 15 Jan 2026 17:28:32 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C6F1B61F84\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Jan 2026 17:28:30 +0100 (CET)","from [192.168.33.20] (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EEAD06A8;\n\tThu, 15 Jan 2026 17:28:02 +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=\"FcA+U7p3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768494483;\n\tbh=tOae20DLTZgxsPcWklxZJC92O3YORRtns0m32IvBQr4=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=FcA+U7p3p/gQu+/iLooJt6j+5MIlxPvSysZ/rQpCUl/Tg2T0YWfCqtYpVEGahXDal\n\t0yhLc+GnYdwG0YM1Wwvpc36mZ8mXCw326omJB3TN2B/voPQtVZb0C80h83c14BBMzc\n\t/+H1Bv5ev6atc5vULcV+RN8IM7MgZGMNDAY080UA=","Message-ID":"<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>","Date":"Thu, 15 Jan 2026 17:28:27 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20260114173918.1744023-1-kieran.bingham@ideasonboard.com>\n\t<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":37792,"web_url":"https://patchwork.libcamera.org/comment/37792/","msgid":"<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>","date":"2026-01-21T13:18:17","subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2026-01-15 16:28:27)\n> 2026. 01. 14. 18:39 keltezéssel, Kieran Bingham írta:\n> > Provide tests to validate the conditions of FixedPoint types used\n> > within libcamera explicitly.\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > \n> > ---\n> > v3:\n> > - Rename quantized_type to QuantizedType\n> > \n> > v5:\n> > \n> > - Use string_view for introduction of type\n> > - move min/max check to static assert\n> > - Squash down all tests into a single implementation and remove extra\n> >    type proliferation.\n> > - Use Q/UQ types directly.\n> > - use std::cout consistently\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >   test/ipa/libipa/fixedpoint.cpp | 126 +++++++++++++++++++++++++++++++--\n> >   1 file changed, 122 insertions(+), 4 deletions(-)\n> > \n> > diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\n> > index 4b017e86a74f..9fa7fa688c24 100644\n> > --- a/test/ipa/libipa/fixedpoint.cpp\n> > +++ b/test/ipa/libipa/fixedpoint.cpp\n> > @@ -5,12 +5,14 @@\n> >    * Fixed / Floating point utility tests\n> >    */\n> >   \n> > +#include \"../src/ipa/libipa/fixedpoint.h\"\n> > +\n> >   #include <cmath>\n> >   #include <iostream>\n> >   #include <map>\n> >   #include <stdint.h>\n> >   \n> > -#include \"../src/ipa/libipa/fixedpoint.h\"\n> > +#include <libcamera/base/utils.h>\n> >   \n> >   #include \"test.h\"\n> >   \n> > @@ -95,14 +97,130 @@ protected:\n> >               return TestPass;\n> >       }\n> >   \n> > -     int run()\n> > +     template<typename Q>\n> > +     int quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n> >       {\n> > -             /* fixed point conversion test */\n> > -             if (testFixedPoint() != TestPass)\n> > +             Q q(input);\n> > +             using T = typename Q::QuantizedType;\n> > +\n> > +             std::cout << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n> \n> `toString()` can be omitted here and later.\n> \n> \n> > +\n> > +             T quantized = q.quantized();\n> > +             if (quantized != expected) {\n> > +                     std::cout << \"    ** Q Expected \" << input\n> > +                               << \" to quantize to \" << utils::hex(expected)\n> > +                               << \", got \" << utils::hex(quantized)\n> > +                               << \" - (\" << q.toString() << \")\"\n> > +                               << std::endl;\n> > +                     return 1;\n> > +             }\n> > +\n> > +             if ((std::abs(q.value() - value)) > 0.0001f) {\n> > +                     std::cout << \"    ** V Expected \" << input\n> > +                               << \" to quantize to \" << value\n> > +                               << \", got \" << q.value()\n> > +                               << \" - (\" << q.toString() << \")\"\n> > +                               << std::endl;\n> > +                     return 1;\n> > +             }\n> > +\n> > +             return 0;\n> > +     }\n> > [...]\n> > +     int testFixedPointQuantizers()\n> > +     {\n> > +             unsigned int fails = 0;\n> > +\n> > +             /* clang-format off */\n> > +\n> > +             [...]\n> > +\n> > +             /* UQ12.4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n> > +             introduce<UQ<12, 4>>(\"UQ12.4\");\n> > +             fails += quantizedCheck<UQ<12, 4>>(0.0f, 0b000000000000'0000, 0.0f);\n> > +             fails += quantizedCheck<UQ<12, 4>>(7.5f, 0b000000000111'1000, 7.5f);\n> > +\n> > +             /* Validate that exceeding limits clamps to type range */\n> > +             std::cout << std::endl << \"Range validation:\" << std::endl;\n> > +             fails += quantizedCheck<Q<1, 7>>(-100.0f, 0b1'0000000, -1.0f);\n> > +             fails += quantizedCheck<Q<1, 7>>(+100.0f, 0b0'1111111, 0.992188f);\n> > +             fails += quantizedCheck<UQ<1, 7>>(-100.0f, 0b0'0000000, 0.0f);\n> > +             fails += quantizedCheck<UQ<1, 7>>(+100.0f, 0b1'1111111, 1.99219f);\n> \n> Would it be possible to add some tests that use 32 and 64 bit underlying types?\n\nYes, and that's found some more bugs - also related to the undefined\nbehviour with << shifts so thanks for the prompt!\n\nI'm adding:\n\n/* Storage selection tests */\nstatic_assert(std::is_same_v<typename Q<1, 7>::TraitsType::QuantizedType, int8_t>);\nstatic_assert(std::is_same_v<typename UQ<1, 7>::TraitsType::QuantizedType, uint8_t>);\nstatic_assert(std::is_same_v<typename Q<8, 8>::TraitsType::QuantizedType, int16_t>);\nstatic_assert(std::is_same_v<typename UQ<8, 8>::TraitsType::QuantizedType, uint16_t>);\nstatic_assert(std::is_same_v<typename Q<16, 16>::TraitsType::QuantizedType, int32_t>);\nstatic_assert(std::is_same_v<typename UQ<16, 16>::TraitsType::QuantizedType, uint32_t>);\n\nAnd that's picked out that I have undefined behaviour hitting the\nqMin/qMax types.\n\nFixing for next iteration.\n\nI'll also put in some {U,}Q<30, 2> {U,}Q<60, 4> value and range tests.\n\n\n> \n> \n> > [...]\n>","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 32EDFBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 13:18:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 50C2861FC4;\n\tWed, 21 Jan 2026 14:18:21 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62E8E61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 14:18:20 +0100 (CET)","from pendragon.ideasonboard.com\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 61A88A06;\n\tWed, 21 Jan 2026 14:17:48 +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=\"AaiTvuqc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769001468;\n\tbh=p9OJ8yTmZ74T/oDKzK5pR3d9tCzopcTIz/7RgVf27DQ=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=AaiTvuqc4i1YXFl/yluVcZLHufV3+3acsmFQHMgme4xdK5b/fqLSonHbj5r7F/CRV\n\tcS7heBQZW/JreAn7WHp6FhU177GuA44/t+5nmx6njW/Hl8mnGaC2G3HbHCypoHnJG8\n\t3SY2NcLF1P5/fFWPmkoP5XzseJosehyo1ZdyVYDQ=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>","References":"<20260114173918.1744023-1-kieran.bingham@ideasonboard.com>\n\t<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>\n\t<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>","Subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 21 Jan 2026 13:18:17 +0000","Message-ID":"<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":37794,"web_url":"https://patchwork.libcamera.org/comment/37794/","msgid":"<176900218231.1693075.11791426267363889353@ping.linuxembedded.co.uk>","date":"2026-01-21T13:29:42","subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2026-01-21 13:18:17)\n> Quoting Barnabás Pőcze (2026-01-15 16:28:27)\n> > 2026. 01. 14. 18:39 keltezéssel, Kieran Bingham írta:\n> > > Provide tests to validate the conditions of FixedPoint types used\n> > > within libcamera explicitly.\n> > > \n> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > \n> > > ---\n> > > v3:\n> > > - Rename quantized_type to QuantizedType\n> > > \n> > > v5:\n> > > \n> > > - Use string_view for introduction of type\n> > > - move min/max check to static assert\n> > > - Squash down all tests into a single implementation and remove extra\n> > >    type proliferation.\n> > > - Use Q/UQ types directly.\n> > > - use std::cout consistently\n> > > \n> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > ---\n> > >   test/ipa/libipa/fixedpoint.cpp | 126 +++++++++++++++++++++++++++++++--\n> > >   1 file changed, 122 insertions(+), 4 deletions(-)\n> > > \n> > > diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\n> > > index 4b017e86a74f..9fa7fa688c24 100644\n> > > --- a/test/ipa/libipa/fixedpoint.cpp\n> > > +++ b/test/ipa/libipa/fixedpoint.cpp\n> > > @@ -5,12 +5,14 @@\n> > >    * Fixed / Floating point utility tests\n> > >    */\n> > >   \n> > > +#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > +\n> > >   #include <cmath>\n> > >   #include <iostream>\n> > >   #include <map>\n> > >   #include <stdint.h>\n> > >   \n> > > -#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > +#include <libcamera/base/utils.h>\n> > >   \n> > >   #include \"test.h\"\n> > >   \n> > > @@ -95,14 +97,130 @@ protected:\n> > >               return TestPass;\n> > >       }\n> > >   \n> > > -     int run()\n> > > +     template<typename Q>\n> > > +     int quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n> > >       {\n> > > -             /* fixed point conversion test */\n> > > -             if (testFixedPoint() != TestPass)\n> > > +             Q q(input);\n> > > +             using T = typename Q::QuantizedType;\n> > > +\n> > > +             std::cout << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n> > \n> > `toString()` can be omitted here and later.\n> > \n> > \n> > > +\n> > > +             T quantized = q.quantized();\n> > > +             if (quantized != expected) {\n> > > +                     std::cout << \"    ** Q Expected \" << input\n> > > +                               << \" to quantize to \" << utils::hex(expected)\n> > > +                               << \", got \" << utils::hex(quantized)\n> > > +                               << \" - (\" << q.toString() << \")\"\n> > > +                               << std::endl;\n> > > +                     return 1;\n> > > +             }\n> > > +\n> > > +             if ((std::abs(q.value() - value)) > 0.0001f) {\n> > > +                     std::cout << \"    ** V Expected \" << input\n> > > +                               << \" to quantize to \" << value\n> > > +                               << \", got \" << q.value()\n> > > +                               << \" - (\" << q.toString() << \")\"\n> > > +                               << std::endl;\n> > > +                     return 1;\n> > > +             }\n> > > +\n> > > +             return 0;\n> > > +     }\n> > > [...]\n> > > +     int testFixedPointQuantizers()\n> > > +     {\n> > > +             unsigned int fails = 0;\n> > > +\n> > > +             /* clang-format off */\n> > > +\n> > > +             [...]\n> > > +\n> > > +             /* UQ12.4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n> > > +             introduce<UQ<12, 4>>(\"UQ12.4\");\n> > > +             fails += quantizedCheck<UQ<12, 4>>(0.0f, 0b000000000000'0000, 0.0f);\n> > > +             fails += quantizedCheck<UQ<12, 4>>(7.5f, 0b000000000111'1000, 7.5f);\n> > > +\n> > > +             /* Validate that exceeding limits clamps to type range */\n> > > +             std::cout << std::endl << \"Range validation:\" << std::endl;\n> > > +             fails += quantizedCheck<Q<1, 7>>(-100.0f, 0b1'0000000, -1.0f);\n> > > +             fails += quantizedCheck<Q<1, 7>>(+100.0f, 0b0'1111111, 0.992188f);\n> > > +             fails += quantizedCheck<UQ<1, 7>>(-100.0f, 0b0'0000000, 0.0f);\n> > > +             fails += quantizedCheck<UQ<1, 7>>(+100.0f, 0b1'1111111, 1.99219f);\n> > \n> > Would it be possible to add some tests that use 32 and 64 bit underlying types?\n\nHrm - it looks like we have built in requirements/assumptions on a\nmaximum type of 32 bits too for the toFloat implementation:\n\n\tstatic constexpr float toFloat(QuantizedType q)\n\t{\n\t\tif constexpr (std::is_unsigned_v<T>)\n\t\t\treturn static_cast<float>(q) / static_cast<float>(UT{1} << F);\n\n\t\t/*\n\t\t * Recreate the upper bits in case of a negative number by\n\t\t * shifting the sign bit from the fixed point to the first bit\n\t\t * of the unsigned and then right shifting by the same amount\n\t\t * which keeps the sign bit in place. This can be optimized by\n\t\t * the compiler quite well.\n\t\t */\n\t\tstatic_assert(sizeof(int) >= sizeof(T));\n\n\t\tint remaining_bits = sizeof(int) * 8 - (I + F);\n\t\tint t = static_cast<int>(static_cast<unsigned>(q) << remaining_bits) >> remaining_bits;\n\t\treturn static_cast<float>(t) / static_cast<float>(UT{1} << F);\n\t}\n\nI think I'll remove 64 bit support for now. Someone could add that in\nlater if required but I don't think we need 64 bit fixed point types\nright now (or even in the foreseable?)\n\n--\nKieran","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 565BEBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 13:29:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5A86261FC4;\n\tWed, 21 Jan 2026 14:29:46 +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 51D3A61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 14:29:45 +0100 (CET)","from pendragon.ideasonboard.com\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 43951593;\n\tWed, 21 Jan 2026 14:29: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=\"epObIkjF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769002153;\n\tbh=CU/in6SBD8E/xt34J7rOAKePfQqJWWj1EcUBJcM2xeQ=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=epObIkjFxDn+5eswCSrYxz183gTeic9enMffsTtbEYc51ypcd7romDqTgqRyKIfms\n\tKEzvf6R+XNziew1R1kLEvTg+/YEqHfRDFjaMuaoWr3fUQCCQMNcMf/F+eNb9GC1gYT\n\tP5WOTC5tdwnM/N1gDTW9wv5+O5CSFxSCdguTApJw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>","References":"<20260114173918.1744023-1-kieran.bingham@ideasonboard.com>\n\t<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>\n\t<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>\n\t<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>","Subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Wed, 21 Jan 2026 13:29:42 +0000","Message-ID":"<176900218231.1693075.11791426267363889353@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":37799,"web_url":"https://patchwork.libcamera.org/comment/37799/","msgid":"<20260121151831.GA184493@killaraus>","date":"2026-01-21T15:18:31","subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Jan 21, 2026 at 01:29:42PM +0000, Kieran Bingham wrote:\n> Quoting Kieran Bingham (2026-01-21 13:18:17)\n> > Quoting Barnabás Pőcze (2026-01-15 16:28:27)\n> > > 2026. 01. 14. 18:39 keltezéssel, Kieran Bingham írta:\n> > > > Provide tests to validate the conditions of FixedPoint types used\n> > > > within libcamera explicitly.\n> > > > \n> > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > > \n> > > > ---\n> > > > v3:\n> > > > - Rename quantized_type to QuantizedType\n> > > > \n> > > > v5:\n> > > > \n> > > > - Use string_view for introduction of type\n> > > > - move min/max check to static assert\n> > > > - Squash down all tests into a single implementation and remove extra\n> > > >    type proliferation.\n> > > > - Use Q/UQ types directly.\n> > > > - use std::cout consistently\n> > > > \n> > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > > ---\n> > > >   test/ipa/libipa/fixedpoint.cpp | 126 +++++++++++++++++++++++++++++++--\n> > > >   1 file changed, 122 insertions(+), 4 deletions(-)\n> > > > \n> > > > diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\n> > > > index 4b017e86a74f..9fa7fa688c24 100644\n> > > > --- a/test/ipa/libipa/fixedpoint.cpp\n> > > > +++ b/test/ipa/libipa/fixedpoint.cpp\n> > > > @@ -5,12 +5,14 @@\n> > > >    * Fixed / Floating point utility tests\n> > > >    */\n> > > >   \n> > > > +#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > > +\n> > > >   #include <cmath>\n> > > >   #include <iostream>\n> > > >   #include <map>\n> > > >   #include <stdint.h>\n> > > >   \n> > > > -#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > > +#include <libcamera/base/utils.h>\n> > > >   \n> > > >   #include \"test.h\"\n> > > >   \n> > > > @@ -95,14 +97,130 @@ protected:\n> > > >               return TestPass;\n> > > >       }\n> > > >   \n> > > > -     int run()\n> > > > +     template<typename Q>\n> > > > +     int quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n> > > >       {\n> > > > -             /* fixed point conversion test */\n> > > > -             if (testFixedPoint() != TestPass)\n> > > > +             Q q(input);\n> > > > +             using T = typename Q::QuantizedType;\n> > > > +\n> > > > +             std::cout << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n> > > \n> > > `toString()` can be omitted here and later.\n> > > \n> > > > +\n> > > > +             T quantized = q.quantized();\n> > > > +             if (quantized != expected) {\n> > > > +                     std::cout << \"    ** Q Expected \" << input\n> > > > +                               << \" to quantize to \" << utils::hex(expected)\n> > > > +                               << \", got \" << utils::hex(quantized)\n> > > > +                               << \" - (\" << q.toString() << \")\"\n> > > > +                               << std::endl;\n> > > > +                     return 1;\n> > > > +             }\n> > > > +\n> > > > +             if ((std::abs(q.value() - value)) > 0.0001f) {\n> > > > +                     std::cout << \"    ** V Expected \" << input\n> > > > +                               << \" to quantize to \" << value\n> > > > +                               << \", got \" << q.value()\n> > > > +                               << \" - (\" << q.toString() << \")\"\n> > > > +                               << std::endl;\n> > > > +                     return 1;\n> > > > +             }\n> > > > +\n> > > > +             return 0;\n> > > > +     }\n> > > > [...]\n> > > > +     int testFixedPointQuantizers()\n> > > > +     {\n> > > > +             unsigned int fails = 0;\n> > > > +\n> > > > +             /* clang-format off */\n> > > > +\n> > > > +             [...]\n> > > > +\n> > > > +             /* UQ12.4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n> > > > +             introduce<UQ<12, 4>>(\"UQ12.4\");\n> > > > +             fails += quantizedCheck<UQ<12, 4>>(0.0f, 0b000000000000'0000, 0.0f);\n> > > > +             fails += quantizedCheck<UQ<12, 4>>(7.5f, 0b000000000111'1000, 7.5f);\n> > > > +\n> > > > +             /* Validate that exceeding limits clamps to type range */\n> > > > +             std::cout << std::endl << \"Range validation:\" << std::endl;\n> > > > +             fails += quantizedCheck<Q<1, 7>>(-100.0f, 0b1'0000000, -1.0f);\n> > > > +             fails += quantizedCheck<Q<1, 7>>(+100.0f, 0b0'1111111, 0.992188f);\n> > > > +             fails += quantizedCheck<UQ<1, 7>>(-100.0f, 0b0'0000000, 0.0f);\n> > > > +             fails += quantizedCheck<UQ<1, 7>>(+100.0f, 0b1'1111111, 1.99219f);\n> > > \n> > > Would it be possible to add some tests that use 32 and 64 bit underlying types?\n> \n> Hrm - it looks like we have built in requirements/assumptions on a\n> maximum type of 32 bits too for the toFloat implementation:\n> \n> \tstatic constexpr float toFloat(QuantizedType q)\n> \t{\n> \t\tif constexpr (std::is_unsigned_v<T>)\n> \t\t\treturn static_cast<float>(q) / static_cast<float>(UT{1} << F);\n> \n> \t\t/*\n> \t\t * Recreate the upper bits in case of a negative number by\n> \t\t * shifting the sign bit from the fixed point to the first bit\n> \t\t * of the unsigned and then right shifting by the same amount\n> \t\t * which keeps the sign bit in place. This can be optimized by\n> \t\t * the compiler quite well.\n> \t\t */\n> \t\tstatic_assert(sizeof(int) >= sizeof(T));\n> \n> \t\tint remaining_bits = sizeof(int) * 8 - (I + F);\n> \t\tint t = static_cast<int>(static_cast<unsigned>(q) << remaining_bits) >> remaining_bits;\n> \t\treturn static_cast<float>(t) / static_cast<float>(UT{1} << F);\n> \t}\n> \n> I think I'll remove 64 bit support for now. Someone could add that in\n> later if required but I don't think we need 64 bit fixed point types\n> right now (or even in the foreseable?)\n\n32 bits is likely enough, I don't foresee the need to write 64-bit fixed\npoints values to registers any time soon. Make sure there's a\ncompilation-time error if anyone tries to set I + F > 32.","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 C3001C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 15:18:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB6BF61FC9;\n\tWed, 21 Jan 2026 16:18:35 +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 18F7061F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 16:18:34 +0100 (CET)","from pendragon.ideasonboard.com\n\t(2001-14ba-703d-e500--2a1.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::2a1])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C1943741;\n\tWed, 21 Jan 2026 16:18:01 +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=\"ThNCEo0b\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769008681;\n\tbh=1xsdYLmNhjIxsu8ddhUZVQV6yGsb1VtJS956MKsXyas=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ThNCEo0bPFzlVCEHjOpC85/tWzd+CL/xxHUR1OHjfBpv8u/z7EiESXKDwhlWH6Ze5\n\tvjtZfQWWusBbUAH7hkUDGXSmNF3rLMlA8JbA6fVaEEksHTWOfrM3pZTHnIQCmo9zNv\n\t4iGFhS1LoZa/eFdj6k8x6a3+gtV7zMe6J5+ErMgI=","Date":"Wed, 21 Jan 2026 17:18:31 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","Message-ID":"<20260121151831.GA184493@killaraus>","References":"<20260114173918.1744023-1-kieran.bingham@ideasonboard.com>\n\t<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>\n\t<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>\n\t<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>\n\t<176900218231.1693075.11791426267363889353@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<176900218231.1693075.11791426267363889353@ping.linuxembedded.co.uk>","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>"}},{"id":37804,"web_url":"https://patchwork.libcamera.org/comment/37804/","msgid":"<176901046882.1693075.15531496315038278749@ping.linuxembedded.co.uk>","date":"2026-01-21T15:47:48","subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2026-01-21 15:18:31)\n> On Wed, Jan 21, 2026 at 01:29:42PM +0000, Kieran Bingham wrote:\n> > Quoting Kieran Bingham (2026-01-21 13:18:17)\n> > > Quoting Barnabás Pőcze (2026-01-15 16:28:27)\n> > > > 2026. 01. 14. 18:39 keltezéssel, Kieran Bingham írta:\n> > > > > Provide tests to validate the conditions of FixedPoint types used\n> > > > > within libcamera explicitly.\n> > > > > \n> > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > > > \n> > > > > ---\n> > > > > v3:\n> > > > > - Rename quantized_type to QuantizedType\n> > > > > \n> > > > > v5:\n> > > > > \n> > > > > - Use string_view for introduction of type\n> > > > > - move min/max check to static assert\n> > > > > - Squash down all tests into a single implementation and remove extra\n> > > > >    type proliferation.\n> > > > > - Use Q/UQ types directly.\n> > > > > - use std::cout consistently\n> > > > > \n> > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > > > ---\n> > > > >   test/ipa/libipa/fixedpoint.cpp | 126 +++++++++++++++++++++++++++++++--\n> > > > >   1 file changed, 122 insertions(+), 4 deletions(-)\n> > > > > \n> > > > > diff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\n> > > > > index 4b017e86a74f..9fa7fa688c24 100644\n> > > > > --- a/test/ipa/libipa/fixedpoint.cpp\n> > > > > +++ b/test/ipa/libipa/fixedpoint.cpp\n> > > > > @@ -5,12 +5,14 @@\n> > > > >    * Fixed / Floating point utility tests\n> > > > >    */\n> > > > >   \n> > > > > +#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > > > +\n> > > > >   #include <cmath>\n> > > > >   #include <iostream>\n> > > > >   #include <map>\n> > > > >   #include <stdint.h>\n> > > > >   \n> > > > > -#include \"../src/ipa/libipa/fixedpoint.h\"\n> > > > > +#include <libcamera/base/utils.h>\n> > > > >   \n> > > > >   #include \"test.h\"\n> > > > >   \n> > > > > @@ -95,14 +97,130 @@ protected:\n> > > > >               return TestPass;\n> > > > >       }\n> > > > >   \n> > > > > -     int run()\n> > > > > +     template<typename Q>\n> > > > > +     int quantizedCheck(float input, typename Q::QuantizedType expected, float value)\n> > > > >       {\n> > > > > -             /* fixed point conversion test */\n> > > > > -             if (testFixedPoint() != TestPass)\n> > > > > +             Q q(input);\n> > > > > +             using T = typename Q::QuantizedType;\n> > > > > +\n> > > > > +             std::cout << \"  Checking \" << input << \" == \" << q.toString() << std::endl;\n> > > > \n> > > > `toString()` can be omitted here and later.\n> > > > \n> > > > > +\n> > > > > +             T quantized = q.quantized();\n> > > > > +             if (quantized != expected) {\n> > > > > +                     std::cout << \"    ** Q Expected \" << input\n> > > > > +                               << \" to quantize to \" << utils::hex(expected)\n> > > > > +                               << \", got \" << utils::hex(quantized)\n> > > > > +                               << \" - (\" << q.toString() << \")\"\n> > > > > +                               << std::endl;\n> > > > > +                     return 1;\n> > > > > +             }\n> > > > > +\n> > > > > +             if ((std::abs(q.value() - value)) > 0.0001f) {\n> > > > > +                     std::cout << \"    ** V Expected \" << input\n> > > > > +                               << \" to quantize to \" << value\n> > > > > +                               << \", got \" << q.value()\n> > > > > +                               << \" - (\" << q.toString() << \")\"\n> > > > > +                               << std::endl;\n> > > > > +                     return 1;\n> > > > > +             }\n> > > > > +\n> > > > > +             return 0;\n> > > > > +     }\n> > > > > [...]\n> > > > > +     int testFixedPointQuantizers()\n> > > > > +     {\n> > > > > +             unsigned int fails = 0;\n> > > > > +\n> > > > > +             /* clang-format off */\n> > > > > +\n> > > > > +             [...]\n> > > > > +\n> > > > > +             /* UQ12.4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625 */\n> > > > > +             introduce<UQ<12, 4>>(\"UQ12.4\");\n> > > > > +             fails += quantizedCheck<UQ<12, 4>>(0.0f, 0b000000000000'0000, 0.0f);\n> > > > > +             fails += quantizedCheck<UQ<12, 4>>(7.5f, 0b000000000111'1000, 7.5f);\n> > > > > +\n> > > > > +             /* Validate that exceeding limits clamps to type range */\n> > > > > +             std::cout << std::endl << \"Range validation:\" << std::endl;\n> > > > > +             fails += quantizedCheck<Q<1, 7>>(-100.0f, 0b1'0000000, -1.0f);\n> > > > > +             fails += quantizedCheck<Q<1, 7>>(+100.0f, 0b0'1111111, 0.992188f);\n> > > > > +             fails += quantizedCheck<UQ<1, 7>>(-100.0f, 0b0'0000000, 0.0f);\n> > > > > +             fails += quantizedCheck<UQ<1, 7>>(+100.0f, 0b1'1111111, 1.99219f);\n> > > > \n> > > > Would it be possible to add some tests that use 32 and 64 bit underlying types?\n> > \n> > Hrm - it looks like we have built in requirements/assumptions on a\n> > maximum type of 32 bits too for the toFloat implementation:\n> > \n> >       static constexpr float toFloat(QuantizedType q)\n> >       {\n> >               if constexpr (std::is_unsigned_v<T>)\n> >                       return static_cast<float>(q) / static_cast<float>(UT{1} << F);\n> > \n> >               /*\n> >                * Recreate the upper bits in case of a negative number by\n> >                * shifting the sign bit from the fixed point to the first bit\n> >                * of the unsigned and then right shifting by the same amount\n> >                * which keeps the sign bit in place. This can be optimized by\n> >                * the compiler quite well.\n> >                */\n> >               static_assert(sizeof(int) >= sizeof(T));\n> > \n> >               int remaining_bits = sizeof(int) * 8 - (I + F);\n> >               int t = static_cast<int>(static_cast<unsigned>(q) << remaining_bits) >> remaining_bits;\n> >               return static_cast<float>(t) / static_cast<float>(UT{1} << F);\n> >       }\n> > \n> > I think I'll remove 64 bit support for now. Someone could add that in\n> > later if required but I don't think we need 64 bit fixed point types\n> > right now (or even in the foreseable?)\n> \n> 32 bits is likely enough, I don't foresee the need to write 64-bit fixed\n> points values to registers any time soon. Make sure there's a\n> compilation-time error if anyone tries to set I + F > 32.\n\nActually - it turns out I'll probably restrict to 24 bits while we use\n'float'. More than that and we'll want to swap up for double types.\n\n\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 5BF60BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Jan 2026 15:47:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86F5361FC4;\n\tWed, 21 Jan 2026 16:47:53 +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 E94FC61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Jan 2026 16:47:51 +0100 (CET)","from pendragon.ideasonboard.com\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 CBDC71C6;\n\tWed, 21 Jan 2026 16:47: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=\"NbtPqH+2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1769010439;\n\tbh=RujKqG3X3blPDfIaV9QQeFFimtHCWZs7Mf47fLI35n4=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=NbtPqH+2yXtJePdP6++kFfGGFTVZvGfkMj3RiRev0x6xR9D5+wGv26GRnasAZWun2\n\tvo2t4PtRcdN6urP0cqeACy0/80MfeXnSdePwhVBkX53bHyBBea49VYNzJmuGLd6q0g\n\tCFY6fAnx0oSr4ESFhoXY6xja2zfZVQLqmB07iEFc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260121151831.GA184493@killaraus>","References":"<20260114173918.1744023-1-kieran.bingham@ideasonboard.com>\n\t<20260114173918.1744023-6-kieran.bingham@ideasonboard.com>\n\t<ff504453-1051-42d5-94b4-5c71b9069cc9@ideasonboard.com>\n\t<176900149720.1693075.4910566726924337921@ping.linuxembedded.co.uk>\n\t<176900218231.1693075.11791426267363889353@ping.linuxembedded.co.uk>\n\t<20260121151831.GA184493@killaraus>","Subject":"Re: [PATCH v5 05/16] test: libipa: Provide FixedPoint Quantized\n\ttests","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Wed, 21 Jan 2026 15:47:48 +0000","Message-ID":"<176901046882.1693075.15531496315038278749@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]