ipa: rkisp1: Use frame number passed to Algorithm::prepare()

Now that the Algorithm::prepare() function takes a frame number, we can
use it to replace the IPAActiveState::frameCount member.

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:
Laurent Pinchart 2022-09-08 00:31:23 +03:00
parent 05e6a19373
commit b3724d3766
10 changed files with 17 additions and 34 deletions

View file

@ -327,12 +327,11 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void Agc::prepare(IPAContext &context, void Agc::prepare(IPAContext &context, const uint32_t frame,
[[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
/* Configure the measurement window. */ /* Configure the measurement window. */

View file

@ -74,8 +74,7 @@ uint32_t Awb::estimateCCT(double red, double green, double blue)
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void Awb::prepare(IPAContext &context, void Awb::prepare(IPAContext &context, const uint32_t frame,
[[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
@ -88,7 +87,7 @@ void Awb::prepare(IPAContext &context,
params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AWB_GAIN; params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AWB_GAIN;
/* If we already have configured the gains and window, return. */ /* If we already have configured the gains and window, return. */
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
/* Configure the gains to apply. */ /* Configure the gains to apply. */

View file

@ -65,12 +65,12 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void BlackLevelCorrection::prepare(IPAContext &context, void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context,
[[maybe_unused]] const uint32_t frame, const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
if (!tuningParameters_) if (!tuningParameters_)

View file

@ -231,12 +231,12 @@ int DefectPixelClusterCorrection::init([[maybe_unused]] IPAContext &context,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void DefectPixelClusterCorrection::prepare(IPAContext &context, void DefectPixelClusterCorrection::prepare([[maybe_unused]] IPAContext &context,
[[maybe_unused]] const uint32_t frame, const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
if (!initialized_) if (!initialized_)

View file

@ -207,7 +207,7 @@ void Dpf::queueRequest(IPAContext &context,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void Dpf::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, void Dpf::prepare(IPAContext &context, const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
@ -216,7 +216,7 @@ void Dpf::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame,
auto &dpf = context.activeState.dpf; auto &dpf = context.activeState.dpf;
if (context.activeState.frameCount == 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_;

View file

@ -118,12 +118,12 @@ int GammaSensorLinearization::init([[maybe_unused]] IPAContext &context,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void GammaSensorLinearization::prepare(IPAContext &context, void GammaSensorLinearization::prepare([[maybe_unused]] IPAContext &context,
[[maybe_unused]] const uint32_t frame, const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
if (!initialized_) if (!initialized_)

View file

@ -132,12 +132,11 @@ int LensShadingCorrection::configure(IPAContext &context,
/** /**
* \copydoc libcamera::ipa::Algorithm::prepare * \copydoc libcamera::ipa::Algorithm::prepare
*/ */
void LensShadingCorrection::prepare(IPAContext &context, void LensShadingCorrection::prepare(IPAContext &context, const uint32_t frame,
[[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext, [[maybe_unused]] IPAFrameContext &frameContext,
rkisp1_params_cfg *params) rkisp1_params_cfg *params)
{ {
if (context.activeState.frameCount > 0) if (frame > 0)
return; return;
if (!initialized_) if (!initialized_)

View file

@ -192,15 +192,6 @@ namespace libcamera::ipa::rkisp1 {
* \brief Analogue gain multiplier * \brief Analogue gain multiplier
*/ */
/**
* \var IPAActiveState::frameCount
* \brief Counter of requests queued to the IPA module
*
* The counter is reset to 0 when the IPA module is configured, and is
* incremented for each request being queued, after calling the
* Algorithm::prepare() function of all algorithms.
*/
/** /**
* \struct IPAFrameContext * \struct IPAFrameContext
* \brief Per-frame context for algorithms * \brief Per-frame context for algorithms

View file

@ -87,8 +87,6 @@ struct IPAActiveState {
uint32_t exposure; uint32_t exposure;
double gain; double gain;
} sensor; } sensor;
unsigned int frameCount;
}; };
struct IPAFrameContext : public FrameContext { struct IPAFrameContext : public FrameContext {

View file

@ -260,8 +260,6 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain); context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);
context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain); context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);
context_.activeState.frameCount = 0;
for (auto const &algo : algorithms()) { for (auto const &algo : algorithms()) {
int ret = algo->configure(context_, info); int ret = algo->configure(context_, info);
if (ret) if (ret)
@ -324,7 +322,6 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
algo->prepare(context_, frame, frameContext, params); algo->prepare(context_, frame, frameContext, params);
paramsBufferReady.emit(frame); paramsBufferReady.emit(frame);
context_.activeState.frameCount++;
} }
void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId, void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,