Commit d9d0c1cc authored by Michael Niedermayer's avatar Michael Niedermayer

mjpegdec: support AVRn interlaced

Fixes Ticket1527
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 633b90ca
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment