mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
amd/vpelib: VPE integration for HLG
Added external and internal enums for HLG and some related house keeping. Reviewed-by: Roy Chan <Roy.Chan@amd.com> Acked-by: Alan Liu <haoping.liu@amd.com> Signed-off-by: Jesse Agate <Jesse.Agate@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27239>
This commit is contained in:
parent
5fd59c83ef
commit
1dd28d6766
3 changed files with 23 additions and 22 deletions
|
|
@ -881,6 +881,9 @@ void vpe_color_get_color_space_and_tf(
|
|||
case VPE_TF_BT709:
|
||||
*tf = TRANSFER_FUNC_BT709;
|
||||
break;
|
||||
case VPE_TF_HLG:
|
||||
*tf = TRANSFER_FUNC_HLG;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -974,7 +977,7 @@ void vpe_convert_full_range_color_enum(enum color_space *cs)
|
|||
bool vpe_is_HDR(enum color_transfer_func tf)
|
||||
{
|
||||
|
||||
return (tf == TRANSFER_FUNC_PQ2084 || tf == TRANSFER_FUNC_LINEAR_0_125);
|
||||
return (tf == TRANSFER_FUNC_PQ2084 || tf == TRANSFER_FUNC_LINEAR_0_125 || tf == TRANSFER_FUNC_HLG);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ bool vpe_has_per_pixel_alpha(enum vpe_surface_pixel_format format)
|
|||
// another function is needed here.
|
||||
static bool is_HDR(enum vpe_transfer_function tf)
|
||||
{
|
||||
return (tf == VPE_TF_PQ || tf == VPE_TF_G10);
|
||||
return (tf == VPE_TF_PQ || tf == VPE_TF_G10 || tf == VPE_TF_HLG);
|
||||
}
|
||||
|
||||
enum vpe_status vpe_check_output_support(struct vpe *vpe, const struct vpe_build_param *param)
|
||||
|
|
@ -565,27 +565,24 @@ enum vpe_status vpe_check_tone_map_support(
|
|||
struct vpe *vpe, const struct vpe_stream *stream, const struct vpe_build_param *param)
|
||||
{
|
||||
enum vpe_status status = VPE_STATUS_OK;
|
||||
bool input_is_hdr = is_HDR(stream->surface_info.cs.tf);
|
||||
bool is_3D_lut_enabled = stream->tm_params.enable_3dlut;
|
||||
bool is_hlg = stream->tm_params.shaper_tf == VPE_TF_HLG;
|
||||
bool is_in_lum_greater_than_out_lum = stream->hdr_metadata.max_mastering > param->hdr_metadata.max_mastering;
|
||||
|
||||
// If tone map enabled but bad luminance reject.
|
||||
if (stream->tm_params.enable_3dlut &&
|
||||
stream->hdr_metadata.max_mastering <= param->hdr_metadata.max_mastering) {
|
||||
status = VPE_STATUS_BAD_TONE_MAP_PARAMS;
|
||||
goto exit;
|
||||
// Check if Tone Mapping parameters are valid
|
||||
if (is_3D_lut_enabled) {
|
||||
if ((stream->tm_params.lut_data == NULL) ||
|
||||
(!input_is_hdr) ||
|
||||
(!is_hlg && !is_in_lum_greater_than_out_lum)) {
|
||||
status = VPE_STATUS_BAD_TONE_MAP_PARAMS;
|
||||
}
|
||||
} else {
|
||||
if (is_hlg ||
|
||||
(input_is_hdr && is_in_lum_greater_than_out_lum)) {
|
||||
status = VPE_STATUS_BAD_TONE_MAP_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
// If tone map enabled but input is not HDR, reject.
|
||||
if (stream->tm_params.enable_3dlut && !is_HDR(stream->surface_info.cs.tf)) {
|
||||
status = VPE_STATUS_BAD_TONE_MAP_PARAMS;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// If tone map case but enable tm flag is not set or 3dlut pointer is null reject.
|
||||
if (stream->hdr_metadata.max_mastering > param->hdr_metadata.max_mastering &&
|
||||
is_HDR(stream->surface_info.cs.tf) &&
|
||||
(!stream->tm_params.enable_3dlut || stream->tm_params.lut_data == NULL)) {
|
||||
status = VPE_STATUS_BAD_HDR_METADATA;
|
||||
}
|
||||
|
||||
exit:
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ enum color_depth {
|
|||
TRANSFER_FUNC_PQ2084,
|
||||
TRANSFER_FUNC_LINEAR_0_1,
|
||||
TRANSFER_FUNC_LINEAR_0_125,
|
||||
TRANSFER_FUNC_NORMALIZED_PQ
|
||||
TRANSFER_FUNC_NORMALIZED_PQ,
|
||||
TRANSFER_FUNC_HLG
|
||||
};
|
||||
|
||||
enum dither_option {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue