[v3,05/21] ipa: libipa: awb_bayes: Fix initial max value
diff mbox series

Message ID 20260918120949.191668-6-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: rcar-gen4 + rpp-x1
Related show

Commit Message

Barnabás Pőcze Sept. 18, 2026, 12:09 p.m. UTC
For floating-point types `std::numeric_limits<T>::min()` is the smallest
normal positive value. So `lowest()` needs to be used other e.g. a value
of 0 will not be properly handled.

This type is only used for logging, so no effects on the algorithm.

Fixes: c2059585f3c7 ("libipa: awb_bayes: Add logging of value limits")
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/libipa/awb_bayes.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Sept. 18, 2026, 4:34 p.m. UTC | #1
Quoting Barnabás Pőcze (2026-09-18 13:09:33)
> For floating-point types `std::numeric_limits<T>::min()` is the smallest
> normal positive value. So `lowest()` needs to be used other e.g. a value
> of 0 will not be properly handled.
> 
> This type is only used for logging, so no effects on the algorithm.
> 
> Fixes: c2059585f3c7 ("libipa: awb_bayes: Add logging of value limits")
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/ipa/libipa/awb_bayes.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
> index 10e05962b8..7f3237c0ab 100644
> --- a/src/ipa/libipa/awb_bayes.cpp
> +++ b/src/ipa/libipa/awb_bayes.cpp
> @@ -66,7 +66,7 @@ class LimitsRecorder
>  public:
>         LimitsRecorder()
>                 : min_(std::numeric_limits<T>::max()),
> -                 max_(std::numeric_limits<T>::min())
> +                 max_(std::numeric_limits<T>::lowest())
>         {
>         }
>  
> -- 
> 2.55.0
>
Jacopo Mondi Sept. 23, 2026, 3:09 p.m. UTC | #2
On Fri, Sep 18, 2026 at 02:09:33PM +0200, Barnabás Pőcze wrote:
> For floating-point types `std::numeric_limits<T>::min()` is the smallest
> normal positive value. So `lowest()` needs to be used other e.g. a value
> of 0 will not be properly handled.

I'm not sure I understand the part after "to be used".

Did you mean "otherwise" ?

>
> This type is only used for logging, so no effects on the algorithm.
>
> Fixes: c2059585f3c7 ("libipa: awb_bayes: Add logging of value limits")
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/ipa/libipa/awb_bayes.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
> index 10e05962b8..7f3237c0ab 100644
> --- a/src/ipa/libipa/awb_bayes.cpp
> +++ b/src/ipa/libipa/awb_bayes.cpp
> @@ -66,7 +66,7 @@ class LimitsRecorder
>  public:
>  	LimitsRecorder()
>  		: min_(std::numeric_limits<T>::max()),
> -		  max_(std::numeric_limits<T>::min())
> +		  max_(std::numeric_limits<T>::lowest())
>  	{
>  	}
>
> --
> 2.55.0
>
Barnabás Pőcze Sept. 23, 2026, 3:36 p.m. UTC | #3
2026. 09. 23. 17:09 keltezéssel, Jacopo Mondi írta:
> On Fri, Sep 18, 2026 at 02:09:33PM +0200, Barnabás Pőcze wrote:
>> For floating-point types `std::numeric_limits<T>::min()` is the smallest
>> normal positive value. So `lowest()` needs to be used other e.g. a value
>> of 0 will not be properly handled.
> 
> I'm not sure I understand the part after "to be used".
> 
> Did you mean "otherwise" ?

Yes, indeed!


> 
>>
>> This type is only used for logging, so no effects on the algorithm.
>>
>> Fixes: c2059585f3c7 ("libipa: awb_bayes: Add logging of value limits")
>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> 
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> 
> Thanks
>    j
> 
>> ---
>>   src/ipa/libipa/awb_bayes.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
>> index 10e05962b8..7f3237c0ab 100644
>> --- a/src/ipa/libipa/awb_bayes.cpp
>> +++ b/src/ipa/libipa/awb_bayes.cpp
>> @@ -66,7 +66,7 @@ class LimitsRecorder
>>   public:
>>   	LimitsRecorder()
>>   		: min_(std::numeric_limits<T>::max()),
>> -		  max_(std::numeric_limits<T>::min())
>> +		  max_(std::numeric_limits<T>::lowest())
>>   	{
>>   	}
>>
>> --
>> 2.55.0
>>

Patch
diff mbox series

diff --git a/src/ipa/libipa/awb_bayes.cpp b/src/ipa/libipa/awb_bayes.cpp
index 10e05962b8..7f3237c0ab 100644
--- a/src/ipa/libipa/awb_bayes.cpp
+++ b/src/ipa/libipa/awb_bayes.cpp
@@ -66,7 +66,7 @@  class LimitsRecorder
 public:
 	LimitsRecorder()
 		: min_(std::numeric_limits<T>::max()),
-		  max_(std::numeric_limits<T>::min())
+		  max_(std::numeric_limits<T>::lowest())
 	{
 	}