thp: Fix handling of restart interval
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Jan 2012 22:30:01 +0000 (23:30 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Jan 2012 23:53:59 +0000 (00:53 +0100)
Fixes Ticket903

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mjpegdec.c

index 64e5839..d3bcb6f 100644 (file)
@@ -1048,6 +1048,12 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
 
             if (s->restart_interval) {
                 s->restart_count--;
+                if(s->restart_count == 0 && s->avctx->codec_id == CODEC_ID_THP){
+                    align_get_bits(&s->gb);
+                    for (i = 0; i < nb_components; i++) /* reset dc */
+                        s->last_dc[i] = 1024;
+                }
+
                 i = 8 + ((-get_bits_count(&s->gb)) & 7);
                 /* skip RSTn */
                 if (show_bits(&s->gb, i) == (1 << i) - 1) {