G191 e
G191 e
G191 e
T e l e c o m m u n i c a t i o n
U n i o n
ITU-T
TELECOMMUNICATION STANDARDIZATION SECTOR OF ITU
G.191
(03/2010)
SERIES G: TRANSMISSION SYSTEMS AND MEDIA, DIGITAL SYSTEMS AND NETWORKS International telephone connections and circuits Software tools for transmission systems
ITU-T G-SERIES RECOMMENDATIONS TRANSMISSION SYSTEMS AND MEDIA, DIGITAL SYSTEMS AND NETWORKS INTERNATIONAL TELEPHONE CONNECTIONS AND CIRCUITS Transmission planning and the E-model General Recommendations on the transmission quality for an entire international telephone connection General characteristics of national systems forming part of international connections General characteristics of the 4-wire chain formed by the international circuits and national extension circuits General characteristics of the 4-wire chain of international circuits; international transit General characteristics of international telephone circuits and national extension circuits Apparatus associated with long-distance telephone circuits Transmission plan aspects of special circuits and connections using the international telephone connection network Protection and restoration of transmission systems Software tools for transmission systems GENERAL CHARACTERISTICS COMMON TO ALL ANALOGUE CARRIERTRANSMISSION SYSTEMS INDIVIDUAL CHARACTERISTICS OF INTERNATIONAL CARRIER TELEPHONE SYSTEMS ON METALLIC LINES GENERAL CHARACTERISTICS OF INTERNATIONAL CARRIER TELEPHONE SYSTEMS ON RADIO-RELAY OR SATELLITE LINKS AND INTERCONNECTION WITH METALLIC LINES COORDINATION OF RADIOTELEPHONY AND LINE TELEPHONY TRANSMISSION MEDIA AND OPTICAL SYSTEMS CHARACTERISTICS DIGITAL TERMINAL EQUIPMENTS DIGITAL NETWORKS DIGITAL SECTIONS AND DIGITAL LINE SYSTEM MULTIMEDIA QUALITY OF SERVICE AND PERFORMANCE GENERIC AND USERRELATED ASPECTS TRANSMISSION MEDIA CHARACTERISTICS DATA OVER TRANSPORT GENERIC ASPECTS PACKET OVER TRANSPORT ASPECTS ACCESS NETWORKS
For further details, please refer to the list of ITU-T Recommendations.
G.100G.199 G.100G.109 G.110G.119 G.120G.129 G.130G.139 G.140G.149 G.150G.159 G.160G.169 G.170G.179 G.180G.189 G.190G.199 G.200G.299 G.300G.399 G.400G.449 G.450G.499 G.600G.699 G.700G.799 G.800G.899 G.900G.999 G.1000G.1999 G.6000G.6999 G.7000G.7999 G.8000G.8999 G.9000G.9999
Recommendation ITU-T G.191 Software tools for speech and audio coding standardization
Summary This revision only introduces changes to ITU-T G.191 Annex A, which describes the ITU-T Software Tools (STL) containing a high-quality, portable C code library for speech processing applications. This new release of the STL dubbed STL2009 incorporates many changes in software and manual. The new sets of tools added are: ITU-T G.728 fixed-/floating-point executables, basic ITU-T G.722 frame-erasure concealments (G.722 PLC0 and PLC1), program ROM counting, floating point complexity evaluation, stereo operation and bitstream truncation. There have been also updates such as addition of new filters to rate change tools, more options added for frequency response calculations, adaptation of error-insertion device to embedded-variable bitstream, addition of impulse responses to the reverberation processing tool and update to make ITU-T G.722/ITU-T G.192 compliant. Corrections of several known problems have also been implemented. The associated STL user's manual has also been updated. This Recommendation includes an electronic attachment containing STL2009 Software Tool Library and manual.
History
Edition Recommendation 1.0 2.0 3.0 4.0 5.0 ITU-T G.191 ITU-T G.191 ITU-T G.191 ITU-T G.191 ITU-T G.191 Approval 1993-03-12 1996-11-11 2000-11-17 2005-09-13 2010-03-29 Study Group XV 15 16 16 16
FOREWORD The International Telecommunication Union (ITU) is the United Nations specialized agency in the field of telecommunications, information and communication technologies (ICTs). The ITU Telecommunication Standardization Sector (ITU-T) is a permanent organ of ITU. ITU-T is responsible for studying technical, operating and tariff questions and issuing Recommendations on them with a view to standardizing telecommunications on a worldwide basis. The World Telecommunication Standardization Assembly (WTSA), which meets every four years, establishes the topics for study by the ITU-T study groups which, in turn, produce Recommendations on these topics. The approval of ITU-T Recommendations is covered by the procedure laid down in WTSA Resolution 1. In some areas of information technology which fall within ITU-T's purview, the necessary standards are prepared on a collaborative basis with ISO and IEC.
NOTE In this Recommendation, the expression "Administration" is used for conciseness to indicate both a telecommunication administration and a recognized operating agency. Compliance with this Recommendation is voluntary. However, the Recommendation may contain certain mandatory provisions (to ensure e.g., interoperability or applicability) and compliance with the Recommendation is achieved when all of these mandatory provisions are met. The words "shall" or some other obligatory language such as "must" and the negative equivalents are used to express requirements. The use of such words does not suggest that compliance with the Recommendation is required of any party.
INTELLECTUAL PROPERTY RIGHTS ITU draws attention to the possibility that the practice or implementation of this Recommendation may involve the use of a claimed Intellectual Property Right. ITU takes no position concerning the evidence, validity or applicability of claimed Intellectual Property Rights, whether asserted by ITU members or others outside of the Recommendation development process. As of the date of approval of this Recommendation, ITU had not received notice of intellectual property, protected by patents, which may be required to implement this Recommendation. However, implementers are cautioned that this may not represent the latest information and are therefore strongly urged to consult the TSB patent database at http://www.itu.int/ITU-T/ipr/.
ITU 2010 All rights reserved. No part of this publication may be reproduced, by any means whatsoever, without the prior written permission of ITU.
ii
CONTENTS Page 1 2 3 General.......................................................................................................................... Software tools ............................................................................................................... License and copyright ................................................................................................... 1 1 1 2 19
Annex A List of software tools available.............................................................................. Annex B ITU-T software tools General Public License .......................................................
iii
Recommendation ITU-T G.191 Software tools for speech and audio coding standardization
1 General
In the process of generating speech and audio coding standards, the following situations often happen: a) In many cases, experimental results generated with different software tools may not be directly compared. b) Software tools used by different organizations may not perfectly conform to related ITU-T Recommendations, which may delay ITU-T standardization processes. c) ITU-T Recommendations may leave scope for different implementations. d) New speech and audio coding standards are increasing in complexity, leading to non-bitexact specifications; furthermore, appropriate testing procedures to assure interoperability of different implementations are needed. The need for a common set of tools has been recognized in past ITU-T standardization activities of speech algorithms. As a consequence, a library of portable, interworkable and reliable software routines has been established. 2 Software tools
To clarify the use of the set of software tools, arranged as a software tool library, the ITU-T makes the following recommendations: 1) The software tools specified in Annex A should be used as building modules of signal processing blocks to be used in the process of generation of ITU-T Recommendations, particularly those concerned with speech and audio coding algorithms. 2) Some of the tools shall be used in procedures for the verification of interoperability of ITU-T standards, mainly of speech and audio coding algorithms whose description is in terms of non-bitexact specifications. 3) The use of these modules should be made strictly in accordance with the technical instructions of their attached documentation, and should respect the following terms. 3 License and copyright
The modules in the ITU-T Software Tool Library (STL) are free software; they can be redistributed and/or modified under the terms of the "ITU-T software tools General Public License" of Annex B, as published by the ITU-T; this applies to any of the versions of the modules in the STL. The STL has been carefully tested and it is believed that both the modules and the example programs on their usage conform to their description documents. Nevertheless, the ITU-T STL is provided "as is", in the hope that it will be useful, but without any warranty. The STL is intended to help the scientific community to achieve new standards in telecommunications more efficiently, and for such must not be sold, entirely or in parts. The original developers, except where otherwise noted, retain ownership of their copyright, and allow their use under the terms and conditions of the "ITU-T software tools General Public License".
on the use of the ITU-T G.711 module. on the use of the ITU-T G.726 module. on the use of the ITU-T G.727 module on the use of the ITU-T G.722 module. on the use of the ITU-T G.728 floating-point encoder. on the use of the ITU-T G.728 floating-point decoder. on the use of the ITU-T G.728 fixed-point encoder. on the use of the ITU-T G.728 fixed-point decoder. on the use of the full-rate GSM 06.10 speech codec module. on the use of the speech voltmeter module, and also the gain/loss routine. on the use of the error insertion device for bit error insertion and frame erasure. on the use of the error insertion device for bit error insertion for layered bitstreams, which can be used to apply errors to individual layers in layered bitstreams such as ITU-T G.718 or ITU-T G.729.1. on the use of generating bit error pattern files for error insertion in ITU-T G.192-compliant serial bitstreams encoded files. on the use of fast switching rate profile generation tool. on the use of the FIR (finite impulse response) high-quality low-pass and band-pass filters and of the FIR-IRS filters, associated with the rate change module. on the use of the ITU-T G.712 (standard PCM) IIR (infinite impulse response) filters, associated with the rate change module. on the use of both the IIR and the FIR filters available in the rate change module. on the use of the narrow-band and wideband modulated noise reference unity (ITU-T P.81) module.
eiddemo.c
eid-ev.c
gen-patt.c
gen_rate_profile.c firdemo.c
pcmdemo.c
filter.c
mnrudemo.c
spdemo.c
on the use of the serialization and parallelization routines of the utility module. on the use of Appendix I/G.711 Packet Loss Concealment module. on the use of the reverberation module. on the use of the bitstream truncation module. on the use of the frequency response computation tool. on the use of stereo file operations.
g711iplc.c
NOTE The module for the Basic Operators does not have a demo program but it is supplemented by two tools: one to evaluate program ROM complexity for fixed-point code (basop_cnt.c), and another to evaluate complexity (including program ROM) of floating-point implementations (flc_example.c). Both reside in the Basic Operators module.
b)
initialize 16 kHz 1:1 SM weighting filter. initialize 2:1 low-pass down-sampling filter. initialize 3:1 low-pass down-sampling filter. initialize 1:2 low-pass up-sampling filter. initialize 1:3 low-pass up-sampling filter. initialize 8-kHz P.48 IRS weighting filter. initialize 16-kHz P.48 IRS weighting filter. initialize 2:1 bandpass down-sampling filter. initialize 1:2 bandpass up-sampling filter. initialize 1:1 bandpass filter. initialize 16-kHz send-side modified IRS weighting filter. initialize 48-kHz send-side modified IRS weighting filter. initialize 1:1 ITU-T O.41 psophometric weighting filter. initialize 1:1 ITU-T P.341 send-part weighting filter for data sampled at 16 kHz. initialize 16-kHz modified IRS receive-side weighting filter. initialize 8-kHz modified IRS receive-side weighting filter. initialize 8-kHz IRS weighting filter using the TIA coefficients. initialize 16-kHz IRS weighting filter with a half-tilt inclination within the ITU-T P.48 mask. initialize mobile station weighting filter. initialize 50-Hz to 5-kHz-bandpass filter (16 kHz sampling).
Rec. ITU-T G.191 (03/2010) 3
ht_irs_16khz_init
msin_16khz_init bp5k_16khz_init
bp100_5k_16khz_init
initialize a 100-Hz to 5-kHz-bandpass filter (16-kHz sampling). initialize a 50-Hz to 14-kHz-bandpass filter (32-kHz sampling). initialize a 20-Hz to 20-kHz-bandpass filter (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 1.5 kHz (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 3.5 kHz (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 7 kHz (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 10 kHz (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 12 kHz at (48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 14 kHz at 48-kHz sampling). initialize a low-pass filter with a cut-off frequency of 20 kHz (48-kHz sampling). FIR filtering function. clear state variables. deallocate FIR-filter memory.
bp14k_32khz_init
bp20k_48khz_init
LP1p5_48kHz_init
LP35_48kHz_init
LP7_48kHz_init
LP10_48kHz_init
LP12_48kHz_init
LP14_48kHz_init
LP20_48kHz_init
c)
parallel-form IIR kernel filtering routine. initialization of a parallel-form IIR standard PCM-filter for input and output data at 16 kHz. as "stdpcm_16khz_init( )", but needs input with sampling frequency of 8 kHz and returns data at 16 kHz. as "stdpcm_16khz_init( )", but needs input with sampling frequency of 16 kHz and returns data at 8 kHz. clear state variables (needed only if another signal should be processed with the same filter) for a parallel-form structure. deallocate filter memory for a parallel-form state variable structure. cascade-form IIR filtering routine. initialization of a cascade-form IIR standard PCM filter for data sampled at 8 kHz.
stdpcm_1_to_2_init
stdpcm_2_to_1_init
stdpcm_reset
stdpcm_free
iir_irs_8khz_init
initialization of a cascade-form IIR P.48 IRS filter for data sampled at 8 kHz. initialization of a cascade-form IIR low-pass filter for asynchronization filtering of data and downsampling by a factor of 3:1. initialization of a cascade-form IIR low-pass filter for asynchronization filtering of data and upsampling by a factor of 3:1. clear state variables (needed only if another signal should be processed with the same filter) for a cascade-form structure. deallocate filter memory for a cascade-form state variable structure. direct-form IIR filtering routine. Initialize a direct-form IIR filter structure for a 1:1 DC removal filtering. clear state variables (needed only if another signal should be processed with the same filter) for a direct-form structure. deallocate filter memory for a direct-form state variable structure.
iir_casc_1p_3_to_1_init
iir_casc_1p_1_to_3_init
cascade_iir_reset
cascade_iir_free
direct_iir_kernel iir_dir_dc_removal_init
direct_reset
direct_iir_free
d)
initializes the error pattern generator (for single-bit errors, burst bit-errors, or single frame erasures). initializes the burst frame erasure pattern generator. reinitializes the burst frame erasure pattern generator. generates a bit error sequence with properties defined by "open_eid". generates a random frame erasure sequence with properties, defined by "open_eid". generates a burst frame erasure sequence with properties, defined by "open_burst_eid". modifies the input data bits according to the error pattern, stored in a buffer. frame erasure module. frees memory allocated to the EID state variable buffer.
FER_generator_random
FER_generator_burst
BER_insertion
FER_module close_eid
e)
G.711 module
alaw_compress
compands 1 vector of linear PCM samples to A-law; uses 13 Most Significant Bits (MSBs) from input and 8 Least Significant Bits (LSBs) on output. expands 1 vector of A-law samples to linear PCM; uses 8 LSBs from input and 13 MSBs on output. compands 1 vector of linear PCM samples to -law; uses 14 MSBs from input and 8 LSBs on output. expands 1 vector of -law samples to linear PCM; uses 8 LSBs from input and 14 MSBs on output.
alaw_expand
ulaw_compress
ulaw_expand
f)
LowcFE Constructor. generate the synthetic signal. a good frame was received and decoded, add the frame to history buffer.
g)
G.726 module
ITU-T G.726 encoder at 40, 32, 24 and 16 kbit/s. ITU-T G.726 decoder at 40, 32, 24 and 16 kbit/s.
h)
module for addition of modulated noise to a vector of samples, according to Rec. ITU-T P.810, for both the narrow-band and the wideband models.
i)
initializes a speech voltmeter state variable. measurement of the active speech level of data in a buffer according to Rec. ITU-T P.56.
j)
gain/loss insertion algorithm. conversion of two's complement, 16-bit integer to floating point. conversion of two's complement, 15-bit integer to floating point. conversion of two's complement, 14-bit integer to floating point. conversion of two's complement, 13-bit integer to floating point. conversion of two's complement, 12-bit integer to floating point. generic function for conversion from integer to floating point. alternate (faster) implementation of sh2fl, with compulsory range conversion. conversion of floating point data to two's complement, 16-bit integer. conversion of floating point data to two's complement, 15-bit integer. conversion of floating point data to two's complement, 14-bit integer. conversion of floating point data to two's complement, 13-bit integer. conversion of floating point data to two's complement, 12-bit integer. generic function for conversion from floating point to integer. serialization for left-justified data. serialization for right-justified data. parallelization for left-justified data. parallelization for right-justified data.
sh2fl_15bit
sh2fl_14bit
sh2fl_13bit
sh2fl_12bit
sh2fl
sh2fl_alt
fl2sh_16bit
fl2sh_15bit
fl2sh_14bit
fl2sh_13bit
fl2sh_12bit
fl2sh
k)
G.722 module
ITU-T G.722 wideband speech encoder at 64 kbit/s. ITU-T G.722 wideband speech decoder at 64, 56 and 48 kbit/s. initialization of the ITU-T G.722 encoder state variable. initialization of the ITU-T G.722 decoder state variable.
g722_reset_encoder g722_reset_decoder
l)
RPE-LTP module
GSM 06.10 full-rate RPE-LTP speech encoder at 13 kbit/s. GSM 06.10 full-rate RPE-LTP speech decoder at 13 kbit/s. initialize memory for the RPE-LTP state variables. release memory previously allocated for the RPE-LTP state variables.
m)
G.727 module
ITU-T G.727 encoder at 40, 32, 24 and 16 kbit/s. ITU-T G.727 decoder at 40, 32, 24 and 16 kbit/s.
n)
Basic Operators
Name: basop32.c, enh1632.c, enh40.c Associated header file: stl.h Variable definitions: v1, v2: 16-bit variables L_v1, L_v2, L_v3: 32-bit variables L40_v1, L40_v2, L40_v3: 40-bit variables Functions included:
add(v1, v2)
Performs the addition (v1+v2) with overflow control and saturation; the 16-bit result is set at +32767 when overflow occurs or at 32768 when underflow occurs. Performs the subtraction (v1v2) with overflow control and saturation; the 16-bit result is set at +32767 when overflow occurs or at 32768 when underflow occurs. Absolute value of v1. If v1 is 32768, returns 32767.
sub(v1, v2)
abs_s(v1)
shl(v1, v2)
Arithmetically shifts the 16-bit input v1 left by v2 positions. Zero fills the v2 LSB of the result. If v2 is negative, arithmetically shifts v1 right by v2 with sign extension. Saturates the result in case of underflows or overflows. Arithmetically shifts the 16-bit input v1 right v2 positions with sign extension. If v2 is negative, arithmetically shifts v1 left by v2 and zero fills the v2 LSB of the result:
shr(v1, v2) = shl(v1, v2)
shr(v1, v2)
s_max(v1, v2)
Compares two 16-bit variables v1 and v2 and returns the maximum value. Compares two 16-bit variables v1 and v2 and returns the minimum value. Produces the number of left shifts needed to normalize the 16-bit variable v1 for positive values on the interval with minimum of 16384 and maximum 32767, and for negative values on the interval with minimum of 32768 and maximum of 16384; in order to normalize the result, the following operation must be done:
norm_v1 = shl(v1, norm_s(v1))
s_min(v1, v2)
norm_s(v1)
L_add(L_v1, L_v2)
32-bit addition of the two 32-bit variables (L_v1+L_v2) with overflow control and saturation; the result is set at +2147483647 when overflow occurs or at 2147483648 when underflow occurs. 32-bit subtraction of the two 32-bit variables (L_v1L_v2) with overflow control and saturation; the result is set at +2147483647 when overflow occurs or at 2147483648 when underflow occurs. Absolute value of L_v1, with L_abs(2147483648) = 2147483647. Arithmetically shifts the 32-bit input L_v1 left v2 positions. Zero fills the v2 LSB of the result. If v2 is negative, arithmetically shifts L_v1 right by v2 with sign extension. Saturates the result in case of underflows or overflows. Arithmetically shifts the 32-bit input L_v1 right v2 positions with sign extension. If v2 is negative, arithmetically shifts L_v1 left by v2 and zero fills the v2 LSB of the result. Saturates the result in case of underflows or overflows. Negates the 32-bit L_v1 with saturation, saturate in the case where input is 2147483648. Compares two 32-bit variables L_v1 and L_v2 and returns the maximum value.
Rec. ITU-T G.191 (03/2010) 9
L_sub(L_v1, L_v2)
L_abs(L_v1)
L_shl(L_v1, v2)
L_shr(L_v1, v2)
L_negate(L_v1)
L_max(L_v1, L_v2)
L_min(L_v1, L_v2)
Compares two 32-bit variables L_v1 and L_v2 and returns the minimum value. Produces the number of left shifts needed to normalize the 32-bit variable L_v1 for positive values on the interval with minimum of 1073741824 and maximum 2147483647, and for negative values on the interval with minimum of 2147483648 and maximum of 1073741824; in order to normalize the result, the following operation must be done:
L_norm_v1 = L_shl( L_v1, norm_l( L_v1))
norm_l(L_v1)
L_mult(v1, v2)
L_mult implements the 32-bit result of the multiplication of v1 times v2 with one shift left, i.e.,
L_mult(v1, v2) = L_shl( (v1 * v2), 1)
L_mult0 implements the 32-bit result of the multiplication of v1 times v2 without left shift, i.e.,
L_mult(v1, v2) = (v1 * v2)
mult(v1, v2)
Performs the multiplication of v1 by v2 and gives a 16-bit result which is scaled, i.e.,
mult(v1, v2) = extract_l( L_shr( (v1 times v2), 15))
Multiplies v1 by v2 and shifts the result left by 1. Adds the 32-bit result to L_v3 with saturation, returns a 32-bit result:
L_mac( L_v3, v1, v2) = L_add(L_v3, L_mult( v1, v2))
Multiplies v1 by v2 without left shift. Adds the 32-bit result to L_v3 with saturation, returning a 32-bit result:
L_mac(L_v3, v1, v2) = L_add(vL_v3, L_mult0(vv1, v2))
Multiplies v1 by v2 and shifts the result left by 1. Adds the 32-bit result to L_v3 without saturation, returns a 32-bit result. Generates carry and overflow values:
L_macNs( L_v3, L_mult(v1, v2)) v1, v2) = L_add_c( L_v3,
10
Multiplies v1 by v2 and shifts the result left by 1. Adds the 32-bit result to L_v3 with saturation. Rounds the 16 least significant bits of the result into the 16 most significant bits with saturation and shifts the result right by 16. Returns a 16-bit result.
mac_r( L_v3, v1, v2) = round( L_mac( L_v3, v1, v2)) = extract_h( L_add( L_add( L_v3, L_mult( v1, v2)), 32768))
Multiplies v1 by v2 and shifts the result left by 1. Subtracts the 32-bit result from L_v3 with saturation, returns a 32-bit result:
L_msu(L_v3, v1, v2) = L_sub(L_v3, L_mult(v1, v2))
Multiplies v1 by v2 without left shift. Subtracts the 32-bit result from L_v3 with saturation, returning a 32-bit result:
L_msu(L_v3, v1, v2) = L_sub(L_v3, L_mult0( v1, v2))
Multiplies v1 by v2 and shifts the result left by 1. Subtracts the 32-bit result from L_v3 without saturation, returns a 32-bit result. Generates carry and overflow values:
L_msuNs( L_v3, v1, v2) = L_sub_c(L_v3, L_mult( v1, v2))
Multiplies v1 by v2 and shifts the result left by 1. Subtracts the 32-bit result from L_v3 with saturation. Rounds the 16 least significant bits of the result into the 16 bits with saturation and shifts the result right by 16. Returns a 16-bit result.
msu_r( L_v3, v1, v2) = round( L_msu( L_v3, v1, v2)) = extract_h( L_add( L_sub( L_v3, L_mult( v1, v2)), 32768))
s_and(v1, v2)
Performs a bit wise AND between the two 16-bit variables v1 and v2. Performs a bit wise OR between the two 16-bit variables v1 and v2. Performs a bit wise XOR between the two 16-bit variables v1 and v2. Logically shifts left the 16-bit variable v1 by v2 positions: if v2 is negative, v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is positive, v1 is shifted to the most significant bits by (v2) positions without saturation control.
s_or(v1, v2)
s_xor(v1, v2)
lshl(v1, v2)
11
lshr(v1, v2)
Logically shifts right the 16-bit variable v1 by v2 positions: if v2 is positive, v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is negative, v1 is shifted to the most significant bits by (v2) positions without saturation control.
L_and(L_v1, L_v2)
Performs a bit wise AND between the two 32-bit variables L_v1 and L_v2. Performs a bit wise OR between the two 32-bit variables L_v1 and L_v2. Performs a bit wise XOR between the two 32-bit variables L_v1 and L_v2. Logically shifts left the 32-bit variable L_v1 by v2 positions: if v2 is negative, L_v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is positive, L_v1 is shifted to the most significant bits by (v2) positions without saturation control.
L_or(L_v1, L_v2)
L_xor(L_v1, L_v2)
L_lshl(L_v1, v2)
L_lshr(L_v1, v2)
Logically shifts right the 32-bit variable L_v1 by v2 positions: if v2 is positive, L_v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is negative, L_v1 is shifted to the most significant bits by (v2) positions without saturation control.
Returns the 16 most significant bits of L_v1. Returns the 16 least significant bits of L_v1. Rounds the lower 16 bits of the 32-bit input number into the most significant 16 bits with saturation. Shifts the resulting bits right by 16 and returns the 16-bit number:
round(L_v1) = extract_h( L_add( L_v1, 32768))
L_deposit_h(v1)
Deposits the 16-bit v1 into the 16-bit most significant bits of the 32-bit output. The 16 least significant bits of the output are zeroed. Deposits the 16-bit v1 into the 16-bit least significant bits of the 32-bit output. The 16 most significant bits of the output are sign extended. Performs the 32-bit addition with carry. No saturation. Generates carry and overflow values. The carry and overflow values are binary variables which can be tested and assigned values. Performs the 32-bit subtraction with carry (borrow). Generates carry (borrow) and overflow values. No saturation. The carry and overflow values are binary variables which can be tested and assigned values.
L_deposit_l(v1)
L_add_c(L_v1, L_v2)
L_sub_c(L_v1, L_v2)
12
shr_r(v1, v2)
Same as shr( v1, v2) but with rounding. Saturates the result in case of underflows or overflows. if v2 is strictly greater than zero, then
if (sub( shl ( shr( v1,v2), 1), shr( v1, sub(v2, 1))) == 0) then shr_r(v1, v2) = shr(v1, v2) else shr_r(v1, v2) = add(shr(v1, v2), 1)
Same as shl( v1, v2) but with rounding. Saturates the result in case of underflows or overflows:
shl_r( v1, v2) = shr_r( v1, v2)
In the previous version of the STL-basic operators, this operator is called shift_r(v1, v2); both names can be used.
L_shr_r(L_v1, v2)
Same as L_shr( v1, v2) but with rounding. Saturates the result in case of underflows or overflows: if v2 is strictly greater than zero, then
if( L_sub( L_shl( L_shr( L_v1, v2), 1), L_shr( L_v1, sub( v2, 1)))) == 0 then L_shr_r( L_v1, v2) = L_shr( L_v1, v2) else L_shr_r( L_v1, v2) = L_add( L_shr( L_v1, v2), 1)
Same as L_shl( L_v1, v2) but with rounding. Saturates the result in case of underflows or overflows.
L_shift_r( L_v1, v2) = L_shr_r( L_v1, v2)
In the previous version of the STL-basic operators, this operator is called L_shift_r(L_v1, v2); both names can be used.
i_mult(v1, v2)
Multiplies two 16-bit variables v1 and v2 returning a 16-bit value with overflow control. Rotates the 16-bit variable v1 by 1 bit to the most significant bits. Bit 0 of v2 is copied to the least significant bit of the result before it is returned. The most significant bit of v1 is copied to the bit 0 of v3 variable. Rotates the 16-bit variable v1 by 1 bit to the least significant bits. Bit 0 of v2 is copied to the most significant bit of the result before it is returned. The least significant bit of v1 is copied to the bit 0 of v3 variable. Rotates the 32-bit variable L_v1 by 1 bit to the most significant bits. Bit 0 of v2 is copied to the least significant bit of the result before it is returned. The most significant bit of L_v1 is copied to the bit 0 of v3 variable.
Rec. ITU-T G.191 (03/2010) 13
Rotates the 32-bit variable L_v1 by 1 bit to the least significant bits. Bit 0 of v2 is copied to the most significant bit of the result before it is returned. The least significant bit of L_v1 is copied to the bit 0 of v3 variable. Long (32-bit) L_v1 is set to 2147483647 if an overflow occurred, or 2147483648 if an underflow occurred, on the most recent L_add_c(), L_sub_c(), L_macNs() or L_msuNs() operations. The carry and overflow values are binary variables which can be tested and assigned values. Performs a multiplication of a 32-bit variable L_v1 by a 16-bit variable v2, returning a 32-bit value. Produces a result which is the fractional integer division of v1 by v2. Values in v1 and v2 must be positive and v2 must be greater than or equal to v1. The result is positive (leading bit equal to 0) and truncated to 16 bits. If v1 equals v2, then div( v1, v2) = 32767. Produces a result which is the fractional integer division of a positive 32-bit variable L_v1 by a positive 16-bit variable v2. The result is positive (leading bit equal to 0) and truncated to 16 bits. Adds the two 40-bit variables L40_v1 and L40_v2 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution. Subtracts the two 40-bit variables L40_v2 from L40_v1 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution. Returns the absolute value of the 40-bit variable L40_v1 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution. Arithmetically shifts left the 40-bit variable L40_v1 by v2 positions: if v2 is negative, L40_v1 is shifted to the least significant bits by (v2) positions with extension of the sign bit. if v2 is positive, L40_v1 is shifted to the most significant bits by (v2) positions without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution.
L_sat(L_v1)
L_mls(L_v1, v2)
div_s(v1, v2)
div_l(L_v1, v2)
L40_add(L40_v1, L40_v2)
L40_sub(L40_v1, L40_v2)
L40_abs(L40_v1)
L40_shl(L40_v1, v2)
L40_shr(L40_v1, v2)
Arithmetically shifts right the 40-bit variable L40_v1 by v2 positions: if v2 is positive, L40_v1 is shifted to the least significant bits by (v2) positions with extension of the sign bit. if v2 is negative, L40_v1 is shifted to the most significant bits by (v2) positions without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution.
L40_negate(L40_v1)
Negates the 40-bit variable L40_v1 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution.
14
L40_max(L40_v1, L40_v2)
Compares two 40-bit variables L40_v1 and L40_v2 and returns the maximum value. Compares two 40-bit variables L40_v1 and L40_v2 and returns the minimum value. Produces the number of left shifts needed to normalize the 40-bit variable L40_v1 for positive values on the interval with minimum of 1073741824 and maximum 2147483647, and for negative values on the interval with minimum of 2147483648 and maximum of 1073741824; in order to normalize the result, the following operation must be done:
L40_norm_v1 = L40_shl( L40_v1, norm_L40( L40_v1))
L40_min(L40_v1, L40_v2)
norm_L40(L40_v1)
L40_mult(v1, v2)
Multiplies the 2 signed 16-bit variables v1 and v2 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution. The operation is performed in fractional mode: v1 and v2 are supposed to be in 1Q15 format. The result is produced in 9Q31 format.
Equivalent to:
L40_add( L40_v1, L40_mult( v2, v3))
Equivalent to:
L40_sub( L40_v1, L40_mult( v2, v3))
L40_lshl(L40_v1, v2)
Logically shifts left the 40-bit variable L40_v1 by v2 positions: if v2 is negative, L40_v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is positive, L40_v1 is shifted to the most significant bits by (v2) positions without saturation control.
L40_lshr(L40_v1, v2)
Logically shifts right the 40-bit variable L40_v1 by v2 positions: if v2 is positive, L40_v1 is shifted to the least significant bits by (v2) positions with insertion of 0 at the most significant bit. if v2 is negative, L40_v1 is shifted to the most significant bits by (v2) positions without saturation control.
Returns the bits [31..16] of L40_v1. Returns the bits [15..00] of L40_v1. Equivalent to:
extract_h( L_saturate40( L40_round( L40_v1)))
L_Extract40(L40_v1)
15
L_saturate40(L40_v1)
If L40_v1 is greater than 2147483647, returns 2147483647. If L40_v1 is lower than 2147483648, returns 2147483648. If not, equivalent to:
L_Extract40( L40_v1)
L40_deposit_h(v1)
Deposits the 16-bit variable v1 in the bits [31..16] of the return value: the return value bits [15..0] are set to 0 and the bits [39..32] sign extend v1 sign bit. Deposits the 16-bit variable v1 in the bits [15..0] of the return value: the return value bits [39..16] sign extend v1 sign bit. Deposits the 32-bit variable L_v1 in the bits [31..0] of the return value: the return value bits [39..32] sign extend L_v1 sign bit. Performs a rounding to the infinite on the 40-bit variable L40_v1. 32768 is added to L40_v1 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution. The end-result 16 LSB are cleared to 0.
L40_deposit_l(v1)
L40_deposit32(L_v1)
L40_round(L40_v1)
Equivalent to:
round40( L40_mac( L40_v1, v2, v3))
Equivalent to:
round40( L40_msu( L40_v1, v2, v3))
Multiplies the 2 signed values L_v1 (32-bit) and v2 (16-bit) with saturation control on 48 bits. The operation is performed in fractional mode: When L_v1 is in 1Q31 format, and v2 is in 1Q15 format, the result is produced in 1Q47 format: L_v3_h bears the 32 most significant bits while v3_l bears the 16 least significant bits.
L40_shr_r(L40_v1, v2)
Arithmetically shifts the 40-bit variable L40_v1 by v2 positions to the least significant bits and rounds the result. It is equivalent to L40_shr( L40_v1, v2) except that if v2 is positive and the last shifted out bit is 1, then the shifted result is incremented by 1 without saturation control on 40 bits. Any detected overflow on 40 bits will exit execution.
L40_shl_r(L40_v1, v2)
Arithmetically shifts the 40-bit variable L40_v1 by v2 positions to the most significant bits and rounds the result. It is equivalent to L40_shl( L40_var1, v2) except if v2 is negative. In this case, it does the same as L40_shr_r( L40_v1, (v2)).
16
Assigns a 40-bit constant to the returned 40-bit variable. Multiplies the 2 signed 32-bit values L_v1 and L_v2 with saturation control on 64 bits. The operation is performed in fractional mode: When L_v1 and L_v2 are in 1Q31 format, the result is produced in 1Q63 format: L_v3_h bears the 32 most significant bits while L_v3_l bears the 32 least significant bits.
The Basic Operators module is supplemented by two tools: one to evaluate program ROM complexity for fixed-point code, and another to evaluate complexity (including program ROM) of floating-point implementations. n.1) Program ROM estimation tool for fixed-point C code Name: basop_cnt.c Associated header file: None. Usage: basop cnt input.c [result_file_name.txt] The basop_cnt tool estimates the program ROM of applications written using the ITU-T Basic Operator libraries. It counts the number of calls to basic operators in the input C source file, and also the number of calls to user-defined functions. The sum of these two numbers gives an estimation of the required PROM. n.2) Complexity evaluation tool for floating-point C code Name: flc.c Associated header file: flc.h Functions included:
FLC_init FLC_sub_start FLC_sub_end FLC_end
Initialize the floating-point counters. Marks the start of a subroutine/subsection. Marks the end of a subroutine/subsection. Computes and prints complexity, i.e., floating-point counter results. Marks the end of a frame processing to keep track of the per-frame maxima.
FLC_frame_update
o)
Reverberation module
17
p)
q)
Discrete Fourier Transform for real signals. Hanning window generation routine. Power spectrum computation routine.
18
accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for non-commercial distribution and only if you received the module in object code or executable form alone.)
Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. B.5 You may not copy, modify, sublicense, distribute or transfer the Module except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Module is void, and will automatically terminate your rights to use the Module under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. B.6 By copying, distributing or modifying the Module (or any work based on the Module) you indicate your acceptance of this license to do so, and all its terms and conditions. B.7 Each time you redistribute the Module (or any work based on the Module), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Module subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. B.8 The ITU-T may publish revised and/or new versions of this General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Module specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the ITU-T. If the Module does not specify a version number of the license, you may choose any version ever published by the ITU-T. B.9 If you wish to incorporate parts of the Module into other free modules whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the ITU-T, write to the ITU-T Secretariat; exceptions may be made for this. This decision will be guided by the two goals of preserving the free status of all derivatives of this free software and of promoting the sharing and reuse of software generally. B.10 Because the Module is licensed free of charge, there is no warranty for the Module, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the Module "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the Module is with you. Should the Module prove defective, you assume the cost of all necessary servicing, repair or correction. B.11 In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the Module as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the Module (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the Module to operate with any other modules), even if such holder or other party has been advised of the possibility of such damages.
20