[{"id":22203,"web_url":"https://patchwork.libcamera.org/comment/22203/","msgid":"<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>","date":"2022-02-28T17:02:43","subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi JM\n\nOn 2/24/22 20:41, Jean-Michel Hautbois wrote:\n> The gain values are coded as u3.13 fixed point values, ie they can not\n> be more than 8. Clampt the values in order to avoid any off limits value\n\n\ns/Clampt/Clamp\n\n> which could make the IPU3 behave weirdly.\n>\n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>   src/ipa/ipu3/algorithms/awb.cpp | 8 ++++++++\n>   1 file changed, 8 insertions(+)\n>\n> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> index 1dc27fc9..dc25be81 100644\n> --- a/src/ipa/ipu3/algorithms/awb.cpp\n> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> @@ -353,6 +353,14 @@ void Awb::awbGreyWorld()\n>   \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> +\n> +\t/*\n> +\t * Gain values are unsigned integer value, range 0 to 8 with 13 bit\n\n\nI am not able to decipher \"integer value\" with \"fractional part\". The \nredGain and blueGain are floating valuesright..?\n\n> +\t * fractional part.\n> +\t */\n> +\tredGain = std::clamp(redGain, 0.0, 65535.0 / 8192);\n> +\tblueGain = std::clamp(blueGain, 0.0, 65535.0 / 8192);\n> +\n>   \tasyncResults_.redGain = redGain;\n>   \t/* Hardcode the green gain to 1.0. */\n>   \tasyncResults_.greenGain = 1.0;","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 8D045BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Feb 2022 17:02:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F1CED61166;\n\tMon, 28 Feb 2022 18:02:50 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6611261101\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Feb 2022 18:02:49 +0100 (CET)","from [192.168.1.106] (unknown [103.251.226.77])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C4BE478;\n\tMon, 28 Feb 2022 18:02:47 +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=\"pMB3/5nC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1646067769;\n\tbh=CHA+xK8LtFq5SapFMJehrqXaUaLPZez3R4uxZbT5Bno=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=pMB3/5nC90d00DJ4I/94RsdvTudPGTfNFZgQ6X3rePmWuNzdx71lg6gm+iRPR0Bx1\n\t/KGx98fZlhhzHT6AVLHOrPNy4gu9ggeHgzn5aSl3Kip3dgfv8gWbQhqUatpuQLBYZI\n\tfdiVJZJFUxCBczjpRfzgoxECV/6V70mW6YsNIOlg=","Message-ID":"<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>","Date":"Mon, 28 Feb 2022 22:32:43 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220224151113.109858-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20220224151113.109858-5-jeanmichel.hautbois@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20220224151113.109858-5-jeanmichel.hautbois@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","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":22211,"web_url":"https://patchwork.libcamera.org/comment/22211/","msgid":"<164622462737.3022961.7917557049405717349@Monstersaurus>","date":"2022-03-02T12:37:07","subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Umang Jain (2022-02-28 17:02:43)\n> Hi JM\n> \n> On 2/24/22 20:41, Jean-Michel Hautbois wrote:\n> > The gain values are coded as u3.13 fixed point values, ie they can not\n> > be more than 8. Clampt the values in order to avoid any off limits value\n> \n> \n> s/Clampt/Clamp\n> \n> > which could make the IPU3 behave weirdly.\n> >\n> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > ---\n> >   src/ipa/ipu3/algorithms/awb.cpp | 8 ++++++++\n> >   1 file changed, 8 insertions(+)\n> >\n> > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> > index 1dc27fc9..dc25be81 100644\n> > --- a/src/ipa/ipu3/algorithms/awb.cpp\n> > +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> > @@ -353,6 +353,14 @@ void Awb::awbGreyWorld()\n> >   \n> >       /* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n> >       asyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n> > +\n> > +     /*\n> > +      * Gain values are unsigned integer value, range 0 to 8 with 13 bit\n\nTechincally, we can't store '8' in this representation though can we.\nIt looks like the max is something like 7.99987792969 ... so maybe this\nshould be range 0 to < 8 ?\n\nUnless there's a better notation to say up to but not including 8?\n \n> I am not able to decipher \"integer value\" with \"fractional part\". The \n> redGain and blueGain are floating valuesright..?\n\nPerhaps stating that they are stored as unsigned integer 3.13 fixed\npoint might be more clear.\n\nI would love to see a proper fixed-point class representing that, but\nthat could be a big task, so I think this is fine until we get something\nlike that.\n\nWith Clampt/Clamp, and this updated if needed/desired.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > +      * fractional part.\n> > +      */\n> > +     redGain = std::clamp(redGain, 0.0, 65535.0 / 8192);\n> > +     blueGain = std::clamp(blueGain, 0.0, 65535.0 / 8192);\n> > +\n> >       asyncResults_.redGain = redGain;\n> >       /* Hardcode the green gain to 1.0. */\n> >       asyncResults_.greenGain = 1.0;","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 209DFBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Mar 2022 12:37:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 432DE61101;\n\tWed,  2 Mar 2022 13:37:11 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C2BF4601F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Mar 2022 13:37: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 400E99FF;\n\tWed,  2 Mar 2022 13:37:09 +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=\"d7DojFel\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1646224629;\n\tbh=8x7NirLxVV/LIZ/YwkyyN6G9IfdSjngG2k5oN/wsD2w=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=d7DojFel4DJg/UCK34FhKbShUdeHILK7YGXfZh+Kl+NFVLn7/8QMBnnHbw8j1pwXh\n\tyAb4QICCK0VmYxZwECioGlqaCAAz5MHNdfkYKrkPDLoq5grrbT4ZOceuzOCdYr8Wlb\n\tJUxQhtV3bddhZivEqedBlsbz4k2dAlbiTZy3qiHc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>","References":"<20220224151113.109858-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20220224151113.109858-5-jeanmichel.hautbois@ideasonboard.com>\n\t<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 02 Mar 2022 12:37:07 +0000","Message-ID":"<164622462737.3022961.7917557049405717349@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","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":22212,"web_url":"https://patchwork.libcamera.org/comment/22212/","msgid":"<Yh9mZz/VlVXsMPME@pendragon.ideasonboard.com>","date":"2022-03-02T12:43:19","subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Mar 02, 2022 at 12:37:07PM +0000, Kieran Bingham wrote:\n> Quoting Umang Jain (2022-02-28 17:02:43)\n> > Hi JM\n> > \n> > On 2/24/22 20:41, Jean-Michel Hautbois wrote:\n> > > The gain values are coded as u3.13 fixed point values, ie they can not\n> > > be more than 8. Clampt the values in order to avoid any off limits value\n> > \n> > \n> > s/Clampt/Clamp\n> > \n> > > which could make the IPU3 behave weirdly.\n> > >\n> > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > > ---\n> > >   src/ipa/ipu3/algorithms/awb.cpp | 8 ++++++++\n> > >   1 file changed, 8 insertions(+)\n> > >\n> > > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n> > > index 1dc27fc9..dc25be81 100644\n> > > --- a/src/ipa/ipu3/algorithms/awb.cpp\n> > > +++ b/src/ipa/ipu3/algorithms/awb.cpp\n> > > @@ -353,6 +353,14 @@ void Awb::awbGreyWorld()\n> > >   \n> > >       /* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n> > >       asyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n> > > +\n> > > +     /*\n> > > +      * Gain values are unsigned integer value, range 0 to 8 with 13 bit\n> \n> Techincally, we can't store '8' in this representation though can we.\n> It looks like the max is something like 7.99987792969 ... so maybe this\n> should be range 0 to < 8 ?\n> \n> Unless there's a better notation to say up to but not including 8?\n\n[0, 8[ and [0, 8) are commonly used for this purpose.\n\n> > I am not able to decipher \"integer value\" with \"fractional part\". The \n> > redGain and blueGain are floating valuesright..?\n> \n> Perhaps stating that they are stored as unsigned integer 3.13 fixed\n> point might be more clear.\n> \n> I would love to see a proper fixed-point class representing that, but\n> that could be a big task, so I think this is fine until we get something\n> like that.\n> \n> With Clampt/Clamp, and this updated if needed/desired.\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > \n> > > +      * fractional part.\n> > > +      */\n> > > +     redGain = std::clamp(redGain, 0.0, 65535.0 / 8192);\n> > > +     blueGain = std::clamp(blueGain, 0.0, 65535.0 / 8192);\n> > > +\n> > >       asyncResults_.redGain = redGain;\n> > >       /* Hardcode the green gain to 1.0. */\n> > >       asyncResults_.greenGain = 1.0;","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 D4AC5BE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Mar 2022 12:43:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E21B61101;\n\tWed,  2 Mar 2022 13:43:32 +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 88730601F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Mar 2022 13:43:31 +0100 (CET)","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 E53569FF;\n\tWed,  2 Mar 2022 13:43:30 +0100 (CET)"],"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=\"N1nEIvMh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1646225011;\n\tbh=8SjFg2/YoucEx7xQmY4JRwmVofRV/xbiVUVvWJdKUik=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=N1nEIvMhHlbg6wQ137/M66AuoZsF1nCkqoVwMC4tqUYeLHAwd0beXy3JFx22eo/b8\n\tp4jhEzRAyYAiw4Q3SQcU8rVIAaHxdWZNc/k1R5eeLIwmcivzwMBiO29RQl1aZL7l+Z\n\t4NWcmNdp66ap0gph+SZnzbkCKwXpxZuZscApDLI4=","Date":"Wed, 2 Mar 2022 14:43:19 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<Yh9mZz/VlVXsMPME@pendragon.ideasonboard.com>","References":"<20220224151113.109858-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20220224151113.109858-5-jeanmichel.hautbois@ideasonboard.com>\n\t<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>\n\t<164622462737.3022961.7917557049405717349@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<164622462737.3022961.7917557049405717349@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","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":22213,"web_url":"https://patchwork.libcamera.org/comment/22213/","msgid":"<1e769d7d-c003-1bce-a900-3a51a71f46a9@ideasonboard.com>","date":"2022-03-02T13:40:43","subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Umang, Kieran and Laurent,\n\nOn 02/03/2022 13:43, Laurent Pinchart wrote:\n> On Wed, Mar 02, 2022 at 12:37:07PM +0000, Kieran Bingham wrote:\n>> Quoting Umang Jain (2022-02-28 17:02:43)\n>>> Hi JM\n>>>\n>>> On 2/24/22 20:41, Jean-Michel Hautbois wrote:\n>>>> The gain values are coded as u3.13 fixed point values, ie they can not\n>>>> be more than 8. Clampt the values in order to avoid any off limits value\n>>>\n>>>\n>>> s/Clampt/Clamp\n>>>\n>>>> which could make the IPU3 behave weirdly.\n>>>>\n>>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>>>> ---\n>>>>    src/ipa/ipu3/algorithms/awb.cpp | 8 ++++++++\n>>>>    1 file changed, 8 insertions(+)\n>>>>\n>>>> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\n>>>> index 1dc27fc9..dc25be81 100644\n>>>> --- a/src/ipa/ipu3/algorithms/awb.cpp\n>>>> +++ b/src/ipa/ipu3/algorithms/awb.cpp\n>>>> @@ -353,6 +353,14 @@ void Awb::awbGreyWorld()\n>>>>    \n>>>>        /* Color temperature is not relevant in Grey world but still useful to estimate it :-) */\n>>>>        asyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B);\n>>>> +\n>>>> +     /*\n>>>> +      * Gain values are unsigned integer value, range 0 to 8 with 13 bit\n>>\n>> Techincally, we can't store '8' in this representation though can we.\n>> It looks like the max is something like 7.99987792969 ... so maybe this\n>> should be range 0 to < 8 ?\n>>\n>> Unless there's a better notation to say up to but not including 8?\n> \n> [0, 8[ and [0, 8) are commonly used for this purpose.\n> \n\nIndeed, sorry for this, I will correct it.\n\n>>> I am not able to decipher \"integer value\" with \"fractional part\". The\n>>> redGain and blueGain are floating valuesright..?\n>>\n>> Perhaps stating that they are stored as unsigned integer 3.13 fixed\n>> point might be more clear.\n>>\n>> I would love to see a proper fixed-point class representing that, but\n>> that could be a big task, so I think this is fine until we get something\n>> like that.\n>>\n>> With Clampt/Clamp, and this updated if needed/desired.\n>>\n>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>\n>>>\n>>>> +      * fractional part.\n>>>> +      */\n>>>> +     redGain = std::clamp(redGain, 0.0, 65535.0 / 8192);\n>>>> +     blueGain = std::clamp(blueGain, 0.0, 65535.0 / 8192);\n>>>> +\n>>>>        asyncResults_.redGain = redGain;\n>>>>        /* Hardcode the green gain to 1.0. */\n>>>>        asyncResults_.greenGain = 1.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 797BCBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Mar 2022 13:40:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D362F61101;\n\tWed,  2 Mar 2022 14:40:47 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 49318601F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Mar 2022 14:40:46 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:c541:2d5:27ad:febb] (unknown\n\t[IPv6:2a01:e0a:169:7140:c541:2d5:27ad:febb])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B309C9FF;\n\tWed,  2 Mar 2022 14:40:45 +0100 (CET)"],"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=\"VXdWUKHw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1646228445;\n\tbh=wgsjQZmYKY0jH1En61VwoAmwc6ffqHaMQNrqh7G+Z2M=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=VXdWUKHw+pRx+GFOoC12vrpEdBPgkxcOoEmON8jjmS4RF2DJpMlioBTEU5m16hLza\n\tyb6lMnZ0OdyKOO6iy8kkXjre4kOZAmLNVYS0c48heSYBHiUwFnJvgC4zeMgYno/Xv1\n\t4pXEf57cYCMJ+Pv74KBFJczznzFcL/Wzbm/ipMEo=","Message-ID":"<1e769d7d-c003-1bce-a900-3a51a71f46a9@ideasonboard.com>","Date":"Wed, 2 Mar 2022 14:40:43 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20220224151113.109858-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20220224151113.109858-5-jeanmichel.hautbois@ideasonboard.com>\n\t<68fed61f-5108-8aa1-8df3-c4900c26cadd@ideasonboard.com>\n\t<164622462737.3022961.7917557049405717349@Monstersaurus>\n\t<Yh9mZz/VlVXsMPME@pendragon.ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<Yh9mZz/VlVXsMPME@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 4/4] ipa: ipu3: awb: Clamp gain\n\tvalues","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>"}}]