logo Sign In

Post #117701

Author
Rebel11_38
Parent topic
.: The X0 Project Discussion Thread :. (* unfinished project *)
Link to post in topic
https://originaltrilogy.com/post/id/117701/action/topic#117701
Date created
23-Jun-2005, 2:27 AM
Lagarith offers excellent compression, the MSU Lossless Codec and FFV1 are the only codecs that I have come across that outperform Lagarith in terms of compression. I would recommend Lagarith for the following reasons however. Lagarith is able to operate in several colorspaces - RGB24, RGB32, RGBA, YUY2, and YV12. For DVD video, the compression is typically only 10-30% better than Huffyuv. However, for high static scenes or highly compressible scenes, Lagarith significantly outperforms Huffyuv.Lagarith is able to outperform Huffyuv due to the fact that it uses a much better compression method. Pixel values are first predicted using median prediction (the same method used when "Predict Median" is selected in Huffyuv). This results in a much more compressible data stream. In Huffyuv, this byte stream would then be compress using Huffman compression. In Lagarith, the byte stream may be subjected to a modified Run Length Encoding if it will result in better compression. The resulting byte stream from that is then compressed using Arithmetic compression, which, unlike Huffman compression, can use fractional bits to encode a symbol. This allows the compressed size to be very close to the entropy of the data, and is why Lagarith can compress simple frames much better than Huffyuv, and avoid expanding high static video. Additionally, Lagarith has support for null frames; if the previous frame is mathematically identical to the current, the current frame is discarded and the decoder will simply use the previous frame again.

The trade-off for this improved compression is speed. On a single processor system, Lagarith is significantly slower than Huffyuv on typical video. For me, Lagarith tends to encode at about half the speed Huffyuv does. Additionally, the decode speed is slower than the encode speed; this is due to the nature of Arithmetic compression and the prediction algorithm. Fortunately, for the situations where the codec offers the most advantages over Huffyuv, the speed difference between the two tends to decrease, and Lagarith can be much faster for simple video. For multiple processor systems, Lagarith 1.3.0 can take advantage of additional processors; while Huffyuv cannot. On such systems Lagarith may be faster than Huffyuv.

This codec was build using the Huffyuv source as a template, and uses some Huffyuv code, most notably the routine to upsample YUY2 video to RGB. The function for upsampling YV12 to YUY2 was taken from AviSynth.


- Taken from the Lagarith homepage.

As far as looking better, I can't explain why it does, but...it does. Using similar settings for each codec, I get a lot aliasing on straight lines when using HuffYUV, especially noticable on the 20th century FOX logo. With Lagarith and the same settings, I don't get that, and I get a smaller file to boot.