@@ -501,21 +501,26 @@ double Agc::estimateLuminance(double gain) const
* \brief Process frame duration and compute vblank
* \param[in] context The shared IPA context
* \param[in] frameContext The current frame context
- * \param[in] frameDuration The target frame duration
+ * \param[in] shutterTime The target shutter duration
*
- * Compute and populate vblank from the target frame duration.
+ * Compute and populate vblank from a frame duration that allows to achieve the
+ * desired \a shutterTime
*/
void Agc::processFrameDuration(IPAContext &context,
IPAFrameContext &frameContext,
- utils::Duration frameDuration)
+ utils::Duration shutterTime)
{
- IPACameraSensorInfo &sensorInfo = context.sensorInfo;
utils::Duration lineDuration = context.configuration.sensor.lineDuration;
+ utils::Duration frameDuration =
+ std::max(context.camHelper->minFrameDuration(shutterTime, lineDuration),
+ context.activeState.agc.minFrameDuration);
- frameContext.agc.vblank = (frameDuration / lineDuration) - sensorInfo.outputSize.height;
+ frameContext.agc.vblank = (frameDuration / lineDuration)
+ - context.sensorInfo.outputSize.height;
/* Update frame duration accounting for line length quantization. */
- frameContext.agc.frameDuration = (sensorInfo.outputSize.height + frameContext.agc.vblank) * lineDuration;
+ frameContext.agc.frameDuration = (context.sensorInfo.outputSize.height
+ + frameContext.agc.vblank) * lineDuration;
}
/**
The RkISP1 IPA is the only IPA that derives from AgcMeanLuminance that populates the FrameDuration control. The way frame duration is calculated is by using the shutter time as returned by the Agc helpers and use that value to populate the FrameDuration metadata and calculate the vblank. This is however not correct as the exposure time shall be shorter than the frame duration by a sensor-specific margin. Use the camera sensor helper to calculate the minimum frame duration required to achieve the newly calculated shutter time. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- src/ipa/rkisp1/algorithms/agc.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)