[{"id":25030,"web_url":"https://patchwork.libcamera.org/comment/25030/","msgid":"<20220920203650.owodfjn4mhguqnls@lati>","date":"2022-09-20T20:36:50","subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hello Florian,\n\nOn Tue, Sep 06, 2022 at 06:12:17PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> Add coefficients sets in the YAML tuning file to allow using different set\n> depending of the image color temperature (provided by AWB algorithm).\n>\n> During processing, LSC algorithm computes coefficients by doing a linear\n> interpolation between the two closer set.\n>\n\nAs a general question and looking at the implemenation, do we want to\ngo through copying tables and interpolation every frame ? Shouldn't we\naim instead to re-run it only when the color temperature changes\nsignificnalty enough (with significantly to be defined) ?\n\nOr is there such a mechanism in place already and I've missed it ?\n\nAnother thing to consider is that since interpolation might be\nexpensive, if the color temperature is close enough to one of the\navailable entries, we might want to use that entry directly. This is\neven more relevant when you have sparse temperatures in your set.\nIn your ov5640 tuning file the available color temperatures are 3000\nand 7000. If the current color temperature is 3100 is it worth\ninterpolating with the 7000-set which is quite distant ? I guess to\nanswer these question one should actually perform some tuning tests\nand verify how the color temperature distance impacts the resulting\ntables...\n\n> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> ---\n>  src/ipa/rkisp1/algorithms/lsc.cpp | 170 ++++++++++++++++------\n>  src/ipa/rkisp1/algorithms/lsc.h   |  21 ++-\n>  src/ipa/rkisp1/data/ov5640.yaml   | 231 ++++++++++++++++++++----------\n>  3 files changed, 300 insertions(+), 122 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> index da287ac7..f0930e95 100644\n> --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> @@ -105,14 +105,39 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n>  \tif (xSize_.empty() || ySize_.empty())\n>  \t\treturn -EINVAL;\n>\n> -\trData_ = parseTable(tuningData, \"r\");\n> -\tgrData_ = parseTable(tuningData, \"gr\");\n> -\tgbData_ = parseTable(tuningData, \"gb\");\n> -\tbData_ = parseTable(tuningData, \"b\");\n> -\n> -\tif (rData_.empty() || grData_.empty() ||\n> -\t    gbData_.empty() || bData_.empty())\n> +\t/* Get all defined sets to apply. */\n> +\tconst YamlObject &yamlSets = tuningData[\"sets\"];\n> +\tif (!yamlSets.isList()) {\n> +\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t<< \"'sets' parameter not found in tuning file\";\n>  \t\treturn -EINVAL;\n> +\t}\n> +\n> +\tdouble lastCt = -1;\n\nwhy a double ?\n\n> +\n> +\tfor (std::size_t i = 0; i < yamlSets.size(); ++i) {\n> +\t\tconst YamlObject &yamlSet = yamlSets[i];\n\nWould be sweet if we could use utils::enumerate() and make this\n\n\tfor (const auto &[i, yamlSet] : utils::enumerate(yamlsSets)) {\n\nbut YamlObject is not enumerable (yet). Should be easy to add in\nfacts (ofc not a request for this patch)\n\n> +\n> +\t\tsets_.push_back({});\n> +\t\tcomponentsData &set = sets_.back();\n> +\n> +\t\tset.ct = yamlSet[\"ct\"].get<uint16_t>(0);\n> +\t\tif (set.ct <= lastCt) {\n> +\t\t\tLOG(RkISP1Lsc, Error)\n> +\t\t\t\t<< \"Entries in 'sets' must be in increasing ct order\";\n> +\t\t\treturn -EINVAL;\n> +\t\t}\n> +\t\tlastCt = set.ct;\n> +\n> +\t\tset.r = parseTable(yamlSet, \"r\");\n> +\t\tset.gr = parseTable(yamlSet, \"gr\");\n> +\t\tset.gb = parseTable(yamlSet, \"gb\");\n> +\t\tset.b = parseTable(yamlSet, \"b\");\n> +\n> +\t\tif (set.r.empty() || set.gr.empty() ||\n> +\t\t    set.gb.empty() || set.b.empty())\n> +\t\t\treturn -EINVAL;\n> +\t}\n>\n>  \tinitialized_ = true;\n>\n> @@ -125,56 +150,119 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n>  int LensShadingCorrection::configure(IPAContext &context,\n>  \t\t\t\t     [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n>  {\n> -\tcontext.configuration.lsc.enabled = initialized_;\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> +\t\tx_[i] = xSize_[i] * size.width;\n> +\t\ty_[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\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\tx_[i] = size.width / 2 - totalSize.width;\n> +\t\t\ty_[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> +\t\ttotalSize.width += x_[i];\n> +\t\ttotalSize.height += y_[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\txGrad_[i] = std::round(32768 / x_[i]);\n> +\t\tyGrad_[i] = std::round(32768 / y_[i]);\n>  \t}\n>\n> -\tstd::copy(rData_.begin(), rData_.end(),\n> +\tcontext.configuration.lsc.enabled = initialized_;\n\nI would check if initialized_ at the very beginning and exit if not\ntrue\n\n> +\treturn 0;\n> +}\n> +\n> +void LensShadingCorrection::copyTable(rkisp1_params_cfg *params, const int index)\n> +{\n> +\tcomponentsData_t &set = sets_[index];\n> +\n> +\tstd::copy(set.r.begin(), set.r.end(),\n>  \t\t  &params->others.lsc_config.r_data_tbl[0][0]);\n> -\tstd::copy(grData_.begin(), grData_.end(),\n> +\tstd::copy(set.gr.begin(), set.gr.end(),\n>  \t\t  &params->others.lsc_config.gr_data_tbl[0][0]);\n> -\tstd::copy(gbData_.begin(), gbData_.end(),\n> +\tstd::copy(set.gb.begin(), set.gb.end(),\n>  \t\t  &params->others.lsc_config.gb_data_tbl[0][0]);\n> -\tstd::copy(bData_.begin(), bData_.end(),\n> +\tstd::copy(set.b.begin(), set.b.end(),\n>  \t\t  &params->others.lsc_config.b_data_tbl[0][0]);\n> +}\n> +\n> +/*\n> + * Interpolate LSC parameters based on color temperature value.\n> + */\n> +void LensShadingCorrection::interpolateTable(rkisp1_params_cfg *params, const double ct)\n> +{\n> +\tint index = 0;\n> +\twhile (ct > sets_[index + 1].ct)\n> +\t\tindex++;\n> +\tdouble ct0 = sets_[index].ct, ct1 = sets_[index + 1].ct;\n\nThat's risky. I know the caller guarantees that we're not dealing with\nthe first or, most important here, the last vector entry. But\nthis is an unbounded loop and the caller might get changed without\nconsidering it.\n\nI don't have much better ways to propose, as all the ones I have tried\nhave anyway some assumptions. In example\n\n\n\tauto set = sets_.begin();\n\tfor (; set != sets_.end() - 1; ++set) {\n\t\tif (set->ct < ct)\n\t\t\tbreak;\n\t}\n\n\tcomponentsData_t &set0 = *(set - 1);\n\tcomponentsData_t &set1 = *set;\n\nWon't work for arrays of a single element.\n\nAnyway, unless something more brilliant can be proposed, I would at\nleast record that we assume ct is included in the min/max color\ntemperatures ?\n\n> +\n> +\tLOG(RkISP1Lsc, Debug)\n> +\t\t<< \"ct is \" << ct << \", interpolating between \"\n> +\t\t<< ct0 << \" and \" << ct1;\n> +\n> +\tcomponentsData_t &set0 = sets_[index];\n> +\tcomponentsData_t &set1 = sets_[index + 1];\n> +\n> +\tdouble coeff0 = (ct1 - ct) / (ct1 - ct0);\n> +\tdouble coeff1 = (ct - ct0) / (ct1 - ct0);\n> +\n> +\tfor (int i = 0; i < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++i) {\n> +\t\tfor (int j = 0; j < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++j) {\n> +\t\t\tint sample = i * RKISP1_CIF_ISP_LSC_SAMPLES_MAX + j;\n> +\n> +\t\t\tparams->others.lsc_config.r_data_tbl[i][j] =\n> +\t\t\t\tset0.r[sample] * coeff0 +\n> +\t\t\t\tset1.r[sample] * coeff1;\n> +\n> +\t\t\tparams->others.lsc_config.gr_data_tbl[i][j] =\n> +\t\t\t\tset0.gr[sample] * coeff0 +\n> +\t\t\t\tset1.gr[sample] * coeff1;\n> +\n> +\t\t\tparams->others.lsc_config.gb_data_tbl[i][j] =\n> +\t\t\t\tset0.gb[sample] * coeff0 +\n> +\t\t\t\tset1.gb[sample] * coeff1;\n> +\n> +\t\t\tparams->others.lsc_config.b_data_tbl[i][j] =\n> +\t\t\t\tset0.b[sample] * coeff0 +\n> +\t\t\t\tset1.b[sample] * coeff1;\n> +\t\t}\n> +\t}\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 (!initialized_)\n> +\t\treturn;\n> +\n> +\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> +\tmemcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n> +\tmemcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n> +\tmemcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n> +\tmemcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n> +\n> +\tdouble ct = context.frameContext.awb.temperatureK;\n\nHere it's where I would check how much the color temperature has\nchanged and make choices (before the memcpys of course)\n\n> +\tif (ct <= sets_.front().ct) {\n> +\t\tLOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> +\t\t\t\t      << sets_.front().ct;\n> +\t\tcopyTable(params, 0);\n> +\t} else if (ct >= sets_.back().ct) {\n> +\t\tLOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> +\t\t\t\t      << sets_.back().ct;\n> +\t\tcopyTable(params, sets_.size() - 1);\n> +\t} else {\n> +\t\tinterpolateTable(params, ct);\n> +\t}\n>\n>  \tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n>  \tparams->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> index f68602c0..9b1adfd7 100644\n> --- a/src/ipa/rkisp1/algorithms/lsc.h\n> +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> @@ -15,6 +15,14 @@ namespace ipa::rkisp1::algorithms {\n>\n>  class LensShadingCorrection : public Algorithm\n>  {\n> +\ttypedef struct componentsData {\n\nNo need to typedef, and we usually use capital letter for types.\nThis can be just\n\n        struct Components {\n\nNice one, I'm thrilled to test it to see how much it improves the\nimage quality!\n\nThanks\n  j\n\n> +\t\tuint16_t ct;\n> +\t\tstd::vector<uint16_t> r;\n> +\t\tstd::vector<uint16_t> gr;\n> +\t\tstd::vector<uint16_t> gb;\n> +\t\tstd::vector<uint16_t> b;\n> +\t} componentsData_t;\n> +\n>  public:\n>  \tLensShadingCorrection();\n>  \t~LensShadingCorrection() = default;\n> @@ -24,15 +32,18 @@ public:\n>  \tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n>\n>  private:\n> -\tbool initialized_;\n> +\tvoid copyTable(rkisp1_params_cfg *params, const int index);\n> +\tvoid interpolateTable(rkisp1_params_cfg *params, const double ct);\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> +\tbool initialized_;\n>\n> +\tstd::vector<componentsData_t> sets_;\n>  \tstd::vector<double> xSize_;\n>  \tstd::vector<double> ySize_;\n> +\tuint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> +\tuint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> +\tuint16_t x_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> +\tuint16_t y_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n>  };\n>\n>  } /* namespace ipa::rkisp1::algorithms */\n> diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> index 33a672bc..d80c1655 100644\n> --- a/src/ipa/rkisp1/data/ov5640.yaml\n> +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> @@ -20,82 +20,161 @@ algorithms:\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> +      sets:\n> +        - ct: 3000\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> +        - ct: 7000\n> +          r:  [\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +              ]\n> +          gr: [\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +              ]\n> +          gb: [\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +              ]\n> +          b:  [\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> +              ]\n>    - DefectPixelClusterCorrection:\n>        fixed-set: false\n>        sets:\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 086B7C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Sep 2022 20:36:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 24641621C9;\n\tTue, 20 Sep 2022 22:36:55 +0200 (CEST)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 192A56218B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Sep 2022 22:36:53 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 59DA5100007;\n\tTue, 20 Sep 2022 20:36:52 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663706215;\n\tbh=PStRzWl6uBx6KfbTIe0xP5bP2vZlvudXINlu8arUyYQ=;\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=vrQbBK5L6vXHAcUAPwIogGHVp7k8eixSUx1gYkiZPAUaCwVhjyImrzmeYJxYuTkzJ\n\tep+AvdehqhdlhFeOGVrbCdSkKVxqzvVUh201aomKaKXyps4i8XoY4P+ExyMsXQdAQR\n\tBehb9Qeylvt8dpS2fT3lmMjm4jLwewInWupOx/7GSvvMa3CjWa4IMsyrokOgDeedfC\n\tSYgz8Tu+4XEm4lSfvy3SjHyY3yxoU6GonDWM+YKNuAUmFb20bgUMG+1KFTVV4CdJS0\n\thFpZtYY0AD0N6niVmX0m3qzr5VY0g44XvnKMkLSYlo2IKpPu3RkZr2ENzlmhURdodM\n\tfTY7Q0iUUbSQA==","Date":"Tue, 20 Sep 2022 22:36:50 +0200","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<20220920203650.owodfjn4mhguqnls@lati>","References":"<20220906161217.1806662-1-fsylvestre@baylibre.com>\n\t<20220906161217.1806662-2-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220906161217.1806662-2-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25084,"web_url":"https://patchwork.libcamera.org/comment/25084/","msgid":"<YyxIxE6QSDgzd/VI@pendragon.ideasonboard.com>","date":"2022-09-22T11:36:36","subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Sep 20, 2022 at 10:36:50PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> Hello Florian,\n> \n> On Tue, Sep 06, 2022 at 06:12:17PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> > Add coefficients sets in the YAML tuning file to allow using different set\n> > depending of the image color temperature (provided by AWB algorithm).\n> >\n> > During processing, LSC algorithm computes coefficients by doing a linear\n> > interpolation between the two closer set.\n> \n> As a general question and looking at the implemenation, do we want to\n> go through copying tables and interpolation every frame ? Shouldn't we\n> aim instead to re-run it only when the color temperature changes\n> significnalty enough (with significantly to be defined) ?\n\nThat could be useful indeed, although the interpolation is relatively\ncheap at this point. Florian, could you share the measurements you made\nrelated to the CPU time consumed by the LSC calculations ?\n\n> Or is there such a mechanism in place already and I've missed it ?\n> \n> Another thing to consider is that since interpolation might be\n> expensive, if the color temperature is close enough to one of the\n> available entries, we might want to use that entry directly. This is\n> even more relevant when you have sparse temperatures in your set.\n> In your ov5640 tuning file the available color temperatures are 3000\n> and 7000. If the current color temperature is 3100 is it worth\n> interpolating with the 7000-set which is quite distant ? I guess to\n> answer these question one should actually perform some tuning tests\n> and verify how the color temperature distance impacts the resulting\n> tables...\n\nIt's an interesting idea, but I would be cautious with too much early\noptimization, the calculation may not be costly. This is especially true\nif we implement a hysteresis on the colour temperature.\n\n> > Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/lsc.cpp | 170 ++++++++++++++++------\n> >  src/ipa/rkisp1/algorithms/lsc.h   |  21 ++-\n> >  src/ipa/rkisp1/data/ov5640.yaml   | 231 ++++++++++++++++++++----------\n> >  3 files changed, 300 insertions(+), 122 deletions(-)\n> >\n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > index da287ac7..f0930e95 100644\n> > --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > @@ -105,14 +105,39 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> >  \tif (xSize_.empty() || ySize_.empty())\n> >  \t\treturn -EINVAL;\n> >\n> > -\trData_ = parseTable(tuningData, \"r\");\n> > -\tgrData_ = parseTable(tuningData, \"gr\");\n> > -\tgbData_ = parseTable(tuningData, \"gb\");\n> > -\tbData_ = parseTable(tuningData, \"b\");\n> > -\n> > -\tif (rData_.empty() || grData_.empty() ||\n> > -\t    gbData_.empty() || bData_.empty())\n> > +\t/* Get all defined sets to apply. */\n> > +\tconst YamlObject &yamlSets = tuningData[\"sets\"];\n> > +\tif (!yamlSets.isList()) {\n> > +\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t<< \"'sets' parameter not found in tuning file\";\n> >  \t\treturn -EINVAL;\n> > +\t}\n> > +\n> > +\tdouble lastCt = -1;\n> \n> why a double ?\n> \n> > +\n> > +\tfor (std::size_t i = 0; i < yamlSets.size(); ++i) {\n> > +\t\tconst YamlObject &yamlSet = yamlSets[i];\n> \n> Would be sweet if we could use utils::enumerate() and make this\n> \n> \tfor (const auto &[i, yamlSet] : utils::enumerate(yamlsSets)) {\n> \n> but YamlObject is not enumerable (yet). Should be easy to add in\n> facts (ofc not a request for this patch)\n\nYamlObject isn't (by design), but YamlObject::asList() and\nYamlObject::asDict() are enumerable.\n\n\tconst auto &sets = yamlSets.asList();\n\tfor (const auto &[i, yamlSet] : utils::enumerate(sets)) {\n\nYou need the intermediate variable until\nhttps://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2012r2.pdf\ngets approved, integrated in a new C++ release, and we move to that C++\nversion (a.k.a. in a long time).\n\n> > +\n> > +\t\tsets_.push_back({});\n> > +\t\tcomponentsData &set = sets_.back();\n> > +\n> > +\t\tset.ct = yamlSet[\"ct\"].get<uint16_t>(0);\n> > +\t\tif (set.ct <= lastCt) {\n> > +\t\t\tLOG(RkISP1Lsc, Error)\n> > +\t\t\t\t<< \"Entries in 'sets' must be in increasing ct order\";\n> > +\t\t\treturn -EINVAL;\n> > +\t\t}\n> > +\t\tlastCt = set.ct;\n\nThis could also be moved after the loop with\n\n\tif (!std::is_sorted(sets_.begin(), sets_.end(),\n\t    [](const auto &a, const auto &b) { return a.ct < b.ct; })) {\n\t\tLOG(RkISP1Lsc, Error)\n\t\t\t<< \"Entries in 'sets' must be in increasing ct order\";\n\t\treturn -EINVAL;\n\t}\n\n(You need to include <algorithm>)\n\n> > +\n> > +\t\tset.r = parseTable(yamlSet, \"r\");\n> > +\t\tset.gr = parseTable(yamlSet, \"gr\");\n> > +\t\tset.gb = parseTable(yamlSet, \"gb\");\n> > +\t\tset.b = parseTable(yamlSet, \"b\");\n> > +\n> > +\t\tif (set.r.empty() || set.gr.empty() ||\n> > +\t\t    set.gb.empty() || set.b.empty())\n> > +\t\t\treturn -EINVAL;\n> > +\t}\n> >\n> >  \tinitialized_ = true;\n> >\n> > @@ -125,56 +150,119 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> >  int LensShadingCorrection::configure(IPAContext &context,\n> >  \t\t\t\t     [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n> >  {\n> > -\tcontext.configuration.lsc.enabled = initialized_;\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> > +\t\tx_[i] = xSize_[i] * size.width;\n> > +\t\ty_[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\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\nWrong indentation.\n\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\tx_[i] = size.width / 2 - totalSize.width;\n> > +\t\t\ty_[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> > +\t\ttotalSize.width += x_[i];\n> > +\t\ttotalSize.height += y_[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\txGrad_[i] = std::round(32768 / x_[i]);\n> > +\t\tyGrad_[i] = std::round(32768 / y_[i]);\n> >  \t}\n> >\n> > -\tstd::copy(rData_.begin(), rData_.end(),\n> > +\tcontext.configuration.lsc.enabled = initialized_;\n> \n> I would check if initialized_ at the very beginning and exit if not\n> true\n> \n> > +\treturn 0;\n\nMoving the gradient calculation from prepare() to configure() is a good\nchange, but it's not even mentioned in the commit message. I'd split\nthis to its own patch, going first in the series.\n\n> > +}\n> > +\n> > +void LensShadingCorrection::copyTable(rkisp1_params_cfg *params, const int index)\n\nYou can pass rkisp1_cif_isp_lsc_config instead of rkisp1_params_cfg to\nthis function. I would also make it a reference instead of a pointer as\nit can't be null.\n\nI'd also pass a const reference to the set instead of the index.\n\n> > +{\n> > +\tcomponentsData_t &set = sets_[index];\n> > +\n> > +\tstd::copy(set.r.begin(), set.r.end(),\n> >  \t\t  &params->others.lsc_config.r_data_tbl[0][0]);\n> > -\tstd::copy(grData_.begin(), grData_.end(),\n> > +\tstd::copy(set.gr.begin(), set.gr.end(),\n> >  \t\t  &params->others.lsc_config.gr_data_tbl[0][0]);\n> > -\tstd::copy(gbData_.begin(), gbData_.end(),\n> > +\tstd::copy(set.gb.begin(), set.gb.end(),\n> >  \t\t  &params->others.lsc_config.gb_data_tbl[0][0]);\n> > -\tstd::copy(bData_.begin(), bData_.end(),\n> > +\tstd::copy(set.b.begin(), set.b.end(),\n> >  \t\t  &params->others.lsc_config.b_data_tbl[0][0]);\n> > +}\n> > +\n> > +/*\n> > + * Interpolate LSC parameters based on color temperature value.\n> > + */\n> > +void LensShadingCorrection::interpolateTable(rkisp1_params_cfg *params, const double ct)\n\nSame here for params.\n\n> > +{\n> > +\tint index = 0;\n> > +\twhile (ct > sets_[index + 1].ct)\n> > +\t\tindex++;\n> > +\tdouble ct0 = sets_[index].ct, ct1 = sets_[index + 1].ct;\n> \n> That's risky. I know the caller guarantees that we're not dealing with\n> the first or, most important here, the last vector entry. But\n> this is an unbounded loop and the caller might get changed without\n> considering it.\n> \n> I don't have much better ways to propose, as all the ones I have tried\n> have anyway some assumptions. In example\n> \n> \n> \tauto set = sets_.begin();\n> \tfor (; set != sets_.end() - 1; ++set) {\n> \t\tif (set->ct < ct)\n> \t\t\tbreak;\n> \t}\n> \n> \tcomponentsData_t &set0 = *(set - 1);\n> \tcomponentsData_t &set1 = *set;\n> \n> Won't work for arrays of a single element.\n> \n> Anyway, unless something more brilliant can be proposed, I would at\n> least record that we assume ct is included in the min/max color\n> temperatures ?\n> \n> > +\n> > +\tLOG(RkISP1Lsc, Debug)\n> > +\t\t<< \"ct is \" << ct << \", interpolating between \"\n> > +\t\t<< ct0 << \" and \" << ct1;\n> > +\n> > +\tcomponentsData_t &set0 = sets_[index];\n> > +\tcomponentsData_t &set1 = sets_[index + 1];\n> > +\n> > +\tdouble coeff0 = (ct1 - ct) / (ct1 - ct0);\n> > +\tdouble coeff1 = (ct - ct0) / (ct1 - ct0);\n> > +\n> > +\tfor (int i = 0; i < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++i) {\n> > +\t\tfor (int j = 0; j < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++j) {\n> > +\t\t\tint sample = i * RKISP1_CIF_ISP_LSC_SAMPLES_MAX + j;\n\nAll these variables can be unsigned.\n\n> > +\n> > +\t\t\tparams->others.lsc_config.r_data_tbl[i][j] =\n> > +\t\t\t\tset0.r[sample] * coeff0 +\n> > +\t\t\t\tset1.r[sample] * coeff1;\n> > +\n> > +\t\t\tparams->others.lsc_config.gr_data_tbl[i][j] =\n> > +\t\t\t\tset0.gr[sample] * coeff0 +\n> > +\t\t\t\tset1.gr[sample] * coeff1;\n> > +\n> > +\t\t\tparams->others.lsc_config.gb_data_tbl[i][j] =\n> > +\t\t\t\tset0.gb[sample] * coeff0 +\n> > +\t\t\t\tset1.gb[sample] * coeff1;\n> > +\n> > +\t\t\tparams->others.lsc_config.b_data_tbl[i][j] =\n> > +\t\t\t\tset0.b[sample] * coeff0 +\n> > +\t\t\t\tset1.b[sample] * coeff1;\n> > +\t\t}\n> > +\t}\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 (!initialized_)\n> > +\t\treturn;\n> > +\n> > +\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> > +\tmemcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n> > +\tmemcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n> > +\tmemcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n> > +\tmemcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n> > +\n> > +\tdouble ct = context.frameContext.awb.temperatureK;\n> \n> Here it's where I would check how much the color temperature has\n> changed and make choices (before the memcpys of course)\n\nAs Jacopo mentioned, we shouldn't interpolate if the colour temperate is\nvery close to one of the tables, so I would have a special case here,\nbut write\n\n\tdouble ct = context.frameContext.awb.temperatureK;\n\tct = std::clamp(ct, sets_.front().ct, sets_.back().ct);\n\n\t/*\n\t * Possibly Handle hysteresis here, returning if the value\n\t * hasn't changed enough.\n\t */\n\n\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n\n\t/*\n\t * Pick the sets to interpolate between, or if the colour temperate is\n\t * close enough to one of the sets, use that set without interpolation.\n\t */\n\t...\n\n\tif (...)\n\t\tcopyTable(config, set0);\n\telse\n\t\tinterpolateTable(config, set0, set1, ct);\n\n\tmemcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n\tmemcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n\tmemcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n\tmemcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n\n> > +\tif (ct <= sets_.front().ct) {\n> > +\t\tLOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > +\t\t\t\t      << sets_.front().ct;\n> > +\t\tcopyTable(params, 0);\n> > +\t} else if (ct >= sets_.back().ct) {\n> > +\t\tLOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > +\t\t\t\t      << sets_.back().ct;\n> > +\t\tcopyTable(params, sets_.size() - 1);\n> > +\t} else {\n> > +\t\tinterpolateTable(params, ct);\n> > +\t}\n> >\n> >  \tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> >  \tparams->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> > index f68602c0..9b1adfd7 100644\n> > --- a/src/ipa/rkisp1/algorithms/lsc.h\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> > @@ -15,6 +15,14 @@ namespace ipa::rkisp1::algorithms {\n> >\n> >  class LensShadingCorrection : public Algorithm\n> >  {\n> > +\ttypedef struct componentsData {\n> \n> No need to typedef, and we usually use capital letter for types.\n> This can be just\n> \n>         struct Components {\n> \n> Nice one, I'm thrilled to test it to see how much it improves the\n> image quality!\n> \n> > +\t\tuint16_t ct;\n> > +\t\tstd::vector<uint16_t> r;\n> > +\t\tstd::vector<uint16_t> gr;\n> > +\t\tstd::vector<uint16_t> gb;\n> > +\t\tstd::vector<uint16_t> b;\n> > +\t} componentsData_t;\n> > +\n> >  public:\n> >  \tLensShadingCorrection();\n> >  \t~LensShadingCorrection() = default;\n> > @@ -24,15 +32,18 @@ public:\n> >  \tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> >\n> >  private:\n> > -\tbool initialized_;\n> > +\tvoid copyTable(rkisp1_params_cfg *params, const int index);\n> > +\tvoid interpolateTable(rkisp1_params_cfg *params, const double ct);\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> > +\tbool initialized_;\n> >\n> > +\tstd::vector<componentsData_t> sets_;\n> >  \tstd::vector<double> xSize_;\n> >  \tstd::vector<double> ySize_;\n> > +\tuint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > +\tuint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > +\tuint16_t x_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > +\tuint16_t y_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n\nMaybe xSizes_ and ySizes_ ?\n\n> >  };\n> >\n> >  } /* namespace ipa::rkisp1::algorithms */\n> > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > index 33a672bc..d80c1655 100644\n> > --- a/src/ipa/rkisp1/data/ov5640.yaml\n> > +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> > @@ -20,82 +20,161 @@ algorithms:\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> > +      sets:\n> > +        - ct: 3000\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> > +        - ct: 7000\n> > +          r:  [\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +              ]\n> > +          gr: [\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +              ]\n> > +          gb: [\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +              ]\n> > +          b:  [\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > +              ]\n> >    - DefectPixelClusterCorrection:\n> >        fixed-set: false\n> >        sets:","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 5281CBD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Sep 2022 11:36:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D82576220C;\n\tThu, 22 Sep 2022 13:36:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 48B6A6219A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Sep 2022 13:36:52 +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 624E76BE;\n\tThu, 22 Sep 2022 13:36:51 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1663846613;\n\tbh=p4EHqsfwYxbIPAVmHE45QpDLRE9zLHUFzf8X9Hw6s4U=;\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=Uukpoamn6QpMgTff8msZIOdtkSJB0KLWlJ7uHfsFMFf9PNiOm9/g6jvE+qZ4O0U2W\n\ttMvC5xFEK3aNWxFzcxag2Th1oRfPisMWWJhnyS5ZqKPzN7Yh3cAoUuPlkRJ+hrXRW4\n\tf/SSS9pS/fR6k9382cIEkFgYU7JdMFttHHYb93to/qM9MRMpuSBFDePCX+TtJpnDyj\n\tQSfEhnApcFUxxDL+mmtEGpEBEzfowoJNJ5iPonxWMwTvC4VjOEYh5QJ0AF9Y1iMhs7\n\tYiN4MZt3IroOgK2SH/MPgaCIGcaCtCGuWQs0IwsSXv4GfYvNols1FkkB8V+DUIx64X\n\tw3kh5Ol9EDoew==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1663846611;\n\tbh=p4EHqsfwYxbIPAVmHE45QpDLRE9zLHUFzf8X9Hw6s4U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZCK98k25C4DaFCr41346vfvQBfnIua8wpLvqKHMk4L/9T5m1xFZTGqgaySN1B4NXZ\n\tWTYg4nNz6s13qlOf2zSJiZh4UmMLdtWgVTsh9YMyBgB5KxGNyyRGhhoJR856egI6Cc\n\tmGhSbt3wTAtPM/ZWU5I4jgvvTbdCJyElKA6p27w8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZCK98k25\"; dkim-atps=neutral","Date":"Thu, 22 Sep 2022 14:36:36 +0300","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YyxIxE6QSDgzd/VI@pendragon.ideasonboard.com>","References":"<20220906161217.1806662-1-fsylvestre@baylibre.com>\n\t<20220906161217.1806662-2-fsylvestre@baylibre.com>\n\t<20220920203650.owodfjn4mhguqnls@lati>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220920203650.owodfjn4mhguqnls@lati>","Subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","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>"}},{"id":25125,"web_url":"https://patchwork.libcamera.org/comment/25125/","msgid":"<CALzBHU7BS_zPfbdCkV1kSvpQ4Ee=ezZM3UAo3C63nrNv5b=97w@mail.gmail.com>","date":"2022-09-26T07:35:17","subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","submitter":{"id":123,"url":"https://patchwork.libcamera.org/api/people/123/","name":"Florian Sylvestre","email":"fsylvestre@baylibre.com"},"content":"Hello,\n\nOn Thu, 22 Sept 2022 at 13:36, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> On Tue, Sep 20, 2022 at 10:36:50PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> > Hello Florian,\n> >\n> > On Tue, Sep 06, 2022 at 06:12:17PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> > > Add coefficients sets in the YAML tuning file to allow using different set\n> > > depending of the image color temperature (provided by AWB algorithm).\n> > >\n> > > During processing, LSC algorithm computes coefficients by doing a linear\n> > > interpolation between the two closer set.\n> >\n> > As a general question and looking at the implemenation, do we want to\n> > go through copying tables and interpolation every frame ? Shouldn't we\n> > aim instead to re-run it only when the color temperature changes\n> > significnalty enough (with significantly to be defined) ?\n>\n> That could be useful indeed, although the interpolation is relatively\n> cheap at this point. Florian, could you share the measurements you made\n> related to the CPU time consumed by the LSC calculations ?\nI have measured the computation time at an average 135us on an Imx8Mp board.\n\n>\n> > Or is there such a mechanism in place already and I've missed it ?\n> >\n> > Another thing to consider is that since interpolation might be\n> > expensive, if the color temperature is close enough to one of the\n> > available entries, we might want to use that entry directly. This is\n> > even more relevant when you have sparse temperatures in your set.\n> > In your ov5640 tuning file the available color temperatures are 3000\n> > and 7000. If the current color temperature is 3100 is it worth\n> > interpolating with the 7000-set which is quite distant ? I guess to\n> > answer these question one should actually perform some tuning tests\n> > and verify how the color temperature distance impacts the resulting\n> > tables...\n>\n> It's an interesting idea, but I would be cautious with too much early\n> optimization, the calculation may not be costly. This is especially true\n> if we implement a hysteresis on the colour temperature.\n>\n> > > Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> > > ---\n> > >  src/ipa/rkisp1/algorithms/lsc.cpp | 170 ++++++++++++++++------\n> > >  src/ipa/rkisp1/algorithms/lsc.h   |  21 ++-\n> > >  src/ipa/rkisp1/data/ov5640.yaml   | 231 ++++++++++++++++++++----------\n> > >  3 files changed, 300 insertions(+), 122 deletions(-)\n> > >\n> > > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > index da287ac7..f0930e95 100644\n> > > --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > @@ -105,14 +105,39 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> > >     if (xSize_.empty() || ySize_.empty())\n> > >             return -EINVAL;\n> > >\n> > > -   rData_ = parseTable(tuningData, \"r\");\n> > > -   grData_ = parseTable(tuningData, \"gr\");\n> > > -   gbData_ = parseTable(tuningData, \"gb\");\n> > > -   bData_ = parseTable(tuningData, \"b\");\n> > > -\n> > > -   if (rData_.empty() || grData_.empty() ||\n> > > -       gbData_.empty() || bData_.empty())\n> > > +   /* Get all defined sets to apply. */\n> > > +   const YamlObject &yamlSets = tuningData[\"sets\"];\n> > > +   if (!yamlSets.isList()) {\n> > > +           LOG(RkISP1Lsc, Error)\n> > > +                   << \"'sets' parameter not found in tuning file\";\n> > >             return -EINVAL;\n> > > +   }\n> > > +\n> > > +   double lastCt = -1;\n> >\n> > why a double ?\n> >\n> > > +\n> > > +   for (std::size_t i = 0; i < yamlSets.size(); ++i) {\n> > > +           const YamlObject &yamlSet = yamlSets[i];\n> >\n> > Would be sweet if we could use utils::enumerate() and make this\n> >\n> >       for (const auto &[i, yamlSet] : utils::enumerate(yamlsSets)) {\n> >\n> > but YamlObject is not enumerable (yet). Should be easy to add in\n> > facts (ofc not a request for this patch)\n>\n> YamlObject isn't (by design), but YamlObject::asList() and\n> YamlObject::asDict() are enumerable.\n>\n>         const auto &sets = yamlSets.asList();\n>         for (const auto &[i, yamlSet] : utils::enumerate(sets)) {\n>\n> You need the intermediate variable until\n> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2012r2.pdf\n> gets approved, integrated in a new C++ release, and we move to that C++\n> version (a.k.a. in a long time).\n>\nLaurent, so what is your preferred version? The one you suggested?\n> > > +\n> > > +           sets_.push_back({});\n> > > +           componentsData &set = sets_.back();\n> > > +\n> > > +           set.ct = yamlSet[\"ct\"].get<uint16_t>(0);\n> > > +           if (set.ct <= lastCt) {\n> > > +                   LOG(RkISP1Lsc, Error)\n> > > +                           << \"Entries in 'sets' must be in increasing ct order\";\n> > > +                   return -EINVAL;\n> > > +           }\n> > > +           lastCt = set.ct;\n>\n> This could also be moved after the loop with\n>\n>         if (!std::is_sorted(sets_.begin(), sets_.end(),\n>             [](const auto &a, const auto &b) { return a.ct < b.ct; })) {\n>                 LOG(RkISP1Lsc, Error)\n>                         << \"Entries in 'sets' must be in increasing ct order\";\n>                 return -EINVAL;\n>         }\n>\n> (You need to include <algorithm>)\n>\n> > > +\n> > > +           set.r = parseTable(yamlSet, \"r\");\n> > > +           set.gr = parseTable(yamlSet, \"gr\");\n> > > +           set.gb = parseTable(yamlSet, \"gb\");\n> > > +           set.b = parseTable(yamlSet, \"b\");\n> > > +\n> > > +           if (set.r.empty() || set.gr.empty() ||\n> > > +               set.gb.empty() || set.b.empty())\n> > > +                   return -EINVAL;\n> > > +   }\n> > >\n> > >     initialized_ = true;\n> > >\n> > > @@ -125,56 +150,119 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> > >  int LensShadingCorrection::configure(IPAContext &context,\n> > >                                  [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n> > >  {\n> > > -   context.configuration.lsc.enabled = initialized_;\n> > > -   return 0;\n> > > -}\n> > > -\n> > > -/**\n> > > - * \\copydoc libcamera::ipa::Algorithm::prepare\n> > > - */\n> > > -void LensShadingCorrection::prepare(IPAContext &context,\n> > > -                               rkisp1_params_cfg *params)\n> > > -{\n> > > -   if (context.frameContext.frameCount > 0)\n> > > -           return;\n> > > -\n> > > -   if (!initialized_)\n> > > -           return;\n> > > -\n> > > -   struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> > >     const Size &size = context.configuration.sensor.size;\n> > >     Size totalSize{};\n> > >\n> > >     for (unsigned int i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE; ++i) {\n> > > -           config.x_size_tbl[i] = xSize_[i] * size.width;\n> > > -           config.y_size_tbl[i] = ySize_[i] * size.height;\n> > > +           x_[i] = xSize_[i] * size.width;\n> > > +           y_[i] = ySize_[i] * size.height;\n> > >\n> > >             /*\n> > > -            * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n> > > -            * y_size_tbl items shall be equal to respectively size.width/2 and\n> > > -            * size.height/2. Enforce it by computing the last tables value to avoid\n> > > -            * rounding-induced errors.\n> > > -            */\n> > > +           * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n> > > +           * y_size_tbl items shall be equal to respectively size.width/2 and\n> > > +           * size.height/2. Enforce it by computing the last tables value to avoid\n> > > +           * rounding-induced errors.\n> > > +           */\n>\n> Wrong indentation.\n>\n> > >             if (i == RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE - 1) {\n> > > -                   config.x_size_tbl[i] = size.width / 2 - totalSize.width;\n> > > -                   config.y_size_tbl[i] = size.height / 2 - totalSize.height;\n> > > +                   x_[i] = size.width / 2 - totalSize.width;\n> > > +                   y_[i] = size.height / 2 - totalSize.height;\n> > >             }\n> > >\n> > > -           totalSize.width += config.x_size_tbl[i];\n> > > -           totalSize.height += config.y_size_tbl[i];\n> > > +           totalSize.width += x_[i];\n> > > +           totalSize.height += y_[i];\n> > >\n> > > -           config.x_grad_tbl[i] = std::round(32768 / config.x_size_tbl[i]);\n> > > -           config.y_grad_tbl[i] = std::round(32768 / config.y_size_tbl[i]);\n> > > +           xGrad_[i] = std::round(32768 / x_[i]);\n> > > +           yGrad_[i] = std::round(32768 / y_[i]);\n> > >     }\n> > >\n> > > -   std::copy(rData_.begin(), rData_.end(),\n> > > +   context.configuration.lsc.enabled = initialized_;\n> >\n> > I would check if initialized_ at the very beginning and exit if not\n> > true\n> >\n> > > +   return 0;\n>\n> Moving the gradient calculation from prepare() to configure() is a good\n> change, but it's not even mentioned in the commit message. I'd split\n> this to its own patch, going first in the series.\n>\n> > > +}\n> > > +\n> > > +void LensShadingCorrection::copyTable(rkisp1_params_cfg *params, const int index)\n>\n> You can pass rkisp1_cif_isp_lsc_config instead of rkisp1_params_cfg to\n> this function. I would also make it a reference instead of a pointer as\n> it can't be null.\n>\n> I'd also pass a const reference to the set instead of the index.\n>\n> > > +{\n> > > +   componentsData_t &set = sets_[index];\n> > > +\n> > > +   std::copy(set.r.begin(), set.r.end(),\n> > >               &params->others.lsc_config.r_data_tbl[0][0]);\n> > > -   std::copy(grData_.begin(), grData_.end(),\n> > > +   std::copy(set.gr.begin(), set.gr.end(),\n> > >               &params->others.lsc_config.gr_data_tbl[0][0]);\n> > > -   std::copy(gbData_.begin(), gbData_.end(),\n> > > +   std::copy(set.gb.begin(), set.gb.end(),\n> > >               &params->others.lsc_config.gb_data_tbl[0][0]);\n> > > -   std::copy(bData_.begin(), bData_.end(),\n> > > +   std::copy(set.b.begin(), set.b.end(),\n> > >               &params->others.lsc_config.b_data_tbl[0][0]);\n> > > +}\n> > > +\n> > > +/*\n> > > + * Interpolate LSC parameters based on color temperature value.\n> > > + */\n> > > +void LensShadingCorrection::interpolateTable(rkisp1_params_cfg *params, const double ct)\n>\n> Same here for params.\n>\n> > > +{\n> > > +   int index = 0;\n> > > +   while (ct > sets_[index + 1].ct)\n> > > +           index++;\n> > > +   double ct0 = sets_[index].ct, ct1 = sets_[index + 1].ct;\n> >\n> > That's risky. I know the caller guarantees that we're not dealing with\n> > the first or, most important here, the last vector entry. But\n> > this is an unbounded loop and the caller might get changed without\n> > considering it.\n> >\n> > I don't have much better ways to propose, as all the ones I have tried\n> > have anyway some assumptions. In example\n> >\n> >\n> >       auto set = sets_.begin();\n> >       for (; set != sets_.end() - 1; ++set) {\n> >               if (set->ct < ct)\n> >                       break;\n> >       }\n> >\n> >       componentsData_t &set0 = *(set - 1);\n> >       componentsData_t &set1 = *set;\n> >\n> > Won't work for arrays of a single element.\n> >\n> > Anyway, unless something more brilliant can be proposed, I would at\n> > least record that we assume ct is included in the min/max color\n> > temperatures ?\n> >\n> > > +\n> > > +   LOG(RkISP1Lsc, Debug)\n> > > +           << \"ct is \" << ct << \", interpolating between \"\n> > > +           << ct0 << \" and \" << ct1;\n> > > +\n> > > +   componentsData_t &set0 = sets_[index];\n> > > +   componentsData_t &set1 = sets_[index + 1];\n> > > +\n> > > +   double coeff0 = (ct1 - ct) / (ct1 - ct0);\n> > > +   double coeff1 = (ct - ct0) / (ct1 - ct0);\n> > > +\n> > > +   for (int i = 0; i < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++i) {\n> > > +           for (int j = 0; j < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++j) {\n> > > +                   int sample = i * RKISP1_CIF_ISP_LSC_SAMPLES_MAX + j;\n>\n> All these variables can be unsigned.\n>\n> > > +\n> > > +                   params->others.lsc_config.r_data_tbl[i][j] =\n> > > +                           set0.r[sample] * coeff0 +\n> > > +                           set1.r[sample] * coeff1;\n> > > +\n> > > +                   params->others.lsc_config.gr_data_tbl[i][j] =\n> > > +                           set0.gr[sample] * coeff0 +\n> > > +                           set1.gr[sample] * coeff1;\n> > > +\n> > > +                   params->others.lsc_config.gb_data_tbl[i][j] =\n> > > +                           set0.gb[sample] * coeff0 +\n> > > +                           set1.gb[sample] * coeff1;\n> > > +\n> > > +                   params->others.lsc_config.b_data_tbl[i][j] =\n> > > +                           set0.b[sample] * coeff0 +\n> > > +                           set1.b[sample] * coeff1;\n> > > +           }\n> > > +   }\n> > > +}\n> > > +\n> > > +/**\n> > > + * \\copydoc libcamera::ipa::Algorithm::prepare\n> > > + */\n> > > +void LensShadingCorrection::prepare(IPAContext &context,\n> > > +                               rkisp1_params_cfg *params)\n> > > +{\n> > > +   if (!initialized_)\n> > > +           return;\n> > > +\n> > > +   struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> > > +   memcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n> > > +   memcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n> > > +   memcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n> > > +   memcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n> > > +\n> > > +   double ct = context.frameContext.awb.temperatureK;\n> >\n> > Here it's where I would check how much the color temperature has\n> > changed and make choices (before the memcpys of course)\n>\n> As Jacopo mentioned, we shouldn't interpolate if the colour temperate is\n> very close to one of the tables, so I would have a special case here,\n> but write\nJust to be makes it clear before implementing it: this 'close' is it something\nthat should come from the tuning file? (or hardcoded in the code ? from\nsomewhere else?)\nWhat should I put as a default value?\n>\n>         double ct = context.frameContext.awb.temperatureK;\n>         ct = std::clamp(ct, sets_.front().ct, sets_.back().ct);\n>\n>         /*\n>          * Possibly Handle hysteresis here, returning if the value\n>          * hasn't changed enough.\n>          */\n>\n>         struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n>\n>         /*\n>          * Pick the sets to interpolate between, or if the colour temperate is\n>          * close enough to one of the sets, use that set without interpolation.\n>          */\n>         ...\n>\n>         if (...)\n>                 copyTable(config, set0);\n>         else\n>                 interpolateTable(config, set0, set1, ct);\n>\n>         memcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n>         memcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n>         memcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n>         memcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n>\n> > > +   if (ct <= sets_.front().ct) {\n> > > +           LOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > > +                                 << sets_.front().ct;\n> > > +           copyTable(params, 0);\n> > > +   } else if (ct >= sets_.back().ct) {\n> > > +           LOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > > +                                 << sets_.back().ct;\n> > > +           copyTable(params, sets_.size() - 1);\n> > > +   } else {\n> > > +           interpolateTable(params, ct);\n> > > +   }\n> > >\n> > >     params->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> > >     params->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> > > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> > > index f68602c0..9b1adfd7 100644\n> > > --- a/src/ipa/rkisp1/algorithms/lsc.h\n> > > +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> > > @@ -15,6 +15,14 @@ namespace ipa::rkisp1::algorithms {\n> > >\n> > >  class LensShadingCorrection : public Algorithm\n> > >  {\n> > > +   typedef struct componentsData {\n> >\n> > No need to typedef, and we usually use capital letter for types.\n> > This can be just\n> >\n> >         struct Components {\n> >\n> > Nice one, I'm thrilled to test it to see how much it improves the\n> > image quality!\n> >\n> > > +           uint16_t ct;\n> > > +           std::vector<uint16_t> r;\n> > > +           std::vector<uint16_t> gr;\n> > > +           std::vector<uint16_t> gb;\n> > > +           std::vector<uint16_t> b;\n> > > +   } componentsData_t;\n> > > +\n> > >  public:\n> > >     LensShadingCorrection();\n> > >     ~LensShadingCorrection() = default;\n> > > @@ -24,15 +32,18 @@ public:\n> > >     void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> > >\n> > >  private:\n> > > -   bool initialized_;\n> > > +   void copyTable(rkisp1_params_cfg *params, const int index);\n> > > +   void interpolateTable(rkisp1_params_cfg *params, const double ct);\n> > >\n> > > -   std::vector<uint16_t> rData_;\n> > > -   std::vector<uint16_t> grData_;\n> > > -   std::vector<uint16_t> gbData_;\n> > > -   std::vector<uint16_t> bData_;\n> > > +   bool initialized_;\n> > >\n> > > +   std::vector<componentsData_t> sets_;\n> > >     std::vector<double> xSize_;\n> > >     std::vector<double> ySize_;\n> > > +   uint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > +   uint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > +   uint16_t x_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > +   uint16_t y_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n>\n> Maybe xSizes_ and ySizes_ ?\n>\n> > >  };\n> > >\n> > >  } /* namespace ipa::rkisp1::algorithms */\n> > > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > > index 33a672bc..d80c1655 100644\n> > > --- a/src/ipa/rkisp1/data/ov5640.yaml\n> > > +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> > > @@ -20,82 +20,161 @@ algorithms:\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> > > +      sets:\n> > > +        - ct: 3000\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> > > +        - ct: 7000\n> > > +          r:  [\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +              ]\n> > > +          gr: [\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +              ]\n> > > +          gb: [\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +              ]\n> > > +          b:  [\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > +              ]\n> > >    - DefectPixelClusterCorrection:\n> > >        fixed-set: false\n> > >        sets:\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 6E951C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Sep 2022 07:35:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4D166224A;\n\tMon, 26 Sep 2022 09:35:31 +0200 (CEST)","from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com\n\t[IPv6:2607:f8b0:4864:20::d2f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C49AE61F7C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Sep 2022 09:35:30 +0200 (CEST)","by mail-io1-xd2f.google.com with SMTP id v128so4497722ioe.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Sep 2022 00:35:30 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664177731;\n\tbh=8hdjA2pOy/bnj6AyhLXssGstKQg0jXLPc1dr7nSwe28=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=x7SoG3QucFsKVpvQVEYBSKpisF+jWBnccMHHQBmg1dJpEq1Z0Qof0HnGYbHtI17+p\n\t9Gg7EJvcEvoA7Dex6y+dbh636FAqBE9xFB8yOUBpr4NwOTGdoeNQ/XMkADaORGc4s6\n\t5IfTqhPofEVVkQ3+xtMIK/yqW1aSVP8Lyb/tBnHYptO34pvDjvWHxX8hmOoZ6gOfvd\n\toy5v+0pGTWJdPrZcL6JKS4g4V4xUTZCofPX83dQsztGG8F9DLpiBYZ1eNnfkTkidKa\n\tGEPsTTGPZxfxytpqSREcyTl+7irimwFyD4GrPB1D3vo2m95pqIsDJr6zDFjcoXhhkO\n\tMFhVmH7E7uQgw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date;\n\tbh=VtPKgXPhlrwWqJtmh/AwdPpAw2pTE6yG9kv1xfFfNvE=;\n\tb=yTHsl/nPZLMq5Lyxi10zg9f5R6+J1P/bgSSwV3GrI+U9UUZHt4BaPkG5pzrv54tyUX\n\tBAJx6fvh/li7x14TLjh/4YFcaynnzC5I8R19lSM8hr/pcUq1izKuIvS0gQTjpPhvNg3i\n\tO6N7xsLn7FJQ3158czKn6YaKR1Xct4XBE7sAK+mXGqjJv8k8xlpC9KGxRRPCKmo2Qk0l\n\t03zeQF9X6XKIxfgnWgOxNzGRPuVRjiivkKytV+r1C+QYuySUlWImjP2n3N5k6uSOEd1l\n\tbhNW5lYJNrtRURilz6aqOSSv9nak8tTkHMR0g+sVvQR9C51AxLdFqELTcqj2cOB9+NzJ\n\tBo1w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"yTHsl/nP\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date;\n\tbh=VtPKgXPhlrwWqJtmh/AwdPpAw2pTE6yG9kv1xfFfNvE=;\n\tb=EYN8fcGnrcctWdfUhRkHXgrl5AUzvxMXUPFswHjmrI7BlWcE3jKBKKgYhElcUtrWNs\n\tN6G9zD5dvUnWsNyyTyPaQcb8VVoB5sKQHl7v179yiDEnqOaLEOI6bZbOMl1R9xtJ7/Ox\n\t37kOhUMGs/M18zU0GLYZYev7eY0ItJhkbC5uCicYFw5GM6rHzjcom0KMxxSZttX4Riox\n\tVsVdmbsv+oRie2igiF0lOEYiT7/qXJO/55mTGRHtvudb4pwHseEmJulPYO+KI80A6OMD\n\tWXhavdDrX3/Pax5/N9ZFBrflToLwE/rtPTYnL4f0R6BSw5/pmp3v1Y9SMWBJZqHac2rD\n\tGlcg==","X-Gm-Message-State":"ACrzQf14/Ty4h/zFMzTMuCSsfyLH4wNQRmWodDOb+ss7d6qaC3l0sHu0\n\t0/UdN9MJohpnSnGIhqjKrLAv8G/qft1YaLRlHm5hQOoFscP24w==","X-Google-Smtp-Source":"AMsMyM4lW0xb4hvnPY14GfPRbochHn5igReRVRMXDZCsickqqeFG5ksGOzMOpNt7wPUn3ZDMZrEqmdjHCZihf4wrxVs=","X-Received":"by 2002:a05:6602:140d:b0:68b:1bd1:1c54 with SMTP id\n\tt13-20020a056602140d00b0068b1bd11c54mr9050442iov.9.1664177728563;\n\tMon, 26 Sep 2022 00:35:28 -0700 (PDT)","MIME-Version":"1.0","References":"<20220906161217.1806662-1-fsylvestre@baylibre.com>\n\t<20220906161217.1806662-2-fsylvestre@baylibre.com>\n\t<20220920203650.owodfjn4mhguqnls@lati>\n\t<YyxIxE6QSDgzd/VI@pendragon.ideasonboard.com>","In-Reply-To":"<YyxIxE6QSDgzd/VI@pendragon.ideasonboard.com>","Date":"Mon, 26 Sep 2022 09:35:17 +0200","Message-ID":"<CALzBHU7BS_zPfbdCkV1kSvpQ4Ee=ezZM3UAo3C63nrNv5b=97w@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","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":"Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Florian Sylvestre <fsylvestre@baylibre.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":25126,"web_url":"https://patchwork.libcamera.org/comment/25126/","msgid":"<YzFd0AQSJdco+N6C@pendragon.ideasonboard.com>","date":"2022-09-26T08:07:44","subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Florian,\n\nOn Mon, Sep 26, 2022 at 09:35:17AM +0200, Florian Sylvestre wrote:\n> On Thu, 22 Sept 2022 at 13:36, Laurent Pinchart wrote:\n> > On Tue, Sep 20, 2022 at 10:36:50PM +0200, Jacopo Mondi wrote:\n> > > On Tue, Sep 06, 2022 at 06:12:17PM +0200, Florian Sylvestre via libcamera-devel wrote:\n> > > > Add coefficients sets in the YAML tuning file to allow using different set\n> > > > depending of the image color temperature (provided by AWB algorithm).\n> > > >\n> > > > During processing, LSC algorithm computes coefficients by doing a linear\n> > > > interpolation between the two closer set.\n> > >\n> > > As a general question and looking at the implemenation, do we want to\n> > > go through copying tables and interpolation every frame ? Shouldn't we\n> > > aim instead to re-run it only when the color temperature changes\n> > > significnalty enough (with significantly to be defined) ?\n> >\n> > That could be useful indeed, although the interpolation is relatively\n> > cheap at this point. Florian, could you share the measurements you made\n> > related to the CPU time consumed by the LSC calculations ?\n> \n> I have measured the computation time at an average 135us on an Imx8Mp board.\n> \n> > > Or is there such a mechanism in place already and I've missed it ?\n> > >\n> > > Another thing to consider is that since interpolation might be\n> > > expensive, if the color temperature is close enough to one of the\n> > > available entries, we might want to use that entry directly. This is\n> > > even more relevant when you have sparse temperatures in your set.\n> > > In your ov5640 tuning file the available color temperatures are 3000\n> > > and 7000. If the current color temperature is 3100 is it worth\n> > > interpolating with the 7000-set which is quite distant ? I guess to\n> > > answer these question one should actually perform some tuning tests\n> > > and verify how the color temperature distance impacts the resulting\n> > > tables...\n> >\n> > It's an interesting idea, but I would be cautious with too much early\n> > optimization, the calculation may not be costly. This is especially true\n> > if we implement a hysteresis on the colour temperature.\n> >\n> > > > Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> > > > ---\n> > > >  src/ipa/rkisp1/algorithms/lsc.cpp | 170 ++++++++++++++++------\n> > > >  src/ipa/rkisp1/algorithms/lsc.h   |  21 ++-\n> > > >  src/ipa/rkisp1/data/ov5640.yaml   | 231 ++++++++++++++++++++----------\n> > > >  3 files changed, 300 insertions(+), 122 deletions(-)\n> > > >\n> > > > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > > index da287ac7..f0930e95 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > > > @@ -105,14 +105,39 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> > > >     if (xSize_.empty() || ySize_.empty())\n> > > >             return -EINVAL;\n> > > >\n> > > > -   rData_ = parseTable(tuningData, \"r\");\n> > > > -   grData_ = parseTable(tuningData, \"gr\");\n> > > > -   gbData_ = parseTable(tuningData, \"gb\");\n> > > > -   bData_ = parseTable(tuningData, \"b\");\n> > > > -\n> > > > -   if (rData_.empty() || grData_.empty() ||\n> > > > -       gbData_.empty() || bData_.empty())\n> > > > +   /* Get all defined sets to apply. */\n> > > > +   const YamlObject &yamlSets = tuningData[\"sets\"];\n> > > > +   if (!yamlSets.isList()) {\n> > > > +           LOG(RkISP1Lsc, Error)\n> > > > +                   << \"'sets' parameter not found in tuning file\";\n> > > >             return -EINVAL;\n> > > > +   }\n> > > > +\n> > > > +   double lastCt = -1;\n> > >\n> > > why a double ?\n> > >\n> > > > +\n> > > > +   for (std::size_t i = 0; i < yamlSets.size(); ++i) {\n> > > > +           const YamlObject &yamlSet = yamlSets[i];\n> > >\n> > > Would be sweet if we could use utils::enumerate() and make this\n> > >\n> > >       for (const auto &[i, yamlSet] : utils::enumerate(yamlsSets)) {\n> > >\n> > > but YamlObject is not enumerable (yet). Should be easy to add in\n> > > facts (ofc not a request for this patch)\n> >\n> > YamlObject isn't (by design), but YamlObject::asList() and\n> > YamlObject::asDict() are enumerable.\n> >\n> >         const auto &sets = yamlSets.asList();\n> >         for (const auto &[i, yamlSet] : utils::enumerate(sets)) {\n> >\n> > You need the intermediate variable until\n> > https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2012r2.pdf\n> > gets approved, integrated in a new C++ release, and we move to that C++\n> > version (a.k.a. in a long time).\n> \n> Laurent, so what is your preferred version? The one you suggested?\n\nI like utils::enumerate() personally, but if you think it's less\nreadable here due to the intermediate local variable, I don't mind\neither way.\n\n> > > > +\n> > > > +           sets_.push_back({});\n> > > > +           componentsData &set = sets_.back();\n> > > > +\n> > > > +           set.ct = yamlSet[\"ct\"].get<uint16_t>(0);\n> > > > +           if (set.ct <= lastCt) {\n> > > > +                   LOG(RkISP1Lsc, Error)\n> > > > +                           << \"Entries in 'sets' must be in increasing ct order\";\n> > > > +                   return -EINVAL;\n> > > > +           }\n> > > > +           lastCt = set.ct;\n> >\n> > This could also be moved after the loop with\n> >\n> >         if (!std::is_sorted(sets_.begin(), sets_.end(),\n> >             [](const auto &a, const auto &b) { return a.ct < b.ct; })) {\n> >                 LOG(RkISP1Lsc, Error)\n> >                         << \"Entries in 'sets' must be in increasing ct order\";\n> >                 return -EINVAL;\n> >         }\n> >\n> > (You need to include <algorithm>)\n> >\n> > > > +\n> > > > +           set.r = parseTable(yamlSet, \"r\");\n> > > > +           set.gr = parseTable(yamlSet, \"gr\");\n> > > > +           set.gb = parseTable(yamlSet, \"gb\");\n> > > > +           set.b = parseTable(yamlSet, \"b\");\n> > > > +\n> > > > +           if (set.r.empty() || set.gr.empty() ||\n> > > > +               set.gb.empty() || set.b.empty())\n> > > > +                   return -EINVAL;\n> > > > +   }\n> > > >\n> > > >     initialized_ = true;\n> > > >\n> > > > @@ -125,56 +150,119 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> > > >  int LensShadingCorrection::configure(IPAContext &context,\n> > > >                                  [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n> > > >  {\n> > > > -   context.configuration.lsc.enabled = initialized_;\n> > > > -   return 0;\n> > > > -}\n> > > > -\n> > > > -/**\n> > > > - * \\copydoc libcamera::ipa::Algorithm::prepare\n> > > > - */\n> > > > -void LensShadingCorrection::prepare(IPAContext &context,\n> > > > -                               rkisp1_params_cfg *params)\n> > > > -{\n> > > > -   if (context.frameContext.frameCount > 0)\n> > > > -           return;\n> > > > -\n> > > > -   if (!initialized_)\n> > > > -           return;\n> > > > -\n> > > > -   struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> > > >     const Size &size = context.configuration.sensor.size;\n> > > >     Size totalSize{};\n> > > >\n> > > >     for (unsigned int i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE; ++i) {\n> > > > -           config.x_size_tbl[i] = xSize_[i] * size.width;\n> > > > -           config.y_size_tbl[i] = ySize_[i] * size.height;\n> > > > +           x_[i] = xSize_[i] * size.width;\n> > > > +           y_[i] = ySize_[i] * size.height;\n> > > >\n> > > >             /*\n> > > > -            * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n> > > > -            * y_size_tbl items shall be equal to respectively size.width/2 and\n> > > > -            * size.height/2. Enforce it by computing the last tables value to avoid\n> > > > -            * rounding-induced errors.\n> > > > -            */\n> > > > +           * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n> > > > +           * y_size_tbl items shall be equal to respectively size.width/2 and\n> > > > +           * size.height/2. Enforce it by computing the last tables value to avoid\n> > > > +           * rounding-induced errors.\n> > > > +           */\n> >\n> > Wrong indentation.\n> >\n> > > >             if (i == RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE - 1) {\n> > > > -                   config.x_size_tbl[i] = size.width / 2 - totalSize.width;\n> > > > -                   config.y_size_tbl[i] = size.height / 2 - totalSize.height;\n> > > > +                   x_[i] = size.width / 2 - totalSize.width;\n> > > > +                   y_[i] = size.height / 2 - totalSize.height;\n> > > >             }\n> > > >\n> > > > -           totalSize.width += config.x_size_tbl[i];\n> > > > -           totalSize.height += config.y_size_tbl[i];\n> > > > +           totalSize.width += x_[i];\n> > > > +           totalSize.height += y_[i];\n> > > >\n> > > > -           config.x_grad_tbl[i] = std::round(32768 / config.x_size_tbl[i]);\n> > > > -           config.y_grad_tbl[i] = std::round(32768 / config.y_size_tbl[i]);\n> > > > +           xGrad_[i] = std::round(32768 / x_[i]);\n> > > > +           yGrad_[i] = std::round(32768 / y_[i]);\n> > > >     }\n> > > >\n> > > > -   std::copy(rData_.begin(), rData_.end(),\n> > > > +   context.configuration.lsc.enabled = initialized_;\n> > >\n> > > I would check if initialized_ at the very beginning and exit if not\n> > > true\n> > >\n> > > > +   return 0;\n> >\n> > Moving the gradient calculation from prepare() to configure() is a good\n> > change, but it's not even mentioned in the commit message. I'd split\n> > this to its own patch, going first in the series.\n> >\n> > > > +}\n> > > > +\n> > > > +void LensShadingCorrection::copyTable(rkisp1_params_cfg *params, const int index)\n> >\n> > You can pass rkisp1_cif_isp_lsc_config instead of rkisp1_params_cfg to\n> > this function. I would also make it a reference instead of a pointer as\n> > it can't be null.\n> >\n> > I'd also pass a const reference to the set instead of the index.\n> >\n> > > > +{\n> > > > +   componentsData_t &set = sets_[index];\n> > > > +\n> > > > +   std::copy(set.r.begin(), set.r.end(),\n> > > >               &params->others.lsc_config.r_data_tbl[0][0]);\n> > > > -   std::copy(grData_.begin(), grData_.end(),\n> > > > +   std::copy(set.gr.begin(), set.gr.end(),\n> > > >               &params->others.lsc_config.gr_data_tbl[0][0]);\n> > > > -   std::copy(gbData_.begin(), gbData_.end(),\n> > > > +   std::copy(set.gb.begin(), set.gb.end(),\n> > > >               &params->others.lsc_config.gb_data_tbl[0][0]);\n> > > > -   std::copy(bData_.begin(), bData_.end(),\n> > > > +   std::copy(set.b.begin(), set.b.end(),\n> > > >               &params->others.lsc_config.b_data_tbl[0][0]);\n> > > > +}\n> > > > +\n> > > > +/*\n> > > > + * Interpolate LSC parameters based on color temperature value.\n> > > > + */\n> > > > +void LensShadingCorrection::interpolateTable(rkisp1_params_cfg *params, const double ct)\n> >\n> > Same here for params.\n> >\n> > > > +{\n> > > > +   int index = 0;\n> > > > +   while (ct > sets_[index + 1].ct)\n> > > > +           index++;\n> > > > +   double ct0 = sets_[index].ct, ct1 = sets_[index + 1].ct;\n> > >\n> > > That's risky. I know the caller guarantees that we're not dealing with\n> > > the first or, most important here, the last vector entry. But\n> > > this is an unbounded loop and the caller might get changed without\n> > > considering it.\n> > >\n> > > I don't have much better ways to propose, as all the ones I have tried\n> > > have anyway some assumptions. In example\n> > >\n> > >\n> > >       auto set = sets_.begin();\n> > >       for (; set != sets_.end() - 1; ++set) {\n> > >               if (set->ct < ct)\n> > >                       break;\n> > >       }\n> > >\n> > >       componentsData_t &set0 = *(set - 1);\n> > >       componentsData_t &set1 = *set;\n> > >\n> > > Won't work for arrays of a single element.\n> > >\n> > > Anyway, unless something more brilliant can be proposed, I would at\n> > > least record that we assume ct is included in the min/max color\n> > > temperatures ?\n> > >\n> > > > +\n> > > > +   LOG(RkISP1Lsc, Debug)\n> > > > +           << \"ct is \" << ct << \", interpolating between \"\n> > > > +           << ct0 << \" and \" << ct1;\n> > > > +\n> > > > +   componentsData_t &set0 = sets_[index];\n> > > > +   componentsData_t &set1 = sets_[index + 1];\n> > > > +\n> > > > +   double coeff0 = (ct1 - ct) / (ct1 - ct0);\n> > > > +   double coeff1 = (ct - ct0) / (ct1 - ct0);\n> > > > +\n> > > > +   for (int i = 0; i < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++i) {\n> > > > +           for (int j = 0; j < RKISP1_CIF_ISP_LSC_SAMPLES_MAX; ++j) {\n> > > > +                   int sample = i * RKISP1_CIF_ISP_LSC_SAMPLES_MAX + j;\n> >\n> > All these variables can be unsigned.\n> >\n> > > > +\n> > > > +                   params->others.lsc_config.r_data_tbl[i][j] =\n> > > > +                           set0.r[sample] * coeff0 +\n> > > > +                           set1.r[sample] * coeff1;\n> > > > +\n> > > > +                   params->others.lsc_config.gr_data_tbl[i][j] =\n> > > > +                           set0.gr[sample] * coeff0 +\n> > > > +                           set1.gr[sample] * coeff1;\n> > > > +\n> > > > +                   params->others.lsc_config.gb_data_tbl[i][j] =\n> > > > +                           set0.gb[sample] * coeff0 +\n> > > > +                           set1.gb[sample] * coeff1;\n> > > > +\n> > > > +                   params->others.lsc_config.b_data_tbl[i][j] =\n> > > > +                           set0.b[sample] * coeff0 +\n> > > > +                           set1.b[sample] * coeff1;\n> > > > +           }\n> > > > +   }\n> > > > +}\n> > > > +\n> > > > +/**\n> > > > + * \\copydoc libcamera::ipa::Algorithm::prepare\n> > > > + */\n> > > > +void LensShadingCorrection::prepare(IPAContext &context,\n> > > > +                               rkisp1_params_cfg *params)\n> > > > +{\n> > > > +   if (!initialized_)\n> > > > +           return;\n> > > > +\n> > > > +   struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> > > > +   memcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n> > > > +   memcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n> > > > +   memcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n> > > > +   memcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n> > > > +\n> > > > +   double ct = context.frameContext.awb.temperatureK;\n> > >\n> > > Here it's where I would check how much the color temperature has\n> > > changed and make choices (before the memcpys of course)\n> >\n> > As Jacopo mentioned, we shouldn't interpolate if the colour temperate is\n> > very close to one of the tables, so I would have a special case here,\n> > but write\n> \n> Just to be makes it clear before implementing it: this 'close' is it something\n> that should come from the tuning file? (or hardcoded in the code ? from\n> somewhere else?)\n> What should I put as a default value?\n\nYou can define it as a constant in this file. 1% could be a good value\nto start with (a bit randomly).\n\n> >\n> >         double ct = context.frameContext.awb.temperatureK;\n> >         ct = std::clamp(ct, sets_.front().ct, sets_.back().ct);\n> >\n> >         /*\n> >          * Possibly Handle hysteresis here, returning if the value\n> >          * hasn't changed enough.\n> >          */\n> >\n> >         struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n> >\n> >         /*\n> >          * Pick the sets to interpolate between, or if the colour temperate is\n> >          * close enough to one of the sets, use that set without interpolation.\n> >          */\n> >         ...\n> >\n> >         if (...)\n> >                 copyTable(config, set0);\n> >         else\n> >                 interpolateTable(config, set0, set1, ct);\n> >\n> >         memcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n> >         memcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n> >         memcpy(config.x_size_tbl, x_, sizeof(config.x_size_tbl));\n> >         memcpy(config.y_size_tbl, y_, sizeof(config.y_size_tbl));\n> >\n> > > > +   if (ct <= sets_.front().ct) {\n> > > > +           LOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > > > +                                 << sets_.front().ct;\n> > > > +           copyTable(params, 0);\n> > > > +   } else if (ct >= sets_.back().ct) {\n> > > > +           LOG(RkISP1Lsc, Debug) << \"using calibration for \"\n> > > > +                                 << sets_.back().ct;\n> > > > +           copyTable(params, sets_.size() - 1);\n> > > > +   } else {\n> > > > +           interpolateTable(params, ct);\n> > > > +   }\n> > > >\n> > > >     params->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n> > > >     params->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\n> > > > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> > > > index f68602c0..9b1adfd7 100644\n> > > > --- a/src/ipa/rkisp1/algorithms/lsc.h\n> > > > +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> > > > @@ -15,6 +15,14 @@ namespace ipa::rkisp1::algorithms {\n> > > >\n> > > >  class LensShadingCorrection : public Algorithm\n> > > >  {\n> > > > +   typedef struct componentsData {\n> > >\n> > > No need to typedef, and we usually use capital letter for types.\n> > > This can be just\n> > >\n> > >         struct Components {\n> > >\n> > > Nice one, I'm thrilled to test it to see how much it improves the\n> > > image quality!\n> > >\n> > > > +           uint16_t ct;\n> > > > +           std::vector<uint16_t> r;\n> > > > +           std::vector<uint16_t> gr;\n> > > > +           std::vector<uint16_t> gb;\n> > > > +           std::vector<uint16_t> b;\n> > > > +   } componentsData_t;\n> > > > +\n> > > >  public:\n> > > >     LensShadingCorrection();\n> > > >     ~LensShadingCorrection() = default;\n> > > > @@ -24,15 +32,18 @@ public:\n> > > >     void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> > > >\n> > > >  private:\n> > > > -   bool initialized_;\n> > > > +   void copyTable(rkisp1_params_cfg *params, const int index);\n> > > > +   void interpolateTable(rkisp1_params_cfg *params, const double ct);\n> > > >\n> > > > -   std::vector<uint16_t> rData_;\n> > > > -   std::vector<uint16_t> grData_;\n> > > > -   std::vector<uint16_t> gbData_;\n> > > > -   std::vector<uint16_t> bData_;\n> > > > +   bool initialized_;\n> > > >\n> > > > +   std::vector<componentsData_t> sets_;\n> > > >     std::vector<double> xSize_;\n> > > >     std::vector<double> ySize_;\n> > > > +   uint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > > +   uint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > > +   uint16_t x_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> > > > +   uint16_t y_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n> >\n> > Maybe xSizes_ and ySizes_ ?\n> >\n> > > >  };\n> > > >\n> > > >  } /* namespace ipa::rkisp1::algorithms */\n> > > > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > > > index 33a672bc..d80c1655 100644\n> > > > --- a/src/ipa/rkisp1/data/ov5640.yaml\n> > > > +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> > > > @@ -20,82 +20,161 @@ algorithms:\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> > > > +      sets:\n> > > > +        - ct: 3000\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> > > > +        - ct: 7000\n> > > > +          r:  [\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +              ]\n> > > > +          gr: [\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +              ]\n> > > > +          gb: [\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +              ]\n> > > > +          b:  [\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +                1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536,\n> > > > +              ]\n> > > >    - DefectPixelClusterCorrection:\n> > > >        fixed-set: false\n> > > >        sets:","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 595A4BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Sep 2022 08:08:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B40FA6224B;\n\tMon, 26 Sep 2022 10:08:02 +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 1168961F7C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Sep 2022 10:08:01 +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 2BD8C592;\n\tMon, 26 Sep 2022 10:08:00 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664179682;\n\tbh=SJfFKVVWT5t+YojorFRbEfgw/olPpxDPFvofDxfO3zw=;\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=VnprgSMyL3x0ZFnsuJJT80BV1oBK05R/KKwx0mUevdxI7k3v/8mlmyGmW6har/s2Q\n\tM/QipqUbHGaveCCjF5hJb/XzyNAxd1zBDGv6goCq+IsMzR8HiYDPBei88TDrr3H7ET\n\tIPtjvVlAEWa/LMwoFa8VYwF26jHucXu411McNIEL+vP5YBrIVi9skiwfgCNUd+I840\n\tli0gj/0+bRvyyBeic1lN7sj/eBGMM2rvZl5cLzLmzw1CNotB+3+ioS4WWA24iOGXCz\n\ti4XL8DiEsqLjToS0ui+DXA6zoEvZKHQoleTz7P0aDmqA1CPAd8jFuejphWANJ1UT+s\n\tYJ9vsPnSA82gQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1664179680;\n\tbh=SJfFKVVWT5t+YojorFRbEfgw/olPpxDPFvofDxfO3zw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Cvi4WroJZlwXdXg7WIF1Snr4Gw1JtujM8VtLbgs2/zqte6WAMqWroHE2MYRLv1PmL\n\tihgiPYe51e8wXTupazfquQrmXaW1gMKrlPvw+kqDyczwfHt52moqpklyanBqE6H9JM\n\tDTzpZQLXbAPVAC8epaMaL9BIE97AtxJzXrJDzkCA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Cvi4WroJ\"; dkim-atps=neutral","Date":"Mon, 26 Sep 2022 11:07:44 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<YzFd0AQSJdco+N6C@pendragon.ideasonboard.com>","References":"<20220906161217.1806662-1-fsylvestre@baylibre.com>\n\t<20220906161217.1806662-2-fsylvestre@baylibre.com>\n\t<20220920203650.owodfjn4mhguqnls@lati>\n\t<YyxIxE6QSDgzd/VI@pendragon.ideasonboard.com>\n\t<CALzBHU7BS_zPfbdCkV1kSvpQ4Ee=ezZM3UAo3C63nrNv5b=97w@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CALzBHU7BS_zPfbdCkV1kSvpQ4Ee=ezZM3UAo3C63nrNv5b=97w@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 1/1] ipa: rkisp1: Take into account\n\tcolor temperature during LSC algorithm","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>"}}]