Data Compression

Compressing your assets will let you fit more data on a cartridge. But which data should you compress, and how? What are the tradeoffs?

TODO: Link to decoding libraries / compression tools.

= Data Compression =

Any data can be compressed with a general-purpose data compression algorithm, such as Deflate. However, this is generally not as effective for media, like images, audio, or video.

= Images =


 * Raw


 * JPEG


 * HVQ

= Audio =

TODO: Calculate bit rates at different sample rates. Find samples for comparison or create a test ROM.

The microcode and audio libraries that come with LibUltra support PCM and VADPCM. TODO: What about LibDragon?


 * PCM: Baseline for comparison: 16 bits per sample. This is raw, uncompressed audio.


 * VADPCM: Used in many retail Nintendo 64 games. Always 4.5 bits per sample, encoded in blocks of 16 samples.


 * MP3: "Known to be possible." Used in some retail Nintendo 64 games, such as Conker's Bad Fur Day.


 * Music can also be stored in MOD or MIDI format, but this is not a type of compression.

Note that 1 MiB is 1024*1024 bytes, and 1 kbit is 1,000 bits.

= Video =

TODO: How easy is it to use these codecs? Are there code samples?


 * HVQM: "Known to be possible." Used by some retail Nintendo 64 games.


 * H.264: "Known to be possible." Giovanni Bajo is working on a port of Dragon's Lair, using H.264 for the video.