ipa: ipu3: Put IPAFrameContext(s) in a ring buffer

Instead of having one frame context constantly being updated,
this patch aims to introduce per-frame IPAFrameContext which
are stored in a ring buffer. Whenever a request is queued, a new
IPAFrameContext is created and inserted into the ring buffer.

The IPAFrameContext structure itself has been slightly extended
to store a frame id and a ControlList for incoming frame
controls (sent in by the application). The next step would be to
read and set these controls whenever the request is actually queued
to the hardware.

Since now we are working in multiples of IPAFrameContext, the
Algorithm::process() will actually take in a IPAFrameContext pointer
(as opposed to a nullptr while preparing for this change).

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 23:42:13 +05:30 committed by Kieran Bingham
parent 8b291bce82
commit f4783e6899
5 changed files with 57 additions and 22 deletions

View file

@ -183,14 +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, double yGain,
double iqMeanGain)
void Agc::computeExposure(IPAContext &context, IPAFrameContext *frameContext,
double yGain, double iqMeanGain)
{
const IPASessionConfiguration &configuration = context.configuration;
IPAFrameContext &frameContext = context.frameContext;
/* 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);
@ -360,7 +359,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] IPAFrameContext *frameCo
break;
}
computeExposure(context, yGain, iqMeanGain);
computeExposure(context, frameContext, yGain, iqMeanGain);
frameCount_++;
}