---
 libavcodec/gif.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index c7e7bcd..1c32971 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -71,10 +71,10 @@ static int gif_image_write_header(AVCodecContext *avctx,
 
     bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries 
*/
     bytestream_put_byte(bytestream, 0x1f); /* background color index */
-    bytestream_put_byte(bytestream, 0); /* aspect ratio */
+    bytestream_put_byte(bytestream, 0);    /* aspect ratio */
 
     /* the global palette */
-    for(i=0;i<256;i++) {
+    for(i = 0; i < 256; i++) {
         v = palette[i];
         bytestream_put_be24(bytestream, v);
     }
@@ -89,16 +89,16 @@ static int gif_image_write_image(AVCodecContext *avctx,
     GIFContext *s = avctx->priv_data;
     int len = 0, height;
     const uint8_t *ptr;
-    /* image block */
 
+    /* image block */
     bytestream_put_byte(bytestream, 0x2c);
     bytestream_put_le16(bytestream, 0);
     bytestream_put_le16(bytestream, 0);
     bytestream_put_le16(bytestream, avctx->width);
     bytestream_put_le16(bytestream, avctx->height);
     bytestream_put_byte(bytestream, 0x00); /* flags */
+    
     /* no local clut */
-
     bytestream_put_byte(bytestream, 0x08);
 
     ff_lzw_encode_init(s->lzw, s->buf, avctx->width*avctx->height,
@@ -121,6 +121,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
         ptr += size;
         len -= size;
     }
+
     bytestream_put_byte(bytestream, 0x00); /* end of image block */
     bytestream_put_byte(bytestream, 0x3b);
     return 0;
@@ -131,29 +132,33 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
     GIFContext *s = avctx->priv_data;
 
     avctx->coded_frame = &s->picture;
-    s->lzw = av_mallocz(ff_lzw_encode_state_size);
+    s->lzw             = av_mallocz(ff_lzw_encode_state_size);
     if (!s->lzw)
         return AVERROR(ENOMEM);
+
     s->buf = av_malloc(avctx->width*avctx->height*2);
     if (!s->buf)
          return AVERROR(ENOMEM);
+
     return 0;
 }
 
 /* better than nothing gif encoder */
-static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int 
buf_size, void *data)
+static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
+                            int buf_size, void *data)
 {
-    GIFContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame *const p = (AVFrame *)&s->picture;
+    GIFContext *s       = avctx->priv_data;
+    AVFrame *pict       = data;
+    AVFrame *const p    = (AVFrame *)&s->picture;
     uint8_t *outbuf_ptr = outbuf;
-    uint8_t *end = outbuf + buf_size;
+    uint8_t *end        = outbuf + buf_size;
 
     *p = *pict;
     p->pict_type = AV_PICTURE_TYPE_I;
     p->key_frame = 1;
     gif_image_write_header(avctx, &outbuf_ptr, (uint32_t *)pict->data[1]);
-    gif_image_write_image(avctx, &outbuf_ptr, end, pict->data[0], 
pict->linesize[0]);
+    gif_image_write_image (avctx, &outbuf_ptr, end, pict->data[0],
+                           pict->linesize[0]);
     return outbuf_ptr - outbuf;
 }
 
@@ -174,6 +179,6 @@ AVCodec ff_gif_encoder = {
     .init           = gif_encode_init,
     .encode         = gif_encode_frame,
     .close          = gif_encode_close,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB8, PIX_FMT_BGR8, 
PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, 
PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
+    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_RGB8, PIX_FMT_BGR8, 
PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, 
PIX_FMT_NONE},
+    .long_name      = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange 
Format)"),
 };
-- 
1.7.4.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to