[FFmpeg-devel] [PATCH 2/2] lavc/gif: make possible to disable cropping.
Clément Bœsch
ubitux at gmail.com
Fri Apr 19 13:48:13 CEST 2013
---
libavcodec/gif.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 92c7e59..ad4f08b 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -50,7 +50,8 @@ typedef struct {
} GIFContext;
enum {
- GF_LZW = 1<<0,
+ GF_LZW = 1<<0,
+ GF_CROP = 1<<1,
};
static int gif_image_write_image(AVCodecContext *avctx,
@@ -65,7 +66,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
/* Crop image */
// TODO support with palette change
- if (s->last_frame && !palette) {
+ if ((s->flags & GF_CROP) && s->last_frame && !palette) {
const uint8_t *ref = s->last_frame->data[0];
const int ref_linesize = s->last_frame->linesize[0];
int x_end = avctx->width - 1,
@@ -270,8 +271,9 @@ static int gif_encode_close(AVCodecContext *avctx)
#define OFFSET(x) offsetof(GIFContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption gif_options[] = {
- { "gifflags", "set GIF flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = GF_LZW}, 0, INT_MAX, FLAGS, "flags" },
+ { "gifflags", "set GIF flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = GF_LZW|GF_CROP}, 0, INT_MAX, FLAGS, "flags" },
{ "lzw", "enable LZW compression", 0, AV_OPT_TYPE_CONST, {.i64=GF_LZW}, INT_MIN, INT_MAX, FLAGS, "flags" },
+ { "crop", "enable crop detection", 0, AV_OPT_TYPE_CONST, {.i64=GF_CROP}, INT_MIN, INT_MAX, FLAGS, "flags" },
{ NULL }
};
--
1.8.2.1
More information about the ffmpeg-devel
mailing list