4 C code structure

06.533GPPANSI-C code for the GSM Enhanced Full Rate (EFR) speech codecTS

This clause gives an overview of the structure of the bit‑exact C code and provides an overview of the contents and organization of the archive en_300724v080000o0.ZIP which accompanies the present document.

The C code has been verified on the following systems:

‑ Sun Microsystems [1]1) workstations and Sun Microsystems cc compiler and gcc compiler;

‑ IBM [2]2) PC/AT compatible computers and Borland Turbo‑C++ [3]3) compiler;

‑ Hewlett Packard’s [4]4) workstations and HP cc compiler;

ANSI‑C 9899 was selected as the programming language because portability was desirable.

4.1 Contents of the C source code disk

The C code disk has all of the files in the root level.

In this disk, the files with suffix "c" contain the source code and the files with suffix "h" are the header files. The ROM data is contained mostly in files with suffix "tab". All text files are formatted such that they are correct for an IBM PC/AT compatible.

The archive en_300724v080000o0.ZIP which accompanies the present document contains one speech coder installation verification data file, "spch_dos.inp". The reference encoder output file is named "spch_dos.cod", the reference decoder input file is named "spch_dos.dec" and the reference decoder output file is named "spch_dos.out". These four files are formatted such that they are correct for an IBM PC/AT compatible. The same files with reversed byte order of the 16 bit words are named "spch_unx.inp", "spch_unx.cod", "spch_unx."dec" and "spch_unx.out", respectively.

In an IBM PC/AT compatible platform, the installation verification can be performed by running the batch file "ts_dos.bat". In most UNIX platforms, the installation verification can be performed by running the batch file "ts_unx.bat". Final verification is to be performed using the GSM Enhanced Full Rate test sequences described in GSM 06.54 [2].

Makefiles are provided for the three platforms in which the C code has been verified (listed above). Once the software is installed, this directory will have compiled versions of coder and decoder (the bit‑exact C executables of the speech codec), ed_iface (interface program between coder and decoder) and all the object files.

The programs coder and decoder are the GSM Enhanced Full Rate encoder and decoder executable files, respectively. A third program, ed_iface, is also contained in this directory. This is the program which provides the format conversion between the encoder output file format and the decoder input file format.

4.2 Program execution

The GSM enhanced full rate speech codec is implemented as three separate programs:

‑ (coder) speech encoder;

(ed_iface) encoder/decoder interface;

‑ (decoder) speech decoder.

For encoding using the coder program, the input is a binary speech file (*.inp) and the output is a binary encoded parameter file (*.cod). For decoding using the decoder program, the input is a binary parameter file (*.dec) and the output is a binary synthesized speech file (*.out).

NOTE: The format for the parameter input file required for decoding (*.dec) is not the same as the format of the parameter output file generated by encoding (*.cod). The ed_iface program will translate an *.cod file into a *.dec file.

See the file readme.txt for more information on how to run the coder, ed_iface and decoder programs.

4.3 Code hierarchy

Figures 1 to 5 are call graphs that show the functions used in the speech codec, including the functions of VAD, DTX, and comfort noise generation.

The encode call graph is broken down into three separate call graphs, and the decode call graph is broken down into two separate call graphs. Those clauses which are large are separated from the primary call tree and given their own call tree. Each vertical column represents a call level. For example, main() is at level 0, Coder_12k2() at level 1, Int_lpc2() at level 2, Lsp_Az() at level 3, Get_lsp_pol() at level 4, etc. The basic operations are not counted as extending the depth, therefore the deepest level in this software is level 4.

Some items have been omitted from this call graph. All standard C functions: printf(), fwrite(), etc. have been omitted. Also, no basic operations (add(), L_add(), mac(), etc.) or double precision extended operations (e.g. L_Extract()) appear in the graphs. The reset functions of the encoder and decoder are only visible as the functions reset_enc and reset_dec, respectively. There are several subroutine calls from inside these functions.

The time order in the call graphs is from the bottom upwards as the processing of a frame advances.

Figure 1: Speech encoder call graph (see figures 2 and 3)

Figure 2: Speech encoder subframe processing call graph

Figure 3: Voice Activity Detector (VAD) call graph

Figure 4: Speech decoder call graph (see figure 5)

Figure 5: Speech decoder postfilter call graph

Annex A (informative):
Change Request History

Change history


TDoc. No.

CR. No.

Clause affected

New version




ETSI Publication



Release 1996 version



Release 1997 version



Release 1998 version


Version update to 7.0.1 for Publication



Release 1999 version


Update to Version 8.0.1 for Publication