[{"id":36808,"web_url":"https://patchwork.libcamera.org/comment/36808/","msgid":"<176307979660.2093070.12465765204116616461@ping.linuxembedded.co.uk>","date":"2025-11-14T00:23:16","subject":"Re: [PATCH v3 00/14] libipa: Introduce a Quantized type","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2025-11-13 12:24:35)\n> This series superceeds [0] \"rkisp1: cproc - Metadata and Hue\n> developments\" by introducing a new base type for libipa to be able to\n> maintain values which are quantized for hardware.\n> \n> These data values often need to be converted, perhaps to a fixed-point\n> format for configuration of hardware, but also then back to a floating\n> point for returning as metadata.\n> \n> In particular this series builds to solve the review comment that\n> blocked the original series at [1]\n> \n> The Quantized type provides a storage mechanism to make both of these\n> storage representations visible to code that wishes to utilise the\n> specific values.\n> \n> The series then re-introduces the proposed updates to cproc using the\n> new Q types by supplying Fixed Point types and a scaled fixed point type\n> for the Hue control.\n> \n> Tests and documentation are provided throughout.\n> \n> [0] https://patchwork.libcamera.org/project/libcamera/list/?series=5245\n> [1] https://patchwork.libcamera.org/patch/23645/#34626\n> \n> Running the tests directly shows the following output (all passing)\n\nUnfortunately, these tests pass but the compiler matrix on CI didn't [2] -\nso that took me down another rabbit hole ... and now extends the series\nto 21 patches! eeek.\n\n[2] https://gitlab.freedesktop.org/camera/libcamera/-/pipelines/1546692\n\nv4 coming with more fixups, conversion, and updates here.\n\n--\nKieran\n\n\n> test/ipa/libipa/quantized\n> Quantised tests passed successfully.\n> test/ipa/libipa/fixedpoint\n> \n> Q1_7(-1 .. 0.992188)  Min: [0x80:-1] -- Max: [0x7f:0.992188] Step:0.0078125\n>   Checking -1 == [0x80:-1]\n>   Checking -0.992 == [0x81:-0.992188]\n>   Checking -0.006 == [0xff:-0.0078125]\n>   Checking 0 == [0x00:0]\n>   Checking 0.008 == [0x01:0.0078125]\n>   Checking 0.992 == [0x7f:0.992188]\n> \n> UQ1_7(0 .. 1.99219)  Min: [0x00:0] -- Max: [0xff:1.99219] Step:0.0078125\n>   Checking 0 == [0x00:0]\n>   Checking 1 == [0x80:1]\n>   Checking 1.992 == [0xff:1.99219]\n> \n> Q4_7(-8 .. 7.99219)  Min: [0x0400:-8] -- Max: [0x03ff:7.99219] Step:0.0078125\n>   Checking -8 == [0x0400:-8]\n>   Checking -0.008 == [0x07ff:-0.0078125]\n>   Checking 0 == [0x0000:0]\n>   Checking 0.008 == [0x0001:0.0078125]\n>   Checking 7.992 == [0x03ff:7.99219]\n>   Checking 0.2 == [0x001a:0.203125]\n>   Checking -0.2 == [0x07e6:-0.203125]\n>   Checking -0.8 == [0x079a:-0.796875]\n>   Checking -0.4 == [0x07cd:-0.398438]\n>   Checking -1.4 == [0x074d:-1.39844]\n> \n> Q5_4(-16 .. 15.9375)  Min: [0x0100:-16] -- Max: [0x00ff:15.9375] Step:0.0625\n>   Checking -16 == [0x0100:-16]\n>   Checking 15.94 == [0x00ff:15.9375]\n> \n> Q12_4(-2048 .. 2047.94)  Min: [0x8000:-2048] -- Max: [0x7fff:2047.94] Step:0.0625\n>   Checking 0 == [0x0000:0]\n>   Checking 7.5 == [0x0078:7.5]\n> \n> UQ12_4(0 .. 4095.94)  Min: [0x0000:0] -- Max: [0xffff:4095.94] Step:0.0625\n>   Checking 0 == [0x0000:0]\n>   Checking 7.5 == [0x0078:7.5]\n> \n> Range validation:\n>   Checking -100 == [0x80:-1]\n>   Checking 100 == [0x7f:0.992188]\n>   Checking -100 == [0x00:0]\n>   Checking 100 == [0xff:1.99219]\n> \n> \n> Scaled Fixed-Point Quantizer tests:\n> \n> HueQ (Scaled Q1_7 * 90) (-90 .. 89.2969)  Min: [0x80:-90] -- Max: [0x7f:89.2969] Step:0.703125\n>   Checking -90 == [0x80:-90]\n>   Checking -45 == [0xc0:-45]\n>   Checking 0 == [0x00:0]\n>   Checking 45 == [0x40:45]\n>   Checking 90 == [0x7f:89.2969]\n>   Checking -99 == [0x80:-90]\n>   Checking 99 == [0x7f:89.2969]\n> \n> CPROC Fixed-Point Quantizer conversion tests:\n>   Checking [0x80:-1] == [0x80:-1]\n>   Checking [0x7f:0.992188] == [0x7f:0.992188]\n>   Checking [0x00:0] == [0x00:0]\n>   Checking [0xff:1.99219] == [0xff:1.99219]\n> \n> \n> \n> Kieran Bingham (13):\n>   ipa: libipa: Provide a Quantized data type support\n>   test: libipa: Add tests for Quantized types\n>   ipa: libipa: Provide fixed point quantized traits\n>   test: libipa: Provide FixedPoint Quantized tests\n>   ipa: libipa: fixedpoint: Fix unsigned usage\n>   test: libipa: Add Q4.7 type and tests to match existing use case tests\n>   ipa: libipa: Provide Q5.4 FixedPoint support\n>   ipa: libipa: fixedpoint: Provide a ScaledFixedPoint type\n>   test: libipa: Provide ScaledFixedPoint tests\n>   ipa: rkisp1: cproc: Convert to use Quantized types\n>   ipa: rkisp1: cproc: Report metadata\n>   ipa: rkisp1: cproc: Provide a Hue control\n>   DNI: test: libipa: fixedpoint: Validate extra types\n> \n> van Veen, Stephan (1):\n>   libcamera: controls: Define a new core Hue control\n> \n>  src/ipa/libipa/fixedpoint.cpp       | 182 ++++++++++++++++++++\n>  src/ipa/libipa/fixedpoint.h         |  72 ++++++++\n>  src/ipa/libipa/meson.build          |   2 +\n>  src/ipa/libipa/quantized.cpp        | 134 +++++++++++++++\n>  src/ipa/libipa/quantized.h          |  78 +++++++++\n>  src/ipa/rkisp1/algorithms/cproc.cpp |  66 +++++---\n>  src/ipa/rkisp1/algorithms/cproc.h   |   4 +\n>  src/ipa/rkisp1/ipa_context.h        |  22 ++-\n>  src/libcamera/control_ids_core.yaml |  13 ++\n>  test/ipa/libipa/fixedpoint.cpp      | 247 +++++++++++++++++++++++++++-\n>  test/ipa/libipa/meson.build         |   1 +\n>  test/ipa/libipa/quantized.cpp       | 130 +++++++++++++++\n>  12 files changed, 916 insertions(+), 35 deletions(-)\n>  create mode 100644 src/ipa/libipa/quantized.cpp\n>  create mode 100644 src/ipa/libipa/quantized.h\n>  create mode 100644 test/ipa/libipa/quantized.cpp\n> \n> -- \n> 2.50.1\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 C010CC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Nov 2025 00:23:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE58960A8B;\n\tFri, 14 Nov 2025 01:23:22 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 85BE86069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Nov 2025 01:23: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 D9546161D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Nov 2025 01:21: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=\"Pfu1UeNT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763079679;\n\tbh=J4OEfcd0qCK5azCM18vZxj2r57vpwcoycJgeiNX5rR8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Pfu1UeNTf+vFmHtlUpsfgrhKKEt6VrfIUH5nxhBUNp2CoLEdG/2qcQMksDeg1sk6N\n\tJ3yz+o6xZndqgWBozewcqicq9gWZmYozJ5geh+71ig5lyR9bd7LS9BembkDHvqHkUe\n\tL8h8cyTk2gWDChLuJir/ikzijFlW4weDhQ9Iy4qU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251113122450.287633-1-kieran.bingham@ideasonboard.com>","References":"<20251113122450.287633-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v3 00/14] libipa: Introduce a Quantized type","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 14 Nov 2025 00:23:16 +0000","Message-ID":"<176307979660.2093070.12465765204116616461@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>"}}]