04.11.2014 Views

ITU-T G.729 Speech Coder for TMS320C6201 Overview ... - Radisys

ITU-T G.729 Speech Coder for TMS320C6201 Overview ... - Radisys

ITU-T G.729 Speech Coder for TMS320C6201 Overview ... - Radisys

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.radisys.com<br />

World Headquarters<br />

5445 NE Dawson Creek Drive • Hillsboro, OR<br />

97124 USA<br />

Phone: 503-615-1100 • Fax: 503-615-1121<br />

Toll-Free: 800-950-0044<br />

International Headquarters<br />

Gebouw Flevopoort • Televisieweg 1A<br />

NL-1322 AC • Almere, The Netherlands<br />

Phone: 31 36 5365595 • Fax: 31 36 5365620<br />

007-00968-0002<br />

November 2000<br />

<strong>ITU</strong>-T <strong>G.729</strong><br />

<strong>Speech</strong> <strong>Coder</strong> <strong>for</strong><br />

<strong>TMS320C6201</strong> †<br />

<strong>Overview</strong> Guide


November 2000<br />

Copyright ©2000 by RadiSys Corporation.<br />

All rights reserved.<br />

EPC, iRMX, INtime, Inside Advantage, and RadiSys are registered trademarks of RadiSys Corporation. Spirit,<br />

DAI, DAQ, ASM, Brahma, and SAIB are trademarks of RadiSys Corporation.<br />

† All other trademarks, registered trademarks, service marks, and trade names are the property of their<br />

respective owners.


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong><br />

<strong>TMS320C6201</strong><br />

The <strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> algorithm, as specified by the<br />

<strong>ITU</strong>-T Recommendation <strong>G.729</strong> “Coding of speech at 8 kbits/s using conjugatestructure<br />

algebraic-code-excited linear-prediction (CS-ACELP)”, is optimally<br />

implemented <strong>for</strong> the Texas Instruments TMS320C6x digital signal processor.<br />

The <strong>Speech</strong> <strong>Coder</strong> is implemented as an encoder and decoder based on 10 ms<br />

frames, i.e., they act only upon data collected <strong>for</strong> 10 ms.<br />

For in<strong>for</strong>mation about installing and using the <strong>Speech</strong> <strong>Coder</strong> software, see the<br />

topics listed below.<br />

For in<strong>for</strong>mation about...<br />

Go to this page...<br />

Installation ........................................................................................................... 2<br />

Requirements ................................................................................................. 2<br />

Install the software ......................................................................................... 2<br />

Compile and link the software......................................................................... 3<br />

Application programmer interface......................................................................... 3<br />

Init_G729Encoder .......................................................................................... 4<br />

Init_G729Decoder .......................................................................................... 5<br />

G729Encoder ................................................................................................. 5<br />

G729_Decoder............................................................................................... 6<br />

G729Encoder1 ............................................................................................... 6<br />

G729Encoder2 ............................................................................................... 7<br />

G729_Decoder............................................................................................... 7<br />

Run-time initializations.................................................................................... 8<br />

Testing and per<strong>for</strong>mance specifications................................................................. 8<br />

Where to get more in<strong>for</strong>mation........................................................................... 10<br />

1


RadiSys Corporation<br />

Installation<br />

To make the <strong>Speech</strong> <strong>Coder</strong> software fully functional, follow these steps:<br />

Start<br />

Install the<br />

software<br />

Compile and link<br />

the software<br />

Requirements<br />

Install the software<br />

Done<br />

Figure 1. Installing and building the <strong>Speech</strong> <strong>Coder</strong> software<br />

Be<strong>for</strong>e you can install this software, you need the following:<br />

• A Microsoft † Windows † 95, Windows 98, or Windows NT † compatible<br />

PC plat<strong>for</strong>m.<br />

• The following software installed on your computer:<br />

• TMS320C6x Code Generation Tools Release 3.01 <strong>for</strong> Windows 95,<br />

Windows 98, or Windows NT<br />

—or—<br />

Code Composer Studio Tools, version 1.2, <strong>for</strong> Windows 95, Windows 98,<br />

or Windows NT.<br />

• NMAKE utility (available from Microsoft).<br />

• PKUNZIP utility.<br />

To install the <strong>Speech</strong> <strong>Coder</strong> software:<br />

1. Create a directory on the target system. For example:<br />

mkdir c:\g729<br />

2. Copy the product files from the CD-ROM to the directory you just created.<br />

Use a copy utility that retains the directory structure, such as Xcopy.<br />

2


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> <strong>Overview</strong> Guide<br />

Compile and link the software<br />

To compile and link the <strong>Speech</strong> <strong>Coder</strong> software:<br />

1. Open an MS DOS command prompt window and go to the target directory,<br />

then go to the /c6xsim sub-directory.<br />

2. If you’ve already installed the TI tools, you can build the c6x version of the<br />

<strong>Speech</strong> <strong>Coder</strong> by entering this command at the MS DOS command prompt:<br />

NMAKE -f g729bld.mak<br />

Code organization<br />

When installed, the <strong>Speech</strong> <strong>Coder</strong> software files reside in this directory structure:<br />

1 This file is tested to work with the Microsoft NMAKE utility, and can be modified to work with other<br />

make utilities.<br />

Application programmer interface<br />

The \testvecs sub-directory contains files that have input and output test<br />

vectors <strong>for</strong> each module. These files have extensions of .IN2, .IN, .BIT,<br />

or .PST.<br />

Directory Extension File type Description<br />

\g729 .pdf User’s manual Includes this guide, in PDF <strong>for</strong>mat.<br />

\g729\c6xsim<br />

Control source and executable <strong>for</strong> C6x<br />

.c C files (wrapper code) Control source files.<br />

.cmd Linker command files Linker command files control object<br />

modules, linking options, and<br />

memory maps. These files include:<br />

• coder.cmd: Command file <strong>for</strong> the<br />

G729 Encoder Module.<br />

• decoder.cmd: Command file <strong>for</strong><br />

the G729 Decoder Module.<br />

.lib Library files The g729.lib file is a library of all<br />

object modules.<br />

.mak Build file The g729bld.mak file 1 controls the<br />

build process.<br />

\g729\include .h Header files Header files used to build the <strong>Speech</strong><br />

<strong>Coder</strong>. Applications can share these<br />

files as well.<br />

\g729\testvecs Test vector files <strong>ITU</strong>-T test vectors.<br />

Once you’ve installed and built the <strong>Speech</strong> <strong>Coder</strong> software, you can use the <strong>Speech</strong><br />

<strong>Coder</strong> functions in your C application code.<br />

Observe the following while developing your applications:<br />

• All module execution shall be done on 10ms frames.<br />

3


RadiSys Corporation<br />

• Channel Variable, Control, Tables buffer allocation in the data memory are not<br />

part of the mentioned APIs.<br />

• G729 Encoder and Decoder assume that higher level control allocates the data<br />

memory based on the size of each structure and the alignment.<br />

The next section describes the APIs used <strong>for</strong> the functional implementation of<br />

<strong>ITU</strong>-T G729 coder. This section specifies the APIs <strong>for</strong> two different memory<br />

configurations:<br />

• Configuration 1: Runs the complete encoder from external memory as a<br />

single module.<br />

• Configuration 2: The G729 Encoder code is separated into two modules to fit<br />

into internal memory of the <strong>TMS320C6201</strong>.<br />

You must know the configuration be<strong>for</strong>e calling the APIs.<br />

APIs <strong>for</strong> initialization<br />

The application needs to call this API once at the start of the call. This needs to be<br />

done <strong>for</strong> every new call.<br />

Configuration 1 and Configuration 2<br />

Init_G729Encoder<br />

Syntax<br />

void Init_G729Encoder(<br />

g729EncVars *variables_buf,<br />

g729CodTabs *tables_buf<br />

);<br />

Parameters<br />

For structure definitions, see include\tab_ld8k.h <strong>for</strong> the <strong>G.729</strong> coder. And <strong>for</strong><br />

execution sequence of all APIs, see c6xsim\coder.c <strong>for</strong> G729 encoder and<br />

c6xsim\decoder.c <strong>for</strong> decoder in the directory.<br />

variables_buf<br />

Pointer to Channel Encoder State Variable structure with sizeof<br />

(g729EncVars), 32-bit alignment, and persistent (2268 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

4


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> <strong>Overview</strong> Guide<br />

Init_G729Decoder<br />

Syntax<br />

Configuration 1<br />

G729Encoder<br />

void Init_G729Decoder(<br />

g729DecVars *variables_buf,<br />

g729CodTabs *tables_buf<br />

);<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Decoder State Variable structure with sizeof<br />

(g729DecVars), 32-bit alignment, and persistent (1376 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

APIs <strong>for</strong> run-time execution<br />

The application needs to call this API <strong>for</strong> every 10ms frame after the start of call<br />

and initialization.<br />

Syntax<br />

void G729Encoder(<br />

g729EncVars *variables_buf,<br />

g729CodTabs *tables_buf,<br />

short *pInBuf,<br />

unsigned char *pNwOutBuf,<br />

unsigned char nb_words<br />

);<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Encoder State Variable structure with sizeof<br />

(g729EncVars), 32-bit alignment, and persistent (2268 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

pInBuf<br />

pNwOutBuf<br />

Short Pointer to received PCM data, 32-bit alignment, non-persistent<br />

(160 bytes).<br />

Unsigned Char Pointer to the compressed data to be transmitted, 8-bit<br />

alignment, non-persistent (10 bytes).<br />

5


RadiSys Corporation<br />

nb_words<br />

Number of valid bytes in the compressed packet (pNwOutBuf), 8-bit<br />

alignment, non-persistent (1 byte).<br />

G729_Decoder<br />

Syntax<br />

void G729_Decoder(<br />

g729DecVars *variables_buf,<br />

g729CodTabs *tables_buf,<br />

unsigned char *pNwInBuf,<br />

unsigned char Status,<br />

Word16 *pOutBuf<br />

)<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Decoder State Variable structure with sizeof<br />

(g729DecVars), 32-bit alignment, and persistent (1376 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

pNwInBuf<br />

Status<br />

pOutBuf<br />

Configuration 2<br />

G729Encoder1<br />

Syntax<br />

Unsigned Char Pointer to received data from network, 8-bit alignment,<br />

non-persistent (10 bytes).<br />

Unsigned Char status of the compressed packet received from the<br />

network, 8-bit alignment, non-persistent (1 byte).<br />

Short Pointer to PCM data to be transmitted, 32-bit alignment,<br />

non-persistent (160 bytes).<br />

void G729Encoder1(<br />

short *pInBuf,<br />

g729EncVars *variables_buf,<br />

g729CodTabs *tables_buf<br />

)<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Encoder State Variable structure with sizeof<br />

(g729EncVars), 32-bit alignment, and persistent (2268 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

6


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> <strong>Overview</strong> Guide<br />

pInBuf<br />

Short Pointer to received PCM data, 32-bit alignment, non-persistent<br />

(160 bytes).<br />

G729Encoder2<br />

Syntax<br />

G729_Decoder<br />

void G729Encoder2(<br />

g729EncVars *variables_buf,<br />

g729CodTabs *tables_buf,<br />

unsigned char *pNwOutBuf,<br />

unsigned char *nb_words<br />

)<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Encoder State Variable structure with sizeof<br />

(g729EncVars), 32-bit alignment, and persistent (2268 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

pNwOutBuf<br />

nb_words<br />

Syntax<br />

Unsigned Char Pointer to the compressed data to be transmitted, 8-bit<br />

alignment, non-persistent (10 bytes).<br />

Number of valid bytes in the compressed packet (pNwOutBuf), 8-bit<br />

alignment, non-persistent (1 byte).<br />

void G729_Decoder(<br />

g729DecVars *variables_buf,<br />

g729CodTabs *tables_buf,<br />

unsigned char *pNwInBuf,<br />

unsigned char Status,<br />

Word16 *pOutBuf<br />

)<br />

Parameters<br />

variables_buf<br />

Pointer to Channel Decoder State Variable structure with sizeof<br />

(g729DecVars), 32-bit alignment, and persistent (1376 bytes).<br />

tables_buf<br />

Pointer to Global Tables structure with sizeof(g729CodTabs), 32-bit<br />

alignment, and shared (7460 bytes).<br />

pNwInBuf<br />

Unsigned Char Pointer to received data from network, 8-bit alignment,<br />

non-persistent (10 bytes).<br />

7


RadiSys Corporation<br />

Status<br />

pOutBuf<br />

Unsigned Char status of the compressed packet received from the<br />

network, 8-bit alignment, non-persistent (1 byte).<br />

Short Pointer to PCM data to be transmitted, 32-bit alignment,<br />

non-persistent (160 bytes).<br />

Run-time initializations<br />

pInBuf Short Pointer to the TDM Input buffer (16-bit PCM samples) size of 160<br />

bytes, 32 bit alignment.<br />

pOutBuf<br />

pNwInBuf<br />

pNwOutBuf<br />

Short Pointer to the TDM Output buffer (16-bit PCM samples) size of<br />

160 bytes, 32 bit alignment.<br />

Unsigned Char Pointer to received network packet data, 8-bit alignment,<br />

and non-persistent (10 bytes).<br />

Unsigned Char Pointer to network packet data to be transmitted, 8-bit<br />

alignment, and non-persistent (10 bytes).<br />

Status (8-bit)<br />

Application need to provide the status in<strong>for</strong>mation based on the network<br />

packets/data.<br />

If(PacketSize==10)<br />

Status = ACTIVE_FRAME;<br />

Else<br />

Status = G729BAD_FRAME;<br />

Testing and per<strong>for</strong>mance specifications<br />

Test procedure<br />

The <strong>G.729</strong> software is tested using the Texas Instruments XDS-510 JTAG emulator<br />

on the TEB (Test Evaluation Board) from Texas Instruments. The TEB used in these<br />

tests had Rev. 1.5 of the <strong>TMS320C6201</strong> on it. The emulator software version used<br />

in the test procedure did not allow command line arguments <strong>for</strong> file names, hence<br />

the file names <strong>for</strong> the input and output vectors were hard-coded as shown in the<br />

following module description tables.<br />

For this test the code is assumed to be resident in c:\g729\c6xsim and test vectors in<br />

c:\g729\testvecs.<br />

Encoder test procedure<br />

1. Copy c:\g729\testvecs\algthm.in c:\g729\c6xsim\coder.in<br />

2. Run coder.out using Texas Instruments emulator to produce the file decoder.in<br />

8


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> <strong>Overview</strong> Guide<br />

Decoder.in is the serial bit output file which should be same as the <strong>ITU</strong>-T test<br />

vector file c:\g729\testvecs\algthm.bit<br />

Table 1. Encoder module test summary<br />

Module name<br />

Input Vector File Names<br />

Input Vector <strong>for</strong>mat<br />

Typical <strong>ITU</strong> file from <strong>G.729</strong><br />

test vectors<br />

Output Vector File Name<br />

Output Vector <strong>for</strong>mat<br />

<strong>Coder</strong>.out<br />

<strong>Coder</strong>.in<br />

<strong>Coder</strong>.in: 16 bit binary voice samples, Intel<br />

Algthm.in<br />

decoder.in<br />

<strong>ITU</strong>-T Serial Bit Frame <strong>for</strong>mat. Each frame consists of<br />

80 short words<br />

Decoder test procedure<br />

1. Copy c:\g729\testvecs\algthm.bit to c:\g729\c6xsim\decoder.in<br />

2. Run decoder.out using TI emulator to produce the file decoder.res<br />

3. decoder.res is the serial bit output file which should be same as the <strong>ITU</strong>-T test<br />

vector file c:\g729\testvecs\algthm.pst<br />

Table 2. Decoder module test summary<br />

Module name<br />

Input Vector File Names<br />

Input Vector <strong>for</strong>mat<br />

Typical <strong>ITU</strong>-T file from<br />

<strong>G.729</strong> test vectors<br />

Output Vector File Name<br />

Output Vector <strong>for</strong>mat<br />

<strong>Coder</strong>.out<br />

Decoder.in<br />

<strong>ITU</strong>-T Serial Bit Vector Frame Format. Each frame<br />

consist of 82 short words (164 bytes).<br />

Algthm.bit<br />

decoder.res<br />

16-bit binary voice samples, Intel.<br />

Per<strong>for</strong>mance specification<br />

The per<strong>for</strong>mance results were computed <strong>for</strong> the test vector in the file algthm.in,<br />

with Texas Instruments Code Composer Studio Tools, version 1.2. The cycle count<br />

is <strong>for</strong> the module API functions excludes bit-packing, file reading and writing cycles,<br />

and with all C files compiled with -o2 optimizer option.<br />

Module<br />

Cycles<br />

(speech)<br />

Table 3. <strong>G.729</strong> c6x code per<strong>for</strong>mance<br />

MCPS – speech<br />

(assuming 200<br />

MHz DSP)<br />

Program<br />

memory<br />

(Kbytes)<br />

Data memory<br />

(Kbytes) tables,<br />

var.<br />

Stack<br />

(Kbytes)<br />

Encoder 108000 10.8 51.5 7.46 2.26 3.25<br />

Decoder 28000 2.8 26.4 7.46 1.37 1.5<br />

9


RadiSys Corporation<br />

Where to get more in<strong>for</strong>mation<br />

About the <strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong><br />

You can find out more about the <strong>Speech</strong> <strong>Coder</strong> from these sources:<br />

• Readme file: Lists features and issues that arose too late to include in other<br />

documentation.<br />

• World Wide Web: RadiSys maintains an active site on the World Wide Web. The<br />

site contains current in<strong>for</strong>mation about the company and locations of sales<br />

offices, new and existing products, contacts <strong>for</strong> sales, service, and technical<br />

support in<strong>for</strong>mation. You can also send e-mail to RadiSys using the web site.<br />

About related products<br />

Requests <strong>for</strong> sales, service, and technical support in<strong>for</strong>mation receive<br />

prompt response.<br />

SP6040<br />

The RadiSys SP6040 (SPIRIT-6040 CompactPCI † board) is a high-per<strong>for</strong>mance<br />

intelligent I/O subsystem designed <strong>for</strong> telecom and datacom applications. Based on<br />

Texas Instruments † devices, the SP6040 has a 200MHz DSP engine with an I/O<br />

connector that provides interface-to-digital network interfaces (DNI) such as E1/T1<br />

and ATM. The SP6040 contains up to four <strong>TMS320C6201</strong> digital signal processors.<br />

SP6020<br />

The RadiSys SP6020 (SPIRIT-6020 board) features two Texas Instruments<br />

<strong>TMS320C6201</strong>B fixed-point DSPs that run at 200MHz and serve as the main<br />

processing engines. Each ’C6x can deliver up to 1600 MIPS of processing power,<br />

contingent on the available parallelism within the application code. The DSPs are<br />

used <strong>for</strong> voice and data processing, compression, and decompression.<br />

TASK-6000<br />

When sending e-mail <strong>for</strong> technical support, please include in<strong>for</strong>mation<br />

about both the hardware and software, plus a detailed description of the<br />

problem, including how to reproduce it.<br />

To access the RadiSys web site, enter this URL in your web browser:<br />

http://www.radisys.com<br />

TASK-6000 software is a tool set that provides a framework <strong>for</strong> composing,<br />

executing and dynamically configuring optimized real-time TMS320C62x DSP<br />

applications. The Voice Gateway Plat<strong>for</strong>m (VGP), available from RadiSys, is used<br />

as the reference hardware plat<strong>for</strong>m.<br />

10


<strong>ITU</strong>-T <strong>G.729</strong> <strong>Speech</strong> <strong>Coder</strong> <strong>for</strong> <strong>TMS320C6201</strong> <strong>Overview</strong> Guide<br />

For detailed in<strong>for</strong>mation about TASK-6000 products, see the following<br />

publications:<br />

TASK-6000 User’s Manual, (07-0992-xx)<br />

TASK-6000 Installation Guide, (07-1000-xx)<br />

TI tools<br />

Software tools from Texas Instruments used to build DSP executables.<br />

For more in<strong>for</strong>mation about Texas Instruments products, enter this URL in<br />

your web browser:<br />

http://www.ti.com/dsp<br />

11


RadiSys Corporation<br />

12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!