From e81f54e9b2dc3c4a250ff05ee132097db15b2ccb Mon Sep 17 00:00:00 2001 From: zhongcong Date: Wed, 13 Mar 2013 18:43:43 +0800 Subject: [PATCH] mpeg2: fix Quant-Matrix bug --- gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c index de750fa..73f1242 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c @@ -483,6 +483,7 @@ ensure_quant_matrix(GstVaapiDecoderMpeg2 *decoder, GstVaapiPicture *picture) chroma_intra_quant_matrix = priv->quant_matrix_ext.chroma_intra_quantiser_matrix; if (priv->quant_matrix_ext.load_chroma_non_intra_quantiser_matrix) chroma_non_intra_quant_matrix = priv->quant_matrix_ext.chroma_non_intra_quantiser_matrix; + priv->has_quant_matrix_ext = FALSE; } iq_matrix->load_intra_quantiser_matrix = intra_quant_matrix != NULL; @@ -708,12 +709,6 @@ decode_picture(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size) gst_vaapi_picture_replace(&priv->current_picture, picture); gst_vaapi_picture_unref(picture); - status = ensure_quant_matrix(decoder, picture); - if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) { - GST_ERROR("failed to reset quantizer matrix"); - return status; - } - if (!gst_mpeg_video_parse_picture_header(pic_hdr, buf, buf_size, 4)) { GST_ERROR("failed to parse picture header"); return GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER; @@ -1038,6 +1033,12 @@ decode_packet(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size) type - GST_MPEG_VIDEO_PACKET_SLICE_MIN, buf, buf_size ); + if (priv->quant_matrix_changed){ + status = ensure_quant_matrix(decoder, priv->current_picture); + if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) { + GST_ERROR("failed to reset quantizer matrix"); + } + } break; } else if (type >= 0xb9 && type <= 0xff) { -- 1.7.9.5