views:

443

answers:

4

Does anyone of you know a lossless compression algorithm, which produces headerless outputs? For example do not store the huffman tree used to compress it? I do not speak about hard coded huffman trees, but I like to know if there is any algorithm that can compress and decompress input without storing some metadata in its output. Or is this even theoretically impossible?

+4  A: 

Run Length Encoding would be one example

Rowland Shaw
Even RLE requires some knowledge of what the data is and how the RLE is encoded. The decompression algorithm needs to know if it was counting bits, or bytes, colors, or sound samples, etc.
Adam Davis
That is either hard coded into the compression/decompression algorithm itself, or headers.
Adam Davis
Yes, but generally it's hard-coded in the algorithm, whereas the tables for huffman coding are generally stored with the compressed data.
Douglas Leeder
+4  A: 

Of course it is posible. Among others, the LZ family of compressors don't need to output anything apart from the compressed data itself, as the dictionary is built on-line as compression (or decompression) progress. You have a lot of reference implementations for those LZ-type algorithms. For example, LZMA, component of 7zip.

Diego Sevilla
A: 

lzo springs to mind. it's used in OpenVPN, with great results

Javier
+2  A: 

Adaptive Huffman coding does exactly that. More generally, the term adaptive coding is used to describe entropy codes with this property. Some dictionary codes have this property too, e.g. run-length encoding (RLE) and Lempel-Ziv-Welch (LZW).

Zach Scrivena