Commit ac330161 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Luca Barbato
Browse files

mjpegdec: support AVRn interlaced


Signed-off-by: default avatarLuca Barbato <lu_zero@gentoo.org>
parent 5b170c0b
......@@ -1051,9 +1051,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
prev_shift = get_bits(&s->gb, 4); /* Ah */
point_transform = get_bits(&s->gb, 4); /* Al */
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);
......@@ -1079,6 +1076,10 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
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) {
if (CONFIG_JPEGLS_DECODER && s->ls) {
// for () {
......@@ -1113,6 +1114,22 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
return ret;
}
}
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_dlog(s->avctx, "AVRn interlaced picture marker found\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