EALayer3

From MultimediaWiki
Jump to navigation Jump to search

EALayer3 is a codec derived from MPEG-1 Audio. It exists in 2 known variants, EL31 and L32P. EL31 files have the following header for each granule:

8 bits - nonzero value here indicates the presence of uncompressed samples at the end of the granule.
2 bits - MPEG version
2 bits - MPEG sample rate index
2 bits - MPEG channel mode
2 bits - MPEG mode extension
1 bit - which granule
if granule is 1 and version is 3 (MPEG 1.0):
channels * 4 bits - MPEG scfsi
MPEG side info beginning after scfsi for each channel
MPEG data
if there are uncompressed samples
32 bits - number of uncompressed sample frames
32 bits - offset in the outputted granule these samples go
channels * uncompressed * 16 bits - uncompressed PCM samples

L32P files have the following header for each granule:

1 bit - there is an extended header
1 bit - unknown
2 bits - unused
12 bits - total granule size including this small header and uncompressed samples
if extended header:
2 bits - mode
10 bits - sample frames to discard (mode == 0) or skip (mode == 1 or 2) before outputting the uncompressed samples
10 bits - number of uncompressed sample frames at the end of the granule
10 bits - granule size (can be zero)
end extended header
2 bits - MPEG version
2 bits - MPEG sample rate index
2 bits - MPEG channel mode
2 bits - MPEG mode extension
1 bit - which granule
if granule is 1 and version is 3 (MPEG 1.0):
channels * 4 bits - MPEG scfsi
MPEG side info beginning after scfsi for each channel
MPEG data
if there are uncompressed samples
channels * uncompressed * 16 bits - uncompressed PCM samples

Other Electronic Arts games use EALayer3 audio inside other container formats but the details of that variant of the codec is not described here.

Code (under the BSD license) to decode EALayer3 audio can be found here