[FFmpeg-devel] [PATCH]Fix tiff grayscale palette

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Aug 29 15:47:35 CEST 2011


On date Monday 2011-08-29 09:42:37 +0200, Carl Eugen Hoyos encoded:
> Hi!
> 
> Fixes ticket 417.
> 
> Please comment, Carl Eugen

> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 1997e54..ab67ea5 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -294,8 +294,8 @@ static int init_image(TiffContext *s)
>          } else {
>              /* make default grayscale pal */
>              pal = (uint32_t *) s->picture.data[1];
> -            for (i = 0; i < 256; i++)
> -                pal[i] = i * 0x010101;
> +            for (i = 0; i < 1<<s->bpp; i++)
> +                pal[256 - (1<<s->bpp) + i] = i * 255 / ((1<<s->bpp) - 1) * 0x010101;

Seems it fixes the samples from the ticket, but how did you get that
expression? Just had a quick look at the specs, can't find a reference
to it.

Also please add a more complete explanation in the comment, why and
how does it fixes the grayscale (default) palette?
-- 
FFmpeg = Freak Fascinating Majestic Pitiful Eretic Governor


More information about the ffmpeg-devel mailing list