ipa: rkisp1: dpf: Store per-frame information in frame context
Rework the algorithm's usage of the active state, to store the value of controls for the last queued request in the queueRequest() function, and store a copy of the values in the corresponding frame context. The latter is used in the prepare() function to populate the ISP parameters with values corresponding to the right frame. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
cb08adffe2
commit
3c3e0aa123
3 changed files with 34 additions and 17 deletions
|
@ -176,10 +176,11 @@ int Dpf::init([[maybe_unused]] IPAContext &context,
|
||||||
*/
|
*/
|
||||||
void Dpf::queueRequest(IPAContext &context,
|
void Dpf::queueRequest(IPAContext &context,
|
||||||
[[maybe_unused]] const uint32_t frame,
|
[[maybe_unused]] const uint32_t frame,
|
||||||
[[maybe_unused]] IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext,
|
||||||
const ControlList &controls)
|
const ControlList &controls)
|
||||||
{
|
{
|
||||||
auto &dpf = context.activeState.dpf;
|
auto &dpf = context.activeState.dpf;
|
||||||
|
bool update = false;
|
||||||
|
|
||||||
const auto &denoise = controls.get(controls::draft::NoiseReductionMode);
|
const auto &denoise = controls.get(controls::draft::NoiseReductionMode);
|
||||||
if (denoise) {
|
if (denoise) {
|
||||||
|
@ -187,35 +188,40 @@ void Dpf::queueRequest(IPAContext &context,
|
||||||
|
|
||||||
switch (*denoise) {
|
switch (*denoise) {
|
||||||
case controls::draft::NoiseReductionModeOff:
|
case controls::draft::NoiseReductionModeOff:
|
||||||
|
if (dpf.denoise) {
|
||||||
dpf.denoise = false;
|
dpf.denoise = false;
|
||||||
dpf.updateParams = true;
|
update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case controls::draft::NoiseReductionModeMinimal:
|
case controls::draft::NoiseReductionModeMinimal:
|
||||||
case controls::draft::NoiseReductionModeHighQuality:
|
case controls::draft::NoiseReductionModeHighQuality:
|
||||||
case controls::draft::NoiseReductionModeFast:
|
case controls::draft::NoiseReductionModeFast:
|
||||||
|
if (!dpf.denoise) {
|
||||||
dpf.denoise = true;
|
dpf.denoise = true;
|
||||||
dpf.updateParams = true;
|
update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(RkISP1Dpf, Error)
|
LOG(RkISP1Dpf, Error)
|
||||||
<< "Unsupported denoise value "
|
<< "Unsupported denoise value "
|
||||||
<< *denoise;
|
<< *denoise;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frameContext.dpf.denoise = dpf.denoise;
|
||||||
|
frameContext.dpf.update = update;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \copydoc libcamera::ipa::Algorithm::prepare
|
* \copydoc libcamera::ipa::Algorithm::prepare
|
||||||
*/
|
*/
|
||||||
void Dpf::prepare(IPAContext &context, const uint32_t frame,
|
void Dpf::prepare(IPAContext &context, const uint32_t frame,
|
||||||
[[maybe_unused]] IPAFrameContext &frameContext,
|
IPAFrameContext &frameContext, rkisp1_params_cfg *params)
|
||||||
rkisp1_params_cfg *params)
|
|
||||||
{
|
{
|
||||||
if (!initialized_)
|
if (!initialized_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto &dpf = context.activeState.dpf;
|
|
||||||
|
|
||||||
if (frame == 0) {
|
if (frame == 0) {
|
||||||
params->others.dpf_config = config_;
|
params->others.dpf_config = config_;
|
||||||
params->others.dpf_strength_config = strengthConfig_;
|
params->others.dpf_strength_config = strengthConfig_;
|
||||||
|
@ -245,12 +251,10 @@ void Dpf::prepare(IPAContext &context, const uint32_t frame,
|
||||||
RKISP1_CIF_ISP_MODULE_DPF_STRENGTH;
|
RKISP1_CIF_ISP_MODULE_DPF_STRENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dpf.updateParams) {
|
if (frameContext.dpf.update) {
|
||||||
params->module_en_update |= RKISP1_CIF_ISP_MODULE_DPF;
|
params->module_en_update |= RKISP1_CIF_ISP_MODULE_DPF;
|
||||||
if (dpf.denoise)
|
if (frameContext.dpf.denoise)
|
||||||
params->module_ens |= RKISP1_CIF_ISP_MODULE_DPF;
|
params->module_ens |= RKISP1_CIF_ISP_MODULE_DPF;
|
||||||
|
|
||||||
dpf.updateParams = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,6 @@ namespace libcamera::ipa::rkisp1 {
|
||||||
*
|
*
|
||||||
* \var IPAActiveState::dpf.denoise
|
* \var IPAActiveState::dpf.denoise
|
||||||
* \brief Indicates if denoise is activated
|
* \brief Indicates if denoise is activated
|
||||||
*
|
|
||||||
* \var IPAActiveState::dpf.updateParams
|
|
||||||
* \brief Indicates if ISP parameters need to be updated
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,6 +248,18 @@ namespace libcamera::ipa::rkisp1 {
|
||||||
* compared to the previous frame
|
* compared to the previous frame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \var IPAFrameContext::dpf
|
||||||
|
* \brief Denoise Pre-Filter parameters for this frame
|
||||||
|
*
|
||||||
|
* \var IPAFrameContext::dpf.denoise
|
||||||
|
* \brief Indicates if denoise is activated
|
||||||
|
*
|
||||||
|
* \var IPAFrameContext::dpf.update
|
||||||
|
* \brief Indicates if the denoise pre-filter parameters have been updated
|
||||||
|
* compared to the previous frame
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \var IPAFrameContext::sensor
|
* \var IPAFrameContext::sensor
|
||||||
* \brief Sensor configuration that used been used for this frame
|
* \brief Sensor configuration that used been used for this frame
|
||||||
|
|
|
@ -79,7 +79,6 @@ struct IPAActiveState {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool denoise;
|
bool denoise;
|
||||||
bool updateParams;
|
|
||||||
} dpf;
|
} dpf;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -113,6 +112,11 @@ struct IPAFrameContext : public FrameContext {
|
||||||
bool update;
|
bool update;
|
||||||
} cproc;
|
} cproc;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool denoise;
|
||||||
|
bool update;
|
||||||
|
} dpf;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t exposure;
|
uint32_t exposure;
|
||||||
double gain;
|
double gain;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue