summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/algorithms/lsc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipa/rkisp1/algorithms/lsc.cpp')
-rw-r--r--src/ipa/rkisp1/algorithms/lsc.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp
index 161183fc..3f00707b 100644
--- a/src/ipa/rkisp1/algorithms/lsc.cpp
+++ b/src/ipa/rkisp1/algorithms/lsc.cpp
@@ -185,18 +185,16 @@ int LensShadingCorrection::configure(IPAContext &context,
return 0;
}
-void LensShadingCorrection::setParameters(rkisp1_params_cfg *params)
+void LensShadingCorrection::setParameters(rkisp1_ext_params_lsc_config *lsc)
{
- struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;
-
- memcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));
- memcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));
- memcpy(config.x_size_tbl, xSizes_, sizeof(config.x_size_tbl));
- memcpy(config.y_size_tbl, ySizes_, sizeof(config.y_size_tbl));
-
- params->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;
- params->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;
- params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_LSC;
+ memcpy(lsc->lsc_config.x_grad_tbl, xGrad_, sizeof(lsc->lsc_config.x_grad_tbl));
+ memcpy(lsc->lsc_config.y_grad_tbl, yGrad_, sizeof(lsc->lsc_config.y_grad_tbl));
+ memcpy(lsc->lsc_config.x_size_tbl, xSizes_, sizeof(lsc->lsc_config.x_size_tbl));
+ memcpy(lsc->lsc_config.y_size_tbl, ySizes_, sizeof(lsc->lsc_config.y_size_tbl));
+
+ lsc->header.type = RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC;
+ lsc->header.enable = RKISP1_EXT_PARAMS_BLOCK_ENABLE;
+ lsc->header.size = sizeof(rkisp1_ext_params_lsc_config);
}
void LensShadingCorrection::copyTable(rkisp1_cif_isp_lsc_config &config,
@@ -248,10 +246,8 @@ void LensShadingCorrection::interpolateTable(rkisp1_cif_isp_lsc_config &config,
void LensShadingCorrection::prepare(IPAContext &context,
const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
- rkisp1_params_cfg *params)
+ rkisp1_ext_params_block_header *hdr)
{
- struct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;
-
/*
* If there is only one set, the configuration has already been done
* for first frame.
@@ -259,13 +255,16 @@ void LensShadingCorrection::prepare(IPAContext &context,
if (sets_.size() == 1 && frame > 0)
return;
+ struct rkisp1_ext_params_lsc_config *lsc =
+ reinterpret_cast<rkisp1_ext_params_lsc_config *>(hdr);
+
/*
* If there is only one set, pick it. We can ignore lastCt_, as it will
* never be relevant.
*/
if (sets_.size() == 1) {
- setParameters(params);
- copyTable(config, sets_.cbegin()->second);
+ setParameters(lsc);
+ copyTable(lsc->lsc_config, sets_.cbegin()->second);
return;
}
@@ -294,13 +293,13 @@ void LensShadingCorrection::prepare(IPAContext &context,
(lastCt_.adjusted <= ct && ct <= lastCt_.original))
return;
- setParameters(params);
+ setParameters(lsc);
/*
* The color temperature matches exactly one of the available LSC tables.
*/
if (sets_.count(ct)) {
- copyTable(config, sets_[ct]);
+ copyTable(lsc->lsc_config, sets_[ct]);
lastCt_ = { ct, ct };
return;
}
@@ -319,7 +318,7 @@ void LensShadingCorrection::prepare(IPAContext &context,
if (diff0 < threshold || diff1 < threshold) {
const Components &set = diff0 < diff1 ? set0 : set1;
LOG(RkISP1Lsc, Debug) << "using LSC table for " << set.ct;
- copyTable(config, set);
+ copyTable(lsc->lsc_config, set);
lastCt_ = { ct, set.ct };
return;
}
@@ -331,7 +330,7 @@ void LensShadingCorrection::prepare(IPAContext &context,
LOG(RkISP1Lsc, Debug)
<< "ct is " << ct << ", interpolating between "
<< ct0 << " and " << ct1;
- interpolateTable(config, set0, set1, ct);
+ interpolateTable(lsc->lsc_config, set0, set1, ct);
lastCt_ = { ct, ct };
}