Quote:
Originally Posted by bieliqus
I'm new to compression and i wonder if i can use game compression methods to compress other files like pdf or media (avi, jpg etc).
|
In general, the answer is "no". In particular, PDF and JPEG are old standards so they have to rely on old algorithms to remain compatible with files created years or decades ago.
PDF compression methods are:
- RLE (run length encoding);
- LZW (Lempel-Ziv-Welch, modified from Lempel & Ziv's original LZ77 [from 1977!]);
- deflate (gzip, zip; mostly LZ77 plus Huffman encoding).
JPEG:
- DCT (discrete cosine transformation; not a compression method in itself, it rather "smooths" the picture so that it can be compressed better; it also results in "artifacts", the loss of original fine details and emergence of fine details that weren't originally there);
- RLE;
- Huffman encoding or arithmetic coding.
AVI is not a compression method but a container format. You can put into it video and audio compressed, in theory, with
any compression algorithm ("codec" = encoding/decoding). The codec's code ("FourCC" = four character code) is stored in the AVI header; upon reading this information, the player will have to decide how to decompress the video and audio. Common (not all!) AVI video codecs are: MPEG-4 (DivX, XviD), H.264 (MPEG-4 AVC) and MJPEG (Motion JPEG); common audio codes: MP3, AC3 and DTS.
Games, on the other hand, don't have to be compatible with anything else as they contain their own decompression algorithms. This algorithm can be the very latest, sometimes with bugs.

Established standards can't afford that.