[{"id":20365,"web_url":"https://patchwork.libcamera.org/comment/20365/","msgid":"<163485014177.4046931.8096114749604551466@Monstersaurus>","date":"2021-10-21T21:02:21","subject":"Re: [libcamera-devel] [PATCH v3 08/14] ipa: ipu3: agc: Use filtered\n\texposure values","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:43:55)\n> We are filtering the exposure value to limit the gain to apply, but we\n> are not using the result.\n> \n> Fix it.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 984aed53..f5bb3328 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -158,17 +158,17 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)\n>  \n>                 utils::Duration newExposure = 0.0s;\n>                 if (currentShutter < maxShutterSpeed) {\n> -                       exposure = std::clamp<uint32_t>(exposure * currentExposure_ / currentExposureNoDg_,\n> +                       exposure = std::clamp<uint32_t>(exposure * filteredExposure_ / currentExposureNoDg_,\n>                                                         minExposureLines_,\n>                                                         maxExposureLines_);\n> -                       newExposure = currentExposure_ / exposure;\n> -                       gain = std::clamp(gain * currentExposure_ / newExposure,\n> +                       newExposure = filteredExposure_ / exposure;\n> +                       gain = std::clamp(gain * filteredExposure_ / newExposure,\n>                                           kMinGain, kMaxGain);\n>                 } else {\n> -                       gain = std::clamp(gain * currentExposure_ / currentExposureNoDg_,\n> +                       gain = std::clamp(gain * filteredExposure_ / currentExposureNoDg_,\n>                                           kMinGain, kMaxGain);\n> -                       newExposure = currentExposure_ / gain;\n> -                       exposure = std::clamp<uint32_t>(exposure * currentExposure_ / newExposure,\n> +                       newExposure = filteredExposure_ / gain;\n> +                       exposure = std::clamp<uint32_t>(exposure * filteredExposure_ / newExposure,\n>                                                         minExposureLines_,\n>                                                         maxExposureLines_);\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 2EE46BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Oct 2021 21:02:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 858BB68F58;\n\tThu, 21 Oct 2021 23:02:26 +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 258E2604FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Oct 2021 23:02:25 +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 B30F71B43;\n\tThu, 21 Oct 2021 23:02:24 +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=\"AH9mfAp1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634850144;\n\tbh=2Wr25FD11pRn9rhprtWt238/TaJ2eECvBK4n1PoL1VM=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=AH9mfAp14VPVeGm2UHJtz5YMOX5gU4b73P7G76yo8KppFJEyEKKmyEo+duOYL2WX7\n\th6OVgYxkqyL8mjrkDX7lSbNy15jXeObIVb3565vTdaNlMFr88aQHXaTwKuGXAktD2Y\n\tMD8zYnsIsUbqdv1DcKvWtFmK395P+cfAtw2If8hU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211021164401.110033-9-jeanmichel.hautbois@ideasonboard.com>","References":"<20211021164401.110033-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211021164401.110033-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":"Thu, 21 Oct 2021 22:02:21 +0100","Message-ID":"<163485014177.4046931.8096114749604551466@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v3 08/14] ipa: ipu3: agc: Use filtered\n\texposure values","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>"}},{"id":20372,"web_url":"https://patchwork.libcamera.org/comment/20372/","msgid":"<YXI5xuSxiQpHEQjp@pendragon.ideasonboard.com>","date":"2021-10-22T04:10:46","subject":"Re: [libcamera-devel] [PATCH v3 08/14] ipa: ipu3: agc: Use filtered\n\texposure values","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jean-Michel,\n\nThank you for the patch.\n\nOn Thu, Oct 21, 2021 at 06:43:55PM +0200, Jean-Michel Hautbois wrote:\n> We are filtering the exposure value to limit the gain to apply, but we\n> are not using the result.\n> \n> Fix it.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 12 ++++++------\n>  1 file changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index 984aed53..f5bb3328 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -158,17 +158,17 @@ void Agc::lockExposureGain(uint32_t &exposure, double &gain)\n>  \n>  \t\tutils::Duration newExposure = 0.0s;\n>  \t\tif (currentShutter < maxShutterSpeed) {\n> -\t\t\texposure = std::clamp<uint32_t>(exposure * currentExposure_ / currentExposureNoDg_,\n> +\t\t\texposure = std::clamp<uint32_t>(exposure * filteredExposure_ / currentExposureNoDg_,\n>  \t\t\t\t\t\t\tminExposureLines_,\n>  \t\t\t\t\t\t\tmaxExposureLines_);\n> -\t\t\tnewExposure = currentExposure_ / exposure;\n> -\t\t\tgain = std::clamp(gain * currentExposure_ / newExposure,\n> +\t\t\tnewExposure = filteredExposure_ / exposure;\n> +\t\t\tgain = std::clamp(gain * filteredExposure_ / newExposure,\n>  \t\t\t\t\t  kMinGain, kMaxGain);\n>  \t\t} else {\n> -\t\t\tgain = std::clamp(gain * currentExposure_ / currentExposureNoDg_,\n> +\t\t\tgain = std::clamp(gain * filteredExposure_ / currentExposureNoDg_,\n>  \t\t\t\t\t  kMinGain, kMaxGain);\n> -\t\t\tnewExposure = currentExposure_ / gain;\n> -\t\t\texposure = std::clamp<uint32_t>(exposure * currentExposure_ / newExposure,\n> +\t\t\tnewExposure = filteredExposure_ / gain;\n> +\t\t\texposure = std::clamp<uint32_t>(exposure * filteredExposure_ / newExposure,\n>  \t\t\t\t\t\t\tminExposureLines_,\n>  \t\t\t\t\t\t\tmaxExposureLines_);\n>  \t\t}","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 ED5AFBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 04:11:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 451D768F59;\n\tFri, 22 Oct 2021 06:11:08 +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 697EE60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 06:11:06 +0200 (CEST)","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 D706A51D;\n\tFri, 22 Oct 2021 06:11:05 +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=\"Hc3mYxjf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634875866;\n\tbh=NCbDHHK1t/Cjbc66Sl/oR5+qff3Kkxmf6vfvAjE0eJs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Hc3mYxjfo9kZ7VZjiqp7V6wDb71JYhrvQ6fPFJm/BrVZAIC1f1qp2xgPTWAPEt7cH\n\ttOqkLzsJoX/IMNtfxeRHJwbJ144V6Mpbe5sPP9+U7yKDs+mNLHWi5didCB3aZefxkH\n\tTB/QBR+k+SGHnHD1ABElMUSve5HCnyzM5ZHpzOQw=","Date":"Fri, 22 Oct 2021 07:10:46 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<YXI5xuSxiQpHEQjp@pendragon.ideasonboard.com>","References":"<20211021164401.110033-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211021164401.110033-9-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211021164401.110033-9-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 08/14] ipa: ipu3: agc: Use filtered\n\texposure values","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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]