From 2a087df8fc709c67d69280206b609f2ec22babbb Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 2 Mar 2021 10:19:22 +0000 Subject: [PATCH] add some printf dbg to linnsgif, trying to find the GIF decode bug --- libvips/foreign/libnsgif/libnsgif.c | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libvips/foreign/libnsgif/libnsgif.c b/libvips/foreign/libnsgif/libnsgif.c index 5550a613..d8d5df19 100644 --- a/libvips/foreign/libnsgif/libnsgif.c +++ b/libvips/foreign/libnsgif/libnsgif.c @@ -571,6 +571,8 @@ static void gif__record_previous_frame(gif_animation *gif) const uint32_t *frame_data; uint32_t *prev_frame; + printf( "gif__record_previous_frame:\n" ); + if (gif->decoded_frame == GIF_INVALID_FRAME || gif->decoded_frame == gif->prev_index) { /* No frame to copy, or already have this frame recorded. */ @@ -613,6 +615,8 @@ static gif_result gif__recover_previous_frame(const gif_animation *gif) unsigned width = gif->width < gif->prev_width ? gif->width : gif->prev_width; uint32_t *frame_data; + printf( "gif__recover_previous_frame:\n" ); + if (prev_frame == NULL) { return GIF_FRAME_DATA_ERROR; } @@ -659,6 +663,31 @@ gif_internal_decode_frame(gif_animation *gif, unsigned int x, y, decode_y, burst_bytes; register unsigned char colour; + printf( "gif_internal_decode_frame: frame = %d, clear_image = %d\n", + frame, clear_image ); + printf( "gif->frames[frame].disposal_method == " ); + switch( gif->frames[frame].disposal_method ) { + case 0: + printf( "NONE\n" ); + break; + + case GIF_FRAME_COMBINE: + printf( "COMBINE\n" ); + break; + + case GIF_FRAME_CLEAR: + printf( "CLEAR\n" ); + break; + + case GIF_FRAME_RESTORE: + printf( "RESTORE\n" ); + break; + + case GIF_FRAME_QUIRKS_RESTORE: + printf( "QUIRKS_RESTORE\n" ); + break; + } + /* Ensure this frame is supposed to be decoded */ if (gif->frames[frame].display == false) { return GIF_OK; @@ -880,6 +909,7 @@ gif_internal_decode_frame(gif_animation *gif, } /* Decompress the data */ + printf( "... decompressing frame data\n" ); for (y = 0; y < height; y++) { if (interlace) { decode_y = gif_interlaced_line(height, y) + offset_y; @@ -924,6 +954,7 @@ gif_internal_decode_frame(gif_animation *gif, } } } else { + printf( "... clearing frame\n" ); /* Clear our frame */ if (gif->frames[frame].disposal_method == GIF_FRAME_CLEAR) { for (y = 0; y < height; y++) {