ipa: Pass metadata to Algorithm::process() function

Extend the Algorithm::process() function with a metadata control list,
to be filled by individual algorithms with frame metadata. Update the
rkisp1 and ipu3 IPA modules accordingly, and drop the dead code in the
IPARkISP1::prepareMetadata() function while at it.

This only creates the infrastructure, filling metadata in individual
algorithms will be handled separately.

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-10-05 12:46:03 +03:00
parent dac1a0549a
commit c20ca6587d
16 changed files with 44 additions and 37 deletions

View file

@ -409,6 +409,7 @@ bool Af::afIsOutOfFocus(IPAContext &context)
* \param[in] frame The frame context sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The statistics buffer of IPU3
* \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* Ideally, a clear image also has a relatively higher contrast. So, every
* image for each focus step should be tested to find an optimal focus step.
@ -423,7 +424,8 @@ bool Af::afIsOutOfFocus(IPAContext &context)
*/
void Af::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats)
const ipu3_uapi_stats_3a *stats,
[[maybe_unused]] ControlList &metadata)
{
/* Evaluate the AF buffer length */
uint32_t afRawBufferLen = context.configuration.af.afGrid.width *

View file

@ -36,7 +36,8 @@ public:
ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats) override;
const ipu3_uapi_stats_3a *stats,
ControlList &metadata) override;
private:
void afCoarseScan(IPAContext &context);

View file

@ -320,13 +320,15 @@ double Agc::estimateLuminance(IPAActiveState &activeState,
* \param[in] frame The current frame sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The IPU3 statistics and ISP results
* \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* 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]] const uint32_t frame,
IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats)
const ipu3_uapi_stats_3a *stats,
[[maybe_unused]] ControlList &metadata)
{
/*
* Estimate the gain needed to have the proportion of pixels in a given

View file

@ -30,7 +30,8 @@ public:
int configure(IPAContext &context, const IPAConfigInfo &configInfo) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats) override;
const ipu3_uapi_stats_3a *stats,
ControlList &metadata) override;
private:
double measureBrightness(const ipu3_uapi_stats_3a *stats,

View file

@ -389,7 +389,8 @@ void Awb::calculateWBGains(const ipu3_uapi_stats_3a *stats)
*/
void Awb::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats)
const ipu3_uapi_stats_3a *stats,
[[maybe_unused]] ControlList &metadata)
{
calculateWBGains(stats);

View file

@ -44,7 +44,8 @@ public:
ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats) override;
const ipu3_uapi_stats_3a *stats,
ControlList &metadata) override;
private:
/* \todo Make these structs available to all the ISPs ? */

View file

@ -79,13 +79,15 @@ void ToneMapping::prepare([[maybe_unused]] IPAContext &context,
* \param[in] frame The current frame sequence number
* \param[in] frameContext The current frame context
* \param[in] stats The IPU3 statistics and ISP results
* \param[out] metadata Metadata for the frame, to be filled by the algorithm
*
* The tone mapping look up table is generated as an inverse power curve from
* our gamma setting.
*/
void ToneMapping::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
[[maybe_unused]] IPAFrameContext &frameContext,
[[maybe_unused]] const ipu3_uapi_stats_3a *stats)
[[maybe_unused]] const ipu3_uapi_stats_3a *stats,
[[maybe_unused]] ControlList &metadata)
{
/*
* Hardcode gamma to 1.1 as a default for now.

View file

@ -23,7 +23,8 @@ public:
IPAFrameContext &frameContext, ipu3_uapi_params *params) override;
void process(IPAContext &context, const uint32_t frame,
IPAFrameContext &frameContext,
const ipu3_uapi_stats_3a *stats) override;
const ipu3_uapi_stats_3a *stats,
ControlList &metadata) override;
private:
double gamma_;