{"id":24889,"url":"https://patchwork.libcamera.org/api/1.1/covers/24889/?format=json","web_url":"https://patchwork.libcamera.org/cover/24889/","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":"<20251029172439.1513907-1-kieran.bingham@ideasonboard.com>","date":"2025-10-29T17:24:25","name":"[v2,00/13] libipa: Introduce a Quantized type","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/24889/mbox/","series":[{"id":5544,"url":"https://patchwork.libcamera.org/api/1.1/series/5544/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5544","date":"2025-10-29T17:24:25","name":"libipa: Introduce a Quantized type","version":2,"mbox":"https://patchwork.libcamera.org/series/5544/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/24889/comments/","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 639E0C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Oct 2025 17:24:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2059560875;\n\tWed, 29 Oct 2025 18:24:48 +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 7D04D60453\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Oct 2025 18:24:46 +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 89F5911DD;\n\tWed, 29 Oct 2025 18:22:56 +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=\"CULfMDRu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761758576;\n\tbh=40Iulwbyu21tsAnibxOMTqBcqjx3Zi4O33V9foS4ni8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=CULfMDRuan19uiOrbPJHkbhHjYGLzluRx3XQQz1K/j4RSow+30huBr+uVGZXgFRLj\n\te5v+KZ2Vqn8+pljJsmz/Go4OJ8FinVWAjaW4J5+bpx8c4e2ko1+W+P28qGFPfztfwx\n\tTBFbNV36cZaFFcQR+4exI+dWISqjIqdMxG/oZTww=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v2 00/13] libipa: Introduce a Quantized type","Date":"Wed, 29 Oct 2025 17:24:25 +0000","Message-ID":"<20251029172439.1513907-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.50.1","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":"This series superceeds [0] \"rkisp1: cproc - Metadata and Hue\ndevelopments\" by introducing a new base type for libipa to be able to\nmaintain values which are quantized for hardware.\n\nThese data values often need to be converted, perhaps to a fixed-point\nformat for configuration of hardware, but also then back to a floating\npoint for returning as metadata.\n\nIn particular this series builds to solve the review comment that\nblocked the original series at [1]\n\nThe Quantized type provides a storage mechanism to make both of these\nstorage representations visible to code that wishes to utilise the\nspecific values.\n\nThe series then re-introduces the proposed updates to cproc using the\nnew Q types by supplying Fixed Point types and a scaled fixed point type\nfor the Hue control.\n\nTests 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\nRunning the tests directly shows the following output (all passing)\n\ntest/ipa/libipa/quantized\nQuantised tests passed successfully.\ntest/ipa/libipa/fixedpoint\n\nQ1_7(-1 .. 0.992188)  Min: Q:0x80 V:-1 -- Max: Q:0x7f V:0.992188 Step:0.0078125\n  Checking -1 == Q:0x80 V:-1\n  Checking -0.992 == Q:0x81 V:-0.992188\n  Checking -0.006 == Q:0xff V:-0.0078125\n  Checking 0 == Q:0x00 V:0\n  Checking 0.008 == Q:0x01 V:0.0078125\n  Checking 0.992 == Q:0x7f V:0.992188\n\nUQ1_7(0 .. 1.99219)  Min: Q:0x00 V:0 -- Max: Q:0xff V:1.99219 Step:0.0078125\n  Checking 0 == Q:0x00 V:0\n  Checking 1 == Q:0x80 V:1\n  Checking 1.992 == Q:0xff V:1.99219\n\nQ4_7(-8 .. 7.99219)  Min: Q:0x0400 V:-8 -- Max: Q:0x03ff V:7.99219 Step:0.0078125\n  Checking -8 == Q:0x0400 V:-8\n  Checking -0.008 == Q:0x07ff V:-0.0078125\n  Checking 0 == Q:0x0000 V:0\n  Checking 0.008 == Q:0x0001 V:0.0078125\n  Checking 7.992 == Q:0x03ff V:7.99219\n  Checking 0.2 == Q:0x001a V:0.203125\n  Checking -0.2 == Q:0x07e6 V:-0.203125\n  Checking -0.8 == Q:0x079a V:-0.796875\n  Checking -0.4 == Q:0x07cd V:-0.398438\n  Checking -1.4 == Q:0x074d V:-1.39844\n\nQ12.4(-2048 .. 2047.94)  Min: Q:0x8000 V:-2048 -- Max: Q:0x7fff V:2047.94 Step:0.0625\n\nQ12_4(-2048 .. 2047.94)  Min: Q:0x8000 V:-2048 -- Max: Q:0x7fff V:2047.94 Step:0.0625\n  Checking 0 == Q:0x0000 V:0\n  Checking 7.5 == Q:0x0078 V:7.5\n\nUQ12_4(0 .. 4095.94)  Min: Q:0x0000 V:0 -- Max: Q:0xffff V:4095.94 Step:0.0625\n  Checking 0 == Q:0x0000 V:0\n  Checking 7.5 == Q:0x0078 V:7.5\n\nRange validation:\n  Checking -100 == Q:0x80 V:-1\n  Checking 100 == Q:0x7f V:0.992188\n  Checking -100 == Q:0x00 V:0\n  Checking 100 == Q:0xff V:1.99219\n\n\nScaled Fixed-Point Quantizer tests:\n\nHueQ (Scaled Q1_7 * 90) (-90 .. 89.2969)  Min: Q:0x80 V:-90 -- Max: Q:0x7f V:89.2969 Step:0.703125\n  Checking -90 == Q:0x80 V:-90\n  Checking -45 == Q:0xc0 V:-45\n  Checking 0 == Q:0x00 V:0\n  Checking 45 == Q:0x40 V:45\n  Checking 90 == Q:0x7f V:89.2969\n  Checking -99 == Q:0x80 V:-90\n  Checking 99 == Q:0x7f V:89.2969\n\nCPROC Fixed-Point Quantizer conversion tests:\n  Checking Q:0x80 V:-1 == Q:0x80 V:-1\n  Checking Q:0x7f V:0.992188 == Q:0x7f V:0.992188\n  Checking Q:0x00 V:0 == Q:0x00 V:0\n  Checking Q:0xff V:1.99219 == Q:0xff V:1.99219\n\n\n\nv2:\n - A big rework thanks to the Traits suggestion!\n - Quantizers are removed.\n - FixedPoint types are added, giving Q1_7, and UQ1_7, Q12_4 and UQ12_4\n   as initial usages.\n - ScaledFixedPoint types added\n\n\n\n\nKieran Bingham (12):\n  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: 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\nvan Veen, Stephan (1):\n  libcamera: controls: Define a new core Hue control\n\n src/ipa/libipa/fixedpoint.cpp       | 173 ++++++++++++++++++++\n src/ipa/libipa/fixedpoint.h         |  70 ++++++++\n src/ipa/libipa/meson.build          |   2 +\n src/ipa/libipa/quantized.cpp        | 134 +++++++++++++++\n src/ipa/libipa/quantized.h          |  79 +++++++++\n src/ipa/rkisp1/algorithms/cproc.cpp |  66 +++++---\n src/ipa/rkisp1/algorithms/cproc.h   |   4 +\n src/ipa/rkisp1/ipa_context.h        |  23 ++-\n src/libcamera/control_ids_core.yaml |  13 ++\n test/ipa/libipa/fixedpoint.cpp      | 242 +++++++++++++++++++++++++++-\n test/ipa/libipa/meson.build         |   1 +\n test/ipa/libipa/quantized.cpp       | 130 +++++++++++++++\n 12 files changed, 902 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"}