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

Alexander Strange astrange
Thu Oct 15 21:51:11 CEST 2009


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.

1- fixes a valgrind warning in get_vlc2, caused by the input padding  
in bitstream_buffer being uninitialized.
2- fixes temp[0] and temp[1] being allocated when only temp[0] is used  
for RGB.
3- adds 'const' to the DSP functions' src pointers (didn't run  
patcheck?) and removes a meaningless 'inline'.
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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Huffyuv-Fix-a-valgrind-warning-in-get_vlc2.patch
Type: application/octet-stream
Size: 822 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Huffyuv-Remove-unnecessary-allocation-in-alloc_temp.patch
Type: application/octet-stream
Size: 809 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-missing-const-for-src-pointers-in-Huffyuv-dsp-fu.patch
Type: application/octet-stream
Size: 3553 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Huffyuv-Decode-RGB24-as-PIX_FMT_BGR24.patch
Type: application/octet-stream
Size: 8646 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Reindent-huffyuv.c.patch
Type: application/octet-stream
Size: 2437 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Huffyuv-Decode-the-alpha-channel-in-RGB32-files.patch
Type: application/octet-stream
Size: 5207 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091015/987dfa40/attachment-0005.obj>



More information about the ffmpeg-devel mailing list