[{"id":19934,"web_url":"https://patchwork.libcamera.org/comment/19934/","msgid":"<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>","date":"2021-09-28T15:53:42","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n> The gains have a precision u3.13, range [0, 8) which means that a gain\n\ns/)/]/ or s/[/(/\n\n> multiplier value of 1.0 is represented as a multiplication by 8192 in\n> the ImgU. Correct the gains as this was misunderstood in the first\n> place.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n>  1 file changed, 6 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 800d023c..8a926691 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>  \tasyncResults_.redGain = redGain;\n> +\t/* Green gains should not be touched and considered 1. */\n>  \tasyncResults_.greenGain = 1.0;\n>  \tasyncResults_.blueGain = blueGain;\n>  }\n> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n> -\t/*\n> -\t * Green gains should not be touched and considered 1.\n> -\t * Default is 16, so do not change it at all.\n> -\t * 4096 is the value for a gain of 1.0\n> -\t */\n> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n> +\t/* 8192 is the multiplier for a gain of 1.0 */\n\nI'd be a bit more explicit to say at least\n\n  /* Convert to u3.13 Fixed point values with a base of 8192 */\n\nBut I'm not sure the '8192' is a base as such, perhaps just:\n\n  /* Convert to u3.13 fixed point values */\n\nSometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\nclass that handles this a bit more elegantly...\n\nBut I don't think we want to dwell on that right now.\n\nWhatever works out best in the end (and I think we'll revist this with\na FixedPoint type sometime)...:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n>  \n>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n>  \n> -- \n> 2.30.2\n> \n\n--\nKieran","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 53E8CC3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Sep 2021 15:53:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9459E69193;\n\tTue, 28 Sep 2021 17:53:45 +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 87F9F69188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Sep 2021 17:53:44 +0200 (CEST)","from 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 0F6F73F1;\n\tTue, 28 Sep 2021 17:53:44 +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=\"Tb6R/Wcu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632844424;\n\tbh=kQTKI1K9NhpQolPX/LOWRgsFfg05OW842LNQONQ3xDA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Tb6R/WcuSZokxSxzkByysdPQLZomkGLtqFrPF7it1KgBkgrwkWSCveiLO8v9yvWUt\n\tm2ixznatmhbDC04PMeXZ7fIgddyKMYvIgKQrVhNeoxXj9fV0O9XDrHjAdGbBASwI0s\n\taYMAmYuvO488Y0zTVvzbD3GKZkNj7+qJo1RLPr7E=","Date":"Tue, 28 Sep 2021 16:53:42 +0100","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}},{"id":19935,"web_url":"https://patchwork.libcamera.org/comment/19935/","msgid":"<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>","date":"2021-09-28T15:59:29","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"On 28/09/2021 17:53, Kieran Bingham wrote:\n> On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n>> The gains have a precision u3.13, range [0, 8) which means that a gain\n> \n> s/)/]/ or s/[/(/\n\nMmmh, I must disagree here, it is going from 0 to 7,99987793 and not 8\n(all ones). So the interval is opened for 8.\n\n> \n>> multiplier value of 1.0 is represented as a multiplication by 8192 in\n>> the ImgU. Correct the gains as this was misunderstood in the first\n>> place.\n>>\n>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>> ---\n>>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n>>  1 file changed, 6 insertions(+), 9 deletions(-)\n>>\n>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n>> index 800d023c..8a926691 100644\n>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n>>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>>  \tasyncResults_.redGain = redGain;\n>> +\t/* Green gains should not be touched and considered 1. */\n>>  \tasyncResults_.greenGain = 1.0;\n>>  \tasyncResults_.blueGain = blueGain;\n>>  }\n>> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n>>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n>> -\t/*\n>> -\t * Green gains should not be touched and considered 1.\n>> -\t * Default is 16, so do not change it at all.\n>> -\t * 4096 is the value for a gain of 1.0\n>> -\t */\n>> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n>> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n>> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n>> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n>> +\t/* 8192 is the multiplier for a gain of 1.0 */\n> \n> I'd be a bit more explicit to say at least\n> \n>   /* Convert to u3.13 Fixed point values with a base of 8192 */\n> \n> But I'm not sure the '8192' is a base as such, perhaps just:\n> \n>   /* Convert to u3.13 fixed point values */\n> \n> Sometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\n> class that handles this a bit more elegantly...\n> \n> But I don't think we want to dwell on that right now.\n> \n> Whatever works out best in the end (and I think we'll revist this with\n> a FixedPoint type sometime)...:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nOK, thx.\n\n> \n>> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n>> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n>> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n>> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n>>  \n>>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n>>  \n>> -- \n>> 2.30.2\n>>\n> \n> --\n> Kieran\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 1BC2DBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Sep 2021 15:59:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 482BF69191;\n\tTue, 28 Sep 2021 17:59:34 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9B5C69188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Sep 2021 17:59:32 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:49db:1c4b:4bb:6f1f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 53E1A3F1;\n\tTue, 28 Sep 2021 17:59:32 +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=\"lGZk5Muq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632844772;\n\tbh=cAwlOpjpp6L0H8Xu5KngVQM8ee0TZOR1lZeogRpk+fU=;\n\th=Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=lGZk5Muq72xXzl/I23lJn/10V/2TaHgsB3chmLU6IseyR1pFVvTAjWi6UjLJDPhZz\n\t00ouD8cHsVeguc+yDokMjtf4TXmrYCsiylDAqW3xIx7br2nNVXIIVUFLJLfqC8cdAT\n\t05s0LWqULYyCC6+sTYE7Bh1GhXS4Nf52VSiS09+A=","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>\n\t<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>","Date":"Tue, 28 Sep 2021 17:59:29 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}},{"id":19939,"web_url":"https://patchwork.libcamera.org/comment/19939/","msgid":"<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>","date":"2021-09-28T16:31:31","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 28/09/2021 16:59, Jean-Michel Hautbois wrote:\n> On 28/09/2021 17:53, Kieran Bingham wrote:\n>> On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n>>> The gains have a precision u3.13, range [0, 8) which means that a gain\n>>\n>> s/)/]/ or s/[/(/\n> \n> Mmmh, I must disagree here, it is going from 0 to 7,99987793 and not 8\n> (all ones). So the interval is opened for 8.\n\nIt looks like a typo ... Is that a defined way to describe that range\notherwise? It wasn't obvious to me that you were trying to convey that\nby the different symbols.\n\n\n>>> multiplier value of 1.0 is represented as a multiplication by 8192 in\n>>> the ImgU. Correct the gains as this was misunderstood in the first\n>>> place.\n>>>\n>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>>> ---\n>>>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n>>>  1 file changed, 6 insertions(+), 9 deletions(-)\n>>>\n>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n>>> index 800d023c..8a926691 100644\n>>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>>> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n>>>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>>>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>>>  \tasyncResults_.redGain = redGain;\n>>> +\t/* Green gains should not be touched and considered 1. */\n>>>  \tasyncResults_.greenGain = 1.0;\n>>>  \tasyncResults_.blueGain = blueGain;\n>>>  }\n>>> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n>>>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n>>> -\t/*\n>>> -\t * Green gains should not be touched and considered 1.\n>>> -\t * Default is 16, so do not change it at all.\n>>> -\t * 4096 is the value for a gain of 1.0\n>>> -\t */\n>>> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n>>> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n>>> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n>>> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n>>> +\t/* 8192 is the multiplier for a gain of 1.0 */\n>>\n>> I'd be a bit more explicit to say at least\n>>\n>>   /* Convert to u3.13 Fixed point values with a base of 8192 */\n>>\n>> But I'm not sure the '8192' is a base as such, perhaps just:\n>>\n>>   /* Convert to u3.13 fixed point values */\n>>\n>> Sometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\n>> class that handles this a bit more elegantly...\n>>\n>> But I don't think we want to dwell on that right now.\n>>\n>> Whatever works out best in the end (and I think we'll revist this with\n>> a FixedPoint type sometime)...:\n>>\n>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> OK, thx.\n> \n>>\n>>> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n>>> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n>>> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n>>> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n>>>  \n>>>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n>>>  \n>>> -- \n>>> 2.30.2\n>>>\n>>\n>> --\n>> Kieran\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 389CDBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Sep 2021 16:31:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6E67669191;\n\tTue, 28 Sep 2021 18:31:35 +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 19BE969188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Sep 2021 18:31:34 +0200 (CEST)","from [192.168.0.20]\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 912523F1;\n\tTue, 28 Sep 2021 18:31:33 +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=\"NxQ6nDlj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632846693;\n\tbh=rcRGY8mBkSGl5OjuKYbyAR7ZEU1AYm4cwaPQXvncGPM=;\n\th=From:Subject:To:Cc:References:Date:In-Reply-To:From;\n\tb=NxQ6nDljOUJIhKk1/H3GvBOEPIKp02lk7A9gC+Ki5h+J+AJSvvOHDVDBDBW16U/4x\n\tXR78hiVjn0VVUqrTFw5/9TQ8/+9kMitoMCZEKkxkqViAdGLl60M5Zl6OETPakBoTOp\n\tbnLVgsPRk8OgZBwb4I8wtaufqOzrS5LGrzjO9ZrE=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>\n\t<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>\n\t<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>","Message-ID":"<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>","Date":"Tue, 28 Sep 2021 17:31:31 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}},{"id":19940,"web_url":"https://patchwork.libcamera.org/comment/19940/","msgid":"<fc1d1bce-4f66-7dad-05c9-461f778412e5@ideasonboard.com>","date":"2021-09-28T16:32:41","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"On 28/09/2021 18:31, Kieran Bingham wrote:\n> On 28/09/2021 16:59, Jean-Michel Hautbois wrote:\n>> On 28/09/2021 17:53, Kieran Bingham wrote:\n>>> On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n>>>> The gains have a precision u3.13, range [0, 8) which means that a gain\n>>>\n>>> s/)/]/ or s/[/(/\n>>\n>> Mmmh, I must disagree here, it is going from 0 to 7,99987793 and not 8\n>> (all ones). So the interval is opened for 8.\n> \n> It looks like a typo ... Is that a defined way to describe that range\n> otherwise? It wasn't obvious to me that you were trying to convey that\n> by the different symbols.\n> \n> \n\nSorry about that, it is the mathematical definition, maybe should we\nwrite it differently... ?\n\n>>>> multiplier value of 1.0 is represented as a multiplication by 8192 in\n>>>> the ImgU. Correct the gains as this was misunderstood in the first\n>>>> place.\n>>>>\n>>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>>>> ---\n>>>>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n>>>>  1 file changed, 6 insertions(+), 9 deletions(-)\n>>>>\n>>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n>>>> index 800d023c..8a926691 100644\n>>>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>>>> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n>>>>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>>>>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>>>>  \tasyncResults_.redGain = redGain;\n>>>> +\t/* Green gains should not be touched and considered 1. */\n>>>>  \tasyncResults_.greenGain = 1.0;\n>>>>  \tasyncResults_.blueGain = blueGain;\n>>>>  }\n>>>> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n>>>>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n>>>> -\t/*\n>>>> -\t * Green gains should not be touched and considered 1.\n>>>> -\t * Default is 16, so do not change it at all.\n>>>> -\t * 4096 is the value for a gain of 1.0\n>>>> -\t */\n>>>> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n>>>> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n>>>> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n>>>> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n>>>> +\t/* 8192 is the multiplier for a gain of 1.0 */\n>>>\n>>> I'd be a bit more explicit to say at least\n>>>\n>>>   /* Convert to u3.13 Fixed point values with a base of 8192 */\n>>>\n>>> But I'm not sure the '8192' is a base as such, perhaps just:\n>>>\n>>>   /* Convert to u3.13 fixed point values */\n>>>\n>>> Sometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\n>>> class that handles this a bit more elegantly...\n>>>\n>>> But I don't think we want to dwell on that right now.\n>>>\n>>> Whatever works out best in the end (and I think we'll revist this with\n>>> a FixedPoint type sometime)...:\n>>>\n>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>\n>> OK, thx.\n>>\n>>>\n>>>> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n>>>> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n>>>> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n>>>> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n>>>>  \n>>>>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n>>>>  \n>>>> -- \n>>>> 2.30.2\n>>>>\n>>>\n>>> --\n>>> Kieran\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 83AC0BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Sep 2021 16:32:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4CB8469193;\n\tTue, 28 Sep 2021 18:32:45 +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 429D869188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Sep 2021 18:32:44 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:49db:1c4b:4bb:6f1f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EF3D53F1;\n\tTue, 28 Sep 2021 18:32:43 +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=\"AAwzuoLR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632846764;\n\tbh=1QQkqfFz/y2CROtnRKa81nTg/hjOXvsOP37pLVU3B8M=;\n\th=Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=AAwzuoLRQ3VTODlD+G91CAQlQMEt6e67jpNgmVEophvxuq3dkAFrnl+LjYFr1aP/k\n\txPUqA5ickTa1uhgNZ5L7pLsUkcUm59ETJfuV8nGUjo5wda+vUay6D3viBzo6NxgJAW\n\t+rv+DHp/XNYvZvCJYvLwQykqk15PCnH91b1ueUL0=","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>\n\t<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>\n\t<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>\n\t<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<fc1d1bce-4f66-7dad-05c9-461f778412e5@ideasonboard.com>","Date":"Tue, 28 Sep 2021 18:32:41 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}},{"id":19941,"web_url":"https://patchwork.libcamera.org/comment/19941/","msgid":"<7db6090c-b0c4-13ac-47f8-872386045de1@ideasonboard.com>","date":"2021-09-28T16:36:24","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 28/09/2021 17:32, Jean-Michel Hautbois wrote:\n> On 28/09/2021 18:31, Kieran Bingham wrote:\n>> On 28/09/2021 16:59, Jean-Michel Hautbois wrote:\n>>> On 28/09/2021 17:53, Kieran Bingham wrote:\n>>>> On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n>>>>> The gains have a precision u3.13, range [0, 8) which means that a gain\n>>>>\n>>>> s/)/]/ or s/[/(/\n>>>\n>>> Mmmh, I must disagree here, it is going from 0 to 7,99987793 and not 8\n>>> (all ones). So the interval is opened for 8.\n>>\n>> It looks like a typo ... Is that a defined way to describe that range\n>> otherwise? It wasn't obvious to me that you were trying to convey that\n>> by the different symbols.\n>>\n>>\n> \n> Sorry about that, it is the mathematical definition, maybe should we\n> write it differently... ?\n\nIf it's a standard mathematical definition to use in that way, that's fine.\n\n\n>>>>> multiplier value of 1.0 is represented as a multiplication by 8192 in\n>>>>> the ImgU. Correct the gains as this was misunderstood in the first\n>>>>> place.\n>>>>>\n>>>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>>>>> ---\n>>>>>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n>>>>>  1 file changed, 6 insertions(+), 9 deletions(-)\n>>>>>\n>>>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n>>>>> index 800d023c..8a926691 100644\n>>>>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>>>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>>>>> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n>>>>>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>>>>>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>>>>>  \tasyncResults_.redGain = redGain;\n>>>>> +\t/* Green gains should not be touched and considered 1. */\n>>>>>  \tasyncResults_.greenGain = 1.0;\n>>>>>  \tasyncResults_.blueGain = blueGain;\n>>>>>  }\n>>>>> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n>>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n>>>>>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n>>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n>>>>> -\t/*\n>>>>> -\t * Green gains should not be touched and considered 1.\n>>>>> -\t * Default is 16, so do not change it at all.\n>>>>> -\t * 4096 is the value for a gain of 1.0\n>>>>> -\t */\n>>>>> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n>>>>> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n>>>>> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n>>>>> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n>>>>> +\t/* 8192 is the multiplier for a gain of 1.0 */\n>>>>\n>>>> I'd be a bit more explicit to say at least\n>>>>\n>>>>   /* Convert to u3.13 Fixed point values with a base of 8192 */\n>>>>\n>>>> But I'm not sure the '8192' is a base as such, perhaps just:\n>>>>\n>>>>   /* Convert to u3.13 fixed point values */\n>>>>\n>>>> Sometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\n>>>> class that handles this a bit more elegantly...\n>>>>\n>>>> But I don't think we want to dwell on that right now.\n>>>>\n>>>> Whatever works out best in the end (and I think we'll revist this with\n>>>> a FixedPoint type sometime)...:\n>>>>\n>>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>\n>>> OK, thx.\n>>>\n>>>>\n>>>>> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n>>>>> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n>>>>> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n>>>>> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n>>>>>  \n>>>>>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\n>>>>>  \n>>>>> -- \n>>>>> 2.30.2\n>>>>>\n>>>>\n>>>> --\n>>>> Kieran\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 29131C3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Sep 2021 16:36:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96B2F69191;\n\tTue, 28 Sep 2021 18:36:28 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E67069188\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Sep 2021 18:36:27 +0200 (CEST)","from [192.168.0.20]\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 9940D3F1;\n\tTue, 28 Sep 2021 18:36:26 +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=\"JRKK8FAg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632846986;\n\tbh=3RYdG9lkHW8gPkGnSGa76I3YupE3Qzx+ryoXVeJvuRI=;\n\th=From:Subject:To:Cc:References:Date:In-Reply-To:From;\n\tb=JRKK8FAgGWIl+WRJCcyEPlQ8e6TKLgNdnrA4UYv53lc5Yo7Y00aFevkbWatNkO+Et\n\tCYIp40Yuf4xhF+YPRvkLuFAQFSdBEWXKIfszoZk3LYrFpxNy4nc7JLjsFCp7G73Mz1\n\topcc5XlFY1vAt7b6zYnq84DUHs0bCwIKCCRs/uKY=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>\n\t<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>\n\t<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>\n\t<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>\n\t<fc1d1bce-4f66-7dad-05c9-461f778412e5@ideasonboard.com>","Message-ID":"<7db6090c-b0c4-13ac-47f8-872386045de1@ideasonboard.com>","Date":"Tue, 28 Sep 2021 17:36:24 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<fc1d1bce-4f66-7dad-05c9-461f778412e5@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}},{"id":19993,"web_url":"https://patchwork.libcamera.org/comment/19993/","msgid":"<YVRckPUNcMNPBWpK@pendragon.ideasonboard.com>","date":"2021-09-29T12:31:12","subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Sep 28, 2021 at 05:36:24PM +0100, Kieran Bingham wrote:\n> On 28/09/2021 17:32, Jean-Michel Hautbois wrote:\n> > On 28/09/2021 18:31, Kieran Bingham wrote:\n> >> On 28/09/2021 16:59, Jean-Michel Hautbois wrote:\n> >>> On 28/09/2021 17:53, Kieran Bingham wrote:\n> >>>> On Thu, Sep 23, 2021 at 10:16:21AM +0200, Jean-Michel Hautbois wrote:\n> >>>>> The gains have a precision u3.13, range [0, 8) which means that a gain\n> >>>>\n> >>>> s/)/]/ or s/[/(/\n> >>>\n> >>> Mmmh, I must disagree here, it is going from 0 to 7,99987793 and not 8\n> >>> (all ones). So the interval is opened for 8.\n> >>\n> >> It looks like a typo ... Is that a defined way to describe that range\n> >> otherwise? It wasn't obvious to me that you were trying to convey that\n> >> by the different symbols.\n> > \n> > Sorry about that, it is the mathematical definition, maybe should we\n> > write it differently... ?\n> \n> If it's a standard mathematical definition to use in that way, that's fine.\n\nAnother option is [0, 8[ which I find more readable (in particular it's\nnot immediately visible that (0, 8) means ]0, 8[ in my opinion), but\nthat may just be me.\n\nhttps://en.wikipedia.org/wiki/Interval_(mathematics)#Including_or_excluding_endpoints\n\n> >>>>> multiplier value of 1.0 is represented as a multiplication by 8192 in\n> >>>>> the ImgU. Correct the gains as this was misunderstood in the first\n> >>>>> place.\n> >>>>>\n> >>>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> >>>>> ---\n> >>>>>  src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++---------\n> >>>>>  1 file changed, 6 insertions(+), 9 deletions(-)\n> >>>>>\n> >>>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> >>>>> index 800d023c..8a926691 100644\n> >>>>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> >>>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> >>>>> @@ -313,6 +313,7 @@ void Awb::awbGreyWorld()\n> >>>>>  \t/* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n> >>>>>  \tasyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n> >>>>>  \tasyncResults_.redGain = redGain;\n> >>>>> +\t/* Green gains should not be touched and considered 1. */\n\n\t/*Hardcode the green gain to 1.0. */\n\n> >>>>>  \tasyncResults_.greenGain = 1.0;\n> >>>>>  \tasyncResults_.blueGain = blueGain;\n> >>>>>  }\n> >>>>> @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)\n> >>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.x_reset;\n> >>>>>  \tparams->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset\n> >>>>>  \t\t\t\t\t\t\t* params->acc_param.bnr.opt_center.y_reset;\n> >>>>> -\t/*\n> >>>>> -\t * Green gains should not be touched and considered 1.\n> >>>>> -\t * Default is 16, so do not change it at all.\n> >>>>> -\t * 4096 is the value for a gain of 1.0\n> >>>>> -\t */\n> >>>>> -\tparams->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green;\n> >>>>> -\tparams->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red;\n> >>>>> -\tparams->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue;\n> >>>>> -\tparams->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green;\n> >>>>> +\t/* 8192 is the multiplier for a gain of 1.0 */\n> >>>>\n> >>>> I'd be a bit more explicit to say at least\n> >>>>\n> >>>>   /* Convert to u3.13 Fixed point values with a base of 8192 */\n> >>>>\n> >>>> But I'm not sure the '8192' is a base as such, perhaps just:\n> >>>>\n> >>>>   /* Convert to u3.13 fixed point values */\n\nLooks good to me.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> >>>> Sometime I'm sure we could use C++ to make a u3_13 type or a FixedPoint\n> >>>> class that handles this a bit more elegantly...\n> >>>>\n> >>>> But I don't think we want to dwell on that right now.\n> >>>>\n> >>>> Whatever works out best in the end (and I think we'll revist this with\n> >>>> a FixedPoint type sometime)...:\n\nSometime indeed :-)\n\n> >>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >>>\n> >>> OK, thx.\n> >>>\n> >>>>> +\tparams->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green;\n> >>>>> +\tparams->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red;\n> >>>>> +\tparams->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue;\n> >>>>> +\tparams->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green;\n> >>>>>  \n> >>>>>  \tLOG(IPU3Awb, Debug) << \"Color temperature estimated: \" << asyncResults_.temperatureK;\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 EEDE8BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Sep 2021 12:31:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B288691AA;\n\tWed, 29 Sep 2021 14:31:16 +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 B594E69185\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Sep 2021 14:31:14 +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 26C933F0;\n\tWed, 29 Sep 2021 14:31:14 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oVb2fohR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632918674;\n\tbh=CLOWJ7dK9EAo7Q1YLjQCGK9ZmFVAsm88xzPd3uEicp8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oVb2fohRE95Wjj9057gM2saZmFdlUX0xhzgRLD+fMHHcS+5tpfF336lzBkKF7pv5z\n\tt8rQyzm6p0m8JzxtBQ6QJpgB/laZWyq4EvMys5Qsrp4qgaEf1Lc+S/N0E98eLAC0pH\n\tOy9YDNzhWgxnwyY/JrxyRV2bRddl/0IbJ0V9c0LQ=","Date":"Wed, 29 Sep 2021 15:31:12 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YVRckPUNcMNPBWpK@pendragon.ideasonboard.com>","References":"<20210923081625.60276-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20210923081625.60276-9-jeanmichel.hautbois@ideasonboard.com>\n\t<20210928155342.w74c4wzxxte6wy3d@ideasonboard.com>\n\t<66791f73-f4e3-bcee-3601-d72240ce6525@ideasonboard.com>\n\t<a975c4ae-4472-2fe1-7b63-a9efb1391be3@ideasonboard.com>\n\t<fc1d1bce-4f66-7dad-05c9-461f778412e5@ideasonboard.com>\n\t<7db6090c-b0c4-13ac-47f8-872386045de1@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<7db6090c-b0c4-13ac-47f8-872386045de1@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 08/12] ipa: ipu3: awb: Correct the\n\tgain multipliers","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>"}}]