| Message ID | 20261102101610.877390-17-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Hi Barnabás, Quoting Barnabás Pőcze (2026-11-02 11:16:02) > Only frame durations that are multiples of the line duration are possible, > and currently it is possible that a smaller frame duration is selected > even if a frame duration satisfying the requested limits is available. > > This is caused by the float -> integer truncation during the calculation. For > (an unrealistic) example, if the exposure time is 24ms, the min frame duration > is 33ms, and the line duration is 2ms, then 32ms will be used as the frame > duration even if e.g. 34 would be allowed by the max frame duration. > > So round the result to ensure that if not prevented by the max frame duration > then a value that satisfies the limits is selected. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Looks good to me. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Best regards, Stefan > --- > src/ipa/libipa/agc.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp > index 127b4893fd..f40f4b0947 100644 > --- a/src/ipa/libipa/agc.cpp > +++ b/src/ipa/libipa/agc.cpp > @@ -1154,7 +1154,8 @@ void AgcAlgorithm::processFrameDuration(const agc::Session &session, > * the minimum frame duration when we have short exposures. > */ > const auto frameLength = std::max<uint32_t>( > - frameContext.minFrameDuration / lineDuration, > + std::min(std::ceil(frameContext.minFrameDuration / lineDuration), > + frameContext.maxFrameDuration / lineDuration), > frameContext.exposure); > > frameContext.vblank = frameLength - session.sensor.outputSize.height; > -- > 2.56.0 >
diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index 127b4893fd..f40f4b0947 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -1154,7 +1154,8 @@ void AgcAlgorithm::processFrameDuration(const agc::Session &session, * the minimum frame duration when we have short exposures. */ const auto frameLength = std::max<uint32_t>( - frameContext.minFrameDuration / lineDuration, + std::min(std::ceil(frameContext.minFrameDuration / lineDuration), + frameContext.maxFrameDuration / lineDuration), frameContext.exposure); frameContext.vblank = frameLength - session.sensor.outputSize.height;