Skip to content

Commit 81ee62e

Browse files
tititiou36mchehab
authored andcommitted
media: atomisp: Use clamp() in ia_css_eed1_8_vmem_encode()
Using clamp() instead of min_t(max_t()) is easier to read. 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/[email protected]/ Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/155aba6ab759e98f66349e6bb4f69e2410486c09.1722084704.git.christophe.jaillet@wanadoo.fr Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent ffe3dc5 commit 81ee62e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,21 @@ ia_css_eed1_8_vmem_encode(
172172
base = shuffle_block * i;
173173

174174
for (j = 0; j < IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS; j++) {
175-
to->e_dew_enh_x[0][base + j] = min_t(int, max_t(int,
176-
from->dew_enhance_seg_x[j], 0),
177-
8191);
178-
to->e_dew_enh_y[0][base + j] = min_t(int, max_t(int,
179-
from->dew_enhance_seg_y[j], -8192),
180-
8191);
175+
to->e_dew_enh_x[0][base + j] = clamp(from->dew_enhance_seg_x[j],
176+
0, 8191);
177+
to->e_dew_enh_y[0][base + j] = clamp(from->dew_enhance_seg_y[j],
178+
-8192, 8191);
181179
}
182180

183181
for (j = 0; j < (IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS - 1); j++) {
184-
to->e_dew_enh_a[0][base + j] = min_t(int, max_t(int,
185-
from->dew_enhance_seg_slope[j],
186-
-8192), 8191);
182+
to->e_dew_enh_a[0][base + j] = clamp(from->dew_enhance_seg_slope[j],
183+
-8192, 8191);
187184
/* Convert dew_enhance_seg_exp to flag:
188185
* 0 -> 0
189186
* 1...13 -> 1
190187
*/
191-
to->e_dew_enh_f[0][base + j] = (min_t(int, max_t(int,
192-
from->dew_enhance_seg_exp[j],
193-
0), 13) > 0);
188+
to->e_dew_enh_f[0][base + j] = clamp(from->dew_enhance_seg_exp[j],
189+
0, 13) > 0;
194190
}
195191

196192
/* Hard-coded to 0, in order to be able to handle out of

0 commit comments

Comments
 (0)