[FFmpeg-devel] [PATCH] IFF: Add grayscale support to decoder

Sebastian Vater cdgs.basty
Mon May 10 19:58:53 CEST 2010

Ronald S. Bultje a ?crit :
> Hi,
> On Mon, May 10, 2010 at 1:25 PM, Sebastian Vater
> <cdgs.basty at googlemail.com> wrote:
>> Ronald S. Bultje a ?crit :
>>> But can it get < 0? And should it get < 0? And if so, what does that mean?
>> It means that there's no actual palette data itself attached from an old
>> demuxer, the new decoder will then subtract the custom extra data size
>> and this will < 0, of course this should be handled as no palette and
>> therefore use grayscale palette ;)
> This sounds buggy to me. How many bytes are in extradata if count < 0?
> count should never be smaller than size / 3, suggesting that count < 0
> is in fact a bug.

It is more a workaround / compatibility issue than a bug, actually, just
that we get it for free (i.e. no speed/size penalty).
The line causing this will sth. look like that (like in my HAM patches):
count = FFMIN((avctx->extradata_size - IFF_EXTRA_CONTEXT_SIZE) / 3, count);

Actually, that will depend on the new structure we are using when HAM
gets in, if it will be 6 bytes, then count will be -6 if old demuxer
delivers no extradata.

Of course, this could be solved other ways, too. But this will make the
code more complex.
With the current patch level, this can't happen, of course, but I just
don't want to change that line later, just because of that, esp. if it
does right now no harm at all (neither size nor speed).


Best regards,
                   :-) Basty/CDGS (-:

More information about the ffmpeg-devel mailing list