Skip to content

Files

Latest commit

 

History

History
 
 

Compress

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Compress


Compression Bare Metal Code by krom (Peter Lemon).

I have provided examples of LZ77 & Huffman decompression, compatible with the same standards used by
Nintendo GBA/DS bios decompression functions.
There is a simple minimal demo & a GFX demo for both LZ77 & Huffman.
The minimal demos decompress the Raspberry Pi logo to RAM.
The GFX demos decompress the Raspberry Pi logo to the screen.

The best LZ77/Huffman compressor I have found is called "Nintendo DS/GBA Compressors" by CUE.
You can find it here: http://www.romhacking.net/utilities/826/
It also includes full CPP source code for all of it's compressors.

Here is an url to the best explanation of LZ77/Huffman decompression I have found:
http://nocash.emubase.de/gbatek.htm#biosdecompressionfunctions

P.S The variant of LZ77 on GBA/NDS is sometimes called LZSS hence the naming scheme in this util,
but you will find that it is indeed LZ77 compatible data.

Huffman:
Command line used to compress data: "huffman -e8 RaspiLogo24BPP.bin"
Original data size: RaspiLogo24BPP.bin = 921600 bytes
Compress data size: RaspiLogo24BPP.huff = 241984 bytes

LZ77:
Command line used to compress data: "lzss -ewo RaspiLogo24BPP.bin"
Original data size: RaspiLogo24BPP.bin = 921600 bytes
Compress data size: RaspiLogo24BPP.lz = 135168 bytes

Many thanks to my friend Andy Smith, who helped me understand the Huffman decoding =D