ipa: libipa: Pass a reference instead of pointer to Algorithm::process()
Frame contexts will become the core component of IPA modules, always available to functions of the algorithms. To indicate and prepare for this, turn the frame context pointer passed to Algorithm::process() into a reference. The RkISP1 IPA module doesn't use frame contexts yet, so pass a dummy context for now. While at it, drop an unneeded [[maybe_unused]] from Agc::process() and add a missing parameter documentation for the frameContext argument to Awb::process(). 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
024d16b7db
commit
2101af47e4
15 changed files with 23 additions and 19 deletions
|
@ -417,7 +417,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)
|
|||
*
|
||||
* [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing
|
||||
*/
|
||||
void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
|
||||
void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats)
|
||||
{
|
||||
/* Evaluate the AF buffer length */
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
|
||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -183,13 +183,13 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)
|
|||
* \param[in] yGain The gain calculated based on the relative luminance target
|
||||
* \param[in] iqMeanGain The gain calculated based on the relative luminance target
|
||||
*/
|
||||
void Agc::computeExposure(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void Agc::computeExposure(IPAContext &context, IPAFrameContext &frameContext,
|
||||
double yGain, double iqMeanGain)
|
||||
{
|
||||
const IPASessionConfiguration &configuration = context.configuration;
|
||||
/* Get the effective exposure and gain applied on the sensor. */
|
||||
uint32_t exposure = frameContext->sensor.exposure;
|
||||
double analogueGain = frameContext->sensor.gain;
|
||||
uint32_t exposure = frameContext.sensor.exposure;
|
||||
double analogueGain = frameContext.sensor.gain;
|
||||
|
||||
/* Use the highest of the two gain estimates. */
|
||||
double evGain = std::max(yGain, iqMeanGain);
|
||||
|
@ -323,7 +323,7 @@ double Agc::estimateLuminance(IPAActiveState &activeState,
|
|||
* Identify the current image brightness, and use that to estimate the optimal
|
||||
* new exposure and gain for the scene.
|
||||
*/
|
||||
void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
|
||||
void Agc::process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -28,14 +28,14 @@ public:
|
|||
~Agc() = default;
|
||||
|
||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats) override;
|
||||
|
||||
private:
|
||||
double measureBrightness(const ipu3_uapi_stats_3a *stats,
|
||||
const ipu3_uapi_grid_config &grid) const;
|
||||
utils::Duration filterExposure(utils::Duration currentExposure);
|
||||
void computeExposure(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void computeExposure(IPAContext &context, IPAFrameContext &frameContext,
|
||||
double yGain, double iqMeanGain);
|
||||
double estimateLuminance(IPAActiveState &activeState,
|
||||
const ipu3_uapi_grid_config &grid,
|
||||
|
|
|
@ -387,7 +387,7 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)
|
|||
/**
|
||||
* \copydoc libcamera::ipa::Algorithm::process
|
||||
*/
|
||||
void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
|
||||
void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats)
|
||||
{
|
||||
calculateWBGains(stats);
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -78,7 +78,7 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
|
|||
* The tone mapping look up table is generated as an inverse power curve from
|
||||
* our gamma setting.
|
||||
*/
|
||||
void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
|
||||
void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext,
|
||||
[[maybe_unused]] const ipu3_uapi_stats_3a *stats)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
|
||||
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const ipu3_uapi_stats_3a *stats) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -616,7 +616,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,
|
|||
ControlList ctrls(controls::controls);
|
||||
|
||||
for (auto const &algo : algorithms())
|
||||
algo->process(context_, &frameContext, stats);
|
||||
algo->process(context_, frameContext, stats);
|
||||
|
||||
setControls(frame);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void process([[maybe_unused]] typename Module::Context &context,
|
||||
[[maybe_unused]] typename Module::FrameContext *frameContext,
|
||||
[[maybe_unused]] typename Module::FrameContext &frameContext,
|
||||
[[maybe_unused]] const typename Module::Stats *stats)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -275,13 +275,14 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const
|
|||
/**
|
||||
* \brief Process RkISP1 statistics, and run AGC operations
|
||||
* \param[in] context The shared IPA context
|
||||
* \param[in] frameContext The current frame context
|
||||
* \param[in] stats The RKISP1 statistics and ISP results
|
||||
*
|
||||
* Identify the current image brightness, and use that to estimate the optimal
|
||||
* new exposure and gain for the scene.
|
||||
*/
|
||||
void Agc::process(IPAContext &context,
|
||||
[[maybe_unused]] IPAFrameContext *frameContext,
|
||||
[[maybe_unused]] IPAFrameContext &frameContext,
|
||||
const rkisp1_stat_buffer *stats)
|
||||
{
|
||||
const rkisp1_cif_isp_stat *params = &stats->params;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
|
||||
void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameContext,
|
||||
void process(IPAContext &context, IPAFrameContext &frameContext,
|
||||
const rkisp1_stat_buffer *stats) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -152,7 +152,7 @@ void Awb::queueRequest(IPAContext &context,
|
|||
* \copydoc libcamera::ipa::Algorithm::process
|
||||
*/
|
||||
void Awb::process([[maybe_unused]] IPAContext &context,
|
||||
[[maybe_unused]] IPAFrameContext *frameCtx,
|
||||
[[maybe_unused]] IPAFrameContext &frameCtx,
|
||||
const rkisp1_stat_buffer *stats)
|
||||
{
|
||||
const rkisp1_cif_isp_stat *params = &stats->params;
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void prepare(IPAContext &context, rkisp1_params_cfg *params) override;
|
||||
void queueRequest(IPAContext &context, const uint32_t frame,
|
||||
const ControlList &controls) override;
|
||||
void process(IPAContext &context, IPAFrameContext *frameCtx,
|
||||
void process(IPAContext &context, IPAFrameContext &frameCtx,
|
||||
const rkisp1_stat_buffer *stats) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -325,8 +325,11 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
|
|||
|
||||
unsigned int aeState = 0;
|
||||
|
||||
/* \todo Obtain the frame context to pass to process from the FCQueue */
|
||||
IPAFrameContext frameContext;
|
||||
|
||||
for (auto const &algo : algorithms())
|
||||
algo->process(context_, nullptr, stats);
|
||||
algo->process(context_, frameContext, stats);
|
||||
|
||||
setControls(frame);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue