[{"id":29007,"web_url":"https://patchwork.libcamera.org/comment/29007/","msgid":"<20240319214712.GB8501@pendragon.ideasonboard.com>","date":"2024-03-19T21:47:12","subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Will and Kieran,\n\nThank you for the patch.\n\nOn Tue, Mar 19, 2024 at 03:11:21PM +0000, Kieran Bingham wrote:\n> From: Will Whang <will@willwhang.com>\n> \n> Add tuning files and camera helpers for the Sony IMX283.\n> \n> Signed-off-by: Will Whang <will@willwhang.com>\n> [Kieran: Fix checkstyle formatting, extend commit message, remove pi5]\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> ---\n> This is a partial cherry-pick from\n> https://github.com/raspberrypi/libcamera/pull/118\n> \n> The Pi5 support has not been included, as Pi5 is not yet upstream.\n> Once Pi5 is submitted, the remaining components from\n> https://github.com/raspberrypi/libcamera/pull/118 for the IMX283 should\n> be submitted on top.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/rpi/cam_helper/cam_helper_imx283.cpp |  73 +++++\n>  src/ipa/rpi/cam_helper/meson.build           |   1 +\n>  src/ipa/rpi/vc4/data/imx283.json             | 320 +++++++++++++++++++\n>  src/ipa/rpi/vc4/data/meson.build             |   1 +\n>  4 files changed, 395 insertions(+)\n>  create mode 100644 src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n>  create mode 100644 src/ipa/rpi/vc4/data/imx283.json\n> \n> diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> new file mode 100644\n> index 000000000000..5674b75466b5\n> --- /dev/null\n> +++ b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> @@ -0,0 +1,73 @@\n> +/* SPDX-License-Identifier: BSD-2-Clause */\n> +/*\n> + * Copyright (C) 2021, Raspberry Pi Ltd\n> + *\n> + * cam_helper_imx283.cpp - camera information for imx283 sensor\n> + */\n> +\n> +#include <assert.h>\n> +\n> +#include \"cam_helper.h\"\n> +#include \"math.h\"\n\nMissing blank line.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +using namespace RPiController;\n> +\n> +class CamHelperImx283 : public CamHelper\n> +{\n> +public:\n> +\tCamHelperImx283();\n> +\tuint32_t gainCode(double gain) const override;\n> +\tdouble gain(uint32_t gainCode) const override;\n> +\tvoid getDelays(int &exposureDelay, int &gainDelay,\n> +\t\t       int &vblankDelay, int &hblankDelay) const override;\n> +\tunsigned int hideFramesModeSwitch() const override;\n> +\n> +private:\n> +\t/*\n> +\t * Smallest difference between the frame length and integration time,\n> +\t * in units of lines.\n> +\t */\n> +\tstatic constexpr int frameIntegrationDiff = 4;\n> +};\n> +\n> +/*\n> + * Imx283 doesn't output metadata, so we have to use the \"unicam parser\" which\n> + * works by counting frames.\n> + */\n> +\n> +CamHelperImx283::CamHelperImx283()\n> +\t: CamHelper({}, frameIntegrationDiff)\n> +{\n> +}\n> +\n> +uint32_t CamHelperImx283::gainCode(double gain) const\n> +{\n> +\treturn static_cast<uint32_t>(2048.0 - 2048.0 / gain);\n> +}\n> +\n> +double CamHelperImx283::gain(uint32_t gainCode) const\n> +{\n> +\treturn static_cast<double>(2048.0 / (2048 - gainCode));\n> +}\n> +\n> +void CamHelperImx283::getDelays(int &exposureDelay, int &gainDelay,\n> +\t\t\t\tint &vblankDelay, int &hblankDelay) const\n> +{\n> +\t/* The driver appears to behave as follows: */\n> +\texposureDelay = 2;\n> +\tgainDelay = 2;\n> +\tvblankDelay = 2;\n> +\thblankDelay = 2;\n> +}\n> +\n> +unsigned int CamHelperImx283::hideFramesModeSwitch() const\n> +{\n> +\t/* After a mode switch, we seem to get 1 bad frame. */\n> +\treturn 1;\n> +}\n> +\n> +static CamHelper *create()\n> +{\n> +\treturn new CamHelperImx283();\n> +}\n> +\n> +static RegisterCamHelper reg(\"imx283\", &create);\n> diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\n> index 7262505742f3..1e43f1da29cd 100644\n> --- a/src/ipa/rpi/cam_helper/meson.build\n> +++ b/src/ipa/rpi/cam_helper/meson.build\n> @@ -4,6 +4,7 @@ rpi_ipa_cam_helper_sources = files([\n>      'cam_helper.cpp',\n>      'cam_helper_ov5647.cpp',\n>      'cam_helper_imx219.cpp',\n> +    'cam_helper_imx283.cpp',\n>      'cam_helper_imx290.cpp',\n>      'cam_helper_imx296.cpp',\n>      'cam_helper_imx477.cpp',\n> diff --git a/src/ipa/rpi/vc4/data/imx283.json b/src/ipa/rpi/vc4/data/imx283.json\n> new file mode 100644\n> index 000000000000..20892de19299\n> --- /dev/null\n> +++ b/src/ipa/rpi/vc4/data/imx283.json\n> @@ -0,0 +1,320 @@\n> +{\n> +    \"version\": 2.0,\n> +    \"target\": \"bcm2835\",\n> +    \"algorithms\": [\n> +        {\n> +            \"rpi.black_level\":\n> +            {\n> +                \"black_level\": 3200\n> +            }\n> +        },\n> +        {\n> +            \"rpi.dpc\": { }\n> +        },\n> +        {\n> +            \"rpi.lux\":\n> +            {\n> +                \"reference_shutter_speed\": 2461,\n> +                \"reference_gain\": 1.0,\n> +                \"reference_aperture\": 1.0,\n> +                \"reference_lux\": 1148,\n> +                \"reference_Y\": 13314\n> +            }\n> +        },\n> +        {\n> +            \"rpi.noise\":\n> +            {\n> +                \"reference_constant\": 0,\n> +                \"reference_slope\": 2.204\n> +            }\n> +        },\n> +        {\n> +            \"rpi.geq\":\n> +            {\n> +                \"offset\": 199,\n> +                \"slope\": 0.01947\n> +            }\n> +        },\n> +        {\n> +            \"rpi.sdn\": { }\n> +        },\n> +        {\n> +            \"rpi.awb\":\n> +            {\n> +                \"priors\": [\n> +                    {\n> +                        \"lux\": 0,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 1.0,\n> +                            3000, 0.0,\n> +                            13000, 0.0\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"lux\": 800,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 0.0,\n> +                            6000, 2.0,\n> +                            13000, 2.0\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"lux\": 1500,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 0.0,\n> +                            4000, 1.0,\n> +                            6000, 6.0,\n> +                            6500, 7.0,\n> +                            7000, 1.0,\n> +                            13000, 1.0\n> +                        ]\n> +                    }\n> +                ],\n> +                \"modes\":\n> +                {\n> +                    \"auto\":\n> +                    {\n> +                        \"lo\": 2500,\n> +                        \"hi\": 8000\n> +                    },\n> +                    \"incandescent\":\n> +                    {\n> +                        \"lo\": 2500,\n> +                        \"hi\": 3000\n> +                    },\n> +                    \"tungsten\":\n> +                    {\n> +                        \"lo\": 3000,\n> +                        \"hi\": 3500\n> +                    },\n> +                    \"fluorescent\":\n> +                    {\n> +                        \"lo\": 4000,\n> +                        \"hi\": 4700\n> +                    },\n> +                    \"indoor\":\n> +                    {\n> +                        \"lo\": 3000,\n> +                        \"hi\": 5000\n> +                    },\n> +                    \"daylight\":\n> +                    {\n> +                        \"lo\": 5500,\n> +                        \"hi\": 6500\n> +                    },\n> +                    \"cloudy\":\n> +                    {\n> +                        \"lo\": 7000,\n> +                        \"hi\": 8600\n> +                    }\n> +                },\n> +                \"bayes\": 1,\n> +                \"ct_curve\":\n> +                [\n> +                    2213.0, 0.9607, 0.2593,\n> +                    2255.0, 0.9309, 0.2521,\n> +                    2259.0, 0.9257, 0.2508,\n> +                    5313.0, 0.4822, 0.5909,\n> +                    6237.0, 0.4726, 0.6376\n> +                ],\n> +                \"sensitivity_r\": 1.0,\n> +                \"sensitivity_b\": 1.0,\n> +                \"transverse_pos\": 0.0144,\n> +                \"transverse_neg\": 0.01\n> +            }\n> +        },\n> +        {\n> +            \"rpi.agc\":\n> +            {\n> +                \"metering_modes\":\n> +                {\n> +                    \"centre-weighted\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0\n> +                        ]\n> +                    },\n> +                    \"spot\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n> +                        ]\n> +                    },\n> +                    \"matrix\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n> +                        ]\n> +                    }\n> +                },\n> +                \"exposure_modes\":\n> +                {\n> +                    \"normal\":\n> +                    {\n> +                        \"shutter\": [ 100, 10000, 30000, 60000, 120000 ],\n> +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> +                    },\n> +                    \"short\":\n> +                    {\n> +                        \"shutter\": [ 100, 5000, 10000, 20000, 120000 ],\n> +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> +                    }\n> +                },\n> +                \"constraint_modes\":\n> +                {\n> +                    \"normal\": [\n> +                        {\n> +                            \"bound\": \"LOWER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.5,\n> +                                1000, 0.5\n> +                            ]\n> +                        }\n> +                    ],\n> +                    \"highlight\": [\n> +                        {\n> +                            \"bound\": \"LOWER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.5,\n> +                                1000, 0.5\n> +                            ]\n> +                        },\n> +                        {\n> +                            \"bound\": \"UPPER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.8,\n> +                                1000, 0.8\n> +                            ]\n> +                        }\n> +                    ]\n> +                },\n> +                \"y_target\":\n> +                [\n> +                    0, 0.16,\n> +                    1000, 0.165,\n> +                    10000, 0.17\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.alsc\":\n> +            {\n> +                \"omega\": 1.3,\n> +                \"n_iter\": 100,\n> +                \"luminance_strength\": 0.7\n> +            }\n> +        },\n> +        {\n> +            \"rpi.contrast\":\n> +            {\n> +                \"ce_enable\": 1,\n> +                \"gamma_curve\":\n> +                [\n> +                    0, 0,\n> +                    1024, 5040,\n> +                    2048, 9338,\n> +                    3072, 12356,\n> +                    4096, 15312,\n> +                    5120, 18051,\n> +                    6144, 20790,\n> +                    7168, 23193,\n> +                    8192, 25744,\n> +                    9216, 27942,\n> +                    10240, 30035,\n> +                    11264, 32005,\n> +                    12288, 33975,\n> +                    13312, 35815,\n> +                    14336, 37600,\n> +                    15360, 39168,\n> +                    16384, 40642,\n> +                    18432, 43379,\n> +                    20480, 45749,\n> +                    22528, 47753,\n> +                    24576, 49621,\n> +                    26624, 51253,\n> +                    28672, 52698,\n> +                    30720, 53796,\n> +                    32768, 54876,\n> +                    36864, 57012,\n> +                    40960, 58656,\n> +                    45056, 59954,\n> +                    49152, 61183,\n> +                    53248, 62355,\n> +                    57344, 63419,\n> +                    61440, 64476,\n> +                    65535, 65535\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.ccm\":\n> +            {\n> +                \"ccms\": [\n> +                    {\n> +                        \"ct\": 2213,\n> +                        \"ccm\":\n> +                        [\n> +                            1.91264, -0.27609, -0.63655,\n> +                            -0.65708, 2.11718, -0.46009,\n> +                            0.03629, -1.38441, 2.34811\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 2255,\n> +                        \"ccm\":\n> +                        [\n> +                            1.90369, -0.29309, -0.61059,\n> +                            -0.64693, 2.08169, -0.43476,\n> +                            0.04086, -1.29999, 2.25914\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 2259,\n> +                        \"ccm\":\n> +                        [\n> +                            1.92762, -0.35134, -0.57628,\n> +                            -0.63523, 2.08481, -0.44958,\n> +                            0.06754, -1.32953, 2.26199\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 5313,\n> +                        \"ccm\":\n> +                        [\n> +                            1.75924, -0.54053, -0.21871,\n> +                            -0.38159, 1.88671, -0.50511,\n> +                            -0.00747, -0.53492, 1.54239\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 6237,\n> +                        \"ccm\":\n> +                        [\n> +                            2.19299, -0.74764, -0.44536,\n> +                            -0.51678, 2.27651, -0.75972,\n> +                            -0.06498, -0.74269, 1.80767\n> +                        ]\n> +                    }\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.sharpen\": { }\n> +        }\n> +    ]\n> +}\n> \\ No newline at end of file\n> diff --git a/src/ipa/rpi/vc4/data/meson.build b/src/ipa/rpi/vc4/data/meson.build\n> index afbf875a113a..60477c112196 100644\n> --- a/src/ipa/rpi/vc4/data/meson.build\n> +++ b/src/ipa/rpi/vc4/data/meson.build\n> @@ -3,6 +3,7 @@\n>  conf_files = files([\n>      'imx219.json',\n>      'imx219_noir.json',\n> +    'imx283.json',\n>      'imx290.json',\n>      'imx296.json',\n>      'imx296_mono.json',","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 108D8C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 21:47:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 678B461C48;\n\tTue, 19 Mar 2024 22:47:17 +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 00580616EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Mar 2024 22:47:15 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C92DC7E9;\n\tTue, 19 Mar 2024 22:46:48 +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=\"sdlAdPxQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710884809;\n\tbh=SoWT2O8PA0Ag9JhvOL9o6MFnMzEq0ymdeQZc+QYYKdo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sdlAdPxQaIjjWTzdFKZ+lUy4lzsOmP4r0Mu0Zf0kYDK95vO4bum7QMZJfKCdTCVP3\n\tjBx9oW5BJKekp1qJ2BIZy+wVJE133Znk4YWNjEdN5jB2D1cSV5BiCJ912Dv4cqrFYc\n\tovjjEtTZk/d8tCObuAeEn9WQVUw737iQf9e3Fof0=","Date":"Tue, 19 Mar 2024 23:47:12 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tWill Whang <will@willwhang.com>","Subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","Message-ID":"<20240319214712.GB8501@pendragon.ideasonboard.com>","References":"<20240319151121.561588-1-kieran.bingham@ideasonboard.com>\n\t<20240319151121.561588-3-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240319151121.561588-3-kieran.bingham@ideasonboard.com>","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>"}},{"id":29010,"web_url":"https://patchwork.libcamera.org/comment/29010/","msgid":"<CAEmqJPqA5FHxgLnEwzrC4Skv5_FK+wMAAO+Ef-euzix92UwiZQ@mail.gmail.com>","date":"2024-03-20T08:54:32","subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Will,\n\nThank you for this patch!\n\nOn Tue, 19 Mar 2024 at 15:11, Kieran Bingham\n<kieran.bingham@ideasonboard.com> wrote:\n>\n> From: Will Whang <will@willwhang.com>\n>\n> Add tuning files and camera helpers for the Sony IMX283.\n>\n> Signed-off-by: Will Whang <will@willwhang.com>\n> [Kieran: Fix checkstyle formatting, extend commit message, remove pi5]\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> ---\n> This is a partial cherry-pick from\n> https://github.com/raspberrypi/libcamera/pull/118\n>\n> The Pi5 support has not been included, as Pi5 is not yet upstream.\n> Once Pi5 is submitted, the remaining components from\n> https://github.com/raspberrypi/libcamera/pull/118 for the IMX283 should\n> be submitted on top.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/rpi/cam_helper/cam_helper_imx283.cpp |  73 +++++\n>  src/ipa/rpi/cam_helper/meson.build           |   1 +\n>  src/ipa/rpi/vc4/data/imx283.json             | 320 +++++++++++++++++++\n>  src/ipa/rpi/vc4/data/meson.build             |   1 +\n>  4 files changed, 395 insertions(+)\n>  create mode 100644 src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n>  create mode 100644 src/ipa/rpi/vc4/data/imx283.json\n>\n> diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> new file mode 100644\n> index 000000000000..5674b75466b5\n> --- /dev/null\n> +++ b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> @@ -0,0 +1,73 @@\n> +/* SPDX-License-Identifier: BSD-2-Clause */\n> +/*\n> + * Copyright (C) 2021, Raspberry Pi Ltd\n> + *\n> + * cam_helper_imx283.cpp - camera information for imx283 sensor\n> + */\n> +\n> +#include <assert.h>\n> +\n> +#include \"cam_helper.h\"\n> +#include \"math.h\"\n> +using namespace RPiController;\n> +\n> +class CamHelperImx283 : public CamHelper\n> +{\n> +public:\n> +       CamHelperImx283();\n> +       uint32_t gainCode(double gain) const override;\n> +       double gain(uint32_t gainCode) const override;\n> +       void getDelays(int &exposureDelay, int &gainDelay,\n> +                      int &vblankDelay, int &hblankDelay) const override;\n> +       unsigned int hideFramesModeSwitch() const override;\n> +\n> +private:\n> +       /*\n> +        * Smallest difference between the frame length and integration time,\n> +        * in units of lines.\n> +        */\n> +       static constexpr int frameIntegrationDiff = 4;\n> +};\n> +\n> +/*\n> + * Imx283 doesn't output metadata, so we have to use the \"unicam parser\" which\n> + * works by counting frames.\n> + */\n> +\n> +CamHelperImx283::CamHelperImx283()\n> +       : CamHelper({}, frameIntegrationDiff)\n> +{\n> +}\n> +\n> +uint32_t CamHelperImx283::gainCode(double gain) const\n> +{\n> +       return static_cast<uint32_t>(2048.0 - 2048.0 / gain);\n> +}\n> +\n> +double CamHelperImx283::gain(uint32_t gainCode) const\n> +{\n> +       return static_cast<double>(2048.0 / (2048 - gainCode));\n> +}\n> +\n> +void CamHelperImx283::getDelays(int &exposureDelay, int &gainDelay,\n> +                               int &vblankDelay, int &hblankDelay) const\n> +{\n> +       /* The driver appears to behave as follows: */\n> +       exposureDelay = 2;\n> +       gainDelay = 2;\n> +       vblankDelay = 2;\n> +       hblankDelay = 2;\n> +}\n> +\n> +unsigned int CamHelperImx283::hideFramesModeSwitch() const\n> +{\n> +       /* After a mode switch, we seem to get 1 bad frame. */\n> +       return 1;\n> +}\n> +\n> +static CamHelper *create()\n> +{\n> +       return new CamHelperImx283();\n> +}\n> +\n> +static RegisterCamHelper reg(\"imx283\", &create);\n> diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build\n> index 7262505742f3..1e43f1da29cd 100644\n> --- a/src/ipa/rpi/cam_helper/meson.build\n> +++ b/src/ipa/rpi/cam_helper/meson.build\n> @@ -4,6 +4,7 @@ rpi_ipa_cam_helper_sources = files([\n>      'cam_helper.cpp',\n>      'cam_helper_ov5647.cpp',\n>      'cam_helper_imx219.cpp',\n> +    'cam_helper_imx283.cpp',\n>      'cam_helper_imx290.cpp',\n>      'cam_helper_imx296.cpp',\n>      'cam_helper_imx477.cpp',\n> diff --git a/src/ipa/rpi/vc4/data/imx283.json b/src/ipa/rpi/vc4/data/imx283.json\n> new file mode 100644\n> index 000000000000..20892de19299\n> --- /dev/null\n> +++ b/src/ipa/rpi/vc4/data/imx283.json\n> @@ -0,0 +1,320 @@\n> +{\n> +    \"version\": 2.0,\n> +    \"target\": \"bcm2835\",\n> +    \"algorithms\": [\n> +        {\n> +            \"rpi.black_level\":\n> +            {\n> +                \"black_level\": 3200\n> +            }\n> +        },\n> +        {\n> +            \"rpi.dpc\": { }\n> +        },\n> +        {\n> +            \"rpi.lux\":\n> +            {\n> +                \"reference_shutter_speed\": 2461,\n> +                \"reference_gain\": 1.0,\n> +                \"reference_aperture\": 1.0,\n> +                \"reference_lux\": 1148,\n> +                \"reference_Y\": 13314\n> +            }\n> +        },\n> +        {\n> +            \"rpi.noise\":\n> +            {\n> +                \"reference_constant\": 0,\n> +                \"reference_slope\": 2.204\n> +            }\n> +        },\n> +        {\n> +            \"rpi.geq\":\n> +            {\n> +                \"offset\": 199,\n> +                \"slope\": 0.01947\n> +            }\n> +        },\n> +        {\n> +            \"rpi.sdn\": { }\n> +        },\n> +        {\n> +            \"rpi.awb\":\n> +            {\n> +                \"priors\": [\n> +                    {\n> +                        \"lux\": 0,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 1.0,\n> +                            3000, 0.0,\n> +                            13000, 0.0\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"lux\": 800,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 0.0,\n> +                            6000, 2.0,\n> +                            13000, 2.0\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"lux\": 1500,\n> +                        \"prior\":\n> +                        [\n> +                            2000, 0.0,\n> +                            4000, 1.0,\n> +                            6000, 6.0,\n> +                            6500, 7.0,\n> +                            7000, 1.0,\n> +                            13000, 1.0\n> +                        ]\n> +                    }\n> +                ],\n> +                \"modes\":\n> +                {\n> +                    \"auto\":\n> +                    {\n> +                        \"lo\": 2500,\n> +                        \"hi\": 8000\n> +                    },\n> +                    \"incandescent\":\n> +                    {\n> +                        \"lo\": 2500,\n> +                        \"hi\": 3000\n> +                    },\n> +                    \"tungsten\":\n> +                    {\n> +                        \"lo\": 3000,\n> +                        \"hi\": 3500\n> +                    },\n> +                    \"fluorescent\":\n> +                    {\n> +                        \"lo\": 4000,\n> +                        \"hi\": 4700\n> +                    },\n> +                    \"indoor\":\n> +                    {\n> +                        \"lo\": 3000,\n> +                        \"hi\": 5000\n> +                    },\n> +                    \"daylight\":\n> +                    {\n> +                        \"lo\": 5500,\n> +                        \"hi\": 6500\n> +                    },\n> +                    \"cloudy\":\n> +                    {\n> +                        \"lo\": 7000,\n> +                        \"hi\": 8600\n> +                    }\n> +                },\n> +                \"bayes\": 1,\n> +                \"ct_curve\":\n> +                [\n> +                    2213.0, 0.9607, 0.2593,\n> +                    2255.0, 0.9309, 0.2521,\n> +                    2259.0, 0.9257, 0.2508,\n> +                    5313.0, 0.4822, 0.5909,\n> +                    6237.0, 0.4726, 0.6376\n> +                ],\n\nThis is a quirk of our tuning tool (and we should really fix it), but\nthe CT curve has a range of approx. 2215K - 6235K.  The AWB modes\nabove should really be constrained to this range, or the search could\njump to a bad target and give invalid results.  This only impacts the\n\"cloudy\" awb mode.  Perhaps it's best to leave that out?\n\nNaush\n\n\n> +                \"sensitivity_r\": 1.0,\n> +                \"sensitivity_b\": 1.0,\n> +                \"transverse_pos\": 0.0144,\n> +                \"transverse_neg\": 0.01\n> +            }\n> +        },\n> +        {\n> +            \"rpi.agc\":\n> +            {\n> +                \"metering_modes\":\n> +                {\n> +                    \"centre-weighted\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0\n> +                        ]\n> +                    },\n> +                    \"spot\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n> +                        ]\n> +                    },\n> +                    \"matrix\":\n> +                    {\n> +                        \"weights\":\n> +                        [\n> +                            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n> +                        ]\n> +                    }\n> +                },\n> +                \"exposure_modes\":\n> +                {\n> +                    \"normal\":\n> +                    {\n> +                        \"shutter\": [ 100, 10000, 30000, 60000, 120000 ],\n> +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> +                    },\n> +                    \"short\":\n> +                    {\n> +                        \"shutter\": [ 100, 5000, 10000, 20000, 120000 ],\n> +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> +                    }\n> +                },\n> +                \"constraint_modes\":\n> +                {\n> +                    \"normal\": [\n> +                        {\n> +                            \"bound\": \"LOWER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.5,\n> +                                1000, 0.5\n> +                            ]\n> +                        }\n> +                    ],\n> +                    \"highlight\": [\n> +                        {\n> +                            \"bound\": \"LOWER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.5,\n> +                                1000, 0.5\n> +                            ]\n> +                        },\n> +                        {\n> +                            \"bound\": \"UPPER\",\n> +                            \"q_lo\": 0.98,\n> +                            \"q_hi\": 1.0,\n> +                            \"y_target\":\n> +                            [\n> +                                0, 0.8,\n> +                                1000, 0.8\n> +                            ]\n> +                        }\n> +                    ]\n> +                },\n> +                \"y_target\":\n> +                [\n> +                    0, 0.16,\n> +                    1000, 0.165,\n> +                    10000, 0.17\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.alsc\":\n> +            {\n> +                \"omega\": 1.3,\n> +                \"n_iter\": 100,\n> +                \"luminance_strength\": 0.7\n> +            }\n> +        },\n> +        {\n> +            \"rpi.contrast\":\n> +            {\n> +                \"ce_enable\": 1,\n> +                \"gamma_curve\":\n> +                [\n> +                    0, 0,\n> +                    1024, 5040,\n> +                    2048, 9338,\n> +                    3072, 12356,\n> +                    4096, 15312,\n> +                    5120, 18051,\n> +                    6144, 20790,\n> +                    7168, 23193,\n> +                    8192, 25744,\n> +                    9216, 27942,\n> +                    10240, 30035,\n> +                    11264, 32005,\n> +                    12288, 33975,\n> +                    13312, 35815,\n> +                    14336, 37600,\n> +                    15360, 39168,\n> +                    16384, 40642,\n> +                    18432, 43379,\n> +                    20480, 45749,\n> +                    22528, 47753,\n> +                    24576, 49621,\n> +                    26624, 51253,\n> +                    28672, 52698,\n> +                    30720, 53796,\n> +                    32768, 54876,\n> +                    36864, 57012,\n> +                    40960, 58656,\n> +                    45056, 59954,\n> +                    49152, 61183,\n> +                    53248, 62355,\n> +                    57344, 63419,\n> +                    61440, 64476,\n> +                    65535, 65535\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.ccm\":\n> +            {\n> +                \"ccms\": [\n> +                    {\n> +                        \"ct\": 2213,\n> +                        \"ccm\":\n> +                        [\n> +                            1.91264, -0.27609, -0.63655,\n> +                            -0.65708, 2.11718, -0.46009,\n> +                            0.03629, -1.38441, 2.34811\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 2255,\n> +                        \"ccm\":\n> +                        [\n> +                            1.90369, -0.29309, -0.61059,\n> +                            -0.64693, 2.08169, -0.43476,\n> +                            0.04086, -1.29999, 2.25914\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 2259,\n> +                        \"ccm\":\n> +                        [\n> +                            1.92762, -0.35134, -0.57628,\n> +                            -0.63523, 2.08481, -0.44958,\n> +                            0.06754, -1.32953, 2.26199\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 5313,\n> +                        \"ccm\":\n> +                        [\n> +                            1.75924, -0.54053, -0.21871,\n> +                            -0.38159, 1.88671, -0.50511,\n> +                            -0.00747, -0.53492, 1.54239\n> +                        ]\n> +                    },\n> +                    {\n> +                        \"ct\": 6237,\n> +                        \"ccm\":\n> +                        [\n> +                            2.19299, -0.74764, -0.44536,\n> +                            -0.51678, 2.27651, -0.75972,\n> +                            -0.06498, -0.74269, 1.80767\n> +                        ]\n> +                    }\n> +                ]\n> +            }\n> +        },\n> +        {\n> +            \"rpi.sharpen\": { }\n> +        }\n> +    ]\n> +}\n> \\ No newline at end of file\n> diff --git a/src/ipa/rpi/vc4/data/meson.build b/src/ipa/rpi/vc4/data/meson.build\n> index afbf875a113a..60477c112196 100644\n> --- a/src/ipa/rpi/vc4/data/meson.build\n> +++ b/src/ipa/rpi/vc4/data/meson.build\n> @@ -3,6 +3,7 @@\n>  conf_files = files([\n>      'imx219.json',\n>      'imx219_noir.json',\n> +    'imx283.json',\n>      'imx290.json',\n>      'imx296.json',\n>      'imx296_mono.json',\n> --\n> 2.34.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 98324BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Mar 2024 08:55:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E395262D2D;\n\tWed, 20 Mar 2024 09:55:12 +0100 (CET)","from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com\n\t[IPv6:2607:f8b0:4864:20::112a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 715E361C5B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2024 09:55:09 +0100 (CET)","by mail-yw1-x112a.google.com with SMTP id\n\t00721157ae682-6098a20ab22so59725947b3.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2024 01:55:09 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"iR9NYICp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1710924908; x=1711529708;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=JYfC4lLu5aWiBYxhDE/OoMogq6hxpClcO8X7BVg2y6w=;\n\tb=iR9NYICpAKvWgU0yeTpfUwUs+JU+zAemreXhCQ6eISYlp3eTe4FpzoU2iCZ5geq4rG\n\t4Km2yZvObTIaFfITYkGm/qhCXwUulf7ZDjVQ3UPAwORr0tnC2tKLg5lIGiTDSrqK27Hn\n\tlCO2MFM9Vkuijc7FLBCCt0iG5Bq3fc2eg4L0sVcSSzBX59j+9F8TDJtEL6ZJfKDugIsp\n\tXxvZIxhrAVvwLabLuekrPLMVsWcng22wYs+j5ZQ82D33uHy6TlS4ASEkEt6HaiyfDRBK\n\tXsycla/lZwdV133cjtD32L4OhFwEJGXY4SQiAa4XZCLrRlX80F8tXq48fUboNYVwNNLG\n\tJw0Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1710924908; x=1711529708;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=JYfC4lLu5aWiBYxhDE/OoMogq6hxpClcO8X7BVg2y6w=;\n\tb=xENnhbtXX8xzvVl2Xe78BSmHLL192jn46VDtdcE86UV8AdIN4tP5VNo4AbWzYoFy0r\n\t3PHurM9KoKCDPasuK0bNvcjDhASev87GiD+t7twHPKl9AmFKx0wvCz9hgtQ2YYy91f/y\n\toe51enKinvUCAOcWPs/x2UH1aggeHr6XfPE3vuGvc5l5/hWwnf8NjraV/fUkUS5LIors\n\tFHLmpMAMOUB/35liEvgWQBxVQfwHCOld/89LHJiWUiXycW1f7LA4+/TbdGONrd7FHGhK\n\tS6h6BuzL0n0I1FJdD30uWGgkH3txiDPfvK/6SK43U9HHVlmk51UoeiagwJLOUtYYP+Vq\n\thCHA==","X-Gm-Message-State":"AOJu0Yz07H5jbv+5njarmr0rSwsyrRGmbK3v6g3lnds25bg90UX7egif\n\tPHmNpN8ZaaNvVQ/kAShXKQpT0vVUNro8a3YJW/6YQgRyXW5LHgfTHqMn4XNpAVFH+DJrCE+4YI7\n\tVBvpbIJV3hiprASN++tr89EYaVjVsIlPZUVlnCA==","X-Google-Smtp-Source":"AGHT+IGpVsqpu478Sc8eshNXre7dCNv+TwBKncejrQt26F82QsKN8AWV249sN92WxJLgLZyPfv/8Cmf05GFrme2q/aw=","X-Received":"by 2002:a0d:efc3:0:b0:60d:547:bc38 with SMTP id\n\ty186-20020a0defc3000000b0060d0547bc38mr15318758ywe.0.1710924908204;\n\tWed, 20 Mar 2024 01:55:08 -0700 (PDT)","MIME-Version":"1.0","References":"<20240319151121.561588-1-kieran.bingham@ideasonboard.com>\n\t<20240319151121.561588-3-kieran.bingham@ideasonboard.com>","In-Reply-To":"<20240319151121.561588-3-kieran.bingham@ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 20 Mar 2024 08:54:32 +0000","Message-ID":"<CAEmqJPqA5FHxgLnEwzrC4Skv5_FK+wMAAO+Ef-euzix92UwiZQ@mail.gmail.com>","Subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tWill Whang <will@willwhang.com>","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}},{"id":29017,"web_url":"https://patchwork.libcamera.org/comment/29017/","msgid":"<CAFoNnry0LpbDBa-PLq_Sh58k30Kjsi8eqf8TJxjEQ9Ncxakt+A@mail.gmail.com>","date":"2024-03-20T18:08:56","subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","submitter":{"id":192,"url":"https://patchwork.libcamera.org/api/people/192/","name":"willl will","email":"will@willwhang.com"},"content":"Hi Naushir,\n\nI can update the calibration file later this week with the cloudy weather\ncoming up : D.\nI thought the CT curve can extrapolate over the existing range, but if not\nI can try to covers it.\nThanks,\nWei-Chun\n\nNaushir Patuck <naush@raspberrypi.com> 於 2024年3月20日 週三 上午2:22寫道：\n\n> Hi Will,\n>\n> Thank you for this patch!\n>\n> On Tue, 19 Mar 2024 at 15:11, Kieran Bingham\n> <kieran.bingham@ideasonboard.com> wrote:\n> >\n> > From: Will Whang <will@willwhang.com>\n> >\n> > Add tuning files and camera helpers for the Sony IMX283.\n> >\n> > Signed-off-by: Will Whang <will@willwhang.com>\n> > [Kieran: Fix checkstyle formatting, extend commit message, remove pi5]\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> > ---\n> > This is a partial cherry-pick from\n> > https://github.com/raspberrypi/libcamera/pull/118\n> >\n> > The Pi5 support has not been included, as Pi5 is not yet upstream.\n> > Once Pi5 is submitted, the remaining components from\n> > https://github.com/raspberrypi/libcamera/pull/118 for the IMX283 should\n> > be submitted on top.\n> >\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  src/ipa/rpi/cam_helper/cam_helper_imx283.cpp |  73 +++++\n> >  src/ipa/rpi/cam_helper/meson.build           |   1 +\n> >  src/ipa/rpi/vc4/data/imx283.json             | 320 +++++++++++++++++++\n> >  src/ipa/rpi/vc4/data/meson.build             |   1 +\n> >  4 files changed, 395 insertions(+)\n> >  create mode 100644 src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> >  create mode 100644 src/ipa/rpi/vc4/data/imx283.json\n> >\n> > diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> > new file mode 100644\n> > index 000000000000..5674b75466b5\n> > --- /dev/null\n> > +++ b/src/ipa/rpi/cam_helper/cam_helper_imx283.cpp\n> > @@ -0,0 +1,73 @@\n> > +/* SPDX-License-Identifier: BSD-2-Clause */\n> > +/*\n> > + * Copyright (C) 2021, Raspberry Pi Ltd\n> > + *\n> > + * cam_helper_imx283.cpp - camera information for imx283 sensor\n> > + */\n> > +\n> > +#include <assert.h>\n> > +\n> > +#include \"cam_helper.h\"\n> > +#include \"math.h\"\n> > +using namespace RPiController;\n> > +\n> > +class CamHelperImx283 : public CamHelper\n> > +{\n> > +public:\n> > +       CamHelperImx283();\n> > +       uint32_t gainCode(double gain) const override;\n> > +       double gain(uint32_t gainCode) const override;\n> > +       void getDelays(int &exposureDelay, int &gainDelay,\n> > +                      int &vblankDelay, int &hblankDelay) const\n> override;\n> > +       unsigned int hideFramesModeSwitch() const override;\n> > +\n> > +private:\n> > +       /*\n> > +        * Smallest difference between the frame length and integration\n> time,\n> > +        * in units of lines.\n> > +        */\n> > +       static constexpr int frameIntegrationDiff = 4;\n> > +};\n> > +\n> > +/*\n> > + * Imx283 doesn't output metadata, so we have to use the \"unicam\n> parser\" which\n> > + * works by counting frames.\n> > + */\n> > +\n> > +CamHelperImx283::CamHelperImx283()\n> > +       : CamHelper({}, frameIntegrationDiff)\n> > +{\n> > +}\n> > +\n> > +uint32_t CamHelperImx283::gainCode(double gain) const\n> > +{\n> > +       return static_cast<uint32_t>(2048.0 - 2048.0 / gain);\n> > +}\n> > +\n> > +double CamHelperImx283::gain(uint32_t gainCode) const\n> > +{\n> > +       return static_cast<double>(2048.0 / (2048 - gainCode));\n> > +}\n> > +\n> > +void CamHelperImx283::getDelays(int &exposureDelay, int &gainDelay,\n> > +                               int &vblankDelay, int &hblankDelay) const\n> > +{\n> > +       /* The driver appears to behave as follows: */\n> > +       exposureDelay = 2;\n> > +       gainDelay = 2;\n> > +       vblankDelay = 2;\n> > +       hblankDelay = 2;\n> > +}\n> > +\n> > +unsigned int CamHelperImx283::hideFramesModeSwitch() const\n> > +{\n> > +       /* After a mode switch, we seem to get 1 bad frame. */\n> > +       return 1;\n> > +}\n> > +\n> > +static CamHelper *create()\n> > +{\n> > +       return new CamHelperImx283();\n> > +}\n> > +\n> > +static RegisterCamHelper reg(\"imx283\", &create);\n> > diff --git a/src/ipa/rpi/cam_helper/meson.build\n> b/src/ipa/rpi/cam_helper/meson.build\n> > index 7262505742f3..1e43f1da29cd 100644\n> > --- a/src/ipa/rpi/cam_helper/meson.build\n> > +++ b/src/ipa/rpi/cam_helper/meson.build\n> > @@ -4,6 +4,7 @@ rpi_ipa_cam_helper_sources = files([\n> >      'cam_helper.cpp',\n> >      'cam_helper_ov5647.cpp',\n> >      'cam_helper_imx219.cpp',\n> > +    'cam_helper_imx283.cpp',\n> >      'cam_helper_imx290.cpp',\n> >      'cam_helper_imx296.cpp',\n> >      'cam_helper_imx477.cpp',\n> > diff --git a/src/ipa/rpi/vc4/data/imx283.json\n> b/src/ipa/rpi/vc4/data/imx283.json\n> > new file mode 100644\n> > index 000000000000..20892de19299\n> > --- /dev/null\n> > +++ b/src/ipa/rpi/vc4/data/imx283.json\n> > @@ -0,0 +1,320 @@\n> > +{\n> > +    \"version\": 2.0,\n> > +    \"target\": \"bcm2835\",\n> > +    \"algorithms\": [\n> > +        {\n> > +            \"rpi.black_level\":\n> > +            {\n> > +                \"black_level\": 3200\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.dpc\": { }\n> > +        },\n> > +        {\n> > +            \"rpi.lux\":\n> > +            {\n> > +                \"reference_shutter_speed\": 2461,\n> > +                \"reference_gain\": 1.0,\n> > +                \"reference_aperture\": 1.0,\n> > +                \"reference_lux\": 1148,\n> > +                \"reference_Y\": 13314\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.noise\":\n> > +            {\n> > +                \"reference_constant\": 0,\n> > +                \"reference_slope\": 2.204\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.geq\":\n> > +            {\n> > +                \"offset\": 199,\n> > +                \"slope\": 0.01947\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.sdn\": { }\n> > +        },\n> > +        {\n> > +            \"rpi.awb\":\n> > +            {\n> > +                \"priors\": [\n> > +                    {\n> > +                        \"lux\": 0,\n> > +                        \"prior\":\n> > +                        [\n> > +                            2000, 1.0,\n> > +                            3000, 0.0,\n> > +                            13000, 0.0\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"lux\": 800,\n> > +                        \"prior\":\n> > +                        [\n> > +                            2000, 0.0,\n> > +                            6000, 2.0,\n> > +                            13000, 2.0\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"lux\": 1500,\n> > +                        \"prior\":\n> > +                        [\n> > +                            2000, 0.0,\n> > +                            4000, 1.0,\n> > +                            6000, 6.0,\n> > +                            6500, 7.0,\n> > +                            7000, 1.0,\n> > +                            13000, 1.0\n> > +                        ]\n> > +                    }\n> > +                ],\n> > +                \"modes\":\n> > +                {\n> > +                    \"auto\":\n> > +                    {\n> > +                        \"lo\": 2500,\n> > +                        \"hi\": 8000\n> > +                    },\n> > +                    \"incandescent\":\n> > +                    {\n> > +                        \"lo\": 2500,\n> > +                        \"hi\": 3000\n> > +                    },\n> > +                    \"tungsten\":\n> > +                    {\n> > +                        \"lo\": 3000,\n> > +                        \"hi\": 3500\n> > +                    },\n> > +                    \"fluorescent\":\n> > +                    {\n> > +                        \"lo\": 4000,\n> > +                        \"hi\": 4700\n> > +                    },\n> > +                    \"indoor\":\n> > +                    {\n> > +                        \"lo\": 3000,\n> > +                        \"hi\": 5000\n> > +                    },\n> > +                    \"daylight\":\n> > +                    {\n> > +                        \"lo\": 5500,\n> > +                        \"hi\": 6500\n> > +                    },\n> > +                    \"cloudy\":\n> > +                    {\n> > +                        \"lo\": 7000,\n> > +                        \"hi\": 8600\n> > +                    }\n> > +                },\n> > +                \"bayes\": 1,\n> > +                \"ct_curve\":\n> > +                [\n> > +                    2213.0, 0.9607, 0.2593,\n> > +                    2255.0, 0.9309, 0.2521,\n> > +                    2259.0, 0.9257, 0.2508,\n> > +                    5313.0, 0.4822, 0.5909,\n> > +                    6237.0, 0.4726, 0.6376\n> > +                ],\n>\n> This is a quirk of our tuning tool (and we should really fix it), but\n> the CT curve has a range of approx. 2215K - 6235K.  The AWB modes\n> above should really be constrained to this range, or the search could\n> jump to a bad target and give invalid results.  This only impacts the\n> \"cloudy\" awb mode.  Perhaps it's best to leave that out?\n>\n> Naush\n>\n>\n> > +                \"sensitivity_r\": 1.0,\n> > +                \"sensitivity_b\": 1.0,\n> > +                \"transverse_pos\": 0.0144,\n> > +                \"transverse_neg\": 0.01\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.agc\":\n> > +            {\n> > +                \"metering_modes\":\n> > +                {\n> > +                    \"centre-weighted\":\n> > +                    {\n> > +                        \"weights\":\n> > +                        [\n> > +                            3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0\n> > +                        ]\n> > +                    },\n> > +                    \"spot\":\n> > +                    {\n> > +                        \"weights\":\n> > +                        [\n> > +                            2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n> > +                        ]\n> > +                    },\n> > +                    \"matrix\":\n> > +                    {\n> > +                        \"weights\":\n> > +                        [\n> > +                            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n> > +                        ]\n> > +                    }\n> > +                },\n> > +                \"exposure_modes\":\n> > +                {\n> > +                    \"normal\":\n> > +                    {\n> > +                        \"shutter\": [ 100, 10000, 30000, 60000, 120000 ],\n> > +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> > +                    },\n> > +                    \"short\":\n> > +                    {\n> > +                        \"shutter\": [ 100, 5000, 10000, 20000, 120000 ],\n> > +                        \"gain\": [ 1.0, 2.0, 4.0, 6.0, 6.0 ]\n> > +                    }\n> > +                },\n> > +                \"constraint_modes\":\n> > +                {\n> > +                    \"normal\": [\n> > +                        {\n> > +                            \"bound\": \"LOWER\",\n> > +                            \"q_lo\": 0.98,\n> > +                            \"q_hi\": 1.0,\n> > +                            \"y_target\":\n> > +                            [\n> > +                                0, 0.5,\n> > +                                1000, 0.5\n> > +                            ]\n> > +                        }\n> > +                    ],\n> > +                    \"highlight\": [\n> > +                        {\n> > +                            \"bound\": \"LOWER\",\n> > +                            \"q_lo\": 0.98,\n> > +                            \"q_hi\": 1.0,\n> > +                            \"y_target\":\n> > +                            [\n> > +                                0, 0.5,\n> > +                                1000, 0.5\n> > +                            ]\n> > +                        },\n> > +                        {\n> > +                            \"bound\": \"UPPER\",\n> > +                            \"q_lo\": 0.98,\n> > +                            \"q_hi\": 1.0,\n> > +                            \"y_target\":\n> > +                            [\n> > +                                0, 0.8,\n> > +                                1000, 0.8\n> > +                            ]\n> > +                        }\n> > +                    ]\n> > +                },\n> > +                \"y_target\":\n> > +                [\n> > +                    0, 0.16,\n> > +                    1000, 0.165,\n> > +                    10000, 0.17\n> > +                ]\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.alsc\":\n> > +            {\n> > +                \"omega\": 1.3,\n> > +                \"n_iter\": 100,\n> > +                \"luminance_strength\": 0.7\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.contrast\":\n> > +            {\n> > +                \"ce_enable\": 1,\n> > +                \"gamma_curve\":\n> > +                [\n> > +                    0, 0,\n> > +                    1024, 5040,\n> > +                    2048, 9338,\n> > +                    3072, 12356,\n> > +                    4096, 15312,\n> > +                    5120, 18051,\n> > +                    6144, 20790,\n> > +                    7168, 23193,\n> > +                    8192, 25744,\n> > +                    9216, 27942,\n> > +                    10240, 30035,\n> > +                    11264, 32005,\n> > +                    12288, 33975,\n> > +                    13312, 35815,\n> > +                    14336, 37600,\n> > +                    15360, 39168,\n> > +                    16384, 40642,\n> > +                    18432, 43379,\n> > +                    20480, 45749,\n> > +                    22528, 47753,\n> > +                    24576, 49621,\n> > +                    26624, 51253,\n> > +                    28672, 52698,\n> > +                    30720, 53796,\n> > +                    32768, 54876,\n> > +                    36864, 57012,\n> > +                    40960, 58656,\n> > +                    45056, 59954,\n> > +                    49152, 61183,\n> > +                    53248, 62355,\n> > +                    57344, 63419,\n> > +                    61440, 64476,\n> > +                    65535, 65535\n> > +                ]\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.ccm\":\n> > +            {\n> > +                \"ccms\": [\n> > +                    {\n> > +                        \"ct\": 2213,\n> > +                        \"ccm\":\n> > +                        [\n> > +                            1.91264, -0.27609, -0.63655,\n> > +                            -0.65708, 2.11718, -0.46009,\n> > +                            0.03629, -1.38441, 2.34811\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"ct\": 2255,\n> > +                        \"ccm\":\n> > +                        [\n> > +                            1.90369, -0.29309, -0.61059,\n> > +                            -0.64693, 2.08169, -0.43476,\n> > +                            0.04086, -1.29999, 2.25914\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"ct\": 2259,\n> > +                        \"ccm\":\n> > +                        [\n> > +                            1.92762, -0.35134, -0.57628,\n> > +                            -0.63523, 2.08481, -0.44958,\n> > +                            0.06754, -1.32953, 2.26199\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"ct\": 5313,\n> > +                        \"ccm\":\n> > +                        [\n> > +                            1.75924, -0.54053, -0.21871,\n> > +                            -0.38159, 1.88671, -0.50511,\n> > +                            -0.00747, -0.53492, 1.54239\n> > +                        ]\n> > +                    },\n> > +                    {\n> > +                        \"ct\": 6237,\n> > +                        \"ccm\":\n> > +                        [\n> > +                            2.19299, -0.74764, -0.44536,\n> > +                            -0.51678, 2.27651, -0.75972,\n> > +                            -0.06498, -0.74269, 1.80767\n> > +                        ]\n> > +                    }\n> > +                ]\n> > +            }\n> > +        },\n> > +        {\n> > +            \"rpi.sharpen\": { }\n> > +        }\n> > +    ]\n> > +}\n> > \\ No newline at end of file\n> > diff --git a/src/ipa/rpi/vc4/data/meson.build\n> b/src/ipa/rpi/vc4/data/meson.build\n> > index afbf875a113a..60477c112196 100644\n> > --- a/src/ipa/rpi/vc4/data/meson.build\n> > +++ b/src/ipa/rpi/vc4/data/meson.build\n> > @@ -3,6 +3,7 @@\n> >  conf_files = files([\n> >      'imx219.json',\n> >      'imx219_noir.json',\n> > +    'imx283.json',\n> >      'imx290.json',\n> >      'imx296.json',\n> >      'imx296_mono.json',\n> > --\n> > 2.34.1\n> >\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 72E6EC3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Mar 2024 20:50:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A33D363055;\n\tWed, 20 Mar 2024 21:50:25 +0100 (CET)","from mail-lf1-f49.google.com (mail-lf1-f49.google.com\n\t[209.85.167.49])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 682A462834\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2024 19:09:09 +0100 (CET)","by mail-lf1-f49.google.com with SMTP id\n\t2adb3069b0e04-513d23be0b6so228667e87.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2024 11:09:09 -0700 (PDT)","from mail-lf1-f49.google.com (mail-lf1-f49.google.com.\n\t[209.85.167.49]) by smtp.gmail.com with ESMTPSA id\n\tbe10-20020a056512250a00b00514b627aab4sm768176lfb.63.2024.03.20.11.09.07\n\tfor <libcamera-devel@lists.libcamera.org>\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 20 Mar 2024 11:09:07 -0700 (PDT)","by mail-lf1-f49.google.com with SMTP id\n\t2adb3069b0e04-513d4559fb4so200369e87.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2024 11:09:07 -0700 (PDT)"],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1710958148; x=1711562948;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=VErnDJ3BF6vrU95N2CgXFCU51x0ziSz8PCBRvfHiM+Q=;\n\tb=v0NOQFmNlEhb+w93ZIzc1i7l3g9vHXuhi0mW/A7hXVDFw0k2T7rrwLZo3+yNiYLSfP\n\tLtysm4BHfjAKS6UGkagD1nMR9UjlJR1NTSfA/KLLeODQT5p0k67+39dWgzkXIMmWLmuQ\n\t+QS4pKr1YtEu0jU43IAJib93VsJFDfTZ3xc1Z9Vl3KCX9yOkYUmJseL8nkgcDb566etz\n\t4KtjSNlI97iME62e4Fz4Y80d9g+BpnGq7ysJf0XJZQL3QZm+HH2c04l2xBIVtrrUhH6z\n\t0+L3ytTuRDtUtquznfm2eNBYFgAG5xHuYGbr87SrInzHWSou3SVZSYQiuWgKv2FiRAHT\n\tWoPQ==","X-Forwarded-Encrypted":["i=1;\n\tAJvYcCWJcU1Nj/7BCr4n+6T/axESMoYUZZwLhpmQNBP10zMY8JX+4rJj9+tNn9TcnWz3LKe2Q/YFbZmHcq07wmsC6wy1UG3XIfAdY+s0qeqBrCrZqF9/0g==","i=1;\n\tAJvYcCWzt9zo9Jfmcm5MTLEkYn9oEFCYRUwad525F5bMfPBiWnIqIiuIfwi//Ls5kVdjKJU7V6iaACN/yKYoRnSNmrSZyhqted9I2OWlqRpkhZ3yM0U1OA=="],"X-Gm-Message-State":"AOJu0Yyii8i9a1SOPfvTtRSjlmcHIGD5j2gGiw811m72K3ELKlY3FPTP\n\tNrGBvchMGBYJOm5EypVXc8kLQQz6qdAeSa3jBZKCSjW5YJan2+8JqBPD/4iypg8a7w==","X-Google-Smtp-Source":"AGHT+IHOiwZKzHrdblVjkFnv+UpXHOr4vUgSUx9thpXOP4dZ2+1z29hAdzhJnY7/RDQVF6FA0BF08Q==","X-Received":["by 2002:ac2:5b46:0:b0:513:ca65:8c58 with SMTP id\n\ti6-20020ac25b46000000b00513ca658c58mr2224133lfp.43.1710958147967; \n\tWed, 20 Mar 2024 11:09:07 -0700 (PDT)","by 2002:a05:6512:20d0:b0:513:c54d:d4a with SMTP id\n\tu16-20020a05651220d000b00513c54d0d4amr1909768lfr.5.1710958147425;\n\tWed, 20 Mar 2024 11:09:07 -0700 (PDT)"],"MIME-Version":"1.0","References":"<20240319151121.561588-1-kieran.bingham@ideasonboard.com>\n\t<20240319151121.561588-3-kieran.bingham@ideasonboard.com>\n\t<CAEmqJPqA5FHxgLnEwzrC4Skv5_FK+wMAAO+Ef-euzix92UwiZQ@mail.gmail.com>","In-Reply-To":"<CAEmqJPqA5FHxgLnEwzrC4Skv5_FK+wMAAO+Ef-euzix92UwiZQ@mail.gmail.com>","From":"willl will <will@willwhang.com>","Date":"Wed, 20 Mar 2024 11:08:56 -0700","X-Gmail-Original-Message-ID":"<CAFoNnry0LpbDBa-PLq_Sh58k30Kjsi8eqf8TJxjEQ9Ncxakt+A@mail.gmail.com>","Message-ID":"<CAFoNnry0LpbDBa-PLq_Sh58k30Kjsi8eqf8TJxjEQ9Ncxakt+A@mail.gmail.com>","Subject":"Re: [PATCH 2/2] ipa: rpi: Add IMX283 support","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>, \n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"multipart/alternative; boundary=\"0000000000009a67ba06141b7ca1\"","X-Mailman-Approved-At":"Wed, 20 Mar 2024 21:50:23 +0100","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>"}}]