[v3,13/23] libtuning: lsc: rkisp1: Clip lsc values to valid range
diff mbox series

Message ID 20240703141726.252368-14-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add ccm calibration to libtuning
Related show

Commit Message

Stefan Klug July 3, 2024, 2:17 p.m. UTC
Based on the input images, the lsc values could exceed the range allowed
by the rkisp1. As we are now clipping the values, we can simplify the
value mapping.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/tuning/libtuning/modules/lsc/rkisp1.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul Elder July 4, 2024, 9:16 a.m. UTC | #1
On Wed, Jul 03, 2024 at 04:17:02PM +0200, Stefan Klug wrote:
> Based on the input images, the lsc values could exceed the range allowed
> by the rkisp1. As we are now clipping the values, we can simplify the
> value mapping.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/tuning/libtuning/modules/lsc/rkisp1.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/tuning/libtuning/modules/lsc/rkisp1.py b/utils/tuning/libtuning/modules/lsc/rkisp1.py
> index 20406e436a6a..57004104fc7a 100644
> --- a/utils/tuning/libtuning/modules/lsc/rkisp1.py
> +++ b/utils/tuning/libtuning/modules/lsc/rkisp1.py
> @@ -80,7 +80,8 @@ class LSCRkISP1(LSC):
>              tables = []
>              for lis in [list_cr, list_cgr, list_cgb, list_cb]:
>                  table = np.mean(lis[indices], axis=0)
> -                table = output_map_func((1, 3.999), (1024, 4095), table)
> +                table = output_map_func((1, 4), (1024, 4096), table)
> +                table = np.clip(table, 1024, 4095)

Oh that indeed does look nicer.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

>                  table = np.round(table).astype('int32').tolist()
>                  tables.append(table)
>  
> -- 
> 2.43.0
>

Patch
diff mbox series

diff --git a/utils/tuning/libtuning/modules/lsc/rkisp1.py b/utils/tuning/libtuning/modules/lsc/rkisp1.py
index 20406e436a6a..57004104fc7a 100644
--- a/utils/tuning/libtuning/modules/lsc/rkisp1.py
+++ b/utils/tuning/libtuning/modules/lsc/rkisp1.py
@@ -80,7 +80,8 @@  class LSCRkISP1(LSC):
             tables = []
             for lis in [list_cr, list_cgr, list_cgb, list_cb]:
                 table = np.mean(lis[indices], axis=0)
-                table = output_map_func((1, 3.999), (1024, 4095), table)
+                table = output_map_func((1, 4), (1024, 4096), table)
+                table = np.clip(table, 1024, 4095)
                 table = np.round(table).astype('int32').tolist()
                 tables.append(table)