[FFmpeg-devel] [PATCH]Set palette for 1bit PCX

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Nov 11 17:54:35 CET 2011


On Fri, Nov 11, 2011 at 11:01:37AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> The palette is all 0 for 1 bit PCX, attached patch fixes ticket #637 for me.
> 
> Please comment, Carl Eugen

> diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
> index b2d433a..e940868 100644
> --- a/libavcodec/pcx.c
> +++ b/libavcodec/pcx.c
> @@ -224,6 +224,9 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
>  
>      if (nplanes == 1 && bits_per_pixel == 8) {
>          pcx_palette(&buf, (uint32_t *) p->data[1], 256);
> +    } else if (bits_per_pixel * nplanes == 1) {
> +        ((uint32_t *) p->data[1])[0] = 0xFF000000;
> +        ((uint32_t *) p->data[1])[1] = 0xFFFFFFFF;

Hm, might it be better to use AV_WNA32 to avoid e.g. possible
aliasing warnings/issues?
I know it seems overly pedantic, but still.


More information about the ffmpeg-devel mailing list