diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-10 15:47:07 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-10 15:56:14 +0200 |
commit | d9d0c1ccc3df39fecbbbb6b600c18542741c5a51 (patch) | |
tree | 3faf61c65dd4e6e85b6af755a35b483f269ef0f0 /libavcodec/mjpegdec.c | |
parent | 633b90ca8d5fbdac4e54b0d6b054e273b3a5efa5 (diff) | |
download | ffmpeg-d9d0c1ccc3df39fecbbbb6b600c18542741c5a51.tar.gz |
mjpegdec: support AVRn interlaced
Fixes Ticket1527
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r-- | libavcodec/mjpegdec.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 37e5fd6b23..4fb2f3e1e7 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1209,9 +1209,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, }else prev_shift = point_transform = 0; - for (i = 0; i < nb_components; i++) - s->last_dc[i] = 1024; - if (nb_components > 1) { /* interleaved stream */ s->mb_width = (s->width + s->h_max * block_size - 1) / (s->h_max * block_size); @@ -1236,6 +1233,9 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, /* mjpeg-b can have padding bytes between sos and image data, skip them */ for (i = s->mjpb_skiptosod; i > 0; i--) skip_bits(&s->gb, 8); +next_field: + for (i = 0; i < nb_components; i++) + s->last_dc[i] = 1024; if (s->lossless) { av_assert0(s->picture_ptr == &s->picture); @@ -1266,6 +1266,19 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, return -1; } } + if(s->interlaced && get_bits_left(&s->gb) > 32 && show_bits(&s->gb, 8) == 0xFF) { + GetBitContext bak= s->gb; + align_get_bits(&bak); + if(show_bits(&bak, 16) == 0xFFD1) { + av_log(s->avctx, AV_LOG_DEBUG, "AVRn ingterlaced picture\n"); + s->gb = bak; + skip_bits(&s->gb, 16); + s->bottom_field ^= 1; + + goto next_field; + } + } + emms_c(); return 0; out_of_range: |