[{"id":20333,"web_url":"https://patchwork.libcamera.org/comment/20333/","msgid":"<CAEmqJPr121+4NDgXBUbQD_HTyVBC4mMpNzKT2_-0wMuqLQEYbQ@mail.gmail.com>","date":"2021-10-20T13:47:10","subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Lee and David,\n\nThank you for your work.\n\nOn Wed, 20 Oct 2021 at 14:23, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> From: Arducam info <info@arducam.com>\n>\n> The necessary tuning file and CamHelper is added for the imx519 sensor.\n>\n> The imx519 is a 16MP rolling shutter sensor. To enable\n> it, please add\n>\n> dtoverlay=imx519\n>\n> to the /boot/config.txt file and reboot the Pi.\n>\n> Signed-off-by: Lee Jackson <info@arducam.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n>\n> ---\n>  src/ipa/raspberrypi/cam_helper_imx519.cpp | 185 ++++++++++++\n>  src/ipa/raspberrypi/data/imx519.json      | 338 ++++++++++++++++++++++\n>  src/ipa/raspberrypi/data/meson.build      |   1 +\n>  src/ipa/raspberrypi/meson.build           |   1 +\n>  4 files changed, 525 insertions(+)\n>  create mode 100644 src/ipa/raspberrypi/cam_helper_imx519.cpp\n>  create mode 100644 src/ipa/raspberrypi/data/imx519.json\n>\n> diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> new file mode 100644\n> index 00000000..eaf24982\n> --- /dev/null\n> +++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> @@ -0,0 +1,185 @@\n> +/* SPDX-License-Identifier: BSD-2-Clause */\n> +/*\n> + * Based on cam_helper_imx477.cpp\n> + * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n> + *\n> + * cam_helper_imx519.cpp - camera helper for imx519 sensor\n> + * Copyright (C) 2021, Arducam Technology co., Ltd.\n> + */\n> +\n> +#include <assert.h>\n> +#include <cmath>\n> +#include <stddef.h>\n> +#include <stdio.h>\n> +#include <stdlib.h>\n> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include \"cam_helper.hpp\"\n> +#include \"md_parser.hpp\"\n> +\n> +using namespace RPiController;\n> +using namespace libcamera;\n> +using libcamera::utils::Duration;\n> +\n> +namespace libcamera {\n> +LOG_DECLARE_CATEGORY(IPARPI)\n> +}\n> +\n> +/*\n> + * We care about two gain registers and a pair of exposure registers.\n> Their\n> + * I2C addresses from the Sony IMX519 datasheet:\n> + */\n> +constexpr uint32_t expHiReg = 0x0202;\n> +constexpr uint32_t expLoReg = 0x0203;\n> +constexpr uint32_t gainHiReg = 0x0204;\n> +constexpr uint32_t gainLoReg = 0x0205;\n> +constexpr uint32_t frameLengthHiReg = 0x0340;\n> +constexpr uint32_t frameLengthLoReg = 0x0341;\n> +constexpr std::initializer_list<uint32_t> registerList =\n> +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg,\n> frameLengthLoReg  };\n> +\n> +class CamHelperImx519 : public CamHelper\n> +{\n> +public:\n> +       CamHelperImx519();\n> +       uint32_t GainCode(double gain) const override;\n> +       double Gain(uint32_t gain_code) const override;\n> +       void Prepare(libcamera::Span<const uint8_t> buffer, Metadata\n> &metadata) override;\n> +       uint32_t GetVBlanking(Duration &exposure, Duration\n> minFrameDuration,\n> +                             Duration maxFrameDuration) const override;\n> +       void GetDelays(int &exposure_delay, int &gain_delay,\n> +                      int &vblank_delay) const override;\n> +       bool SensorEmbeddedDataPresent() 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 = 32;\n> +       /* Maximum frame length allowable for long exposure calculations.\n> */\n> +       static constexpr int frameLengthMax = 0xffdc;\n> +       /* Largest long exposure scale factor given as a left shift on the\n> frame length. */\n> +       static constexpr int longExposureShiftMax = 7;\n> +\n> +       void PopulateMetadata(const MdParser::RegisterMap &registers,\n> +                             Metadata &metadata) const override;\n> +};\n> +\n> +CamHelperImx519::CamHelperImx519()\n> +       : CamHelper(std::make_unique<MdParserSmia>(registerList),\n> frameIntegrationDiff)\n> +{\n> +}\n> +\n> +uint32_t CamHelperImx519::GainCode(double gain) const\n> +{\n> +       return static_cast<uint32_t>(1024 - 1024 / gain);\n> +}\n> +\n> +double CamHelperImx519::Gain(uint32_t gain_code) const\n> +{\n> +       return 1024.0 / (1024 - gain_code);\n> +}\n> +\n> +void CamHelperImx519::Prepare(libcamera::Span<const uint8_t> buffer,\n> Metadata &metadata)\n> +{\n> +       MdParser::RegisterMap registers;\n> +       DeviceStatus deviceStatus;\n> +\n> +       if (metadata.Get(\"device.status\", deviceStatus)) {\n> +               LOG(IPARPI, Error) << \"DeviceStatus not found from\n> DelayedControls\";\n> +               return;\n> +       }\n> +\n> +       parseEmbeddedData(buffer, metadata);\n> +\n> +       /*\n> +        * The DeviceStatus struct is first populated with values obtained\n> from\n> +        * DelayedControls. If this reports frame length is >\n> frameLengthMax,\n> +        * it means we are using a long exposure mode. Since the long\n> exposure\n> +        * scale factor is not returned back through embedded data, we\n> must rely\n> +        * on the existing exposure lines and frame length values returned\n> by\n> +        * DelayedControls.\n> +        *\n> +        * Otherwise, all values are updated with what is reported in the\n> +        * embedded data.\n> +        */\n> +       if (deviceStatus.frame_length > frameLengthMax) {\n> +               DeviceStatus parsedDeviceStatus;\n> +\n> +               metadata.Get(\"device.status\", parsedDeviceStatus);\n> +               parsedDeviceStatus.shutter_speed =\n> deviceStatus.shutter_speed;\n> +               parsedDeviceStatus.frame_length =\n> deviceStatus.frame_length;\n> +               metadata.Set(\"device.status\", parsedDeviceStatus);\n> +\n> +               LOG(IPARPI, Debug) << \"Metadata updated for long exposure:\n> \"\n> +                                  << parsedDeviceStatus;\n> +       }\n> +}\n> +\n> +uint32_t CamHelperImx519::GetVBlanking(Duration &exposure,\n> +                                      Duration minFrameDuration,\n> +                                      Duration maxFrameDuration) const\n> +{\n> +       uint32_t frameLength, exposureLines;\n> +       unsigned int shift = 0;\n> +\n> +       frameLength = mode_.height + CamHelper::GetVBlanking(exposure,\n> minFrameDuration,\n> +\n> maxFrameDuration);\n> +       /*\n> +        * Check if the frame length calculated needs to be setup for long\n> +        * exposure mode. This will require us to use a long exposure scale\n> +        * factor provided by a shift operation in the sensor.\n> +        */\n> +       while (frameLength > frameLengthMax) {\n> +               if (++shift > longExposureShiftMax) {\n> +                       shift = longExposureShiftMax;\n> +                       frameLength = frameLengthMax;\n> +                       break;\n> +               }\n> +               frameLength >>= 1;\n> +       }\n> +\n> +       if (shift) {\n> +               /* Account for any rounding in the scaled frame length\n> value. */\n> +               frameLength <<= shift;\n> +               exposureLines = ExposureLines(exposure);\n> +               exposureLines = std::min(exposureLines, frameLength -\n> frameIntegrationDiff);\n> +               exposure = Exposure(exposureLines);\n> +       }\n> +\n> +       return frameLength - mode_.height;\n> +}\n> +\n> +void CamHelperImx519::GetDelays(int &exposure_delay, int &gain_delay,\n> +                               int &vblank_delay) const\n> +{\n> +       exposure_delay = 2;\n> +       gain_delay = 2;\n> +       vblank_delay = 3;\n> +}\n> +\n> +bool CamHelperImx519::SensorEmbeddedDataPresent() const\n> +{\n> +       return true;\n> +}\n> +\n> +void CamHelperImx519::PopulateMetadata(const MdParser::RegisterMap\n> &registers,\n> +                                      Metadata &metadata) const\n> +{\n> +       DeviceStatus deviceStatus;\n> +\n> +       deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) *\n> 256 + registers.at(expLoReg));\n> +       deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 +\n> registers.at(gainLoReg));\n> +       deviceStatus.frame_length = registers.at(frameLengthHiReg) * 256\n> + registers.at(frameLengthLoReg);\n> +\n> +       metadata.Set(\"device.status\", deviceStatus);\n> +}\n> +\n> +static CamHelper *Create()\n> +{\n> +       return new CamHelperImx519();\n> +}\n> +\n> +static RegisterCamHelper reg(\"imx519\", &Create);\n> diff --git a/src/ipa/raspberrypi/data/imx519.json\n> b/src/ipa/raspberrypi/data/imx519.json\n> new file mode 100644\n> index 00000000..164d0d9d\n> --- /dev/null\n> +++ b/src/ipa/raspberrypi/data/imx519.json\n> @@ -0,0 +1,338 @@\n> +{\n> +    \"rpi.black_level\":\n> +    {\n> +        \"black_level\": 4096\n> +    },\n> +    \"rpi.dpc\":\n> +    {\n> +    },\n> +    \"rpi.lux\":\n> +    {\n> +        \"reference_shutter_speed\": 13841,\n> +        \"reference_gain\": 2.0,\n> +        \"reference_aperture\": 1.0,\n> +        \"reference_lux\": 900,\n> +        \"reference_Y\": 12064\n> +    },\n> +    \"rpi.noise\":\n> +    {\n> +        \"reference_constant\": 0,\n> +        \"reference_slope\": 2.776\n> +    },\n> +    \"rpi.geq\":\n> +    {\n> +        \"offset\": 189,\n> +        \"slope\": 0.01495\n> +    },\n> +    \"rpi.sdn\":\n> +    {\n> +    },\n> +    \"rpi.awb\":\n> +    {\n> +        \"priors\":\n> +        [\n> +            {\n> +                \"lux\": 0, \"prior\":\n> +                [\n> +                    2000, 1.0, 3000, 0.0, 13000, 0.0\n> +                ]\n> +            },\n> +            {\n> +                \"lux\": 800, \"prior\":\n> +                [\n> +                    2000, 0.0, 6000, 2.0, 13000, 2.0\n> +                ]\n> +            },\n> +            {\n> +                \"lux\": 1500, \"prior\":\n> +                [\n> +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000,\n> 1.0, 13000, 1.0\n> +                ]\n> +            }\n> +        ],\n> +        \"modes\":\n> +        {\n> +            \"auto\":\n> +            {\n> +                \"lo\": 2500,\n> +                \"hi\": 7900\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\": 8000\n> +            }\n> +        },\n> +        \"bayes\": 1,\n> +        \"ct_curve\":\n> +        [\n> +            2890.0, 0.7328, 0.3734, 3550.0, 0.6228, 0.4763, 4500.0,\n> 0.5208, 0.5825, 5700.0, 0.4467, 0.6671, 7900.0, 0.3858, 0.7411\n> +        ],\n> +        \"sensitivity_r\": 1.0,\n> +        \"sensitivity_b\": 1.0,\n> +        \"transverse_pos\": 0.02027,\n> +        \"transverse_neg\": 0.01935\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\":\n> +                [\n> +                    100, 10000, 30000, 60000, 120000\n> +                ],\n> +                \"gain\":\n> +                [\n> +                    1.0, 2.0, 4.0, 6.0, 6.0\n> +                ]\n> +            },\n> +            \"short\":\n> +            {\n> +                \"shutter\":\n> +                [\n> +                    100, 5000, 10000, 20000, 120000\n> +                ],\n> +                \"gain\":\n> +                [\n> +                    1.0, 2.0, 4.0, 6.0, 6.0\n> +                ]\n> +            }\n> +        },\n> +        \"constraint_modes\":\n> +        {\n> +            \"normal\":\n> +            [\n> +                {\n> +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> +                    [\n> +                        0, 0.5, 1000, 0.5\n> +                    ]\n> +                }\n> +            ],\n> +            \"highlight\":\n> +            [\n> +                {\n> +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> +                    [\n> +                        0, 0.5, 1000, 0.5\n> +                    ]\n> +                },\n> +                {\n> +                    \"bound\": \"UPPER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> +                    [\n> +                        0, 0.8, 1000, 0.8\n> +                    ]\n> +                }\n> +            ]\n> +        },\n> +        \"y_target\":\n> +        [\n> +            0, 0.16, 1000, 0.165, 10000, 0.17\n> +        ]\n> +    },\n> +    \"rpi.alsc\":\n> +    {\n> +        \"omega\": 1.3,\n> +        \"n_iter\": 100,\n> +        \"luminance_strength\": 0.5,\n> +        \"calibrations_Cr\":\n> +        [\n> +            {\n> +                \"ct\": 3000, \"table\":\n> +                [\n> +                    1.527, 1.521, 1.508, 1.493, 1.476, 1.455, 1.442,\n> 1.441, 1.441, 1.441, 1.448, 1.467, 1.483, 1.494, 1.503, 1.504,\n> +                    1.525, 1.513, 1.496, 1.477, 1.461, 1.434, 1.418,\n> 1.409, 1.409, 1.416, 1.429, 1.449, 1.469, 1.485, 1.495, 1.503,\n> +                    1.517, 1.506, 1.485, 1.461, 1.434, 1.412, 1.388,\n> 1.376, 1.376, 1.386, 1.405, 1.429, 1.449, 1.471, 1.488, 1.495,\n> +                    1.512, 1.496, 1.471, 1.442, 1.412, 1.388, 1.361,\n> 1.344, 1.344, 1.358, 1.384, 1.405, 1.431, 1.456, 1.479, 1.489,\n> +                    1.508, 1.488, 1.458, 1.425, 1.393, 1.361, 1.343,\n> 1.322, 1.321, 1.342, 1.358, 1.385, 1.416, 1.445, 1.471, 1.484,\n> +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322,\n> 1.318, 1.318, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322,\n> 1.313, 1.313, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> +                    1.507, 1.485, 1.455, 1.422, 1.387, 1.355, 1.333,\n> 1.319, 1.321, 1.333, 1.351, 1.381, 1.411, 1.441, 1.467, 1.483,\n> +                    1.508, 1.489, 1.463, 1.432, 1.401, 1.372, 1.355,\n> 1.333, 1.333, 1.351, 1.369, 1.393, 1.422, 1.448, 1.471, 1.484,\n> +                    1.511, 1.494, 1.472, 1.444, 1.416, 1.398, 1.372,\n> 1.361, 1.361, 1.369, 1.393, 1.411, 1.436, 1.458, 1.477, 1.487,\n> +                    1.511, 1.496, 1.478, 1.455, 1.436, 1.416, 1.399,\n> 1.391, 1.391, 1.397, 1.411, 1.429, 1.451, 1.466, 1.479, 1.487,\n> +                    1.511, 1.495, 1.478, 1.462, 1.448, 1.432, 1.419,\n> 1.419, 1.419, 1.419, 1.429, 1.445, 1.459, 1.471, 1.482, 1.487\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 6000, \"table\":\n> +                [\n> +                    2.581, 2.573, 2.558, 2.539, 2.514, 2.487, 2.473,\n> 2.471, 2.471, 2.471, 2.479, 2.499, 2.517, 2.532, 2.543, 2.544,\n> +                    2.575, 2.559, 2.539, 2.521, 2.491, 2.458, 2.435,\n> 2.421, 2.421, 2.429, 2.449, 2.477, 2.499, 2.519, 2.534, 2.543,\n> +                    2.561, 2.549, 2.521, 2.491, 2.457, 2.423, 2.393,\n> 2.375, 2.375, 2.387, 2.412, 2.444, 2.475, 2.499, 2.519, 2.532,\n> +                    2.552, 2.531, 2.498, 2.459, 2.423, 2.391, 2.349,\n> 2.325, 2.325, 2.344, 2.374, 2.412, 2.444, 2.476, 2.505, 2.519,\n> +                    2.543, 2.518, 2.479, 2.435, 2.392, 2.349, 2.324,\n> 2.285, 2.283, 2.313, 2.344, 2.374, 2.417, 2.457, 2.489, 2.506,\n> +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284,\n> 2.277, 2.279, 2.283, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284,\n> 2.267, 2.267, 2.281, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> +                    2.541, 2.512, 2.472, 2.425, 2.381, 2.338, 2.302,\n> 2.278, 2.279, 2.301, 2.324, 2.364, 2.407, 2.447, 2.481, 2.504,\n> +                    2.544, 2.519, 2.483, 2.441, 2.401, 2.363, 2.338,\n> 2.302, 2.302, 2.324, 2.355, 2.385, 2.423, 2.459, 2.488, 2.506,\n> +                    2.549, 2.527, 2.497, 2.463, 2.427, 2.401, 2.363,\n> 2.345, 2.345, 2.355, 2.385, 2.412, 2.444, 2.473, 2.497, 2.509,\n> +                    2.552, 2.532, 2.507, 2.481, 2.459, 2.427, 2.402,\n> 2.389, 2.389, 2.394, 2.412, 2.444, 2.465, 2.481, 2.499, 2.511,\n> +                    2.553, 2.533, 2.508, 2.489, 2.475, 2.454, 2.429,\n> 2.429, 2.429, 2.429, 2.439, 2.463, 2.481, 2.492, 2.504, 2.511\n> +                ]\n> +            }\n> +        ],\n> +        \"calibrations_Cb\":\n> +        [\n> +            {\n> +                \"ct\": 3000, \"table\":\n> +                [\n> +                    3.132, 3.126, 3.116, 3.103, 3.097, 3.091, 3.087,\n> 3.086, 3.088, 3.091, 3.092, 3.102, 3.113, 3.121, 3.141, 3.144,\n> +                    3.149, 3.132, 3.123, 3.108, 3.101, 3.096, 3.091,\n> 3.089, 3.091, 3.092, 3.101, 3.107, 3.116, 3.129, 3.144, 3.153,\n> +                    3.161, 3.149, 3.129, 3.121, 3.108, 3.103, 3.101,\n> 3.101, 3.101, 3.103, 3.107, 3.116, 3.125, 3.134, 3.153, 3.159,\n> +                    3.176, 3.161, 3.144, 3.129, 3.124, 3.121, 3.117,\n> 3.118, 3.118, 3.119, 3.122, 3.125, 3.134, 3.146, 3.159, 3.171,\n> +                    3.183, 3.176, 3.157, 3.144, 3.143, 3.143, 3.139,\n> 3.141, 3.141, 3.141, 3.141, 3.141, 3.146, 3.161, 3.171, 3.179,\n> +                    3.189, 3.183, 3.165, 3.157, 3.156, 3.157, 3.159,\n> 3.163, 3.163, 3.163, 3.163, 3.161, 3.163, 3.169, 3.179, 3.187,\n> +                    3.199, 3.189, 3.171, 3.165, 3.164, 3.167, 3.171,\n> 3.173, 3.173, 3.172, 3.171, 3.169, 3.169, 3.175, 3.187, 3.189,\n> +                    3.206, 3.196, 3.177, 3.171, 3.165, 3.167, 3.171,\n> 3.173, 3.173, 3.172, 3.171, 3.171, 3.173, 3.177, 3.192, 3.194,\n> +                    3.209, 3.197, 3.178, 3.171, 3.164, 3.161, 3.159,\n> 3.161, 3.162, 3.164, 3.167, 3.171, 3.173, 3.181, 3.193, 3.198,\n> +                    3.204, 3.194, 3.176, 3.165, 3.161, 3.156, 3.154,\n> 3.154, 3.159, 3.161, 3.164, 3.168, 3.173, 3.182, 3.198, 3.199,\n> +                    3.199, 3.191, 3.176, 3.169, 3.161, 3.157, 3.153,\n> 3.153, 3.156, 3.161, 3.164, 3.168, 3.173, 3.186, 3.196, 3.199,\n> +                    3.199, 3.188, 3.179, 3.173, 3.165, 3.157, 3.153,\n> 3.154, 3.156, 3.159, 3.167, 3.171, 3.176, 3.185, 3.193, 3.198\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 6000, \"table\":\n> +                [\n> +                    1.579, 1.579, 1.577, 1.574, 1.573, 1.571, 1.571,\n> 1.571, 1.571, 1.569, 1.569, 1.571, 1.572, 1.574, 1.577, 1.578,\n> +                    1.584, 1.579, 1.578, 1.575, 1.573, 1.572, 1.571,\n> 1.572, 1.572, 1.571, 1.571, 1.572, 1.573, 1.576, 1.578, 1.579,\n> +                    1.587, 1.584, 1.579, 1.578, 1.575, 1.573, 1.573,\n> 1.575, 1.575, 1.574, 1.573, 1.574, 1.576, 1.578, 1.581, 1.581,\n> +                    1.591, 1.587, 1.584, 1.579, 1.578, 1.579, 1.579,\n> 1.581, 1.581, 1.581, 1.578, 1.577, 1.578, 1.581, 1.585, 1.586,\n> +                    1.595, 1.591, 1.587, 1.585, 1.585, 1.586, 1.587,\n> 1.587, 1.588, 1.588, 1.585, 1.584, 1.584, 1.586, 1.589, 1.589,\n> +                    1.597, 1.595, 1.591, 1.589, 1.591, 1.593, 1.595,\n> 1.596, 1.597, 1.597, 1.595, 1.594, 1.592, 1.592, 1.593, 1.593,\n> +                    1.601, 1.597, 1.593, 1.592, 1.593, 1.595, 1.598,\n> 1.599, 1.602, 1.601, 1.598, 1.596, 1.595, 1.596, 1.595, 1.595,\n> +                    1.601, 1.599, 1.594, 1.593, 1.593, 1.595, 1.598,\n> 1.599, 1.602, 1.601, 1.598, 1.597, 1.597, 1.597, 1.597, 1.597,\n> +                    1.602, 1.599, 1.594, 1.593, 1.592, 1.593, 1.595,\n> 1.597, 1.597, 1.598, 1.598, 1.597, 1.597, 1.597, 1.598, 1.598,\n> +                    1.599, 1.598, 1.594, 1.592, 1.591, 1.591, 1.592,\n> 1.595, 1.596, 1.597, 1.597, 1.597, 1.597, 1.599, 1.599, 1.599,\n> +                    1.598, 1.596, 1.594, 1.593, 1.592, 1.592, 1.592,\n> 1.594, 1.595, 1.597, 1.597, 1.597, 1.598, 1.599, 1.599, 1.599,\n> +                    1.597, 1.595, 1.594, 1.594, 1.593, 1.592, 1.593,\n> 1.595, 1.595, 1.597, 1.598, 1.598, 1.598, 1.599, 1.599, 1.599\n> +                ]\n> +            }\n> +        ],\n> +        \"luminance_lut\":\n> +        [\n> +            2.887, 2.754, 2.381, 2.105, 1.859, 1.678, 1.625, 1.623,\n> 1.623, 1.624, 1.669, 1.849, 2.092, 2.362, 2.723, 2.838,\n> +            2.754, 2.443, 2.111, 1.905, 1.678, 1.542, 1.455, 1.412,\n> 1.412, 1.452, 1.535, 1.665, 1.893, 2.096, 2.413, 2.723,\n> +            2.443, 2.216, 1.911, 1.678, 1.537, 1.372, 1.288, 1.245,\n> 1.245, 1.283, 1.363, 1.527, 1.665, 1.895, 2.193, 2.413,\n> +            2.318, 2.057, 1.764, 1.541, 1.372, 1.282, 1.159, 1.113,\n> 1.113, 1.151, 1.269, 1.363, 1.527, 1.749, 2.034, 2.278,\n> +            2.259, 1.953, 1.671, 1.452, 1.283, 1.159, 1.107, 1.018,\n> 1.017, 1.097, 1.151, 1.269, 1.437, 1.655, 1.931, 2.222,\n> +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.019, 1.011,\n> 1.005, 1.014, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.016, 1.001,\n> 1.001, 1.007, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> +            2.257, 1.946, 1.666, 1.448, 1.281, 1.153, 1.093, 1.013,\n> 1.008, 1.089, 1.143, 1.269, 1.437, 1.654, 1.934, 2.226,\n> +            2.309, 2.044, 1.756, 1.532, 1.363, 1.259, 1.153, 1.093,\n> 1.093, 1.143, 1.264, 1.354, 1.524, 1.746, 2.035, 2.284,\n> +            2.425, 2.201, 1.896, 1.662, 1.519, 1.363, 1.259, 1.214,\n> 1.214, 1.264, 1.354, 1.519, 1.655, 1.888, 2.191, 2.413,\n> +            2.724, 2.417, 2.091, 1.888, 1.662, 1.519, 1.419, 1.373,\n> 1.373, 1.425, 1.521, 1.655, 1.885, 2.089, 2.409, 2.722,\n> +            2.858, 2.724, 2.356, 2.085, 1.842, 1.658, 1.581, 1.577,\n> 1.577, 1.579, 1.653, 1.838, 2.084, 2.359, 2.722, 2.842\n> +        ],\n> +        \"sigma\": 0.00372,\n> +        \"sigma_Cb\": 0.00244\n> +    },\n> +    \"rpi.contrast\":\n> +    {\n> +        \"ce_enable\": 1,\n> +        \"gamma_curve\":\n> +        [\n> +            0, 0, 1024, 5040, 2048, 9338, 3072, 12356, 4096, 15312, 5120,\n> 18051, 6144, 20790, 7168, 23193,\n> +            8192, 25744, 9216, 27942, 10240, 30035, 11264, 32005, 12288,\n> 33975, 13312, 35815, 14336, 37600, 15360, 39168,\n> +            16384, 40642, 18432, 43379, 20480, 45749, 22528, 47753,\n> 24576, 49621, 26624, 51253, 28672, 52698, 30720, 53796,\n> +            32768, 54876, 36864, 57012, 40960, 58656, 45056, 59954,\n> 49152, 61183, 53248, 62355, 57344, 63419, 61440, 64476,\n> +            65535, 65535\n> +        ]\n> +    },\n> +    \"rpi.ccm\":\n> +    {\n> +        \"ccms\":\n> +        [\n> +            {\n> +                \"ct\": 2890, \"ccm\":\n> +                [\n> +                    1.36754, -0.18448, -0.18306, -0.32356, 1.44826,\n> -0.12471, -0.00412, -0.69936, 1.70348\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 2920, \"ccm\":\n> +                [\n> +                    1.26704, 0.01624, -0.28328, -0.28516, 1.38934,\n> -0.10419, -0.04854, -0.82211, 1.87066\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 3550, \"ccm\":\n> +                [\n> +                    1.42836, -0.27235, -0.15601, -0.28751, 1.41075,\n> -0.12325, -0.01812, -0.54849, 1.56661\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 4500, \"ccm\":\n> +                [\n> +                    1.36328, -0.19569, -0.16759, -0.25254, 1.52248,\n> -0.26994, -0.01575, -0.53155, 1.54729\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 5700, \"ccm\":\n> +                [\n> +                    1.49207, -0.37245, -0.11963, -0.21493, 1.40005,\n> -0.18512, -0.03781, -0.38779, 1.42561\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 7900, \"ccm\":\n> +                [\n> +                    1.34849, -0.05425, -0.29424, -0.22182, 1.77684,\n> -0.55502, -0.07403, -0.55336, 1.62739\n> +                ]\n> +            }\n> +        ]\n> +    },\n> +    \"rpi.sharpen\":\n> +    {\n> +    }\n> +}\n> diff --git a/src/ipa/raspberrypi/data/meson.build\n> b/src/ipa/raspberrypi/data/meson.build\n> index 2def75cb..e84cd099 100644\n> --- a/src/ipa/raspberrypi/data/meson.build\n> +++ b/src/ipa/raspberrypi/data/meson.build\n> @@ -7,6 +7,7 @@ conf_files = files([\n>      'imx378.json',\n>      'imx477.json',\n>      'imx477_noir.json',\n> +    'imx519.json',\n>      'ov5647.json',\n>      'ov5647_noir.json',\n>      'ov9281.json',\n> diff --git a/src/ipa/raspberrypi/meson.build\n> b/src/ipa/raspberrypi/meson.build\n> index 1af31e4a..176055f4 100644\n> --- a/src/ipa/raspberrypi/meson.build\n> +++ b/src/ipa/raspberrypi/meson.build\n> @@ -22,6 +22,7 @@ rpi_ipa_sources = files([\n>      'cam_helper_imx219.cpp',\n>      'cam_helper_imx290.cpp',\n>      'cam_helper_imx477.cpp',\n> +    'cam_helper_imx519.cpp',\n>      'cam_helper_ov9281.cpp',\n>      'controller/controller.cpp',\n>      'controller/histogram.cpp',\n> --\n> 2.20.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 647CFBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Oct 2021 13:47:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AAAAE68F5B;\n\tWed, 20 Oct 2021 15:47:29 +0200 (CEST)","from mail-lf1-x131.google.com (mail-lf1-x131.google.com\n\t[IPv6:2a00:1450:4864:20::131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3277D6023A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Oct 2021 15:47:27 +0200 (CEST)","by mail-lf1-x131.google.com with SMTP id n8so15198855lfk.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Oct 2021 06:47:27 -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=\"Amjk31XS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=E+XYTjlU1smYFzKVe09WQI5PRjv5S3KCz+cOdpRX1w8=;\n\tb=Amjk31XSuGMu8AB5AS6QVE8/nYSN9yj5KmSdngeafRELq9eKvnEn63m6MupTr4OIco\n\t6NDbkDJ7Ec51wedxQyZytlokud9R3dyzgG5/5KIMuAGG7ivLOBt5dRF9Fo/7PYaF2AP9\n\tE0IyUKWIhnh3SFFCWFWrYMcFhjZ6m5IG78x9e+F6SVdOGMIQStjTkSevz8Qfis63SnUd\n\tfJ/uWR98jKE30i0VLdseecizpJQXuFdu0DEEfWfplSyMDGGEeijRbDssQaM5JEVE91PD\n\tBj39NXi6B4tlm/k6vfq9uvO8OSKEpnAHyNuIqCx/YNsvo/c1CfctmtxymdxQfSwiRtk9\n\t91Zg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=E+XYTjlU1smYFzKVe09WQI5PRjv5S3KCz+cOdpRX1w8=;\n\tb=mfTGGFDhIDAGud2YYRArWwGtFHAuZddUoBsvhNx7tIhYGo4aFVV7fgr885ZjPxQ7lC\n\tKKk9H/ji+dL+50rcZxa7KnRsGItR9+cQS6tHZXJ70XMPpu+9RYFmR3tCJDUOSB2PtYnu\n\tiu3wtJvdhdw7i/sV81QsBpYLD4W2h/64rT64ycBbylhdIlBpP9fnFMXPHEbZlM7pC+dK\n\tH1bTeltpjTReJRO3dfM474MRS+CwcsY9LYpxL8zWfUZiCB7xGOckm5GT/NzxT1vsF4vs\n\tyZrhNKv84p8tlIc+gFziCwbqwXTp/u6h5Cmb8RALLZ75jTeXbuRlEJMfEg7ZWyCpMG+Y\n\t8VOA==","X-Gm-Message-State":"AOAM530Hd574CCzD3aoiCy1wD2XFD8H9T2b/nAUmI6PVU9uarL7T+ICX\n\t/473X0U2H7IFY5hthHjPPbZ3bRpkeQWdz7dnMsDnaA==","X-Google-Smtp-Source":"ABdhPJyuaLi0uf1ygTHH5968XSO0Ih56PpH3/kTQxPXySjbphP3Qc2CdXFAvkWjRFhAb2HAr8QjO0irhLS07/hBHjQ8=","X-Received":"by 2002:a05:6512:2241:: with SMTP id\n\ti1mr11979191lfu.611.1634737646224; \n\tWed, 20 Oct 2021 06:47:26 -0700 (PDT)","MIME-Version":"1.0","References":"<20211020132334.2199-1-david.plowman@raspberrypi.com>\n\t<20211020132334.2199-2-david.plowman@raspberrypi.com>","In-Reply-To":"<20211020132334.2199-2-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 20 Oct 2021 14:47:10 +0100","Message-ID":"<CAEmqJPr121+4NDgXBUbQD_HTyVBC4mMpNzKT2_-0wMuqLQEYbQ@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Content-Type":"multipart/alternative; boundary=\"000000000000b4662f05cec904c7\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tArducam info <info@arducam.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20357,"web_url":"https://patchwork.libcamera.org/comment/20357/","msgid":"<163480910079.2663858.14277654487177505675@Monstersaurus>","date":"2021-10-21T09:38:20","subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Lee, David,\n\nQuoting David Plowman (2021-10-20 14:23:34)\n> From: Arducam info <info@arducam.com>\n> \n> The necessary tuning file and CamHelper is added for the imx519 sensor.\n> \n> The imx519 is a 16MP rolling shutter sensor. To enable\n> it, please add\n> \n> dtoverlay=imx519\n> \n\nGreat, I'm glad to see new sensor support progressing.\n\nFor this patch:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nI see the imx519 is integrated into the Raspberry Pi kernel, who will\ntake this forward and post to the linux-media to get it intgrated into\nthe kernel directly?\n\n--\nKieran\n\n> to the /boot/config.txt file and reboot the Pi.\n> \n> Signed-off-by: Lee Jackson <info@arducam.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> \n> ---\n>  src/ipa/raspberrypi/cam_helper_imx519.cpp | 185 ++++++++++++\n>  src/ipa/raspberrypi/data/imx519.json      | 338 ++++++++++++++++++++++\n>  src/ipa/raspberrypi/data/meson.build      |   1 +\n>  src/ipa/raspberrypi/meson.build           |   1 +\n>  4 files changed, 525 insertions(+)\n>  create mode 100644 src/ipa/raspberrypi/cam_helper_imx519.cpp\n>  create mode 100644 src/ipa/raspberrypi/data/imx519.json\n> \n> diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> new file mode 100644\n> index 00000000..eaf24982\n> --- /dev/null\n> +++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> @@ -0,0 +1,185 @@\n> +/* SPDX-License-Identifier: BSD-2-Clause */\n> +/*\n> + * Based on cam_helper_imx477.cpp\n> + * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n> + *\n> + * cam_helper_imx519.cpp - camera helper for imx519 sensor\n> + * Copyright (C) 2021, Arducam Technology co., Ltd.\n> + */\n> +\n> +#include <assert.h>\n> +#include <cmath>\n> +#include <stddef.h>\n> +#include <stdio.h>\n> +#include <stdlib.h>\n> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include \"cam_helper.hpp\"\n> +#include \"md_parser.hpp\"\n> +\n> +using namespace RPiController;\n> +using namespace libcamera;\n> +using libcamera::utils::Duration;\n> +\n> +namespace libcamera {\n> +LOG_DECLARE_CATEGORY(IPARPI)\n> +}\n> +\n> +/*\n> + * We care about two gain registers and a pair of exposure registers. Their\n> + * I2C addresses from the Sony IMX519 datasheet:\n> + */\n> +constexpr uint32_t expHiReg = 0x0202;\n> +constexpr uint32_t expLoReg = 0x0203;\n> +constexpr uint32_t gainHiReg = 0x0204;\n> +constexpr uint32_t gainLoReg = 0x0205;\n> +constexpr uint32_t frameLengthHiReg = 0x0340;\n> +constexpr uint32_t frameLengthLoReg = 0x0341;\n> +constexpr std::initializer_list<uint32_t> registerList =\n> +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n> +\n> +class CamHelperImx519 : public CamHelper\n> +{\n> +public:\n> +       CamHelperImx519();\n> +       uint32_t GainCode(double gain) const override;\n> +       double Gain(uint32_t gain_code) const override;\n> +       void Prepare(libcamera::Span<const uint8_t> buffer, Metadata &metadata) override;\n> +       uint32_t GetVBlanking(Duration &exposure, Duration minFrameDuration,\n> +                             Duration maxFrameDuration) const override;\n> +       void GetDelays(int &exposure_delay, int &gain_delay,\n> +                      int &vblank_delay) const override;\n> +       bool SensorEmbeddedDataPresent() 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 = 32;\n> +       /* Maximum frame length allowable for long exposure calculations. */\n> +       static constexpr int frameLengthMax = 0xffdc;\n> +       /* Largest long exposure scale factor given as a left shift on the frame length. */\n> +       static constexpr int longExposureShiftMax = 7;\n> +\n> +       void PopulateMetadata(const MdParser::RegisterMap &registers,\n> +                             Metadata &metadata) const override;\n> +};\n> +\n> +CamHelperImx519::CamHelperImx519()\n> +       : CamHelper(std::make_unique<MdParserSmia>(registerList), frameIntegrationDiff)\n> +{\n> +}\n> +\n> +uint32_t CamHelperImx519::GainCode(double gain) const\n> +{\n> +       return static_cast<uint32_t>(1024 - 1024 / gain);\n> +}\n> +\n> +double CamHelperImx519::Gain(uint32_t gain_code) const\n> +{\n> +       return 1024.0 / (1024 - gain_code);\n> +}\n> +\n> +void CamHelperImx519::Prepare(libcamera::Span<const uint8_t> buffer, Metadata &metadata)\n> +{\n> +       MdParser::RegisterMap registers;\n> +       DeviceStatus deviceStatus;\n> +\n> +       if (metadata.Get(\"device.status\", deviceStatus)) {\n> +               LOG(IPARPI, Error) << \"DeviceStatus not found from DelayedControls\";\n> +               return;\n> +       }\n> +\n> +       parseEmbeddedData(buffer, metadata);\n> +\n> +       /*\n> +        * The DeviceStatus struct is first populated with values obtained from\n> +        * DelayedControls. If this reports frame length is > frameLengthMax,\n> +        * it means we are using a long exposure mode. Since the long exposure\n> +        * scale factor is not returned back through embedded data, we must rely\n> +        * on the existing exposure lines and frame length values returned by\n> +        * DelayedControls.\n> +        *\n> +        * Otherwise, all values are updated with what is reported in the\n> +        * embedded data.\n> +        */\n> +       if (deviceStatus.frame_length > frameLengthMax) {\n> +               DeviceStatus parsedDeviceStatus;\n> +\n> +               metadata.Get(\"device.status\", parsedDeviceStatus);\n> +               parsedDeviceStatus.shutter_speed = deviceStatus.shutter_speed;\n> +               parsedDeviceStatus.frame_length = deviceStatus.frame_length;\n> +               metadata.Set(\"device.status\", parsedDeviceStatus);\n> +\n> +               LOG(IPARPI, Debug) << \"Metadata updated for long exposure: \"\n> +                                  << parsedDeviceStatus;\n> +       }\n> +}\n> +\n> +uint32_t CamHelperImx519::GetVBlanking(Duration &exposure,\n> +                                      Duration minFrameDuration,\n> +                                      Duration maxFrameDuration) const\n> +{\n> +       uint32_t frameLength, exposureLines;\n> +       unsigned int shift = 0;\n> +\n> +       frameLength = mode_.height + CamHelper::GetVBlanking(exposure, minFrameDuration,\n> +                                                            maxFrameDuration);\n> +       /*\n> +        * Check if the frame length calculated needs to be setup for long\n> +        * exposure mode. This will require us to use a long exposure scale\n> +        * factor provided by a shift operation in the sensor.\n> +        */\n> +       while (frameLength > frameLengthMax) {\n> +               if (++shift > longExposureShiftMax) {\n> +                       shift = longExposureShiftMax;\n> +                       frameLength = frameLengthMax;\n> +                       break;\n> +               }\n> +               frameLength >>= 1;\n> +       }\n> +\n> +       if (shift) {\n> +               /* Account for any rounding in the scaled frame length value. */\n> +               frameLength <<= shift;\n> +               exposureLines = ExposureLines(exposure);\n> +               exposureLines = std::min(exposureLines, frameLength - frameIntegrationDiff);\n> +               exposure = Exposure(exposureLines);\n> +       }\n> +\n> +       return frameLength - mode_.height;\n> +}\n> +\n> +void CamHelperImx519::GetDelays(int &exposure_delay, int &gain_delay,\n> +                               int &vblank_delay) const\n> +{\n> +       exposure_delay = 2;\n> +       gain_delay = 2;\n> +       vblank_delay = 3;\n> +}\n> +\n> +bool CamHelperImx519::SensorEmbeddedDataPresent() const\n> +{\n> +       return true;\n> +}\n> +\n> +void CamHelperImx519::PopulateMetadata(const MdParser::RegisterMap &registers,\n> +                                      Metadata &metadata) const\n> +{\n> +       DeviceStatus deviceStatus;\n> +\n> +       deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n> +       deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n> +       deviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n> +\n> +       metadata.Set(\"device.status\", deviceStatus);\n> +}\n> +\n> +static CamHelper *Create()\n> +{\n> +       return new CamHelperImx519();\n> +}\n> +\n> +static RegisterCamHelper reg(\"imx519\", &Create);\n> diff --git a/src/ipa/raspberrypi/data/imx519.json b/src/ipa/raspberrypi/data/imx519.json\n> new file mode 100644\n> index 00000000..164d0d9d\n> --- /dev/null\n> +++ b/src/ipa/raspberrypi/data/imx519.json\n> @@ -0,0 +1,338 @@\n> +{\n> +    \"rpi.black_level\":\n> +    {\n> +        \"black_level\": 4096\n> +    },\n> +    \"rpi.dpc\":\n> +    {\n> +    },\n> +    \"rpi.lux\":\n> +    {\n> +        \"reference_shutter_speed\": 13841,\n> +        \"reference_gain\": 2.0,\n> +        \"reference_aperture\": 1.0,\n> +        \"reference_lux\": 900,\n> +        \"reference_Y\": 12064\n> +    },\n> +    \"rpi.noise\":\n> +    {\n> +        \"reference_constant\": 0,\n> +        \"reference_slope\": 2.776\n> +    },\n> +    \"rpi.geq\":\n> +    {\n> +        \"offset\": 189,\n> +        \"slope\": 0.01495\n> +    },\n> +    \"rpi.sdn\":\n> +    {\n> +    },\n> +    \"rpi.awb\":\n> +    {\n> +        \"priors\":\n> +        [\n> +            {\n> +                \"lux\": 0, \"prior\":\n> +                [\n> +                    2000, 1.0, 3000, 0.0, 13000, 0.0\n> +                ]\n> +            },\n> +            {\n> +                \"lux\": 800, \"prior\":\n> +                [\n> +                    2000, 0.0, 6000, 2.0, 13000, 2.0\n> +                ]\n> +            },\n> +            {\n> +                \"lux\": 1500, \"prior\":\n> +                [\n> +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0\n> +                ]\n> +            }\n> +        ],\n> +        \"modes\":\n> +        {\n> +            \"auto\":\n> +            {\n> +                \"lo\": 2500,\n> +                \"hi\": 7900\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\": 8000\n> +            }\n> +        },\n> +        \"bayes\": 1,\n> +        \"ct_curve\":\n> +        [\n> +            2890.0, 0.7328, 0.3734, 3550.0, 0.6228, 0.4763, 4500.0, 0.5208, 0.5825, 5700.0, 0.4467, 0.6671, 7900.0, 0.3858, 0.7411\n> +        ],\n> +        \"sensitivity_r\": 1.0,\n> +        \"sensitivity_b\": 1.0,\n> +        \"transverse_pos\": 0.02027,\n> +        \"transverse_neg\": 0.01935\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\":\n> +                [\n> +                    100, 10000, 30000, 60000, 120000\n> +                ],\n> +                \"gain\":\n> +                [\n> +                    1.0, 2.0, 4.0, 6.0, 6.0\n> +                ]\n> +            },\n> +            \"short\":\n> +            {\n> +                \"shutter\":\n> +                [\n> +                    100, 5000, 10000, 20000, 120000\n> +                ],\n> +                \"gain\":\n> +                [\n> +                    1.0, 2.0, 4.0, 6.0, 6.0\n> +                ]\n> +            }\n> +        },\n> +        \"constraint_modes\":\n> +        {\n> +            \"normal\":\n> +            [\n> +                {\n> +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> +                    [\n> +                        0, 0.5, 1000, 0.5\n> +                    ]\n> +                }\n> +            ],\n> +            \"highlight\":\n> +            [\n> +                {\n> +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> +                    [\n> +                        0, 0.5, 1000, 0.5\n> +                    ]\n> +                },\n> +                {\n> +                    \"bound\": \"UPPER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> +                    [\n> +                        0, 0.8, 1000, 0.8\n> +                    ]\n> +                }\n> +            ]\n> +        },\n> +        \"y_target\":\n> +        [\n> +            0, 0.16, 1000, 0.165, 10000, 0.17\n> +        ]\n> +    },\n> +    \"rpi.alsc\":\n> +    {\n> +        \"omega\": 1.3,\n> +        \"n_iter\": 100,\n> +        \"luminance_strength\": 0.5,\n> +        \"calibrations_Cr\":\n> +        [\n> +            {\n> +                \"ct\": 3000, \"table\":\n> +                [\n> +                    1.527, 1.521, 1.508, 1.493, 1.476, 1.455, 1.442, 1.441, 1.441, 1.441, 1.448, 1.467, 1.483, 1.494, 1.503, 1.504,\n> +                    1.525, 1.513, 1.496, 1.477, 1.461, 1.434, 1.418, 1.409, 1.409, 1.416, 1.429, 1.449, 1.469, 1.485, 1.495, 1.503,\n> +                    1.517, 1.506, 1.485, 1.461, 1.434, 1.412, 1.388, 1.376, 1.376, 1.386, 1.405, 1.429, 1.449, 1.471, 1.488, 1.495,\n> +                    1.512, 1.496, 1.471, 1.442, 1.412, 1.388, 1.361, 1.344, 1.344, 1.358, 1.384, 1.405, 1.431, 1.456, 1.479, 1.489,\n> +                    1.508, 1.488, 1.458, 1.425, 1.393, 1.361, 1.343, 1.322, 1.321, 1.342, 1.358, 1.385, 1.416, 1.445, 1.471, 1.484,\n> +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.318, 1.318, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.313, 1.313, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> +                    1.507, 1.485, 1.455, 1.422, 1.387, 1.355, 1.333, 1.319, 1.321, 1.333, 1.351, 1.381, 1.411, 1.441, 1.467, 1.483,\n> +                    1.508, 1.489, 1.463, 1.432, 1.401, 1.372, 1.355, 1.333, 1.333, 1.351, 1.369, 1.393, 1.422, 1.448, 1.471, 1.484,\n> +                    1.511, 1.494, 1.472, 1.444, 1.416, 1.398, 1.372, 1.361, 1.361, 1.369, 1.393, 1.411, 1.436, 1.458, 1.477, 1.487,\n> +                    1.511, 1.496, 1.478, 1.455, 1.436, 1.416, 1.399, 1.391, 1.391, 1.397, 1.411, 1.429, 1.451, 1.466, 1.479, 1.487,\n> +                    1.511, 1.495, 1.478, 1.462, 1.448, 1.432, 1.419, 1.419, 1.419, 1.419, 1.429, 1.445, 1.459, 1.471, 1.482, 1.487\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 6000, \"table\":\n> +                [\n> +                    2.581, 2.573, 2.558, 2.539, 2.514, 2.487, 2.473, 2.471, 2.471, 2.471, 2.479, 2.499, 2.517, 2.532, 2.543, 2.544,\n> +                    2.575, 2.559, 2.539, 2.521, 2.491, 2.458, 2.435, 2.421, 2.421, 2.429, 2.449, 2.477, 2.499, 2.519, 2.534, 2.543,\n> +                    2.561, 2.549, 2.521, 2.491, 2.457, 2.423, 2.393, 2.375, 2.375, 2.387, 2.412, 2.444, 2.475, 2.499, 2.519, 2.532,\n> +                    2.552, 2.531, 2.498, 2.459, 2.423, 2.391, 2.349, 2.325, 2.325, 2.344, 2.374, 2.412, 2.444, 2.476, 2.505, 2.519,\n> +                    2.543, 2.518, 2.479, 2.435, 2.392, 2.349, 2.324, 2.285, 2.283, 2.313, 2.344, 2.374, 2.417, 2.457, 2.489, 2.506,\n> +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.277, 2.279, 2.283, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.267, 2.267, 2.281, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> +                    2.541, 2.512, 2.472, 2.425, 2.381, 2.338, 2.302, 2.278, 2.279, 2.301, 2.324, 2.364, 2.407, 2.447, 2.481, 2.504,\n> +                    2.544, 2.519, 2.483, 2.441, 2.401, 2.363, 2.338, 2.302, 2.302, 2.324, 2.355, 2.385, 2.423, 2.459, 2.488, 2.506,\n> +                    2.549, 2.527, 2.497, 2.463, 2.427, 2.401, 2.363, 2.345, 2.345, 2.355, 2.385, 2.412, 2.444, 2.473, 2.497, 2.509,\n> +                    2.552, 2.532, 2.507, 2.481, 2.459, 2.427, 2.402, 2.389, 2.389, 2.394, 2.412, 2.444, 2.465, 2.481, 2.499, 2.511,\n> +                    2.553, 2.533, 2.508, 2.489, 2.475, 2.454, 2.429, 2.429, 2.429, 2.429, 2.439, 2.463, 2.481, 2.492, 2.504, 2.511\n> +                ]\n> +            }\n> +        ],\n> +        \"calibrations_Cb\":\n> +        [\n> +            {\n> +                \"ct\": 3000, \"table\":\n> +                [\n> +                    3.132, 3.126, 3.116, 3.103, 3.097, 3.091, 3.087, 3.086, 3.088, 3.091, 3.092, 3.102, 3.113, 3.121, 3.141, 3.144,\n> +                    3.149, 3.132, 3.123, 3.108, 3.101, 3.096, 3.091, 3.089, 3.091, 3.092, 3.101, 3.107, 3.116, 3.129, 3.144, 3.153,\n> +                    3.161, 3.149, 3.129, 3.121, 3.108, 3.103, 3.101, 3.101, 3.101, 3.103, 3.107, 3.116, 3.125, 3.134, 3.153, 3.159,\n> +                    3.176, 3.161, 3.144, 3.129, 3.124, 3.121, 3.117, 3.118, 3.118, 3.119, 3.122, 3.125, 3.134, 3.146, 3.159, 3.171,\n> +                    3.183, 3.176, 3.157, 3.144, 3.143, 3.143, 3.139, 3.141, 3.141, 3.141, 3.141, 3.141, 3.146, 3.161, 3.171, 3.179,\n> +                    3.189, 3.183, 3.165, 3.157, 3.156, 3.157, 3.159, 3.163, 3.163, 3.163, 3.163, 3.161, 3.163, 3.169, 3.179, 3.187,\n> +                    3.199, 3.189, 3.171, 3.165, 3.164, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.169, 3.169, 3.175, 3.187, 3.189,\n> +                    3.206, 3.196, 3.177, 3.171, 3.165, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.171, 3.173, 3.177, 3.192, 3.194,\n> +                    3.209, 3.197, 3.178, 3.171, 3.164, 3.161, 3.159, 3.161, 3.162, 3.164, 3.167, 3.171, 3.173, 3.181, 3.193, 3.198,\n> +                    3.204, 3.194, 3.176, 3.165, 3.161, 3.156, 3.154, 3.154, 3.159, 3.161, 3.164, 3.168, 3.173, 3.182, 3.198, 3.199,\n> +                    3.199, 3.191, 3.176, 3.169, 3.161, 3.157, 3.153, 3.153, 3.156, 3.161, 3.164, 3.168, 3.173, 3.186, 3.196, 3.199,\n> +                    3.199, 3.188, 3.179, 3.173, 3.165, 3.157, 3.153, 3.154, 3.156, 3.159, 3.167, 3.171, 3.176, 3.185, 3.193, 3.198\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 6000, \"table\":\n> +                [\n> +                    1.579, 1.579, 1.577, 1.574, 1.573, 1.571, 1.571, 1.571, 1.571, 1.569, 1.569, 1.571, 1.572, 1.574, 1.577, 1.578,\n> +                    1.584, 1.579, 1.578, 1.575, 1.573, 1.572, 1.571, 1.572, 1.572, 1.571, 1.571, 1.572, 1.573, 1.576, 1.578, 1.579,\n> +                    1.587, 1.584, 1.579, 1.578, 1.575, 1.573, 1.573, 1.575, 1.575, 1.574, 1.573, 1.574, 1.576, 1.578, 1.581, 1.581,\n> +                    1.591, 1.587, 1.584, 1.579, 1.578, 1.579, 1.579, 1.581, 1.581, 1.581, 1.578, 1.577, 1.578, 1.581, 1.585, 1.586,\n> +                    1.595, 1.591, 1.587, 1.585, 1.585, 1.586, 1.587, 1.587, 1.588, 1.588, 1.585, 1.584, 1.584, 1.586, 1.589, 1.589,\n> +                    1.597, 1.595, 1.591, 1.589, 1.591, 1.593, 1.595, 1.596, 1.597, 1.597, 1.595, 1.594, 1.592, 1.592, 1.593, 1.593,\n> +                    1.601, 1.597, 1.593, 1.592, 1.593, 1.595, 1.598, 1.599, 1.602, 1.601, 1.598, 1.596, 1.595, 1.596, 1.595, 1.595,\n> +                    1.601, 1.599, 1.594, 1.593, 1.593, 1.595, 1.598, 1.599, 1.602, 1.601, 1.598, 1.597, 1.597, 1.597, 1.597, 1.597,\n> +                    1.602, 1.599, 1.594, 1.593, 1.592, 1.593, 1.595, 1.597, 1.597, 1.598, 1.598, 1.597, 1.597, 1.597, 1.598, 1.598,\n> +                    1.599, 1.598, 1.594, 1.592, 1.591, 1.591, 1.592, 1.595, 1.596, 1.597, 1.597, 1.597, 1.597, 1.599, 1.599, 1.599,\n> +                    1.598, 1.596, 1.594, 1.593, 1.592, 1.592, 1.592, 1.594, 1.595, 1.597, 1.597, 1.597, 1.598, 1.599, 1.599, 1.599,\n> +                    1.597, 1.595, 1.594, 1.594, 1.593, 1.592, 1.593, 1.595, 1.595, 1.597, 1.598, 1.598, 1.598, 1.599, 1.599, 1.599\n> +                ]\n> +            }\n> +        ],\n> +        \"luminance_lut\":\n> +        [\n> +            2.887, 2.754, 2.381, 2.105, 1.859, 1.678, 1.625, 1.623, 1.623, 1.624, 1.669, 1.849, 2.092, 2.362, 2.723, 2.838,\n> +            2.754, 2.443, 2.111, 1.905, 1.678, 1.542, 1.455, 1.412, 1.412, 1.452, 1.535, 1.665, 1.893, 2.096, 2.413, 2.723,\n> +            2.443, 2.216, 1.911, 1.678, 1.537, 1.372, 1.288, 1.245, 1.245, 1.283, 1.363, 1.527, 1.665, 1.895, 2.193, 2.413,\n> +            2.318, 2.057, 1.764, 1.541, 1.372, 1.282, 1.159, 1.113, 1.113, 1.151, 1.269, 1.363, 1.527, 1.749, 2.034, 2.278,\n> +            2.259, 1.953, 1.671, 1.452, 1.283, 1.159, 1.107, 1.018, 1.017, 1.097, 1.151, 1.269, 1.437, 1.655, 1.931, 2.222,\n> +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.019, 1.011, 1.005, 1.014, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.016, 1.001, 1.001, 1.007, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> +            2.257, 1.946, 1.666, 1.448, 1.281, 1.153, 1.093, 1.013, 1.008, 1.089, 1.143, 1.269, 1.437, 1.654, 1.934, 2.226,\n> +            2.309, 2.044, 1.756, 1.532, 1.363, 1.259, 1.153, 1.093, 1.093, 1.143, 1.264, 1.354, 1.524, 1.746, 2.035, 2.284,\n> +            2.425, 2.201, 1.896, 1.662, 1.519, 1.363, 1.259, 1.214, 1.214, 1.264, 1.354, 1.519, 1.655, 1.888, 2.191, 2.413,\n> +            2.724, 2.417, 2.091, 1.888, 1.662, 1.519, 1.419, 1.373, 1.373, 1.425, 1.521, 1.655, 1.885, 2.089, 2.409, 2.722,\n> +            2.858, 2.724, 2.356, 2.085, 1.842, 1.658, 1.581, 1.577, 1.577, 1.579, 1.653, 1.838, 2.084, 2.359, 2.722, 2.842\n> +        ],\n> +        \"sigma\": 0.00372,\n> +        \"sigma_Cb\": 0.00244\n> +    },\n> +    \"rpi.contrast\":\n> +    {\n> +        \"ce_enable\": 1,\n> +        \"gamma_curve\":\n> +        [\n> +            0, 0, 1024, 5040, 2048, 9338, 3072, 12356, 4096, 15312, 5120, 18051, 6144, 20790, 7168, 23193,\n> +            8192, 25744, 9216, 27942, 10240, 30035, 11264, 32005, 12288, 33975, 13312, 35815, 14336, 37600, 15360, 39168,\n> +            16384, 40642, 18432, 43379, 20480, 45749, 22528, 47753, 24576, 49621, 26624, 51253, 28672, 52698, 30720, 53796,\n> +            32768, 54876, 36864, 57012, 40960, 58656, 45056, 59954, 49152, 61183, 53248, 62355, 57344, 63419, 61440, 64476,\n> +            65535, 65535\n> +        ]\n> +    },\n> +    \"rpi.ccm\":\n> +    {\n> +        \"ccms\":\n> +        [\n> +            {\n> +                \"ct\": 2890, \"ccm\":\n> +                [\n> +                    1.36754, -0.18448, -0.18306, -0.32356, 1.44826, -0.12471, -0.00412, -0.69936, 1.70348\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 2920, \"ccm\":\n> +                [\n> +                    1.26704, 0.01624, -0.28328, -0.28516, 1.38934, -0.10419, -0.04854, -0.82211, 1.87066\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 3550, \"ccm\":\n> +                [\n> +                    1.42836, -0.27235, -0.15601, -0.28751, 1.41075, -0.12325, -0.01812, -0.54849, 1.56661\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 4500, \"ccm\":\n> +                [\n> +                    1.36328, -0.19569, -0.16759, -0.25254, 1.52248, -0.26994, -0.01575, -0.53155, 1.54729\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 5700, \"ccm\":\n> +                [\n> +                    1.49207, -0.37245, -0.11963, -0.21493, 1.40005, -0.18512, -0.03781, -0.38779, 1.42561\n> +                ]\n> +            },\n> +            {\n> +                \"ct\": 7900, \"ccm\":\n> +                [\n> +                    1.34849, -0.05425, -0.29424, -0.22182, 1.77684, -0.55502, -0.07403, -0.55336, 1.62739\n> +                ]\n> +            }\n> +        ]\n> +    },\n> +    \"rpi.sharpen\":\n> +    {\n> +    }\n> +}\n> diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build\n> index 2def75cb..e84cd099 100644\n> --- a/src/ipa/raspberrypi/data/meson.build\n> +++ b/src/ipa/raspberrypi/data/meson.build\n> @@ -7,6 +7,7 @@ conf_files = files([\n>      'imx378.json',\n>      'imx477.json',\n>      'imx477_noir.json',\n> +    'imx519.json',\n>      'ov5647.json',\n>      'ov5647_noir.json',\n>      'ov9281.json',\n> diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build\n> index 1af31e4a..176055f4 100644\n> --- a/src/ipa/raspberrypi/meson.build\n> +++ b/src/ipa/raspberrypi/meson.build\n> @@ -22,6 +22,7 @@ rpi_ipa_sources = files([\n>      'cam_helper_imx219.cpp',\n>      'cam_helper_imx290.cpp',\n>      'cam_helper_imx477.cpp',\n> +    'cam_helper_imx519.cpp',\n>      'cam_helper_ov9281.cpp',\n>      'controller/controller.cpp',\n>      'controller/histogram.cpp',\n> -- \n> 2.20.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 2117BBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Oct 2021 09:38:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6463268F58;\n\tThu, 21 Oct 2021 11:38:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0631160129\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Oct 2021 11:38:24 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 86DF72BA;\n\tThu, 21 Oct 2021 11:38:23 +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=\"pFKEkcPV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634809103;\n\tbh=wILBNfyoEjY56yO57EV9GHkEbR7LQkVXU96VmfTkP38=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=pFKEkcPV92pX/4IAOTLdrEAwHVmmVsJDm0b/wtnqfZ50ELT8yAfh26s0tf8goJphI\n\tZS8GQ8Qx/prlQvFt3gC/VeYYxxl9Qw1SlNQp8j+y2pd8+dj+Ks88XoyfMNeAd+x6j5\n\t9ehBene2EAWwBB7ITN4JHbPhHL+W5VvbyFANzZvg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211020132334.2199-2-david.plowman@raspberrypi.com>","References":"<20211020132334.2199-1-david.plowman@raspberrypi.com>\n\t<20211020132334.2199-2-david.plowman@raspberrypi.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 21 Oct 2021 10:38:20 +0100","Message-ID":"<163480910079.2663858.14277654487177505675@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","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>","Cc":"Arducam info <info@arducam.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20657,"web_url":"https://patchwork.libcamera.org/comment/20657/","msgid":"<163585196967.1097798.9290683661641464035@Monstersaurus>","date":"2021-11-02T11:19:29","subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Kieran Bingham (2021-10-21 10:38:20)\n> Hi Lee, David,\n> \n> Quoting David Plowman (2021-10-20 14:23:34)\n> > From: Arducam info <info@arducam.com>\n> > \n> > The necessary tuning file and CamHelper is added for the imx519 sensor.\n> > \n> > The imx519 is a 16MP rolling shutter sensor. To enable\n> > it, please add\n> > \n> > dtoverlay=imx519\n> > \n> \n> Great, I'm glad to see new sensor support progressing.\n> \n> For this patch:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> I see the imx519 is integrated into the Raspberry Pi kernel, who will\n> take this forward and post to the linux-media to get it intgrated into\n> the kernel directly?\n\nExcellent, with\n [PATCH 1/2] dt-bindings: media: i2c: Add IMX519 CMOS sensor binding \n https://lore.kernel.org/linux-media/38FCC5C9-9D03-4C8B-9ADF-896AE2BD90DE@arducam.com/T/#u\nand\n [PATCH 2/2] media: i2c: Add driver for IMX519 sensor\n https://lore.kernel.org/linux-media/DBFF7F52-B763-4D54-8DC9-10508ECC7BD2@arducam.com/T/#u\n\nposted, I think we should get this integrated into libcamera now.\n\nDavid/Naush - I'm not able to test this. Is this fine to go in as it is?\nAny impacts on the recent MC series, or anything else?\n\n--\nKieran\n\n\n> \n> --\n> Kieran\n> \n> > to the /boot/config.txt file and reboot the Pi.\n> > \n> > Signed-off-by: Lee Jackson <info@arducam.com>\n> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > \n> > ---\n> >  src/ipa/raspberrypi/cam_helper_imx519.cpp | 185 ++++++++++++\n> >  src/ipa/raspberrypi/data/imx519.json      | 338 ++++++++++++++++++++++\n> >  src/ipa/raspberrypi/data/meson.build      |   1 +\n> >  src/ipa/raspberrypi/meson.build           |   1 +\n> >  4 files changed, 525 insertions(+)\n> >  create mode 100644 src/ipa/raspberrypi/cam_helper_imx519.cpp\n> >  create mode 100644 src/ipa/raspberrypi/data/imx519.json\n> > \n> > diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> > new file mode 100644\n> > index 00000000..eaf24982\n> > --- /dev/null\n> > +++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> > @@ -0,0 +1,185 @@\n> > +/* SPDX-License-Identifier: BSD-2-Clause */\n> > +/*\n> > + * Based on cam_helper_imx477.cpp\n> > + * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n> > + *\n> > + * cam_helper_imx519.cpp - camera helper for imx519 sensor\n> > + * Copyright (C) 2021, Arducam Technology co., Ltd.\n> > + */\n> > +\n> > +#include <assert.h>\n> > +#include <cmath>\n> > +#include <stddef.h>\n> > +#include <stdio.h>\n> > +#include <stdlib.h>\n> > +\n> > +#include <libcamera/base/log.h>\n> > +\n> > +#include \"cam_helper.hpp\"\n> > +#include \"md_parser.hpp\"\n> > +\n> > +using namespace RPiController;\n> > +using namespace libcamera;\n> > +using libcamera::utils::Duration;\n> > +\n> > +namespace libcamera {\n> > +LOG_DECLARE_CATEGORY(IPARPI)\n> > +}\n> > +\n> > +/*\n> > + * We care about two gain registers and a pair of exposure registers. Their\n> > + * I2C addresses from the Sony IMX519 datasheet:\n> > + */\n> > +constexpr uint32_t expHiReg = 0x0202;\n> > +constexpr uint32_t expLoReg = 0x0203;\n> > +constexpr uint32_t gainHiReg = 0x0204;\n> > +constexpr uint32_t gainLoReg = 0x0205;\n> > +constexpr uint32_t frameLengthHiReg = 0x0340;\n> > +constexpr uint32_t frameLengthLoReg = 0x0341;\n> > +constexpr std::initializer_list<uint32_t> registerList =\n> > +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n> > +\n> > +class CamHelperImx519 : public CamHelper\n> > +{\n> > +public:\n> > +       CamHelperImx519();\n> > +       uint32_t GainCode(double gain) const override;\n> > +       double Gain(uint32_t gain_code) const override;\n> > +       void Prepare(libcamera::Span<const uint8_t> buffer, Metadata &metadata) override;\n> > +       uint32_t GetVBlanking(Duration &exposure, Duration minFrameDuration,\n> > +                             Duration maxFrameDuration) const override;\n> > +       void GetDelays(int &exposure_delay, int &gain_delay,\n> > +                      int &vblank_delay) const override;\n> > +       bool SensorEmbeddedDataPresent() 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 = 32;\n> > +       /* Maximum frame length allowable for long exposure calculations. */\n> > +       static constexpr int frameLengthMax = 0xffdc;\n> > +       /* Largest long exposure scale factor given as a left shift on the frame length. */\n> > +       static constexpr int longExposureShiftMax = 7;\n> > +\n> > +       void PopulateMetadata(const MdParser::RegisterMap &registers,\n> > +                             Metadata &metadata) const override;\n> > +};\n> > +\n> > +CamHelperImx519::CamHelperImx519()\n> > +       : CamHelper(std::make_unique<MdParserSmia>(registerList), frameIntegrationDiff)\n> > +{\n> > +}\n> > +\n> > +uint32_t CamHelperImx519::GainCode(double gain) const\n> > +{\n> > +       return static_cast<uint32_t>(1024 - 1024 / gain);\n> > +}\n> > +\n> > +double CamHelperImx519::Gain(uint32_t gain_code) const\n> > +{\n> > +       return 1024.0 / (1024 - gain_code);\n> > +}\n> > +\n> > +void CamHelperImx519::Prepare(libcamera::Span<const uint8_t> buffer, Metadata &metadata)\n> > +{\n> > +       MdParser::RegisterMap registers;\n> > +       DeviceStatus deviceStatus;\n> > +\n> > +       if (metadata.Get(\"device.status\", deviceStatus)) {\n> > +               LOG(IPARPI, Error) << \"DeviceStatus not found from DelayedControls\";\n> > +               return;\n> > +       }\n> > +\n> > +       parseEmbeddedData(buffer, metadata);\n> > +\n> > +       /*\n> > +        * The DeviceStatus struct is first populated with values obtained from\n> > +        * DelayedControls. If this reports frame length is > frameLengthMax,\n> > +        * it means we are using a long exposure mode. Since the long exposure\n> > +        * scale factor is not returned back through embedded data, we must rely\n> > +        * on the existing exposure lines and frame length values returned by\n> > +        * DelayedControls.\n> > +        *\n> > +        * Otherwise, all values are updated with what is reported in the\n> > +        * embedded data.\n> > +        */\n> > +       if (deviceStatus.frame_length > frameLengthMax) {\n> > +               DeviceStatus parsedDeviceStatus;\n> > +\n> > +               metadata.Get(\"device.status\", parsedDeviceStatus);\n> > +               parsedDeviceStatus.shutter_speed = deviceStatus.shutter_speed;\n> > +               parsedDeviceStatus.frame_length = deviceStatus.frame_length;\n> > +               metadata.Set(\"device.status\", parsedDeviceStatus);\n> > +\n> > +               LOG(IPARPI, Debug) << \"Metadata updated for long exposure: \"\n> > +                                  << parsedDeviceStatus;\n> > +       }\n> > +}\n> > +\n> > +uint32_t CamHelperImx519::GetVBlanking(Duration &exposure,\n> > +                                      Duration minFrameDuration,\n> > +                                      Duration maxFrameDuration) const\n> > +{\n> > +       uint32_t frameLength, exposureLines;\n> > +       unsigned int shift = 0;\n> > +\n> > +       frameLength = mode_.height + CamHelper::GetVBlanking(exposure, minFrameDuration,\n> > +                                                            maxFrameDuration);\n> > +       /*\n> > +        * Check if the frame length calculated needs to be setup for long\n> > +        * exposure mode. This will require us to use a long exposure scale\n> > +        * factor provided by a shift operation in the sensor.\n> > +        */\n> > +       while (frameLength > frameLengthMax) {\n> > +               if (++shift > longExposureShiftMax) {\n> > +                       shift = longExposureShiftMax;\n> > +                       frameLength = frameLengthMax;\n> > +                       break;\n> > +               }\n> > +               frameLength >>= 1;\n> > +       }\n> > +\n> > +       if (shift) {\n> > +               /* Account for any rounding in the scaled frame length value. */\n> > +               frameLength <<= shift;\n> > +               exposureLines = ExposureLines(exposure);\n> > +               exposureLines = std::min(exposureLines, frameLength - frameIntegrationDiff);\n> > +               exposure = Exposure(exposureLines);\n> > +       }\n> > +\n> > +       return frameLength - mode_.height;\n> > +}\n> > +\n> > +void CamHelperImx519::GetDelays(int &exposure_delay, int &gain_delay,\n> > +                               int &vblank_delay) const\n> > +{\n> > +       exposure_delay = 2;\n> > +       gain_delay = 2;\n> > +       vblank_delay = 3;\n> > +}\n> > +\n> > +bool CamHelperImx519::SensorEmbeddedDataPresent() const\n> > +{\n> > +       return true;\n> > +}\n> > +\n> > +void CamHelperImx519::PopulateMetadata(const MdParser::RegisterMap &registers,\n> > +                                      Metadata &metadata) const\n> > +{\n> > +       DeviceStatus deviceStatus;\n> > +\n> > +       deviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n> > +       deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n> > +       deviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n> > +\n> > +       metadata.Set(\"device.status\", deviceStatus);\n> > +}\n> > +\n> > +static CamHelper *Create()\n> > +{\n> > +       return new CamHelperImx519();\n> > +}\n> > +\n> > +static RegisterCamHelper reg(\"imx519\", &Create);\n> > diff --git a/src/ipa/raspberrypi/data/imx519.json b/src/ipa/raspberrypi/data/imx519.json\n> > new file mode 100644\n> > index 00000000..164d0d9d\n> > --- /dev/null\n> > +++ b/src/ipa/raspberrypi/data/imx519.json\n> > @@ -0,0 +1,338 @@\n> > +{\n> > +    \"rpi.black_level\":\n> > +    {\n> > +        \"black_level\": 4096\n> > +    },\n> > +    \"rpi.dpc\":\n> > +    {\n> > +    },\n> > +    \"rpi.lux\":\n> > +    {\n> > +        \"reference_shutter_speed\": 13841,\n> > +        \"reference_gain\": 2.0,\n> > +        \"reference_aperture\": 1.0,\n> > +        \"reference_lux\": 900,\n> > +        \"reference_Y\": 12064\n> > +    },\n> > +    \"rpi.noise\":\n> > +    {\n> > +        \"reference_constant\": 0,\n> > +        \"reference_slope\": 2.776\n> > +    },\n> > +    \"rpi.geq\":\n> > +    {\n> > +        \"offset\": 189,\n> > +        \"slope\": 0.01495\n> > +    },\n> > +    \"rpi.sdn\":\n> > +    {\n> > +    },\n> > +    \"rpi.awb\":\n> > +    {\n> > +        \"priors\":\n> > +        [\n> > +            {\n> > +                \"lux\": 0, \"prior\":\n> > +                [\n> > +                    2000, 1.0, 3000, 0.0, 13000, 0.0\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"lux\": 800, \"prior\":\n> > +                [\n> > +                    2000, 0.0, 6000, 2.0, 13000, 2.0\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"lux\": 1500, \"prior\":\n> > +                [\n> > +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0\n> > +                ]\n> > +            }\n> > +        ],\n> > +        \"modes\":\n> > +        {\n> > +            \"auto\":\n> > +            {\n> > +                \"lo\": 2500,\n> > +                \"hi\": 7900\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\": 8000\n> > +            }\n> > +        },\n> > +        \"bayes\": 1,\n> > +        \"ct_curve\":\n> > +        [\n> > +            2890.0, 0.7328, 0.3734, 3550.0, 0.6228, 0.4763, 4500.0, 0.5208, 0.5825, 5700.0, 0.4467, 0.6671, 7900.0, 0.3858, 0.7411\n> > +        ],\n> > +        \"sensitivity_r\": 1.0,\n> > +        \"sensitivity_b\": 1.0,\n> > +        \"transverse_pos\": 0.02027,\n> > +        \"transverse_neg\": 0.01935\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\":\n> > +                [\n> > +                    100, 10000, 30000, 60000, 120000\n> > +                ],\n> > +                \"gain\":\n> > +                [\n> > +                    1.0, 2.0, 4.0, 6.0, 6.0\n> > +                ]\n> > +            },\n> > +            \"short\":\n> > +            {\n> > +                \"shutter\":\n> > +                [\n> > +                    100, 5000, 10000, 20000, 120000\n> > +                ],\n> > +                \"gain\":\n> > +                [\n> > +                    1.0, 2.0, 4.0, 6.0, 6.0\n> > +                ]\n> > +            }\n> > +        },\n> > +        \"constraint_modes\":\n> > +        {\n> > +            \"normal\":\n> > +            [\n> > +                {\n> > +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> > +                    [\n> > +                        0, 0.5, 1000, 0.5\n> > +                    ]\n> > +                }\n> > +            ],\n> > +            \"highlight\":\n> > +            [\n> > +                {\n> > +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> > +                    [\n> > +                        0, 0.5, 1000, 0.5\n> > +                    ]\n> > +                },\n> > +                {\n> > +                    \"bound\": \"UPPER\", \"q_lo\": 0.98, \"q_hi\": 1.0, \"y_target\":\n> > +                    [\n> > +                        0, 0.8, 1000, 0.8\n> > +                    ]\n> > +                }\n> > +            ]\n> > +        },\n> > +        \"y_target\":\n> > +        [\n> > +            0, 0.16, 1000, 0.165, 10000, 0.17\n> > +        ]\n> > +    },\n> > +    \"rpi.alsc\":\n> > +    {\n> > +        \"omega\": 1.3,\n> > +        \"n_iter\": 100,\n> > +        \"luminance_strength\": 0.5,\n> > +        \"calibrations_Cr\":\n> > +        [\n> > +            {\n> > +                \"ct\": 3000, \"table\":\n> > +                [\n> > +                    1.527, 1.521, 1.508, 1.493, 1.476, 1.455, 1.442, 1.441, 1.441, 1.441, 1.448, 1.467, 1.483, 1.494, 1.503, 1.504,\n> > +                    1.525, 1.513, 1.496, 1.477, 1.461, 1.434, 1.418, 1.409, 1.409, 1.416, 1.429, 1.449, 1.469, 1.485, 1.495, 1.503,\n> > +                    1.517, 1.506, 1.485, 1.461, 1.434, 1.412, 1.388, 1.376, 1.376, 1.386, 1.405, 1.429, 1.449, 1.471, 1.488, 1.495,\n> > +                    1.512, 1.496, 1.471, 1.442, 1.412, 1.388, 1.361, 1.344, 1.344, 1.358, 1.384, 1.405, 1.431, 1.456, 1.479, 1.489,\n> > +                    1.508, 1.488, 1.458, 1.425, 1.393, 1.361, 1.343, 1.322, 1.321, 1.342, 1.358, 1.385, 1.416, 1.445, 1.471, 1.484,\n> > +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.318, 1.318, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> > +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.313, 1.313, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> > +                    1.507, 1.485, 1.455, 1.422, 1.387, 1.355, 1.333, 1.319, 1.321, 1.333, 1.351, 1.381, 1.411, 1.441, 1.467, 1.483,\n> > +                    1.508, 1.489, 1.463, 1.432, 1.401, 1.372, 1.355, 1.333, 1.333, 1.351, 1.369, 1.393, 1.422, 1.448, 1.471, 1.484,\n> > +                    1.511, 1.494, 1.472, 1.444, 1.416, 1.398, 1.372, 1.361, 1.361, 1.369, 1.393, 1.411, 1.436, 1.458, 1.477, 1.487,\n> > +                    1.511, 1.496, 1.478, 1.455, 1.436, 1.416, 1.399, 1.391, 1.391, 1.397, 1.411, 1.429, 1.451, 1.466, 1.479, 1.487,\n> > +                    1.511, 1.495, 1.478, 1.462, 1.448, 1.432, 1.419, 1.419, 1.419, 1.419, 1.429, 1.445, 1.459, 1.471, 1.482, 1.487\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 6000, \"table\":\n> > +                [\n> > +                    2.581, 2.573, 2.558, 2.539, 2.514, 2.487, 2.473, 2.471, 2.471, 2.471, 2.479, 2.499, 2.517, 2.532, 2.543, 2.544,\n> > +                    2.575, 2.559, 2.539, 2.521, 2.491, 2.458, 2.435, 2.421, 2.421, 2.429, 2.449, 2.477, 2.499, 2.519, 2.534, 2.543,\n> > +                    2.561, 2.549, 2.521, 2.491, 2.457, 2.423, 2.393, 2.375, 2.375, 2.387, 2.412, 2.444, 2.475, 2.499, 2.519, 2.532,\n> > +                    2.552, 2.531, 2.498, 2.459, 2.423, 2.391, 2.349, 2.325, 2.325, 2.344, 2.374, 2.412, 2.444, 2.476, 2.505, 2.519,\n> > +                    2.543, 2.518, 2.479, 2.435, 2.392, 2.349, 2.324, 2.285, 2.283, 2.313, 2.344, 2.374, 2.417, 2.457, 2.489, 2.506,\n> > +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.277, 2.279, 2.283, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> > +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.267, 2.267, 2.281, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> > +                    2.541, 2.512, 2.472, 2.425, 2.381, 2.338, 2.302, 2.278, 2.279, 2.301, 2.324, 2.364, 2.407, 2.447, 2.481, 2.504,\n> > +                    2.544, 2.519, 2.483, 2.441, 2.401, 2.363, 2.338, 2.302, 2.302, 2.324, 2.355, 2.385, 2.423, 2.459, 2.488, 2.506,\n> > +                    2.549, 2.527, 2.497, 2.463, 2.427, 2.401, 2.363, 2.345, 2.345, 2.355, 2.385, 2.412, 2.444, 2.473, 2.497, 2.509,\n> > +                    2.552, 2.532, 2.507, 2.481, 2.459, 2.427, 2.402, 2.389, 2.389, 2.394, 2.412, 2.444, 2.465, 2.481, 2.499, 2.511,\n> > +                    2.553, 2.533, 2.508, 2.489, 2.475, 2.454, 2.429, 2.429, 2.429, 2.429, 2.439, 2.463, 2.481, 2.492, 2.504, 2.511\n> > +                ]\n> > +            }\n> > +        ],\n> > +        \"calibrations_Cb\":\n> > +        [\n> > +            {\n> > +                \"ct\": 3000, \"table\":\n> > +                [\n> > +                    3.132, 3.126, 3.116, 3.103, 3.097, 3.091, 3.087, 3.086, 3.088, 3.091, 3.092, 3.102, 3.113, 3.121, 3.141, 3.144,\n> > +                    3.149, 3.132, 3.123, 3.108, 3.101, 3.096, 3.091, 3.089, 3.091, 3.092, 3.101, 3.107, 3.116, 3.129, 3.144, 3.153,\n> > +                    3.161, 3.149, 3.129, 3.121, 3.108, 3.103, 3.101, 3.101, 3.101, 3.103, 3.107, 3.116, 3.125, 3.134, 3.153, 3.159,\n> > +                    3.176, 3.161, 3.144, 3.129, 3.124, 3.121, 3.117, 3.118, 3.118, 3.119, 3.122, 3.125, 3.134, 3.146, 3.159, 3.171,\n> > +                    3.183, 3.176, 3.157, 3.144, 3.143, 3.143, 3.139, 3.141, 3.141, 3.141, 3.141, 3.141, 3.146, 3.161, 3.171, 3.179,\n> > +                    3.189, 3.183, 3.165, 3.157, 3.156, 3.157, 3.159, 3.163, 3.163, 3.163, 3.163, 3.161, 3.163, 3.169, 3.179, 3.187,\n> > +                    3.199, 3.189, 3.171, 3.165, 3.164, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.169, 3.169, 3.175, 3.187, 3.189,\n> > +                    3.206, 3.196, 3.177, 3.171, 3.165, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.171, 3.173, 3.177, 3.192, 3.194,\n> > +                    3.209, 3.197, 3.178, 3.171, 3.164, 3.161, 3.159, 3.161, 3.162, 3.164, 3.167, 3.171, 3.173, 3.181, 3.193, 3.198,\n> > +                    3.204, 3.194, 3.176, 3.165, 3.161, 3.156, 3.154, 3.154, 3.159, 3.161, 3.164, 3.168, 3.173, 3.182, 3.198, 3.199,\n> > +                    3.199, 3.191, 3.176, 3.169, 3.161, 3.157, 3.153, 3.153, 3.156, 3.161, 3.164, 3.168, 3.173, 3.186, 3.196, 3.199,\n> > +                    3.199, 3.188, 3.179, 3.173, 3.165, 3.157, 3.153, 3.154, 3.156, 3.159, 3.167, 3.171, 3.176, 3.185, 3.193, 3.198\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 6000, \"table\":\n> > +                [\n> > +                    1.579, 1.579, 1.577, 1.574, 1.573, 1.571, 1.571, 1.571, 1.571, 1.569, 1.569, 1.571, 1.572, 1.574, 1.577, 1.578,\n> > +                    1.584, 1.579, 1.578, 1.575, 1.573, 1.572, 1.571, 1.572, 1.572, 1.571, 1.571, 1.572, 1.573, 1.576, 1.578, 1.579,\n> > +                    1.587, 1.584, 1.579, 1.578, 1.575, 1.573, 1.573, 1.575, 1.575, 1.574, 1.573, 1.574, 1.576, 1.578, 1.581, 1.581,\n> > +                    1.591, 1.587, 1.584, 1.579, 1.578, 1.579, 1.579, 1.581, 1.581, 1.581, 1.578, 1.577, 1.578, 1.581, 1.585, 1.586,\n> > +                    1.595, 1.591, 1.587, 1.585, 1.585, 1.586, 1.587, 1.587, 1.588, 1.588, 1.585, 1.584, 1.584, 1.586, 1.589, 1.589,\n> > +                    1.597, 1.595, 1.591, 1.589, 1.591, 1.593, 1.595, 1.596, 1.597, 1.597, 1.595, 1.594, 1.592, 1.592, 1.593, 1.593,\n> > +                    1.601, 1.597, 1.593, 1.592, 1.593, 1.595, 1.598, 1.599, 1.602, 1.601, 1.598, 1.596, 1.595, 1.596, 1.595, 1.595,\n> > +                    1.601, 1.599, 1.594, 1.593, 1.593, 1.595, 1.598, 1.599, 1.602, 1.601, 1.598, 1.597, 1.597, 1.597, 1.597, 1.597,\n> > +                    1.602, 1.599, 1.594, 1.593, 1.592, 1.593, 1.595, 1.597, 1.597, 1.598, 1.598, 1.597, 1.597, 1.597, 1.598, 1.598,\n> > +                    1.599, 1.598, 1.594, 1.592, 1.591, 1.591, 1.592, 1.595, 1.596, 1.597, 1.597, 1.597, 1.597, 1.599, 1.599, 1.599,\n> > +                    1.598, 1.596, 1.594, 1.593, 1.592, 1.592, 1.592, 1.594, 1.595, 1.597, 1.597, 1.597, 1.598, 1.599, 1.599, 1.599,\n> > +                    1.597, 1.595, 1.594, 1.594, 1.593, 1.592, 1.593, 1.595, 1.595, 1.597, 1.598, 1.598, 1.598, 1.599, 1.599, 1.599\n> > +                ]\n> > +            }\n> > +        ],\n> > +        \"luminance_lut\":\n> > +        [\n> > +            2.887, 2.754, 2.381, 2.105, 1.859, 1.678, 1.625, 1.623, 1.623, 1.624, 1.669, 1.849, 2.092, 2.362, 2.723, 2.838,\n> > +            2.754, 2.443, 2.111, 1.905, 1.678, 1.542, 1.455, 1.412, 1.412, 1.452, 1.535, 1.665, 1.893, 2.096, 2.413, 2.723,\n> > +            2.443, 2.216, 1.911, 1.678, 1.537, 1.372, 1.288, 1.245, 1.245, 1.283, 1.363, 1.527, 1.665, 1.895, 2.193, 2.413,\n> > +            2.318, 2.057, 1.764, 1.541, 1.372, 1.282, 1.159, 1.113, 1.113, 1.151, 1.269, 1.363, 1.527, 1.749, 2.034, 2.278,\n> > +            2.259, 1.953, 1.671, 1.452, 1.283, 1.159, 1.107, 1.018, 1.017, 1.097, 1.151, 1.269, 1.437, 1.655, 1.931, 2.222,\n> > +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.019, 1.011, 1.005, 1.014, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> > +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.016, 1.001, 1.001, 1.007, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> > +            2.257, 1.946, 1.666, 1.448, 1.281, 1.153, 1.093, 1.013, 1.008, 1.089, 1.143, 1.269, 1.437, 1.654, 1.934, 2.226,\n> > +            2.309, 2.044, 1.756, 1.532, 1.363, 1.259, 1.153, 1.093, 1.093, 1.143, 1.264, 1.354, 1.524, 1.746, 2.035, 2.284,\n> > +            2.425, 2.201, 1.896, 1.662, 1.519, 1.363, 1.259, 1.214, 1.214, 1.264, 1.354, 1.519, 1.655, 1.888, 2.191, 2.413,\n> > +            2.724, 2.417, 2.091, 1.888, 1.662, 1.519, 1.419, 1.373, 1.373, 1.425, 1.521, 1.655, 1.885, 2.089, 2.409, 2.722,\n> > +            2.858, 2.724, 2.356, 2.085, 1.842, 1.658, 1.581, 1.577, 1.577, 1.579, 1.653, 1.838, 2.084, 2.359, 2.722, 2.842\n> > +        ],\n> > +        \"sigma\": 0.00372,\n> > +        \"sigma_Cb\": 0.00244\n> > +    },\n> > +    \"rpi.contrast\":\n> > +    {\n> > +        \"ce_enable\": 1,\n> > +        \"gamma_curve\":\n> > +        [\n> > +            0, 0, 1024, 5040, 2048, 9338, 3072, 12356, 4096, 15312, 5120, 18051, 6144, 20790, 7168, 23193,\n> > +            8192, 25744, 9216, 27942, 10240, 30035, 11264, 32005, 12288, 33975, 13312, 35815, 14336, 37600, 15360, 39168,\n> > +            16384, 40642, 18432, 43379, 20480, 45749, 22528, 47753, 24576, 49621, 26624, 51253, 28672, 52698, 30720, 53796,\n> > +            32768, 54876, 36864, 57012, 40960, 58656, 45056, 59954, 49152, 61183, 53248, 62355, 57344, 63419, 61440, 64476,\n> > +            65535, 65535\n> > +        ]\n> > +    },\n> > +    \"rpi.ccm\":\n> > +    {\n> > +        \"ccms\":\n> > +        [\n> > +            {\n> > +                \"ct\": 2890, \"ccm\":\n> > +                [\n> > +                    1.36754, -0.18448, -0.18306, -0.32356, 1.44826, -0.12471, -0.00412, -0.69936, 1.70348\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 2920, \"ccm\":\n> > +                [\n> > +                    1.26704, 0.01624, -0.28328, -0.28516, 1.38934, -0.10419, -0.04854, -0.82211, 1.87066\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 3550, \"ccm\":\n> > +                [\n> > +                    1.42836, -0.27235, -0.15601, -0.28751, 1.41075, -0.12325, -0.01812, -0.54849, 1.56661\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 4500, \"ccm\":\n> > +                [\n> > +                    1.36328, -0.19569, -0.16759, -0.25254, 1.52248, -0.26994, -0.01575, -0.53155, 1.54729\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 5700, \"ccm\":\n> > +                [\n> > +                    1.49207, -0.37245, -0.11963, -0.21493, 1.40005, -0.18512, -0.03781, -0.38779, 1.42561\n> > +                ]\n> > +            },\n> > +            {\n> > +                \"ct\": 7900, \"ccm\":\n> > +                [\n> > +                    1.34849, -0.05425, -0.29424, -0.22182, 1.77684, -0.55502, -0.07403, -0.55336, 1.62739\n> > +                ]\n> > +            }\n> > +        ]\n> > +    },\n> > +    \"rpi.sharpen\":\n> > +    {\n> > +    }\n> > +}\n> > diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build\n> > index 2def75cb..e84cd099 100644\n> > --- a/src/ipa/raspberrypi/data/meson.build\n> > +++ b/src/ipa/raspberrypi/data/meson.build\n> > @@ -7,6 +7,7 @@ conf_files = files([\n> >      'imx378.json',\n> >      'imx477.json',\n> >      'imx477_noir.json',\n> > +    'imx519.json',\n> >      'ov5647.json',\n> >      'ov5647_noir.json',\n> >      'ov9281.json',\n> > diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build\n> > index 1af31e4a..176055f4 100644\n> > --- a/src/ipa/raspberrypi/meson.build\n> > +++ b/src/ipa/raspberrypi/meson.build\n> > @@ -22,6 +22,7 @@ rpi_ipa_sources = files([\n> >      'cam_helper_imx219.cpp',\n> >      'cam_helper_imx290.cpp',\n> >      'cam_helper_imx477.cpp',\n> > +    'cam_helper_imx519.cpp',\n> >      'cam_helper_ov9281.cpp',\n> >      'controller/controller.cpp',\n> >      'controller/histogram.cpp',\n> > -- \n> > 2.20.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 639F0BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Nov 2021 11:19:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CCE3860325;\n\tTue,  2 Nov 2021 12:19:34 +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 463E5600B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Nov 2021 12:19:33 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C5F363E5;\n\tTue,  2 Nov 2021 12:19:32 +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=\"iPOCEhHs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635851972;\n\tbh=GrIShnlPvodaVdL8h1KMHOZNAi85mqEBZQnGJpt+m1s=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=iPOCEhHs1uR/OFf+x7V3kvJbplCmhu0Np2llaUTxDFQdYmfB0xmm+u8E3d5+Y99wo\n\tYuzArkpApMXkst8X2y7boND0m4nDjA7Fkb7Am/6gFCI82SPu3W/bC0NLjjaU2aAO0T\n\tQfy/+C1pmz1K23xYrG1TiDHSWKXJBQhOntLuBC0U=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<163480910079.2663858.14277654487177505675@Monstersaurus>","References":"<20211020132334.2199-1-david.plowman@raspberrypi.com>\n\t<20211020132334.2199-2-david.plowman@raspberrypi.com>\n\t<163480910079.2663858.14277654487177505675@Monstersaurus>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 02 Nov 2021 11:19:29 +0000","Message-ID":"<163585196967.1097798.9290683661641464035@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","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>","Cc":"Arducam info <info@arducam.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20658,"web_url":"https://patchwork.libcamera.org/comment/20658/","msgid":"<CAEmqJPqP71uM9ixcfD6zZbQmud_oYE6SoNcnsF=vxJ5pkrG5tA@mail.gmail.com>","date":"2021-11-02T11:23:05","subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Kieran,\n\nOn Tue, 2 Nov 2021 at 11:19, Kieran Bingham <kieran.bingham@ideasonboard.com>\nwrote:\n\n> Quoting Kieran Bingham (2021-10-21 10:38:20)\n> > Hi Lee, David,\n> >\n> > Quoting David Plowman (2021-10-20 14:23:34)\n> > > From: Arducam info <info@arducam.com>\n> > >\n> > > The necessary tuning file and CamHelper is added for the imx519 sensor.\n> > >\n> > > The imx519 is a 16MP rolling shutter sensor. To enable\n> > > it, please add\n> > >\n> > > dtoverlay=imx519\n> > >\n> >\n> > Great, I'm glad to see new sensor support progressing.\n> >\n> > For this patch:\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> > I see the imx519 is integrated into the Raspberry Pi kernel, who will\n> > take this forward and post to the linux-media to get it intgrated into\n> > the kernel directly?\n>\n> Excellent, with\n>  [PATCH 1/2] dt-bindings: media: i2c: Add IMX519 CMOS sensor binding\n>\n> https://lore.kernel.org/linux-media/38FCC5C9-9D03-4C8B-9ADF-896AE2BD90DE@arducam.com/T/#u\n> and\n>  [PATCH 2/2] media: i2c: Add driver for IMX519 sensor\n>\n> https://lore.kernel.org/linux-media/DBFF7F52-B763-4D54-8DC9-10508ECC7BD2@arducam.com/T/#u\n>\n> posted, I think we should get this integrated into libcamera now.\n>\n> David/Naush - I'm not able to test this. Is this fine to go in as it is?\n>\n\nYup, happy to have this merged now.\n\n\n> Any impacts on the recent MC series, or anything else?\n>\n\nThere should not be any conflicts/impact with the MC series, which\nincidentally is good to go as well :-)\n\nRegards,\nNaush\n\n\n\n>\n> --\n> Kieran\n>\n>\n> >\n> > --\n> > Kieran\n> >\n> > > to the /boot/config.txt file and reboot the Pi.\n> > >\n> > > Signed-off-by: Lee Jackson <info@arducam.com>\n> > > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> > >\n> > > ---\n> > >  src/ipa/raspberrypi/cam_helper_imx519.cpp | 185 ++++++++++++\n> > >  src/ipa/raspberrypi/data/imx519.json      | 338 ++++++++++++++++++++++\n> > >  src/ipa/raspberrypi/data/meson.build      |   1 +\n> > >  src/ipa/raspberrypi/meson.build           |   1 +\n> > >  4 files changed, 525 insertions(+)\n> > >  create mode 100644 src/ipa/raspberrypi/cam_helper_imx519.cpp\n> > >  create mode 100644 src/ipa/raspberrypi/data/imx519.json\n> > >\n> > > diff --git a/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> > > new file mode 100644\n> > > index 00000000..eaf24982\n> > > --- /dev/null\n> > > +++ b/src/ipa/raspberrypi/cam_helper_imx519.cpp\n> > > @@ -0,0 +1,185 @@\n> > > +/* SPDX-License-Identifier: BSD-2-Clause */\n> > > +/*\n> > > + * Based on cam_helper_imx477.cpp\n> > > + * Copyright (C) 2020, Raspberry Pi (Trading) Limited\n> > > + *\n> > > + * cam_helper_imx519.cpp - camera helper for imx519 sensor\n> > > + * Copyright (C) 2021, Arducam Technology co., Ltd.\n> > > + */\n> > > +\n> > > +#include <assert.h>\n> > > +#include <cmath>\n> > > +#include <stddef.h>\n> > > +#include <stdio.h>\n> > > +#include <stdlib.h>\n> > > +\n> > > +#include <libcamera/base/log.h>\n> > > +\n> > > +#include \"cam_helper.hpp\"\n> > > +#include \"md_parser.hpp\"\n> > > +\n> > > +using namespace RPiController;\n> > > +using namespace libcamera;\n> > > +using libcamera::utils::Duration;\n> > > +\n> > > +namespace libcamera {\n> > > +LOG_DECLARE_CATEGORY(IPARPI)\n> > > +}\n> > > +\n> > > +/*\n> > > + * We care about two gain registers and a pair of exposure registers.\n> Their\n> > > + * I2C addresses from the Sony IMX519 datasheet:\n> > > + */\n> > > +constexpr uint32_t expHiReg = 0x0202;\n> > > +constexpr uint32_t expLoReg = 0x0203;\n> > > +constexpr uint32_t gainHiReg = 0x0204;\n> > > +constexpr uint32_t gainLoReg = 0x0205;\n> > > +constexpr uint32_t frameLengthHiReg = 0x0340;\n> > > +constexpr uint32_t frameLengthLoReg = 0x0341;\n> > > +constexpr std::initializer_list<uint32_t> registerList =\n> > > +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg,\n> frameLengthLoReg  };\n> > > +\n> > > +class CamHelperImx519 : public CamHelper\n> > > +{\n> > > +public:\n> > > +       CamHelperImx519();\n> > > +       uint32_t GainCode(double gain) const override;\n> > > +       double Gain(uint32_t gain_code) const override;\n> > > +       void Prepare(libcamera::Span<const uint8_t> buffer, Metadata\n> &metadata) override;\n> > > +       uint32_t GetVBlanking(Duration &exposure, Duration\n> minFrameDuration,\n> > > +                             Duration maxFrameDuration) const\n> override;\n> > > +       void GetDelays(int &exposure_delay, int &gain_delay,\n> > > +                      int &vblank_delay) const override;\n> > > +       bool SensorEmbeddedDataPresent() const override;\n> > > +\n> > > +private:\n> > > +       /*\n> > > +        * Smallest difference between the frame length and\n> integration time,\n> > > +        * in units of lines.\n> > > +        */\n> > > +       static constexpr int frameIntegrationDiff = 32;\n> > > +       /* Maximum frame length allowable for long exposure\n> calculations. */\n> > > +       static constexpr int frameLengthMax = 0xffdc;\n> > > +       /* Largest long exposure scale factor given as a left shift on\n> the frame length. */\n> > > +       static constexpr int longExposureShiftMax = 7;\n> > > +\n> > > +       void PopulateMetadata(const MdParser::RegisterMap &registers,\n> > > +                             Metadata &metadata) const override;\n> > > +};\n> > > +\n> > > +CamHelperImx519::CamHelperImx519()\n> > > +       : CamHelper(std::make_unique<MdParserSmia>(registerList),\n> frameIntegrationDiff)\n> > > +{\n> > > +}\n> > > +\n> > > +uint32_t CamHelperImx519::GainCode(double gain) const\n> > > +{\n> > > +       return static_cast<uint32_t>(1024 - 1024 / gain);\n> > > +}\n> > > +\n> > > +double CamHelperImx519::Gain(uint32_t gain_code) const\n> > > +{\n> > > +       return 1024.0 / (1024 - gain_code);\n> > > +}\n> > > +\n> > > +void CamHelperImx519::Prepare(libcamera::Span<const uint8_t> buffer,\n> Metadata &metadata)\n> > > +{\n> > > +       MdParser::RegisterMap registers;\n> > > +       DeviceStatus deviceStatus;\n> > > +\n> > > +       if (metadata.Get(\"device.status\", deviceStatus)) {\n> > > +               LOG(IPARPI, Error) << \"DeviceStatus not found from\n> DelayedControls\";\n> > > +               return;\n> > > +       }\n> > > +\n> > > +       parseEmbeddedData(buffer, metadata);\n> > > +\n> > > +       /*\n> > > +        * The DeviceStatus struct is first populated with values\n> obtained from\n> > > +        * DelayedControls. If this reports frame length is >\n> frameLengthMax,\n> > > +        * it means we are using a long exposure mode. Since the long\n> exposure\n> > > +        * scale factor is not returned back through embedded data, we\n> must rely\n> > > +        * on the existing exposure lines and frame length values\n> returned by\n> > > +        * DelayedControls.\n> > > +        *\n> > > +        * Otherwise, all values are updated with what is reported in\n> the\n> > > +        * embedded data.\n> > > +        */\n> > > +       if (deviceStatus.frame_length > frameLengthMax) {\n> > > +               DeviceStatus parsedDeviceStatus;\n> > > +\n> > > +               metadata.Get(\"device.status\", parsedDeviceStatus);\n> > > +               parsedDeviceStatus.shutter_speed =\n> deviceStatus.shutter_speed;\n> > > +               parsedDeviceStatus.frame_length =\n> deviceStatus.frame_length;\n> > > +               metadata.Set(\"device.status\", parsedDeviceStatus);\n> > > +\n> > > +               LOG(IPARPI, Debug) << \"Metadata updated for long\n> exposure: \"\n> > > +                                  << parsedDeviceStatus;\n> > > +       }\n> > > +}\n> > > +\n> > > +uint32_t CamHelperImx519::GetVBlanking(Duration &exposure,\n> > > +                                      Duration minFrameDuration,\n> > > +                                      Duration maxFrameDuration) const\n> > > +{\n> > > +       uint32_t frameLength, exposureLines;\n> > > +       unsigned int shift = 0;\n> > > +\n> > > +       frameLength = mode_.height + CamHelper::GetVBlanking(exposure,\n> minFrameDuration,\n> > > +\n> maxFrameDuration);\n> > > +       /*\n> > > +        * Check if the frame length calculated needs to be setup for\n> long\n> > > +        * exposure mode. This will require us to use a long exposure\n> scale\n> > > +        * factor provided by a shift operation in the sensor.\n> > > +        */\n> > > +       while (frameLength > frameLengthMax) {\n> > > +               if (++shift > longExposureShiftMax) {\n> > > +                       shift = longExposureShiftMax;\n> > > +                       frameLength = frameLengthMax;\n> > > +                       break;\n> > > +               }\n> > > +               frameLength >>= 1;\n> > > +       }\n> > > +\n> > > +       if (shift) {\n> > > +               /* Account for any rounding in the scaled frame length\n> value. */\n> > > +               frameLength <<= shift;\n> > > +               exposureLines = ExposureLines(exposure);\n> > > +               exposureLines = std::min(exposureLines, frameLength -\n> frameIntegrationDiff);\n> > > +               exposure = Exposure(exposureLines);\n> > > +       }\n> > > +\n> > > +       return frameLength - mode_.height;\n> > > +}\n> > > +\n> > > +void CamHelperImx519::GetDelays(int &exposure_delay, int &gain_delay,\n> > > +                               int &vblank_delay) const\n> > > +{\n> > > +       exposure_delay = 2;\n> > > +       gain_delay = 2;\n> > > +       vblank_delay = 3;\n> > > +}\n> > > +\n> > > +bool CamHelperImx519::SensorEmbeddedDataPresent() const\n> > > +{\n> > > +       return true;\n> > > +}\n> > > +\n> > > +void CamHelperImx519::PopulateMetadata(const MdParser::RegisterMap\n> &registers,\n> > > +                                      Metadata &metadata) const\n> > > +{\n> > > +       DeviceStatus deviceStatus;\n> > > +\n> > > +       deviceStatus.shutter_speed = Exposure(registers.at(expHiReg)\n> * 256 + registers.at(expLoReg));\n> > > +       deviceStatus.analogue_gain = Gain(registers.at(gainHiReg) *\n> 256 + registers.at(gainLoReg));\n> > > +       deviceStatus.frame_length = registers.at(frameLengthHiReg) *\n> 256 + registers.at(frameLengthLoReg);\n> > > +\n> > > +       metadata.Set(\"device.status\", deviceStatus);\n> > > +}\n> > > +\n> > > +static CamHelper *Create()\n> > > +{\n> > > +       return new CamHelperImx519();\n> > > +}\n> > > +\n> > > +static RegisterCamHelper reg(\"imx519\", &Create);\n> > > diff --git a/src/ipa/raspberrypi/data/imx519.json\n> b/src/ipa/raspberrypi/data/imx519.json\n> > > new file mode 100644\n> > > index 00000000..164d0d9d\n> > > --- /dev/null\n> > > +++ b/src/ipa/raspberrypi/data/imx519.json\n> > > @@ -0,0 +1,338 @@\n> > > +{\n> > > +    \"rpi.black_level\":\n> > > +    {\n> > > +        \"black_level\": 4096\n> > > +    },\n> > > +    \"rpi.dpc\":\n> > > +    {\n> > > +    },\n> > > +    \"rpi.lux\":\n> > > +    {\n> > > +        \"reference_shutter_speed\": 13841,\n> > > +        \"reference_gain\": 2.0,\n> > > +        \"reference_aperture\": 1.0,\n> > > +        \"reference_lux\": 900,\n> > > +        \"reference_Y\": 12064\n> > > +    },\n> > > +    \"rpi.noise\":\n> > > +    {\n> > > +        \"reference_constant\": 0,\n> > > +        \"reference_slope\": 2.776\n> > > +    },\n> > > +    \"rpi.geq\":\n> > > +    {\n> > > +        \"offset\": 189,\n> > > +        \"slope\": 0.01495\n> > > +    },\n> > > +    \"rpi.sdn\":\n> > > +    {\n> > > +    },\n> > > +    \"rpi.awb\":\n> > > +    {\n> > > +        \"priors\":\n> > > +        [\n> > > +            {\n> > > +                \"lux\": 0, \"prior\":\n> > > +                [\n> > > +                    2000, 1.0, 3000, 0.0, 13000, 0.0\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"lux\": 800, \"prior\":\n> > > +                [\n> > > +                    2000, 0.0, 6000, 2.0, 13000, 2.0\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"lux\": 1500, \"prior\":\n> > > +                [\n> > > +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000,\n> 1.0, 13000, 1.0\n> > > +                ]\n> > > +            }\n> > > +        ],\n> > > +        \"modes\":\n> > > +        {\n> > > +            \"auto\":\n> > > +            {\n> > > +                \"lo\": 2500,\n> > > +                \"hi\": 7900\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\": 8000\n> > > +            }\n> > > +        },\n> > > +        \"bayes\": 1,\n> > > +        \"ct_curve\":\n> > > +        [\n> > > +            2890.0, 0.7328, 0.3734, 3550.0, 0.6228, 0.4763, 4500.0,\n> 0.5208, 0.5825, 5700.0, 0.4467, 0.6671, 7900.0, 0.3858, 0.7411\n> > > +        ],\n> > > +        \"sensitivity_r\": 1.0,\n> > > +        \"sensitivity_b\": 1.0,\n> > > +        \"transverse_pos\": 0.02027,\n> > > +        \"transverse_neg\": 0.01935\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\":\n> > > +                [\n> > > +                    100, 10000, 30000, 60000, 120000\n> > > +                ],\n> > > +                \"gain\":\n> > > +                [\n> > > +                    1.0, 2.0, 4.0, 6.0, 6.0\n> > > +                ]\n> > > +            },\n> > > +            \"short\":\n> > > +            {\n> > > +                \"shutter\":\n> > > +                [\n> > > +                    100, 5000, 10000, 20000, 120000\n> > > +                ],\n> > > +                \"gain\":\n> > > +                [\n> > > +                    1.0, 2.0, 4.0, 6.0, 6.0\n> > > +                ]\n> > > +            }\n> > > +        },\n> > > +        \"constraint_modes\":\n> > > +        {\n> > > +            \"normal\":\n> > > +            [\n> > > +                {\n> > > +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> > > +                    [\n> > > +                        0, 0.5, 1000, 0.5\n> > > +                    ]\n> > > +                }\n> > > +            ],\n> > > +            \"highlight\":\n> > > +            [\n> > > +                {\n> > > +                    \"bound\": \"LOWER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> > > +                    [\n> > > +                        0, 0.5, 1000, 0.5\n> > > +                    ]\n> > > +                },\n> > > +                {\n> > > +                    \"bound\": \"UPPER\", \"q_lo\": 0.98, \"q_hi\": 1.0,\n> \"y_target\":\n> > > +                    [\n> > > +                        0, 0.8, 1000, 0.8\n> > > +                    ]\n> > > +                }\n> > > +            ]\n> > > +        },\n> > > +        \"y_target\":\n> > > +        [\n> > > +            0, 0.16, 1000, 0.165, 10000, 0.17\n> > > +        ]\n> > > +    },\n> > > +    \"rpi.alsc\":\n> > > +    {\n> > > +        \"omega\": 1.3,\n> > > +        \"n_iter\": 100,\n> > > +        \"luminance_strength\": 0.5,\n> > > +        \"calibrations_Cr\":\n> > > +        [\n> > > +            {\n> > > +                \"ct\": 3000, \"table\":\n> > > +                [\n> > > +                    1.527, 1.521, 1.508, 1.493, 1.476, 1.455, 1.442,\n> 1.441, 1.441, 1.441, 1.448, 1.467, 1.483, 1.494, 1.503, 1.504,\n> > > +                    1.525, 1.513, 1.496, 1.477, 1.461, 1.434, 1.418,\n> 1.409, 1.409, 1.416, 1.429, 1.449, 1.469, 1.485, 1.495, 1.503,\n> > > +                    1.517, 1.506, 1.485, 1.461, 1.434, 1.412, 1.388,\n> 1.376, 1.376, 1.386, 1.405, 1.429, 1.449, 1.471, 1.488, 1.495,\n> > > +                    1.512, 1.496, 1.471, 1.442, 1.412, 1.388, 1.361,\n> 1.344, 1.344, 1.358, 1.384, 1.405, 1.431, 1.456, 1.479, 1.489,\n> > > +                    1.508, 1.488, 1.458, 1.425, 1.393, 1.361, 1.343,\n> 1.322, 1.321, 1.342, 1.358, 1.385, 1.416, 1.445, 1.471, 1.484,\n> > > +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322,\n> 1.318, 1.318, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> > > +                    1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322,\n> 1.313, 1.313, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,\n> > > +                    1.507, 1.485, 1.455, 1.422, 1.387, 1.355, 1.333,\n> 1.319, 1.321, 1.333, 1.351, 1.381, 1.411, 1.441, 1.467, 1.483,\n> > > +                    1.508, 1.489, 1.463, 1.432, 1.401, 1.372, 1.355,\n> 1.333, 1.333, 1.351, 1.369, 1.393, 1.422, 1.448, 1.471, 1.484,\n> > > +                    1.511, 1.494, 1.472, 1.444, 1.416, 1.398, 1.372,\n> 1.361, 1.361, 1.369, 1.393, 1.411, 1.436, 1.458, 1.477, 1.487,\n> > > +                    1.511, 1.496, 1.478, 1.455, 1.436, 1.416, 1.399,\n> 1.391, 1.391, 1.397, 1.411, 1.429, 1.451, 1.466, 1.479, 1.487,\n> > > +                    1.511, 1.495, 1.478, 1.462, 1.448, 1.432, 1.419,\n> 1.419, 1.419, 1.419, 1.429, 1.445, 1.459, 1.471, 1.482, 1.487\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 6000, \"table\":\n> > > +                [\n> > > +                    2.581, 2.573, 2.558, 2.539, 2.514, 2.487, 2.473,\n> 2.471, 2.471, 2.471, 2.479, 2.499, 2.517, 2.532, 2.543, 2.544,\n> > > +                    2.575, 2.559, 2.539, 2.521, 2.491, 2.458, 2.435,\n> 2.421, 2.421, 2.429, 2.449, 2.477, 2.499, 2.519, 2.534, 2.543,\n> > > +                    2.561, 2.549, 2.521, 2.491, 2.457, 2.423, 2.393,\n> 2.375, 2.375, 2.387, 2.412, 2.444, 2.475, 2.499, 2.519, 2.532,\n> > > +                    2.552, 2.531, 2.498, 2.459, 2.423, 2.391, 2.349,\n> 2.325, 2.325, 2.344, 2.374, 2.412, 2.444, 2.476, 2.505, 2.519,\n> > > +                    2.543, 2.518, 2.479, 2.435, 2.392, 2.349, 2.324,\n> 2.285, 2.283, 2.313, 2.344, 2.374, 2.417, 2.457, 2.489, 2.506,\n> > > +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284,\n> 2.277, 2.279, 2.283, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> > > +                    2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284,\n> 2.267, 2.267, 2.281, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,\n> > > +                    2.541, 2.512, 2.472, 2.425, 2.381, 2.338, 2.302,\n> 2.278, 2.279, 2.301, 2.324, 2.364, 2.407, 2.447, 2.481, 2.504,\n> > > +                    2.544, 2.519, 2.483, 2.441, 2.401, 2.363, 2.338,\n> 2.302, 2.302, 2.324, 2.355, 2.385, 2.423, 2.459, 2.488, 2.506,\n> > > +                    2.549, 2.527, 2.497, 2.463, 2.427, 2.401, 2.363,\n> 2.345, 2.345, 2.355, 2.385, 2.412, 2.444, 2.473, 2.497, 2.509,\n> > > +                    2.552, 2.532, 2.507, 2.481, 2.459, 2.427, 2.402,\n> 2.389, 2.389, 2.394, 2.412, 2.444, 2.465, 2.481, 2.499, 2.511,\n> > > +                    2.553, 2.533, 2.508, 2.489, 2.475, 2.454, 2.429,\n> 2.429, 2.429, 2.429, 2.439, 2.463, 2.481, 2.492, 2.504, 2.511\n> > > +                ]\n> > > +            }\n> > > +        ],\n> > > +        \"calibrations_Cb\":\n> > > +        [\n> > > +            {\n> > > +                \"ct\": 3000, \"table\":\n> > > +                [\n> > > +                    3.132, 3.126, 3.116, 3.103, 3.097, 3.091, 3.087,\n> 3.086, 3.088, 3.091, 3.092, 3.102, 3.113, 3.121, 3.141, 3.144,\n> > > +                    3.149, 3.132, 3.123, 3.108, 3.101, 3.096, 3.091,\n> 3.089, 3.091, 3.092, 3.101, 3.107, 3.116, 3.129, 3.144, 3.153,\n> > > +                    3.161, 3.149, 3.129, 3.121, 3.108, 3.103, 3.101,\n> 3.101, 3.101, 3.103, 3.107, 3.116, 3.125, 3.134, 3.153, 3.159,\n> > > +                    3.176, 3.161, 3.144, 3.129, 3.124, 3.121, 3.117,\n> 3.118, 3.118, 3.119, 3.122, 3.125, 3.134, 3.146, 3.159, 3.171,\n> > > +                    3.183, 3.176, 3.157, 3.144, 3.143, 3.143, 3.139,\n> 3.141, 3.141, 3.141, 3.141, 3.141, 3.146, 3.161, 3.171, 3.179,\n> > > +                    3.189, 3.183, 3.165, 3.157, 3.156, 3.157, 3.159,\n> 3.163, 3.163, 3.163, 3.163, 3.161, 3.163, 3.169, 3.179, 3.187,\n> > > +                    3.199, 3.189, 3.171, 3.165, 3.164, 3.167, 3.171,\n> 3.173, 3.173, 3.172, 3.171, 3.169, 3.169, 3.175, 3.187, 3.189,\n> > > +                    3.206, 3.196, 3.177, 3.171, 3.165, 3.167, 3.171,\n> 3.173, 3.173, 3.172, 3.171, 3.171, 3.173, 3.177, 3.192, 3.194,\n> > > +                    3.209, 3.197, 3.178, 3.171, 3.164, 3.161, 3.159,\n> 3.161, 3.162, 3.164, 3.167, 3.171, 3.173, 3.181, 3.193, 3.198,\n> > > +                    3.204, 3.194, 3.176, 3.165, 3.161, 3.156, 3.154,\n> 3.154, 3.159, 3.161, 3.164, 3.168, 3.173, 3.182, 3.198, 3.199,\n> > > +                    3.199, 3.191, 3.176, 3.169, 3.161, 3.157, 3.153,\n> 3.153, 3.156, 3.161, 3.164, 3.168, 3.173, 3.186, 3.196, 3.199,\n> > > +                    3.199, 3.188, 3.179, 3.173, 3.165, 3.157, 3.153,\n> 3.154, 3.156, 3.159, 3.167, 3.171, 3.176, 3.185, 3.193, 3.198\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 6000, \"table\":\n> > > +                [\n> > > +                    1.579, 1.579, 1.577, 1.574, 1.573, 1.571, 1.571,\n> 1.571, 1.571, 1.569, 1.569, 1.571, 1.572, 1.574, 1.577, 1.578,\n> > > +                    1.584, 1.579, 1.578, 1.575, 1.573, 1.572, 1.571,\n> 1.572, 1.572, 1.571, 1.571, 1.572, 1.573, 1.576, 1.578, 1.579,\n> > > +                    1.587, 1.584, 1.579, 1.578, 1.575, 1.573, 1.573,\n> 1.575, 1.575, 1.574, 1.573, 1.574, 1.576, 1.578, 1.581, 1.581,\n> > > +                    1.591, 1.587, 1.584, 1.579, 1.578, 1.579, 1.579,\n> 1.581, 1.581, 1.581, 1.578, 1.577, 1.578, 1.581, 1.585, 1.586,\n> > > +                    1.595, 1.591, 1.587, 1.585, 1.585, 1.586, 1.587,\n> 1.587, 1.588, 1.588, 1.585, 1.584, 1.584, 1.586, 1.589, 1.589,\n> > > +                    1.597, 1.595, 1.591, 1.589, 1.591, 1.593, 1.595,\n> 1.596, 1.597, 1.597, 1.595, 1.594, 1.592, 1.592, 1.593, 1.593,\n> > > +                    1.601, 1.597, 1.593, 1.592, 1.593, 1.595, 1.598,\n> 1.599, 1.602, 1.601, 1.598, 1.596, 1.595, 1.596, 1.595, 1.595,\n> > > +                    1.601, 1.599, 1.594, 1.593, 1.593, 1.595, 1.598,\n> 1.599, 1.602, 1.601, 1.598, 1.597, 1.597, 1.597, 1.597, 1.597,\n> > > +                    1.602, 1.599, 1.594, 1.593, 1.592, 1.593, 1.595,\n> 1.597, 1.597, 1.598, 1.598, 1.597, 1.597, 1.597, 1.598, 1.598,\n> > > +                    1.599, 1.598, 1.594, 1.592, 1.591, 1.591, 1.592,\n> 1.595, 1.596, 1.597, 1.597, 1.597, 1.597, 1.599, 1.599, 1.599,\n> > > +                    1.598, 1.596, 1.594, 1.593, 1.592, 1.592, 1.592,\n> 1.594, 1.595, 1.597, 1.597, 1.597, 1.598, 1.599, 1.599, 1.599,\n> > > +                    1.597, 1.595, 1.594, 1.594, 1.593, 1.592, 1.593,\n> 1.595, 1.595, 1.597, 1.598, 1.598, 1.598, 1.599, 1.599, 1.599\n> > > +                ]\n> > > +            }\n> > > +        ],\n> > > +        \"luminance_lut\":\n> > > +        [\n> > > +            2.887, 2.754, 2.381, 2.105, 1.859, 1.678, 1.625, 1.623,\n> 1.623, 1.624, 1.669, 1.849, 2.092, 2.362, 2.723, 2.838,\n> > > +            2.754, 2.443, 2.111, 1.905, 1.678, 1.542, 1.455, 1.412,\n> 1.412, 1.452, 1.535, 1.665, 1.893, 2.096, 2.413, 2.723,\n> > > +            2.443, 2.216, 1.911, 1.678, 1.537, 1.372, 1.288, 1.245,\n> 1.245, 1.283, 1.363, 1.527, 1.665, 1.895, 2.193, 2.413,\n> > > +            2.318, 2.057, 1.764, 1.541, 1.372, 1.282, 1.159, 1.113,\n> 1.113, 1.151, 1.269, 1.363, 1.527, 1.749, 2.034, 2.278,\n> > > +            2.259, 1.953, 1.671, 1.452, 1.283, 1.159, 1.107, 1.018,\n> 1.017, 1.097, 1.151, 1.269, 1.437, 1.655, 1.931, 2.222,\n> > > +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.019, 1.011,\n> 1.005, 1.014, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> > > +            2.257, 1.902, 1.624, 1.408, 1.239, 1.111, 1.016, 1.001,\n> 1.001, 1.007, 1.098, 1.227, 1.395, 1.608, 1.883, 2.222,\n> > > +            2.257, 1.946, 1.666, 1.448, 1.281, 1.153, 1.093, 1.013,\n> 1.008, 1.089, 1.143, 1.269, 1.437, 1.654, 1.934, 2.226,\n> > > +            2.309, 2.044, 1.756, 1.532, 1.363, 1.259, 1.153, 1.093,\n> 1.093, 1.143, 1.264, 1.354, 1.524, 1.746, 2.035, 2.284,\n> > > +            2.425, 2.201, 1.896, 1.662, 1.519, 1.363, 1.259, 1.214,\n> 1.214, 1.264, 1.354, 1.519, 1.655, 1.888, 2.191, 2.413,\n> > > +            2.724, 2.417, 2.091, 1.888, 1.662, 1.519, 1.419, 1.373,\n> 1.373, 1.425, 1.521, 1.655, 1.885, 2.089, 2.409, 2.722,\n> > > +            2.858, 2.724, 2.356, 2.085, 1.842, 1.658, 1.581, 1.577,\n> 1.577, 1.579, 1.653, 1.838, 2.084, 2.359, 2.722, 2.842\n> > > +        ],\n> > > +        \"sigma\": 0.00372,\n> > > +        \"sigma_Cb\": 0.00244\n> > > +    },\n> > > +    \"rpi.contrast\":\n> > > +    {\n> > > +        \"ce_enable\": 1,\n> > > +        \"gamma_curve\":\n> > > +        [\n> > > +            0, 0, 1024, 5040, 2048, 9338, 3072, 12356, 4096, 15312,\n> 5120, 18051, 6144, 20790, 7168, 23193,\n> > > +            8192, 25744, 9216, 27942, 10240, 30035, 11264, 32005,\n> 12288, 33975, 13312, 35815, 14336, 37600, 15360, 39168,\n> > > +            16384, 40642, 18432, 43379, 20480, 45749, 22528, 47753,\n> 24576, 49621, 26624, 51253, 28672, 52698, 30720, 53796,\n> > > +            32768, 54876, 36864, 57012, 40960, 58656, 45056, 59954,\n> 49152, 61183, 53248, 62355, 57344, 63419, 61440, 64476,\n> > > +            65535, 65535\n> > > +        ]\n> > > +    },\n> > > +    \"rpi.ccm\":\n> > > +    {\n> > > +        \"ccms\":\n> > > +        [\n> > > +            {\n> > > +                \"ct\": 2890, \"ccm\":\n> > > +                [\n> > > +                    1.36754, -0.18448, -0.18306, -0.32356, 1.44826,\n> -0.12471, -0.00412, -0.69936, 1.70348\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 2920, \"ccm\":\n> > > +                [\n> > > +                    1.26704, 0.01624, -0.28328, -0.28516, 1.38934,\n> -0.10419, -0.04854, -0.82211, 1.87066\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 3550, \"ccm\":\n> > > +                [\n> > > +                    1.42836, -0.27235, -0.15601, -0.28751, 1.41075,\n> -0.12325, -0.01812, -0.54849, 1.56661\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 4500, \"ccm\":\n> > > +                [\n> > > +                    1.36328, -0.19569, -0.16759, -0.25254, 1.52248,\n> -0.26994, -0.01575, -0.53155, 1.54729\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 5700, \"ccm\":\n> > > +                [\n> > > +                    1.49207, -0.37245, -0.11963, -0.21493, 1.40005,\n> -0.18512, -0.03781, -0.38779, 1.42561\n> > > +                ]\n> > > +            },\n> > > +            {\n> > > +                \"ct\": 7900, \"ccm\":\n> > > +                [\n> > > +                    1.34849, -0.05425, -0.29424, -0.22182, 1.77684,\n> -0.55502, -0.07403, -0.55336, 1.62739\n> > > +                ]\n> > > +            }\n> > > +        ]\n> > > +    },\n> > > +    \"rpi.sharpen\":\n> > > +    {\n> > > +    }\n> > > +}\n> > > diff --git a/src/ipa/raspberrypi/data/meson.build\n> b/src/ipa/raspberrypi/data/meson.build\n> > > index 2def75cb..e84cd099 100644\n> > > --- a/src/ipa/raspberrypi/data/meson.build\n> > > +++ b/src/ipa/raspberrypi/data/meson.build\n> > > @@ -7,6 +7,7 @@ conf_files = files([\n> > >      'imx378.json',\n> > >      'imx477.json',\n> > >      'imx477_noir.json',\n> > > +    'imx519.json',\n> > >      'ov5647.json',\n> > >      'ov5647_noir.json',\n> > >      'ov9281.json',\n> > > diff --git a/src/ipa/raspberrypi/meson.build\n> b/src/ipa/raspberrypi/meson.build\n> > > index 1af31e4a..176055f4 100644\n> > > --- a/src/ipa/raspberrypi/meson.build\n> > > +++ b/src/ipa/raspberrypi/meson.build\n> > > @@ -22,6 +22,7 @@ rpi_ipa_sources = files([\n> > >      'cam_helper_imx219.cpp',\n> > >      'cam_helper_imx290.cpp',\n> > >      'cam_helper_imx477.cpp',\n> > > +    'cam_helper_imx519.cpp',\n> > >      'cam_helper_ov9281.cpp',\n> > >      'controller/controller.cpp',\n> > >      'controller/histogram.cpp',\n> > > --\n> > > 2.20.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 4B61CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Nov 2021 11:23:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 849876032F;\n\tTue,  2 Nov 2021 12:23:24 +0100 (CET)","from mail-lf1-x134.google.com (mail-lf1-x134.google.com\n\t[IPv6:2a00:1450:4864:20::134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3BD2B600B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Nov 2021 12:23:22 +0100 (CET)","by mail-lf1-x134.google.com with SMTP id f3so34080809lfu.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Nov 2021 04:23:22 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"hAzbccfZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=NjYfk0Do/iYK58A/fwWpA8VCMrJ001dtnxFEcfQoG4I=;\n\tb=hAzbccfZr4/Bo6GRdWZi1YucSsSFjw5ig3rfb8Stv6HOKzZk+PtQTuwA6dQq0Oi+kH\n\tfPDFIC4y1eCNUZQi/+Vd6gXJVBv+AdT3qcbA35O+/csoJGauSfsS/pzC0u4fp21klb+9\n\tHgJ1+7HbRlHUBAhRf1IHptbis6H5RkkXT1xvP3duwlNvKlTUHCWiZlCS8cv0W9JJawzB\n\tW7cCSKfMLyACAvRQL7fsbHImhsEymKiTda2CTR7O9izHHJJ6cSVUueY7DHLgPDZ87DNy\n\tIdV4RH+pJVDuno410GJHADsvwxl4oqQStAFhJgk7oZJfyjYxVu9rRgjQzSEd6sqxmqHs\n\tIJdQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=NjYfk0Do/iYK58A/fwWpA8VCMrJ001dtnxFEcfQoG4I=;\n\tb=RloSLTJ6+pQ7Aii1mL3BaLO5eDdmK2Jrn15fXekDS1VNsDYlTIJorlcCnXuiX57ltt\n\tepknNphMEv/8JsaR4uzLMIY5o9Zh20ZL3f3UTzpnQAYLfHgfh63HZFUzPwRPOU7sH4pV\n\tTgKrIF8H7qVJhpD76btiqSyqWV7ldXwjzfnR8Ru5RtYGBMm9VqR/9cbywyThmYVsjtPd\n\tRXrp8rn2/Igd31YF3lS3tGWY3dIXsldA+1f9CnaGoHNTgQR1f7h4j/HcoHS8yz883kz9\n\tP8tuf8oTUSPLewUrB7PHumishxahVVpNvmfbUNJcKUiT+riN80fsFp6efx7CdVB0T34u\n\t9HSQ==","X-Gm-Message-State":"AOAM530UUxLMxggKdZ1vTjfnJoTsGX6avZymIICZklt4pVEzq4322b3Y\n\tltIig7lT1zeMqzyfZemxyai1+TZOs47/mlf1I55hyw==","X-Google-Smtp-Source":"ABdhPJyaYozyAiD0MDVv75cBfGVydibt1fA2O7skBlWROB5Mv8svGtFpPiGEiyfE7uWOGf8I4G4at5sqeT/pfFhphfE=","X-Received":"by 2002:a05:6512:3144:: with SMTP id\n\ts4mr33093330lfi.108.1635852201264; \n\tTue, 02 Nov 2021 04:23:21 -0700 (PDT)","MIME-Version":"1.0","References":"<20211020132334.2199-1-david.plowman@raspberrypi.com>\n\t<20211020132334.2199-2-david.plowman@raspberrypi.com>\n\t<163480910079.2663858.14277654487177505675@Monstersaurus>\n\t<163585196967.1097798.9290683661641464035@Monstersaurus>","In-Reply-To":"<163585196967.1097798.9290683661641464035@Monstersaurus>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 2 Nov 2021 11:23:05 +0000","Message-ID":"<CAEmqJPqP71uM9ixcfD6zZbQmud_oYE6SoNcnsF=vxJ5pkrG5tA@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000005c9a1d05cfcc85ca\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] libcamera: ipa: raspberrypi:\n\tAdd support for imx519 sensor","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tArducam info <info@arducam.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]