{"id":23168,"url":"https://patchwork.libcamera.org/api/1.1/patches/23168/?format=json","web_url":"https://patchwork.libcamera.org/patch/23168/","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":"<20250411130423.2164577-2-stefan.klug@ideasonboard.com>","date":"2025-04-11T13:04:08","name":"[1/8] include: linux: Add Wdr to rkisp1-config.h","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b4eb80cee9ecda5555ea749623eadc371865d900","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23168/mbox/","series":[{"id":5122,"url":"https://patchwork.libcamera.org/api/1.1/series/5122/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5122","date":"2025-04-11T13:04:07","name":"Implement WDR algorithm","version":1,"mbox":"https://patchwork.libcamera.org/series/5122/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23168/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23168/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 CC5E9C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Apr 2025 13:04:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86EB368AA2;\n\tFri, 11 Apr 2025 15:04:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9329468A90\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Apr 2025 15:04:30 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:5b21:2ad5:1023:7179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 326FF667;\n\tFri, 11 Apr 2025 15:02:31 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"H9ObuWYj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1744376551;\n\tbh=IpGHt+jH7947Ft/P0vMDtPTf4fCCMp8E2cVf9bVm0jE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=H9ObuWYjlpxZ9P5ydp7Jb1F8/hgcdY62J/egVnDa6POf0+KITttvSUs138o21gb+n\n\tWOC7ZLpoQPEYLN+2ExdhFqm0HVcaE0V2mjzLtdwyhPRybqJwlh6rqH69d85TqQoiUI\n\te7UzievbvVhdb3TSVofkOVCXiTkIdugdkZQG4Igo=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>, Jai Luthra <me@jailuthra.in>","Subject":"[PATCH 1/8] include: linux: Add Wdr to rkisp1-config.h","Date":"Fri, 11 Apr 2025 15:04:08 +0200","Message-ID":"<20250411130423.2164577-2-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20250411130423.2164577-1-stefan.klug@ideasonboard.com>","References":"<20250411130423.2164577-1-stefan.klug@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":"From: Jai Luthra <me@jailuthra.in>\n\nUpdate linux headers.\n\nSigned-off-by: Jai Luthra <me@jailuthra.in>\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/linux/rkisp1-config.h | 72 +++++++++++++++++++++++++++++++++++\n 1 file changed, 72 insertions(+)","diff":"diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\nindex edbc6cb65d1c..656835577c9e 100644\n--- a/include/linux/rkisp1-config.h\n+++ b/include/linux/rkisp1-config.h\n@@ -169,6 +169,13 @@\n  */\n #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS\t64\n \n+/*\n+ * Wide Dynamic Range\n+ */\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV\t32\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF\t(RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV + 1)\n+#define RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS\t4\n+\n /*\n  * Measurement types\n  */\n@@ -889,6 +896,52 @@ struct rkisp1_cif_isp_compand_curve_config {\n \t__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n };\n \n+/**\n+ * struct rkisp1_cif_isp_wdr_tone_curve - Tone mapping curve definition for WDR unit.\n+ *\n+ * @dY: the dYn increments for horizontal (input) axis of the tone curve.\n+ *      each 3-bit dY value represents an increment of 2**(value+3).\n+ *      dY[0] bits 0:2 is increment dY1, bit 3 unused\n+ *      dY[0] bits 4:6 is increment dY2, bit 7 unused\n+ *      ...\n+ *      dY[0] bits 28:30 is increment dY8, bit 31 unused\n+ *      ... and so on till dY[3] bits 28:30 is increment dY32, bit 31 unused.\n+ * @ym: the Ym values for the vertical (output) axis of the tone curve.\n+ *      each value is 13 bit.\n+ *\n+ * The reset values define a linear curve which has the same effect as bypass:\n+ *\n+ * dY[0..3] = 0x44444444, This means that input sample range of 0-4096 is\n+ * divided in 32 equal increments of 2**(4+3) = 128 units\n+ *\n+ * ym[0] = 0x0000, ym[1] = 0x0080, ... ym[31] = 0x0f80, ym[32] = 0x1000\n+ * which increases by 0x80 = 128 units\n+ *\n+ */\n+struct rkisp1_cif_isp_wdr_tone_curve {\n+\t__u32 dY[RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS];\n+\t__u16 ym[RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF];\n+};\n+\n+struct rkisp1_cif_isp_wdr_iref_config {\n+\t__u8 rgb_factor;\n+\t__u8 use_y9_8;\n+\t__u8 use_rgb7_8;\n+\t__u8 disable_transient;\n+};\n+\n+struct rkisp1_cif_isp_wdr_config {\n+\tstruct rkisp1_cif_isp_wdr_tone_curve tone_curve;\n+\tstruct rkisp1_cif_isp_wdr_iref_config iref_config;\n+\t__u16 rgb_offset;\n+\t__u16 luma_offset;\n+\t__u16 dmin_thresh;\n+\t__u8 dmin_strength;\n+\t__u8 use_rgb_colorspace;\n+\t__u8 bypass_chroma_mapping;\n+\t__u8 use_iref;\n+};\n+\n /*---------- PART2: Measurement Statistics ------------*/\n \n /**\n@@ -1059,6 +1112,7 @@ struct rkisp1_stat_buffer {\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve\n+ * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range\n  */\n enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,\n@@ -1081,6 +1135,7 @@ enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS,\n+\tRKISP1_EXT_PARAMS_BLOCK_TYPE_WDR,\n };\n \n #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE\t(1U << 0)\n@@ -1460,6 +1515,23 @@ struct rkisp1_ext_params_compand_curve_config {\n \tstruct rkisp1_cif_isp_compand_curve_config config;\n } __attribute__((aligned(8)));\n \n+/**\n+ * struct rkisp1_ext_params_wdr_config - RkISP1 extensible params\n+ *                                       Wide dynamic range config\n+ *\n+ * RkISP1 extensible parameters WDR block.\n+ * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR`\n+ *\n+ * @header: The RkISP1 extensible parameters header, see\n+ *\t    :c:type:`rkisp1_ext_params_block_header`\n+ * @config: WDR configuration, see\n+ *\t    :c:type:`rkisp1_cif_isp_wdr_config`\n+ */\n+struct rkisp1_ext_params_wdr_config {\n+\tstruct rkisp1_ext_params_block_header header;\n+\tstruct rkisp1_cif_isp_wdr_config config;\n+} __attribute__((aligned(8)));\n+\n /*\n  * The rkisp1_ext_params_compand_curve_config structure is counted twice as it\n  * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types.\n","prefixes":["1/8"]}