SMJPEG IMA ADPCM

From MultimediaWiki
Jump to navigation Jump to search

SMJPEG stands for SDL Motion JPEG. It is an animation format used by Loki Software for porting computer games (and their full motion video) to Linux. SMJPEG is a chunked file format which uses FOURCCs to identify blocks in the file as well as audio and video codecs. The only known video FOURCC used is 'JFIF' for JPEG. The only known audio FOURCC is 'APCM' for ADPCM.

The ADPCM algorithm is standard IMA ADPCM data. Compressed audio data comes packaged in 'sndD' chunks within the SMJPEG file. Each chunk is stamped with a millisecond presentation timestamp and a data length, which is usually 0x104 bytes. The first 4 bytes are the initial conditions for decoding the ADPCM block:

bytes 0-1  initial predictor, big endian format
byte 2     initial index
byte 3     unused 

The remainder of the data bytes in the chunk are ADPCM nibbles to be decoded with the standard ADPCM algorithm. The low nibble is decoded first (bits 3-0), then the high nibble.

Note that the SMJPEG format description apparently supports stereo. No stereo SMJPEG samples have been encountered at the time of this writing. It is unknown how the format would store stereo data.