From: Gwenole Beauchesne Date: Thu, 23 Feb 2012 15:39:14 +0000 (+0100) Subject: mpeg2: fix slice_vertical_position calculation. X-Git-Tag: 0.3.5~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1883b4a4e9a88d5f55947813dea456f2c66957c;p=platform%2Fupstream%2Fgstreamer-vaapi.git mpeg2: fix slice_vertical_position calculation. Make sure to adjust slice_vertical_position if picture structure is a top or bottom field. --- diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c index 305a2dc..b2579b3 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c @@ -574,12 +574,22 @@ decode_picture_ext(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size) { GstVaapiDecoderMpeg2Private * const priv = decoder->priv; GstMpegVideoPictureExt * const pic_ext = &priv->pic_ext; + GstVaapiPicture * const picture = priv->current_picture; if (!gst_mpeg_video_parse_picture_extension(pic_ext, buf, buf_size, 0)) { GST_DEBUG("failed to parse picture-extension"); return GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER; } priv->has_pic_ext = TRUE; + + switch (pic_ext->picture_structure) { + case GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD: + GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_TOP_FIELD); + break; + case GST_MPEG_VIDEO_PICTURE_STRUCTURE_BOTTOM_FIELD: + GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_BOTTOM_FIELD); + break; + } return GST_VAAPI_DECODER_STATUS_SUCCESS; } @@ -700,7 +710,10 @@ decode_slice( } macroblock_offset = gst_bit_reader_get_pos(&br); - mb_y = slice_no; + mb_y = slice_no << !GST_VAAPI_PICTURE_IS_FRAME(picture); + if (GST_VAAPI_PICTURE_IS_BOTTOM_FIELD(picture)) + mb_y++; + mb_x = -1; do { if (!decode_vlc(&br, &mb_inc, mpeg2_mbaddr_vlc_table,