diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index a6b6be0470..c7b9ac8726 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -64,7 +64,6 @@ typedef struct GifState { int stored_bg_color; GetByteContext gb; - /* LZW compatible decoder */ LZWState *lzw; /* aux buffers */ @@ -140,11 +139,11 @@ static int gif_read_image(GifState *s, AVFrame *frame) if (bytestream2_get_bytes_left(&s->gb) < 9) return AVERROR_INVALIDDATA; - left = bytestream2_get_le16u(&s->gb); - top = bytestream2_get_le16u(&s->gb); - width = bytestream2_get_le16u(&s->gb); + left = bytestream2_get_le16u(&s->gb); + top = bytestream2_get_le16u(&s->gb); + width = bytestream2_get_le16u(&s->gb); height = bytestream2_get_le16u(&s->gb); - flags = bytestream2_get_byteu(&s->gb); + flags = bytestream2_get_byteu(&s->gb); is_interleaved = flags & 0x40; has_local_palette = flags & 0x80; bits_per_pixel = (flags & 0x07) + 1; @@ -302,7 +301,7 @@ static int gif_read_extension(GifState *s) return AVERROR_INVALIDDATA; ext_code = bytestream2_get_byteu(&s->gb); - ext_len = bytestream2_get_byteu(&s->gb); + ext_len = bytestream2_get_byteu(&s->gb); av_dlog(s->avctx, "ext_code=0x%x len=%d\n", ext_code, ext_len); @@ -316,7 +315,7 @@ static int gif_read_extension(GifState *s) if (bytestream2_get_bytes_left(&s->gb) < 5) return AVERROR_INVALIDDATA; - gce_flags = bytestream2_get_byteu(&s->gb); + gce_flags = bytestream2_get_byteu(&s->gb); bytestream2_skipu(&s->gb, 2); // delay during which the frame is shown gce_transparent_index = bytestream2_get_byteu(&s->gb); if (gce_flags & 0x01) @@ -370,7 +369,7 @@ static int gif_read_header1(GifState *s) /* read screen header */ s->transparent_color_index = -1; - s->screen_width = bytestream2_get_le16u(&s->gb); + s->screen_width = bytestream2_get_le16u(&s->gb); s->screen_height = bytestream2_get_le16u(&s->gb); v = bytestream2_get_byteu(&s->gb); @@ -404,7 +403,7 @@ static int gif_read_header1(GifState *s) static int gif_parse_next_image(GifState *s, AVFrame *frame) { - while (bytestream2_get_bytes_left(&s->gb)) { + while (bytestream2_get_bytes_left(&s->gb) > 0) { int code = bytestream2_get_byte(&s->gb); int ret; @@ -502,7 +501,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A return ret; *got_frame = 1; - return avpkt->size; + return bytestream2_tell(&s->gb); } static av_cold int gif_decode_close(AVCodecContext *avctx)