[FFmpeg-devel] [PATCH] lavc/rawdec: Only use AV_PIX_FMT_PAL8 for 1 bpp video

Mats Peterson matsp888 at yahoo.com
Sun Jan 31 22:08:41 CET 2016


On 01/31/2016 03:07 PM, Michael Niedermayer wrote:
> On Sun, Jan 31, 2016 at 01:27:22PM +0100, Mats Peterson wrote:
>> I don't really appreciate that you're doing things behind my back,
>> Michael. There's nothing mentioned on the ffmpeg-devel mailing lis
>
> indeed, i should have clearly stated that i applied the pal8
> patches with the plan to use pal8 only when neccessary.
> I had asked you to implement exactly that but it seemed you didnt
> know how to do that cleanly and simply so i thought "no problem,
> i know how to do that, ill do it"
> i had not expected this to be controversal
>
>

Even if you stubbornly decide to keep your patch, it is incorrect 
anyway. If a 1 bpp AVI contains a palette, black & white or not, pal8 
will be used regardless. Look at the snippet below. Furthermore, the 
palette side data packet will be retrieved twice, both here and at the 
end of the raw_decode() function.

Don't you agree that it just creates a lot of unnecessary code noise to 
have to do this "switching" uniformly for 1 bpp in all file formats? I 
suggest you apply my patch, and we will get rid of stuff like this.

if (avctx->bits_per_coded_sample == 1 &&
         avctx->frame_number == 0 &&
         context->palette &&
         AV_RB64(context->palette->data) == 0xFFFFFFFF00000000
) {
         const uint8_t *pal = av_packet_get_side_data(avpkt, 
AV_PKT_DATA_PALETTE,
         if (!pal) {
             avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
         } else
             avctx->pix_fmt = AV_PIX_FMT_PAL8;
}




More information about the ffmpeg-devel mailing list