From 2172ab2c2a6a396687b09955b2b63cf6c4dae23a Mon Sep 17 00:00:00 2001 From: "Visan, Tiberiu" Date: Wed, 23 Oct 2024 15:37:40 -0400 Subject: [PATCH] amd/vpelib: patch to match shader (#456) \[WHY\] Shader and VPE had different behavior while adjusting the brightness \[HOW\] Apply the same normalization factor \[TESTING\] Tested on real video outputs Co-authored-by: Tiberiu Visan Reviewed-by: Jesse Agate Reviewed-by: Krunoslav Kovac Acked-by: Chenyu Chen Part-of: --- src/amd/vpelib/src/core/color_cs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/vpelib/src/core/color_cs.c b/src/amd/vpelib/src/core/color_cs.c index 76bca02439c..54822c41c49 100644 --- a/src/amd/vpelib/src/core/color_cs.c +++ b/src/amd/vpelib/src/core/color_cs.c @@ -142,7 +142,7 @@ static void color_adjustments_to_fixed_point(const struct vpe_color_adjustments const int hw_contrast_max = 200; const int hw_bright_min = -1000; const int hw_bright_max = 1000; - const int hw_bright_cap = 460; + const int hw_bright_cap = 500; int hw_val = 0; if (icsc) { @@ -163,7 +163,7 @@ static void color_adjustments_to_fixed_point(const struct vpe_color_adjustments hw_val = -hw_bright_cap; } - *grph_bright = vpe_fixpt_from_fraction(hw_val, 1000); + *grph_bright = vpe_fixpt_from_fraction(hw_val, 2550); //shader normalizes this value to the pixel range *grph_cont = vpe_fixpt_from_fraction( get_hw_value_from_sw_value(vpe_adjust->contrast.current, vpe_adjust->contrast.min, @@ -622,6 +622,7 @@ static void calculate_yuv_matrix(struct vpe_color_adjustments *vpe_adjust, for (i = 0; i < 12; i++) { initialMatrix[i] = vpe_convfix31_32(input_cs->regval[i]); // convert from s.2.13 to s.31.32 } + color_adjustments_to_fixed_point( vpe_adjust, ovl, &grph_cont, &grph_sat, &grph_bright, &sin_grph_hue, &cos_grph_hue); grph_bright = vpe_fixpt_sub(grph_bright, lumaOffset);