mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
mjpegdec: support AVRn interlaced
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
5b170c0bea
commit
ac33016158
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user