[FFmpeg-devel] [PATCH] BGR24 Huffyuv and drive-by bug fixes

Michael Niedermayer michaelni
Sat Oct 17 22:04:29 CEST 2009


On Sat, Oct 17, 2009 at 03:09:50AM -0400, Alexander Strange wrote:
>
> On Oct 15, 2009, at 5:53 PM, Michael Niedermayer wrote:
>
>> On Thu, Oct 15, 2009 at 03:51:11PM -0400, Alexander Strange wrote:
>>> The Huffyuv decoder currently decodes all RGB files as RGB32 with the 
>>> alpha
>>> channel left uninitialized - there are rows of 0x80 (the default) and a 
>>> few
>>> of 0x00 (probably because of plane prediction).
>>> This has just recently caused some rendering problems in Perian, although
>>> I'm not sure why it worked before.
>>>
>>> Attached patches decode 24-bit huffyuv as BGR24 to avoid this, and fix 
>>> some
>>> other problems I found along the way.
>>>
[...]
>>> 4- adds BGR24 decoding for 24-bit files. Decoding speed is about the 
>>> same.
>>> It requires a bit of copied code; PIX_FMT_RGB32 is endian-dependent and
>>> BGR24 isn't, so merging the two cases turned out very ugly.
>>> I used AV_WL32 to do a 24-bit write, since it's faster than AV_WL24 on 
>>> most
>>> platforms.
>>> 5- reindents.
>>>
>>> The last patch is meant to add correct alpha decoding for actual RGBA
>>> files, but without a sample I can't test it.
>>>
[...]
>>> dsputil.c |   23 +++++++++++++++++++++++
>>> dsputil.h |    1 +
>>> huffyuv.c |   62 
>>> +++++++++++++++++++++++++++++++++++++++-----------------------
>>> 3 files changed, 63 insertions(+), 23 deletions(-)
>>> b5040e16dc7f1c8edd5b85a99a11f4e32f3ee521  
>>> 0004-Huffyuv-Decode-RGB24-as-PIX_FMT_BGR24.patch
>>> From 268f8db45761bbf65140c88b6c82d0c2db57225f Mon Sep 17 00:00:00 2001
>>> From: Alexander Strange <astrange at ithinksw.com>
>>> Date: Wed, 14 Oct 2009 22:15:28 -0400
>>> Subject: [PATCH 4/6] Huffyuv: Decode RGB24 as PIX_FMT_BGR24.
>>>
>>> Currently it decodes as RGB32 with junk in the alpha channel.
>>> ---
>>> libavcodec/dsputil.c |   23 ++++++++++++++++++
>>> libavcodec/dsputil.h |    1 +
>>> libavcodec/huffyuv.c |   62 
>>> +++++++++++++++++++++++++++++++------------------
>>> 3 files changed, 63 insertions(+), 23 deletions(-)
>>
>> it might be as fast to handle 3 byte groups in C but its not clear how 
>> SIMD
>> would behave with that
>
> I don't think it applies here.

besides this, which loren alraedy awnsered ...
this patch adds 63 lines and removes 23 thats 40 lines more
i would suspect that setting the alpha bytes so they arent random can be done
with less.
Is there some other advantage / argument in favor of switching to rgb24?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091017/1d519825/attachment.pgp>



More information about the ffmpeg-devel mailing list