can anyone put me straight on this explenation that i've got from a www page about lossless compression ( http://www.data-compression.com/lossless.html ), of the difference between huffman compression algorithm and lz compression algorithm. in particular the talk about fixed length and variable length, parts:


A Huffman encoder takes a block of input characters with fixed length and produces a block of output bits of variable length. It is a fixed-to-variable length code. Lempel-Ziv, on the other hand, is a variable-to-fixed length code.

The design of the Huffman code is optimal (for a fixed blocklength) assuming that the source statistics are known a priori. The Lempel-Ziv code is not designed for any particular source but for a large class of sources.


the 2nd part there, would indicate that there's a huffman algorithm that works best for a 500 bytes long file, and another for 510 bytes long file and another for 501 etc.. !? you tailor the algorithm it once having counted the length maybe ? but then the length will be determined once you've taken a look at it, assuming it's not streaming data.

also surely lz compression's result, end product, is variable, not fixed. ?

"fixed-to-variable" and "variable-to-fixed". what are the two things being refered to in both of those statements exactly? just to be absolutely clear about my question: "x-to-y". what are x and y?

if x is simply refering to the input into the compression algorithm, and y is to the output, i don't understand it. doesn't seem to add up to me.

the amount of pattern and repetition, will determine the length of output in both cases i would have thought.

i've probably misunderstood something very basic there.

thanks.