3.1.3. ETSI basic operations

The European Telecommunications Standard Institute (ETSI) has produced several recommendations for the coding of speech, for example, the G.723.1 and G.729 recommendations. These recommendations include source code and test sequences for reference implementations of the codecs.

Model implementations of speech codecs supplied by the ETSI are based on a collection of C functions known as the ETSI basic operations. The ETSI basic operations include 16-bit, 32-bit and 40-bit operations for saturated arithmetic, 16-bit and 32-bit logical operations, and 16-bit and 32-bit operations for data type conversion.


Version 2.0 of the ETSI collection of basic operations, as described in the ITU-T Software Tool Library 2005 User's manual, introduces new 16-bit, 32-bit and 40 bit-operations. These operations are not currently supported in RVCT.

The ETSI basic operations serve as a set of primitives for developers publishing codec algorithms, rather than as a library for use by developers implementing codecs in C or C++. RVCT provides support for the ETSI basic operations through the header file dspfns.h.

ETSI operations in RVCT

The dspfns.h header file contains definitions of the ETSI basic operations as a combination of C code and intrinsics. RVCT supports the original ETSI family of basic operations described in the ETSI G.729 recommendation Coding of speech at 8 kbit/s using conjugate-structure algebraic-code-excited linear prediction (CS-ACELP), including:

  • 16-bit and 32-bit saturated arithmetic operations, such as add and sub. For example, add(v1, v2) adds two 16-bit numbers v1 and v2 together, with overflow control and saturation, returning a 16-bit result.

  • 16-bit and 32-bit multiplication operations, such as mult and L_mult. For example, mult(v1, v2) multiplies two 16-bit numbers v1 and v2 together, returning a scaled 16-bit result.

  • 16-bit arithmetic shift operations, such as shl and shr. For example, the saturating left shift operation shl(v1, v2) arithmetically shifts the 16-bit input v1 left v2 positions. A negative shift count shifts v1 right v2 positions.

  • 16-bit data conversion operations, such as extract_l, extract_h, and round. For example, round(L_v1) rounds the lower 16 bits of the 32-bit input L_v1 into the most significant 16 bits with saturation.


    Beware that both the dspfns.h header file and the ISO C99 header file math.h both define (different versions of) the function round(). Take care to avoid this potential conflict.

See the header file dspfns.h for a complete list of the ETSI basic operations supported in RVCT.

For more information see:

  • ETSI Recommendation G.191: Software tools for speech and audio coding standardization

  • ITU-T Software Tool Library 2005 User's manual, included as part of ETSI Recommendation G.191

  • ETSI Recommendation G723.1: Dual rate speech coder for multimedia communications transmitting at 5.3 and 6.3 kbit/s

  • ETSI Recommendation G.729: Coding of speech at 8 kbit/s using conjugate-structure algebraic-code-excited linear prediction (CS-ACELP).

These documents are available from ITU-T, the telecommunications bureau of the ITU, at http://www.itu.int.

Overflow and carry

The implementation of the ETSI basic operations in dspfns.h exposes the status flags Overflow and Carry. These flags are available as global variables for use in your own C or C++ programs. For example:

#include <dspfns.h>                  /* include ETSI intrinsics */
#include <stdio.h>
const int BUFLEN=255;
int a[BUFLEN], b[BUFLEN], c[BUFLEN];
Overflow = 0;                        /* clear overflow flag */
for (i = 0; i < BUFLEN; ++i) {
    c[i] = L_add(a[i], b[i]);        /* saturated add of a[i] and b[i] */

if (Overflow)
    fprintf(stderr, "Overflow on saturated addition\n");

Generally, saturating functions have a sticky effect on overflow. That is, the overflow flag remains set until it is explicitly cleared. For more information, see the header file dspfns.h.

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H