diff mbox

[FFmpeg-devel] avcodec/gif: dont honor transparency if palette changed

Message ID 1473161417-19576-1-git-send-email-onemda@gmail.com
State Accepted
Commit 7a258ef97e54a499b1ab8ad0244dbb8c48b4fd51
Headers show

Commit Message

Paul B Mahol Sept. 6, 2016, 11:30 a.m. UTC
It generally does not work.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/gif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Sept. 6, 2016, 11:33 a.m. UTC | #1
2016-09-06 13:30 GMT+02:00 Paul B Mahol <onemda@gmail.com>:
> It generally does not work.

Shouldn't a warning be printed in this case?

Carl Eugen
Clément Bœsch Sept. 6, 2016, 2:53 p.m. UTC | #2
On Tue, Sep 06, 2016 at 01:30:17PM +0200, Paul B Mahol wrote:
> It generally does not work.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/gif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/gif.c b/libavcodec/gif.c
> index 6af1f4a..d9c99d5 100644
> --- a/libavcodec/gif.c
> +++ b/libavcodec/gif.c
> @@ -83,7 +83,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
>      GIFContext *s = avctx->priv_data;
>      int len = 0, height = avctx->height, width = avctx->width, x, y;
>      int x_start = 0, y_start = 0, trans = s->transparent_index;
> -    int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame;
> +    int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame && !palette;
>      const uint8_t *ptr;
>  

LGTM
diff mbox

Patch

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index 6af1f4a..d9c99d5 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -83,7 +83,7 @@  static int gif_image_write_image(AVCodecContext *avctx,
     GIFContext *s = avctx->priv_data;
     int len = 0, height = avctx->height, width = avctx->width, x, y;
     int x_start = 0, y_start = 0, trans = s->transparent_index;
-    int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame;
+    int honor_transparency = (s->flags & GF_TRANSDIFF) && s->last_frame && !palette;
     const uint8_t *ptr;
 
     /* Crop image */