[FFmpeg-cvslog] mjpegdec: support AVRn interlaced
Michael Niedermayer
git at videolan.org
Thu Aug 23 14:41:48 CEST 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Aug 10 15:47:07 2012 +0200| [ac330161584b69c766d955d6ee3ee045cca31030] | committer: Luca Barbato
mjpegdec: support AVRn interlaced
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac330161584b69c766d955d6ee3ee045cca31030
---
libavcodec/mjpegdec.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 81aa36a..f79eabe 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -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:
More information about the ffmpeg-cvslog
mailing list