9.145 ETSI basic operations

The compilation tools support the original ETSI family of basic operations through intrinsics.

The original ETSI family of basic operations are described in the ETSI G.729 recommendation Coding of speech at 8 kbit/s using conjugate-structure algebraic-code-excited linear prediction (CS-ACELP).
To make use of the ETSI basic operations in your own code, include the standard header file dspfns.h. The intrinsics supplied in dspfns.h are listed in the following table.

Table 9-15 ETSI basic operations that the ARM compilation tools support

Intrinsics
abs_s L_add_c L_mult L_sub_c norm_l
add L_deposit_h L_negate mac_r round
div_s L_deposit_l L_sat msu_r saturate
extract_h L_mac L_shl mult shl
extract_l L_macNs L_shr mult_r shr
L_abs L_msu L_shr_r negate shr_r
L_add L_msuNs L_sub norm_s sub
The header file dspfns.h also exposes certain status flags as global variables for use in your C or C++ programs. The status flags exposed by dspfns.h are listed in the following table.

Table 9-16 ETSI status flags exposed in the ARM compilation tools

Status flag Description
Overflow
Overflow status flag.
Generally, saturating functions have a sticky effect on overflow.
Carry
Carry status flag.

Example

#include <limits.h>
#include <stdint.h>
#include <dspfns.h>       // include ETSI basic operations
int32_t C_L_add(int32_t a, int32_t b)
{
    int32_t c = a + b;
    if (((a ^ b) & INT_MIN) == 0)
    {
        if ((c ^ a) & INT_MIN)
        {
            c = (a < 0) ? INT_MIN : INT_MAX;
        }
    }
    return c;
}
__asm int32_t asm_L_add(int32_t a, int32_t b)
{
    qadd r0, r0, r1
    bx lr
}
int32_t foo(int32_t a, int32_t b)
{
    int32_t c, d, e, f;
    Overflow = 0;         // set global overflow flag
    c = C_L_add(a, b);    // C saturating add
    d = asm_L_add(a, b);  // assembly language saturating add
    e = __qadd(a, b);     // ARM intrinsic saturating add
    f = L_add(a, b);      // ETSI saturating add
    return Overflow ? -1 : c == d == e == f; // returns 1, unless overflow
}
Related concepts
3.9 Compiler support for European Telecommunications Standards Institute (ETSI) basic operations
Related information
ETSI Recommendation G.191: Software tools for speech and audio coding standardization
ETSI Recommendation G.729: Coding of speech at 8 kbit/s using conjugate-structure algebraic-code-excited linear prediction (CS-ACELP)
ETSI Recommendation G723.1 : Dual rate speech coder for multimedia communications transmitting at 5.3 and 6.3 kbit/s
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.