ipa: libipa: Add frame context pointer in process()

Currently we have a single structure of IPAFrameContext but
subsequently, we shall have a ring buffer (or similar) container
to keep IPAFrameContext structures for each frame.

It would be a hassle to query out the frame context required for
process() (since they will reside in a ring buffer) by the IPA
for each process. Hence, prepare the process() libipa template to
accept a particular IPAFrameContext early on.

As for this patch, we shall pass in the pointer as nullptr, so
that the changes compile and keep working as-is.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Umang Jain 2022-05-17 22:12:33 +05:30 committed by Kieran Bingham
parent bab437df1f
commit 8b291bce82
18 changed files with 40 additions and 17 deletions

View file

@ -406,6 +406,7 @@ bool Af::afIsOutOfFocus(IPAContext context)
/**
* \brief Determine the max contrast image and lens position.
* \param[in] context The IPA context.
* \param[in] frameContext The current frame context
* \param[in] stats The statistics buffer of IPU3.
*
* Ideally, a clear image also has a relatively higher contrast. So, every
@ -419,7 +420,8 @@ bool Af::afIsOutOfFocus(IPAContext context)
*
* [1] Hill Climbing Algorithm, https://en.wikipedia.org/wiki/Hill_climbing
*/
void Af::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
void Af::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats)
{
/* Evaluate the AF buffer length */
uint32_t afRawBufferLen = context.configuration.af.afGrid.width *

View file

@ -32,7 +32,8 @@ public:
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
void process(IPAContext &context, IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats) override;
private:
void afCoarseScan(IPAContext &context);

View file

@ -318,12 +318,14 @@ double Agc::estimateLuminance(IPAActiveState &activeState,
/**
* \brief Process IPU3 statistics, and run AGC operations
* \param[in] context The shared IPA context
* \param[in] frameContext The current frame context
* \param[in] stats The IPU3 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, const ipu3_uapi_stats_3a *stats)
void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats)
{
/*
* Estimate the gain needed to have the proportion of pixels in a given

View file

@ -28,7 +28,8 @@ public:
~Agc() = default;
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
void process(IPAContext &context, IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats) override;
private:
double measureBrightness(const ipu3_uapi_stats_3a *stats,

View file

@ -17,7 +17,9 @@ namespace libcamera {
namespace ipa::ipu3 {
using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPAConfigInfo, ipu3_uapi_params, ipu3_uapi_stats_3a>;
using Algorithm = libcamera::ipa::Algorithm<IPAContext, IPAFrameContext,
IPAConfigInfo, ipu3_uapi_params,
ipu3_uapi_stats_3a>;
} /* namespace ipa::ipu3 */

View file

@ -387,7 +387,8 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)
/**
* \copydoc libcamera::ipa::Algorithm::process
*/
void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
void Awb::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats)
{
calculateWBGains(stats);

View file

@ -40,7 +40,8 @@ public:
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
void process(IPAContext &context, IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats) override;
private:
/* \todo Make these structs available to all the ISPs ? */

View file

@ -72,12 +72,13 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
/**
* \brief Calculate the tone mapping look up table
* \param context The shared IPA context
* \param frameContext The current frame context
* \param stats The IPU3 statistics and ISP results
*
* The tone mapping look up table is generated as an inverse power curve from
* our gamma setting.
*/
void ToneMapping::process(IPAContext &context,
void ToneMapping::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameContext,
[[maybe_unused]] const ipu3_uapi_stats_3a *stats)
{
/*

View file

@ -20,7 +20,8 @@ public:
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void prepare(IPAContext &context, ipu3_uapi_params *params) override;
void process(IPAContext &context, const ipu3_uapi_stats_3a *stats) override;
void process(IPAContext &context, IPAFrameContext *frameContext,
const ipu3_uapi_stats_3a *stats) override;
private:
double gamma_;