Browse code

jpegdec: give handle_rstn() a return code that indicates if restart did happen

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/07/10 06:45:31
Showing 1 changed files
... ...
@@ -736,9 +736,11 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
736 736
 #undef REFINE_BIT
737 737
 #undef ZERO_RUN
738 738
 
739
-static void handle_rstn(MJpegDecodeContext *s, int nb_components)
739
+static int handle_rstn(MJpegDecodeContext *s, int nb_components)
740 740
 {
741 741
     int i;
742
+    int reset = 0;
743
+
742 744
     if (s->restart_interval) {
743 745
         s->restart_count--;
744 746
         if(s->restart_count == 0 && s->avctx->codec_id == AV_CODEC_ID_THP){
... ...
@@ -759,11 +761,13 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
759 759
                 if (get_bits_left(&s->gb) >= 8 && (get_bits(&s->gb, 8) & 0xF8) == 0xD0) {
760 760
                     for (i = 0; i < nb_components; i++) /* reset dc */
761 761
                         s->last_dc[i] = 1024;
762
+                    reset = 1;
762 763
                 } else
763 764
                     skip_bits_long(&s->gb, pos - get_bits_count(&s->gb));
764 765
             }
765 766
         }
766 767
     }
768
+    return reset;
767 769
 }
768 770
 
769 771
 static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int predictor, int point_transform)