[FFmpeg-devel] [PATCH] Huffyuv: Align the image data in adaptive Huffman tables mode

Michael Niedermayer michaelni
Mon Aug 9 15:15:53 CEST 2010

On Sun, Aug 08, 2010 at 09:59:47PM +0200, Michael Kaufmann wrote:
> This patch is for the "adaptive Huffman tables" mode of Huffyuv. In this 
> mode, three per-frame huffman tables are saved, and then the actual image 
> data. This patch aligns the image data by enlarging one of the three 
> Huffman tables by up to 3 bytes.
> If the the image data is not aligned, then the bitstream is not saved in 
> little endian (like the bitstream of the original Huffyuv codec), but in a 
> strange mixture. Decoding the frame is much easier for other decoders if 
> the image data is aligned, and it is also possible with better performance.
> A detailed explanation of the alignment problems can be found in the 3rd 
> comment of this blog entry:
> http://www.virtualdub.org/blog/pivot/entry.php?id=203
> This patch enlarges the Huffman tables in a backwards-compatible way to 
> align the image data. Video files generated with this patch can be read 
> with older ffmeg versions without any problems. They can also be read by 
> the built-in Huffyuv decoder of VirtualDub.

The first question is which is the faster way to read huffyuv (with alignment)
if the faster variant doesnt need alignment then theres little point in
bothering about alignment. If the faster way does need alignment i would be
interrested in a patch that switches our decoder to this faster way.

either way enlarging the tables should only need <5 lines of code.
aka i dont see how this mess would be needed
a simple loop that enlarges the table by afew bits until final alignment is
ok should do

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100809/b09a9920/attachment.pgp>

More information about the ffmpeg-devel mailing list