[{"id":20720,"web_url":"https://patchwork.libcamera.org/comment/20720/","msgid":"<163638463213.275423.7114658444711737982@Monstersaurus>","date":"2021-11-08T15:17:12","subject":"Re: [libcamera-devel] [PATCH 08/22] ipa: ipu3: agc: Update previous\n\texposure value","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-11-08 13:13:36)\n> Previous exposure value is calculated based on the estimated shutter\n\nPreviously ?\n\nif so\nPreviously, the exposure value was calculated based...\n\n> time and gain applied. Now that we have the real values for the current\n> frame, use those before estimating the next one.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 19 +++----------------\n>  1 file changed, 3 insertions(+), 16 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index e4048d40..475e715f 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -193,15 +193,12 @@ void Agc::computeExposure(uint32_t &exposure, double &analogueGain, double curre\n>         /* Estimate the gain needed to have the proportion wanted */\n>         double evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n>  \n> -       if (std::abs(evGain - 1.0) < 0.01) {\n\nHrm ... we'd not long ago added this, but I guess it's fine as the\ndevelopment path.\n\n\n> -               LOG(IPU3Agc, Debug) << \"We are well exposed (iqMean = \"\n> -                                   << iqMean_ << \")\";\n> -               return;\n> -       }\n> -\n>         /* extracted from Rpi::Agc::computeTargetExposure */\n>         /* Calculate the shutter time in seconds */\n>         utils::Duration currentShutter = exposure * lineDuration_;\n\nNew line here please, my eyes really struggle to separate or group content when\nit's condensed as\n\n\t/* line comment like the code */\n\tcode as long as the comment;\n\t/* line comment also here */\n\tmore code batched together;\n\nThe code blurs into the comments too easily, and it all looks like one\nblock.\n\n\n> +       /* Update the exposure value for the next computation. */\n> +       prevExposureValue_ = currentShutter * analogueGain;\n> +\n\nIs there a reason this moves earlier in the function? Does it get used\nbefore the end? If so - it's not the 'previousExposureValue' is it?\n\nPerhaps I haven't understood the meaning of the specific variables. It's\njust hard to see how we are in a current frame, calculating the\n'previous' exposure... just before we use it.\n\n>         LOG(IPU3Agc, Debug) << \"Actual total exposure \" << currentShutter * analogueGain\n>                             << \" Shutter speed \" << currentShutter\n>                             << \" Gain \" << analogueGain\n> @@ -250,16 +247,6 @@ void Agc::computeExposure(uint32_t &exposure, double &analogueGain, double curre\n>  \n>         exposure = shutterTime / lineDuration_;\n>         analogueGain = stepGain;\n> -\n> -       /*\n> -        * Update the exposure value for the next process call.\n> -        *\n> -        * \\todo Obtain the values of the exposure time and analog gain\n> -        * that were actually used by the sensor, either from embedded\n> -        * data when available, or from the delayed controls\n> -        * infrastructure in case a slow down caused a mismatch.\n> -        */\n> -       prevExposureValue_ = shutterTime * analogueGain;\n>  }\n>  \n>  /**\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 3337FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Nov 2021 15:17:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6FA036032C;\n\tMon,  8 Nov 2021 16:17:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45CD66032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Nov 2021 16:17:15 +0100 (CET)","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 D01CE110E;\n\tMon,  8 Nov 2021 16:17:14 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"E+SJrzlS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636384634;\n\tbh=6IVPDoqMQ8Alafrni25efyhaQrWVtRJn232jmiRh2fw=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=E+SJrzlSgB3lixGv9PbttytsFkY7QFspgfNG/xjqNsJMmkqCK4ewTRn7RkVQaVtsY\n\tcUsxQPKqyhUTtkX2ni2Ay6SRkcS43I9/myFiRUT535MSs9JIGKOX/UomjiVx+9hoM7\n\tDpSD+s78J9KCbqtmHpVQclrNtQqI47qI95NNplfA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211108131350.130665-9-jeanmichel.hautbois@ideasonboard.com>","References":"<20211108131350.130665-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211108131350.130665-9-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":"Mon, 08 Nov 2021 15:17:12 +0000","Message-ID":"<163638463213.275423.7114658444711737982@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH 08/22] ipa: ipu3: agc: Update previous\n\texposure value","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>"}}]