mpeg2: fix calculation of macroblock_offset.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Apr 2012 16:42:12 +0000 (18:42 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Apr 2012 16:42:12 +0000 (18:42 +0200)
Fix decoding of streams with extra slice() information before the first
macroblock(). e.g. this fixes sony-ct3.bs from conformance test.

NEWS
gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c

diff --git a/NEWS b/NEWS
index 17867ef..05c54ca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,8 @@ Copyright (C) 2011 Collabora
 
 Version 0.3.7 - DD.Apr.2012
 * Fix vaapidecode to report unsupported codec profiles
-* Fix decoding of MPEG-2 High profile streams compatible with Main profile
+* Fix MPEG-2 decoding of streams with extra slice() information
+* Fix MPEG-2 decoding of High profile streams compatible with Main profile
 * Don't forcibly resize user provided X windows (Holger Kaelberer)
 * Recalculate render rect only if caps are negotiated (Holger Kaelberer)
 
index 3333c2e..38ecb33 100644 (file)
@@ -870,7 +870,7 @@ decode_slice(
     guint macroblock_offset;
     guint8 slice_vertical_position_extension;
     guint8 quantiser_scale_code;
-    guint8 intra_slice_flag, intra_slice = 0;
+    guint8 intra_slice = 0;
     guint8 extra_bit_slice, junk8;
 
     GST_DEBUG("slice %d @ %p, %u bytes)", slice_no, buf, buf_size);
@@ -896,11 +896,8 @@ decode_slice(
     READ_UINT8(&br, quantiser_scale_code, 5);
     READ_UINT8(&br, extra_bit_slice, 1);
     if (extra_bit_slice == 1) {
-        READ_UINT8(&br, intra_slice_flag, 1);
-        if (intra_slice_flag) {
-            READ_UINT8(&br, intra_slice, 1);
-            READ_UINT8(&br, junk8, 7);
-        }
+        READ_UINT8(&br, intra_slice, 1);
+        READ_UINT8(&br, junk8, 7);
         READ_UINT8(&br, extra_bit_slice, 1);
         while (extra_bit_slice == 1) {
             READ_UINT8(&br, junk8, 8);