[{"id":23835,"web_url":"https://patchwork.libcamera.org/comment/23835/","msgid":"<20220712111250.GD2364006@pyrite.rasen.tech>","date":"2022-07-12T11:12:50","subject":"Re: [libcamera-devel] [PATCH 3/5] ipa: rkisp1: Add support of Lens\n\tShading Correction control","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Florian,\n\nOn Wed, Jun 22, 2022 at 05:19:16PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> The Lens Shading Correction algorithm applies a correction on the pixels based\n> on values defined in the YAML tuning file.\n> \n> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n\nSame comments as the patch on GSL.\n\n\nPaul\n\n> ---\n>  src/ipa/rkisp1/algorithms/lsc.cpp     | 171 ++++++++++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/lsc.h       |  44 +++++++\n>  src/ipa/rkisp1/algorithms/meson.build |   1 +\n>  src/ipa/rkisp1/data/ov5640.yaml       |  81 ++++++++++++\n>  src/ipa/rkisp1/rkisp1.cpp             |   1 +\n>  5 files changed, 298 insertions(+)\n>  create mode 100644 src/ipa/rkisp1/algorithms/lsc.cpp\n>  create mode 100644 src/ipa/rkisp1/algorithms/lsc.h\n> \n> diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> new file mode 100644\n> index 00000000..f68243a1\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> @@ -0,0 +1,171 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021-2022, Ideas On Board\n> + *\n> + * lsc.cpp - RkISP1 Lens Shading Correction control\n> + */\n> +\n> +#include \"lsc.h\"\n> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include \"libcamera/internal/yaml_parser.h\"\n> +#include \"linux/rkisp1-config.h\"\n> +\n> +/**\n> + * \\file lsc.h\n> + */\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::rkisp1::algorithms {\n> +\n> +/**\n> + * \\class LensShadingCorrection\n> + * \\brief RkISP1 Lens Shading Correction control\n> + *\n> + * Due to the optical characteristics of the lens, the light intensity received\n> + * by the sensor is not uniform.\n> + *\n> + * The Lens Shading Correction algorithm applies a correction on the pixels for\n> + * each component based on measurement done during the camera tuning process.\n> + */\n> +\n> +LOG_DEFINE_CATEGORY(RkISP1Lsc)\n> +\n> +LensShadingCorrection::LensShadingCorrection()\n> +\t: tuningParameters_(false)\n> +{\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::init\n> + */\n> +int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> +\t\t\t\tconst YamlObject &tuningData)\n> +{\n> +\txSizeTbl_ = tuningData[\"x-size\"].getList<uint16_t>();\n> +\tif (xSizeTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'x-size'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< xSizeTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tySizeTbl_ = tuningData[\"y-size\"].getList<uint16_t>();\n> +\tif (ySizeTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'y-size'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< ySizeTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\txGradTbl_ = tuningData[\"x-grad\"].getList<uint16_t>();\n> +\tif (xGradTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'x-grad'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< xGradTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tyGradTbl_ = tuningData[\"y-grad\"].getList<uint16_t>();\n> +\tif (yGradTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'y-grad'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< yGradTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\trDataTbl_ = tuningData[\"r\"].getList<uint16_t>();\n> +\tif (rDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'r'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< rDataTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tgrDataTbl_ = tuningData[\"gr\"].getList<uint16_t>();\n> +\tif (grDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'gr'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< grDataTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tgbDataTbl_ = tuningData[\"gb\"].getList<uint16_t>();\n> +\tif (gbDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'gb'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< gbDataTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tbDataTbl_ = tuningData[\"b\"].getList<uint16_t>();\n> +\tif (bDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Issue while parsing 'b'\"\n> +\t\t\t<< \"in tuning file (list size:\"\n> +\t\t\t<< bDataTbl_.size() << \"/\"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\ttuningParameters_ = true;\n> +\n> +\treturn 0;\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::prepare\n> + */\n> +void LensShadingCorrection::prepare(IPAContext &context,\n> +\t\t\t\t    rkisp1_params_cfg *params)\n> +{\n> +\tif (context.frameContext.frameCount > 0)\n> +\t\treturn;\n> +\n> +\tif (!tuningParameters_)\n> +\t\treturn;\n> +\n> +\tstd::copy(xSizeTbl_.begin(), xSizeTbl_.end(),\n> +\t\t  params->others.lsc_config.x_size_tbl);\n> +\tstd::copy(ySizeTbl_.begin(), ySizeTbl_.end(),\n> +\t\t  params->others.lsc_config.y_size_tbl);\n> +\tstd::copy(xGradTbl_.begin(), xGradTbl_.end(),\n> +\t\t  params->others.lsc_config.x_grad_tbl);\n> +\tstd::copy(yGradTbl_.begin(), yGradTbl_.end(),\n> +\t\t  params->others.lsc_config.y_grad_tbl);\n> +\n> +\tstd::copy(rDataTbl_.begin(), rDataTbl_.end(),\n> +\t\t  &params->others.lsc_config.r_data_tbl[0][0]);\n> +\tstd::copy(grDataTbl_.begin(), grDataTbl_.end(),\n> +\t\t  &params->others.lsc_config.gr_data_tbl[0][0]);\n> +\tstd::copy(gbDataTbl_.begin(), gbDataTbl_.end(),\n> +\t\t  &params->others.lsc_config.gb_data_tbl[0][0]);\n> +\tstd::copy(bDataTbl_.begin(), bDataTbl_.end(),\n> +\t\t  &params->others.lsc_config.b_data_tbl[0][0]);\n> +\n> +\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> +\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> +\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> +}\n> +\n> +REGISTER_IPA_ALGORITHM(LensShadingCorrection)\n> +\n> +} /* namespace ipa::rkisp1::algorithms */\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> new file mode 100644\n> index 00000000..7f620ffa\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> @@ -0,0 +1,44 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021-2022, Ideas On Board\n> + *\n> + * gsl.h - RkISP1 Lens Shading Correction control\n> + */\n> +\n> +#pragma once\n> +\n> +#include <linux/rkisp1-config.h>\n> +\n> +#include \"algorithm.h\"\n> +\n> +namespace libcamera {\n> +\n> +struct IPACameraSensorInfo;\n> +\n> +namespace ipa::rkisp1::algorithms {\n> +\n> +class LensShadingCorrection : public Algorithm\n> +{\n> +public:\n> +\tLensShadingCorrection();\n> +\t~LensShadingCorrection() = default;\n> +\n> +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n> +\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> +\n> +private:\n> +\tbool tuningParameters_;\n> +\n> +\tstd::vector<uint16_t> rDataTbl_;\n> +\tstd::vector<uint16_t> grDataTbl_;\n> +\tstd::vector<uint16_t> gbDataTbl_;\n> +\tstd::vector<uint16_t> bDataTbl_;\n> +\n> +\tstd::vector<uint16_t> xGradTbl_;\n> +\tstd::vector<uint16_t> yGradTbl_;\n> +\tstd::vector<uint16_t> xSizeTbl_;\n> +\tstd::vector<uint16_t> ySizeTbl_;\n> +};\n> +\n> +} /* namespace ipa::rkisp1::algorithms */\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\n> index 0597c353..64e11dce 100644\n> --- a/src/ipa/rkisp1/algorithms/meson.build\n> +++ b/src/ipa/rkisp1/algorithms/meson.build\n> @@ -5,4 +5,5 @@ rkisp1_ipa_algorithms = files([\n>      'awb.cpp',\n>      'blc.cpp',\n>      'gsl.cpp',\n> +    'lsc.cpp',\n>  ])\n> diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> index 6cb84ed9..154ed3b5 100644\n> --- a/src/ipa/rkisp1/data/ov5640.yaml\n> +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> @@ -16,4 +16,85 @@ algorithms:\n>          red:   [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n>          green: [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n>          blue:  [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n> +  - LensShadingCorrection:\n> +      x-size: [ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 ]\n> +      y-size: [ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 ]\n> +      x-grad: [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n> +      y-grad: [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n> +      r:  [\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +          ]\n> +      gr: [\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +          ]\n> +      gb: [\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +          ]\n> +      b:  [\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> +          ]\n>  ...\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 622a0d61..996edc0a 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -32,6 +32,7 @@\n>  #include \"algorithms/awb.h\"\n>  #include \"algorithms/blc.h\"\n>  #include \"algorithms/gsl.h\"\n> +#include \"algorithms/lsc.h\"\n>  #include \"libipa/camera_sensor_helper.h\"\n>  \n>  #include \"ipa_context.h\"\n> -- \n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 77ADFBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Jul 2022 11:12:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DECCB6330F;\n\tTue, 12 Jul 2022 13:12:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E3EF60402\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Jul 2022 13:12:58 +0200 (CEST)","from pyrite.rasen.tech (softbank036240121080.bbtec.net\n\t[36.240.121.80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD8A0103F;\n\tTue, 12 Jul 2022 13:12:56 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657624378;\n\tbh=4bm5l2EVjl/c/Xgn2wWFnCaP5FkZOszLK7xFBgyJWJc=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=y74nrborKLRaZvGxhovfjdJTMz+Hbc/yapN5tfJDRGuYqhdRJ+t1RolFoQ7JPAK7n\n\tZr0E4Xcud6gCnJ0munz3RZf16CtdSJtH5gHo9M0Bjo0GDN2pPjYiTms8D8+xoX36wx\n\tG4ixD6cjiR3OaBmifAUZCY9Z0HbtQ4mkRZF0RjLM323npbRgKGnrZujD0tzsdGFSH5\n\tG8ovXwX8kNjOxMo6ylGgMj0O7ck8djUTypasqrvXJ+oJV8eMbtox7Lba6Y1wl/OHLX\n\texVsNt+WpDfZVFlD3vjaD+gKmRztPnTVclDuPqiYVY8C3h9E1f/w1ofT9+lEAzT3uc\n\tYIq+xKd7PCJaw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1657624377;\n\tbh=4bm5l2EVjl/c/Xgn2wWFnCaP5FkZOszLK7xFBgyJWJc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cMS9uLRYB4LVyWNU+1GaRc8AUbGQYRwUPKN7yZdJy+U0yzSUTrXd6pHQDSbZN4QGq\n\tg7cXBoB69vu08QrJ87tqhB4Z/lCxsU2uszrMS0RUc39UGDWVcyIFeZ5khmYrqlIjFH\n\tHzzBkG1E7daM8QOslxo5ZDR0AKqzmaPXczCrp5lg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"cMS9uLRY\"; dkim-atps=neutral","Date":"Tue, 12 Jul 2022 20:12:50 +0900","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<20220712111250.GD2364006@pyrite.rasen.tech>","References":"<20220622151918.451635-1-fsylvestre@baylibre.com>\n\t<20220622151918.451635-4-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220622151918.451635-4-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH 3/5] ipa: rkisp1: Add support of Lens\n\tShading Correction control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23847,"web_url":"https://patchwork.libcamera.org/comment/23847/","msgid":"<Ys4Rdajn5VPHUzqK@pendragon.ideasonboard.com>","date":"2022-07-13T00:27:33","subject":"Re: [libcamera-devel] [PATCH 3/5] ipa: rkisp1: Add support of Lens\n\tShading Correction control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Tue, Jul 12, 2022 at 08:12:50PM +0900, Paul Elder via libcamera-devel wrote:\n> On Wed, Jun 22, 2022 at 05:19:16PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> > The Lens Shading Correction algorithm applies a correction on the pixels based\n> > on values defined in the YAML tuning file.\n> > \n> > Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> \n> Same comments as the patch on GSL.\n\nDitto, plus a few comments below.\n\n> > ---\n> >  src/ipa/rkisp1/algorithms/lsc.cpp     | 171 ++++++++++++++++++++++++++\n> >  src/ipa/rkisp1/algorithms/lsc.h       |  44 +++++++\n> >  src/ipa/rkisp1/algorithms/meson.build |   1 +\n> >  src/ipa/rkisp1/data/ov5640.yaml       |  81 ++++++++++++\n> >  src/ipa/rkisp1/rkisp1.cpp             |   1 +\n> >  5 files changed, 298 insertions(+)\n> >  create mode 100644 src/ipa/rkisp1/algorithms/lsc.cpp\n> >  create mode 100644 src/ipa/rkisp1/algorithms/lsc.h\n> > \n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > new file mode 100644\n> > index 00000000..f68243a1\n> > --- /dev/null\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > @@ -0,0 +1,171 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2021-2022, Ideas On Board\n> > + *\n> > + * lsc.cpp - RkISP1 Lens Shading Correction control\n> > + */\n> > +\n> > +#include \"lsc.h\"\n> > +\n> > +#include <libcamera/base/log.h>\n> > +\n> > +#include \"libcamera/internal/yaml_parser.h\"\n> > +#include \"linux/rkisp1-config.h\"\n> > +\n> > +/**\n> > + * \\file lsc.h\n> > + */\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::rkisp1::algorithms {\n> > +\n> > +/**\n> > + * \\class LensShadingCorrection\n> > + * \\brief RkISP1 Lens Shading Correction control\n> > + *\n> > + * Due to the optical characteristics of the lens, the light intensity received\n> > + * by the sensor is not uniform.\n> > + *\n> > + * The Lens Shading Correction algorithm applies a correction on the pixels for\n> > + * each component based on measurement done during the camera tuning process.\n> > + */\n> > +\n> > +LOG_DEFINE_CATEGORY(RkISP1Lsc)\n> > +\n> > +LensShadingCorrection::LensShadingCorrection()\n> > +\t: tuningParameters_(false)\n> > +{\n> > +}\n> > +\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::init\n> > + */\n> > +int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> > +\t\t\t\tconst YamlObject &tuningData)\n> > +{\n> > +\txSizeTbl_ = tuningData[\"x-size\"].getList<uint16_t>();\n> > +\tif (xSizeTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'x-size'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< xSizeTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\tySizeTbl_ = tuningData[\"y-size\"].getList<uint16_t>();\n> > +\tif (ySizeTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'y-size'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< ySizeTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\txGradTbl_ = tuningData[\"x-grad\"].getList<uint16_t>();\n> > +\tif (xGradTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'x-grad'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< xGradTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n\nThe gradients are directly derived from the sector sizes and should thus\nbe computed in the LensShadingCorrection::prepare() function instead of\nloaded from the tuning data. Please see below\n\n> > +\n> > +\tyGradTbl_ = tuningData[\"y-grad\"].getList<uint16_t>();\n> > +\tif (yGradTbl_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'y-grad'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< yGradTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\trDataTbl_ = tuningData[\"r\"].getList<uint16_t>();\n> > +\tif (rDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'r'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< rDataTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\tgrDataTbl_ = tuningData[\"gr\"].getList<uint16_t>();\n> > +\tif (grDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'gr'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< grDataTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\tgbDataTbl_ = tuningData[\"gb\"].getList<uint16_t>();\n> > +\tif (gbDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'gb'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< gbDataTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\tbDataTbl_ = tuningData[\"b\"].getList<uint16_t>();\n> > +\tif (bDataTbl_.size() != RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"Issue while parsing 'b'\"\n> > +\t\t\t<< \"in tuning file (list size:\"\n> > +\t\t\t<< bDataTbl_.size() << \"/\"\n> > +\t\t\t<< RKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX << \")\";\n> > +\t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\ttuningParameters_ = true;\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::prepare\n> > + */\n> > +void LensShadingCorrection::prepare(IPAContext &context,\n> > +\t\t\t\t    rkisp1_params_cfg *params)\n> > +{\n> > +\tif (context.frameContext.frameCount > 0)\n> > +\t\treturn;\n> > +\n> > +\tif (!tuningParameters_)\n> > +\t\treturn;\n> > +\n> > +\tstd::copy(xSizeTbl_.begin(), xSizeTbl_.end(),\n> > +\t\t  params->others.lsc_config.x_size_tbl);\n> > +\tstd::copy(ySizeTbl_.begin(), ySizeTbl_.end(),\n> > +\t\t  params->others.lsc_config.y_size_tbl);\n> > +\tstd::copy(xGradTbl_.begin(), xGradTbl_.end(),\n> > +\t\t  params->others.lsc_config.x_grad_tbl);\n> > +\tstd::copy(yGradTbl_.begin(), yGradTbl_.end(),\n> > +\t\t  params->others.lsc_config.y_grad_tbl);\n\nThe gradient value must be equal to\n\n\tgrad = round(32768 / size)\n\nin both the X and Y directions.\n\n> > +\n> > +\tstd::copy(rDataTbl_.begin(), rDataTbl_.end(),\n> > +\t\t  &params->others.lsc_config.r_data_tbl[0][0]);\n> > +\tstd::copy(grDataTbl_.begin(), grDataTbl_.end(),\n> > +\t\t  &params->others.lsc_config.gr_data_tbl[0][0]);\n> > +\tstd::copy(gbDataTbl_.begin(), gbDataTbl_.end(),\n> > +\t\t  &params->others.lsc_config.gb_data_tbl[0][0]);\n> > +\tstd::copy(bDataTbl_.begin(), bDataTbl_.end(),\n> > +\t\t  &params->others.lsc_config.b_data_tbl[0][0]);\n> > +\n> > +\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> > +\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> > +\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> > +}\n> > +\n> > +REGISTER_IPA_ALGORITHM(LensShadingCorrection)\n> > +\n> > +} /* namespace ipa::rkisp1::algorithms */\n> > +\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> > new file mode 100644\n> > index 00000000..7f620ffa\n> > --- /dev/null\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> > @@ -0,0 +1,44 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2021-2022, Ideas On Board\n> > + *\n> > + * gsl.h - RkISP1 Lens Shading Correction control\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include <linux/rkisp1-config.h>\n> > +\n> > +#include \"algorithm.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +struct IPACameraSensorInfo;\n> > +\n> > +namespace ipa::rkisp1::algorithms {\n> > +\n> > +class LensShadingCorrection : public Algorithm\n> > +{\n> > +public:\n> > +\tLensShadingCorrection();\n> > +\t~LensShadingCorrection() = default;\n> > +\n> > +\tint init(IPAContext &context, const YamlObject &tuningData) override;\n> > +\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> > +\n> > +private:\n> > +\tbool tuningParameters_;\n> > +\n> > +\tstd::vector<uint16_t> rDataTbl_;\n> > +\tstd::vector<uint16_t> grDataTbl_;\n> > +\tstd::vector<uint16_t> gbDataTbl_;\n> > +\tstd::vector<uint16_t> bDataTbl_;\n> > +\n> > +\tstd::vector<uint16_t> xGradTbl_;\n> > +\tstd::vector<uint16_t> yGradTbl_;\n> > +\tstd::vector<uint16_t> xSizeTbl_;\n> > +\tstd::vector<uint16_t> ySizeTbl_;\n\nI would drop all the Tbl_ suffixes.\n\n> > +};\n> > +\n> > +} /* namespace ipa::rkisp1::algorithms */\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\n> > index 0597c353..64e11dce 100644\n> > --- a/src/ipa/rkisp1/algorithms/meson.build\n> > +++ b/src/ipa/rkisp1/algorithms/meson.build\n> > @@ -5,4 +5,5 @@ rkisp1_ipa_algorithms = files([\n> >      'awb.cpp',\n> >      'blc.cpp',\n> >      'gsl.cpp',\n> > +    'lsc.cpp',\n> >  ])\n> > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > index 6cb84ed9..154ed3b5 100644\n> > --- a/src/ipa/rkisp1/data/ov5640.yaml\n> > +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> > @@ -16,4 +16,85 @@ algorithms:\n> >          red:   [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n> >          green: [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n> >          blue:  [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096 ]\n> > +  - LensShadingCorrection:\n> > +      x-size: [ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 ]\n> > +      y-size: [ 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 ]\n\nI'm afraid this won't work. The sizes express how the image is divided\nin a grid of 16x16 blocks (as the grid mus be symmetrical around the\nframe centre, they're specified as 8 values instead of 16). The values\nmust thus be computed dynamically based on the frame size, with the sum\nof all the sizes horizontally and vertically being exactly equal to half\nof the image width and height respectively.\n\nYou could store relative sizes in the configuration file, for instance\nas floating point numbers, with the constraint that the sum must be\nequal to 0.5 and then multiply these values by the image width when\nconfiguring the ISP. Alternatively, you can also use fixed-by values.\n\nFor this configuration file, I would start with giving all the cells an\nidentical size.\n\n> > +      x-grad: [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n> > +      y-grad: [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n> > +      r:  [\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n\nThe values surprise me, as they're expressed on 12 bits with 2 bits of\nintegral part and 10 bits of fractional part, with valid values in the\nrange [1, 3.999]. I would thus expect all values here to be set to 1024\n(we could also store floating-point values, but that would increase the\nprocessing time during initialization, I don't think it would be\nuseful).\n\n> > +          ]\n> > +      gr: [\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +          ]\n> > +      gb: [\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +          ]\n> > +      b:  [\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n> > +          ]\n> >  ...\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index 622a0d61..996edc0a 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -32,6 +32,7 @@\n> >  #include \"algorithms/awb.h\"\n> >  #include \"algorithms/blc.h\"\n> >  #include \"algorithms/gsl.h\"\n> > +#include \"algorithms/lsc.h\"\n> >  #include \"libipa/camera_sensor_helper.h\"\n> >  \n> >  #include \"ipa_context.h\"","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DFE01BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 00:28:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F6B06330F;\n\tWed, 13 Jul 2022 02:28:05 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0BB786048B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 02:28:04 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 47BDF305;\n\tWed, 13 Jul 2022 02:28:03 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657672085;\n\tbh=dfNXDm/D4xj+1q5RBmoXrZibeZAZaBG/aT2ZCjOOftA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Mx+4dmob3pAgKptOQU4G6f2izW2iD35qxjon2TywpML+dP0sJoRayI3KeqQYr0Thb\n\ttKeG4iwi8laCc0XZDEpdKENmDLJtq/jjO4p+hyVsTaFY3Bpf83f1h065ScQFiEw45M\n\tgPR2SAKs8pbYxnCK0GEzs6JRFtvUFZRqJ2mnB7LUnHb7u2D0iHqr1NVZ8LUi+cgQX6\n\tccvnEO3lMU5u7mlgNzuj413R3ISaBBgh3UNWgtzB1M2g69VlkFJiMC5I5thq9SxQ8B\n\tbijI2dLTmW0aTwHwjnDw2hedl5p+0krxFletOByvUcqD5ws/R5BctoBAElr6+y5RP7\n\tPVyaV6S/5rsbw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1657672083;\n\tbh=dfNXDm/D4xj+1q5RBmoXrZibeZAZaBG/aT2ZCjOOftA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=l+/IPbZbfxq/qFE2G3j7BEmnPVqiYK4qCxmREkKcWIEH+nykbMKhu59xvnHVIQdCl\n\tSCh0dTx+/7RdHVbz5P8zylpUbr2fH1XwaPyyyIIG8VuUoA1fpXQ8VvzN7NPnctZ8r3\n\teWE1cKSDztSZ7MFdTC2jA1tTbjGO/IZerAJnN/Ng="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"l+/IPbZb\"; dkim-atps=neutral","Date":"Wed, 13 Jul 2022 03:27:33 +0300","To":"paul.elder@ideasonboard.com","Message-ID":"<Ys4Rdajn5VPHUzqK@pendragon.ideasonboard.com>","References":"<20220622151918.451635-1-fsylvestre@baylibre.com>\n\t<20220622151918.451635-4-fsylvestre@baylibre.com>\n\t<20220712111250.GD2364006@pyrite.rasen.tech>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220712111250.GD2364006@pyrite.rasen.tech>","Subject":"Re: [libcamera-devel] [PATCH 3/5] ipa: rkisp1: Add support of Lens\n\tShading Correction control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]