[{"id":14126,"web_url":"https://patchwork.libcamera.org/comment/14126/","msgid":"<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>","date":"2020-12-08T10:07:19","subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThank you for your patch.\n\nOn Mon, 7 Dec 2020 at 18:02, David Plowman <david.plowman@raspberrypi.com>\nwrote:\n\n> We add a GetConvergenceFrames method to the AgcAlgorithm class which\n> can be called when the AGC is started from scratch. It suggests how\n> many frames should be dropped before displaying any (while the AGC\n> converges).\n>\n> The Raspberry Pi specific implementation makes this customisable from\n> the tuning file.\n>\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/controller/agc_algorithm.hpp |  1 +\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp       | 13 +++++++++++++\n>  src/ipa/raspberrypi/controller/rpi/agc.hpp       |  2 ++\n>  3 files changed, 16 insertions(+)\n>\n> diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> index b4ea54fb..85fc6084 100644\n> --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> @@ -15,6 +15,7 @@ class AgcAlgorithm : public Algorithm\n>  public:\n>         AgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n>         // An AGC algorithm must provide the following:\n> +       virtual unsigned int GetConvergenceFrames(unsigned int\n> mistrust_frames) const = 0;\n>\n        virtual void SetEv(double ev) = 0;\n>         virtual void SetFlickerPeriod(double flicker_period) = 0;\n>         virtual void SetFixedShutter(double fixed_shutter) = 0; //\n> microseconds\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index 9da18c31..787918cc 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -142,6 +142,7 @@ void AgcConfig::Read(boost::property_tree::ptree const\n> &params)\n>         Y_target.Read(params.get_child(\"y_target\"));\n>         speed = params.get<double>(\"speed\", 0.2);\n>         startup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n> +       convergence_frames = params.get<unsigned\n> int>(\"convergence_frames\", 6);\n>         fast_reduce_threshold =\n>                 params.get<double>(\"fast_reduce_threshold\", 0.4);\n>         base_ev = params.get<double>(\"base_ev\", 1.0);\n> @@ -206,6 +207,18 @@ void Agc::Resume()\n>         fixed_analogue_gain_ = 0;\n>  }\n>\n> +unsigned int Agc::GetConvergenceFrames(unsigned int mistrust_frames) const\n> +{\n> +       // If shutter and gain have been explicitly set, there is no\n> +       // convergence to happen, so no need to drop any frames - return\n> zero.\n> +       // Otherwise, any frames for which we have been told not to trust\n> the\n> +       // statistics must be added to our own count.\n> +       if (fixed_shutter_ && fixed_analogue_gain_)\n> +               return 0;\n> +       else\n> +               return config_.convergence_frames + mistrust_frames;\n> +}\n> +\n>\n\nMinor nitpick, but why do you pass mistrust_frames into\nGetConvergenceFrames?  Could you not leave it out and do the addition of\nmistrust frames in the IPA? Either way,\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n\n>  void Agc::SetEv(double ev)\n>  {\n>         ev_ = ev;\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> index 95db1812..7d41608a 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> @@ -52,6 +52,7 @@ struct AgcConfig {\n>         Pwl Y_target;\n>         double speed;\n>         uint16_t startup_frames;\n> +       unsigned int convergence_frames;\n>         double max_change;\n>         double min_change;\n>         double fast_reduce_threshold;\n> @@ -74,6 +75,7 @@ public:\n>         bool IsPaused() const override;\n>         void Pause() override;\n>         void Resume() override;\n> +       unsigned int GetConvergenceFrames(unsigned int mistrust_frames)\n> const override;\n>         void SetEv(double ev) override;\n>         void SetFlickerPeriod(double flicker_period) override;\n>         void SetFixedShutter(double fixed_shutter) override; //\n> microseconds\n> --\n> 2.20.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\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 086CBBDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 10:07:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F80F67E6E;\n\tTue,  8 Dec 2020 11:07:40 +0100 (CET)","from mail-lf1-x129.google.com (mail-lf1-x129.google.com\n\t[IPv6:2a00:1450:4864:20::129])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 433DC635F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 11:07:39 +0100 (CET)","by mail-lf1-x129.google.com with SMTP id l11so22268472lfg.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Dec 2020 02:07:39 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"FoL/itJe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=+bTkANSxmHTgMZXk+QTLsvFUVA1qFV2u2eFOnN8vnMU=;\n\tb=FoL/itJeDh2Huf02VzG0mjFqCADLM9mV2ZEoY1rcDyIOwTiZopNFuddRLqnxcO7YBf\n\txRQIxZ7E9oXcpfUQYz6LAjSu5KdUThURdlGDxSI5cTx0+TWzdw2DYpQjMd36Y3PJhOYP\n\tjt846VrFeSigOZlFwv2Fx3bjh3rJVnpBGWf9qD30wN53bmVDNaOq0OcS9J3oH5zDmnoy\n\tNi3Ixn7lroQRyTqkS34S/v0f54PWVIQRBIxMiKO/A3jkIWHZrnXIFGEkRTjytUrC+VcA\n\t/oKJhuLXzCac7Zs3zXCCfBXTqX8nZt0U/dsj4fsWNO/2onSlg+pOh4PCfDbBjc9z4uSH\n\t0JqA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=+bTkANSxmHTgMZXk+QTLsvFUVA1qFV2u2eFOnN8vnMU=;\n\tb=QR3eEe2nIFOkdxjtnU2mToNFAB44uqs+rN2w7KsHmTY3cNdon0X+Ivfs8vIrpbj+Af\n\t0hUg1d5b1hZWNcSoeMkQK/sWhN6RALLvmvgU0YEcngTE8rYolEUyj7lRYprApCgqpIqk\n\tnw9qsWYm2xjwcNPd1NhUYy4gYS5ct3NkPLGBbfWNz9wn2Twz1zCQgARUGaI+mix05y/I\n\tcYrORGFSxaZP78R443RI4AHYGo2S0uLG5He67eN7ExDZa1078Z3ebPMAQbRlSe3l7H0s\n\tKPlJuapm32Tf13/hDET3Mq0NvIsZqnM9GN2eezzmoumRBXHk2S6NPEMA3JCeWKcieVJV\n\t+VHg==","X-Gm-Message-State":"AOAM533zaeqsytDzLABmZd5BHfjjHxlzsiqk79cQoAARQqrF/xbo7sEi\n\tYs2yFDJ9+jP1SFyRSQF5HbFFR0rvF2wyERTItvZDTg==","X-Google-Smtp-Source":"ABdhPJxjiv+9elnqoXvyRA8RWsiJIutrNxwqdsI6LqLQCUX8uJgPD1ZnbQOIn7OGXBc3Wg98SqWzyj9fAD4PhyxiDjk=","X-Received":"by 2002:a05:6512:3047:: with SMTP id\n\tb7mr9417519lfb.210.1607422058617; \n\tTue, 08 Dec 2020 02:07:38 -0800 (PST)","MIME-Version":"1.0","References":"<20201207180121.6374-1-david.plowman@raspberrypi.com>\n\t<20201207180121.6374-3-david.plowman@raspberrypi.com>","In-Reply-To":"<20201207180121.6374-3-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 8 Dec 2020 10:07:19 +0000","Message-ID":"<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","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 <libcamera-devel@lists.libcamera.org>","Content-Type":"multipart/mixed;\n\tboundary=\"===============4733337240824987093==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14136,"web_url":"https://patchwork.libcamera.org/comment/14136/","msgid":"<X89k/zL/8drOF9nj@pendragon.ideasonboard.com>","date":"2020-12-08T11:35:27","subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Mon, Dec 07, 2020 at 06:01:17PM +0000, David Plowman wrote:\n> We add a GetConvergenceFrames method to the AgcAlgorithm class which\n> can be called when the AGC is started from scratch. It suggests how\n> many frames should be dropped before displaying any (while the AGC\n> converges).\n> \n> The Raspberry Pi specific implementation makes this customisable from\n> the tuning file.\n> \n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/controller/agc_algorithm.hpp |  1 +\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp       | 13 +++++++++++++\n>  src/ipa/raspberrypi/controller/rpi/agc.hpp       |  2 ++\n>  3 files changed, 16 insertions(+)\n> \n> diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> index b4ea54fb..85fc6084 100644\n> --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> @@ -15,6 +15,7 @@ class AgcAlgorithm : public Algorithm\n>  public:\n>  \tAgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n>  \t// An AGC algorithm must provide the following:\n> +\tvirtual unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const = 0;\n\nAs you need the same feature for AWB, would it make sense to add this\nvirtual function to the Algorithm class instead ?\n\n>  \tvirtual void SetEv(double ev) = 0;\n>  \tvirtual void SetFlickerPeriod(double flicker_period) = 0;\n>  \tvirtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index 9da18c31..787918cc 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -142,6 +142,7 @@ void AgcConfig::Read(boost::property_tree::ptree const &params)\n>  \tY_target.Read(params.get_child(\"y_target\"));\n>  \tspeed = params.get<double>(\"speed\", 0.2);\n>  \tstartup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n> +\tconvergence_frames = params.get<unsigned int>(\"convergence_frames\", 6);\n\nSupplying the convergence value from the algorithm instead of the\nCamHelper is really nice.\n\nPossibly with GetConvergenceFrames() moved to Algorithm,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \tfast_reduce_threshold =\n>  \t\tparams.get<double>(\"fast_reduce_threshold\", 0.4);\n>  \tbase_ev = params.get<double>(\"base_ev\", 1.0);\n> @@ -206,6 +207,18 @@ void Agc::Resume()\n>  \tfixed_analogue_gain_ = 0;\n>  }\n>  \n> +unsigned int Agc::GetConvergenceFrames(unsigned int mistrust_frames) const\n> +{\n> +\t// If shutter and gain have been explicitly set, there is no\n> +\t// convergence to happen, so no need to drop any frames - return zero.\n> +\t// Otherwise, any frames for which we have been told not to trust the\n> +\t// statistics must be added to our own count.\n> +\tif (fixed_shutter_ && fixed_analogue_gain_)\n> +\t\treturn 0;\n> +\telse\n> +\t\treturn config_.convergence_frames + mistrust_frames;\n> +}\n> +\n>  void Agc::SetEv(double ev)\n>  {\n>  \tev_ = ev;\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> index 95db1812..7d41608a 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> @@ -52,6 +52,7 @@ struct AgcConfig {\n>  \tPwl Y_target;\n>  \tdouble speed;\n>  \tuint16_t startup_frames;\n> +\tunsigned int convergence_frames;\n>  \tdouble max_change;\n>  \tdouble min_change;\n>  \tdouble fast_reduce_threshold;\n> @@ -74,6 +75,7 @@ public:\n>  \tbool IsPaused() const override;\n>  \tvoid Pause() override;\n>  \tvoid Resume() override;\n> +\tunsigned int GetConvergenceFrames(unsigned int mistrust_frames) const override;\n>  \tvoid SetEv(double ev) override;\n>  \tvoid SetFlickerPeriod(double flicker_period) override;\n>  \tvoid SetFixedShutter(double fixed_shutter) override; // microseconds","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 B61A7BDB20\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 11:35:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2210367E71;\n\tTue,  8 Dec 2020 12:35:32 +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 CFA69600FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 12:35:30 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 476ADDD;\n\tTue,  8 Dec 2020 12:35:30 +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=\"d19Y4Gnk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607427330;\n\tbh=npqucFoRiibUJD+Ctj3PJGXUvPRflq715cVyreZURvE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=d19Y4Gnk8EhkdqZvQ+orO7bHYybljlujWCMqXoTD6DkFN4/Ngzm+bF9pKni3X+J5J\n\tGuB9N96uJGxAOAb+cU0dvLf139l6IhFzpwwkzWpPcPuSFXzQQSUL8ZPzGdHRIrXO65\n\taU0vEWbUUjHj6CyZrWu81HeK13YR+ZxLA4thI9es=","Date":"Tue, 8 Dec 2020 13:35:27 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<X89k/zL/8drOF9nj@pendragon.ideasonboard.com>","References":"<20201207180121.6374-1-david.plowman@raspberrypi.com>\n\t<20201207180121.6374-3-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201207180121.6374-3-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","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>"}},{"id":14137,"web_url":"https://patchwork.libcamera.org/comment/14137/","msgid":"<X89lqoIn6H0sFFKg@pendragon.ideasonboard.com>","date":"2020-12-08T11:38:18","subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Tue, Dec 08, 2020 at 10:07:19AM +0000, Naushir Patuck wrote:\n> On Mon, 7 Dec 2020 at 18:02, David Plowman wrote:\n> > We add a GetConvergenceFrames method to the AgcAlgorithm class which\n> > can be called when the AGC is started from scratch. It suggests how\n> > many frames should be dropped before displaying any (while the AGC\n> > converges).\n> >\n> > The Raspberry Pi specific implementation makes this customisable from\n> > the tuning file.\n> >\n> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > ---\n> >  src/ipa/raspberrypi/controller/agc_algorithm.hpp |  1 +\n> >  src/ipa/raspberrypi/controller/rpi/agc.cpp       | 13 +++++++++++++\n> >  src/ipa/raspberrypi/controller/rpi/agc.hpp       |  2 ++\n> >  3 files changed, 16 insertions(+)\n> >\n> > diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > index b4ea54fb..85fc6084 100644\n> > --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > @@ -15,6 +15,7 @@ class AgcAlgorithm : public Algorithm\n> >  public:\n> >         AgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n> >         // An AGC algorithm must provide the following:\n> > +       virtual unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const = 0;\n> >\n> >         virtual void SetEv(double ev) = 0;\n> >         virtual void SetFlickerPeriod(double flicker_period) = 0;\n> >         virtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds\n> > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > index 9da18c31..787918cc 100644\n> > --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > @@ -142,6 +142,7 @@ void AgcConfig::Read(boost::property_tree::ptree const &params)\n> >         Y_target.Read(params.get_child(\"y_target\"));\n> >         speed = params.get<double>(\"speed\", 0.2);\n> >         startup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n> > +       convergence_frames = params.get<unsigned int>(\"convergence_frames\", 6);\n> >         fast_reduce_threshold =\n> >                 params.get<double>(\"fast_reduce_threshold\", 0.4);\n> >         base_ev = params.get<double>(\"base_ev\", 1.0);\n> > @@ -206,6 +207,18 @@ void Agc::Resume()\n> >         fixed_analogue_gain_ = 0;\n> >  }\n> >\n> > +unsigned int Agc::GetConvergenceFrames(unsigned int mistrust_frames) const\n> > +{\n> > +       // If shutter and gain have been explicitly set, there is no\n> > +       // convergence to happen, so no need to drop any frames - return zero.\n> > +       // Otherwise, any frames for which we have been told not to trust the\n> > +       // statistics must be added to our own count.\n> > +       if (fixed_shutter_ && fixed_analogue_gain_)\n> > +               return 0;\n> > +       else\n> > +               return config_.convergence_frames + mistrust_frames;\n> > +}\n> > +\n> \n> Minor nitpick, but why do you pass mistrust_frames into\n> GetConvergenceFrames?  Could you not leave it out and do the addition of\n> mistrust frames in the IPA? Either way,\n\nCould it be that the effect of the mistrusted frames could depend on the\nalgorithm's implementation ? I could imagine some algorithms not using\nmetadata, in which case the number of mistrusted frames could be\nignored (at least if mistrusted frames always means mistrusted\nmetadata).\n\n> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> \n> >  void Agc::SetEv(double ev)\n> >  {\n> >         ev_ = ev;\n> > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > index 95db1812..7d41608a 100644\n> > --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > @@ -52,6 +52,7 @@ struct AgcConfig {\n> >         Pwl Y_target;\n> >         double speed;\n> >         uint16_t startup_frames;\n> > +       unsigned int convergence_frames;\n> >         double max_change;\n> >         double min_change;\n> >         double fast_reduce_threshold;\n> > @@ -74,6 +75,7 @@ public:\n> >         bool IsPaused() const override;\n> >         void Pause() override;\n> >         void Resume() override;\n> > +       unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const override;\n> >         void SetEv(double ev) override;\n> >         void SetFlickerPeriod(double flicker_period) override;\n> >         void SetFixedShutter(double fixed_shutter) override; // microseconds","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 51007BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 11:38:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6A7A67E6D;\n\tTue,  8 Dec 2020 12:38:22 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC7D2600FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 12:38:21 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4CFA7DD;\n\tTue,  8 Dec 2020 12:38:21 +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=\"UvB2G+Yu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607427501;\n\tbh=UiFqpNFuaAA4qCFsuHeLkOACcxM/sBgBbih0KzoxlmU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UvB2G+Yu3x7P5U82bOqjM6HNS30WGjtMwGdbPqNHUxa7JEh1/82kvonjPVhLKcpfG\n\tfu96XbUfa5iQI2krPxnFZs/ZwfidlZle/zMUFRHEMMLWXlvHKH5lzgMpacHLNfU7zg\n\tZSNWdeqnV4YfWjH+3D4Q8QbXRF5ilezgz0ETqZck=","Date":"Tue, 8 Dec 2020 13:38:18 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<X89lqoIn6H0sFFKg@pendragon.ideasonboard.com>","References":"<20201207180121.6374-1-david.plowman@raspberrypi.com>\n\t<20201207180121.6374-3-david.plowman@raspberrypi.com>\n\t<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","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 <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>"}},{"id":14140,"web_url":"https://patchwork.libcamera.org/comment/14140/","msgid":"<CAHW6GYK+gsYcVGSekPG7ezCkfLR+Q8U2ORF8K98nvV3=LN775w@mail.gmail.com>","date":"2020-12-08T11:50:22","subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Laurent, Naush,\n\nThanks for the comments. I think there are some good points there. To\nbring the two together, I think Naush's suggest would be to avoid\npassing mistrust_frames into the GetConvergenceFrames method, and in\nthe raspberrypi.cpp IPA file have something like:\n\nunsigned int convergenceFrames = agc->GetConvergenceFrames();\nif (convergenceFrames)\n        convergenceFrames += mistrustFrames;\n\nI can see that leaves the Algorithms looking simpler, which is nice.\n\nMoving onto Laurent's point, this would mean that there's an in-built\nassumption that convergence is only to do with statistics (which,\nyou're right, is what \"mistrusted frames\" are all about). But I don't\nreally see any other sort of convergence, at least certainly not in\nour pipeline.\n\nSo I'm feeling like the Naush approach is probably the way to go...?\n\nThanks\nDavid\n\nOn Tue, 8 Dec 2020 at 11:38, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Naush,\n>\n> On Tue, Dec 08, 2020 at 10:07:19AM +0000, Naushir Patuck wrote:\n> > On Mon, 7 Dec 2020 at 18:02, David Plowman wrote:\n> > > We add a GetConvergenceFrames method to the AgcAlgorithm class which\n> > > can be called when the AGC is started from scratch. It suggests how\n> > > many frames should be dropped before displaying any (while the AGC\n> > > converges).\n> > >\n> > > The Raspberry Pi specific implementation makes this customisable from\n> > > the tuning file.\n> > >\n> > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > ---\n> > >  src/ipa/raspberrypi/controller/agc_algorithm.hpp |  1 +\n> > >  src/ipa/raspberrypi/controller/rpi/agc.cpp       | 13 +++++++++++++\n> > >  src/ipa/raspberrypi/controller/rpi/agc.hpp       |  2 ++\n> > >  3 files changed, 16 insertions(+)\n> > >\n> > > diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > index b4ea54fb..85fc6084 100644\n> > > --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > @@ -15,6 +15,7 @@ class AgcAlgorithm : public Algorithm\n> > >  public:\n> > >         AgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n> > >         // An AGC algorithm must provide the following:\n> > > +       virtual unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const = 0;\n> > >\n> > >         virtual void SetEv(double ev) = 0;\n> > >         virtual void SetFlickerPeriod(double flicker_period) = 0;\n> > >         virtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds\n> > > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > index 9da18c31..787918cc 100644\n> > > --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > @@ -142,6 +142,7 @@ void AgcConfig::Read(boost::property_tree::ptree const &params)\n> > >         Y_target.Read(params.get_child(\"y_target\"));\n> > >         speed = params.get<double>(\"speed\", 0.2);\n> > >         startup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n> > > +       convergence_frames = params.get<unsigned int>(\"convergence_frames\", 6);\n> > >         fast_reduce_threshold =\n> > >                 params.get<double>(\"fast_reduce_threshold\", 0.4);\n> > >         base_ev = params.get<double>(\"base_ev\", 1.0);\n> > > @@ -206,6 +207,18 @@ void Agc::Resume()\n> > >         fixed_analogue_gain_ = 0;\n> > >  }\n> > >\n> > > +unsigned int Agc::GetConvergenceFrames(unsigned int mistrust_frames) const\n> > > +{\n> > > +       // If shutter and gain have been explicitly set, there is no\n> > > +       // convergence to happen, so no need to drop any frames - return zero.\n> > > +       // Otherwise, any frames for which we have been told not to trust the\n> > > +       // statistics must be added to our own count.\n> > > +       if (fixed_shutter_ && fixed_analogue_gain_)\n> > > +               return 0;\n> > > +       else\n> > > +               return config_.convergence_frames + mistrust_frames;\n> > > +}\n> > > +\n> >\n> > Minor nitpick, but why do you pass mistrust_frames into\n> > GetConvergenceFrames?  Could you not leave it out and do the addition of\n> > mistrust frames in the IPA? Either way,\n>\n> Could it be that the effect of the mistrusted frames could depend on the\n> algorithm's implementation ? I could imagine some algorithms not using\n> metadata, in which case the number of mistrusted frames could be\n> ignored (at least if mistrusted frames always means mistrusted\n> metadata).\n>\n> > Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> >\n> > >  void Agc::SetEv(double ev)\n> > >  {\n> > >         ev_ = ev;\n> > > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > index 95db1812..7d41608a 100644\n> > > --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > @@ -52,6 +52,7 @@ struct AgcConfig {\n> > >         Pwl Y_target;\n> > >         double speed;\n> > >         uint16_t startup_frames;\n> > > +       unsigned int convergence_frames;\n> > >         double max_change;\n> > >         double min_change;\n> > >         double fast_reduce_threshold;\n> > > @@ -74,6 +75,7 @@ public:\n> > >         bool IsPaused() const override;\n> > >         void Pause() override;\n> > >         void Resume() override;\n> > > +       unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const override;\n> > >         void SetEv(double ev) override;\n> > >         void SetFlickerPeriod(double flicker_period) override;\n> > >         void SetFixedShutter(double fixed_shutter) override; // microseconds\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 76EFCBDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 11:50:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0306C67E6D;\n\tTue,  8 Dec 2020 12:50:36 +0100 (CET)","from mail-oo1-xc41.google.com (mail-oo1-xc41.google.com\n\t[IPv6:2607:f8b0:4864:20::c41])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1A9A67E15\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 12:50:34 +0100 (CET)","by mail-oo1-xc41.google.com with SMTP id t23so3974705oov.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Dec 2020 03:50:34 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VV8cmkHO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=eyCRKg5BAFaX+6tMw4S0uSxhYxFFkmkpu6g0iMS1f54=;\n\tb=VV8cmkHOUeoEVUgbix5KYMUAKn6Bdz3ykuJCcthr3lH6vtyg5T4XHW3K8KSBuSGgDo\n\t1rtawgR/nNMwdG99nMEnJ7+G2qGE1RmMeIeqgItbt1SigBBQPwtoOlef7ZpW/zapIzKG\n\tH9cgoX2ZUSUdo8r04BJQl92gzM5VGvkCpvE255Lk6sEjbqvv/6xeoIqgI8Z3SkL6+0np\n\tMeKe6rC4otcAdz1iuGiMpsrYQksYkm6dkEfczaNXh/R7+uQtKMgVJgpRLmzRH0JtgEL7\n\t8obnVyvsG1bO4OFRgufLmemLq97W++Ef7kJNfWZHvCet60nQCfY82LS1N02/QR6CqeDj\n\tidZw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=eyCRKg5BAFaX+6tMw4S0uSxhYxFFkmkpu6g0iMS1f54=;\n\tb=ZcG0Gi+4uJb2nL7m4BXK84MHazStrZ4pRkaEETHJoj8rApALoowv+VrGRc08Q3grdf\n\tpWQ+IOtGWjq5PtvxaxF/3mNLsc7grI1fR+hNYUP75LOa/3LR+AcvgpK/v6PgpqSJPend\n\tLq0e7Oc+BXCzSSIHkO4FxEi+Xo0/DaKcuhqmHw6/7tYpxclXKJY575xUumE+jt8ql5kx\n\t0UBiTY0w6H4gXr8xEy3afy8MZ+P0cxcE7K2RF17ntWaykriS/iR95FOqQ2Ye4JQSrDCF\n\th3ChifSHAcgdTcWi0OU4TGf3DYfwWURNm8ICE4j9dL6ksGfWLmmuXsYWIgQTekr37/2U\n\t16/Q==","X-Gm-Message-State":"AOAM532bUHoCl8WzBa18vvSJRbi5lJAwYm8gS0ZgdSwqXCKb9ri8u2GV\n\t5e9/kTL0XfeFtjiohCJ3pXbV3/uuwlQMkXSXFxV4oQ==","X-Google-Smtp-Source":"ABdhPJzv/bAiLsvekaDJ0fri8gWWIDeydxuOedUxkfTVI2HpSFTP03iA8d7DiBa+jK8vFYUC2eSregzHxW1m+Sec69U=","X-Received":"by 2002:a4a:a2c5:: with SMTP id r5mr5429249ool.72.1607428233426; \n\tTue, 08 Dec 2020 03:50:33 -0800 (PST)","MIME-Version":"1.0","References":"<20201207180121.6374-1-david.plowman@raspberrypi.com>\n\t<20201207180121.6374-3-david.plowman@raspberrypi.com>\n\t<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>\n\t<X89lqoIn6H0sFFKg@pendragon.ideasonboard.com>","In-Reply-To":"<X89lqoIn6H0sFFKg@pendragon.ideasonboard.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Tue, 8 Dec 2020 11:50:22 +0000","Message-ID":"<CAHW6GYK+gsYcVGSekPG7ezCkfLR+Q8U2ORF8K98nvV3=LN775w@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","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 <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>"}},{"id":14141,"web_url":"https://patchwork.libcamera.org/comment/14141/","msgid":"<X89poVX6oR88wGOX@pendragon.ideasonboard.com>","date":"2020-12-08T11:55:13","subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nOn Tue, Dec 08, 2020 at 11:50:22AM +0000, David Plowman wrote:\n> Hi Laurent, Naush,\n> \n> Thanks for the comments. I think there are some good points there. To\n> bring the two together, I think Naush's suggest would be to avoid\n> passing mistrust_frames into the GetConvergenceFrames method, and in\n> the raspberrypi.cpp IPA file have something like:\n> \n> unsigned int convergenceFrames = agc->GetConvergenceFrames();\n> if (convergenceFrames)\n>         convergenceFrames += mistrustFrames;\n> \n> I can see that leaves the Algorithms looking simpler, which is nice.\n> \n> Moving onto Laurent's point, this would mean that there's an in-built\n> assumption that convergence is only to do with statistics (which,\n> you're right, is what \"mistrusted frames\" are all about). But I don't\n\nDo you mean sensor metadata, or statistics ?\n\n> really see any other sort of convergence, at least certainly not in\n> our pipeline.\n> \n> So I'm feeling like the Naush approach is probably the way to go...?\n\nI'm fine with that. Given that the mistrusted frames cause\nController::Process() to be skipped altogether, the algorithms can't see\nthose frames anyway, so there will always be an additional convergence\ndelay. If some algorithms could later work with mistrusted frames, we\nwould need a more intrusive rework anyway.\n\n> On Tue, 8 Dec 2020 at 11:38, Laurent Pinchart wrote:\n> > On Tue, Dec 08, 2020 at 10:07:19AM +0000, Naushir Patuck wrote:\n> > > On Mon, 7 Dec 2020 at 18:02, David Plowman wrote:\n> > > > We add a GetConvergenceFrames method to the AgcAlgorithm class which\n> > > > can be called when the AGC is started from scratch. It suggests how\n> > > > many frames should be dropped before displaying any (while the AGC\n> > > > converges).\n> > > >\n> > > > The Raspberry Pi specific implementation makes this customisable from\n> > > > the tuning file.\n> > > >\n> > > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > > ---\n> > > >  src/ipa/raspberrypi/controller/agc_algorithm.hpp |  1 +\n> > > >  src/ipa/raspberrypi/controller/rpi/agc.cpp       | 13 +++++++++++++\n> > > >  src/ipa/raspberrypi/controller/rpi/agc.hpp       |  2 ++\n> > > >  3 files changed, 16 insertions(+)\n> > > >\n> > > > diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > > b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > > index b4ea54fb..85fc6084 100644\n> > > > --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > > +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n> > > > @@ -15,6 +15,7 @@ class AgcAlgorithm : public Algorithm\n> > > >  public:\n> > > >         AgcAlgorithm(Controller *controller) : Algorithm(controller) {}\n> > > >         // An AGC algorithm must provide the following:\n> > > > +       virtual unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const = 0;\n> > > >\n> > > >         virtual void SetEv(double ev) = 0;\n> > > >         virtual void SetFlickerPeriod(double flicker_period) = 0;\n> > > >         virtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds\n> > > > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > > index 9da18c31..787918cc 100644\n> > > > --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > > +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> > > > @@ -142,6 +142,7 @@ void AgcConfig::Read(boost::property_tree::ptree const &params)\n> > > >         Y_target.Read(params.get_child(\"y_target\"));\n> > > >         speed = params.get<double>(\"speed\", 0.2);\n> > > >         startup_frames = params.get<uint16_t>(\"startup_frames\", 10);\n> > > > +       convergence_frames = params.get<unsigned int>(\"convergence_frames\", 6);\n> > > >         fast_reduce_threshold =\n> > > >                 params.get<double>(\"fast_reduce_threshold\", 0.4);\n> > > >         base_ev = params.get<double>(\"base_ev\", 1.0);\n> > > > @@ -206,6 +207,18 @@ void Agc::Resume()\n> > > >         fixed_analogue_gain_ = 0;\n> > > >  }\n> > > >\n> > > > +unsigned int Agc::GetConvergenceFrames(unsigned int mistrust_frames) const\n> > > > +{\n> > > > +       // If shutter and gain have been explicitly set, there is no\n> > > > +       // convergence to happen, so no need to drop any frames - return zero.\n> > > > +       // Otherwise, any frames for which we have been told not to trust the\n> > > > +       // statistics must be added to our own count.\n> > > > +       if (fixed_shutter_ && fixed_analogue_gain_)\n> > > > +               return 0;\n> > > > +       else\n> > > > +               return config_.convergence_frames + mistrust_frames;\n> > > > +}\n> > > > +\n> > >\n> > > Minor nitpick, but why do you pass mistrust_frames into\n> > > GetConvergenceFrames?  Could you not leave it out and do the addition of\n> > > mistrust frames in the IPA? Either way,\n> >\n> > Could it be that the effect of the mistrusted frames could depend on the\n> > algorithm's implementation ? I could imagine some algorithms not using\n> > metadata, in which case the number of mistrusted frames could be\n> > ignored (at least if mistrusted frames always means mistrusted\n> > metadata).\n> >\n> > > Reviewed-by: Naushir Patuck <naush@raspberrypi.com>\n> > >\n> > > >  void Agc::SetEv(double ev)\n> > > >  {\n> > > >         ev_ = ev;\n> > > > diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > > b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > > index 95db1812..7d41608a 100644\n> > > > --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > > +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n> > > > @@ -52,6 +52,7 @@ struct AgcConfig {\n> > > >         Pwl Y_target;\n> > > >         double speed;\n> > > >         uint16_t startup_frames;\n> > > > +       unsigned int convergence_frames;\n> > > >         double max_change;\n> > > >         double min_change;\n> > > >         double fast_reduce_threshold;\n> > > > @@ -74,6 +75,7 @@ public:\n> > > >         bool IsPaused() const override;\n> > > >         void Pause() override;\n> > > >         void Resume() override;\n> > > > +       unsigned int GetConvergenceFrames(unsigned int mistrust_frames) const override;\n> > > >         void SetEv(double ev) override;\n> > > >         void SetFlickerPeriod(double flicker_period) override;\n> > > >         void SetFixedShutter(double fixed_shutter) override; // microseconds","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 2AE36BDB20\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 11:55:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AE93D67E71;\n\tTue,  8 Dec 2020 12:55:18 +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 4C0EA67E15\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 12:55:17 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C7208DD;\n\tTue,  8 Dec 2020 12:55:16 +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=\"CyDIkF1R\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607428517;\n\tbh=xWL3DCNAy67FsTI6ot+Z6OHq1Luw3aoVLPqgNwJI+uk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CyDIkF1RQxCKb0voXKT6rzolYyEtYuzVUiNTxm2yZruxlzG3YG0ipO7nRBtThPSXi\n\tmWU0Dnu12Hyi9zGp1KdCjOwNrBoqNhBq8twt/cDeDvsvvMcfHj6rv/wqzQeFZw65yk\n\tybW49p6zJcIQ+v0mMerClALlWDapYJyKVEpuF4Mc=","Date":"Tue, 8 Dec 2020 13:55:13 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<X89poVX6oR88wGOX@pendragon.ideasonboard.com>","References":"<20201207180121.6374-1-david.plowman@raspberrypi.com>\n\t<20201207180121.6374-3-david.plowman@raspberrypi.com>\n\t<CAEmqJPrE_Tb6xtT7dwn69JZsx_get45OB0oHNC=eNgm+0otEgQ@mail.gmail.com>\n\t<X89lqoIn6H0sFFKg@pendragon.ideasonboard.com>\n\t<CAHW6GYK+gsYcVGSekPG7ezCkfLR+Q8U2ORF8K98nvV3=LN775w@mail.gmail.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<CAHW6GYK+gsYcVGSekPG7ezCkfLR+Q8U2ORF8K98nvV3=LN775w@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/6] src: ipa: raspberrypi: agc:\n\tAdd GetConvergenceFrames method to AGC base class","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 <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>"}}]