{"id":25021,"url":"https://patchwork.libcamera.org/api/1.1/patches/25021/?format=json","web_url":"https://patchwork.libcamera.org/patch/25021/","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":"<20251113122450.287633-8-kieran.bingham@ideasonboard.com>","date":"2025-11-13T12:24:42","name":"[v3,07/14] ipa: libipa: Provide Q5.4 FixedPoint support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6ea1f8403d475dd0ceec8023792bb9f1c0d86b4a","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/25021/mbox/","series":[{"id":5587,"url":"https://patchwork.libcamera.org/api/1.1/series/5587/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5587","date":"2025-11-13T12:24:35","name":"libipa: Introduce a Quantized type","version":3,"mbox":"https://patchwork.libcamera.org/series/5587/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25021/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25021/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 DB0A8C3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Nov 2025 12:25:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5852760AB0;\n\tThu, 13 Nov 2025 13:25:08 +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 ECD4360AA3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Nov 2025 13:24:55 +0100 (CET)","from Monstersaurus.infra.iob\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 D466C6AF;\n\tThu, 13 Nov 2025 13:22:55 +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=\"E4smjz04\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763036575;\n\tbh=sS7N//jLH2aaFP3AtzN6ndBh0IKnG/x3f3ZkQR1Tzw0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=E4smjz04fgm2JA9StsvMx8tM6xOwGszuobDA8fpAZ+Qn0XSt7cE6ZCI9CNMpIbgF/\n\tCTeipHi9i/0UzK5Ul9RDBPWMowy1S2r7JhHqAp/d5HKtvC/Tivb6pOm+wH2iXbRAeB\n\tLhRMLG05apA9yyJLK5DPN/DOKkylssebV1PEtfEA=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v3 07/14] ipa: libipa: Provide Q5.4 FixedPoint support","Date":"Thu, 13 Nov 2025 12:24:42 +0000","Message-ID":"<20251113122450.287633-8-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<20251113122450.287633-1-kieran.bingham@ideasonboard.com>","References":"<20251113122450.287633-1-kieran.bingham@ideasonboard.com>","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":"Provide a FixedPoint Quantized type to support the Q5.4 format\nrepresenting values in the range [-16.0, 15.9375] with a resolution of\n1/16.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\n\nThis format is used by the RKISP1/i.MX8MP for Chromatic Abberation\nCorrection handling\n\n src/ipa/libipa/fixedpoint.cpp  | 9 +++++++++\n src/ipa/libipa/fixedpoint.h    | 2 ++\n test/ipa/libipa/fixedpoint.cpp | 5 +++++\n 3 files changed, 16 insertions(+)","diff":"diff --git a/src/ipa/libipa/fixedpoint.cpp b/src/ipa/libipa/fixedpoint.cpp\nindex 5b5d3721bf85..5c7e05f99076 100644\n--- a/src/ipa/libipa/fixedpoint.cpp\n+++ b/src/ipa/libipa/fixedpoint.cpp\n@@ -132,6 +132,15 @@ namespace ipa {\n  * values in the range [0.0, 1.992] with a resolution of 1/128.\n  */\n \n+/**\n+ * \\typedef Q5_4\n+ * \\brief 5.4 signed fixed-point quantizer\n+ *\n+ * A Quantized type using 5 bit for the integer part and 4 bits for the\n+ * fractional part, stored in an signed 16-bit integer (\\c int16_t). Represents\n+ * values in the range [-16.0, 15.9375] with a resolution of 1/16.\n+ */\n+\n /**\n  * \\typedef Q12_4\n  * \\brief 12.4 signed fixed-point quantizer\ndiff --git a/src/ipa/libipa/fixedpoint.h b/src/ipa/libipa/fixedpoint.h\nindex c3ee6b2ed69f..39d03632cb24 100644\n--- a/src/ipa/libipa/fixedpoint.h\n+++ b/src/ipa/libipa/fixedpoint.h\n@@ -103,6 +103,8 @@ struct FixedPointQTraits {\n using Q1_7 = Quantized<FixedPointQTraits<1, 7, int8_t>>;\n using UQ1_7 = Quantized<FixedPointQTraits<1, 7, uint8_t>>;\n \n+using Q5_4 = Quantized<FixedPointQTraits<5, 4, int16_t>>;\n+\n using Q12_4 = Quantized<FixedPointQTraits<12, 4, int16_t>>;\n using UQ12_4 = Quantized<FixedPointQTraits<12, 4, uint16_t>>;\n \ndiff --git a/test/ipa/libipa/fixedpoint.cpp b/test/ipa/libipa/fixedpoint.cpp\nindex a806aa1e0ef6..61ad487fd950 100644\n--- a/test/ipa/libipa/fixedpoint.cpp\n+++ b/test/ipa/libipa/fixedpoint.cpp\n@@ -190,6 +190,11 @@ protected:\n \t\tfails += quantizedCheck<Q4_7>(-0.4f, 0b1111'1001101, -0.398438f);\t/* 0x7cd */\n \t\tfails += quantizedCheck<Q4_7>(-1.4f, 0b1110'1001101, -1.39844f);\t/* 0x74d */\n \n+\t\t/* Q5_4(-16 .. 15.9375)  Min: [0x0100:-16] -- Max: [0x00ff:15.9375] Step:0.0625 */\n+\t\tintroduce<Q5_4>(\"Q5_4\");\n+\t\tfails += quantizedCheck<Q5_4>(-16.00f, 0b10000'0000, -16.00f);\n+\t\tfails += quantizedCheck<Q5_4>( 15.94f, 0b01111'1111,  15.9375f);\n+\n \t\t/* Q12.4(-2048 .. 2047.94)  Min: [0x8000:-2048] -- Max: [0x7fff:2047.94] Step:0.0625 */\n \t\tintroduce<Q12_4>(\"Q12_4\");\n \t\tfails += quantizedCheck<Q12_4>(0.0f, 0b000000000000'0000, 0.0f);\n","prefixes":["v3","07/14"]}