mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
amd/vpelib: Refactor YUV format check
Using general vpe_is_yuv* helper function for the condition check Reviewed-by: Evan Damphousse <evan.damphousse@amd.com> Reviewed-by: Roy Chan <Roy.Chan@amd.com> Reviewed-by: Navid Assadian <Navid.Assadian@amd.com> Acked-by: Chih-Wei Chien <Chih-Wei.Chien@amd.com> Signed-off-by: Phoebe Chen <phoebe.chen@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32695>
This commit is contained in:
parent
0f3a350087
commit
7d326ab082
3 changed files with 17 additions and 2 deletions
|
|
@ -399,7 +399,7 @@ static bool build_scale_and_bias(struct bias_and_scale *bias_and_scale,
|
|||
scale = vpe_fixpt_from_fraction(1024, 940 - 64);
|
||||
bias = vpe_fixpt_from_fraction(-64, 1024);
|
||||
} // else report error? here just go with default (1.0, 0.0)
|
||||
} else if (vpe_is_yuv420_8(format) || vpe_is_yuv444_8(format)) {
|
||||
} else if (vpe_is_yuv8(format)) {
|
||||
if (vcs->range == VPE_COLOR_RANGE_FULL) {
|
||||
scale = vpe_fixpt_from_fraction(256, 255);
|
||||
} else if (vcs->range == VPE_COLOR_RANGE_STUDIO) {
|
||||
|
|
@ -409,7 +409,7 @@ static bool build_scale_and_bias(struct bias_and_scale *bias_and_scale,
|
|||
bias_c = vpe_fixpt_from_fraction(-16, 256); // See notes in function comment
|
||||
is_chroma_different = true;
|
||||
} // else report error? not sure if default is right
|
||||
} else if (vpe_is_yuv420_10(format) || vpe_is_yuv444_10(format)) {
|
||||
} else if (vpe_is_yuv10(format)) {
|
||||
if (vcs->range == VPE_COLOR_RANGE_FULL) {
|
||||
scale = vpe_fixpt_from_fraction(1024, 1023);
|
||||
} else if (vcs->range == VPE_COLOR_RANGE_STUDIO) {
|
||||
|
|
|
|||
|
|
@ -196,6 +196,18 @@ bool vpe_is_yuv444(enum vpe_surface_pixel_format format)
|
|||
vpe_is_yuv444_10(format));
|
||||
}
|
||||
|
||||
bool vpe_is_yuv8(enum vpe_surface_pixel_format format)
|
||||
{
|
||||
return (vpe_is_yuv420_8(format) ||
|
||||
vpe_is_yuv444_8(format));
|
||||
}
|
||||
|
||||
bool vpe_is_yuv10(enum vpe_surface_pixel_format format)
|
||||
{
|
||||
return (vpe_is_yuv420_10(format) ||
|
||||
vpe_is_yuv444_10(format));
|
||||
}
|
||||
|
||||
bool vpe_is_yuv(enum vpe_surface_pixel_format format)
|
||||
{
|
||||
return (vpe_is_yuv420(format) ||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ bool vpe_is_rgb8(enum vpe_surface_pixel_format format);
|
|||
bool vpe_is_rgb10(enum vpe_surface_pixel_format format);
|
||||
bool vpe_is_fp16(enum vpe_surface_pixel_format format);
|
||||
|
||||
bool vpe_is_yuv8(enum vpe_surface_pixel_format format);
|
||||
bool vpe_is_yuv10(enum vpe_surface_pixel_format format);
|
||||
|
||||
// yuv 4:2:0 check
|
||||
bool vpe_is_yuv420_8(enum vpe_surface_pixel_format format);
|
||||
bool vpe_is_yuv420_10(enum vpe_surface_pixel_format format);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue