6 File formats

26.1733GPPANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codecRelease 17TS

This section describes the file formats used by the encoder and decoder programs. The test sequences defined in [1 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 14-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 320 samples) only.

This means that the encoder will only process n frames if the length of the input file is n*320 + k words, while the files produced by the decoder will always have a length of n*320 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 number per speech frame. Each line contains one of the mode numbers 0-8.

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 available formats.

NOTE ON DEFAULT 3GPP AND ITU BITSTREAM FORMATS:

ITU stream format gives very limited possibilities to distinguish NO_DATA and SID_FIRST frame types at the beginning of a stream. In some very limited cases for which some instance between encoder and decoder cuts of the first hangover period frames (e.g. handovers, editing of the stream), the output of the decoder is different depending on the stream format, ITU or default 3GPP.

Default 3GPP format:

This is the default format used in 3GPP. This format shall be used when the codec is tested against the test vectors.

TYPE_OF_FRAME_TYPE

FRAME_TYPE

MODE

B1

B2

Bnn

Each box corresponds to one Word16 value in the bitstream file, for a total of 3+nn words or 6+2nn bytes per frame, where nn is the number of encoded bits in the frame. Each encoded bit is represented as follows: Bit 0 = 0xff81, Bit 1 = 0x007f. The fields have the following meaning:

TYPE_OF_FRAME_TYPE transmit frame type, which is one of
TX_TYPE (0x6b21)
RX_TYPE (0x6b20)

If TYPE_OF_FRAME_TYPE is TX_TYPE,

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

If TYPE_OF_FRAME_TYPE is RX_TYPE,

FRAME_TYPE transmit frame type, which is one of
RX_SPEECH_GOOD (0x0000)
RX_SPEECH_PROBABLY_DEGRADED (0x0001)
RX_SPEECH_LOST (0x0002)
RX_SPEECH_BAD (0x0003)
RX_SID_FIRST (0x0004)
RX_SID_UPDATE (0x0005)
RX_SID_BAD (0x0006)
RX_NO_DATA (0x0007)

B0…B2nn speech encoder parameter bits (i.e. the bitstream itself). Each Bx either has the value 0x0081 (for bit 0) or 0x007F (for bit 1).

MODE_INFO encoding mode information, which is one of
6.60 kbit/s mode (0x0000)
8.85 kbit/s mode (0x0001)
12.65 kbit/s mode (0x0002)
14.25 kbit/s mode (0x0003)
15.85 kbit/s mode (0x0004)
18.25 kbit/s mode (0x0005)
19.85 kbit/s mode (0x0006)
23.05 kbit/s mode (0x0007)
23.85 kbit/s mode (0x0008)

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

ITU format (activated with command line parameter -itu)

SYNC_WORD

DATA_LENGTH

B1

B2

Bnn

Each box corresponds to one Word16 value in the bitstream file, for a total of 2+nn words or 4+2nn bytes per frame, where nn is the number of encoded bits in the frame. Each encoded bit is represented as follows: Bit 0 = 0x007f, Bit 1 = 0x0081. The fields have the following meaning:

SYNC_WORD Word to ensure correct frame synchronization between the encoder and the decoder. It is also used to indicate the occurrences of bad frames.

In the encoder output: (0x6b21)
In the decoder input: Good frames (0x6b21)
Bad frames (0x6b20)

DATA_LENGTH Length of the speech data. Codec mode and frame type is extracted in the decoder using this parameter:

DATA
_LENGTH


PREVIOUS FRAME


CODEC MODE


FRAMETYPE

0

RX_SPEECH_GOOD/ RX_SPEECH_LOST

DTX

RX_SID_FIRST

0

OTHER THAN

RX_SPEECH_GOOD/
RX_SPEECH_LOST

DTX

RX_NO_DATA

35

DTX

RX_SID_UPDATE

132

6.60 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

177

8.85 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

253

12.65 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

285

14.25 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

317

15.85 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

365

18.25 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

397

19.85 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

461

23.05 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

477

23.85 kbit/s

RX_SPEECH_GOOD/
RX_SPEECH_LOST

MIME/file storage format (activated with command line parameter -mime)

Detailed description of the AMR-WB single channel MIME/file storage format can be found in [7] (sections 5.1 and 5.3). This format is used e.g. by the Multimedia Messaging Service (MMS).

Annex A (informative):
Change history

Change history

Date

TSG #

TSG Doc.

CR

Rev

Subject/Comment

Old

New

03-2001

11

SP-010083

Version 2.0.0 provided for approval

5.0.0

06-2001

12

SP-010307

001

1

Unnecessary printing in Az_isp-function

5.0.0

5.1.0

06-2001

12

SP-010307

002

1

Overflow in isp_az.c

5.0.0

5.1.0

06-2001

12

SP-010307

003

1

Error in the ISF extrapolation in 6.60 kbit/s mode

5.0.0

5.1.0

06-2001

12

SP-010307

004

1

14-bit masking to decoder

5.0.0

5.1.0

06-2001

12

SP-010307

005

1

Correction of the homing function

5.0.0

5.1.0

06-2001

12

SP-010307

006

1

Fixed codebook initialisation

5.0.0

5.1.0

06-2001

Minor editorial to cover page

5.1.0

5.1.1

09-2001

13

SP-010455

007

Error in the C-code of the encoder homing function

5.1.1

5.2.0

09-2001

13

SP-010455

008

Inconsistency in the file format description

5.1.1

5.2.0

12-2001

14

SP-010699

009

Incorrect mode usage during DTX

5.2.0

5.3.0

12-2001

14

SP-010699

010

Correction of decoder homing function for 23.85 kbit/s mode

5.2.0

5.3.0

03-2002

15

SP-020081

011

2

Correction of mode reading and memory usage

5.3.0

5.4.0

03-2002

15

SP-020081

012

Correction of pitch calculation of AMR-WB encoder

5.3.0

5.4.0

03-2002

15

SP-020081

013

Error concealment of high band gain in 23.85 kbit/s mode

5.3.0

5.4.0

12-2002

18

SP-020692

014

Correction of ambiguous expression in the AMR-WB C-Code

5.4.0

5.5.0

03-2003

19

SP-030089

015

2

Harmonization of 3GPP TS 26.173 and ITU-T G.722.2 C-codes

5.5.0

5.6.0

03-2003

19

SP-030089

016

Correction for handling of RX_NO_DATA frames

5.5.0

5.6.0

06-2003

20

SP-030216

017

1

MMS compatible input/output option for fixed-point AMR-WB source code

5.6.0

5.7.0

Added file containing the C-code accidentally omitted from previous version

5.7.0

5.7.1

09-2003

21

SP-030446

019

Possible decoder LPC coefficients overflow

5.7.1

5.8.0

12-2004

26

SP-040844

020

1

Incorrect definition of vector nb_of_bits

5.8.0

6.0.0

12-2006

34

SP-060846

0023

1

Correction to bug in ITU-T bitstream format in the presence of frame erasures

6.0.0

6.1.0

03-2007

35

SP-070023

0025

1

Correct text specification to be aligned with the C-code

6.1.0

6.2.0

03-2007

35

SP-070029

0026

Correction in AMR decoder to avoid division by zero in RX-DTX Handling

6.2.0

7.0.0

09-2007

37

SP-070626

0029

1

Robust operation of AMRWB-decoder

7.0.0

7.1.0

12-2008

42

Version for Release 8

7.1.0

8.0.0

12-2009

46

Version for Release 9

8.0.0

9.0.0

03-2011

51

Version for Release 10

9.0.0

10.0.0

09-2012

57

Version for Release 11

10.0.0

11.0.0

09-2014

65

Version for Release 12

11.0.0

12.0.0

03-2015

67

SP-150094

0030

2

Correction on AMR-WB (noise energy initialization)

12.0.0

12.1.0

03-2015

67

SP-150094

0031

2

Correction on AMR-WB (out-of-bound memory access)

12.0.0

12.1.0

12-2015

70

Version for Release 13

12.1.0

13.0.0

03-2016

71

SP-160077

0032

1

Correction of AMR-WB

13.0.0

13.1.0

Change history

Date

Meeting

TDoc

CR

Rev

Cat

Subject/Comment

New version

2017-03

75

Version for Release 14

14.0.0

2017-12

78

SP-170822

0033

F

Correcting capitalizations of file and table names

14.1.0

2018-06

80

F

Version for Release 15

15.0.0

2018-12

82

SP-180973

0034

F

Correction of table names

15.1.0

2020-07

Update to Rel-16 version (MCC)

16.0.0

2022-04

Update to Rel-17 version (MCC)

17.0.0