diff --git a/src/amd/vpelib/src/core/color.c b/src/amd/vpelib/src/core/color.c index ebff9d82d64..a61e218eeda 100644 --- a/src/amd/vpelib/src/core/color.c +++ b/src/amd/vpelib/src/core/color.c @@ -645,6 +645,11 @@ enum vpe_status vpe_color_update_color_space_and_tf( new_matrix_scaling_factor = vpe_fixpt_one; stream_ctx = &vpe_priv->stream_ctx[stream_idx]; stream_ctx->geometric_scaling = geometric_scaling; + // GDS needs to preserve 'is_yuv_input' flag to be used in updating the whitepoint + if (!geometric_update && !geometric_scaling) { // Non GDS cases + stream_ctx->is_yuv_input = + stream_ctx->stream.surface_info.cs.encoding == VPE_PIXEL_ENCODING_YCbCr; + } bool is_3dlut_enable = stream_ctx->stream.tm_params.UID != 0 || stream_ctx->stream.tm_params.enable_3dlut; bool require_update = stream_ctx->UID_3DLUT != param->streams[stream_idx].tm_params.UID; @@ -999,7 +1004,7 @@ enum vpe_status vpe_color_update_whitepoint( for (unsigned int stream_index = 0; stream_index < vpe_priv->num_streams; stream_index++) { input_isHDR = vpe_is_HDR(stream->tf); - isYCbCr = (vpe_cs->encoding == VPE_PIXEL_ENCODING_YCbCr); + isYCbCr = stream->is_yuv_input; isG24 = (vpe_cs->tf == VPE_TF_G24); if (!input_isHDR && output_isHDR) { diff --git a/src/amd/vpelib/src/core/geometric_scaling.c b/src/amd/vpelib/src/core/geometric_scaling.c index 3fde09c651c..d4dfb848cdb 100644 --- a/src/amd/vpelib/src/core/geometric_scaling.c +++ b/src/amd/vpelib/src/core/geometric_scaling.c @@ -80,12 +80,20 @@ enum vpe_status vpe_validate_geometric_scaling_support(const struct vpe_build_pa void vpe_update_geometric_scaling(struct vpe_priv *vpe_priv, const struct vpe_build_param *param, bool *geometric_update, bool *geometric_scaling) { + bool cached_gds = vpe_priv->stream_ctx[0].geometric_scaling; + bool is_gds = (bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling; if (param->num_streams == 1) { - if ((bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling != - vpe_priv->stream_ctx[0].geometric_scaling) { + if (cached_gds != is_gds) { *geometric_update = true; + // Vpe needs to apply the cooresponding whitepoint on the last pass + // based on the input format of the first pass + if (is_gds) { // First pass + vpe_priv->stream_ctx[0].is_yuv_input = + vpe_priv->stream_ctx[0].stream.surface_info.cs.encoding == + VPE_PIXEL_ENCODING_YCbCr; + } } - *geometric_scaling = (bool)vpe_priv->stream_ctx[0].stream.flags.geometric_scaling; + *geometric_scaling = is_gds; } } diff --git a/src/amd/vpelib/src/core/inc/vpe_priv.h b/src/amd/vpelib/src/core/inc/vpe_priv.h index 722bc902cab..39e521a9f15 100644 --- a/src/amd/vpelib/src/core/inc/vpe_priv.h +++ b/src/amd/vpelib/src/core/inc/vpe_priv.h @@ -130,6 +130,7 @@ struct stream_ctx { bool enable_3dlut; uint64_t UID_3DLUT; // UID for current 3D LUT params bool geometric_scaling; + bool is_yuv_input; union { struct {