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

Stefan Klug stefan.klug at ideasonboard.com
Mon Jul 1 17:56:34 CEST 2024


On Sat, Jun 29, 2024 at 02:19:24AM +0300, Laurent Pinchart wrote:
> 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

Right. I fixed it.

> 
>                   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 ?

I guess wee need to wait for these artefacts to occur to be able to
decide for the best solution. (E.g. I expect such things on lenses where
the fov doesn't cover the whole sensor and you see actual black corners)

Regards,
Stefan

> 
> 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