[FFmpeg-devel] [PATCH] Add DPX decoder rev-13

Jimmy Christensen jimmy
Wed Jun 3 08:21:36 CEST 2009


On 2009-06-02 19:36, Vitor Sessak wrote:
> Jimmy Christensen wrote:
>> On 2009-05-30 12:53, Michael Niedermayer wrote:
>>> On Fri, May 29, 2009 at 08:43:00AM +0200, Jimmy Christensen wrote:
>>>> On 2009-05-28 12:52, Michael Niedermayer wrote:
>>>>> On Thu, May 28, 2009 at 07:19:48AM +0200, Jimmy Christensen wrote:
>>> [...]
>>>
>>>> + if(PIX_FMT_RGB48 == PIX_FMT_RGB48BE) {
>>>> + bytestream_put_be16(&dst, RED10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + bytestream_put_be16(&dst, GREEN10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + bytestream_put_be16(&dst, BLUE10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + } else {
>>>> + bytestream_put_le16(&dst, RED10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + bytestream_put_le16(&dst, GREEN10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + bytestream_put_le16(&dst, BLUE10(rgbBuffer) * 64); // 10-bit> 16-bit
>>>> + }
>>>
>>> *dst16++ = (rgbBuffer& 0x...)>> ..;
>>> *dst16++ = (rgbBuffer& 0x...)>> ..;
>>> *dst16++ = (rgbBuffer& 0x...)>> ..;
>>>
>>
>> Does makes code simpler, but can it always be guarantied that
>> PIX_FMT_RGB48 is PIX_FMT_RGB48BE on big endian systems and
>> PIX_FMT_RGB48LE on little endian systems?
>
> Quoting libavutils/pix_fmt.h
>
>> #ifdef WORDS_BIGENDIAN
>> # define PIX_FMT_NE(be, le) PIX_FMT_##be
>> #else
>> # define PIX_FMT_NE(be, le) PIX_FMT_##le
>> #endif
>>
>> #define PIX_FMT_RGB32 PIX_FMT_NE(ARGB, BGRA)
>> #define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR)
>> #define PIX_FMT_BGR32 PIX_FMT_NE(ABGR, RGBA)
>> #define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB)
>>
>> #define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
>> #define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE)
>
> The whole point of having three pix formats is having one for big
> endian, one for little endian and one for native endianness.
>

I know. I saw that too. Anyway, thought that if pix_fmt was changed it 
would break the decoder, but seeing that all other pix_fmt's works the 
same it would break a whole lot of other codecs aswell.

Perhaps I should look at the pnm encoder/decoder which forces 
PIX_FMT_RGB48BE on all platforms. Will change the behavior then.



More information about the ffmpeg-devel mailing list