RE: [PATCH] media: atomisp: Use clamp_t() in ia_css_eed1_8_vmem_encode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christophe JAILLET
> Sent: 27 July 2024 13:52
> 
> Using clamp_t() instead of min_t(max_t()) is easier to read.

It shouldn't need to be clamp_t(), a plain clamp() looks to be ok.
(dew_enhance_seg_x is s32).

	David

> 
> It also reduces the size of the preprocessed files by ~ 193 ko.
> (see [1] for a discussion about it)
> 
> $ ls -l ia_css_eed1_8.host*.i
>  4829993 27 juil. 14:36 ia_css_eed1_8.host.old.i
>  4636649 27 juil. 14:42 ia_css_eed1_8.host.new.i
> 
> [1]: https://lore.kernel.org/all/23bdb6fc8d884ceebeb6e8b8653b8cfe@xxxxxxxxxxxxxxxx/
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> ---
>  .../isp/kernels/eed1_8/ia_css_eed1_8.host.c   | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
> b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
> index e4fc90f88e24..96c13ebc4331 100644
> --- a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
> +++ b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
> @@ -172,25 +172,25 @@ ia_css_eed1_8_vmem_encode(
>  		base = shuffle_block * i;
> 
>  		for (j = 0; j < IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS; j++) {
> -			to->e_dew_enh_x[0][base + j] = min_t(int, max_t(int,
> -							     from->dew_enhance_seg_x[j], 0),
> -							     8191);
> -			to->e_dew_enh_y[0][base + j] = min_t(int, max_t(int,
> -							     from->dew_enhance_seg_y[j], -8192),
> -							     8191);
> +			to->e_dew_enh_x[0][base + j] = clamp_t(int,
> +							       from->dew_enhance_seg_x[j],
> +							       0, 8191);
> +			to->e_dew_enh_y[0][base + j] = clamp_t(int,
> +							       from->dew_enhance_seg_y[j],
> +							       -8192, 8191);
>  		}
> 
>  		for (j = 0; j < (IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS - 1); j++) {
> -			to->e_dew_enh_a[0][base + j] = min_t(int, max_t(int,
> -							     from->dew_enhance_seg_slope[j],
> -							     -8192), 8191);
> +			to->e_dew_enh_a[0][base + j] = clamp_t(int,
> +							       from->dew_enhance_seg_slope[j],
> +							       -8192, 8191);
>  			/* Convert dew_enhance_seg_exp to flag:
>  			 * 0 -> 0
>  			 * 1...13 -> 1
>  			 */
> -			to->e_dew_enh_f[0][base + j] = (min_t(int, max_t(int,
> -							      from->dew_enhance_seg_exp[j],
> -							      0), 13) > 0);
> +			to->e_dew_enh_f[0][base + j] = (clamp_t(int,
> +							        from->dew_enhance_seg_exp[j],
> +							        0, 13) > 0);
>  		}
> 
>  		/* Hard-coded to 0, in order to be able to handle out of
> --
> 2.45.2

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)






[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux