[{"id":24173,"web_url":"https://patchwork.libcamera.org/comment/24173/","msgid":"<YuCvtYxIUynnNOiq@pendragon.ideasonboard.com>","date":"2022-07-27T03:23:33","subject":"Re: [libcamera-devel] [PATCH v3 3/5] ipa: rkisp1: Add support of\n\tLens Shading Correction control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Florian,\n\nThank you for the patch.\n\nOn Tue, Jul 26, 2022 at 04:36:33PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> The Lens Shading Correction algorithm applies multipliers to all pixels\n> to compensate for the lens shading effect. The coefficients are\n> specified in a downscaled table in the YAML tuning file.\n> \n> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> ---\n>  src/ipa/rkisp1/algorithms/lsc.cpp     | 195 ++++++++++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/lsc.h       |  38 +++++\n>  src/ipa/rkisp1/algorithms/meson.build |   1 +\n>  src/ipa/rkisp1/data/ov5640.yaml       |  79 +++++++++++\n>  src/ipa/rkisp1/ipa_context.cpp        |   3 +\n>  src/ipa/rkisp1/ipa_context.h          |   1 +\n>  src/ipa/rkisp1/rkisp1.cpp             |   1 +\n>  7 files changed, 318 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..5809e154\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> @@ -0,0 +1,195 @@\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 <cmath>\n> +#include <numeric>\n> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include \"libcamera/internal/yaml_parser.h\"\n> +\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 multipliers to all pixels\n> + * to compensate for the lens shading effect. The coefficients are\n> + * specified in a downscaled table in the YAML tuning file.\n> + */\n> +\n> +LOG_DEFINE_CATEGORY(RkISP1Lsc)\n> +\n> +LensShadingCorrection::LensShadingCorrection()\n> +\t: initialized_(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> +\tstatic constexpr unsigned int kLscNumSamples =\n> +\t\tRKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX;\n> +\tfloat sum;\n> +\n> +\txSize_ = tuningData[\"x-size\"].getList<double>();\n> +\tif (xSize_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'x-size' values: expected \"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> +\t\t\t<< \" elements, got \" << xSize_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\t/*\n> +\t * Check that the sum of elements is the expected one with a tolerance\n> +\t * of 1%.\n> +\t */\n> +\tsum = std::accumulate(xSize_.begin(), xSize_.end(), 0.0f);\n> +\tif (sum < 0.495 || sum > 0.505) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'x-size' values: sum of the elements should\"\n> +\t\t\t<< \" be 0.5 , got \" << sum;\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tySize_ = tuningData[\"y-size\"].getList<double>();\n> +\tif (ySize_.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'y-size' values: expected \"\n> +\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> +\t\t\t<< \" elements, got \" << ySize_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\t/*\n> +\t * Check that the sum of elements is the expected one with a tolerance\n> +\t * of 1%.\n> +\t */\n> +\tsum = std::accumulate(ySize_.begin(), ySize_.end(), 0.0f);\n> +\tif (sum < 0.495 || sum > 0.505) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'y-size' values: sum of the elements should\"\n> +\t\t\t<< \" be 0.5 , got \" << sum;\n> +\t\treturn -EINVAL;\n> +\t}\n\nLet's avoid code duplication:\n\nstatic std::vector<double> parseSizes(const YamlObject &tuningData,\n\t\t\t\t      const char *prop)\n{\n\tstd::vector<double> sizes = tuningData[\"prop\"].getList<double>();\n\tif (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n\t\tLOG(RkISP1Lsc, Error)\n\t\t\t<< \"Invalid '\" << prop << \"' values: expected \"\n\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n\t\t\t<< \" elements, got \" << sizes.size();\n\t\treturn {};\n\t}\n\n\t/*\n\t * The sum of all elements must be 0.5 to satisfy hardware constraints.\n\t * Validate it here, allowing a 1% tolerance as rounding errors may\n\t * prevent an exact match (further adjustements will be performed in\n\t * LensShadingCorrection::prepare()).\n\t */\n\tfloat sum = std::accumulate(sizes.begin(), sizes.end(), 0.0f);\n\tif (sum < 0.495 || sum > 0.505) {\n\t\tLOG(RkISP1Lsc, Error)\n\t\t\t<< \"Invalid '\" << prop << \"' values: sum of the elements\"\n\t\t\t<< \" should be 0.5, got \" << sum;\n\t\treturn {};\n\t}\n\n\treturn sizes;\n}\n\n/**\n * \\copydoc libcamera::ipa::Algorithm::init\n */\nint LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n\t\t\t\tconst YamlObject &tuningData)\n{\n\txSize_ = parseSizes(tuningData, \"x-size\");\n\tySize_ = parseSizes(tuningData, \"y-size\");\n\n\tif (xSize_.empty() || ySize_.empty())\n\t\treturn -EINVAL;\n\n\tstatic constexpr unsigned int kLscNumSamples =\n\t\tRKISP1_CIF_ISP_LSC_SAMPLES_MAX * RKISP1_CIF_ISP_LSC_SAMPLES_MAX;\n\n\t...\n}\n\n> +\n> +\trData_ = tuningData[\"r\"].getList<uint16_t>();\n> +\tif (rData_.size() != kLscNumSamples) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'r' values: expected \"\n> +\t\t\t<< kLscNumSamples\n> +\t\t\t<< \" elements, got \" << rData_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tgrData_ = tuningData[\"gr\"].getList<uint16_t>();\n> +\tif (grData_.size() != kLscNumSamples) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'gr' values: expected \"\n> +\t\t\t<< kLscNumSamples\n> +\t\t\t<< \" elements, got \" << grData_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tgbData_ = tuningData[\"gb\"].getList<uint16_t>();\n> +\tif (gbData_.size() != kLscNumSamples) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'gb' values: expected \"\n> +\t\t\t<< kLscNumSamples\n> +\t\t\t<< \" elements, got \" << gbData_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tbData_ = tuningData[\"b\"].getList<uint16_t>();\n> +\tif (bData_.size() != kLscNumSamples) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"Invalid 'b' values: expected \"\n> +\t\t\t<< kLscNumSamples\n> +\t\t\t<< \" elements, got \" << bData_.size();\n> +\t\treturn -EINVAL;\n> +\t}\n\nAnd you could do the same for these too, with a parseTable() function.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\tinitialized_ = 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 (!initialized_)\n> +\t\treturn;\n> +\n> +\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> +\tconst Size &size = context.configuration.sensor.size;\n> +\tSize totalSize{};\n> +\n> +\tfor (unsigned int i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE; ++i) {\n> +\t\tconfig.x_size_tbl[i] = xSize_[i] * size.width;\n> +\t\tconfig.y_size_tbl[i] = ySize_[i] * size.height;\n> +\n> +\t\t/*\n> +\t\t * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n> +\t\t * y_size_tbl items shall be equal to respectively size.width/2 and\n> +\t\t * size.height/2. Enforce it by computing the last tables value to avoid\n> +\t\t * rounding-induced errors.\n> +\t\t */\n> +\t\tif (i == RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE - 1) {\n> +\t\t\tconfig.x_size_tbl[i] = size.width / 2 - totalSize.width;\n> +\t\t\tconfig.y_size_tbl[i] = size.height / 2 - totalSize.height;\n> +\t\t}\n> +\n> +\t\ttotalSize.width += config.x_size_tbl[i];\n> +\t\ttotalSize.height += config.y_size_tbl[i];\n> +\n> +\t\tconfig.x_grad_tbl[i] = std::round(32768 / config.x_size_tbl[i]);\n> +\t\tconfig.y_grad_tbl[i] = std::round(32768 / config.y_size_tbl[i]);\n> +\t}\n> +\n> +\tstd::copy(rData_.begin(), rData_.end(),\n> +\t\t  &params->others.lsc_config.r_data_tbl[0][0]);\n> +\tstd::copy(grData_.begin(), grData_.end(),\n> +\t\t  &params->others.lsc_config.gr_data_tbl[0][0]);\n> +\tstd::copy(gbData_.begin(), gbData_.end(),\n> +\t\t  &params->others.lsc_config.gb_data_tbl[0][0]);\n> +\tstd::copy(bData_.begin(), bData_.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, \"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..fdb2ec1d\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> @@ -0,0 +1,38 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021-2022, Ideas On Board\n> + *\n> + * lsc.h - RkISP1 Lens Shading Correction control\n> + */\n> +\n> +#pragma once\n> +\n> +#include \"algorithm.h\"\n> +\n> +namespace libcamera {\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 initialized_;\n> +\n> +\tstd::vector<uint16_t> rData_;\n> +\tstd::vector<uint16_t> grData_;\n> +\tstd::vector<uint16_t> gbData_;\n> +\tstd::vector<uint16_t> bData_;\n> +\n> +\tstd::vector<double> xSize_;\n> +\tstd::vector<double> ySize_;\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 13f76412..fa2ae436 100644\n> --- a/src/ipa/rkisp1/data/ov5640.yaml\n> +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> @@ -16,4 +16,83 @@ algorithms:\n>          red:   [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4095 ]\n>          green: [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4095 ]\n>          blue:  [ 0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4095 ]\n> +  - LensShadingCorrection:\n> +      x-size: [ 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625 ]\n> +      y-size: [ 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625 ]\n> +      r:  [\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +          ]\n> +      gr: [\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +          ]\n> +      gb: [\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +          ]\n> +      b:  [\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +            1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n> +          ]\n>  ...\n> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> index 1559d3ff..30bb87a9 100644\n> --- a/src/ipa/rkisp1/ipa_context.cpp\n> +++ b/src/ipa/rkisp1/ipa_context.cpp\n> @@ -95,6 +95,9 @@ namespace libcamera::ipa::rkisp1 {\n>   *\n>   * \\var IPASessionConfiguration::sensor.lineDuration\n>   * \\brief Line duration in microseconds\n> + *\n> + * \\var IPASessionConfiguration::sensor.size\n> + * \\brief Sensor output resolution\n>   */\n>  \n>  /**\n> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> index f387cace..3bfb262c 100644\n> --- a/src/ipa/rkisp1/ipa_context.h\n> +++ b/src/ipa/rkisp1/ipa_context.h\n> @@ -33,6 +33,7 @@ struct IPASessionConfiguration {\n>  \n>  \tstruct {\n>  \t\tutils::Duration lineDuration;\n> +\t\tSize size;\n>  \t} sensor;\n>  \n>  \tstruct {\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 4018265c..e5010f6a 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -211,6 +211,7 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n>  \t/* Set the hardware revision for the algorithms. */\n>  \tcontext_.configuration.hw.revision = hwRevision_;\n>  \n> +\tcontext_.configuration.sensor.size = info.outputSize;\n>  \tcontext_.configuration.sensor.lineDuration = info.lineLength * 1.0s / info.pixelRate;\n>  \n>  \t/*","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 0EEFDBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 03:23:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D98063312;\n\tWed, 27 Jul 2022 05:23:36 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7FE8603E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 05:23:34 +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 30E1A56D;\n\tWed, 27 Jul 2022 05:23:34 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658892216;\n\tbh=/9t38l2CWMXNymnamNXQUuBQr94+7/YxRz41a/g/D+4=;\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=JMZuoDwUKisKNZPXR/iIHnLrrdOMbJS7Yf+EGa+Fdg9jPrHZzQHklYgcQPB9WvxFS\n\tFKAfcjyXQWWU+CVIh9aepNqxOhzArxH3DdbtQRQ3shDdcURA+QfpBDjDl3odkQ71/3\n\tHPBTQxmjcVt2+ZJKeacuunUNpZgGZe27UsS1BfyN3s2ONGZ9MziDgb/OjKnl40UvMi\n\tRQ/CxIHK+D6GOT9N0WxQZoKLnn57JNu+6wr5TwW/mrYzWMGxBZ0G8w/t4AP8AG7/3s\n\t642U86xWpBad2POHPst+3bjJxwtju37g3+AwngzOBGUeAZTh3rO1KQ9SOPxHHv/lNz\n\t9ni4P8XFbESiw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658892214;\n\tbh=/9t38l2CWMXNymnamNXQUuBQr94+7/YxRz41a/g/D+4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aUIXkGb/+AGqfB4CNb0YadqG9bT02LMUtFzNwKCCfoE2re2tx8Glk+kJLruEm/dYZ\n\tJe6FDksDCg1Aq1aoWizGrQwAx61t5qVKRkxyXnzwPwV1BzWt9rGz4TxRI6o83SQ1DR\n\trAT5h7xeij57LuIO6HhhaYhc3Fwmw9aCoTvbDAEM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aUIXkGb/\"; dkim-atps=neutral","Date":"Wed, 27 Jul 2022 06:23:33 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<YuCvtYxIUynnNOiq@pendragon.ideasonboard.com>","References":"<20220726143635.518227-1-fsylvestre@baylibre.com>\n\t<20220726143635.518227-4-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220726143635.518227-4-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v3 3/5] ipa: rkisp1: Add support of\n\tLens Shading 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>"}}]