[FFmpeg-devel] [PATCH] IFF: Add grayscale support to decoder
Sebastian Vater
cdgs.basty
Thu May 13 19:25:04 CEST 2010
Ronald S. Bultje a ?crit :
> Hi,
>
> On Thu, May 13, 2010 at 10:40 AM, Sebastian Vater
> <cdgs.basty at googlemail.com> wrote:
>
>> So here is an updated version of grayscale support which fixes:
>>
>> 1. Removal of unneeded parenthesis.
>> 2. Changed 'if (count > 0)' to 'if (count)'.
>> 3. Changed '? (extradata_size == 0) : GRAY8 ? PAL8' to '? extradata_size
>> : PAL8 ? GRAY8.
>>
> [.]
>
>> + } else { // PIX_FMT_GRAY8 has no color palette, create one
>> + uint8_t *gray_pal = (uint8_t *) pal;
>> + count = 1 << avctx->bits_per_coded_sample;
>> +
>> + for (i=0; i < count; i++) {
>> + gray_pal[i] = (i * 255) >> avctx->bits_per_coded_sample;
>> + }
>> + }
>>
>
> Is the palette actually used for GRAY8? I don't think so.
>
>
You have been correct, for GRAY8 it isn't required!
However, trying out helped me to figure out an error covering grayscale images with
bits_per_coded_sample < 8, since PIX_FMT_GRAY8 is allowed only with bpp == 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/cac4a042/attachment.bin>
More information about the ffmpeg-devel
mailing list