[FFmpeg-devel] [PATCH] Add non native 16bits RGB/BGR output support to libswscale

Alexis Ballier alexis.ballier
Thu Aug 13 00:26:43 CEST 2009


>> Per subject. C version only as I'm really not sure how to deal with
>> the mmx versions; suggestions are very welcome.
>
> bswap16 their output?
>
> we already have quite a bit of code, bloat for obscure formats seems
> silly, and non native endian formats seem obscure ...

For me non native endian formats have a real point: allow encoders to
specify what endianness they want. I've been playing with an mmx
version since and have a (may be not optimal) version that depends on
this patch that i'll submit later and leave it to your judgement; it
uses 6 instructions more than native endian format for 8 pixels, thus
2 less than what optimal we might expect by byteswapping the output
(or what seems to be commonly done in current encoders by using
AV_WB/L16 and an if() inside the output loop). The real gain, of
course, is that we use the full mmx converter to get the raw frame
instead of the C version.

>> @@ -909,8 +917,8 @@
>> ? ? ? ? ? ? ?dest+=6;\
>> ? ? ? ? ?}\
>> ? ? ? ? ?break;\
>> - ? ?case PIX_FMT_RGB565:\
>> - ? ?case PIX_FMT_BGR565:\
>> + ? ?case PIX_FMT_NE(RGB565BE,RGB565LE):\
>> + ? ?case PIX_FMT_NE(BGR565BE,BGR565LE):\
>> ? ? ? ? ?{\
>> ? ? ? ? ? ? ?const int dr1= dither_2x2_8[y&1 ? ?][0];\
>> ? ? ? ? ? ? ?const int dg1= dither_2x2_4[y&1 ? ?][0];\
>> @@ -924,10 +932,25 @@
>> ? ? ? ? ? ? ?}\
>> ? ? ? ? ?}\
>> ? ? ? ? ?break;\
>> - ? ?case PIX_FMT_RGB555:\
>> - ? ?case PIX_FMT_BGR555:\
>> + ? ?case PIX_FMT_NE(RGB565LE,RGB565BE):\
>> + ? ?case PIX_FMT_NE(BGR565LE,BGR565BE):\
>
> pointless?

Somehow I was sure you wouldn't like it. It was there to preserve the
symmetry and in the long term perhaps allow to deprecate the formats
that depend on machine endianness. Enclosed is an updated patch.


Alexis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swsscale_non_native_rgb16_support2.patch
Type: application/octet-stream
Size: 5670 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090813/821754ae/attachment.obj>



More information about the ffmpeg-devel mailing list