Commit 1c032e94 authored by Michael Niedermayer's avatar Michael Niedermayer

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

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 776155ca
...@@ -736,9 +736,11 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block, ...@@ -736,9 +736,11 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block,
#undef REFINE_BIT #undef REFINE_BIT
#undef ZERO_RUN #undef ZERO_RUN
static void handle_rstn(MJpegDecodeContext *s, int nb_components) static int handle_rstn(MJpegDecodeContext *s, int nb_components)
{ {
int i; int i;
int reset = 0;
if (s->restart_interval) { if (s->restart_interval) {
s->restart_count--; s->restart_count--;
if(s->restart_count == 0 && s->avctx->codec_id == AV_CODEC_ID_THP){ 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,11 +761,13 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
if (get_bits_left(&s->gb) >= 8 && (get_bits(&s->gb, 8) & 0xF8) == 0xD0) { if (get_bits_left(&s->gb) >= 8 && (get_bits(&s->gb, 8) & 0xF8) == 0xD0) {
for (i = 0; i < nb_components; i++) /* reset dc */ for (i = 0; i < nb_components; i++) /* reset dc */
s->last_dc[i] = 1024; s->last_dc[i] = 1024;
reset = 1;
} else } else
skip_bits_long(&s->gb, pos - get_bits_count(&s->gb)); skip_bits_long(&s->gb, pos - get_bits_count(&s->gb));
} }
} }
} }
return reset;
} }
static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int predictor, int point_transform) static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int predictor, int point_transform)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment