]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/gif.c
gain code, gain pitch and pitch delay decoding for ACELP based codecs
[ffmpeg] / libavcodec / gif.c
index f67ab52c22611594d275b34e28c84cd773d04a26..35cd0a012e478ba2310e2508aab173d5b770d9d4 100644 (file)
@@ -132,15 +132,11 @@ static void gif_put_bits_rev(PutBitContext *s, int n, unsigned int value)
     } else {
         bit_buf |= value << (bit_cnt);
 
-        *s->buf_ptr = bit_buf & 0xff;
-        s->buf_ptr[1] = (bit_buf >> 8) & 0xff;
-        s->buf_ptr[2] = (bit_buf >> 16) & 0xff;
-        s->buf_ptr[3] = (bit_buf >> 24) & 0xff;
+        bytestream_put_le32(&s->buf_ptr, bit_buf);
 
         //printf("bitbuf = %08x\n", bit_buf);
-        s->buf_ptr+=4;
         if (s->buf_ptr >= s->buf_end)
-            puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
+            abort();
 //            flush_buffer_rev(s);
         bit_cnt=bit_cnt + n - 32;
         if (bit_cnt == 0) {
@@ -195,9 +191,7 @@ static int gif_image_write_header(uint8_t **bytestream,
     } else {
         for(i=0;i<256;i++) {
             v = palette[i];
-            bytestream_put_byte(bytestream, (v >> 16) & 0xff);
-            bytestream_put_byte(bytestream, (v >> 8) & 0xff);
-            bytestream_put_byte(bytestream, (v) & 0xff);
+            bytestream_put_be24(bytestream, v);
         }
     }
 
@@ -314,7 +308,7 @@ typedef struct {
     AVFrame picture;
 } GIFContext;
 
-static int gif_encode_init(AVCodecContext *avctx)
+static av_cold int gif_encode_init(AVCodecContext *avctx)
 {
     GIFContext *s = avctx->priv_data;
 
@@ -346,5 +340,6 @@ AVCodec gif_encoder = {
     gif_encode_init,
     gif_encode_frame,
     NULL, //encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_PAL8, -1},
+    .pix_fmts= (enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
+    .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
 };