6 File formats

06.733GPPAdaptive Multi Rate (AMR) speechANSI-C code for the AMR speech codecTS

This section describes the file formats used by the encoder and decoder programs. The test sequences defined in [2] also use the file formats described here.

6.1 Speech file (encoder input / decoder output)

Speech files read by the encoder and written by the decoder consist of 16-bit words where each word contains a 13-bit, left aligned speech sample. The byte order depends on the host architecture (e.g. MSByte first on SUN workstations, LSByte first on PCs etc.). Both the encoder and the decoder program process complete frames (of 160 samples) only.

This means that the encoder will only process n frames if the length of the input file is n*160 + k words, while the files produced by the decoder will always have a length of n*160 words.

6.2 Mode control file (encoder input)

The encoder program can optionally read in a mode control file which specifies the encoding mode for each frame of speech processed. The file is a text file containing one line per speech frame. Each line contains one of the mode names from the list {MR475, MR515, MR59, MR67, MR74, MR795, MR102, MR122}.

6.3 Parameter bitstream file (encoder output / decoder input)

The files produced by the speech encoder/expected by the speech decoder contain an arbitrary number of frames in the following format:

FRAME_TYPE

B1

B2

B244

MODE_INFO

unused1

unused4

Each box corresponds to one Word16 value in the bitstream file, for a total of 250 words or 500 bytes per frame. The fields have the following meaning:

FRAME_TYPE transmit frame type, which is one of
TX_SPEECH (0x0000)
TX_SID_FIRST (0x0001)
TX_SID_UPDATE (0x0002)
TX_NO_DATA (0x0003)

B0…B244 speech encoder parameter bits (i.e. the bitstream itself). Each Bx either has the value 0x0000 or 0x0001. Only mode MR122 really uses all 244 bits; for the other modes, only the first n bits are used (35  n204). The remaining bits are unused (written as 0x0000)

MODE_INFO encoding mode information, which is one of
MR475 (0x0000)
MR515 (0x0001)
MR59 (0x0002)
MR67 (0x0003)
MR74 (0x0004)
MR795 (0x0005)
MR102 (0x0006)
MR122 (0x0007)

unused1…4 unused, written as 0x0000.

As indicated in subclause 6.1, the byte order depends on the host architecture.

Annex A (informative):
Change Request History

SMG#

Tdoc SMG

Spec

CR

Cat

PH

Vers

New
Vers

Subject

s29

420/99

06.73

A001

B

R98

7.0.0

7.1.0

Introduction of codec homing procedure

s29

420/99

06.73

A002

F

R98

7.0.0

7.1.0

Correction to Bit Exact Implementation of Gain Calculation in Adaptive Gain Control (agc) for 12.2 and 7.4 kbit/s Mode

s29

420/99

06.73

A003

F

R98

7.0.0

7.1.0

Correction to the bit stream output file format used by the speech encoder

s29

420/99

06.73

A004

F

R98

7.0.0

7.1.0

Correction to Bit Exact Implementation of Levinson Algorithm for 12.2 kbit/s mode

s29

420/99

06.73

A005

F

R98

7.0.0

7.1.0

Correction to LSP vector initialization

s29

420/99

06.73

A006

D

R98

7.0.0

7.1.0

Documentation of encoder/decoder file formats

s29

420/99

06.73

A007

F

R98

7.0.0

7.1.0

Correction to list of decoder static variables

s29

420/99

06.73

A008

F

R98

7.0.0

7.1.0

Correction to DTX decoder LSF history buffer update

s29

420/99

06.73

A009

F

R98

7.0.0

7.1.0

Correction to bit exact implementation of decoder synthesis filter instability protection

s29

420/99

06.73

A010

F

R98

7.0.0

7.1.0

AMR VAD/DTX Description

s30

630/99

06.73

A011

F

R98

7.1.0

7.2.0

Input buffer initialisation routine added

s30

630/99

06.73

A012

F

R98

7.1.0

7.2.0

Initialization of stat_count in vad1.c

s30

630/99

06.73

A013

F

R98

7.1.0

7.2.0

Correction of algebraic code vector generation in both encoder and decoder

s30

630/99

06.73

A014

F

R98

7.1.0

7.2.0

Use of random excitation when RX_NODATA and not in DTX

s30

630/99

06.73

A015

F

R98

7.1.0

7.2.0

Correction to Bit Exact Implementation of vad_cnst.h

s30

630/99

06.73

A016

F

R98

7.1.0

7.2.0

Correction to Bit Exact Implementation of cor_h_x for 10.2 kbit/s mode

s30

630/99

06.73

A017

F

R98

7.1.0

7.20

Correction to Bit Exact Implementation of dtx_dec

s30

630/99

06.73

A018

F

R98

7.1.0

7.2.0

Correction to Bit Exact Implementation of cod_amr.c

s30

630/99

06.73

A019

F

R98

7.1.0

7.2.0

Correction to Bit Exact Implementation of gain quantization algorithm for 4.75 kbit/s mode

sa6

SP-99570

06.73

A20

F

R98

7.2.0

7.3.0

Correction to reset function in AMR decoder

sa7

SP-000025

06.73

A21

F

R98

7.3.0

7.4.0

Avoidance of pulse cancellation in FCB excitation

06.73

7.4.0

7.4.1

Version update to 7.4.1 for Publication