Interplay ACMP: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (correct categories)
(fill at least some details)
 
Line 2: Line 2:
* Samples: http://samples.mplayerhq.hu/game-formats/interplay-acmp/
* Samples: http://samples.mplayerhq.hu/game-formats/interplay-acmp/


Interplay ACMP is an audio compression file format used in some games from Interplay. The specific audio coding format is presently unknown but is suspected to be [[ACOMP]].
Interplay ACMP is an audio compression file format used in some games from Interplay. The name is shortened "AUDCOMP" and it employs [[DPCM]] with variable-length coding for compressing 8-bit PCM.


== Interplay ACMP Format ==
== Interplay ACMP Format ==
Line 14: Line 14:
  bytes 26-29  possibly the size of decompressed audio
  bytes 26-29  possibly the size of decompressed audio
  bytes 30..  suspected to be the encoded audio data
  bytes 30..  suspected to be the encoded audio data
== Audio data coding ==
Audio seems to be coded in blocks of 256 samples (or less for the last block). Each block starts with 8-bit header:
* 1 bit - audio is transformed and only half of the samples are transmitted;
* 2 bits - quantisation step
* 5 bits - coding mode (0-6)
In general, block data is compressed by first taking differences (initial value is 0x80), quantising it by discarding low bits and coding in one of several ways. Some encoding modes use so-called tally code which is an unary code for <code>min(value, 10)</code> and with optional 6-bit full value written afterwards (for values 10 and above). Also deltas are often coded as absolute values with a sign bit following.
Coding modes are:
* 0 - constant block, first sample is coded as is;
* 1 - deltas are coded as <code>tally(ilog2(|delta|)) |delta| sign</code> (or <code>tally(1)</code> for zero delta);
* 2 - deltas are coded as 4-bit fields, those that do not fit coded as 0 nibble plus <code>8 - quant_bits</code> bits for the actual delta value;
* 3 - deltas are coded as <code>tally((|diff| >> 2) + 1) |diff|&3 sign</code>;
* 4 - the same as previous but with 3 low bits coded raw;
* 5 - delta 0 is coded as <code>00</code>, delta 1 is coded as <code>01</code>, other deltas are coded as <code>10 tally(ilog2(|diff| - 1)) (|diff| - 1) sign</code>;
* 6 - simply write raw quantised differences using <code>8 - quant_bits</code> bits for each.


== Games Using Interplay ACMP Files ==
== Games Using Interplay ACMP Files ==
Line 20: Line 37:
[[Category:Audio Codecs]]
[[Category:Audio Codecs]]
[[Category:Game Formats]]
[[Category:Game Formats]]
[[Category:Undiscovered Audio Codecs]]
[[Category:Incomplete Audio Codecs]]

Latest revision as of 07:56, 28 August 2023

Interplay ACMP is an audio compression file format used in some games from Interplay. The name is shortened "AUDCOMP" and it employs DPCM with variable-length coding for compressing 8-bit PCM.

Interplay ACMP Format

Multi-byte numbers are stored in big endian format.

bytes 0-19   Signature string: 'Interplay ACMP Data\x1A'
bytes 20-21  sample rate
bytes 22-23  unknown, always seems to be 0 and might be part of sample rate
byte  24     unknown, always seems to be 0x28
byte  25     unknown, always seems to be 0
bytes 26-29  possibly the size of decompressed audio
bytes 30..   suspected to be the encoded audio data

Audio data coding

Audio seems to be coded in blocks of 256 samples (or less for the last block). Each block starts with 8-bit header:

  • 1 bit - audio is transformed and only half of the samples are transmitted;
  • 2 bits - quantisation step
  • 5 bits - coding mode (0-6)

In general, block data is compressed by first taking differences (initial value is 0x80), quantising it by discarding low bits and coding in one of several ways. Some encoding modes use so-called tally code which is an unary code for min(value, 10) and with optional 6-bit full value written afterwards (for values 10 and above). Also deltas are often coded as absolute values with a sign bit following.

Coding modes are:

  • 0 - constant block, first sample is coded as is;
  • 1 - deltas are coded as tally(ilog2(|delta|)) |delta| sign (or tally(1) for zero delta);
  • 2 - deltas are coded as 4-bit fields, those that do not fit coded as 0 nibble plus 8 - quant_bits bits for the actual delta value;
  • 3 - deltas are coded as tally((|diff| >> 2) + 1) |diff|&3 sign;
  • 4 - the same as previous but with 3 low bits coded raw;
  • 5 - delta 0 is coded as 00, delta 1 is coded as 01, other deltas are coded as 10 tally(ilog2(|diff| - 1)) (|diff| - 1) sign;
  • 6 - simply write raw quantised differences using 8 - quant_bits bits for each.

Games Using Interplay ACMP Files