[FFmpeg-devel] [PATCH 1/2] lavf/avienc: Simplify palette handling

Mats Peterson matsp888 at yahoo.com
Sat Feb 27 16:13:35 CET 2016


On 02/27/2016 04:08 PM, Mats Peterson wrote:
> On 02/27/2016 04:07 PM, Mats Peterson wrote:
>> On 02/27/2016 04:00 PM, Reimar Döffinger wrote:
>>> On Sat, Feb 27, 2016 at 03:57:06PM +0100, Mats Peterson wrote:
>>>> On 02/27/2016 03:37 PM, Mats Peterson wrote:
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ffmpeg-devel mailing list
>>>>> ffmpeg-devel at ffmpeg.org
>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>
>>>>
>>>> I suppose this is what you mean, Reimar. Treating the palette, if a
>>>> packet
>>>> contains one at the end of the video data, as being AVPALETTE_SIZE
>>>> bytes
>>>> exclusively.
>>>
>>> Well, actually not really.
>>> If the palette is part of input frame it should be sent as side
>>> data.
>>> I am not sure where this variant comes from.
>>> It might be that it should just be written as is.
>>> Or even if the palette needs to be split it might be
>>> necessary to auto-detect the palette size via
>>> packet size - (width*height*bits per pixel)/8.
>>> But as said, I am fairly unclear on what case that
>>> code is supposed to handle.
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> I agree that it should be stored in a side data packet myself normally,
>> and that this is a somewhat weird construction. It probably has to do
>> with the nut format originally, which stores raw palettized data after
>> the video data in the packets. Anyway, I have accepted the facts. For
>> the record, the new ff_reshuffle_raw_rgb() function written by Michael
>> in lavf/rawutils.c that aligns strides properly for AVI and QuickTime,
>> will set a CONTAINS_PAL flag if the packet size is larger than the
>> actual video data. He has hardcoded the palette size to 1024 bytes in
>> that file.
>>
>> Mats
>>
>
> The nut format stores the PALETTE after the video data in the packets,
> nothing else :)
>

In any case, on muxing, the packets will have the palette after the 
video data in the packets, whether it's AVI or QuickTime. Neither 
avienc.c or movenc.c uses any side data packets for the palette.

Michael's intention has been to enable palette switching in the middle 
of the stream, hence storage of the palette in each packet, and AVI 
supports it by using the 'xxpc' chunks in the video data. It is also 
implemented by now.

Mats

-- 
Mats Peterson
http://matsp888.no-ip.org/~mats/


More information about the ffmpeg-devel mailing list