mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
media: atomisp: use clamp() in compute_coring()
When it needs to get a value within a certain interval, using clamp() makes the code easier to understand than min(max()). Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20240830011752.603433-3-lizetao1@huawei.com Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
7adc719353
commit
9a5e69c030
|
|
@ -108,7 +108,7 @@ compute_coring(int coring)
|
|||
* factor. Clip to [0, isp_scale-1).
|
||||
*/
|
||||
isp_coring = ((coring * isp_scale) + offset) / host_scale;
|
||||
return min(max(isp_coring, 0), isp_scale - 1);
|
||||
return clamp(isp_coring, 0, isp_scale - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -168,15 +168,15 @@ ia_css_xnr3_encode(
|
|||
to->alpha.y0 = alpha_y0;
|
||||
to->alpha.u0 = alpha_u0;
|
||||
to->alpha.v0 = alpha_v0;
|
||||
to->alpha.ydiff = min(max(alpha_ydiff, min_diff), max_diff);
|
||||
to->alpha.udiff = min(max(alpha_udiff, min_diff), max_diff);
|
||||
to->alpha.vdiff = min(max(alpha_vdiff, min_diff), max_diff);
|
||||
to->alpha.ydiff = clamp(alpha_ydiff, min_diff, max_diff);
|
||||
to->alpha.udiff = clamp(alpha_udiff, min_diff, max_diff);
|
||||
to->alpha.vdiff = clamp(alpha_vdiff, min_diff, max_diff);
|
||||
|
||||
/* coring parameters are expressed in q1.NN format */
|
||||
to->coring.u0 = coring_u0;
|
||||
to->coring.v0 = coring_v0;
|
||||
to->coring.udiff = min(max(coring_udiff, min_diff), max_diff);
|
||||
to->coring.vdiff = min(max(coring_vdiff, min_diff), max_diff);
|
||||
to->coring.udiff = clamp(coring_udiff, min_diff, max_diff);
|
||||
to->coring.vdiff = clamp(coring_vdiff, min_diff, max_diff);
|
||||
|
||||
/* blending strength is expressed in q1.NN format */
|
||||
to->blending.strength = blending;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user