[{"id":15358,"web_url":"https://patchwork.libcamera.org/comment/15358/","msgid":"<20210301095435.GF3084@pyrite.rasen.tech>","date":"2021-03-01T09:54:35","subject":"Re: [libcamera-devel] [PATCH v2 5/5] libcamera: delayed_controls:\n\tFix off-by-one error in get()","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Naush,\n\nOn Tue, Feb 16, 2021 at 08:53:42AM +0000, Naushir Patuck wrote:\n> There was an off-by-one error in DelayedControls::get() when picking\n> controls from the queue to return back to the pipeline handler.\n> This is only noticeable as small oscillations in brightness when closely\n> viewing frame while AGC is running. The old StaggeredCtrl did not show\n> this error as the startup queuing mechanism has changed in\n> DelayedControls.\n> \n> Fix this by indexing to the correct position in the queue.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reported-by: David Plowman <david.plowman@raspberrypi.com>\n> Fixes: 3d4b7b005911 (\"libcamera: delayed_controls: Add helper for controls that apply with a delay\")\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/delayed_controls.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index d1b79dc3570e..3f829e8c40f2 100644\n> --- a/src/libcamera/delayed_controls.cpp\n> +++ b/src/libcamera/delayed_controls.cpp\n> @@ -183,7 +183,7 @@ bool DelayedControls::push(const ControlList &controls)\n>   */\n>  ControlList DelayedControls::get(uint32_t sequence)\n>  {\n> -\tuint32_t adjustedSeq = sequence - firstSequence_ + 1;\n> +\tuint32_t adjustedSeq = sequence - firstSequence_;\n>  \tunsigned int index = std::max<int>(0, adjustedSeq - maxDelay_);\n>  \n>  \tControlList out(device_->controls());\n> -- \n> 2.25.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2EA57BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Mar 2021 09:54:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AE29A689DD;\n\tMon,  1 Mar 2021 10:54:44 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C953D60521\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Mar 2021 10:54:43 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A818332;\n\tMon,  1 Mar 2021 10:54:42 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UbHknC69\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614592483;\n\tbh=aCBXrD9OwW+3JFWjGR7MfxO1Hjzd3lhRBEf06mapnCU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UbHknC69Q2jfLCwWpoXRkan0OGy0qKA7PF+7kSSQDo4emXFq6A4/A+gJgJC/gUpWH\n\t8Bqm1uSf8kRChu032ppl/m+qMLBz6aj6UdbFVtSuYyunlNOXb+Si91kI/HpXcOsKwr\n\tuoDjz/COQC4wipy8FYChYWIGb5XZ7NyufcgS/+3g=","Date":"Mon, 1 Mar 2021 18:54:35 +0900","From":"paul.elder@ideasonboard.com","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20210301095435.GF3084@pyrite.rasen.tech>","References":"<20210216085342.1012717-1-naush@raspberrypi.com>\n\t<20210216085342.1012717-6-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210216085342.1012717-6-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 5/5] libcamera: delayed_controls:\n\tFix off-by-one error in get()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]