mjpegdec: support AVRn interlaced

Fixes Ticket1527
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/28/head
Michael Niedermayer 13 years ago
parent 633b90ca8d
commit d9d0c1ccc3
  1. 19
      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:

Loading…
Cancel
Save