[FFmpeg-devel] [PATCH] IFF: Make lavf/iff.c stop using ff_cmap_read_palette

Sebastian Vater cdgs.basty
Thu May 13 19:14:59 CEST 2010

Michael Niedermayer a ?crit :
> On Thu, May 13, 2010 at 10:14:27AM -0400, Ronald S. Bultje wrote:
>> Hi,
>> On Thu, May 13, 2010 at 9:57 AM, Sebastian Vater
>> <cdgs.basty at googlemail.com> wrote:
>>> Ronald S. Bultje a ?crit :
>>>>> +            memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
>>>>> +            buf += avctx->width;
>>>> You can just memcpy the whole image at once instead of per-line, no?
>>> They have different width alignment, if I do one memcpy, the image is
>>> totally distorted.
>> Right... Do we have a generic function for this? Otherwise patch OK,
>> will apply if nobody complains.
> av_picture_copy() maybe

All these need an extra AVPicture * struct, adding all the init stuff
for it makes the code larger than the current one.

Also, later I will have add some code there for masking support.

However, I found another error covering grayscale images with
bits_per_coded_sample < 8, since PIX_FMT_GRAY8 is allowed only with == 8.

So this patch fixes this issue by setting PIX_FMT_GRAY8 only if bpp == 8
and initializes a custom RGB color palette for bpp < 8 simulating
correct behaviour (pictures are way too dark otherwise).

Please note that the GRAY2RGB macro will later be used by HAM, too.

I also checked this on big endian and it works correctly there, too.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iff-decoder-grayscale-support.patch
Type: text/x-patch
Size: 3366 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100513/3c32075c/attachment.bin>

More information about the ffmpeg-devel mailing list