From patchwork Sat Feb 20 18:50:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 25849 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id E4DB644ABCA for ; Sat, 20 Feb 2021 21:47:10 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACBCC68A72F; Sat, 20 Feb 2021 21:47:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C74668A360 for ; Sat, 20 Feb 2021 21:47:04 +0200 (EET) Received: by mail-lj1-f170.google.com with SMTP id v6so42989273ljh.9 for ; Sat, 20 Feb 2021 11:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RMFBByIwvGlO3jQwJLWs42iQ19mp3BT+2rVouhGmgQE=; b=maMyGzZLCWZcTq6pXwVru2H8FCmNR4L47XHNsf0McE4aVZyNEFIY1/8O6NTKmu98Si B5luz+cOW0WdRTgHKZtkNiW1aOvDkXCiUYf+cif2w2047wYaBWiT0lCX6qYuXopon9qF opOTTbqTXTElYkpbW5Mv93lljtkOdhB26ePr3vBsnFk+UtfHWtT4dHp+5WSV4BONueiS +dCbU07Fubpud5ufDKR7mZ9SMmbfWvuNeCUDLAK3f+xHGTolDB82TigjrA1aWdMQLs9C B5QkEEPi/liZ/4B2xLYACxOXRb/MFw4OVybKhtiGCvxbP6PW0sA7FyvUMBhLfKP0EphV 84Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RMFBByIwvGlO3jQwJLWs42iQ19mp3BT+2rVouhGmgQE=; b=SKblXONDPILvIUt2dJmqEpHKstQOyJEZAuSi8T6MKfNuneuMPgVI/IDDnhb1ew9DCv p3TB6v5Jg8TyJyIUaXdQG/1GyDHmbI1FQdXOTr+WW7C6LjEsuCOrPwUsPhnVzwLYl32J Zq/bOvqNbq9OQL3C9Mo56B0Gph8tbjj0fq7ZAuxc+DaXWPTghveIMhmcHwMBCmaga2Aq q/lKSF0CGY0s+1H5uRUYQsKZE88JNFEaeutjapFKYrjLN/iIj38T9Fclt7xjGfJhpmJ/ tAhqbOMoYDW5fOr2Rdnu+U6yZLscoGXFLJh42Ys32zwJExOcaJegJ5D+Ush8pIXRDvxT kn0A== X-Gm-Message-State: AOAM531B/waxLNaWq/0zvYCOqNnPRCnkbwmbzLM28Z1dpGjV/xpLeYqN w9OxCkM657+j1kg9HH63aThpodVsW2k= X-Google-Smtp-Source: ABdhPJzuodjx/uNks5oj3vrkItkeWqnVwtQTJa8B5GtuaLFAkpBnZO9e3Fl9AiI+h4SRqxMjT2jHSA== X-Received: by 2002:adf:8084:: with SMTP id 4mr14511157wrl.49.1613847064941; Sat, 20 Feb 2021 10:51:04 -0800 (PST) Received: from localhost.localdomain ([82.129.110.36]) by smtp.gmail.com with ESMTPSA id v17sm19591860wru.85.2021.02.20.10.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Feb 2021 10:51:04 -0800 (PST) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 Feb 2021 18:50:49 +0000 Message-Id: <20210220185050.508373-2-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210220185050.508373-1-derek.buitenhuis@gmail.com> References: <20210220185050.508373-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2 v2] avcodec/gifenc: Add global_palette option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This option will disable the writing of the global palette in global GIF header if it is set to 0, causing only the frame-level palette to ever be written. This will be useful later on when further frame-level palette optimizations are introduced. The default is 1, which maintains current default behavior. Signed-off-by: Derek Buitenhuis --- Does this need a avcodec minor/patch version bump? --- libavcodec/gif.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index de41992851..8c07ee2769 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -51,6 +51,7 @@ typedef struct GIFContext { AVFrame *last_frame; int flags; int image; + int use_global_palette; uint32_t palette[AVPALETTE_COUNT]; ///< local reference palette for !pal8 int palette_loaded; int transparent_index; @@ -293,12 +294,14 @@ static int gif_image_write_image(AVCodecContext *avctx, bcid = get_palette_transparency_index(global_palette); - bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries */ + bytestream_put_byte(bytestream, ((uint8_t) s->use_global_palette << 7) | 0x70 | (s->use_global_palette ? 7 : 0)); /* flags: global clut, 256 entries */ bytestream_put_byte(bytestream, bcid < 0 ? DEFAULT_TRANSPARENCY_INDEX : bcid); /* background color index */ bytestream_put_byte(bytestream, aspect); - for (int i = 0; i < 256; i++) { - const uint32_t v = global_palette[i] & 0xffffff; - bytestream_put_be24(bytestream, v); + if (s->use_global_palette) { + for (int i = 0; i < 256; i++) { + const uint32_t v = global_palette[i] & 0xffffff; + bytestream_put_be24(bytestream, v); + } } } @@ -330,15 +333,16 @@ static int gif_image_write_image(AVCodecContext *avctx, bytestream_put_le16(bytestream, width); bytestream_put_le16(bytestream, height); - if (!palette) { - bytestream_put_byte(bytestream, 0x00); /* flags */ - } else { + if (palette || !s->use_global_palette) { + const uint32_t *pal = palette ? palette : s->palette; unsigned i; bytestream_put_byte(bytestream, 1<<7 | 0x7); /* flags */ for (i = 0; i < AVPALETTE_COUNT; i++) { - const uint32_t v = palette[i]; + const uint32_t v = pal[i]; bytestream_put_be24(bytestream, v); } + } else { + bytestream_put_byte(bytestream, 0x00); /* flags */ } bytestream_put_byte(bytestream, 0x08); @@ -473,6 +477,7 @@ static const AVOption gif_options[] = { { "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" }, { "gifimage", "enable encoding only images per frame", OFFSET(image), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, + { "global_palette", "write a palette to the global gif header where feasible", OFFSET(use_global_palette), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS }, { NULL } }; From patchwork Sat Feb 20 18:50:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 25846 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C722644A0BF for ; Sat, 20 Feb 2021 20:58:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9B3D68A67C; Sat, 20 Feb 2021 20:58:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E1ED68A3B2 for ; Sat, 20 Feb 2021 20:57:54 +0200 (EET) Received: by mail-ej1-f44.google.com with SMTP id e13so18968259ejl.8 for ; Sat, 20 Feb 2021 10:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=M2WSdBKTzyjz/YHBzy64okROBGsPm+Ok4x/Zke4xsRg=; b=PE6PdiqeG8bXPUK6mBOrakRILR8rr3s2bKsBp7nbScKfy2iJQhIR6nx3stey1JkvBg omfIPrxkNkCCXTF/0i39lAFUDN6egInssfpqzqJyHsTh37ufxysVtIROkK7ft+dmA+ov oI/WSqRZuO7pqyz9aAcMTp3KmL3OnxgDi3+So48aMT8KgxBabxMVbj3xXY93OJmiWsYc U/0HqVAwdHwgibuVmqaA3gN7C0PWRJ/8tlsP8dSiNeQ1G4uL1PeLcgWW92CwZiwBhCGW BVPnogKdsAmNoqY8wF37A0vpGB3lJWKcUROVwSaWZl5EyGGexZfTexVdmvYSghMckNUU YCaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M2WSdBKTzyjz/YHBzy64okROBGsPm+Ok4x/Zke4xsRg=; b=rfvKTkwmmFTseMk6I3IhlgF3rwkPUiNm8N+eikKjp/Yd1sJZSO1Y4A26WW2D2YY3wX ddYizYo/6EXEezVMnYjHdmNipFJK8AWLxFjp0rWsSbU8bMopuEn0P/gMqCeDyRh4ktJe QwhXYcpDswpKsZguBzAPn288Cj6s8xD1iaAlQpJsvb8sGFVXR1jVc5WV8pOxhnYEW3wR ylsZ5FaBnURZ3NK2ate6SQxXINoKsU8hQsZU0htYzTlMU4VNgQmMk9F/JcjA21Xl48Sq mAf5uVLQ+Y82rOAl/rj6WiwE77X7bQlEx829yK5yyKBXJVozqkcfM3LUKB4sEtAV8kEn G7Ig== X-Gm-Message-State: AOAM532+Gnl2N1U0RwA6BIG+TC7XcqBPqS/B8OWdf9dk+iC0mdjZF9wr aEgefFtELQkJAqStTp3wzdgGNCie43g= X-Google-Smtp-Source: ABdhPJxZE2kVyPoomXjJ1lEOZSelfahxASEX3Tjm6l+BGaQnLGJ31NiArs7fbOdOsLH2hrABhD7Zxw== X-Received: by 2002:adf:f7ca:: with SMTP id a10mr14828120wrq.25.1613847065627; Sat, 20 Feb 2021 10:51:05 -0800 (PST) Received: from localhost.localdomain ([82.129.110.36]) by smtp.gmail.com with ESMTPSA id v17sm19591860wru.85.2021.02.20.10.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Feb 2021 10:51:05 -0800 (PST) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 Feb 2021 18:50:50 +0000 Message-Id: <20210220185050.508373-3-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210220185050.508373-1-derek.buitenhuis@gmail.com> References: <20210220185050.508373-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2 v2] avcodec/gifenc: Only write frame palette entries that actually used X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" GIF palette entries are not compressed, and writing 256 entries, which can be up to every frame, uses a significant amount of space, especially in extreme cases, where palettes can be very small. Example, first six seconds of Tears of Steel, palette generated with libimagequant, 320x240 resolution, and with transparency optimization + per frame palette: * Before patch: 186765 bytes * After patch: 77895 bytes Signed-off-by: Derek Buitenhuis --- The global palette, if used, is no longer ever shrunk in v2 of this patch. This is because just because any given frame doesn't reference an index, doesn't mean a future frame won't. --- libavcodec/gif.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 8c07ee2769..420a1f523e 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -63,6 +63,44 @@ enum { GF_TRANSDIFF = 1<<1, }; +static void shrink_palette(const uint32_t *src, uint8_t *map, + uint32_t *dst, size_t *palette_count) +{ + size_t colors_seen = 0; + + for (size_t i = 0; i < AVPALETTE_COUNT; i++) { + int seen = 0; + for (size_t c = 0; c < colors_seen; c++) { + if (src[i] == dst[c]) { + seen = 1; + break; + } + } + if (!seen) { + dst[colors_seen] = src[i]; + map[i] = colors_seen; + colors_seen++; + } + } + + *palette_count = colors_seen; +} + +static void remap_frame_to_palette(const uint8_t *src, int src_linesize, + uint8_t *dst, int dst_linesize, + int w, int h, uint8_t *map) +{ + uint8_t *sptr = (uint8_t *) src; + uint8_t *dptr = dst; + + for (int i = 0; i < h; i++) { + for (int j = 0; j < w; j++) + dptr[j] = map[sptr[j]]; + dptr += dst_linesize; + sptr += src_linesize; + } +} + static int is_image_translucent(AVCodecContext *avctx, const uint8_t *buf, const int linesize) { @@ -267,6 +305,18 @@ static int gif_image_write_image(AVCodecContext *avctx, int x_start = 0, y_start = 0, trans = s->transparent_index; int bcid = -1, honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame && !palette; const uint8_t *ptr; + uint32_t shrunk_palette[AVPALETTE_COUNT]; + uint8_t map[AVPALETTE_COUNT] = { 0 }; + size_t shrunk_palette_count = 0; + uint8_t *shrunk_buf = NULL; + + /* + * We memset to 0xff instead of 0x00 so that the transparency detection + * doesn't pick anything after the palette entries as the transparency + * index, and because GIF89a requires us to always write a power-of-2 + * number of palette entries. + */ + memset(shrunk_palette, 0xff, AVPALETTE_SIZE); if (!s->image && is_image_translucent(avctx, buf, linesize)) { gif_crop_translucent(avctx, buf, linesize, &width, &height, &x_start, &y_start); @@ -335,9 +385,14 @@ static int gif_image_write_image(AVCodecContext *avctx, if (palette || !s->use_global_palette) { const uint32_t *pal = palette ? palette : s->palette; + unsigned pow2_count; unsigned i; - bytestream_put_byte(bytestream, 1<<7 | 0x7); /* flags */ - for (i = 0; i < AVPALETTE_COUNT; i++) { + + shrink_palette(pal, map, shrunk_palette, &shrunk_palette_count); + pow2_count = av_log2(shrunk_palette_count - 1); + + bytestream_put_byte(bytestream, 1<<7 | pow2_count); /* flags */ + for (i = 0; i < 1 << (pow2_count + 1); i++) { const uint32_t v = pal[i]; bytestream_put_be24(bytestream, v); } @@ -350,7 +405,17 @@ static int gif_image_write_image(AVCodecContext *avctx, ff_lzw_encode_init(s->lzw, s->buf, s->buf_size, 12, FF_LZW_GIF, 1); - ptr = buf + y_start*linesize + x_start; + if (shrunk_palette_count) { + shrunk_buf = av_malloc(avctx->height * linesize); + if (!shrunk_buf) { + av_log(avctx, AV_LOG_ERROR, "Could not allocated remapped frame buffer.\n"); + return AVERROR(ENOMEM); + } + remap_frame_to_palette(buf, linesize, shrunk_buf, linesize, avctx->width, avctx->height, map); + ptr = shrunk_buf + y_start*linesize + x_start; + } else { + ptr = buf + y_start*linesize + x_start; + } if (honor_transparency) { const int ref_linesize = s->last_frame->linesize[0]; const uint8_t *ref = s->last_frame->data[0] + y_start*ref_linesize + x_start; @@ -383,6 +448,7 @@ static int gif_image_write_image(AVCodecContext *avctx, len -= size; } bytestream_put_byte(bytestream, 0x00); /* end of image block */ + av_freep(&shrunk_buf); return 0; } From patchwork Sun Feb 21 13:12:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 25856 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D2F6844A9A5 for ; Sun, 21 Feb 2021 15:12:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B4D0E68A636; Sun, 21 Feb 2021 15:12:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B517068A5BA for ; Sun, 21 Feb 2021 15:12:38 +0200 (EET) Received: by mail-wm1-f46.google.com with SMTP id a132so11119090wmc.0 for ; Sun, 21 Feb 2021 05:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eIvBWMG3bmiCmGldff/SZXhnjWMi8t5XRr4uhomF7AY=; b=T6IYk0u5Y/QfKNep8Q6yKYBQVOVY3p3Lw+D6r/GfjiP2ElUbXVMZnd8ABJTzxypZyi xA+/Acw7CLO/OWecJmoY1Kyp1xiwApdqzTnstr+GUyPe0neRKON3C2YpdilI6IrZikMA 1Nj7TjSzbUc1WJOYOLa/g56MY3UewCSucPd5YxecP5SSNMGhpyeBS2nKWqcLvnD+C311 B9VAzdIFSgqRpA85RmHfjZASKP4tV0RzXoDvgxiej2gRKvrFNooqeGz4QlPuVjN+OPta Tr6pfd+sb+AvLbGZjaC1YLuVxe2OzwHHqdtPWllYyWT8u0+FLfgJpir5W1dv261Q59OP p3fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eIvBWMG3bmiCmGldff/SZXhnjWMi8t5XRr4uhomF7AY=; b=aPjLPt+jnP+7H/nIgU26anQYNms1VzfHwSziDqr7rUL0jL7lK7lm8yxRC68k68ushf 5DlhFZAUhCFOXgTR7nSMBdPZMbCMLsyYiD2nDZCamxSCoXo5a09RaiZuasPOoN7pYSAR MZOpVS1mNtgot3qVO7ySka277eco5u1frWV+KPUUQl62e7P7FqH+8vQxTuoVdZJTaqs/ LvpdFxt+kZg4vV2U3AheKjK0h7q+PnuV9FKuQPt27xWvHdDdLHbyOQmMMmeXYRXALHuL 9uePfchTNz159GrkjcQ0DPd7FLhsQhmuxFFW2AfAScs5kD/EXSGHBNIwAewXXPga0pj5 z9zQ== X-Gm-Message-State: AOAM532jvaK5t6o/+rmSP65dRUaeyWSM38hZtjbJ7sgX/PGy9BSe8GOK LYOPbWBbGgqTW9enJ16zM+9O33f3LSM= X-Google-Smtp-Source: ABdhPJwzYXHcfT7TKFvuJcb1MhyqB1p9jGGXz7Bb6oB4mGllaFPLBKcTfbeOFotFVHzWAPH9dLDHXw== X-Received: by 2002:a05:600c:4f46:: with SMTP id m6mr15941525wmq.160.1613913158027; Sun, 21 Feb 2021 05:12:38 -0800 (PST) Received: from localhost.localdomain ([82.129.110.36]) by smtp.gmail.com with ESMTPSA id y62sm25903926wmy.9.2021.02.21.05.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Feb 2021 05:12:37 -0800 (PST) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 Feb 2021 13:12:27 +0000 Message-Id: <20210221131227.518865-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210220185050.508373-1-derek.buitenhuis@gmail.com> References: <20210220185050.508373-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/2] doc/encoders: Add documentation for the GIF encoder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Derek Buitenhuis --- doc/encoders.texi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 8fb573c416..d7d81e070d 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1268,6 +1268,44 @@ disabled A description of some of the currently available video encoders follows. +@section GIF + +GIF image/animation encoder. + +@subsection Options + +@table @option +@item gifflags @var{integer} +Sets the flags used for GIF encoding. + +@table @option +@item offsetting +Enables picture offsetting. + +Default is enabled. + +@item transdiff +Enables transparency detection between frames. + +Default is enabled. + +@end table + +@item gifimage @var{integer} +Enables encoding one full GIF image per frame, rather than an animated GIF. + +Default value is @option{0}. + +@item global_palette @var{integer} +Writes a palette to the global GIF header whee feasible. + +If disabled, every frame will always have a palette written, even if there +is a global palette supplied. + +Default value is @option{1}. + +@end table + @section Hap Vidvox Hap video encoder.