[{"id":27871,"web_url":"https://patchwork.libcamera.org/comment/27871/","msgid":"<CAHW6GYLcEAZNmEDJ7pT27K=A=kW24YtPya7Vgg9E=dUL1LmCOQ@mail.gmail.com>","date":"2023-09-25T10:40:11","subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when\n\trunning algorithms","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the fixes! Indeed, I was noticing this...\n\nOn Mon, 25 Sept 2023 at 11:27, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> The frame counter test to determine if we run the IPA algorithms has a\n> logic bug where it treats dropFrameCount_ and mistrustCount_ as frame\n> numbers, not counts of frames (which it is). The implication is that\n> startup convergence and initial settings take one extra frame to apply.\n> Fix this.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n> ---\n>  src/ipa/rpi/common/ipa_base.cpp | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index f7e7ad5ee499..5d8344e3e7e3 100644\n> --- a/src/ipa/rpi/common/ipa_base.cpp\n> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> @@ -409,7 +409,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n>\n>         /* Allow a 10% margin on the comparison below. */\n>         Duration delta = (frameTimestamp - lastRunTimestamp_) * 1.0ns;\n> -       if (lastRunTimestamp_ && frameCount_ > dropFrameCount_ &&\n> +       if (lastRunTimestamp_ && frameCount_ >= dropFrameCount_ &&\n>             delta < controllerMinFrameDuration * 0.9) {\n>                 /*\n>                  * Ensure we merge the previous frame's metadata with the current\n> @@ -451,7 +451,7 @@ void IpaBase::processStats(const ProcessParams &params)\n>  {\n>         unsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n>\n> -       if (processPending_ && frameCount_ > mistrustCount_) {\n> +       if (processPending_ && frameCount_ >= mistrustCount_) {\n>                 RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n>\n>                 auto it = buffers_.find(params.buffers.stats);\n> --\n> 2.34.1\n>","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 E11D4BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Sep 2023 10:40:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 23EE562944;\n\tMon, 25 Sep 2023 12:40:24 +0200 (CEST)","from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com\n\t[IPv6:2607:f8b0:4864:20::72b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B3E1628FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Sep 2023 12:40:23 +0200 (CEST)","by mail-qk1-x72b.google.com with SMTP id\n\taf79cd13be357-7740aa4b545so400702985a.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Sep 2023 03:40:23 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695638424;\n\tbh=A9lGB9O0O616ECo7uYoRngT/zFNZJ1EB+veKhWtOrTo=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=a9Me1KwEFK7YzL0PASRFs6k3WzqdN18zRf+ART/9xxbVt8fIDY6/HeUVydBIXVtNL\n\tZnv62AjNCqBuZdp/LkyJEKtvkjFY+IcFfC6GAFt3hN8vbJeQS0uK0sb7gLyJWVPLzO\n\tgBM557aX95ZrIMh9lFaxjp71wZs6tR0P/n4yU6SzJdsgBBAqk5JL7GIIRyeNGfkVQs\n\tGqv4Poh4KN8+mXag5SN1KoCmEB4sSIe1gw2p6gswTouTyCLkJK3Bwi18t0SeqClnJb\n\tFz7m36OcVTABL1aB8N1AqIacZ21FdgIf1T2Hw/S4qgsAWI0oWeZmmKlxumMUhH3n2+\n\toopF5qUCPo5tA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1695638422; x=1696243222;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=zGMpYVG8ss4b0hdDx2MMrnLIG/nnaC39Jn7FDcpCUM8=;\n\tb=Ohd0fHDrj5uAwZ5v47sd9Xv9U0rPu+as83rRwi86Ud+I/4iZvVPPYqvezmoKmf6znD\n\tMARAuoiIBBet1F/ueqIrDU1GcyVbFZz8w5pwIdDexQ2Oa0UZImLgAwSoGU0z9riPUqOH\n\tZ9KxtKtfmjB1krb4zYqNzJwus8k8J6ICX52HiaBUbch1vC3MfTIba5xt38hW/JNM7E9i\n\tZQqFdaAW1y2XRwFgGtajmahsfDaMbmhlxeTLAz8HJQu2MBP8AmQThtsyXoELr2D7Z6Os\n\tBprTJ/mxQz3ap0tU4X6IY3GRphh7UtoGBIJ400WPJHMvEmCmHPveo/89ji0v3+To5udI\n\tvsSg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Ohd0fHDr\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1695638422; x=1696243222;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=zGMpYVG8ss4b0hdDx2MMrnLIG/nnaC39Jn7FDcpCUM8=;\n\tb=DV9oCbPt/ciSYkuiRONJ16QdgsK2eaHW/WAxTG4PY9Gz6S/VVdPKxR69z4o08rMULc\n\tm+LX5295tDwew8/Ek+8i5NdlAgt5/E0DHOVziPwZPRiO9R6e2+jPIQVS7MmmsvvL23GY\n\tLYUHK5WNvnspBScstMQ2h/vetchH1lOamI1t9fdCcZBN2cVj6kXB0K44vEd7Ic+ZH/PE\n\tgWNYao9xchQrtJ76opCHu6jN/21JNFJ9C3OaAj0G1QxwgI+vFQgUAtt14AXg5w7OvktG\n\tq75mRN3AUn8MAudE8NQREtwJgmIQCy8MfAhFpLazjsbUpTMsdgDBNyv0U+U5yxPXPfM+\n\thp8Q==","X-Gm-Message-State":"AOJu0YyYbH7a5w6AqOHxS/jmnR7BiD+yxK3sm72J3AXCVwfw6fX4au1y\n\tZ3lrfxTumBAW1IkJt6d7g0eA7nWLWJpe38OFyn7uqr52YxGn+wlV/Gg=","X-Google-Smtp-Source":"AGHT+IHfRd3C9TXBxUjopjj2LUX5VM6jE9hb6lPyIt772ho+9zeAtDSUfXDBoBov3HVjo7npN+r9Q1K1t4VXMpJEynA=","X-Received":"by 2002:a05:6214:2469:b0:658:2ef5:26f8 with SMTP id\n\tim9-20020a056214246900b006582ef526f8mr9517768qvb.13.1695638422037;\n\tMon, 25 Sep 2023 03:40:22 -0700 (PDT)","MIME-Version":"1.0","References":"<20230925102714.31780-1-naush@raspberrypi.com>","In-Reply-To":"<20230925102714.31780-1-naush@raspberrypi.com>","Date":"Mon, 25 Sep 2023 11:40:11 +0100","Message-ID":"<CAHW6GYLcEAZNmEDJ7pT27K=A=kW24YtPya7Vgg9E=dUL1LmCOQ@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when\n\trunning algorithms","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>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":27881,"web_url":"https://patchwork.libcamera.org/comment/27881/","msgid":"<169565312046.2915094.5828068286357437373@ping.linuxembedded.co.uk>","date":"2023-09-25T14:45:20","subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when\n\trunning algorithms","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman via libcamera-devel (2023-09-25 11:40:11)\n> Hi Naush\n> \n> Thanks for the fixes! Indeed, I was noticing this...\n> \n> On Mon, 25 Sept 2023 at 11:27, Naushir Patuck <naush@raspberrypi.com> wrote:\n> >\n> > The frame counter test to determine if we run the IPA algorithms has a\n> > logic bug where it treats dropFrameCount_ and mistrustCount_ as frame\n> > numbers, not counts of frames (which it is). The implication is that\n> > startup convergence and initial settings take one extra frame to apply.\n> > Fix this.\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> \n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> Tested-by: David Plowman <david.plowman@raspberrypi.com>\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nCollecting this and the YV444 format now.\n\n--\nKieran\n\n\n> \n> Thanks!\n> David\n> \n> > ---\n> >  src/ipa/rpi/common/ipa_base.cpp | 4 ++--\n> >  1 file changed, 2 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> > index f7e7ad5ee499..5d8344e3e7e3 100644\n> > --- a/src/ipa/rpi/common/ipa_base.cpp\n> > +++ b/src/ipa/rpi/common/ipa_base.cpp\n> > @@ -409,7 +409,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n> >\n> >         /* Allow a 10% margin on the comparison below. */\n> >         Duration delta = (frameTimestamp - lastRunTimestamp_) * 1.0ns;\n> > -       if (lastRunTimestamp_ && frameCount_ > dropFrameCount_ &&\n> > +       if (lastRunTimestamp_ && frameCount_ >= dropFrameCount_ &&\n> >             delta < controllerMinFrameDuration * 0.9) {\n> >                 /*\n> >                  * Ensure we merge the previous frame's metadata with the current\n> > @@ -451,7 +451,7 @@ void IpaBase::processStats(const ProcessParams &params)\n> >  {\n> >         unsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n> >\n> > -       if (processPending_ && frameCount_ > mistrustCount_) {\n> > +       if (processPending_ && frameCount_ >= mistrustCount_) {\n> >                 RPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n> >\n> >                 auto it = buffers_.find(params.buffers.stats);\n> > --\n> > 2.34.1\n> >","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 50E6EC326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Sep 2023 14:45:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B29B562931;\n\tMon, 25 Sep 2023 16:45:24 +0200 (CEST)","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 7CD5E628FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Sep 2023 16:45:23 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 40B9D18BF;\n\tMon, 25 Sep 2023 16:43:43 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1695653124;\n\tbh=zToGx9XJtQ3WkPyaO+OJYrHMQNTtiw9NPe1xWobma48=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=dt1+dY94sqTU1at6M6gW471do+JW9xx/RmjXc3jMdMnoF6Os1Hz/vYJMJtmb0Ymg3\n\tqeN4PgcLVpx7B/wYCHVr1AX1Q4JJ3xTHx9YTRZ9ev/MvGk+RdB29r940NZY6wtalE7\n\tMOJpIIcmwcPgpsTHxMS+JZjy4ZRZKxXhw9crvbykztM6U9iVUsLig3egOdYNoveIBk\n\tNJozT3TAMVZoasTCxcN8zQtSlt+eZmpeb4n/cZoPXyt5u0Too2BkTlA/gg/p6IW/Kc\n\tPqTgXO2BfQgCRH2vMiq/3Rm5IqDbbG7lISGO0VmzdZnt8K1BAXGsTBPlZePsgEk3nS\n\tdGqjkyFBiuW4Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1695653023;\n\tbh=zToGx9XJtQ3WkPyaO+OJYrHMQNTtiw9NPe1xWobma48=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=khde/42R7LX9xxaXIbZ2yFTGtq/btlwtm1Xbmw/vWEAKlw+Dsevn7IyPNtRY3PgtD\n\tQ8fo2VhCFtzRmvlsHdY/0AuxqhSRQ/WvE2dtSnkpZw3hWlSQHReKOcliOaEHktv/ir\n\tl6+y2szUgshsf7AAOLV6QT50Roku35X0XmUxfzMI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"khde/42R\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAHW6GYLcEAZNmEDJ7pT27K=A=kW24YtPya7Vgg9E=dUL1LmCOQ@mail.gmail.com>","References":"<20230925102714.31780-1-naush@raspberrypi.com>\n\t<CAHW6GYLcEAZNmEDJ7pT27K=A=kW24YtPya7Vgg9E=dUL1LmCOQ@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tDavid Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>, \n\tNaushir Patuck <naush@raspberrypi.com>","Date":"Mon, 25 Sep 2023 15:45:20 +0100","Message-ID":"<169565312046.2915094.5828068286357437373@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH] ipa: rpi: Fix frame count logic when\n\trunning algorithms","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]