amd/vpelib: Remove linear_0_125 TF

- Remove TRANSFER_FUNC_LINEAR_0_125 transfer function
- Rename TRANSFER_FUNC_LINEAR_0_1 to TRANSFER_FUNC_LINEAR

Reviewed-by: Roy Chan <Roy.Chan@amd.com>
Acked-by: Jack Chih <chiachih@amd.com>
Signed-off-by: Navid Assadian <navid.assadian@amd.com>
---

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28972>
This commit is contained in:
chiachih 2024-04-27 10:03:27 +08:00 committed by Marge Bot
parent 39b08da80a
commit 7a41fb59d3
6 changed files with 16 additions and 45 deletions

View file

@ -251,8 +251,7 @@ bool vpe10_cm_helper_translate_curve_to_hw_format(
seg_distr[i] = 1;
region_start = -MAX_LOW_POINT;
region_end = 1;
} else if (output_tf->tf == TRANSFER_FUNC_LINEAR_0_125 ||
output_tf->tf == TRANSFER_FUNC_LINEAR_0_1) {
} else if (output_tf->tf == TRANSFER_FUNC_LINEAR) {
int num_regions_linear = MAX_LOW_POINT + 3;
@ -536,7 +535,6 @@ void vpe10_cm_get_tf_pwl_params(
table_index = 2;
break;
case TRANSFER_FUNC_BT709:
case TRANSFER_FUNC_LINEAR_0_125:
table_index = 3;
break;
default:

View file

@ -332,8 +332,7 @@ void vpe10_dpp_cnv_program_pre_dgam(struct dpp *dpp, enum color_transfer_func tr
PROGRAM_ENTRY();
switch (tr) {
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR:
pre_degam_en = 0; // bypass
break;
case TRANSFER_FUNC_SRGB:

View file

@ -172,8 +172,7 @@ static bool color_update_regamma_tf(struct vpe_priv *vpe_priv,
case TRANSFER_FUNC_BT709:
case TRANSFER_FUNC_BT1886:
case TRANSFER_FUNC_PQ2084:
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR:
output_tf->tf = output_transfer_function;
break;
default:
@ -225,8 +224,7 @@ static bool color_update_degamma_tf(struct vpe_priv *vpe_priv,
case TRANSFER_FUNC_BT1886:
case TRANSFER_FUNC_PQ2084:
case TRANSFER_FUNC_NORMALIZED_PQ:
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR:
input_tf->tf = color_input_tf;
break;
default:
@ -421,7 +419,7 @@ static enum vpe_status vpe_update_blnd_gamma(
bool can_bypass = false;
bool lut3d_enabled = false;
enum color_space cs = COLOR_SPACE_2020_RGB_FULLRANGE;
enum color_transfer_func tf = TRANSFER_FUNC_LINEAR_0_1;
enum color_transfer_func tf = TRANSFER_FUNC_LINEAR;
enum vpe_status status = VPE_STATUS_OK;
is_studio = (param->dst_surface.cs.range == VPE_COLOR_RANGE_STUDIO);
@ -445,7 +443,7 @@ static enum vpe_status vpe_update_blnd_gamma(
//If studio out -> No choice but to blend in NL
if (!vpe_is_HDR(output_ctx->tf) || is_studio) {
if (lut3d_enabled) {
tf = TRANSFER_FUNC_LINEAR_0_1;
tf = TRANSFER_FUNC_LINEAR;
}
else {
tf = output_ctx->tf;
@ -784,7 +782,7 @@ enum vpe_status vpe_color_update_shaper(
shaper_in.use_const_hdr_mult = false; // can't be true. Fix is required.
shaper_func->type = TF_TYPE_HWPWL;
shaper_func->tf = TRANSFER_FUNC_LINEAR_0_1;
shaper_func->tf = TRANSFER_FUNC_LINEAR;
return vpe_build_shaper(&shaper_in, &shaper_func->pwl);
}
@ -895,7 +893,7 @@ void vpe_color_get_color_space_and_tf(
*tf = TRANSFER_FUNC_NORMALIZED_PQ;
break;
case VPE_TF_G10:
*tf = TRANSFER_FUNC_LINEAR_0_1;
*tf = TRANSFER_FUNC_LINEAR;
break;
case VPE_TF_SRGB:
*tf = TRANSFER_FUNC_SRGB;
@ -1003,8 +1001,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 ||
tf == TRANSFER_FUNC_HLG || tf == TRANSFER_FUNC_LINEAR_0_1);
return (tf == TRANSFER_FUNC_PQ2084 || tf == TRANSFER_FUNC_HLG || tf == TRANSFER_FUNC_LINEAR);
}
/*

View file

@ -446,8 +446,7 @@ static void vpe_bg_degam(
compute_degam(output_tf->tf, (double)bg_color->rgba.g, &degam_g, true);
compute_degam(output_tf->tf, (double)bg_color->rgba.b, &degam_b, true);
break;
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR:
break;
default:
VPE_ASSERT(0);
@ -471,8 +470,7 @@ static void vpe_bg_inverse_gamut_remap(enum color_space output_cs,
bg_rgb[2] = (double)bg_color->rgba.b;
switch (output_tf->tf) {
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR:
/* Since linear output uses Bt709, and this conversion is only needed
* when the tone mapping is enabled on (Bt2020) input, it is needed to
* apply the reverse of Bt2020 -> Bt709 on the background color to

View file

@ -513,7 +513,6 @@ static bool calculate_curve(struct vpe_priv *vpe_priv, enum color_transfer_func
struct calculate_buffer *cal_buffer)
{
int hdr_norm = vpe_priv->resource.internal_hdr_normalization;
int y_norm;
struct fixed31_32 combined_scale;
bool ret = false;
@ -530,14 +529,8 @@ static bool calculate_curve(struct vpe_priv *vpe_priv, enum color_transfer_func
build_pq(MAX_HW_POINTS, coordinates_x, x_scale, y_scale, rgb_regamma);
ret = true;
break;
case TRANSFER_FUNC_LINEAR_0_125:
case TRANSFER_FUNC_LINEAR_0_1:
if (trans == TRANSFER_FUNC_LINEAR_0_1)
y_norm = 1;
else
y_norm = CCCS_NORM;
combined_scale = vpe_fixpt_div_int(vpe_fixpt_from_int(y_norm), hdr_norm);
case TRANSFER_FUNC_LINEAR:
combined_scale = vpe_fixpt_div_int(vpe_fixpt_one, hdr_norm);
combined_scale = vpe_fixpt_mul(combined_scale, y_scale);
combined_scale = vpe_fixpt_mul(combined_scale, x_scale);
for (int i = 0; i < MAX_HW_POINTS; i++) {
@ -567,7 +560,6 @@ bool vpe_color_calculate_degamma_params(struct vpe_priv *vpe_priv, struct fixed3
enum color_transfer_func tf = input_tf->tf;
int hdr_norm = vpe_priv->resource.internal_hdr_normalization;
bool ret = false;
int x_norm;
struct fixed31_32 scale_combined;
struct fixed31_32 output;
@ -586,15 +578,8 @@ bool vpe_color_calculate_degamma_params(struct vpe_priv *vpe_priv, struct fixed3
build_degamma(MAX_HW_POINTS_DEGAMMA, coordinates_x_degamma, tf, x_scale, y_scale, tf_pts);
ret = true;
break;
case TRANSFER_FUNC_LINEAR_0_1:
case TRANSFER_FUNC_LINEAR_0_125:
if (tf == TRANSFER_FUNC_LINEAR_0_1)
x_norm = 1;
else
x_norm = CCCS_NORM;
scale_combined = vpe_fixpt_div_int(vpe_fixpt_from_int(hdr_norm), x_norm);
scale_combined = vpe_fixpt_mul(scale_combined, x_scale);
case TRANSFER_FUNC_LINEAR:
scale_combined = vpe_fixpt_mul(vpe_fixpt_from_int(hdr_norm), x_scale);
scale_combined = vpe_fixpt_mul(scale_combined, y_scale);
for (int i = 0; i < MAX_HW_POINTS_DEGAMMA; i ++) {

View file

@ -57,19 +57,13 @@ enum color_depth {
COLOR_DEPTH_COUNT
};
/*
* Special comment for TRANSFER_FUNC_LINEAR_0_125,
Inside of the pipeline, vpe operates in 0 - 1 nominal range.
For degamma operations, 0_125 refers to input normalization and for regam, 0_125 refers to output normalization.
*/
enum color_transfer_func {
TRANSFER_FUNC_UNKNOWN,
TRANSFER_FUNC_SRGB,
TRANSFER_FUNC_BT709,
TRANSFER_FUNC_BT1886,
TRANSFER_FUNC_PQ2084,
TRANSFER_FUNC_LINEAR_0_1,
TRANSFER_FUNC_LINEAR_0_125,
TRANSFER_FUNC_LINEAR,
TRANSFER_FUNC_NORMALIZED_PQ,
TRANSFER_FUNC_HLG
};