[{"id":20666,"web_url":"https://patchwork.libcamera.org/comment/20666/","msgid":"<163595196612.3323118.15366395053820043494@Monstersaurus>","date":"2021-11-03T15:06:06","subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the saturation\n\tratio test","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-03 13:04:45)\n> When the histogram is calculated, we check if a cell is saturated or not\n> before cumulating its green value. This is wrong, and it can lead to an\n> empty histogram in case of a fully saturated frame.\n\nDoes it now cause saturated cells to be included in the calculations in\nan adverse way?\n\nI.e. do we now go back to over saturated lights/windows causing us to\nunder-expose? or is this handled separately?\n\n\n> This case is reported in bug #84.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=84\n\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/agc.cpp | 18 ++++++++----------\n>  1 file changed, 8 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n> index b5d736c1..7ac8dfb2 100644\n> --- a/src/ipa/ipu3/algorithms/agc.cpp\n> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n> @@ -124,16 +124,14 @@ void Agc::measureBrightness(const ipu3_uapi_stats_3a *stats,\n>                                         &stats->awb_raw_buffer.meta_data[cellPosition]\n>                                 );\n>  \n> -                       if (cell->sat_ratio == 0) {\n> -                               uint8_t gr = cell->Gr_avg;\n> -                               uint8_t gb = cell->Gb_avg;\n> -                               /*\n> -                                * Store the average green value to estimate the\n> -                                * brightness. Even the overexposed pixels are\n> -                                * taken into account.\n> -                                */\n> -                               hist[(gr + gb) / 2]++;\n> -                       }\n> +                       uint8_t gr = cell->Gr_avg;\n> +                       uint8_t gb = cell->Gb_avg;\n> +                       /*\n> +                       * Store the average green value to estimate the\n> +                       * brightness. Even the overexposed pixels are\n> +                       * taken into account.\n> +                       */\n> +                       hist[(gr + gb) / 2]++;\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 44433BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Nov 2021 15:06:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 94E58600BF;\n\tWed,  3 Nov 2021 16:06:10 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5AA4C600B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Nov 2021 16:06:09 +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 907D1501;\n\tWed,  3 Nov 2021 16:06:08 +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=\"j5kFJ51u\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635951968;\n\tbh=qsuKwShUKedhPeCRSAMAHBMHvuMW1b5ueI2eplwyAVg=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=j5kFJ51u5Uz6lgwXsAZql2IOk5Z51ywizG7BltkVQqFWdcFd/kmvnPQH4ST/ELHNO\n\txm9v37mqmE+OFetGKww6ecfwRmojiYVgp+QatqW07MwEMpXm0tEKnxK675UWkjW+fG\n\tAopDaHP8QEJWYMP44uNQ7OlSlHTJXMr8wmdVqO8Y=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211103130445.64458-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20211103130445.64458-1-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, 03 Nov 2021 15:06:06 +0000","Message-ID":"<163595196612.3323118.15366395053820043494@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the saturation\n\tratio test","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":20673,"web_url":"https://patchwork.libcamera.org/comment/20673/","msgid":"<d329e7c0-840a-0a88-8145-e662f7247762@ideasonboard.com>","date":"2021-11-04T11:22:27","subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the saturation\n\tratio test","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Kieran,\n\nOn 03/11/2021 16:06, Kieran Bingham wrote:\n> Quoting Jean-Michel Hautbois (2021-11-03 13:04:45)\n>> When the histogram is calculated, we check if a cell is saturated or not\n>> before cumulating its green value. This is wrong, and it can lead to an\n>> empty histogram in case of a fully saturated frame.\n> \n> Does it now cause saturated cells to be included in the calculations in\n> an adverse way?\n> \n> I.e. do we now go back to over saturated lights/windows causing us to\n> under-expose? or is this handled separately?\n\nYes, so I will send a v2 (but with a different subject) to use only a \ncertain amount of saturated cells. This way the histogram can't be empty \nand we still know we are saturated so we correct the exposure.\n\n> \n> \n>> This case is reported in bug #84.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=84\n> \n>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>> ---\n>>   src/ipa/ipu3/algorithms/agc.cpp | 18 ++++++++----------\n>>   1 file changed, 8 insertions(+), 10 deletions(-)\n>>\n>> diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\n>> index b5d736c1..7ac8dfb2 100644\n>> --- a/src/ipa/ipu3/algorithms/agc.cpp\n>> +++ b/src/ipa/ipu3/algorithms/agc.cpp\n>> @@ -124,16 +124,14 @@ void Agc::measureBrightness(const ipu3_uapi_stats_3a *stats,\n>>                                          &stats->awb_raw_buffer.meta_data[cellPosition]\n>>                                  );\n>>   \n>> -                       if (cell->sat_ratio == 0) {\n>> -                               uint8_t gr = cell->Gr_avg;\n>> -                               uint8_t gb = cell->Gb_avg;\n>> -                               /*\n>> -                                * Store the average green value to estimate the\n>> -                                * brightness. Even the overexposed pixels are\n>> -                                * taken into account.\n>> -                                */\n>> -                               hist[(gr + gb) / 2]++;\n>> -                       }\n>> +                       uint8_t gr = cell->Gr_avg;\n>> +                       uint8_t gb = cell->Gb_avg;\n>> +                       /*\n>> +                       * Store the average green value to estimate the\n>> +                       * brightness. Even the overexposed pixels are\n>> +                       * taken into account.\n>> +                       */\n>> +                       hist[(gr + gb) / 2]++;\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 987B2BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Nov 2021 11:22:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED9FC6032C;\n\tThu,  4 Nov 2021 12:22:30 +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 52AF06032C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Nov 2021 12:22:30 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:3875:cc64:ce12:aabc] (unknown\n\t[IPv6:2a01:e0a:169:7140:3875:cc64:ce12:aabc])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D882E52;\n\tThu,  4 Nov 2021 12:22:29 +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=\"s8I3SSHG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636024950;\n\tbh=3ZeLW3dzlyo8mg6QTnpBi1KE2ygA9/892p4LAcpUHGk=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=s8I3SSHGSaPfZ/o9J5lkonGwX+1fgrAB4UGcIdVcLhD5UMXdsV0DbHtnqNdt1GV26\n\tfhs4+du0/AGWnLJYwBlv4UzrSz8h+4kO31KrU/FghyKcBGSA/UDA+RGQRTKmzHyRi9\n\tp3Ipa8xIuMUwtNnIaP9ik2wDGlnPpUtc5ajZpuyo=","Message-ID":"<d329e7c0-840a-0a88-8145-e662f7247762@ideasonboard.com>","Date":"Thu, 4 Nov 2021 12:22:27 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.1.2","Content-Language":"en-US","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20211103130445.64458-1-jeanmichel.hautbois@ideasonboard.com>\n\t<163595196612.3323118.15366395053820043494@Monstersaurus>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<163595196612.3323118.15366395053820043494@Monstersaurus>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] ipa: ipu3: agc: Remove the saturation\n\tratio test","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>"}}]