[{"id":20826,"web_url":"https://patchwork.libcamera.org/comment/20826/","msgid":"<163658196036.2121661.17811757210654691521@Monstersaurus>","date":"2021-11-10T22:06:00","subject":"Re: [libcamera-devel] [PATCH v2 06/14] ipa: ipu3: agc: Refactor ev\n\tgain calculation and testing","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-10 19:58:53)\n> When we compute the new gain, we use the iqMean_ and estimate an\n> exposure value gain to apply. Return early when the gain is less than\n> 1%.\n> \n\nThis certainly looks and reads cleaner.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 8 +++-----\n>  1 file changed, 3 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 133f5931..119a7938 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -189,17 +189,15 @@ void Agc::filterExposure()\n>   */\n>  void Agc::computeExposure(uint32_t &exposure, double &analogueGain)\n>  {\n> +       /* Estimate the gain needed to have the proportion wanted */\n> +       double evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n>  \n> -       /* Are we correctly exposed ? */\n> -       if (std::abs(iqMean_ - kEvGainTarget * knumHistogramBins) <= 1) {\n> +       if (std::abs(evGain - 1.0) < 0.01) {\n>                 LOG(IPU3Agc, Debug) << \"We are well exposed (iqMean = \"\n>                                     << iqMean_ << \")\";\n>                 return;\n>         }\n>  \n> -       /* Estimate the gain needed to have the proportion wanted */\n> -       double evGain = kEvGainTarget * knumHistogramBins / iqMean_;\n> -\n>         /* extracted from Rpi::Agc::computeTargetExposure */\n>         /* Calculate the shutter time in seconds */\n>         utils::Duration currentShutter = exposure * lineDuration_;\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 40DD8BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Nov 2021 22:06:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 90BA66035D;\n\tWed, 10 Nov 2021 23:06:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 762E86033C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Nov 2021 23:06:03 +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 0BF838B6;\n\tWed, 10 Nov 2021 23:06:03 +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=\"rQL+4L/V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636581963;\n\tbh=vxE0lgjjUCKCq2Lseu3ocwdXUJfh/Rf1OcxtP7wbn68=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=rQL+4L/VJzJJZKskzeM09Z/JfoKcO2yj/Go46DE20asjSKbt9iUktSxEr7FV4qVbh\n\tap3sTwzKloe11jq8GI9FK+Pruaj8DX0z2I16M+B7kPOG+aOPPVHXKr2SCZxVB/Xd2s\n\taJQxH6DrhOCyS1FYhSY5sANFDo3xeVvvHPM1oajw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211110195901.85597-7-jeanmichel.hautbois@ideasonboard.com>","References":"<20211110195901.85597-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211110195901.85597-7-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":"Wed, 10 Nov 2021 22:06:00 +0000","Message-ID":"<163658196036.2121661.17811757210654691521@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 06/14] ipa: ipu3: agc: Refactor ev\n\tgain calculation and testing","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>"}}]