Home

Embedded SDK (Software Development Kit)

image

Contents

1. SizeDECSTATDEF PostIirD1 Wordl6Size LpcOrder subframe coded parameters EF structure elements EF PrevLsp Word16Size LpcOrder EF PrevExc Word16Size PitchMax Word16Size Wordl6Size ECSTATDEF PrevLspDECSTATDEF Gain Wordl6Size ECSTATDEF PrevExcDECSTATD lines ECSTATDEF SyntIirDIDECSTATD ECSTATDEF PostFirDIDECSTATDEF SyntIirD1 ECSTATDEF PostIirDIDECSTATDEF PostFirD1 ECSTATDEF _ t Word16Size SubFrames 2 define SFSDEF_AcLg BaseAddr define SFSDEF AcGn SFSDEF_AcLg Word16Size define SFSDEF Mamp SFSDEF_AcGn Word16Size define SFSDEF Grid SFSDEF_Mamp Word16Size define SFSDEF Tran SFSDEF_Grid Word16Size define SFSDEF Pamp SFSDEF Tran Wordl6Size define SFSDEF Ppos SFSDEF_Pampt Word16Size define SFSDEF Size SFSDEF_Ppos Word32Size Defines for LINEDEF structure elements frame coded parameters define INEDEF_LspIdBaseAddr define JINEDEF Olp LINEDEF_LspId Word32Size define INEDEF_Sfs INEDEF Olp define JINEDEF Crc INEDEF Sfs SFSDI define JINEDEF Size LINEDEF Crc Wordl6Size Defines for PWDEF structure elements harmonic noise shaping filter parameters define PWDEF Indx BaseAddr define PWDEF Gain PWDEF_Indx Word16Size define PWDEF_Size PWDEF_Gain Word16Size Defines
2. This document uses the following notational conventions Typeface Symbol or Term Meaning Examples Brackets Function keys y pressing function key F7 Quotation Courier Code examples Process command for line flash Monospaced Type Italic Directory names and contains these core directories project names applications contains applications software calls functions CodeWarrior project 3des mcp is statements procedures the pConfig argument routines arguments defined in the C header file aec h a file names G applications z variables a directives code snippets E in text Bold Reference sources refer to the Targeting DSP56F80x Platform Z paths manual Q emphasis see C Program Files Motorola Embedded SDK help tutorials LU 7 Blue Text Linkable on line refer to Chapter 7 License W Number Any number is consid 3V o ered a positive value 10 ul unless preceded by a DES m minus symbol to signify TE a negative value m ALL CAPITAL defines define INCLUDE_STACK_CHECK Tt LETTERS defined constants a oo marks Returned messages the message Test Passed is displayed if unsuccessful for any reason it will return NULL G 723 1A Speech Codec Library Definitions Acronyms and Abbreviations The following list defines the acronyms a
3. define CODSTATDEF_PrevDatCODSTATDEF_PrevExc Word16Size PitchMax Used delay lines define CODSTATDEF WghtFirDICODSTATDEF PrevDat Word16Size LpcFrame SubFrLen define CODSTATDEF WghtIirDICODSTATDEF WghtFirD1 Word16Size LpcOrder define CODSTATDEF RingFirDICODSTATDEF WghtIirD1 Word16Size LpcOrder define CODSTATDEF RingIirDICODSTATDEF RingFirD1 Word16Size LpcOrder define CODSTATDEF SizeCODSTATDEF RingIirDl Wordl6Size LpcOrder Defines for DECSTATDEF structure elements High pass variables define DECSTATDEF EcountBaseAddr define DECSTATDEF InterGainDECSTATDEF Ecount Wordl6Size define DECSTATDEF InterIndxDECSTATDEF InterGain Wordl6Size define DECSTATDEF RseedDECSTATDEF InterIndx Wordl6Size define DECSTATDEF ParkDECSTATDEF Rseed Wordl6Size define DECSTATDEF GainDECSTATDEF Park Wordl6Size 3 4 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Lsp previous vector define D All pitch operation buffers define D Used delay define define define define fi fi fi OU Jag fi Defines for SFSD
4. ApplicationData Define variables for C initialization code F Xdata start addr in ROM F StackAddr ADDR xStack F_StackEndAddr ADDR xStack SIZEOF xStack 1 F_Xdata_start_addr_in_RAM Define variables for SDK mem library Data X Memory Layout _EX_BIT 0 Internal Memory Partitions for mem h partitions NUM IM PARTITIONS 1 IM ADDR 1 no IM ADDR 2 External Memory Partition for mem h partitions NUM EM PARTITIONS 1 EM ADDR 1 FmemEXbit WRITEH EX BIT FmemNumIMpartitions WRITEH NUM IM PARTITIONS MOTOROLA Linking Applications with the G 723 1A Codec Library 5 3 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Linking Applications with Freescale Samiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 FmemNumEMpartitions WRITEH _NUM_EM_ PARTITIONS FmemIMpartitionList WRITEH ADDR xIntRAM_DynamicMem 1 WRITEH SIZEOF xIntRAM_DynamicMem 1 FmemEMpartitionList WRITEH ADDR xExtRAM_DynamicMem 1 WRITEH SIZEOF xExtRAM_DynamicMem 1 Add rest of the data into External RAM const data data fp_state data rtlib data x s F Xdata ROMtoRAM length 0 F Xbss start addr X BSS ADDR
5. rtlib bss lo bss F Xbss length X BSS ADDR Copy DATA gt xExtRAM F kokokok kok k k k kok k k kok k A k K k k k k kok k kok kk kk k kok k kok k A k kkk k k kok k A I kkk kkk kkk kkk kK FArchIO 0x0000 FArchCore ADDR xCoreRegisters FArchInterrupts ADDR pInterruptVector 5 4 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 6 G 723 1A Applications 6 1 Test and Demo Applications To verify the G 723 1A algorithm test and demo applications have been developed Refer to the Targeting Motorola DSP568xx Platform Manual for the DSP you are using to see if the test and demo applications are available for your target MOTOROLA G 723 1A Applications 6 1 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G723 1A Applications Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 6 2 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 7 License 7 1 Limited Use License Agreement LIMITED USE LICENSE AGREEMENT PLEASE READ THIS AGRE
6. How to reach us USA EUROPE Locations Not Listed Motorola Literature Distribution P O Box 5405 Denver Colorado 80217 1 303 675 2140 or 1 800 441 2447 JAPAN Motorola Japan Ltd SPS Technical Information Center 3 20 1 Minami Azabu Minato ku Tokyo 106 8573 Japan 81 3 3440 3569 ASIA PACIFIC Motorola Semiconductors H K Ltd Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po N T Hong Kong 852 26668334 Technical Information Center 1 800 521 6274 HOME PAGE http www motorola com semiconductors MOTOROLA For More Information On This Product SDK138 D Go to www freescale com
7. MOTOROLA G 723 1A Codec Library Interfaces For More Information On This Product Go to www freescale com 3 1 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 The input and output channel arrays should be declared as follows 5 x int EncodeChannel EncodedFrame x int DecodeChannel EncodedFrame X x UseHp Indicates whether to use high pass filtering Xy UseVx indicates whether to use Comp Vad Voice Activity Detection WrkRat sets the coder bit rate Rate63 or Rate53 x V x Ey ifndef __G723_H define __G723_H include port h void Init_Coder Word32 Channell void Init Vad Word32 Channell void Init Cod Cng Word32 Channell Wordl6 Coder Word32 Channell Wordl6 EncodeSpeech Wordl6 EncodeChannel Wordl6 UseHp Word16 UseVx Wordl6 WrkRate void Init _Decod Word32 Channell void Init Dec Cng Word32 Channell Wordl6 Decod Word32 Channell Wordl6 DecodeSpeech Wordl6 DecodeChannel Word16 Crc Wordl6 UsePf define False 0 define True il Definition of the working mode define Both 0 define Cod 1 define Dec 2 Coder rate define Rate63 0 define Rate53 1 Coder global constants define Frame 240 define LpcFrame 180 define SubFrames 4 define SubF rLen Fr
8. dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as voice activity detection and confort noise generation Init Decod Channell MOTOROLA G 723 1A Codec Library Interfaces 3 19 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 6 Init Dec Cng Call s Init Dec Cng Channel Required Header g723 h Arguments Table 3 6 Init Dec Cng Arguments Channel inout A pointer to a data structure containing channel information for the G 723 1A algorithm Description The Init Dec Cng function initializes the G 723 1A Dec Cng static variables During initialization all resources will be set to their initial values in preparation for G 723 1A operation The Init Dec Cng function should be called only once before the first call to the Decod function The parameter Channel points to a data structure of type Word32 its fields initialize G 723 1A operation in the following manner Use_Hp Sets high pass filtering TRUE Sets high pass filtering FALSE No high pass filtering is set Use_Pf Sets post filtering TRUE Sets post filtering FALSE No post filtering is set Use_Vx Sets VAD CNG TRUE Sets VAD CNG FALSE No VAD CNG is set WrkMode Selects encoding decoding or both Both Sets
9. E bsp E config 3 include 3 modem 3 multimedia E security 3 signal 3 speech A sys A telephony 3 aec A caller id A cas detect E cpt E dtmf det a dtmf gen 3 9165 a g168 a a711 a 9723 a 9726 a vad tools a ucos HF G x86 W 444 4 4 H H HF H E H E H A Figure 2 2 DSP56858 Directories The g723 1A Dual Rate Speech Codec directory includes G723 1A Dual Rate Speech Codec specific algorithms Figure 2 3 shows the g723 A directory structure 2 2 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Ing fio Dirsctory Siructure ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 aec A caler_id A cas_detect a cpt Ca dtmf det 3 dtmf gen telephony 5 9723 34 a723 test configintram ref data 9726 Z vad Figure 2 3 G723 1A Dual Rate Speech Codec Directory Structure The g723 directory the G 723 1A library as well as the following sub directories e g723_test includes c source files and configuration necessary for testing G723 1A library modules conf
10. OxDFFF00 xCoreRegisters RW ORIGIN OxFFFF00 LENGTH 0x000100 Pk k kk k k kk kk kk k k kA kk kk k k kk kk k kA kA kA k KA kA KAZ Ak KA KK KKK KKK k AA k k kk T FORCE ACTIVE FconfigInterruptVector Pk k kk k k kk k k kk k k kk kk kk k k kk kk k kk X kA k k kA kA X Ak KA kk kkk kkk kA kk k k k kk ca ECTIONS EK AK kokk k k k kk kk kk k kk kk kok k kk kk kk kk kk k kk k k kk kk kk kk k k kok kk kk k kok A He IK ApplicationInterruptVector vector c text gt piInterruptVector EK A k k k kk kk kk k kk kk k A A kk kk kk k kk k k A A A A A A A IK A KA IK ApplicationCode 5 2 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor INC 793 1 ACodec Library ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Place all code into Program RAM text rtlib text fp engine text user text Ae ee AS es PmemData c const data PmemData c data SDK data to be placed into Program RAM F_Pdata_start_addr_in_ROM 0 F_Pdata_start_addr_in_RAM pramdata c const data pramdata c data F_Pdata_ROMtoRAM_length 0 F Pbss start addr P BSS ADDR pramdata c bss PmemData c bss F Pbss length P BSS ADDR gt pIntRAM EK A Kk A kok k k A kok k k A kk kk k kk kk k I A kkk kkk kkk AA kkk I I I I
11. Using the pitch period estimation the Logz and the impulse response a closed loop pitch predictor is computed A fifth order pitch predictor is used The pitch period is computed as a small differential value around the open loop pitch estimate The contribution of the pitch predictor is then subtracted from the initial target vector Both the pitch period and the differential value are transmitted to the decoder Finally the non periodic component of the excitation is approximated As explained previously MP MLQ excitation is used for the high bit rate and ACELP is used for the low bit rate The decoder operation is also performed on a frame by frame basis First the quantized LPC indices are decoded then the decoder constructs the LPC synthesis filter For every subframe both the adaptive codebook excitation and fixed codebook excitation are decoded and input to the synthesis filter The adaptive post filter consists of a formant and a forward backward pitch post filter The excitation signal is 1 2 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semicenducter In dual Rate Speech Coder ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 input to the pitch post filter which in turn is input to the synthesis filter The output of the synthesis filter is input to the pitch post filter which in turn is input to the synthesis filter
12. 3 Chapter 3 G 723 1A Codec Library Interfaces 3 1 C122 IS SONICS kis ia ok kk E E E E eas 3 1 32 ac P P o M 3 1 33 eet i a b h ok k o i ko oj ko db k bk dik bn ee ee 3 8 331 ak PSP o pidbekesseedisone dea 3 9 c e k o OSP PO p ee es 3 11 s e E m SE koa nb ehh ie POETS a p bees 67240 Pees eases 3 13 3 3 4 R ice ch O VE R O O OR O P O OR O 3 15 333 IM OOO viocrcd skkadnidk u k ksk sav v kakuk kkkak d k 3 18 3 3 6 A M E EEE EE EE EEE EE oS 3 20 ERN EV 08 os o o o o ewe oe kde s ek vk B ose 3 22 Chapter 4 Building the G 723 1A Codec Library 4 1 Building the G 723 1A Codec LiDrary sadas covece ee beta tengd ikonat 4 1 MOTOROLA Table of Contents For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 5 Linking Applications with the G 723 1A Codec Library 3A et ee LI zad dm sec E sees E reakc 5 1 Chapter 6 G 723 1A Applications 6 1 Testand Demo BOA oh ao be ra n A A dra nc 6 1 Chapter 7 License 7 1 Limited Use Liconse A 3 R ko ees be n lh Sec 7 1 ii G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 List of Tables Table 3 1 Table 3 2 Table 3 3 Table 3 4 Table 3 5 Ta
13. Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 MOTOROLA Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 voice activity detection and confort noise generation Init_Coder Channel1 Init Vad Channell Init Cod Cng Channell r for frames 0 frames lt NUM FRAMES frames if ReadSpeech Specifications char EncodeSpeech f_tstfile break for i 0 i lt EncodedFrame i EncodeChannel i 0 Coder Channe11 EncodeSpeech EncodeChannel True 1 if ReadChannel char DecodeChannel f_tstfil break for i 0 i lt EncodedFrame if DecodeChannel i BitErrors close f_tstfile i EncodeChannel i G 723 1A Codec Library Interfaces For More Information On This Product Go to www freescale com True CoderRate Le 3 17 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library nkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 5 Init Decod Call s void Init Decod Word32 Channel Required Header g723 h Arguments Table 3 5 Init Decod Arguments Channel inout A pointer to a data structure containing channel information for the G 723 1A algorithm Description The nit Decod function initializes the G 723 1A Decoder algorithm During initialization all resources wi
14. On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Taming constants define NbFilt085_min51 define NbFilt170_min93 define SizErr 5 define Erro 0x00000004 define ThreshErr 0x40000000 define DEC 30 7 Structure offsets Later to be added to RAM include file define Wordl6Size 1 define Word32Size 2 Base address used to index first element in each structure define BaseAddr 0 Defines for CODSTATDEF structure elements High pass variables define CODSTATDEF HpfPdlBaseAddr define CODSTATDEF HpfZdlCODSTATDEF HpfPdl Word32Size Sine wave detector define CODSTATDEF SinDetCODSTATDEF HpfZdl Wordl6Size J Taming procedure errors define CODSTATDEF_ErrCODSTATDEF_SinDet Word16Size Lsp previous vector define CODSTATDEF_PrevLspCODSTATDEF_Err Word32Size SizErr All pitch operation buffers define CODSTATDEF_PrevWgtCODSTATDEF_PrevLsp Word16Size LpcOrder define CODSTATDEF_PrevErrCODSTATDEF_PrevWgt Word16Size PitchMax define CODSTATDEF PrevExcCODSTATDEF PrevErr Word16Size PitchMax Reguired memory for the delay
15. Rate Speech Codec demo modules c sources contains an example demo code for the G 723 1A Dual Rate Speech Codec configintram contains configuration files appconfig c appconfig h and linker cmd specific to the G 723 1A Dual Rate Speech Codec demo 2 4 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 3 G 723 1A Codec Library Interfaces 3 1 G 723 1A Codec Services The principal application of the G 723 1A speech codec is compression of speech in either of two very low bit rates for telephony applications 3 2 Interface The C interface for the G 723 1A Dual Rate Speech Codec library service is defined in the C header files 723 h shown in Code Example 3 1 SDK defines the G 723 1A Dual Rate Speech Codec library G 723 1A Dual Rate Speech Codec Library g723 lib A description of the interfaces and services provided follow Code Example 3 1 C Header File g723 h if x 5 2 The Channell structure needs to be long word aligned the following x declaration can be used to guarantee this fe long Channell GLOBAL MEM Size 2 x gt x pe The input and output speech arrays should be declared as follows 2 fr int EncodeSpeech Frame k int DecodeSpeech Frame 2 ie wy
16. encoding and decoding Cod Sets encoding only Dec Sets decoding only WrkRate To select the speech codec s rate Rate 63 6 3kBps Rate53 5 3kBps extra extra time Returns None Special Considerations None 3 20 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 7 Use of the Init_Dec_Cng Interface Specifications include g723 h LOCAL VARIABLES define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 APPLICATION int test g7231la void Set two s complement rounding and enable saturation dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as voice activity detection and confort noise generation Init_Coder Channel1 Init Dec Cng Channell MOTOROLA G 723 1A Codec Library Interfaces 3 21 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 7 Decod Call s Word16 Decod Word32 Word16 Word16 Word16 Word16 Required Header g723 h Channel DecodeSpeech DecodeCh
17. to a large variety of hardware platforms To take full advantage of a particular hardware platform use Quick Start from the appropriate Targeting Motorola DSP568xx Platform documentation For example the Targeting Motorola DSP56852 Platform manual provides more specific information and examples about this hardware architecture If you are developing an application for a DSP56852EVM board or any other DSP56852 development system refer to the Targeting Motorola DSP56852 Platform manual for Quick Start or other DSP56852 specific information 1 2 Overview of G 723 1A Dual Rate Speech Coder The ITU T Recommendation G 723 1 Dual Rate Speech Coder provides a coded representation used for compressing speech in either of two very low bit rates The higher 6 3 Kbits s rate produces a greater quality reproduction while the lower 5 3 Kbits s rate provides system designers additional flexibility Both rates are mandatory and it is possible to switch between the rates on any 30ms frame boundary Annex A of this Recommendation G 723 1A provides an optional silence compression system used to reduce the transmitted bit rate during silent intervals of speech This coder was optimized to represent speech with a high quality of the two rates using a limited amount of complexity Music and other audio signals are not represented as faithfully as speech but can be compressed and decompressed using this coder MOTOROLA Introduction 1 1 For More Information On Th
18. 723 1A Codec Library HEkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 5 Use of Coder Interface include g723 h LOCAL FUNCTIONS PROTOTYPES E Wordl6 ReadSpeech char buffer int fin Wordl6 ReadChannel char buffer int fin LOCAL VARIABLES k define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 Declare the G 723 speech buffers Word16 EncodeChannel EncodedFrame Declare encoded channel buffers Word16 EncodeSpeech Frame Word16 OutputSpeech Frame Declare an ascii I O buffer char ioBuffer 2 EncodedFrame APPLICATION MAIN int main void int f_tstfile File of interleaved input speech channel data and output speech char TestFile PC Embedded SDK src dsp56858evm nos telephony g723 g723_test ref_data tstboth bin Word16 i CoderRate BitErrors Word16 frames CoderRate Rate63 BitErrors 0 f tstfile open TestFile O RDONLY if f tstfile NULL assert Error opening the test file Set two s complement rounding and enable saturation dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as 3 16 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product
19. A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 if ReadChannel char DecodeChannel f tstfile break for i 0 i lt EncodedFrame i if DecodeChannel i EncodeChannel i BitErrors Decod Channe11 Speechdata Channeldata Crc UsePf Decod Channell DecodeSpeech DecodeChannel 0 True if ReadSpeech char OutputSpeech f tstfile break for i 0 i lt Frame i if OutputSpeech i DecodeSpeech i BitErrors close f_tstfile 3 24 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com A 9 INC 200 gt Ny F CTO SEMICONDU ESCALE RE Y B HIVED i F v RC A Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 4 Building the G 723 1A Codec Library 4 1 Building the G 723 1A Codec Library The G 723 1A Codec library combines all of the components described in the previous sections into one library g723 lib This library s code is not provided with the SDK therefore it cannot be built from the SDK The G 723 1A Codec library g723 lib is provided in the nos telephony g723 directory of the SDK directory structure MOTOROLA Building the G 723 1A Codec Library 4 1 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SE
20. A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 2 Init_Vad Call s Specifications void Init Vad Word32 Channel Required Header g723 h Arguments Table 3 2 Init_Vad Arguments Channel inout A pointer to a data structure containing channel information for the G 723 1A algorithm Description The nit_Vad function initializes the G 723 1A VAD static variables During initialization all resources will be set to their initial values in preparation for G 723 1A operation The nit_Vad function should be called only once before the first call to the Coder function The parameter Channel points to a data structure of type Word32 its fields initialize G 723 1A operation in the following manner Use_Hp Sets high pass filtering TRUE Sets high pass filtering FALSE No high pass filtering is set Use_Pf Sets post filtering TRUE Sets post filtering FALSE No post filtering is set Use_Vx Sets VAD CNG TRUE Sets VAD CNG FALSE No VAD CNG is set WrkMode Selects encoding decoding or both Both Sets encoding and decoding Cod Sets encoding only Dec Sets decoding only WrkRate Selects the speech codec s rate Rate 63 6 3kBps Rate53 5 3kBps extra extra time Returns None Special Considerati
21. About This Document This manual describes the G 723 1A Dual Rate Speech Coder with Annex A Silence Compression Scheme Codec algorithm for use with Motorola s Embedded Software Development Kit SDK Audience This document targets software developers implementing G 723 1A Codec within software applications Organization This manual is arranged in the following sections e Chapter 1 Introduction provides a brief overview of this document e Chapter 2 Directory Structure provides a description of the required core directories e Chapter 3 G 723 1A Codec Library Interfaces describes all of the G723 1A Library functions e Chapter 4 Building the G 723 1A Codec Library tells how to execute the system library project build e Chapter 5 Linking Applications with the G 723 1A Codec Library describes the organization of the G 723 1A Library e Chapter 6 G 723 1A Applications describes the use of the G 723 1A Library through test demo applications e Chapter 7 License provides the license required to use this product Suggested Reading We recommend that you have a copy of the following references e DSPS56800E Family Manual DSP56800ERM D e DSP5685x User s Manual DSP5685xUM AD e Inside CodeWarrior Core Tools Metrowerks Corp MOTOROLA Preface ix For More Information On This Product Go to www freescale com Freescale Semiconductor Inc ARCHIV Conventions ED BY FREESCALE SEMICONDUCTOR INC 2005
22. Addr define DECCNGDEF_PastFtypDECCNGDEF_CurGain Word16Size define DECCNGDEF_LspSidDECCNGDEF_PastFtyptWord16Size define DECCNGDEF_SidGainDECCNGDEF_LspSid Word16Size LpcOrder define DECCNGDEF_RandSeedDECCNGDEF_SidGain Word16Size define DECCNGDEF_SizeDECCNGDEF_RandSeed Word16Size Defines for offsets into global memory define CodStat BaseAddr define CodCng CodStat CODSTATDEF_Size define DecCng CodCng CODCNGDEF Size define VadStat DecCng DECCNGDEF Size define DecStat VadStat VADSTATDEF Size define UseHp DecStat DECSTATDEF Size define UsePf UseHp Wordl6Size define UseVx UsePf Wordl6Size 3 6 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc Interface ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 define WrkMode UseVx Wordl6Size define WrkRate WrkMode Word16Size define extra WrkRate Word16Size define GLOBAL MEM Size extra Wordl6Size endif MOTOROLA G 723 1A Codec Library Interfaces 3 7 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 Specifications The following pages describe the G 723 1A Dual Rate Speech Codec library functions Function argumen
23. BASIS AND WITHOUT WARRANTY OF ANY KIND INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE IN NO EVENT SHALL MOTOROLA BE LIABLE FOR MOTOROLA License 7 1 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ANY LIABILITY OR DAMAGES OF ANY KIND INCLUDING WITHOUT LIMITATION DIRECT OR INDIRECT OR INCIDENTAL OR CONSEQUENTIAL OR PUNITIVE DAMAGES OR LOST PROFITS OR LOSS OF USE ARISING FROM USE OF THE SOFTWARE OR THE PRODUCT REGARDLESS OF THE FORM OF ACTION OR THEORY OF LIABILITY INCLUDING WITHOUT LIMITATION ACTION IN CONTRACT NEGLIGENCE OR PRODUCT LIABILITY EVEN IF MOTOROLA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THIS DISCLAIMER OF WARRANTY EXTENDS TO LICENSEE OR USERS OF PRODUCTS AND IS IN LIEU OF ALL WARRANTIES WHETHER EXPRESS IMPLIED OR STATUTORY INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR PARTICULAR PURPOSE Motorola does not represent or warrant that the Software is free of infringement of any third party patents copyrights trade secrets or other intellectual property rights or that Motorola has the right to grant the licenses contained herein Motorola does not represent or warrant that the Software is free of defect or that it meets any particular requirements or need of the Licensee or that it conforms to any documen
24. CALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 List of Examples Code Example Code Example Code Example Code Example Code Example Code Example Code Example Code Example Code Example MOTOROLA 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 5 1 C Header File 2723 sadech beeeseensegusk ad eade Use of the Init Coder Interface sca os hse bio 504d 405 5eereawns Use of the Init Vad Interface ooo de bb k kc Use of the Init Cod Cng interlace 2iccadasaccideaeaxivaes s Useni Cader niere 4 6s ceidenea scans naa AEE Use of the Init Decor Interfage a5 6 ns 44 56 howe de esa sodesaaes Use of the Init Dec Cna MRGETGS senei Pes whet kose eens eee ay Useni Decod Ts 5 aw aaa ree Eee dew ee kew a eer ess Haero Fle 4 3 3 4 9 k o aa I a dok A da List of Examples For More Information On This Product Go to www freescale com vii Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 viii Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005
25. EMENT CAREFULLY BEFORE USING THIS SOFTWARE BY USING OR COPYING THE SOFTWARE YOU AGREE TO THE TERMS OF THIS AGREEMENT The software in either source code form Source or object code form Object cumulatively hereinafter Software is provided under a license agreement Agreement as described herein Any use of the Software including copying modifying or installing the Software so that it is usable by or accessible by a central processing unit constitutes acceptance of the terms of the Agreement by the person or persons making such use or if employed the employer thereof Licensee and if employed the person s making such use hereby warrants that they have the authority of their employer to enter this license agreement If Licensee does not agree with and accept the terms of this Agreement Licensee must return or destroy any media containing the Software or materials related thereto and destroy all copies of the Software The Software is licensed to Licensee by Motorola Incorporated Motorola for use under the terms of this Agreement Motorola retains ownership of the Software Motorola grants only the rights specifically granted in this Agreement and grants no other rights Title to the Software all copies thereof and all rights therein including all rights in any intellectual property including patents copyrights and trade secrets applicable thereto shall remain vested in Motorola For the Source Motorola grants Licensee
26. ESCALE SEMICONDUCTOR INC 2005 Linking Applications with Fregsgale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 5 1 inker cmd File Heke kk A kk k kk A A A A A kA k kk k k k A k A A k A A kA kk A I k A I KKK KKK F F Linker cmd file for DSP56852 Internal RAM i using both internal and external program i and data memory F pk kk kk kk k kk kk k A kk kk k k kk A k k A A A A kkk kkk kkk kkk A kkk kK k KKK KKK KKK IKK EMORY pInterruptVector RWX ORIGIN 0x000000 LENGTH 0x00008C pIntRA RWX ORIGIN 0x00008C LENGTH 0x009f74 PEXtRAI RWX ORIGIN 0x001800 LENGTH 0x1EE800 LS010703 Changed to use Viper extended internal RAM temporarily PEXtRAI RWX ORIGIN 0x00a000 LENGTH 0x00B800 pIntRO RX ORIGIN 0x1F0000 LENGTH 0x000400 XIntRAl RW ORIGIN 0x000000 LENGTH 0x000800 xIntRAM DynamicMem RW ORIGIN 0x000800 LENGTH 0x000800 xStack RW ORIGIN 0x001000 LENGTH 0x001000 xExtRAM DynamicMem RW ORIGIN 0x007800 LENGTH 0x000800 xExtRAl RW ORIGIN 0x002800 LENGTH 0x1FD400 LS010703 Changed to use Viper extended internal RAM temporarily xExtRAl RW ORIGIN 0x002000 LENGTH 0x005000 xPeripherals RW ORIGIN Ox1FFC00 LENGTH 0x000400 XEXtRAM2 RW ORIGIN 0x200000 LENGTH
27. Freescale Semiconductor Inc MOTOROLA _ Embedded SDK Software Development Kit G 723 1A Speech Codec Library SDK138 D Rev 1 07 19 2002 le h d MOTOROLA iy Motorola Inc 2002 All rights reserved intelligence everywhere digitaldna For More Information On This Product o to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Contents About This Document A ee ee ee eee eee eee ee db k ee ee 1X A P MO R O P O O O P ee Rea eS 1X SUCCOMC BONN zv na d Kika k ak ach tr irei ix a a 6254 6564 6 9s 60435455 66586 ER ees E E E EET X Definitions Acronyms and Abbreviations 2 4424 4620dseieaserasrwnaeen ds X gt R ee XI Chapter 1 Introduction a ZAL 0 4 245 608 E E EE E oh 85464 Hoss da ORE eE ERS 1 1 12 Overview of G 723 1A Dual Rate Speech Coder c 522ccn2 annaran 1 1 1 2 1 koa E EE E oe u E E E E E sees 1 2 122 Pater and ee go ho Gh oh hs ws SEE HR B lo ews oe 1 3 Chapter 2 Directory Structure 21 Required Core Directories 4 cu esses songs sd sedeneseeeed ence ee deneie es 2 1 2 2 Optional Domain Specific Directories lt 1ccceescaseses sss Sedeoesse ds 2 2 Bon Demo Directory bos o es do V Roo r BC k S 2
28. MICONDUCTOR INC 2005 Building the G723 1A Coded isp Ale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 4 2 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA I E SEMICONDUCTOR INC 2005 L ESCAI ED BY FRE ARCHI Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 5 Linking Applications with the G 723 1A Codec Library 5 1 G 723 1A Codec Library The G 723 1A library consists of Applications Program Interfaces APIs which provide interface between the user application and the G 723 1A Codec modules To invoke G 723 1A Codec APIs must be called in this order For Encoder Init Coder Called once before Coder Init Vad Called once before Coder Init Cod Cng Called once before Coder Coder Can be called by the number of samples For Decoder Init_Decod Called once before Decod Init_Dec_Cng Called once before Decod Decod Can be called by the number of samples A sample linker command file linker cmd used in the test application for encoder and decoder is shown in Code Example 5 1 MOTOROLA Linking Applications with the G 723 1A Codec Library 5 1 For More Information On This Product Go to www freescale com ARCHIVED BY FRE
29. Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 2 Directory Structure 2 1 Required Core Directories Figure 2 1 details required platform directories E Ga sic EG dsp56858evm 4 nos applications C bsp 3 config 3 include E sys 3 tools Figure 2 1 Core Directories H As shown in Figure 2 1 DSP56858EVM has no operating system nos support This platform contains these core directories applications contains applications software that can be exercised on this platform e bsp contains board support package specific for this platform e config contains default hardware software configurations for this platform include contains SDK header files which define the Application Programming Interface e sys contains required system components e tools contains utilities used by system components There are also optional directories that include domain specific libraries MOTOROLA Directory Structure 2 1 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 2 2 Optional Domain Specific Directories Figure 2 2 demonstrates how the G 723 1A Dual Rate Speech Codec is encapsulated in the domain specific directory telephony Directory Structure 3 src dsp56858evm nos A applications
30. Word16Size define VADSTATDEF NlevVADSTATDEF Penr Word32Size define VADSTATDEF_AenVADSTATDEF_Nlev Word32Size define VADSTATDEF PolpVADSTATDEF Aen Wordl6Size define VADSTATDEF_NLpcVADSTATDEF_Polp Word16Size 4 define VADSTATDEF SizeVADSTATDEF NLpc Word16Size LpcOrder CNG features Defines for CODCNGDEF structure elements Coder part define CODCNGDEF CurGainBaseAddr define CODCNGDEF PastFtypCODCNGDEF CurGain Wordl6Size define CODCNGDEF AcfCODCNGDEF PastFtyp Wordl6Size define CODCNGDEF_ShAcf CODCNGDEF_Acf Wordl6Size SizAcf define CODCNGDEF_LspSidCODCNGDEF_ShAcf Wordl6Size NDAVAcf 1 define CODCNGDEF SidLpcCODCNGDEF LspSid Word16Size LpcOrder define CODCNGDEF RC CODCNGDEF SidLpc Word16Size LpcOrder define CODCNGDEF_ShRCCODCNGDEF_RC Word16Size LpcOrderP1 define CODCNGDEF_EnerCODCNGDEF_ShRC Word16Size define CODCNGDEF_NbEnerCODCNGDEF_Ener Word16Size NbAvGain define CODCNGDEF_IRefCODCNGDEF_NbEner Word16Size define CODCNGDEF_SidGainCODCNGDEF_IRef Word16Size define CODCNGDEF_RandSeedCODCNGDEF_SidGain Word16Size define CODCNGDEF_SizeCODCNGDEF_RandSeed Word16Size Defines for DECCNGDEF structure elements Decoder part define DECCNGDEF_CurGainBase
31. a personal non exclusive non assignable revocable royalty free right to use copy and make derivatives of the Source solely in a development system environment in order to produce object code solely for operating on a Motorola semiconductor device having a central processing unit Derivative Object For the Object and Derivative Object Motorola grants Licensee a personal non exclusive non assignable revocable royalty free right to copy use and distribute the Object and the Derivative Object solely for operating on a Motorola semiconductor device having a central processing unit Licensee agrees to a not use modify or copy the Software except as expressly provided herein b not distribute disclose transfer sell assign rent lease or otherwise make available the Software any derivatives thereof or this license to a third party except as expressly provided herein c not remove obliterate or otherwise defeat any copyright trademark patent or proprietary notices related to the Software d not in any form export re export resell ship or divert or cause to be exported re exported resold shipped or diverted directly or indirectly the Software or a direct product thereof to any country which the United States government or any agency thereof at the time of export or re export requires an export license or other government approval without first obtaining such license or approval THE SOFTWARE IS PROVIDED ON AN AS IS
32. ame SubFrames define EncodedFrame 12 3 2 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc Interface ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 LPC constants define LpcOrder 10 define RidgeFact 10 define CosineTableSize512 define PreCoef Oxc000 define LspPrd0 12288 define LspPrdl 23552 define LspOntBands 3 define LspCbSize 256 define LspCbBits 8 LTP constants define PitchMin 18 define PitchMax PitchMin 127 define PwConst 0x2800 define PwRange 3 define C1PitchOrd 5 define Pstep 1 define NbFilt085 85 define NbFilt170 170 MP MLQ constants define Sgrid 2 define MaxPulseNum 6 define MlgSteps 2 acelp constants define SubFrLen2 SubFrLen 4 define DIM RR 416 define NB_POS 8 define STEP 8 define MSIZE 64 define threshold 16384 define max_time 120 Gain constant define NumOfGainLev 24 FER constant define ErrMaxNum 3 CNG constants define NbAvAcf 3 define NbAvGain 3 define ThreshGain 3 define FracThresh 7000 define NbPulsBlk 11 define InvNbPulsBlk 2979 define NbFilt 50 define LpcOrderP1 LpcOrder 1 define SizAcf NbAVAcf 1 LpcOrderP1 define SubFrLenD 2 SubFrLen define Gexc Max 5000 MOTOROLA G 723 1A Codec Library Interfaces 3 3 For More Information
33. annel Cre UseP Arguments Table 3 7 Decod Arguments Channel in A pointer to a data structure containing channel information for the G 723 1A algorithm DecodeSpeech inout Pointer to empty speech buffer EncodeChannel in Pointer to an encoded frame of speech data Cre in Frame erasure indicator UsePf in Post filter flag Description The Decod function processes the 5 3 or 6 3kBps encoded input and decodes it to speech samples Returns Decod will return PASS after successful encoding Special Considerations None Code Example 3 8 Use of Decod Interface include g723 h LOCAL FUNCTIONS PROTOTYPES Wordl6 ReadSpeech char buffer i Wordl16 ReadChannel char buffer x nt fin int fin LOCAL VARIABLE g define NUM_FRAMES 860 Dec Word32 Dec Word16 Word16 3 22 Channe 11 GLOBAL MEM Size 2 lare the ChannelMem structure li lare the G 723 speech buffers EncodeChannel EncodedFrame DecodeChannel EncodedFrame G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Word16 Word16 Word16 Freescale Semiconductor Inc Specifications ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Declare encoded channel buffers EncodeSpeech Frame DecodeSpeech F
34. ble 3 6 Table 3 7 MOTOROLA Init Coder Arguments 493554405445 b4osh 456405544 beaee eed eee deed Ti Pe ed eg ke oh R k ed VE mic God Cor Arme MK S R O O eee Coder AISUMGNE lt s aska v kakikakuhkakisauks kakakekadav kkk kc Tut DUR M ona dndn bod n ash k ek m ds ed ks ka Tnit Deco Cig Fe I R P O O O wot RI EEn RES ENRE DEDO EMS o ob a Sp bts do hh Jo A List of Tables For More Information On This Product Go to www freescale com Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 List of Figures Figure 2 1 Figure 2 2 Figure 2 3 Figure 2 4 Figure 2 5 MOTOROLA Core DieChiies 664445400 be este ds ob hd ck bd endte Ee DCT ceasefire ao r o A ok o dn kos G723 1A Dual Rate Speech Codec Directory Structure 5242200000085 SDK Application Directory Structure 2 4 2 65205482 602464644 b0 400444083 272 CI CNS seriene radi da abb s d ee o List of Figures For More Information On This Product Go to www freescale com Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 vi Freescale Semiconductor Inc ARCHIVED BY FREES
35. commendation G 723 1 Annex A MOTOROLA Preface xi For More Information On This Product Go to www freescale com Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 xii Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Chapter 1 Introduction Welcome to Motorola s Family of Digital Signal Processors DSPs This document describes the G 723 1A Dual Rate Speech Coder Library which is a part of Motorola s comprehensive Software Development Kit SDK for its DSPs In this document you will find all the information required to use and maintain the G 723 1A Dual Rate Speech Coder Library interface and algorithms Motorola provides these algorithms to you for use on the Motorola Digital Signal Processors to expedite your application development and reduce the time it takes to bring your own products to market Motorola s G 723 1A Dual Rate Speech Coder Library is licensed for your use on Motorola processors Please refer to the standard Software License Agreement in Chapter 7 for license terms and conditions please consult with your Motorola representative for premium product licensing 1 1 Quick Start Motorola s Embedded SDK is targeted
36. for PFD pitch postfilter parameters define PFD define PFD define PFD define PFD Defines for B EF Indx EF Gain EF ScGn EF Size ESTDEF struc best excitation vector parame BaseAddr PFD PFD PFD ture eleme ters for the high rate EF structure elements EF Indx Word16Size BF Gain Wordl6Size EF ScGn Wordl6Size nts EF Size SubFrames define BESTDEF_MaxErrBaseAddr define BESTDEF GridIdBESTDEF MaxErr Word32Size define BESTDEF MampIdBESTDEF GridId Wordl6Size define BESTDEF UseTrnBESTDEF MampId Wordl6Size MOTOROLA G 723 1A Codec Library Interfaces For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library HEkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 define BESTDEF Ploc BESTDEF UseTrn Wordl6Size define BESTDEF Pamp BESTDEF Ploc Word16Size MaxPulseNum define BESTDEF Size BESTDEF_Pamp Word16Size MaxPulseNum Defines for VADSTATDEF structure elements best excitation vector parameters for the high rate define VADSTATDEF_HcntBaseAddr define VADSTATDEF_VcntVADSTATDEF_Hcnt Word16Size define VADSTATDEF_PenrVADSTATDEF_Vcnt
37. i MIPS xi MP MLO xi MSB xi MOTOROLA O OMR xi OnCE xi Optional Directories 2 2 P PC xi PSVQ xi R Required Core Directories 2 1 S SDK xi Software License Agreement 1 1 SP xi SPI xi SR xi SRC xi V VAD xi Index For More Information On This Product Go to www freescale com Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Motorola reserves the right to make changes without further notice to any products herein Motorola makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Motorola assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability including without limitation consequential or incidental damages Typical parameters which may be provided in Motorola data sheets and or specifications can and do vary in different a
38. igintram contains configuration files appconfig c appconfig h and linker cmd specific to G726 Encoder Decoder testing ref_data contains files containing reference data used to compare the output of the test 2 3 Demo Directory Structure Figure 2 4 demonstrates how the G 723 1A Dual Rate Speech Codec demo g723 is encapsulated in the telephony directory under applications MOTOROLA Directory Structure 2 3 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Directory Structure nos applications E bsp A intelligent_speech a modem a multimedia A security A speech A telephony HC demo cpt 3 demo vad 3 dtmf det 3 dtmf gen faa 9165 Gj 9168 a g711 g723 F F F E ar H a g2 H E Figure 2 4 SDK Application Directory Structure The g723 directory includes G 723 1A Dual Rate Speech Codec demo specific algorithms Figure 2 5 shows the g723 directory structure telephony E demo_cpt 3 demo vad C dtmf det C dtmf gen a 9165 a 9168 a o 11 a 9723 HI c sources F configintram A 9725 1 1 B Figure 2 5 g723 Directory Structure e g723 includes c sources and configuration necessary for testing G 723 1A Dual
39. in accordance with the laws of the State of Arizona and can only be modified in a writing signed by both parties Licensee agrees to jurisdiction and venue in the State of Arizona By using modifying installing compiling or copying the Software Licensee acknowledges that this Agreement has been read and understood and agrees to be bound by its terms and conditions Licensee agrees that this Agreement is the complete and exclusive statement of the agreement between Licensee and Motorola and supersedes any earlier proposal or prior arrangement whether oral or written and any other communications relative to the subject matter of this Agreement 7 2 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Index A ACELP xi C CNG xi Coder 3 15 Conventions x D Decoder 5 1 Demo Directory Structure 2 3 DSP xi DSP56800E Reference Guide xi DSP5685x User s Manual xi E Embedded SDK Programmers Guide xi Encoder 5 1 G G 723 1A Dual Rate Speech Coder Library 1 1 G 723 1A Applications 6 1 G 723 1A Codec Library 5 1 VO xi IDE xi Init Cod Cng 3 13 Init Coder 3 9 Init Dec Cng 3 20 Init Decod 3 18 Init Vad 3 11 Interface 3 1 ITU T Recommendation G 723 1 xi ITU T Recommendation G 723 1 Annex A xi L Linking Applications 5 1 LPC xi LSB x
40. is Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 1 2 1 Background Introduction The ITU T G 723 1 Recommendation describes an algorithm for coding speech in frames using a linear predictive analysis by synthesis technique The excitation signal for the higher 6 3kBps rate is Multipulse Maximum Likelihood Quantization MP MLQ and for the low rate coder is Algebraic Code Excited Linear Prediction ACELP This coder encodes speech or other audio signals in 30ms frames In addition there is a look ahead of 7 5ms resulting in a total algorithmic delay of 37 5ms All additional delays in the implementation and operation of this coder are due to processing delays of the implementation transmission delays in the communication link and buffering delays of the multiplexing protocol This coder is designed to operate with a digital signal obtained by first performing telephone bandwidth filtering Recommendation G 712 of the analog input sampling at 8000Hz then converting to 16 bit linear PCM for the input to the encoder The output of the decoder should be converted back to analog by similar means Other input output characteristics such as those specified by Recommendation G 711 for 64kBps PCM data should be converted to 16 bit linear PCM before encoding or from 16 bit linear PCM to the appropriate format after decoding The bitstrea
41. ll be set to their initial values in preparation for G 723 1A Decoder operation The Init Decod function should be called only once before the first call to the Decod function The parameter Channel points to a data structure of type Word32 its fields initialize G 723 1A operation in the following manner Use_Hp Sets high pass filtering TRUE Sets high pass filtering FALSE No high pass filtering is set Use_Pf Sets post filtering TRUE Sets post filtering FALSE No post filtering is set Use_Vx Sets VAD CNG TRUE Sets VAD CNG FALSE No VAD CNG is set WrkMode Selects encoding decoding or both Both Sets encoding and decoding Cod Sets encoding only Dec Sets decoding only WrkRate Selects the speech codec s rate Rate 63 6 3kBps Rate53 5 3kBps extra extra time Returns None Special Considerations None 3 18 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 6 Use of the nit_Decod Interface Specifications include g723 h LOCAL VARIABLES define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 APPLICATION int test g7231la void Set two s complement rounding and enable saturation
42. m from the encoder to the decoder is defined within the ITU T G 723 1 Recommendation The coder is based on the principles of linear prediction analysis by synthesis coding and attempts to minimize a perceptually weighted error signal The encoder operates on blocks frames of 240 samples each 30ms Each block is first high pass filtered to remove the DC component then divided into four subframes of 60 samples each For every subframe a 10th order Linear Prediction Coder LPC filter is computed using the unprocessed input signal The LPC filter for the last subframe is quantized using a Predictive Split Vector Quantizer PSVQ The unquantized LPC coefficients are used to construct the short term perceptual weighting filter which filters the entire frame and obtains the perceptually weighted speech signal For every two subframes 120 samples the open loop pitch period Log is computed using the weighted speech signal This pitch estimation is performed on blocks of 120 samples The pitch period is searched in the range from 18 to 142 samples From this point the speech is processed on a 60 samples per subframe basis Using the estimated pitch period computed previously a harmonic noise shaping filter is constructed The combination of the LPC synthesis filter the formant perceptual weighting filter and the harmonic noise shaping filter is used to create an impulse response The impulse response is then used for further computations
43. nd abbreviations used in this document As this template develops this list will be generated from the document As we develop more group resources these acronyms will be easily defined from a common acronym dictionary Please note that while the acronyms are in solid caps terms in the definition should be initial capped ONLY IF they are trademarked names or proper nouns For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ACELP Algebraic Code Excited Linear Prediction CNG Comfort Noise Generator DSP Digital Signal Processor or Digital Signal Processing Vo Input Output IDE Integrated Development Environment LPC Linear Prediction Coder LSB Least Significant Byte MIPS Million Instructions Per Second MP MLO Multipluse Maximum Likelihood Ouantization MSB Most Significant Byte OnCE On Chip Emulation OMR Operating Mode Register PC Program Counter PSVQ Predictive Split Vector Quantizer SDK Software Development Kit SP Stack Pointer SPI Serial Peripheral Interface SR Status Register SRC Source VAD Voice Activity Detector References The following sources were referenced to produce this book 1 DSP56800E Reference Guide DSP56800ERM D 2 DSP5685x User s Manual DSP5685xUM AD 3 Embedded SDK Programmer s Guide SDK101 D 4 ITU T Recommendation G 723 1 5 ITU T Re
44. o a data structure of type Word32 its fields initialize G 723 1A operation in the following manner Use_Hp Sets high pass filtering TRUE Sets high pass filtering FALSE No high pass filtering is set Use_Pf Sets post filtering TRUE Sets post filtering FALSE No post filtering is set Use_Vx Sets VAD CNG TRUE Sets VAD CNG FALSE No VAD CNG is set WrkMode Selects encoding decoding or both Both Sets encoding and decoding Cod Sets encoding only Dec Sets decoding only WrkRate Selects the speech codec s rate Rate 63 6 3kBps Rate53 5 3kBps extra extra time Returns None Special Considerations None MOTOROLA G 723 1A Codec Library Interfaces 3 9 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 2 Use of the Init Coder Interface include g723 h LOCAL VARIABLES define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 APPLICATION int test g7231la void Set two s complement rounding and enable saturation dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as voice activity detection and confort noise generation Init_Coder Channel1 3 10 G 723 1
45. ons None MOTOROLA G 723 1A Codec Library Interfaces 3 11 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 3 Use of the nit_Vad Interface include g723 h LOCAL VARIABLES define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 APPLICATION int test g7231la void Set two s complement rounding and enable saturation dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as voice activity detection and confort noise generation Init_Coder Channel1 Init Vad Channell 3 12 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 3 Init Cod Cng Call s Specifications void Init Cod Cng Word32 Channel Required Header g723 h Arguments Table 3 3 Init Cod Cng Arguments Channel inout A pointer to a data structure containing channel information for the G 723 1A algorithm Description The Init Cod Cng function initializes the G 723 1A Cod Cng static variables During initializa
46. pplications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Motorola does not convey any license under its patent rights nor the rights of others Motorola products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur Should Buyer purchase or use Motorola products for any such unintended or unauthorized application Buyer shall indemnify and hold Motorola and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part Motorola and the Stylized M Logo are registered trademarks of Motorola Inc Motorola Inc is an Equal Opportunity Affirmative Action Employer MOTOROLA and the Stylized M Logo are registered in the US Patent amp Trademark Office All other product or service names are the property of their respective owners Motorola Inc 2002
47. rame OutputSpeech Frame Declare an ascii I O buffer ioBuffer 2 EncodedFrame char APPLICATION MAIN int main void int f_tstfile File of interleaved input speech channel data and output speech char TestFile PC Embedded SDK srce dsp56858evm nos telephony g723 g723_test ref_data tstboth bin Word16 i CoderRate Word16 frames CoderRate Rate63 BitErrors 0 BitErrors f_tstfile open TestFile O RDONLY assert Error opening the test file if f_tstfile NULL Set two s complement rounding and enable saturation dspfuncInitialize Initialize the G 72 3 vocoder enc ode and decode functions as well as voice activity detection and confort noise generation Init_Coder Channel1 Init Vad Channell Init Cod Cng Channell Init Decod Channell Init Dec Cng Channell r r for frames 0 frames lt NUM FRAMES frames if ReadSpeech char EncodeSpeech f_tstfile break for i 0 i lt EncodedFrame i EncodeChannel i 0 DecodeChannel i 0 Coder Channell EncodeSpeech EncodeChannel True True CoderRate MOTOROLA G 723 1A Codec Library Interfaces 3 23 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1
48. tation or that it meets any standards License Motorola shall not be responsible to maintain the Software provide upgrades to the Software or provide any field service of the Software Motorola reserves the right to make changes to the Software without further notice to Licensee The Software is not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Software could create a situation where personal injury or death may occur Should Licensee purchase or use the Software for any such unintended or unauthorized application Licensee shall indemnify and hold Motorola and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Motorola was negligent regarding the design or manufacture of the Software The term of this Agreement is for as long as Licensee uses the Software for its intended purpose and is not in default of any provisions of this Agreement Motorola may terminate this Agreement if Licensee is in default of any of the terms and conditions of this Agreement This Agreement shall be governed by and construed
49. tion all resources will be set to their initial values in preparation for G 723 1A operation The Init Cod Cng function should be called only once before the first call to the Coder function The parameter Channel points to a data structure of type Word32 its fields initialize G 723 1A operation in the following manner Use_Hp Sets high pass filtering TRUE Sets high pass filtering FALSE No high pass filtering is set Use_Pf Sets post filtering TRUE Sets post filtering FALSE No post filtering is set Use_Vx Sets VAD CNG TRUE Sets VAD CNG FALSE No VAD CNG is set WrkMode Selects encoding decoding or both Both Sets encoding and decoding Cod Sets encoding only Dec Sets decoding only WrkRate To select the speech codec s rate Rate 63 6 3kBps Rate53 5 3kBps extra extra time Returns None Special Considerations None MOTOROLA G 723 1A Codec Library Interfaces 3 13 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Codec Library Hkreescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Code Example 3 4 Use of the Init_Cod_Cng Interface include g723 h LOCAL VARIABLES define NUM FRAMES 860 Declare the ChannelMem structure Word32 Channell GLOBAL MEM Size 2 APPLICATION int test g7231la void Set two s complement ro
50. ts for each routine are described as in out or inout An in argument means that the parameter value is an input only to the function An out argument means that the parameter value is an output only from the function An inout argument means that a parameter value is an input to the function but the same parameter is also an output from the function Typically inout parameters are input pointer variables in which the caller passes the address of a preallocated data structure to a function The function stores its results within that data structure The actual value of the inout pointer parameter is not changed 3 8 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 1 Init Coder Call s Specifications void Init Coder Word32 Channel Required Header g723 h Arguments Table 3 1 Init Coder Arguments Channel inout A pointer to a data structure containing channel information for the G 723 1A algorithm Description The nit_Coder function initializes the G 723 1A Encoder algorithm During initialization all resources will be set to their initial values in preparation for G 723 1A Encoder operation The Init_Coder function should be called only once before the first call to the Coder function The parameter Channel points t
51. unding and enable saturation dspfuncInitialize Initialize the G 723 vocoder encode and decode functions as well as voice activity detection and confort noise generation Init Coder Channell Init Vad Channell Init Cod Cng Channell 3 14 G 723 1A Speech Codec Library MOTOROLA For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 3 3 4 Coder Call s Word16 Coder Word32 Word16 Word16 Word16 Word16 Word16 Required Header g723 h Channel EncodeSpeech EncodeChannel UseHp UseVx WrkRate Arguments Table 3 4 Coder Arguments Channel in A pointer to a data structure containing channel information for the G 723 1A algorithm EncodeSpeech in Pointer to frame of speech data EncodeChannel inout Pointer to an encoded frame of speech data UseHp in High pass filter flag UseVx in VAD CNG flag WrkRate in Specifies 5 3 or 6 3kBps Description The Coder function processes input samples and encodes them to either 5 3 or 6 3 kbps output rate Returns Coder will return PASS after successful encoding Special Considerations None MOTOROLA G 723 1A Codec Library Interfaces For More Information On This Product Go to www freescale com Specifications ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G
52. whose output is input to the formant post filter A gain scaling unit maintains the energy at the input level of the formant post filter The ITU T G 732 1 Annex A is the silence compression system for the G 723 1 vocoder Silence compression techniques are used to reduce the transmitted bit rate during silent intervals of speech Systems allowing discontinuous transmission are based on a Voice Activity Detection VAD algorithm and a Comfort Noise Generator CNG algorithm that allows the insertion of an artificial noise during silence periods This feature is necessary to avoid the noise modulation introduced when the transmission is switched off If the background acoustic noise that was present during active periods abruptly disappears this very unpleasant noise modulation may even reduce the intelligibility of the speech 1 2 2 Features and Performance The G 723 1A Dual Rate Speech Coder library is multichannel and re entrant For details on Memory and MIPS for a particular DSP refer to the Libraries chapter of the appropriate Targeting manual MOTOROLA Introduction 1 3 For More Information On This Product Go to www freescale com ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Introduction Freescale Semiconductor Inc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 G 723 1A Speech Codec Library For More Information On This Product Go to www freescale com MOTOROLA ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 Freescale

Download Pdf Manuals

image

Related Search

Related Contents

0200337_FT Nutrifix Herb  Troubleshooting service  Samsung SFN-Z40T User Manual    Panasonic KX-TDA100 KX-TDA200 Hybrid IP  "取扱説明書"  Manule InfoPanel  取扱説明書  MD Editor 2 - MiniDisc Community Page  家庭用 保 - yodobashi.com  

Copyright © All rights reserved.
Failed to retrieve file