[{"id":20367,"web_url":"https://patchwork.libcamera.org/comment/20367/","msgid":"<163485059775.4046931.1261163182773451417@Monstersaurus>","date":"2021-10-21T21:09:57","subject":"Re: [libcamera-devel] [PATCH v3 13/14] ipa: ipu3: agc: Remove\n\tunused variables","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jean-Michel Hautbois (2021-10-21 17:44:00)\n> We currently control the exposure value by the shutter speed and the\n> analogue gain. We can't use the digital gain to have more than the\n> maximum exposure value calculated because we are not controlling it.\n> \n> Remove unused code associated with this digital gain.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI still like removing ununsed code ;-)\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 19 +++----------------\n>  src/ipa/ipu3/algorithms/agc.h   |  2 --\n>  2 files changed, 3 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 7ff3029b..be59d0b0 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -42,8 +42,7 @@ static constexpr double kEvGainTarget = 0.5;\n>  Agc::Agc()\n>         : frameCount_(0), lastFrame_(0), iqMean_(0.0), lineDuration_(0s),\n>           minExposureLines_(0), maxExposureLines_(0), filteredExposure_(0s),\n> -         filteredExposureNoDg_(0s), currentExposure_(0s),\n> -         currentExposureNoDg_(0s), prevExposureValue_(0s)\n> +         currentExposure_(0s), prevExposureValue_(0s)\n>  {\n>  }\n>  \n> @@ -102,7 +101,6 @@ void Agc::filterExposure()\n>         if (filteredExposure_ == 0s) {\n>                 /* DG stands for digital gain.*/\n>                 filteredExposure_ = currentExposure_;\n> -               filteredExposureNoDg_ = currentExposureNoDg_;\n>         } else {\n>                 /*\n>                  * If we are close to the desired result, go faster to avoid making\n> @@ -115,18 +113,8 @@ void Agc::filterExposure()\n>  \n>                 filteredExposure_ = speed * currentExposure_ +\n>                                 filteredExposure_ * (1.0 - speed);\n> -               filteredExposureNoDg_ = speed * currentExposureNoDg_ +\n> -                               filteredExposureNoDg_ * (1.0 - speed);\n>         }\n> -       /*\n> -        * We can't let the no_dg exposure deviate too far below the\n> -        * total exposure, as there might not be enough digital gain available\n> -        * in the ISP to hide it (which will cause nasty oscillation).\n> -        */\n> -       double fastReduceThreshold = 0.4;\n> -       if (filteredExposureNoDg_ <\n> -           filteredExposure_ * fastReduceThreshold)\n> -               filteredExposureNoDg_ = filteredExposure_ * fastReduceThreshold;\n> +\n>         LOG(IPU3Agc, Debug) << \"After filtering, total_exposure \" << filteredExposure_;\n>  }\n>  \n> @@ -145,8 +133,7 @@ void Agc::lockExposureGain(uint32_t &exposure, double &analogueGain)\n>  \n>         /* extracted from Rpi::Agc::computeTargetExposure */\n>         utils::Duration currentShutter = exposure * lineDuration_;\n> -       currentExposureNoDg_ = currentShutter * analogueGain;\n> -       LOG(IPU3Agc, Debug) << \"Actual total exposure \" << currentExposureNoDg_\n> +       LOG(IPU3Agc, Debug) << \"Actual total exposure \" << currentShutter * analogueGain\n>                             << \" Shutter speed \" << currentShutter\n>                             << \" Gain \" << analogueGain\n>                             << \" Needed ev gain \" << evGain;\n> diff --git a/src/ipa/ipu3/algorithms/agc.h b/src/ipa/ipu3/algorithms/agc.h\n> index 2ae88e9f..ad133b98 100644\n> --- a/src/ipa/ipu3/algorithms/agc.h\n> +++ b/src/ipa/ipu3/algorithms/agc.h\n> @@ -46,9 +46,7 @@ private:\n>         uint32_t maxExposureLines_;\n>  \n>         utils::Duration filteredExposure_;\n> -       utils::Duration filteredExposureNoDg_;\n>         utils::Duration currentExposure_;\n> -       utils::Duration currentExposureNoDg_;\n>         utils::Duration prevExposureValue_;\n>  \n>         uint32_t stride_;\n> -- \n> 2.32.0\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 81802BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Oct 2021 21:10:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40E7E68F56;\n\tThu, 21 Oct 2021 23:10:02 +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 A92D8604FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Oct 2021 23:10:00 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5A9128B6;\n\tThu, 21 Oct 2021 23:10:00 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"L6Qe0VPu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634850600;\n\tbh=fnCvUFCook7U/aQhAt3/E1eNb90Nqya84RIjiFcnY6U=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=L6Qe0VPuz08BHxjAHIcnV6C0NMe3t1jWA+hfelDgvETBCPaE9z3N7Ckc8/DMr38KN\n\tbke4p/v3uDJONGpoJpaeS9A6Gm73LZX9wng//lCm19nuiBNja3jGVVRNYQFZjZWVpQ\n\t4+hJ+LyBonBX/aY6shbTTCbp3J9B/x3EOGNVq4H8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211021164401.110033-14-jeanmichel.hautbois@ideasonboard.com>","References":"<20211021164401.110033-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211021164401.110033-14-jeanmichel.hautbois@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 21 Oct 2021 22:09:57 +0100","Message-ID":"<163485059775.4046931.1261163182773451417@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v3 13/14] ipa: ipu3: agc: Remove\n\tunused variables","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]