From a940866440202bddf14d1c69c8657a6d099f1ea0 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Thu, 4 Mar 2021 08:17:26 +0000 Subject: libcamera: delayed_controls: Fix off-by-one error in get() There was an off-by-one error in DelayedControls::get() when picking controls from the queue to return back to the pipeline handler. This is only noticeable as small oscillations in brightness when closely viewing frame while AGC is running. The old StaggeredCtrl did not show this error as the startup queuing mechanism has changed in DelayedControls. Fix this by indexing to the correct position in the queue. Signed-off-by: Naushir Patuck Reported-by: David Plowman Fixes: 3d4b7b005911 ("libcamera: delayed_controls: Add helper for controls that apply with a delay") Tested-by: David Plowman Reviewed-by: Paul Elder Tested-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- src/libcamera/delayed_controls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcamera/delayed_controls.cpp') diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp index 2f953a06..a3917fd9 100644 --- a/src/libcamera/delayed_controls.cpp +++ b/src/libcamera/delayed_controls.cpp @@ -184,7 +184,7 @@ bool DelayedControls::push(const ControlList &controls) */ ControlList DelayedControls::get(uint32_t sequence) { - uint32_t adjustedSeq = sequence - firstSequence_ + 1; + uint32_t adjustedSeq = sequence - firstSequence_; unsigned int index = std::max(0, adjustedSeq - maxDelay_); ControlList out(device_->controls()); -- cgit v1.2.1