summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-13 11:13:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-13 11:24:46 +0200
commit038eb59b3a20fa36390e7dbdc9290f348e177ad2 (patch)
treef33627604efe6c03d770e9bf0daace8b27ee284c /libavcodec/mpeg12.c
parent6b0a0dc555e77b376c4a543d73ec295f2c651210 (diff)
mpeg2dec: support slice_vertical_position_extension
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index c7118a592c..718d52ae5e 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1684,6 +1684,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
assert(mb_y < s->mb_height);
init_get_bits(&s->gb, *buf, buf_size * 8);
+ if(s->codec_id != CODEC_ID_MPEG1VIDEO && s->mb_height > 2800/16)
+ skip_bits(&s->gb, 3);
ff_mpeg1_clean_buffers(s);
s->interlaced_dct = 0;
@@ -1923,7 +1925,10 @@ static int slice_decode_thread(AVCodecContext *c, void *arg)
start_code = -1;
buf = avpriv_mpv_find_start_code(buf, s->gb.buffer_end, &start_code);
- mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
+ mb_y= start_code - SLICE_MIN_START_CODE;
+ if(s->codec_id != CODEC_ID_MPEG1VIDEO && s->mb_height > 2800/16)
+ mb_y += (*buf&0xE0)<<2;
+ mb_y <<= field_pic;
if (s->picture_structure == PICT_BOTTOM_FIELD)
mb_y++;
if (mb_y < 0 || mb_y >= s->end_mb_y)
@@ -2443,9 +2448,12 @@ static int decode_chunks(AVCodecContext *avctx,
if (start_code >= SLICE_MIN_START_CODE &&
start_code <= SLICE_MAX_START_CODE && last_code != 0) {
const int field_pic = s2->picture_structure != PICT_FRAME;
- int mb_y = (start_code - SLICE_MIN_START_CODE) << field_pic;
+ int mb_y = start_code - SLICE_MIN_START_CODE;
last_code = SLICE_MIN_START_CODE;
+ if(s2->codec_id != CODEC_ID_MPEG1VIDEO && s2->mb_height > 2800/16)
+ mb_y += (*buf_ptr&0xE0)<<2;
+ mb_y <<= field_pic;
if (s2->picture_structure == PICT_BOTTOM_FIELD)
mb_y++;