[FFmpeg-devel] Huffyuv: Align the image data in adaptive Huffman tables mode, updated
Michael Kaufmann
hallo
Thu Aug 12 23:08:30 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
>
> [...]
>
Here is an updated patch, I hope it is acceptable.
I agree that another patch for the decoder would be interesting. The
performance will improve a bit. I have done some experiments with a
modified version of the original Huffyuv decoder, it can decode a
particular video at 67 fps instead of 65 fps if the Huffyuv file has
been created with this patch.
But another goal of this patch is to create a bitstream that is more
similar to the bitstream of the original Huffyuv encoder (a clean little
endian bitstream).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Huffyuv.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100812/a84bf510/attachment.asc>
More information about the ffmpeg-devel
mailing list