ipa: ipu3: Rework IPAFrameContext

Currently, IPAFrameContext consolidates the values computed by the
active state of the algorithms, along with the values applied on
the sensor.

Moving ahead, we want to have a frame context associated with each
incoming request (or frame to be captured). This shouldn't necessarily
be tied to "active state" of the algorithms hence:

- Rename current IPAFrameContext -> IPAActiveState
  This will now reflect the latest active state of the algorithms and
  has nothing to do with any frame-related ops/values.

- Re-instate IPAFrameContext with a sub-structure 'sensor' currently
  storing the exposure and gain value.

Adapt the various access to the frame context to the new changes
as described above.

Subsequently, the re-instated IPAFrameContext will be extended to
contain a frame number and ControlList to remember the incoming
request controls provided by the application. A ring-buffer will
be introduced to store these frame contexts for a certain number
of frames.

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-06 15:23:06 +05:30
committed by Kieran Bingham
parent e0766fa205
commit bab437df1f
8 changed files with 113 additions and 95 deletions
+6 -5
View File
@@ -454,7 +454,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,
calculateBdsGrid(configInfo.bdsOutputSize);
/* Clean frameContext at each reconfiguration. */
/* Clean IPAActiveState at each reconfiguration. */
context_.activeState = {};
context_.frameContext = {};
if (!validateSensorControls()) {
@@ -585,7 +586,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,
ctrls.set(controls::AnalogueGain, context_.frameContext.sensor.gain);
ctrls.set(controls::ColourTemperature, context_.frameContext.awb.temperatureK);
ctrls.set(controls::ColourTemperature, context_.activeState.awb.temperatureK);
ctrls.set(controls::ExposureTime, context_.frameContext.sensor.exposure * lineDuration);
@@ -623,8 +624,8 @@ void IPAIPU3::queueRequest([[maybe_unused]] const uint32_t frame,
*/
void IPAIPU3::setControls(unsigned int frame)
{
int32_t exposure = context_.frameContext.agc.exposure;
int32_t gain = camHelper_->gainCode(context_.frameContext.agc.gain);
int32_t exposure = context_.activeState.agc.exposure;
int32_t gain = camHelper_->gainCode(context_.activeState.agc.gain);
ControlList ctrls(sensorCtrls_);
ctrls.set(V4L2_CID_EXPOSURE, exposure);
@@ -632,7 +633,7 @@ void IPAIPU3::setControls(unsigned int frame)
ControlList lensCtrls(lensCtrls_);
lensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE,
static_cast<int32_t>(context_.frameContext.af.focus));
static_cast<int32_t>(context_.activeState.af.focus));
setSensorControls.emit(frame, ctrls, lensCtrls);
}