[PATCH v2 12/25] libtuning: lsc: rkisp1: Clip lsc values to valid range

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jun 29 01:19:24 CEST 2024


Hi Stefan,

Thank you for the patch.

On Fri, Jun 28, 2024 at 12:47:05PM +0200, Stefan Klug wrote:
> Based on the input images, the lsc values could exceed the range allowed
> by the rkisp1.
> 
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> ---
>  utils/tuning/libtuning/modules/lsc/rkisp1.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/utils/tuning/libtuning/modules/lsc/rkisp1.py b/utils/tuning/libtuning/modules/lsc/rkisp1.py
> index 20406e436a6a..074f3b272dbf 100644
> --- a/utils/tuning/libtuning/modules/lsc/rkisp1.py
> +++ b/utils/tuning/libtuning/modules/lsc/rkisp1.py
> @@ -81,6 +81,7 @@ class LSCRkISP1(LSC):
>              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)

To improve the precision, this could then become

                  table = output_map_func((1, 4), (1024, 4096), table)

> +                table = np.clip(table, 1024, 4095)

That's good enough for now, but clipping could introduce quite bad
effects. Could it be better to instead scale the coefficients ?

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

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

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list