[libcamera-devel,1/1] ipa: raspberrypi: Update imx296 tuning file
diff mbox series

Message ID 20220714094143.4399-2-william.vinnicombe@raspberrypi.com
State Superseded
Headers show
Series
  • Update imx296 Tuning File
Related show

Commit Message

Nicolas Dufresne via libcamera-devel July 14, 2022, 9:41 a.m. UTC
From: William Vinnicombe <william.vinnicombe@raspberrypi.com>

The previous tuning values for the imx296 are not accurate, and do not
contain awb parameters.

Update the tuning file using the raspberrypi ctt tool to give accurate
values, and all required parameters.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
---
 src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
 1 file changed, 217 insertions(+), 51 deletions(-)

Comments

Naushir Patuck July 14, 2022, 9:45 a.m. UTC | #1
Hi William,

Thank you for your patch.

On Thu, 14 Jul 2022 at 10:42, William Vinnicombe via libcamera-devel <
libcamera-devel@lists.libcamera.org> wrote:

> From: William Vinnicombe <william.vinnicombe@raspberrypi.com>
>
> The previous tuning values for the imx296 are not accurate, and do not
> contain awb parameters.
>
> Update the tuning file using the raspberrypi ctt tool to give accurate
> values, and all required parameters.
>
> Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
>

Looks good!

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>



> ---
>  src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
>  1 file changed, 217 insertions(+), 51 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/data/imx296.json
> b/src/ipa/raspberrypi/data/imx296.json
> index 837feff5..4d9d0e8b 100644
> --- a/src/ipa/raspberrypi/data/imx296.json
> +++ b/src/ipa/raspberrypi/data/imx296.json
> @@ -8,25 +8,97 @@
>      },
>      "rpi.lux":
>      {
> -        "reference_shutter_speed": 19184,
> -        "reference_gain": 1.0,
> +        "reference_shutter_speed": 17895,
> +        "reference_gain": 1.99,
>          "reference_aperture": 1.0,
> -        "reference_lux": 432,
> -        "reference_Y": 13773
> +        "reference_lux": 1147,
> +        "reference_Y": 13348
>      },
>      "rpi.noise":
>      {
> -        "reference_constant": 0,
> -        "reference_slope": 2.957
> +        "reference_constant": 1,
> +        "reference_slope": 2.631
>      },
>      "rpi.geq":
>      {
> -        "offset": 185,
> -        "slope": 0.0105
> +        "offset": 182,
> +        "slope": 0.0127
>      },
>      "rpi.sdn":
>      {
>      },
> +    "rpi.awb":
> +    {
> +        "priors":
> +        [
> +            {
> +                "lux": 0, "prior":
> +                [
> +                    2000, 1.0, 3000, 0.0, 13000, 0.0
> +                ]
> +            },
> +            {
> +                "lux": 800, "prior":
> +                [
> +                    2000, 0.0, 6000, 2.0, 13000, 2.0
> +                ]
> +            },
> +            {
> +                "lux": 1500, "prior":
> +                [
> +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000,
> 1.0, 13000, 1.0
> +                ]
> +            }
> +        ],
> +        "modes":
> +        {
> +            "auto":
> +            {
> +                "lo": 2500,
> +                "hi": 8000
> +            },
> +            "incandescent":
> +            {
> +                "lo": 2500,
> +                "hi": 3000
> +            },
> +            "tungsten":
> +            {
> +                "lo": 3000,
> +                "hi": 3500
> +            },
> +            "fluorescent":
> +            {
> +                "lo": 4000,
> +                "hi": 4700
> +            },
> +            "indoor":
> +            {
> +                "lo": 3000,
> +                "hi": 5000
> +            },
> +            "daylight":
> +            {
> +                "lo": 5500,
> +                "hi": 6500
> +            },
> +            "cloudy":
> +            {
> +                "lo": 7000,
> +                "hi": 8600
> +            }
> +        },
> +        "bayes": 1,
> +        "ct_curve":
> +        [
> +            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0,
> 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
> +            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789, 0.6527
> +        ],
> +        "sensitivity_r": 1.0,
> +        "sensitivity_b": 1.0,
> +        "transverse_pos": 0.02994,
> +        "transverse_neg": 0.04332
> +    },
>      "rpi.agc":
>      {
>          "metering_modes":
> @@ -113,65 +185,99 @@
>      "rpi.alsc":
>      {
>          "omega": 1.3,
> -        "n_iter": 0,
> +        "n_iter": 100,
>          "luminance_strength": 0.5,
>          "calibrations_Cr":
>          [
>              {
> -                "ct": 4000, "table":
> -                [
> -                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516,
> 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
> -                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506,
> 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
> -                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517,
> 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
> -                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519,
> 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
> -                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539,
> 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
> -                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546,
> 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
> -                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543,
> 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
> -                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543,
> 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
> -                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539,
> 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
> -                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509,
> 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
> -                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508,
> 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
> -                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514,
> 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
> +                "ct": 2943, "table":
> +                [
> +                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
> +                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153,
> 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> +                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> +                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152,
> 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
> +                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151,
> 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
> +                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151,
> 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
> +                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
> +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
> +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
> +                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> +                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> +                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151,
> 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
> +                ]
> +            },
> +            {
> +                "ct": 6097, "table":
> +                [
> +                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603,
> 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
> +                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606,
> 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
> +                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608,
> 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
> +                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603,
> 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
> +                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599,
> 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
> +                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599,
> 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
> +                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599,
> 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
> +                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599,
> 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
> +                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601,
> 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
> +                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608,
> 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
> +                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608,
> 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
> +                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604,
> 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
>                  ]
>              }
>          ],
>          "calibrations_Cb":
>          [
>              {
> -                "ct": 4000, "table":
> -                [
> -                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589,
> 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
> -                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591,
> 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
> -                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593,
> 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
> -                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597,
> 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
> -                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612,
> 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
> -                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629,
> 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
> -                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636,
> 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
> -                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632,
> 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
> -                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624,
> 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
> -                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616,
> 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
> -                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615,
> 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
> -                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621,
> 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
> +                "ct": 2943, "table":
> +                [
> +                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401,
> 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
> +                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403,
> 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
> +                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403,
> 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
> +                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402,
> 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
> +                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401,
> 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
> +                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401,
> 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
> +                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399,
> 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
> +                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397,
> 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
> +                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394,
> 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
> +                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391,
> 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
> +                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385,
> 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
> +                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374,
> 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
> +                ]
> +            },
> +            {
> +                "ct": 6097, "table":
> +                [
> +                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671,
> 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
> +                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672,
> 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
> +                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673,
> 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
> +                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673,
> 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
> +                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673,
> 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
> +                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672,
> 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
> +                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672,
> 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
> +                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672,
> 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
> +                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669,
> 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
> +                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668,
> 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
> +                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664,
> 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
> +                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659,
> 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
>                  ]
>              }
>          ],
>          "luminance_lut":
>          [
> -            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082,
> 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
> -            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077,
> 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
> -            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088,
> 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
> -            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112,
> 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
> -            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138,
> 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
> -            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157,
> 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
> -            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174,
> 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
> -            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187,
> 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
> -            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194,
> 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
> -            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197,
> 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
> -            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193,
> 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
> -            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188,
> 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
> +            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062,
> 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
> +            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062,
> 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
> +            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062,
> 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
> +            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059,
> 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
> +            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054,
> 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
> +            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049,
> 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
> +            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043,
> 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
> +            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039,
> 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
> +            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035,
> 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
> +            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032,
> 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
> +            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027,
> 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
> +            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021,
> 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
>          ],
> -        "sigma": 0.005,
> -        "sigma_Cb": 0.005
> +        "sigma": 0.00063,
> +        "sigma_Cb": 0.00089
>      },
>      "rpi.contrast":
>      {
> @@ -185,6 +291,66 @@
>              65535, 65535
>          ]
>      },
> +    "rpi.ccm":
> +    {
> +        "ccms":
> +        [
> +            {
> +                "ct": 2861, "ccm":
> +                [
> +                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738,
> -0.18503, 0.07817, -0.77121, 1.69304
> +                ]
> +            },
> +            {
> +                "ct": 2915, "ccm":
> +                [
> +                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118,
> -0.20869, 0.08973, -0.78375, 1.69402
> +                ]
> +            },
> +            {
> +                "ct": 2916, "ccm":
> +                [
> +                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627,
> -0.07646, -0.00104, -0.62299, 1.62404
> +                ]
> +            },
> +            {
> +                "ct": 2922, "ccm":
> +                [
> +                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084,
> -0.08813, 0.01453, -0.65247, 1.63794
> +                ]
> +            },
> +            {
> +                "ct": 2934, "ccm":
> +                [
> +                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129,
> -0.08981, 0.01142, -0.64365, 1.63224
> +                ]
> +            },
> +            {
> +                "ct": 3626, "ccm":
> +                [
> +                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135,
> -0.21895, 0.05845, -0.66941, 1.61096
> +                ]
> +            },
> +            {
> +                "ct": 4617, "ccm":
> +                [
> +                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915,
> -0.40287, 0.07878, -0.73116, 1.65238
> +                ]
> +            },
> +            {
> +                "ct": 5674, "ccm":
> +                [
> +                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994,
> -0.33998, 0.04474, -0.61721, 1.57247
> +                ]
> +            },
> +            {
> +                "ct": 7617, "ccm":
> +                [
> +                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915,
> -0.62645, 0.07635, -1.01009, 1.93374
> +                ]
> +            }
> +        ]
> +    },
>      "rpi.sharpen":
>      {
>      }
> --
> 2.25.1
>
>
Laurent Pinchart July 15, 2022, 12:14 a.m. UTC | #2
Hi William,

Thank you for the patch.

On Thu, Jul 14, 2022 at 10:41:43AM +0100, William Vinnicombe via libcamera-devel wrote:
> From: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> 
> The previous tuning values for the imx296 are not accurate, and do not
> contain awb parameters.

There was a reason for that though, the file was meant for the
monochrome version of the sensor. See [1] for the full context. I'm
actually aware of one user of this tuning file with a monochrome sensor,
and this patch will break this use case.

This brings nack the question that we decided to leave unanswered when
the imx296.json file was merged: how do we deal with different modules
that integrated the same camera sensor ?

[1] https://lists.libcamera.org/pipermail/libcamera-devel/2022-January/028756.html

> Update the tuning file using the raspberrypi ctt tool to give accurate
> values, and all required parameters.
> 
> Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
>  1 file changed, 217 insertions(+), 51 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296.json
> index 837feff5..4d9d0e8b 100644
> --- a/src/ipa/raspberrypi/data/imx296.json
> +++ b/src/ipa/raspberrypi/data/imx296.json
> @@ -8,25 +8,97 @@
>      },
>      "rpi.lux":
>      {
> -        "reference_shutter_speed": 19184,
> -        "reference_gain": 1.0,
> +        "reference_shutter_speed": 17895,
> +        "reference_gain": 1.99,
>          "reference_aperture": 1.0,
> -        "reference_lux": 432,
> -        "reference_Y": 13773
> +        "reference_lux": 1147,
> +        "reference_Y": 13348
>      },
>      "rpi.noise":
>      {
> -        "reference_constant": 0,
> -        "reference_slope": 2.957
> +        "reference_constant": 1,
> +        "reference_slope": 2.631
>      },
>      "rpi.geq":
>      {
> -        "offset": 185,
> -        "slope": 0.0105
> +        "offset": 182,
> +        "slope": 0.0127
>      },
>      "rpi.sdn":
>      {
>      },
> +    "rpi.awb":
> +    {
> +        "priors":
> +        [
> +            {
> +                "lux": 0, "prior":
> +                [
> +                    2000, 1.0, 3000, 0.0, 13000, 0.0
> +                ]
> +            },
> +            {
> +                "lux": 800, "prior":
> +                [
> +                    2000, 0.0, 6000, 2.0, 13000, 2.0
> +                ]
> +            },
> +            {
> +                "lux": 1500, "prior":
> +                [
> +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0
> +                ]
> +            }
> +        ],
> +        "modes":
> +        {
> +            "auto":
> +            {
> +                "lo": 2500,
> +                "hi": 8000
> +            },
> +            "incandescent":
> +            {
> +                "lo": 2500,
> +                "hi": 3000
> +            },
> +            "tungsten":
> +            {
> +                "lo": 3000,
> +                "hi": 3500
> +            },
> +            "fluorescent":
> +            {
> +                "lo": 4000,
> +                "hi": 4700
> +            },
> +            "indoor":
> +            {
> +                "lo": 3000,
> +                "hi": 5000
> +            },
> +            "daylight":
> +            {
> +                "lo": 5500,
> +                "hi": 6500
> +            },
> +            "cloudy":
> +            {
> +                "lo": 7000,
> +                "hi": 8600
> +            }
> +        },
> +        "bayes": 1,
> +        "ct_curve":
> +        [
> +            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0, 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
> +            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789, 0.6527
> +        ],
> +        "sensitivity_r": 1.0,
> +        "sensitivity_b": 1.0,
> +        "transverse_pos": 0.02994,
> +        "transverse_neg": 0.04332
> +    },
>      "rpi.agc":
>      {
>          "metering_modes":
> @@ -113,65 +185,99 @@
>      "rpi.alsc":
>      {
>          "omega": 1.3,
> -        "n_iter": 0,
> +        "n_iter": 100,
>          "luminance_strength": 0.5,
>          "calibrations_Cr":
>          [
>              {
> -                "ct": 4000, "table":
> -                [
> -                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516, 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
> -                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506, 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
> -                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517, 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
> -                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519, 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
> -                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539, 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
> -                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546, 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
> -                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543, 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
> -                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543, 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
> -                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539, 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
> -                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509, 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
> -                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508, 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
> -                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514, 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
> +                "ct": 2943, "table":
> +                [
> +                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
> +                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> +                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> +                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
> +                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
> +                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
> +                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
> +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
> +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
> +                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> +                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> +                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151, 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
> +                ]
> +            },
> +            {
> +                "ct": 6097, "table":
> +                [
> +                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603, 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
> +                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606, 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
> +                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608, 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
> +                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603, 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
> +                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599, 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
> +                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599, 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
> +                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599, 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
> +                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599, 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
> +                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601, 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
> +                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608, 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
> +                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608, 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
> +                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604, 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
>                  ]
>              }
>          ],
>          "calibrations_Cb":
>          [
>              {
> -                "ct": 4000, "table":
> -                [
> -                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589, 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
> -                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591, 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
> -                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593, 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
> -                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597, 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
> -                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612, 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
> -                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629, 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
> -                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636, 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
> -                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632, 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
> -                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624, 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
> -                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616, 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
> -                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615, 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
> -                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621, 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
> +                "ct": 2943, "table":
> +                [
> +                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401, 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
> +                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403, 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
> +                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403, 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
> +                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402, 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
> +                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401, 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
> +                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401, 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
> +                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399, 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
> +                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397, 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
> +                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394, 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
> +                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391, 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
> +                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385, 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
> +                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374, 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
> +                ]
> +            },
> +            {
> +                "ct": 6097, "table":
> +                [
> +                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671, 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
> +                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672, 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
> +                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673, 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
> +                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673, 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
> +                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673, 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
> +                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
> +                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
> +                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672, 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
> +                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669, 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
> +                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668, 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
> +                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664, 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
> +                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659, 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
>                  ]
>              }
>          ],
>          "luminance_lut":
>          [
> -            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082, 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
> -            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077, 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
> -            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088, 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
> -            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112, 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
> -            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138, 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
> -            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157, 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
> -            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174, 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
> -            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187, 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
> -            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194, 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
> -            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197, 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
> -            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193, 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
> -            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188, 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
> +            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062, 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
> +            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062, 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
> +            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062, 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
> +            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059, 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
> +            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054, 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
> +            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049, 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
> +            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043, 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
> +            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039, 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
> +            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035, 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
> +            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032, 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
> +            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027, 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
> +            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021, 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
>          ],
> -        "sigma": 0.005,
> -        "sigma_Cb": 0.005
> +        "sigma": 0.00063,
> +        "sigma_Cb": 0.00089
>      },
>      "rpi.contrast":
>      {
> @@ -185,6 +291,66 @@
>              65535, 65535
>          ]
>      },
> +    "rpi.ccm":
> +    {
> +        "ccms":
> +        [
> +            {
> +                "ct": 2861, "ccm":
> +                [
> +                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738, -0.18503, 0.07817, -0.77121, 1.69304
> +                ]
> +            },
> +            {
> +                "ct": 2915, "ccm":
> +                [
> +                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118, -0.20869, 0.08973, -0.78375, 1.69402
> +                ]
> +            },
> +            {
> +                "ct": 2916, "ccm":
> +                [
> +                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627, -0.07646, -0.00104, -0.62299, 1.62404
> +                ]
> +            },
> +            {
> +                "ct": 2922, "ccm":
> +                [
> +                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084, -0.08813, 0.01453, -0.65247, 1.63794
> +                ]
> +            },
> +            {
> +                "ct": 2934, "ccm":
> +                [
> +                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129, -0.08981, 0.01142, -0.64365, 1.63224
> +                ]
> +            },
> +            {
> +                "ct": 3626, "ccm":
> +                [
> +                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135, -0.21895, 0.05845, -0.66941, 1.61096
> +                ]
> +            },
> +            {
> +                "ct": 4617, "ccm":
> +                [
> +                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915, -0.40287, 0.07878, -0.73116, 1.65238
> +                ]
> +            },
> +            {
> +                "ct": 5674, "ccm":
> +                [
> +                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994, -0.33998, 0.04474, -0.61721, 1.57247
> +                ]
> +            },
> +            {
> +                "ct": 7617, "ccm":
> +                [
> +                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915, -0.62645, 0.07635, -1.01009, 1.93374
> +                ]
> +            }
> +        ]
> +    },
>      "rpi.sharpen":
>      {
>      }
Naushir Patuck July 15, 2022, 7:24 a.m. UTC | #3
Hi Laurent,

On Fri, 15 Jul 2022 at 01:14, Laurent Pinchart via libcamera-devel <
libcamera-devel@lists.libcamera.org> wrote:

> Hi William,
>
> Thank you for the patch.
>
> On Thu, Jul 14, 2022 at 10:41:43AM +0100, William Vinnicombe via
> libcamera-devel wrote:
> > From: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> >
> > The previous tuning values for the imx296 are not accurate, and do not
> > contain awb parameters.
>
> There was a reason for that though, the file was meant for the
> monochrome version of the sensor. See [1] for the full context. I'm
> actually aware of one user of this tuning file with a monochrome sensor,
> and this patch will break this use case.
>
> This brings nack the question that we decided to leave unanswered when
> the imx296.json file was merged: how do we deal with different modules
> that integrated the same camera sensor ?
>
> [1]
> https://lists.libcamera.org/pipermail/libcamera-devel/2022-January/028756.html


This is indeed a real problem now.  Our (admittedly very loose) convention
is to have
the <sensor_name>.json file be the full colour variant, and any offshoot be
named as
<sensor_name>_<variant>.json.  Would we be able to give a heads-up and help
this
user switch to imx296_mono.json?  They would also benefit from the new
tuning with
updated noise and sharpening IQ performance.

The difficult bit is how to choose a variant json without user
intervention? Do we add
a variant parameter in devicetree?  Some modules may have eeproms or ids
that can
store this, but I don't think there is a mechanism to return this
information to userland
from v4l2...?

Naush


>
>
> > Update the tuning file using the raspberrypi ctt tool to give accurate
> > values, and all required parameters.
> >
> > Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> > ---
> >  src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
> >  1 file changed, 217 insertions(+), 51 deletions(-)
> >
> > diff --git a/src/ipa/raspberrypi/data/imx296.json
> b/src/ipa/raspberrypi/data/imx296.json
> > index 837feff5..4d9d0e8b 100644
> > --- a/src/ipa/raspberrypi/data/imx296.json
> > +++ b/src/ipa/raspberrypi/data/imx296.json
> > @@ -8,25 +8,97 @@
> >      },
> >      "rpi.lux":
> >      {
> > -        "reference_shutter_speed": 19184,
> > -        "reference_gain": 1.0,
> > +        "reference_shutter_speed": 17895,
> > +        "reference_gain": 1.99,
> >          "reference_aperture": 1.0,
> > -        "reference_lux": 432,
> > -        "reference_Y": 13773
> > +        "reference_lux": 1147,
> > +        "reference_Y": 13348
> >      },
> >      "rpi.noise":
> >      {
> > -        "reference_constant": 0,
> > -        "reference_slope": 2.957
> > +        "reference_constant": 1,
> > +        "reference_slope": 2.631
> >      },
> >      "rpi.geq":
> >      {
> > -        "offset": 185,
> > -        "slope": 0.0105
> > +        "offset": 182,
> > +        "slope": 0.0127
> >      },
> >      "rpi.sdn":
> >      {
> >      },
> > +    "rpi.awb":
> > +    {
> > +        "priors":
> > +        [
> > +            {
> > +                "lux": 0, "prior":
> > +                [
> > +                    2000, 1.0, 3000, 0.0, 13000, 0.0
> > +                ]
> > +            },
> > +            {
> > +                "lux": 800, "prior":
> > +                [
> > +                    2000, 0.0, 6000, 2.0, 13000, 2.0
> > +                ]
> > +            },
> > +            {
> > +                "lux": 1500, "prior":
> > +                [
> > +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000,
> 1.0, 13000, 1.0
> > +                ]
> > +            }
> > +        ],
> > +        "modes":
> > +        {
> > +            "auto":
> > +            {
> > +                "lo": 2500,
> > +                "hi": 8000
> > +            },
> > +            "incandescent":
> > +            {
> > +                "lo": 2500,
> > +                "hi": 3000
> > +            },
> > +            "tungsten":
> > +            {
> > +                "lo": 3000,
> > +                "hi": 3500
> > +            },
> > +            "fluorescent":
> > +            {
> > +                "lo": 4000,
> > +                "hi": 4700
> > +            },
> > +            "indoor":
> > +            {
> > +                "lo": 3000,
> > +                "hi": 5000
> > +            },
> > +            "daylight":
> > +            {
> > +                "lo": 5500,
> > +                "hi": 6500
> > +            },
> > +            "cloudy":
> > +            {
> > +                "lo": 7000,
> > +                "hi": 8600
> > +            }
> > +        },
> > +        "bayes": 1,
> > +        "ct_curve":
> > +        [
> > +            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0,
> 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
> > +            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789,
> 0.6527
> > +        ],
> > +        "sensitivity_r": 1.0,
> > +        "sensitivity_b": 1.0,
> > +        "transverse_pos": 0.02994,
> > +        "transverse_neg": 0.04332
> > +    },
> >      "rpi.agc":
> >      {
> >          "metering_modes":
> > @@ -113,65 +185,99 @@
> >      "rpi.alsc":
> >      {
> >          "omega": 1.3,
> > -        "n_iter": 0,
> > +        "n_iter": 100,
> >          "luminance_strength": 0.5,
> >          "calibrations_Cr":
> >          [
> >              {
> > -                "ct": 4000, "table":
> > -                [
> > -                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516,
> 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
> > -                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506,
> 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
> > -                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517,
> 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
> > -                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519,
> 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
> > -                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539,
> 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
> > -                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546,
> 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
> > -                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543,
> 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
> > -                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543,
> 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
> > -                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539,
> 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
> > -                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509,
> 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
> > -                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508,
> 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
> > -                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514,
> 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
> > +                "ct": 2943, "table":
> > +                [
> > +                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
> > +                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153,
> 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> > +                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> > +                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152,
> 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
> > +                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151,
> 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
> > +                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151,
> 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
> > +                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151,
> 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
> > +                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> > +                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152,
> 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> > +                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151,
> 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
> > +                ]
> > +            },
> > +            {
> > +                "ct": 6097, "table":
> > +                [
> > +                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603,
> 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
> > +                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606,
> 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
> > +                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608,
> 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
> > +                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603,
> 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
> > +                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599,
> 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
> > +                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599,
> 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
> > +                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599,
> 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
> > +                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599,
> 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
> > +                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601,
> 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
> > +                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608,
> 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
> > +                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608,
> 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
> > +                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604,
> 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
> >                  ]
> >              }
> >          ],
> >          "calibrations_Cb":
> >          [
> >              {
> > -                "ct": 4000, "table":
> > -                [
> > -                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589,
> 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
> > -                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591,
> 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
> > -                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593,
> 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
> > -                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597,
> 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
> > -                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612,
> 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
> > -                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629,
> 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
> > -                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636,
> 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
> > -                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632,
> 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
> > -                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624,
> 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
> > -                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616,
> 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
> > -                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615,
> 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
> > -                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621,
> 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
> > +                "ct": 2943, "table":
> > +                [
> > +                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401,
> 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
> > +                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403,
> 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
> > +                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403,
> 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
> > +                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402,
> 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
> > +                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401,
> 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
> > +                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401,
> 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
> > +                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399,
> 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
> > +                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397,
> 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
> > +                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394,
> 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
> > +                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391,
> 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
> > +                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385,
> 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
> > +                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374,
> 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
> > +                ]
> > +            },
> > +            {
> > +                "ct": 6097, "table":
> > +                [
> > +                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671,
> 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
> > +                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672,
> 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
> > +                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673,
> 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
> > +                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673,
> 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
> > +                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673,
> 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
> > +                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672,
> 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
> > +                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672,
> 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
> > +                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672,
> 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
> > +                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669,
> 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
> > +                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668,
> 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
> > +                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664,
> 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
> > +                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659,
> 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
> >                  ]
> >              }
> >          ],
> >          "luminance_lut":
> >          [
> > -            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082,
> 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
> > -            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077,
> 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
> > -            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088,
> 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
> > -            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112,
> 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
> > -            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138,
> 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
> > -            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157,
> 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
> > -            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174,
> 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
> > -            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187,
> 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
> > -            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194,
> 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
> > -            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197,
> 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
> > -            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193,
> 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
> > -            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188,
> 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
> > +            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062,
> 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
> > +            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062,
> 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
> > +            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062,
> 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
> > +            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059,
> 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
> > +            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054,
> 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
> > +            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049,
> 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
> > +            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043,
> 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
> > +            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039,
> 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
> > +            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035,
> 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
> > +            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032,
> 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
> > +            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027,
> 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
> > +            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021,
> 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
> >          ],
> > -        "sigma": 0.005,
> > -        "sigma_Cb": 0.005
> > +        "sigma": 0.00063,
> > +        "sigma_Cb": 0.00089
> >      },
> >      "rpi.contrast":
> >      {
> > @@ -185,6 +291,66 @@
> >              65535, 65535
> >          ]
> >      },
> > +    "rpi.ccm":
> > +    {
> > +        "ccms":
> > +        [
> > +            {
> > +                "ct": 2861, "ccm":
> > +                [
> > +                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738,
> -0.18503, 0.07817, -0.77121, 1.69304
> > +                ]
> > +            },
> > +            {
> > +                "ct": 2915, "ccm":
> > +                [
> > +                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118,
> -0.20869, 0.08973, -0.78375, 1.69402
> > +                ]
> > +            },
> > +            {
> > +                "ct": 2916, "ccm":
> > +                [
> > +                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627,
> -0.07646, -0.00104, -0.62299, 1.62404
> > +                ]
> > +            },
> > +            {
> > +                "ct": 2922, "ccm":
> > +                [
> > +                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084,
> -0.08813, 0.01453, -0.65247, 1.63794
> > +                ]
> > +            },
> > +            {
> > +                "ct": 2934, "ccm":
> > +                [
> > +                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129,
> -0.08981, 0.01142, -0.64365, 1.63224
> > +                ]
> > +            },
> > +            {
> > +                "ct": 3626, "ccm":
> > +                [
> > +                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135,
> -0.21895, 0.05845, -0.66941, 1.61096
> > +                ]
> > +            },
> > +            {
> > +                "ct": 4617, "ccm":
> > +                [
> > +                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915,
> -0.40287, 0.07878, -0.73116, 1.65238
> > +                ]
> > +            },
> > +            {
> > +                "ct": 5674, "ccm":
> > +                [
> > +                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994,
> -0.33998, 0.04474, -0.61721, 1.57247
> > +                ]
> > +            },
> > +            {
> > +                "ct": 7617, "ccm":
> > +                [
> > +                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915,
> -0.62645, 0.07635, -1.01009, 1.93374
> > +                ]
> > +            }
> > +        ]
> > +    },
> >      "rpi.sharpen":
> >      {
> >      }
>
> --
> Regards,
>
> Laurent Pinchart
>
Dave Stevenson July 15, 2022, 10:49 a.m. UTC | #4
Hi All

On Fri, 15 Jul 2022 at 08:24, Naushir Patuck via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> Hi Laurent,
>
> On Fri, 15 Jul 2022 at 01:14, Laurent Pinchart via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:
>>
>> Hi William,
>>
>> Thank you for the patch.
>>
>> On Thu, Jul 14, 2022 at 10:41:43AM +0100, William Vinnicombe via libcamera-devel wrote:
>> > From: William Vinnicombe <william.vinnicombe@raspberrypi.com>
>> >
>> > The previous tuning values for the imx296 are not accurate, and do not
>> > contain awb parameters.
>>
>> There was a reason for that though, the file was meant for the
>> monochrome version of the sensor. See [1] for the full context. I'm
>> actually aware of one user of this tuning file with a monochrome sensor,
>> and this patch will break this use case.
>>
>> This brings nack the question that we decided to leave unanswered when
>> the imx296.json file was merged: how do we deal with different modules
>> that integrated the same camera sensor ?
>>
>> [1] https://lists.libcamera.org/pipermail/libcamera-devel/2022-January/028756.html
>
>
> This is indeed a real problem now.  Our (admittedly very loose) convention is to have
> the <sensor_name>.json file be the full colour variant, and any offshoot be named as
> <sensor_name>_<variant>.json.  Would we be able to give a heads-up and help this
> user switch to imx296_mono.json?  They would also benefit from the new tuning with
> updated noise and sharpening IQ performance.
>
> The difficult bit is how to choose a variant json without user intervention? Do we add
> a variant parameter in devicetree?  Some modules may have eeproms or ids that can
> store this, but I don't think there is a mechanism to return this information to userland
> from v4l2...?

This is going to be a recurring issue, as a very similar thing was
true for imx290. There we have 2 compatible strings [1] as there isn't
a register to read for colour vs mono.

The driver has to know in order to advertise the correct MEDIA_BUS_FMT_ formats.
Do we change the V4L2 sensor subdev name for variants (either based on
compatible or register) to denote an alternate tuning file? That
should then get magically picked up, but does it make for some
confusion choosing the camera helper?
(It would be nice to have a convention, but as it will be down to the
driver to provide the name they could be switched around on a per
driver basis).

  Dave

[1] https://github.com/raspberrypi/linux/blob/rpi-5.15.y/drivers/media/i2c/imx290.c#L1235

> Naush
>
>>
>>
>>
>> > Update the tuning file using the raspberrypi ctt tool to give accurate
>> > values, and all required parameters.
>> >
>> > Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
>> > ---
>> >  src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
>> >  1 file changed, 217 insertions(+), 51 deletions(-)
>> >
>> > diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296.json
>> > index 837feff5..4d9d0e8b 100644
>> > --- a/src/ipa/raspberrypi/data/imx296.json
>> > +++ b/src/ipa/raspberrypi/data/imx296.json
>> > @@ -8,25 +8,97 @@
>> >      },
>> >      "rpi.lux":
>> >      {
>> > -        "reference_shutter_speed": 19184,
>> > -        "reference_gain": 1.0,
>> > +        "reference_shutter_speed": 17895,
>> > +        "reference_gain": 1.99,
>> >          "reference_aperture": 1.0,
>> > -        "reference_lux": 432,
>> > -        "reference_Y": 13773
>> > +        "reference_lux": 1147,
>> > +        "reference_Y": 13348
>> >      },
>> >      "rpi.noise":
>> >      {
>> > -        "reference_constant": 0,
>> > -        "reference_slope": 2.957
>> > +        "reference_constant": 1,
>> > +        "reference_slope": 2.631
>> >      },
>> >      "rpi.geq":
>> >      {
>> > -        "offset": 185,
>> > -        "slope": 0.0105
>> > +        "offset": 182,
>> > +        "slope": 0.0127
>> >      },
>> >      "rpi.sdn":
>> >      {
>> >      },
>> > +    "rpi.awb":
>> > +    {
>> > +        "priors":
>> > +        [
>> > +            {
>> > +                "lux": 0, "prior":
>> > +                [
>> > +                    2000, 1.0, 3000, 0.0, 13000, 0.0
>> > +                ]
>> > +            },
>> > +            {
>> > +                "lux": 800, "prior":
>> > +                [
>> > +                    2000, 0.0, 6000, 2.0, 13000, 2.0
>> > +                ]
>> > +            },
>> > +            {
>> > +                "lux": 1500, "prior":
>> > +                [
>> > +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0
>> > +                ]
>> > +            }
>> > +        ],
>> > +        "modes":
>> > +        {
>> > +            "auto":
>> > +            {
>> > +                "lo": 2500,
>> > +                "hi": 8000
>> > +            },
>> > +            "incandescent":
>> > +            {
>> > +                "lo": 2500,
>> > +                "hi": 3000
>> > +            },
>> > +            "tungsten":
>> > +            {
>> > +                "lo": 3000,
>> > +                "hi": 3500
>> > +            },
>> > +            "fluorescent":
>> > +            {
>> > +                "lo": 4000,
>> > +                "hi": 4700
>> > +            },
>> > +            "indoor":
>> > +            {
>> > +                "lo": 3000,
>> > +                "hi": 5000
>> > +            },
>> > +            "daylight":
>> > +            {
>> > +                "lo": 5500,
>> > +                "hi": 6500
>> > +            },
>> > +            "cloudy":
>> > +            {
>> > +                "lo": 7000,
>> > +                "hi": 8600
>> > +            }
>> > +        },
>> > +        "bayes": 1,
>> > +        "ct_curve":
>> > +        [
>> > +            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0, 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
>> > +            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789, 0.6527
>> > +        ],
>> > +        "sensitivity_r": 1.0,
>> > +        "sensitivity_b": 1.0,
>> > +        "transverse_pos": 0.02994,
>> > +        "transverse_neg": 0.04332
>> > +    },
>> >      "rpi.agc":
>> >      {
>> >          "metering_modes":
>> > @@ -113,65 +185,99 @@
>> >      "rpi.alsc":
>> >      {
>> >          "omega": 1.3,
>> > -        "n_iter": 0,
>> > +        "n_iter": 100,
>> >          "luminance_strength": 0.5,
>> >          "calibrations_Cr":
>> >          [
>> >              {
>> > -                "ct": 4000, "table":
>> > -                [
>> > -                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516, 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
>> > -                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506, 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
>> > -                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517, 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
>> > -                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519, 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
>> > -                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539, 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
>> > -                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546, 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
>> > -                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543, 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
>> > -                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543, 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
>> > -                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539, 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
>> > -                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509, 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
>> > -                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508, 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
>> > -                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514, 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
>> > +                "ct": 2943, "table":
>> > +                [
>> > +                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
>> > +                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
>> > +                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
>> > +                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
>> > +                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
>> > +                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
>> > +                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
>> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
>> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
>> > +                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
>> > +                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
>> > +                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151, 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 6097, "table":
>> > +                [
>> > +                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603, 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
>> > +                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606, 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
>> > +                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608, 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
>> > +                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603, 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
>> > +                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599, 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
>> > +                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599, 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
>> > +                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599, 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
>> > +                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599, 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
>> > +                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601, 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
>> > +                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608, 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
>> > +                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608, 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
>> > +                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604, 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
>> >                  ]
>> >              }
>> >          ],
>> >          "calibrations_Cb":
>> >          [
>> >              {
>> > -                "ct": 4000, "table":
>> > -                [
>> > -                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589, 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
>> > -                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591, 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
>> > -                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593, 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
>> > -                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597, 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
>> > -                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612, 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
>> > -                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629, 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
>> > -                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636, 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
>> > -                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632, 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
>> > -                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624, 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
>> > -                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616, 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
>> > -                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615, 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
>> > -                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621, 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
>> > +                "ct": 2943, "table":
>> > +                [
>> > +                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401, 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
>> > +                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403, 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
>> > +                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403, 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
>> > +                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402, 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
>> > +                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401, 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
>> > +                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401, 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
>> > +                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399, 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
>> > +                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397, 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
>> > +                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394, 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
>> > +                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391, 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
>> > +                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385, 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
>> > +                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374, 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 6097, "table":
>> > +                [
>> > +                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671, 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
>> > +                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672, 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
>> > +                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673, 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
>> > +                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673, 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
>> > +                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673, 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
>> > +                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
>> > +                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
>> > +                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672, 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
>> > +                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669, 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
>> > +                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668, 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
>> > +                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664, 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
>> > +                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659, 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
>> >                  ]
>> >              }
>> >          ],
>> >          "luminance_lut":
>> >          [
>> > -            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082, 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
>> > -            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077, 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
>> > -            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088, 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
>> > -            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112, 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
>> > -            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138, 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
>> > -            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157, 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
>> > -            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174, 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
>> > -            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187, 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
>> > -            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194, 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
>> > -            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197, 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
>> > -            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193, 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
>> > -            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188, 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
>> > +            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062, 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
>> > +            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062, 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
>> > +            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062, 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
>> > +            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059, 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
>> > +            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054, 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
>> > +            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049, 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
>> > +            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043, 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
>> > +            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039, 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
>> > +            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035, 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
>> > +            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032, 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
>> > +            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027, 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
>> > +            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021, 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
>> >          ],
>> > -        "sigma": 0.005,
>> > -        "sigma_Cb": 0.005
>> > +        "sigma": 0.00063,
>> > +        "sigma_Cb": 0.00089
>> >      },
>> >      "rpi.contrast":
>> >      {
>> > @@ -185,6 +291,66 @@
>> >              65535, 65535
>> >          ]
>> >      },
>> > +    "rpi.ccm":
>> > +    {
>> > +        "ccms":
>> > +        [
>> > +            {
>> > +                "ct": 2861, "ccm":
>> > +                [
>> > +                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738, -0.18503, 0.07817, -0.77121, 1.69304
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 2915, "ccm":
>> > +                [
>> > +                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118, -0.20869, 0.08973, -0.78375, 1.69402
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 2916, "ccm":
>> > +                [
>> > +                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627, -0.07646, -0.00104, -0.62299, 1.62404
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 2922, "ccm":
>> > +                [
>> > +                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084, -0.08813, 0.01453, -0.65247, 1.63794
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 2934, "ccm":
>> > +                [
>> > +                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129, -0.08981, 0.01142, -0.64365, 1.63224
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 3626, "ccm":
>> > +                [
>> > +                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135, -0.21895, 0.05845, -0.66941, 1.61096
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 4617, "ccm":
>> > +                [
>> > +                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915, -0.40287, 0.07878, -0.73116, 1.65238
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 5674, "ccm":
>> > +                [
>> > +                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994, -0.33998, 0.04474, -0.61721, 1.57247
>> > +                ]
>> > +            },
>> > +            {
>> > +                "ct": 7617, "ccm":
>> > +                [
>> > +                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915, -0.62645, 0.07635, -1.01009, 1.93374
>> > +                ]
>> > +            }
>> > +        ]
>> > +    },
>> >      "rpi.sharpen":
>> >      {
>> >      }
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
Dave Stevenson July 15, 2022, 11:01 a.m. UTC | #5
On Fri, 15 Jul 2022 at 11:49, Dave Stevenson
<dave.stevenson@raspberrypi.com> wrote:
>
> Hi All
>
> On Fri, 15 Jul 2022 at 08:24, Naushir Patuck via libcamera-devel
> <libcamera-devel@lists.libcamera.org> wrote:
> >
> > Hi Laurent,
> >
> > On Fri, 15 Jul 2022 at 01:14, Laurent Pinchart via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote:
> >>
> >> Hi William,
> >>
> >> Thank you for the patch.
> >>
> >> On Thu, Jul 14, 2022 at 10:41:43AM +0100, William Vinnicombe via libcamera-devel wrote:
> >> > From: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> >> >
> >> > The previous tuning values for the imx296 are not accurate, and do not
> >> > contain awb parameters.
> >>
> >> There was a reason for that though, the file was meant for the
> >> monochrome version of the sensor. See [1] for the full context. I'm
> >> actually aware of one user of this tuning file with a monochrome sensor,
> >> and this patch will break this use case.
> >>
> >> This brings nack the question that we decided to leave unanswered when
> >> the imx296.json file was merged: how do we deal with different modules
> >> that integrated the same camera sensor ?
> >>
> >> [1] https://lists.libcamera.org/pipermail/libcamera-devel/2022-January/028756.html
> >
> >
> > This is indeed a real problem now.  Our (admittedly very loose) convention is to have
> > the <sensor_name>.json file be the full colour variant, and any offshoot be named as
> > <sensor_name>_<variant>.json.  Would we be able to give a heads-up and help this
> > user switch to imx296_mono.json?  They would also benefit from the new tuning with
> > updated noise and sharpening IQ performance.
> >
> > The difficult bit is how to choose a variant json without user intervention? Do we add
> > a variant parameter in devicetree?  Some modules may have eeproms or ids that can
> > store this, but I don't think there is a mechanism to return this information to userland
> > from v4l2...?
>
> This is going to be a recurring issue, as a very similar thing was
> true for imx290. There we have 2 compatible strings [1] as there isn't
> a register to read for colour vs mono.
>
> The driver has to know in order to advertise the correct MEDIA_BUS_FMT_ formats.
> Do we change the V4L2 sensor subdev name for variants (either based on
> compatible or register) to denote an alternate tuning file? That
> should then get magically picked up, but does it make for some
> confusion choosing the camera helper?
> (It would be nice to have a convention, but as it will be down to the
> driver to provide the name they could be switched around on a per
> driver basis).

Replying to myself as I'm noticing the patches to the mainline ov9282
drivers to support ov9281 - that's another case where we could do with
agreeing to deviate from just using the driver name.

RPi have a downstream ov9281 driver, but the mainline one will
currently use the module name, so won't match. OV9281 and OV9282
apparently have differing CRA characteristics, so will potentially
want slightly different tunings should we wish to support both.
Adding a nice way to use the compatible string or custom suffix would
be very useful.

>   Dave
>
> [1] https://github.com/raspberrypi/linux/blob/rpi-5.15.y/drivers/media/i2c/imx290.c#L1235
>
> > Naush
> >
> >>
> >>
> >>
> >> > Update the tuning file using the raspberrypi ctt tool to give accurate
> >> > values, and all required parameters.
> >> >
> >> > Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
> >> > ---
> >> >  src/ipa/raspberrypi/data/imx296.json | 268 ++++++++++++++++++++++-----
> >> >  1 file changed, 217 insertions(+), 51 deletions(-)
> >> >
> >> > diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296.json
> >> > index 837feff5..4d9d0e8b 100644
> >> > --- a/src/ipa/raspberrypi/data/imx296.json
> >> > +++ b/src/ipa/raspberrypi/data/imx296.json
> >> > @@ -8,25 +8,97 @@
> >> >      },
> >> >      "rpi.lux":
> >> >      {
> >> > -        "reference_shutter_speed": 19184,
> >> > -        "reference_gain": 1.0,
> >> > +        "reference_shutter_speed": 17895,
> >> > +        "reference_gain": 1.99,
> >> >          "reference_aperture": 1.0,
> >> > -        "reference_lux": 432,
> >> > -        "reference_Y": 13773
> >> > +        "reference_lux": 1147,
> >> > +        "reference_Y": 13348
> >> >      },
> >> >      "rpi.noise":
> >> >      {
> >> > -        "reference_constant": 0,
> >> > -        "reference_slope": 2.957
> >> > +        "reference_constant": 1,
> >> > +        "reference_slope": 2.631
> >> >      },
> >> >      "rpi.geq":
> >> >      {
> >> > -        "offset": 185,
> >> > -        "slope": 0.0105
> >> > +        "offset": 182,
> >> > +        "slope": 0.0127
> >> >      },
> >> >      "rpi.sdn":
> >> >      {
> >> >      },
> >> > +    "rpi.awb":
> >> > +    {
> >> > +        "priors":
> >> > +        [
> >> > +            {
> >> > +                "lux": 0, "prior":
> >> > +                [
> >> > +                    2000, 1.0, 3000, 0.0, 13000, 0.0
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "lux": 800, "prior":
> >> > +                [
> >> > +                    2000, 0.0, 6000, 2.0, 13000, 2.0
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "lux": 1500, "prior":
> >> > +                [
> >> > +                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0
> >> > +                ]
> >> > +            }
> >> > +        ],
> >> > +        "modes":
> >> > +        {
> >> > +            "auto":
> >> > +            {
> >> > +                "lo": 2500,
> >> > +                "hi": 8000
> >> > +            },
> >> > +            "incandescent":
> >> > +            {
> >> > +                "lo": 2500,
> >> > +                "hi": 3000
> >> > +            },
> >> > +            "tungsten":
> >> > +            {
> >> > +                "lo": 3000,
> >> > +                "hi": 3500
> >> > +            },
> >> > +            "fluorescent":
> >> > +            {
> >> > +                "lo": 4000,
> >> > +                "hi": 4700
> >> > +            },
> >> > +            "indoor":
> >> > +            {
> >> > +                "lo": 3000,
> >> > +                "hi": 5000
> >> > +            },
> >> > +            "daylight":
> >> > +            {
> >> > +                "lo": 5500,
> >> > +                "hi": 6500
> >> > +            },
> >> > +            "cloudy":
> >> > +            {
> >> > +                "lo": 7000,
> >> > +                "hi": 8600
> >> > +            }
> >> > +        },
> >> > +        "bayes": 1,
> >> > +        "ct_curve":
> >> > +        [
> >> > +            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0, 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
> >> > +            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789, 0.6527
> >> > +        ],
> >> > +        "sensitivity_r": 1.0,
> >> > +        "sensitivity_b": 1.0,
> >> > +        "transverse_pos": 0.02994,
> >> > +        "transverse_neg": 0.04332
> >> > +    },
> >> >      "rpi.agc":
> >> >      {
> >> >          "metering_modes":
> >> > @@ -113,65 +185,99 @@
> >> >      "rpi.alsc":
> >> >      {
> >> >          "omega": 1.3,
> >> > -        "n_iter": 0,
> >> > +        "n_iter": 100,
> >> >          "luminance_strength": 0.5,
> >> >          "calibrations_Cr":
> >> >          [
> >> >              {
> >> > -                "ct": 4000, "table":
> >> > -                [
> >> > -                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516, 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
> >> > -                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506, 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
> >> > -                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517, 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
> >> > -                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519, 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
> >> > -                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539, 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
> >> > -                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546, 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
> >> > -                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543, 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
> >> > -                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543, 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
> >> > -                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539, 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
> >> > -                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509, 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
> >> > -                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508, 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
> >> > -                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514, 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
> >> > +                "ct": 2943, "table":
> >> > +                [
> >> > +                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
> >> > +                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> >> > +                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
> >> > +                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
> >> > +                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
> >> > +                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
> >> > +                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
> >> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
> >> > +                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
> >> > +                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> >> > +                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
> >> > +                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151, 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 6097, "table":
> >> > +                [
> >> > +                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603, 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
> >> > +                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606, 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
> >> > +                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608, 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
> >> > +                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603, 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
> >> > +                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599, 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
> >> > +                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599, 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
> >> > +                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599, 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
> >> > +                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599, 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
> >> > +                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601, 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
> >> > +                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608, 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
> >> > +                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608, 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
> >> > +                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604, 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
> >> >                  ]
> >> >              }
> >> >          ],
> >> >          "calibrations_Cb":
> >> >          [
> >> >              {
> >> > -                "ct": 4000, "table":
> >> > -                [
> >> > -                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589, 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
> >> > -                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591, 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
> >> > -                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593, 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
> >> > -                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597, 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
> >> > -                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612, 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
> >> > -                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629, 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
> >> > -                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636, 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
> >> > -                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632, 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
> >> > -                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624, 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
> >> > -                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616, 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
> >> > -                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615, 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
> >> > -                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621, 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
> >> > +                "ct": 2943, "table":
> >> > +                [
> >> > +                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401, 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
> >> > +                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403, 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
> >> > +                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403, 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
> >> > +                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402, 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
> >> > +                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401, 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
> >> > +                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401, 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
> >> > +                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399, 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
> >> > +                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397, 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
> >> > +                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394, 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
> >> > +                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391, 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
> >> > +                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385, 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
> >> > +                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374, 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 6097, "table":
> >> > +                [
> >> > +                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671, 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
> >> > +                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672, 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
> >> > +                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673, 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
> >> > +                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673, 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
> >> > +                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673, 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
> >> > +                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
> >> > +                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
> >> > +                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672, 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
> >> > +                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669, 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
> >> > +                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668, 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
> >> > +                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664, 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
> >> > +                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659, 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
> >> >                  ]
> >> >              }
> >> >          ],
> >> >          "luminance_lut":
> >> >          [
> >> > -            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082, 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
> >> > -            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077, 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
> >> > -            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088, 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
> >> > -            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112, 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
> >> > -            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138, 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
> >> > -            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157, 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
> >> > -            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174, 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
> >> > -            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187, 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
> >> > -            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194, 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
> >> > -            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197, 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
> >> > -            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193, 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
> >> > -            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188, 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
> >> > +            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062, 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
> >> > +            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062, 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
> >> > +            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062, 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
> >> > +            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059, 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
> >> > +            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054, 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
> >> > +            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049, 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
> >> > +            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043, 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
> >> > +            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039, 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
> >> > +            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035, 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
> >> > +            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032, 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
> >> > +            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027, 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
> >> > +            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021, 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
> >> >          ],
> >> > -        "sigma": 0.005,
> >> > -        "sigma_Cb": 0.005
> >> > +        "sigma": 0.00063,
> >> > +        "sigma_Cb": 0.00089
> >> >      },
> >> >      "rpi.contrast":
> >> >      {
> >> > @@ -185,6 +291,66 @@
> >> >              65535, 65535
> >> >          ]
> >> >      },
> >> > +    "rpi.ccm":
> >> > +    {
> >> > +        "ccms":
> >> > +        [
> >> > +            {
> >> > +                "ct": 2861, "ccm":
> >> > +                [
> >> > +                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738, -0.18503, 0.07817, -0.77121, 1.69304
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 2915, "ccm":
> >> > +                [
> >> > +                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118, -0.20869, 0.08973, -0.78375, 1.69402
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 2916, "ccm":
> >> > +                [
> >> > +                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627, -0.07646, -0.00104, -0.62299, 1.62404
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 2922, "ccm":
> >> > +                [
> >> > +                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084, -0.08813, 0.01453, -0.65247, 1.63794
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 2934, "ccm":
> >> > +                [
> >> > +                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129, -0.08981, 0.01142, -0.64365, 1.63224
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 3626, "ccm":
> >> > +                [
> >> > +                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135, -0.21895, 0.05845, -0.66941, 1.61096
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 4617, "ccm":
> >> > +                [
> >> > +                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915, -0.40287, 0.07878, -0.73116, 1.65238
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 5674, "ccm":
> >> > +                [
> >> > +                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994, -0.33998, 0.04474, -0.61721, 1.57247
> >> > +                ]
> >> > +            },
> >> > +            {
> >> > +                "ct": 7617, "ccm":
> >> > +                [
> >> > +                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915, -0.62645, 0.07635, -1.01009, 1.93374
> >> > +                ]
> >> > +            }
> >> > +        ]
> >> > +    },
> >> >      "rpi.sharpen":
> >> >      {
> >> >      }
> >>
> >> --
> >> Regards,
> >>
> >> Laurent Pinchart

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296.json
index 837feff5..4d9d0e8b 100644
--- a/src/ipa/raspberrypi/data/imx296.json
+++ b/src/ipa/raspberrypi/data/imx296.json
@@ -8,25 +8,97 @@ 
     },
     "rpi.lux":
     {
-        "reference_shutter_speed": 19184,
-        "reference_gain": 1.0,
+        "reference_shutter_speed": 17895,
+        "reference_gain": 1.99,
         "reference_aperture": 1.0,
-        "reference_lux": 432,
-        "reference_Y": 13773
+        "reference_lux": 1147,
+        "reference_Y": 13348
     },
     "rpi.noise":
     {
-        "reference_constant": 0,
-        "reference_slope": 2.957
+        "reference_constant": 1,
+        "reference_slope": 2.631
     },
     "rpi.geq":
     {
-        "offset": 185,
-        "slope": 0.0105
+        "offset": 182,
+        "slope": 0.0127
     },
     "rpi.sdn":
     {
     },
+    "rpi.awb":
+    {
+        "priors":
+        [
+            {
+                "lux": 0, "prior":
+                [
+                    2000, 1.0, 3000, 0.0, 13000, 0.0
+                ]
+            },
+            {
+                "lux": 800, "prior":
+                [
+                    2000, 0.0, 6000, 2.0, 13000, 2.0
+                ]
+            },
+            {
+                "lux": 1500, "prior":
+                [
+                    2000, 0.0, 4000, 1.0, 6000, 6.0, 6500, 7.0, 7000, 1.0, 13000, 1.0
+                ]
+            }
+        ],
+        "modes":
+        {
+            "auto":
+            {
+                "lo": 2500,
+                "hi": 8000
+            },
+            "incandescent":
+            {
+                "lo": 2500,
+                "hi": 3000
+            },
+            "tungsten":
+            {
+                "lo": 3000,
+                "hi": 3500
+            },
+            "fluorescent":
+            {
+                "lo": 4000,
+                "hi": 4700
+            },
+            "indoor":
+            {
+                "lo": 3000,
+                "hi": 5000
+            },
+            "daylight":
+            {
+                "lo": 5500,
+                "hi": 6500
+            },
+            "cloudy":
+            {
+                "lo": 7000,
+                "hi": 8600
+            }
+        },
+        "bayes": 1,
+        "ct_curve":
+        [
+            2861.0, 0.4281, 0.2614, 2915.0, 0.4266, 0.2639, 2916.0, 0.4112, 0.2913, 2934.0, 0.4099, 0.2935, 3626.0, 0.3604, 0.3777, 4617.0,
+            0.2776, 0.5093, 5674.0, 0.2567, 0.5409, 7617.0, 0.1789, 0.6527
+        ],
+        "sensitivity_r": 1.0,
+        "sensitivity_b": 1.0,
+        "transverse_pos": 0.02994,
+        "transverse_neg": 0.04332
+    },
     "rpi.agc":
     {
         "metering_modes":
@@ -113,65 +185,99 @@ 
     "rpi.alsc":
     {
         "omega": 1.3,
-        "n_iter": 0,
+        "n_iter": 100,
         "luminance_strength": 0.5,
         "calibrations_Cr":
         [
             {
-                "ct": 4000, "table":
-                [
-                    2.554, 2.554, 2.541, 2.534, 2.495, 2.506, 2.516, 2.517, 2.518, 2.515, 2.513, 2.495, 2.481, 2.533, 2.533, 2.521,
-                    2.522, 2.534, 2.539, 2.531, 2.531, 2.506, 2.506, 2.513, 2.513, 2.509, 2.498, 2.496, 2.508, 2.517, 2.521, 2.521,
-                    2.509, 2.517, 2.534, 2.529, 2.531, 2.521, 2.517, 2.517, 2.515, 2.514, 2.506, 2.499, 2.508, 2.508, 2.521, 2.537,
-                    2.507, 2.508, 2.517, 2.516, 2.495, 2.487, 2.519, 2.534, 2.535, 2.531, 2.499, 2.494, 2.501, 2.511, 2.526, 2.526,
-                    2.509, 2.517, 2.507, 2.501, 2.494, 2.519, 2.539, 2.539, 2.537, 2.537, 2.533, 2.499, 2.503, 2.511, 2.529, 2.525,
-                    2.521, 2.522, 2.476, 2.501, 2.501, 2.539, 2.546, 2.538, 2.531, 2.538, 2.541, 2.531, 2.529, 2.526, 2.529, 2.525,
-                    2.516, 2.519, 2.469, 2.499, 2.499, 2.543, 2.543, 2.531, 2.528, 2.534, 2.541, 2.535, 2.531, 2.526, 2.531, 2.528,
-                    2.509, 2.515, 2.465, 2.487, 2.487, 2.539, 2.543, 2.539, 2.533, 2.549, 2.542, 2.531, 2.529, 2.524, 2.532, 2.533,
-                    2.499, 2.499, 2.475, 2.482, 2.471, 2.509, 2.539, 2.544, 2.543, 2.545, 2.533, 2.498, 2.521, 2.521, 2.537, 2.536,
-                    2.499, 2.488, 2.488, 2.488, 2.471, 2.462, 2.509, 2.539, 2.539, 2.532, 2.498, 2.498, 2.518, 2.518, 2.539, 2.539,
-                    2.483, 2.484, 2.488, 2.488, 2.502, 2.496, 2.508, 2.514, 2.518, 2.517, 2.521, 2.518, 2.518, 2.518, 2.525, 2.539,
-                    2.483, 2.487, 2.478, 2.478, 2.507, 2.509, 2.514, 2.513, 2.514, 2.517, 2.536, 2.559, 2.501, 2.501, 2.503, 2.525
+                "ct": 2943, "table":
+                [
+                    2.153, 2.154, 2.154, 2.153, 2.153, 2.153, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.153,
+                    2.154, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
+                    2.155, 2.155, 2.155, 2.154, 2.154, 2.154, 2.153, 2.151, 2.151, 2.149, 2.149, 2.149, 2.149, 2.149, 2.151, 2.152,
+                    2.154, 2.154, 2.155, 2.153, 2.153, 2.153, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.149, 2.151,
+                    2.153, 2.153, 2.153, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.149, 2.149, 2.148, 2.148, 2.148, 2.149, 2.151,
+                    2.153, 2.153, 2.152, 2.152, 2.152, 2.152, 2.151, 2.149, 2.149, 2.148, 2.148, 2.148, 2.147, 2.147, 2.148, 2.149,
+                    2.152, 2.153, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.148, 2.147, 2.147, 2.147, 2.148, 2.149,
+                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.149, 2.148, 2.147, 2.146, 2.147, 2.147, 2.148, 2.149, 2.151,
+                    2.152, 2.152, 2.152, 2.151, 2.151, 2.151, 2.151, 2.151, 2.149, 2.147, 2.146, 2.147, 2.148, 2.149, 2.152, 2.152,
+                    2.152, 2.154, 2.154, 2.152, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
+                    2.155, 2.156, 2.155, 2.154, 2.152, 2.152, 2.152, 2.151, 2.151, 2.149, 2.149, 2.149, 2.151, 2.152, 2.153, 2.153,
+                    2.155, 2.155, 2.155, 2.154, 2.152, 2.151, 2.151, 2.149, 2.148, 2.148, 2.149, 2.149, 2.151, 2.152, 2.152, 2.154
+                ]
+            },
+            {
+                "ct": 6097, "table":
+                [
+                    3.604, 3.605, 3.607, 3.605, 3.604, 3.604, 3.603, 3.602, 3.598, 3.594, 3.593, 3.593, 3.593, 3.593, 3.596, 3.602,
+                    3.604, 3.607, 3.611, 3.609, 3.609, 3.608, 3.606, 3.602, 3.599, 3.596, 3.596, 3.594, 3.594, 3.594, 3.598, 3.602,
+                    3.606, 3.611, 3.612, 3.609, 3.611, 3.609, 3.608, 3.602, 3.599, 3.597, 3.596, 3.595, 3.594, 3.594, 3.597, 3.599,
+                    3.606, 3.609, 3.611, 3.607, 3.607, 3.606, 3.603, 3.599, 3.597, 3.595, 3.595, 3.593, 3.593, 3.592, 3.593, 3.596,
+                    3.604, 3.607, 3.607, 3.604, 3.603, 3.602, 3.599, 3.597, 3.596, 3.595, 3.595, 3.594, 3.592, 3.591, 3.591, 3.594,
+                    3.606, 3.607, 3.606, 3.604, 3.602, 3.601, 3.599, 3.597, 3.597, 3.596, 3.596, 3.595, 3.593, 3.591, 3.589, 3.592,
+                    3.604, 3.606, 3.605, 3.603, 3.602, 3.602, 3.599, 3.598, 3.596, 3.595, 3.595, 3.595, 3.591, 3.589, 3.591, 3.592,
+                    3.604, 3.604, 3.605, 3.602, 3.601, 3.601, 3.599, 3.598, 3.597, 3.595, 3.593, 3.591, 3.589, 3.591, 3.592, 3.596,
+                    3.604, 3.605, 3.606, 3.602, 3.601, 3.601, 3.601, 3.599, 3.597, 3.595, 3.593, 3.591, 3.589, 3.594, 3.598, 3.599,
+                    3.609, 3.613, 3.615, 3.611, 3.609, 3.609, 3.608, 3.605, 3.603, 3.599, 3.598, 3.597, 3.598, 3.601, 3.603, 3.603,
+                    3.613, 3.616, 3.616, 3.613, 3.609, 3.609, 3.608, 3.606, 3.604, 3.602, 3.599, 3.599, 3.599, 3.602, 3.605, 3.605,
+                    3.615, 3.616, 3.616, 3.613, 3.611, 3.604, 3.604, 3.601, 3.601, 3.599, 3.599, 3.599, 3.601, 3.602, 3.604, 3.604
                 ]
             }
         ],
         "calibrations_Cb":
         [
             {
-                "ct": 4000, "table":
-                [
-                    2.619, 2.603, 2.599, 2.597, 2.595, 2.594, 2.589, 2.587, 2.586, 2.589, 2.592, 2.597, 2.601, 2.608, 2.621, 2.621,
-                    2.619, 2.615, 2.603, 2.601, 2.596, 2.595, 2.591, 2.589, 2.589, 2.592, 2.599, 2.593, 2.601, 2.613, 2.622, 2.631,
-                    2.617, 2.617, 2.612, 2.611, 2.604, 2.598, 2.593, 2.591, 2.592, 2.591, 2.593, 2.595, 2.599, 2.614, 2.623, 2.631,
-                    2.624, 2.619, 2.615, 2.612, 2.605, 2.602, 2.597, 2.596, 2.592, 2.592, 2.595, 2.599, 2.602, 2.606, 2.619, 2.624,
-                    2.629, 2.627, 2.627, 2.617, 2.609, 2.598, 2.612, 2.623, 2.615, 2.604, 2.589, 2.595, 2.599, 2.608, 2.611, 2.614,
-                    2.629, 2.632, 2.637, 2.627, 2.612, 2.612, 2.629, 2.631, 2.628, 2.621, 2.604, 2.597, 2.598, 2.604, 2.609, 2.609,
-                    2.635, 2.636, 2.642, 2.628, 2.623, 2.623, 2.636, 2.636, 2.634, 2.628, 2.616, 2.599, 2.597, 2.601, 2.603, 2.601,
-                    2.641, 2.639, 2.646, 2.632, 2.627, 2.625, 2.632, 2.635, 2.634, 2.627, 2.614, 2.596, 2.595, 2.599, 2.599, 2.598,
-                    2.643, 2.644, 2.651, 2.649, 2.629, 2.617, 2.624, 2.629, 2.625, 2.614, 2.586, 2.599, 2.595, 2.597, 2.592, 2.595,
-                    2.645, 2.646, 2.649, 2.649, 2.638, 2.624, 2.616, 2.617, 2.609, 2.604, 2.603, 2.603, 2.595, 2.589, 2.587, 2.592,
-                    2.641, 2.643, 2.649, 2.647, 2.638, 2.618, 2.615, 2.608, 2.602, 2.595, 2.596, 2.595, 2.593, 2.584, 2.581, 2.583,
-                    2.638, 2.637, 2.647, 2.634, 2.634, 2.618, 2.621, 2.621, 2.611, 2.602, 2.596, 2.583, 2.581, 2.581, 2.576, 2.574
+                "ct": 2943, "table":
+                [
+                    3.361, 3.369, 3.379, 3.385, 3.391, 3.397, 3.401, 3.401, 3.399, 3.396, 3.394, 3.391, 3.383, 3.382, 3.376, 3.375,
+                    3.365, 3.372, 3.381, 3.387, 3.391, 3.398, 3.403, 3.403, 3.402, 3.399, 3.396, 3.392, 3.388, 3.382, 3.378, 3.374,
+                    3.366, 3.377, 3.384, 3.388, 3.391, 3.399, 3.403, 3.405, 3.405, 3.401, 3.399, 3.393, 3.388, 3.384, 3.381, 3.374,
+                    3.366, 3.378, 3.385, 3.389, 3.394, 3.398, 3.402, 3.405, 3.405, 3.404, 3.399, 3.393, 3.389, 3.385, 3.383, 3.369,
+                    3.364, 3.377, 3.383, 3.388, 3.394, 3.398, 3.401, 3.404, 3.404, 3.404, 3.401, 3.394, 3.391, 3.386, 3.383, 3.371,
+                    3.361, 3.376, 3.381, 3.387, 3.394, 3.397, 3.401, 3.402, 3.404, 3.403, 3.399, 3.397, 3.391, 3.387, 3.381, 3.371,
+                    3.359, 3.373, 3.379, 3.385, 3.394, 3.396, 3.399, 3.401, 3.402, 3.401, 3.398, 3.396, 3.392, 3.385, 3.381, 3.371,
+                    3.358, 3.368, 3.376, 3.381, 3.391, 3.395, 3.397, 3.399, 3.399, 3.397, 3.396, 3.392, 3.389, 3.383, 3.378, 3.365,
+                    3.357, 3.366, 3.373, 3.379, 3.383, 3.392, 3.394, 3.396, 3.396, 3.393, 3.391, 3.388, 3.386, 3.382, 3.377, 3.365,
+                    3.355, 3.362, 3.369, 3.374, 3.379, 3.385, 3.391, 3.393, 3.393, 3.392, 3.388, 3.385, 3.383, 3.379, 3.375, 3.362,
+                    3.351, 3.354, 3.363, 3.369, 3.374, 3.379, 3.385, 3.387, 3.391, 3.385, 3.383, 3.382, 3.378, 3.377, 3.363, 3.361,
+                    3.351, 3.352, 3.357, 3.359, 3.365, 3.371, 3.374, 3.375, 3.375, 3.375, 3.373, 3.367, 3.366, 3.366, 3.361, 3.362
+                ]
+            },
+            {
+                "ct": 6097, "table":
+                [
+                    1.654, 1.657, 1.662, 1.665, 1.666, 1.669, 1.671, 1.672, 1.671, 1.669, 1.668, 1.666, 1.661, 1.661, 1.658, 1.656,
+                    1.655, 1.659, 1.663, 1.665, 1.667, 1.671, 1.672, 1.672, 1.673, 1.671, 1.669, 1.667, 1.663, 1.661, 1.659, 1.656,
+                    1.656, 1.661, 1.665, 1.666, 1.668, 1.671, 1.673, 1.673, 1.674, 1.672, 1.669, 1.668, 1.664, 1.662, 1.659, 1.656,
+                    1.656, 1.661, 1.665, 1.667, 1.668, 1.671, 1.673, 1.674, 1.674, 1.673, 1.671, 1.668, 1.665, 1.663, 1.661, 1.655,
+                    1.656, 1.662, 1.665, 1.667, 1.669, 1.671, 1.673, 1.673, 1.674, 1.672, 1.671, 1.668, 1.665, 1.662, 1.661, 1.656,
+                    1.655, 1.661, 1.664, 1.667, 1.669, 1.672, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.656,
+                    1.654, 1.659, 1.663, 1.666, 1.669, 1.671, 1.672, 1.673, 1.673, 1.672, 1.671, 1.669, 1.666, 1.662, 1.661, 1.655,
+                    1.653, 1.658, 1.662, 1.664, 1.668, 1.669, 1.672, 1.672, 1.672, 1.671, 1.669, 1.667, 1.665, 1.661, 1.659, 1.653,
+                    1.652, 1.656, 1.659, 1.663, 1.666, 1.668, 1.669, 1.671, 1.671, 1.669, 1.667, 1.665, 1.663, 1.659, 1.657, 1.653,
+                    1.649, 1.654, 1.658, 1.661, 1.663, 1.666, 1.668, 1.669, 1.668, 1.667, 1.665, 1.663, 1.661, 1.659, 1.657, 1.651,
+                    1.646, 1.649, 1.654, 1.658, 1.661, 1.662, 1.664, 1.665, 1.666, 1.664, 1.662, 1.661, 1.659, 1.657, 1.651, 1.648,
+                    1.645, 1.646, 1.651, 1.653, 1.655, 1.657, 1.659, 1.659, 1.659, 1.658, 1.657, 1.656, 1.653, 1.653, 1.649, 1.648
                 ]
             }
         ],
         "luminance_lut":
         [
-            1.308, 1.293, 1.228, 1.175, 1.139, 1.108, 1.092, 1.082, 1.082, 1.086, 1.097, 1.114, 1.149, 1.199, 1.279, 1.303,
-            1.293, 1.249, 1.199, 1.162, 1.136, 1.109, 1.087, 1.077, 1.072, 1.081, 1.095, 1.103, 1.133, 1.172, 1.225, 1.282,
-            1.251, 1.212, 1.186, 1.159, 1.129, 1.114, 1.102, 1.088, 1.088, 1.088, 1.095, 1.117, 1.123, 1.158, 1.198, 1.249,
-            1.223, 1.192, 1.177, 1.163, 1.147, 1.139, 1.132, 1.112, 1.111, 1.107, 1.113, 1.118, 1.139, 1.155, 1.186, 1.232,
-            1.207, 1.186, 1.171, 1.162, 1.168, 1.163, 1.153, 1.138, 1.129, 1.128, 1.132, 1.136, 1.149, 1.167, 1.189, 1.216,
-            1.198, 1.186, 1.176, 1.176, 1.177, 1.185, 1.171, 1.157, 1.146, 1.144, 1.146, 1.149, 1.161, 1.181, 1.201, 1.221,
-            1.203, 1.181, 1.176, 1.178, 1.191, 1.189, 1.188, 1.174, 1.159, 1.153, 1.158, 1.161, 1.169, 1.185, 1.211, 1.227,
-            1.211, 1.179, 1.177, 1.187, 1.194, 1.196, 1.194, 1.187, 1.176, 1.169, 1.171, 1.171, 1.175, 1.189, 1.214, 1.226,
-            1.219, 1.182, 1.184, 1.191, 1.195, 1.199, 1.197, 1.194, 1.188, 1.185, 1.179, 1.179, 1.182, 1.194, 1.212, 1.227,
-            1.237, 1.192, 1.194, 1.194, 1.198, 1.199, 1.198, 1.197, 1.196, 1.193, 1.189, 1.189, 1.192, 1.203, 1.214, 1.231,
-            1.282, 1.199, 1.199, 1.197, 1.199, 1.199, 1.192, 1.193, 1.193, 1.194, 1.196, 1.197, 1.206, 1.216, 1.228, 1.244,
-            1.309, 1.236, 1.204, 1.203, 1.202, 1.194, 1.194, 1.188, 1.192, 1.192, 1.199, 1.201, 1.212, 1.221, 1.235, 1.247
+            1.054, 1.059, 1.063, 1.063, 1.063, 1.063, 1.062, 1.062, 1.062, 1.062, 1.061, 1.059, 1.056, 1.052, 1.045, 1.043,
+            1.055, 1.061, 1.065, 1.064, 1.065, 1.064, 1.063, 1.062, 1.063, 1.063, 1.061, 1.059, 1.057, 1.054, 1.049, 1.045,
+            1.057, 1.062, 1.064, 1.063, 1.072, 1.072, 1.072, 1.062, 1.062, 1.062, 1.059, 1.058, 1.056, 1.054, 1.051, 1.047,
+            1.058, 1.061, 1.063, 1.061, 1.062, 1.073, 1.073, 1.059, 1.058, 1.057, 1.057, 1.056, 1.055, 1.053, 1.051, 1.047,
+            1.057, 1.059, 1.061, 1.059, 1.059, 1.059, 1.054, 1.054, 1.056, 1.056, 1.056, 1.055, 1.054, 1.052, 1.049, 1.043,
+            1.055, 1.057, 1.059, 1.057, 1.056, 1.052, 1.049, 1.049, 1.053, 1.054, 1.054, 1.052, 1.051, 1.049, 1.043, 1.041,
+            1.049, 1.053, 1.054, 1.055, 1.052, 1.049, 1.045, 1.043, 1.044, 1.047, 1.047, 1.046, 1.047, 1.044, 1.039, 1.035,
+            1.045, 1.048, 1.049, 1.053, 1.047, 1.045, 1.041, 1.039, 1.041, 1.042, 1.042, 1.042, 1.041, 1.038, 1.033, 1.028,
+            1.032, 1.045, 1.047, 1.047, 1.042, 1.039, 1.036, 1.035, 1.036, 1.037, 1.039, 1.039, 1.039, 1.034, 1.028, 1.021,
+            1.022, 1.031, 1.038, 1.038, 1.035, 1.034, 1.033, 1.032, 1.031, 1.031, 1.037, 1.038, 1.041, 1.033, 1.021, 1.013,
+            1.012, 1.021, 1.025, 1.027, 1.027, 1.028, 1.028, 1.027, 1.025, 1.024, 1.024, 1.029, 1.038, 1.028, 1.012, 1.004,
+            1.011, 1.012, 1.017, 1.021, 1.021, 1.022, 1.021, 1.021, 1.021, 1.019, 1.017, 1.023, 1.028, 1.013, 1.004, 1.001
         ],
-        "sigma": 0.005,
-        "sigma_Cb": 0.005
+        "sigma": 0.00063,
+        "sigma_Cb": 0.00089
     },
     "rpi.contrast":
     {
@@ -185,6 +291,66 @@ 
             65535, 65535
         ]
     },
+    "rpi.ccm":
+    {
+        "ccms":
+        [
+            {
+                "ct": 2861, "ccm":
+                [
+                    1.61339, -0.55137, -0.06202, -0.24235, 1.42738, -0.18503, 0.07817, -0.77121, 1.69304
+                ]
+            },
+            {
+                "ct": 2915, "ccm":
+                [
+                    1.64366, -0.57014, -0.07352, -0.27249, 1.48118, -0.20869, 0.08973, -0.78375, 1.69402
+                ]
+            },
+            {
+                "ct": 2916, "ccm":
+                [
+                    1.59805, -0.49622, -0.10183, -0.17981, 1.25627, -0.07646, -0.00104, -0.62299, 1.62404
+                ]
+            },
+            {
+                "ct": 2922, "ccm":
+                [
+                    1.61099, -0.52067, -0.09032, -0.19271, 1.28084, -0.08813, 0.01453, -0.65247, 1.63794
+                ]
+            },
+            {
+                "ct": 2934, "ccm":
+                [
+                    1.60849, -0.51603, -0.09246, -0.19148, 1.28129, -0.08981, 0.01142, -0.64365, 1.63224
+                ]
+            },
+            {
+                "ct": 3626, "ccm":
+                [
+                    1.62525, -0.59206, -0.03319, -0.20241, 1.42135, -0.21895, 0.05845, -0.66941, 1.61096
+                ]
+            },
+            {
+                "ct": 4617, "ccm":
+                [
+                    1.62324, -0.66976, 0.04652, -0.16629, 1.56915, -0.40287, 0.07878, -0.73116, 1.65238
+                ]
+            },
+            {
+                "ct": 5674, "ccm":
+                [
+                    1.66733, -0.68927, 0.02194, -0.13995, 1.47994, -0.33998, 0.04474, -0.61721, 1.57247
+                ]
+            },
+            {
+                "ct": 7617, "ccm":
+                [
+                    1.53155, -0.66311, 0.13157, -0.03271, 1.65915, -0.62645, 0.07635, -1.01009, 1.93374
+                ]
+            }
+        ]
+    },
     "rpi.sharpen":
     {
     }