1. Introduction

The N64 JPEG library is an adapted version of the useful elements of the JPEG compression method customized for use in N64 game development.

The N64 JPEG library uses the Huffman entropy encoding method for data compression.

Huffman Method

The Huffman method stores redundancy information, so it uses fewer bits to express data that appears frequently.

As a result, the size of the compressed data is kept very small. Typically you can compress the original file down to 10% of its original size. Depending on the image, you may even be able to compress the file down to 5% of its original size. However, the speed of decompressing the compressed data slows things down. It typically takes more than 80 ms to decompress a 320x240 compressed image. Of course, the decompressing speed will vary depending on the image.

The N64 JPEG library consists of library functions, microcode, and tools. There are two library functions that you can use for entropy encoding and decoding.

to encode using the Huffman method.

to decode data that was encoded using the Huffman method.

There are two microcode object files that you can use for encoding and decoding.

Use the njpgespMain.o microcode to complete the YUV conversion, culling, DCT, quantization, and zigzag scanning processes on RGBA-formatted image data. It outputs entropy encodable data.

Use the njpgdspMain.o microcode to do reverse-zigzag scanning, reverse-quantization, and reverse-DCT to create entropy decoded (decompressed) data. It outputs data in YUV form.

There are tools that you can use to compress an image to the proper form.

Use the njpgCompress tool compresses an image to the N64 JPEG form.

Use the njpgMakeSlide tool compresses one or more images to the N64 JPEG form, and puts them into a file.