{"id":20585,"url":"https://patchwork.libcamera.org/api/patches/20585/?format=json","web_url":"https://patchwork.libcamera.org/patch/20585/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20240704162035.15074-9-laurent.pinchart@ideasonboard.com>","date":"2024-07-04T16:20:32","name":"[v2,08/11] include: rkisp1: Update header for compand parameters","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d55d9b6edd0989ea029cce787c816a64f2edd817","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20585/mbox/","series":[{"id":4445,"url":"https://patchwork.libcamera.org/api/series/4445/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4445","date":"2024-07-04T16:20:24","name":"rkisp1: Support BLS on i.MX8MP","version":2,"mbox":"https://patchwork.libcamera.org/series/4445/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20585/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20585/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 20A0ABD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Jul 2024 16:21:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6CF2A63366;\n\tThu,  4 Jul 2024 18:21:18 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96702619C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2024 18:21:04 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A2331502;\n\tThu,  4 Jul 2024 18:20:35 +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=\"VE2CQxV+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720110035;\n\tbh=SWl6qzI8UQ+ZwaY5uOSa/5l0wovV3PqT4KI0tx6UBqY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VE2CQxV+OnD0F2o8L50wyC5EJtBufP1V/dd4WffqcdTZAiCl2drCR+ucVAD25wsHn\n\tC7iDIwViO2sIGWXhTlMivq/4+pK5mQl+wlT2uPGERcs6D7PPsnHZCN+Y/KTXxHPg17\n\taqbIddSbwipk/1voNK1HYEsDwI/p45qNRYbK/XLU=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v2 08/11] include: rkisp1: Update header for compand\n\tparameters","Date":"Thu,  4 Jul 2024 19:20:32 +0300","Message-ID":"<20240704162035.15074-9-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","In-Reply-To":"<20240704162035.15074-1-laurent.pinchart@ideasonboard.com>","References":"<20240704162035.15074-1-laurent.pinchart@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: Paul Elder <paul.elder@ideasonboard.com>\n\nUpdate the rkisp1-config.h header with the definitions for the\ncompanding block, which use the extensible parameters format. The\nchanges come from the \"[PATCH v2 0/5] media: rkisp1: Add support for the\ncompanding block\" series posted to the linux-media mailing list and\navailable at [1].\n\n[1] https://lore.kernel.org/all/20240704154932.6686-1-laurent.pinchart@ideasonboard.com/\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/linux/rkisp1-config.h | 89 ++++++++++++++++++++++++++++++++++-\n 1 file changed, 88 insertions(+), 1 deletion(-)","diff":"diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\nindex 2fe735943d02..848c7f72bc43 100644\n--- a/include/linux/rkisp1-config.h\n+++ b/include/linux/rkisp1-config.h\n@@ -164,6 +164,11 @@\n #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS      17\n #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS  6\n \n+/*\n+ * Compand\n+ */\n+#define RKISP1_CIF_ISP_COMPAND_NUM_POINTS\t64\n+\n /*\n  * Measurement types\n  */\n@@ -851,6 +856,39 @@ struct rkisp1_params_cfg {\n \tstruct rkisp1_cif_isp_isp_other_cfg others;\n };\n \n+/**\n+ * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS)\n+ * @r: Fixed subtraction value for Bayer pattern R\n+ * @gr: Fixed subtraction value for Bayer pattern Gr\n+ * @gb: Fixed subtraction value for Bayer pattern Gb\n+ * @b: Fixed subtraction value for Bayer pattern B\n+ *\n+ * The values will be subtracted from the sensor values. Note that unlike the\n+ * dedicated BLS block, the BLS values in the compander are 20-bit unsigned.\n+ */\n+struct rkisp1_cif_isp_compand_bls_config {\n+\t__u32 r;\n+\t__u32 gr;\n+\t__u32 gb;\n+\t__u32 b;\n+};\n+\n+/**\n+ * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding\n+ * parameters (expand and compression curves)\n+ * @px: Compand curve x-values. Each value stores the distance from the\n+ *      previous x-value, expressed as log2 of the distance on 5 bits.\n+ * @x: Compand curve x-values. The functionality of these parameters are\n+ *     unknown due to do a lack of hardware documentation, but these are left\n+ *     here for future compatibility purposes.\n+ * @y: Compand curve y-values\n+ */\n+struct rkisp1_cif_isp_compand_curve_config {\n+\t__u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n+\t__u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n+\t__u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS];\n+};\n+\n /*---------- PART2: Measurement Statistics ------------*/\n \n /**\n@@ -1018,6 +1056,9 @@ struct rkisp1_stat_buffer {\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics\n  * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics\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  */\n enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_BLS,\n@@ -1037,6 +1078,9 @@ enum rkisp1_ext_params_block_type {\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS,\n \tRKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS,\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 };\n \n /**\n@@ -1384,6 +1428,46 @@ struct rkisp1_ext_params_afc_config {\n \tstruct rkisp1_cif_isp_afc_config config;\n } __attribute__((aligned(8)));\n \n+/**\n+ * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params\n+ * Compand BLS config\n+ *\n+ * RkISP1 extensible parameters Companding configuration block (black level\n+ * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`.\n+ *\n+ * @header: The RkISP1 extensible parameters header, see\n+ *\t    :c:type:`rkisp1_ext_params_block_header`\n+ * @config: Companding BLS configuration, see\n+ *\t    :c:type:`rkisp1_cif_isp_compand_bls_config`\n+ */\n+struct rkisp1_ext_params_compand_bls_config {\n+\tstruct rkisp1_ext_params_block_header header;\n+\tstruct rkisp1_cif_isp_compand_bls_config config;\n+} __attribute__((aligned(8)));\n+\n+/**\n+ * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params\n+ * Compand curve config\n+ *\n+ * RkISP1 extensible parameters Companding configuration block (expand and\n+ * compression curves). Identified by\n+ * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND`or\n+ * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`.\n+ *\n+ * @header: The RkISP1 extensible parameters header, see\n+ *\t    :c:type:`rkisp1_ext_params_block_header`\n+ * @config: Companding curve configuration, see\n+ *\t    :c:type:`rkisp1_cif_isp_compand_curve_config`\n+ */\n+struct rkisp1_ext_params_compand_curve_config {\n+\tstruct rkisp1_ext_params_block_header header;\n+\tstruct rkisp1_cif_isp_compand_curve_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+ */\n #define RKISP1_EXT_PARAMS_MAX_SIZE\t\t\t\t\t\\\n \t(sizeof(struct rkisp1_ext_params_bls_config)\t\t\t+\\\n \tsizeof(struct rkisp1_ext_params_dpcc_config)\t\t\t+\\\n@@ -1401,7 +1485,10 @@ struct rkisp1_ext_params_afc_config {\n \tsizeof(struct rkisp1_ext_params_awb_meas_config)\t\t+\\\n \tsizeof(struct rkisp1_ext_params_hst_config)\t\t\t+\\\n \tsizeof(struct rkisp1_ext_params_aec_config)\t\t\t+\\\n-\tsizeof(struct rkisp1_ext_params_afc_config))\n+\tsizeof(struct rkisp1_ext_params_afc_config)\t\t\t+\\\n+\tsizeof(struct rkisp1_ext_params_compand_bls_config)\t\t+\\\n+\tsizeof(struct rkisp1_ext_params_compand_curve_config)\t\t+\\\n+\tsizeof(struct rkisp1_ext_params_compand_curve_config))\n \n /**\n  * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version\n","prefixes":["v2","08/11"]}