[FFmpeg-cvslog] jpegdec: actually search for and parse RSTn

Michael Niedermayer git at videolan.org
Sun Dec 25 01:35:56 CET 2011


ffmpeg | branch: release/0.6 | Michael Niedermayer <michaelni at gmx.at> | Thu Jun  9 03:35:50 2011 +0200| [feca20021cc2be02261fcd0077add8d0b6a5fc6b] | committer: Reinhard Tartler

jpegdec: actually search for and parse RSTn

Fixes decoding of MJPEG files produced by some UVC Logitec web cameras,
such as "Notebook Pro" and "HD C910".

References:
http://trac.videolan.org/vlc/ticket/4215
http://ffmpeg.org/trac/ffmpeg/ticket/267

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
Reviewed-by: Kostya <kostya.shishkov at gmail.com>
(cherry picked from commit 8c0fa61a9713a1306fca7997dd04d72ea1f060ea)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=feca20021cc2be02261fcd0077add8d0b6a5fc6b
---

 libavcodec/mjpegdec.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 9f2f88b..edfdd56 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -839,9 +839,12 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
                 }
             }
 
-            if (s->restart_interval && !--s->restart_count) {
+            if (s->restart_interval && show_bits(&s->gb, 8) == 0xFF){ /* skip RSTn */
+                --s->restart_count;
                 align_get_bits(&s->gb);
-                skip_bits(&s->gb, 16); /* skip RSTn */
+                while(show_bits(&s->gb, 8) == 0xFF)
+                    skip_bits(&s->gb, 8);
+                skip_bits(&s->gb, 8);
                 for (i=0; i<nb_components; i++) /* reset dc */
                     s->last_dc[i] = 1024;
             }



More information about the ffmpeg-cvslog mailing list