All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
gif.c File Reference

GIF encoder. More...

#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "lzw.h"
#include "gif.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  GIFContext


#define OFFSET(x)   offsetof(GIFContext, x)


enum  { GF_OFFSETTING = 1<<0, GF_TRANSDIFF = 1<<1 }


static int pick_palette_entry (const uint8_t *buf, int linesize, int w, int h)
static int gif_image_write_image (AVCodecContext *avctx, uint8_t **bytestream, uint8_t *end, const uint32_t *palette, const uint8_t *buf, const int linesize, AVPacket *pkt)
static av_cold int gif_encode_init (AVCodecContext *avctx)
static int get_palette_transparency_index (const uint32_t *palette)
static int gif_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
static int gif_encode_close (AVCodecContext *avctx)


static const AVOption gif_options []
static const AVClass gif_class
AVCodec ff_gif_encoder

Detailed Description

GIF encoder.

See Also

Definition in file gif.c.

Macro Definition Documentation


Definition at line 31 of file gif.c.

#define OFFSET (   x)    offsetof(GIFContext, x)

Definition at line 332 of file gif.c.

Definition at line 333 of file gif.c.

Enumeration Type Documentation

anonymous enum

Definition at line 56 of file gif.c.

Function Documentation

static int pick_palette_entry ( const uint8_t buf,
int  linesize,
int  w,
int  h 

Definition at line 61 of file gif.c.

Referenced by gif_image_write_image().

static int gif_image_write_image ( AVCodecContext avctx,
uint8_t **  bytestream,
uint8_t end,
const uint32_t *  palette,
const uint8_t buf,
const int  linesize,
AVPacket pkt 

Definition at line 77 of file gif.c.

Referenced by gif_encode_frame().

static av_cold int gif_encode_init ( AVCodecContext avctx)

Definition at line 217 of file gif.c.

static int get_palette_transparency_index ( const uint32_t *  palette)

Definition at line 248 of file gif.c.

Referenced by gif_encode_frame().

static int gif_encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pict,
int *  got_packet 

Definition at line 266 of file gif.c.

static int gif_encode_close ( AVCodecContext avctx)

Definition at line 320 of file gif.c.

Variable Documentation

const AVOption gif_options[]
Initial value:
= {
{ "gifflags", "set GIF flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = GF_OFFSETTING|GF_TRANSDIFF}, 0, INT_MAX, FLAGS, "flags" },
{ "offsetting", "enable picture offsetting", 0, AV_OPT_TYPE_CONST, {.i64=GF_OFFSETTING}, INT_MIN, INT_MAX, FLAGS, "flags" },
{ "transdiff", "enable transparency detection between frames", 0, AV_OPT_TYPE_CONST, {.i64=GF_TRANSDIFF}, INT_MIN, INT_MAX, FLAGS, "flags" },
{ NULL }
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: gif.c:333
#define OFFSET(x)
Definition: gif.c:332
static int flags
Definition: cpu.c:47

Definition at line 334 of file gif.c.

const AVClass gif_class
Initial value:
= {
.class_name = "GIF encoder",
.item_name = av_default_item_name,
.option = gif_options,
Definition: version.h:70
static const AVOption gif_options[]
Definition: gif.c:334

Definition at line 341 of file gif.c.

AVCodec ff_gif_encoder
Initial value:
= {
.name = "gif",
.long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
.priv_data_size = sizeof(GIFContext),
.encode2 = gif_encode_frame,
.close = gif_encode_close,
.pix_fmts = (const enum AVPixelFormat[]){
.priv_class = &gif_class,
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int gif_encode_close(AVCodecContext *avctx)
Definition: gif.c:320
static const AVClass gif_class
Definition: gif.c:341
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:86
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:73
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
Definition: gif.c:42
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:89
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:84
static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: gif.c:266
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:262
Y , 8bpp.
Definition: pixfmt.h:70
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:87
static av_cold int gif_encode_init(AVCodecContext *avctx)
Definition: gif.c:217
Pixel format.
Definition: pixfmt.h:60

Definition at line 348 of file gif.c.