Part Number Hot Search : 
24C01 4029B 2620T 682M16 ABE0121 FQB11P06 MC100 PCI954
Product Description
Full Text Search
 

To Download USAB13AP77016-XXX-B06 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  user?s manual target devices pd77018a pd77019 pd77110 pd77111 pd77112 pd77113a pd77114 sap77016-b06 amr speech codec middleware document no. u15165ej3v0um00 (3rd edition) date published june 2002 n cp(n) printed in japan 2001
user?s manual u15165ej3v0um 2 [memo]
user?s manual u15165ej3v0um 3 windows and windows nt are either registered trademarks or trademarks of microsoft corporation in the united states and/or other countries. m8e 00. 4 the information in this document is current as of may, 2002. the information is subject to change without notice. for actual design-in, refer to the latest publications of nec's data sheets or data books, etc., for the most up-to-date specifications of nec semiconductor products. not all products and/or types are available in every country. please check with an nec sales representative for availability and additional information. no part of this document may be copied or reproduced in any form or by any means without prior written consent of nec. nec assumes no responsibility for any errors that may appear in this document. nec does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of nec semiconductor products listed in this document or any other liability arising from the use of such products. no license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec or others. descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. the incorporation of these circuits, software and information in the design of customer's equipment shall be done under the full responsibility of customer. nec assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec endeavours to enhance the quality, reliability and safety of nec semiconductor products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. to minimize risks of damage to property or injury (including death) to persons arising from defects in nec semiconductor products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment, and anti-failure features. nec semiconductor products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to semiconductor products developed based on a customer-designated "quality assurance program" for a specific application. the recommended applications of a semiconductor product depend on its quality grade, as indicated below. customers must check the quality grade of each semiconductor product before using it in a particular application. "standard": com puters, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots "special": transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support) "specific": aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. the quality grade of nec semiconductor products is "standard" unless otherwise expressly specified in nec's data sheets or data books, etc. if customers wish to use nec semiconductor products in applications not intended by nec, they must contact an nec sales representative in advance to determine nec's willingness to support a given application. (note) (1) "nec" as used in this statement means nec corporation and also includes its majority-owned subsidiaries. (2) "nec semiconductor products" means any semiconductor product developed or manufactured by or for nec (as defined above). ? ? ? ? ? ?
user ? s manual u15165ej3v0um 4 regional information some information contained in this document may vary from country to country. before using any nec product in your application, piease contact the nec office in your country to obtain a list of authorized representatives and distributors. they will verify: ? device availability ? ordering information ? product release schedule ? availability of related technical literature ? development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, ac supply voltages, and so forth) ? network requirements in addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. nec electronics inc. (u.s.) santa clara, california tel: 408-588-6000 800-366-9782 fax: 408-588-6130 800-729-9288 nec electronics hong kong ltd. hong kong tel: 2886-9318 fax: 2886-9022/9044 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-528-0303 fax: 02-528-4411 nec electronics shanghai, ltd. shanghai, p.r. china tel: 021-6841-1138 fax: 021-6841-1137 nec electronics taiwan ltd. taipei, taiwan tel: 02-2719-2377 fax: 02-2719-5951 nec electronics singapore pte. ltd. novena square, singapore tel: 253-8311 fax: 250-3583 nec do brasil s.a. electron devices division guarulhos-sp, brasil tel: 11-6462-6810 fax: 11-6462-6829 j02.4 nec electronics (europe) gmbh duesseldorf, germany tel: 0211-65 03 01 fax: 0211-65 03 327  sucursal en espa ? a madrid, spain tel: 091-504 27 87 fax: 091-504 28 60 v lizy-villacoublay, france tel: 01-30-67 58 00 fax: 01-30-67 58 99  succursale fran ? aise  filiale italiana milano, italy tel: 02-66 75 41 fax: 02-66 75 42 99  branch the netherlands eindhoven, the netherlands tel: 040-244 58 45 fax: 040-244 45 80  branch sweden taeby, sweden tel: 08-63 80 820 fax: 08-63 80 388  united kingdom branch milton keynes, uk tel: 01908-691-133 fax: 01908-670-290
user?s manual u15165ej3v0um 5 major revisions in this edition page contents throughout deletion of pd77018 and 77113 from the target device p.12 change of 1.3.1 features p.12 change of 1.3.2 (2) required memory size p.13 change of table 1-3 operation quantity of amr speech codec p.14 change of 1.3.4 directory configuration p.15 change of 1.3.5 combination of libraries p.20 2.2.3 amr_encodeframe function change of hardware resource value p.21 2.2.4 amr_initdecoder function change of hardware resource value p.22 2.2.5 amr_resetdecoder function change of hardware resource value p.23 2.2.6 amr_decodeframe function change of hardware resource value p.23 change of table 2-3 receive frame type p.25 change of table 2-4 transmit frame type p.26 2.2.10 amr_tx_to_rx function change of register name and hardware resource value p.26 change of table 2-5 transmit/receive frame type p.28 2.2.13 amr_getversion function change of the description of function p.44 change of appendix a sample program source the mark shows major revised points.
user?s manual u15165ej3v0um 6 preface target readers this manual is intended for users who wish to design and develop application systems using the pd77016 family. the pd77016 family includes the pd7701x family ( pd77015, 77016, 77017, 77018a, 77019) and the pd77111 family ( pd77110, 77111, 77112, 77113a, 77114, 77115). this manual, however, only covers the pd77018a, 77019, 77110, 77111, 77112, 77113a, and 77114. purpose the purpose of this manual is to help users understand the middleware used for support when designing and developing pd77016 family application systems. organization this manual consists of the following sections. chapter 1 introduction chapter 2 library specifications chapter 3 bit stream format chapter 4 installation appendix a sample program source appendix b related documents how to read this manual it is assumed that the reader of this manual has general knowledge in the fields of electrical engineering, logic circuits, microcontrollers and the c language. to learn about pd7701x family hardware functions refer to pd7701x family user?s manual architecture . to learn about pd77111 family hardware functions refer to pd77111 family user?s manual architecture . to learn about pd77016 family instruction functions refer to pd77016 family user?s manual instruction . conventions data significance: higher digits on the left and lower digits on the right active low representation: (overscore over pin or signal name) note : footnote for item marked with note in the text caution : information requiring particular attention remark : supplementary information number representation: binary or 0b decimal hexadecimal 0x
user?s manual u15165ej3v0um 7 related documents the related documents indicated in this publication may include preliminary versions. however, preliminary versions are not marked as such. documents related to pd77016 family user?s manual application note document name part number pamphlet data sheet architecture instructions basic software pd77016 u10891e pd77015 pd77017 u10902e pd77018a pd77019 u11849e pd77019-013 ? u13053e u10503e pd77110 pd77111 pd77112 u12801e pd77113a pd77114 u14373e pd77115 u12395e u14867e u14623e u13116e u11958e documents related to development tools document name document no. function u14397e rx77016 user?s manual configuration tool u14404e rx77016 application note host api u14371e caution the related documents listed above are subject to change without notice. be sure to use the latest version of each document for designing.
user?s manual u15165ej3v0um 8 contents chapter 1 introduction ...................................................................................................... ........................... 11 1.1 middleware ................................................................................................................ ........................................ 11 1.2 amr speech codec.......................................................................................................... .............................. 11 1.3 outline of system ......................................................................................................... ..................................... 12 1.3.1 features................................................................................................................ ...................................... 12 1.3.2 operating environment................................................................................................... ............................. 12 1.3.3 performance ............................................................................................................. .................................. 13 1.3.4 directory configuration ................................................................................................. ............................... 14 1.3.5 combination of libraries ................................................................................................ .............................. 15 chapter 2 library specifications ........................................................................................... .................. 16 2.1 application processing flow............................................................................................... ............................... 16 2.2 function specifications................................................................................................... ................................... 18 2.2.1 amr_initencoder function ................................................................................................ ............................ 18 2.2.2 amr_resetencoder function............................................................................................... ......................... 19 2.2.3 amr_encodeframe function................................................................................................ ........................ 20 2.2.4 amr_initdecoder function ................................................................................................ ............................ 21 2.2.5 amr_resetdecoder function ............................................................................................... ........................ 22 2.2.6 amr_decodeframe function................................................................................................ ........................ 23 2.2.7 amr_sid_sync_init function.............................................................................................. ............................ 24 2.2.8 amr_sid_sync_reset function ............................................................................................. ......................... 24 2.2.9 amr_sid_sync function ................................................................................................... ............................. 25 2.2.10 amr_tx_to_rx function.................................................................................................. .......................... 26 2.2.11 amr_ehf_test function.................................................................................................. .............................. 27 2.2.12 amr_dhf_test function.................................................................................................. .............................. 27 2.2.13 amr_getversion function ................................................................................................ .......................... 28 2.3 memory structure .......................................................................................................... .................................... 29 2.4 macros.................................................................................................................... ........................................... 31 2.4.1 amr_allocatescratchmemory macro ......................................................................................... ................ 31 2.4.2 amr_allocatestaticmemoryforencoder macro ................................................................................ .......... 31 2.4.3 amr_allocatestaticmemoryfordecoder macro................................................................................ .......... 31 chapter 3 bit stream format............................................................................................... ...................... 32 chapter 4 installation...................................................................................................... ............................. 41 4.1 installation procedure .................................................................................................... .................................... 41 4.2 sample creation procedure ................................................................................................. ............................. 42 4.3 change of location........................................................................................................ .................................... 43 4.4 symbol naming regulations ................................................................................................. ............................ 43 appendix a sample program source.......................................................................................... ............. 44 appendix b related documents ............................................................................................... .................. 51
user?s manual u15165ej3v0um 9 list of figures figure no. title page 2-1 example of application processing flow (encoder) .......................................................................... ............ 16 2-2 example of application processing flow (decoder) .......................................................................... ............ 17 3-1 relationship between bit allocation and word.............................................................................. ................ 40 4-1 example of sample program evaluation system ............................................................................... ........... 42
user?s manual u15165ej3v0um 10 list of tables table no. title page 1-1 amr speech codec bit rates ................................................................................................ ....................11 1-2 required memory size ...................................................................................................... ............................12 1-3 operation quantity of amr speech codec .................................................................................... .............13 1-4 combination of header file and library .................................................................................... ....................15 1-5 combination of target device and library (codec library) .................................................................. .........15 2-1 dtx mode.................................................................................................................. ....................................18 2-2 operation mode of encoder/decoder ......................................................................................... ...................20 2-3 receive frame type........................................................................................................ ..............................23 2-4 transmit frame type....................................................................................................... ..............................25 2-5 transmit/receive frame type............................................................................................... ........................26 2-6 symbol name and size of memory............................................................................................ ....................29 2-7 memory access range....................................................................................................... ...........................30 3-1 bit allocation in mr122 mode.............................................................................................. ..........................32 3-2 bit allocation in mr102 mode.............................................................................................. ..........................33 3-3 bit allocation in mr795 mode.............................................................................................. ..........................34 3-4 bit allocation in mr74 mode............................................................................................... ...........................35 3-5 bit allocation in mr67 mode............................................................................................... ...........................36 3-6 bit allocation in mr59 mode............................................................................................... ...........................37 3-7 bit allocation in mr515 mode.............................................................................................. ..........................38 3-8 bit allocation in mr475 mode.............................................................................................. ..........................39 3-9 bit allocation in mrdtx mode.............................................................................................. .........................39 4-1 section name .............................................................................................................. ..................................43 4-2 symbol naming regulations................................................................................................. .........................43
user?s manual u15165ej3v0um 11 chapter 1 introduction 1.1 middleware middleware is the name given to a group of software that has been tuned so that it draws out the maximum performance of the processor and enables processing that is conventionally performed by hardware to be performed by software. the concept of middleware was introduced with the development of a new high-speed processor, the dsp, in order to facilitate operation of the environments integrated in the system. by providing appropriate speech codec and image data compression/decompression-type middleware, nec is offering users the kind of technology essential in the realization of a multimedia system for the pd77016 family, and is continuing its promotion of system development. 1.2 amr speech codec the amr speech codec is a 4.75 kbps to 12.2 kbps speech compression/decompression codec standardized by 3gpp (3rd generation partnership project). it includes a multi-rate speech coder, a silence compression function, and an error concealment function. the multi-rate speech coder enables selection of the bit rate from a total of 8 (refer to table 1-1), except mrdtx note 1 , and allows bit rate switching on a frame by frame (20 ms) basis. table 1-1. amr speech codec bit rates codec mode bit rate mr122 12.20 kbps (gsm efr note 2 ) mr102 10.20 kbps mr795 7.95 kbps mr74 7.40 kbps (is-641 note 3 ) mr67 6.70 kbps (pdc-efr note 4 ) mr59 5.90 kbps mr515 5.15 kbps mr475 4.75 kbps mrdtx note 1 1.80 kbps notes 1. the encoder automatically executes compression in the mrdtx mode if the silence compression function is set to on. 2. gsm efr: etsi gsm 06.90 enhanced full rate speech codec 3. is-641: tia/eia is-641 tdma enhanced full rate speech codec 4. pdc-efr: arib 6.7 kbps enhanced full rate speech codec remark for details of each standard, refer to the reports in appendix b related documents .
chapter 1 introduction user?s manual u15165ej3v0um 12 1.3 outline of system 1.3.1 features ? supports amr speech codec version 7.6.0 of 3gpp (excluding channel codec). ? supports eight bit rates for compression/decompression (refer to table 1-1 amr speech codec bit rates ). ? silence compression function (vad1 and vad2 options supported) ? coding/decoding of 160 samples/frame at sampling frequency of 8 khz ? all speech i/o data is 16-bit linear pcm data note . note in the sap77016-b06 library, 13-bit data from the msb is used. 1.3.2 operating environment (1) target dsp ? pd77018a, 77019, 77110, 77111, 77112, 77113a, 77114 (2) required memory size table 1-2. required memory size size [words] memory space type codec encoder decoder instruction memory ? 14.1 k 10.2 k 4.4 k x memory ram 2.9 k 2.5 k 2.4 k rom 11.2 k 11.1 k 10.7 k y memory ram 2.4 k 1.9 k 1.5 k rom 3.6 k 3.2 k 2.8 k remarks 1. locate the x memory and y memory areas used for the library of the sap77016-b06 in the internal rom/ram space. 2. the required memory size shown in the table above does not include the buffers for speech data and bit stream data i/o. for details, refer to 2.3 memory structure . (3) software tools (windows tm version) dsp tools: work bench wb77016 high-speed simulator hsm77016 debugger id77016
chapter 1 introduction user?s manual u15165ej3v0um 13 1.3.3 performance table 1-3 shows the mips values necessary for executing processing of one frame in real time (20 ms). [measurement conditions] ? high-speed simulator: hsm77016 ? evaluated speech: speech file of 3gpp test sequences (ts 26.074) is used. ? evaluation result: operation quantity is measured when the speech file is compressed and decompressed, to calculate the worst case value. ? the operation quantity for compression is that of the amr_encodeframe function and the operation quantity for decompression is that of the amr_decodeframe function. the operation quantity of other functions and interrupt handlers is not included. table 1-3. operation quantity of amr speech codec vad off [mips] vad1 on [mips] vad2 on [mips] codec mode compression decompression compression decompression compression decompression mr475 15.116 2.658 15.658 2.658 16.749 2.683 mr515 12.000 2.675 12.542 2.675 13.635 2.675 mr59 14.901 2.674 15.425 2.674 16.552 2.661 mr67 19.331 2.740 19.817 2.740 20.970 2.745 mr74 17.371 2.408 17.864 2.408 18.992 2.407 mr795 18.318 2.783 18.830 2.783 19.934 2.835 mr102 18.548 2.495 19.054 2.495 20.161 2.495 mr122 19.997 2.489 20.510 2.489 21.626 2.489
chapter 1 introduction user?s manual u15165ej3v0um 14 1.3.4 directory configuration the directory configuration of the sap77016-b06 is shown below. macro definition file for pd77016 family upd7701x.h: upd7701x.mac: sample source file for single channel project file for single channel sample source file for multiple channels project file for multiple channels preprocessing function for multiple channels preprocessing function definition file for multiple channels header file for decoder library codec library constant data library for codec library ram segment constant data library for codec library rom segment amrcodec.lib: definition file for pd77016 family amrcodera.lib: amrcodero.lib: encoder library constant data library for encodder library ram segment constant data library for encodder library rom segment amrencod.lib: amrencra.lib: amrencro.lib: decoder library constant data library for decoder library ram segment constant data library for decoder library rom segment amrdecod.lib: amrdecra.lib: amrdecro.lib: sample.prj: sample.asm: sample_m.prj: sample_m.asm: amrmulti.h: amrmulti.asm: amr_libd.h: header file for encodecr library amr_libe.h: header file for codec library amr_lib.h:
chapter 1 introduction user?s manual u15165ej3v0um 15 1.3.5 combination of libraries table 1-4 shows the combination of the header file and the library to be used. table 1-5 shows the combination of the library and the dsp when using the codec library. table 1-4. combination of header file and library library header file code constant for ram constant for rom codec library amr_lib.h amrcodec.lib amrcodra.lib amrcodro.lib encoder library amr_libe.h amrencod.lib amrencra.lib amrencro.lib decoder library amr_libd.h amrdecod.lib amrdecra.lib amrdecro.lib table 1-5. combination of target device and library (codec library) device name code (amrcodec.lib) ram constant (amrcodra.lib) rom constant (amrcodro.lib) pd77015 pd77016 pd77017 pd77018a pd77019 pd77110 ? pd77111 pd77112 pd77113a ? note note pd77114 ? note note pd77115 note link either of amrcodra.lib or amrcodro.lib.
16 user?s manual u15165ej3v0um chapter 2 library specifications this chapter explains the function specifications and calling conventions of the sap77016-b06. 2.1 application processing flow figures 2-1 and 2-2 show examples of application processing using the sap77016-b06. figure 2-1. example of application processing flow (encoder) start speech input initialization processing ? ad/da initial settings ? interrupt enable, etc. encoder initialization call amr_initencoder no speech input interrupt handler 16-bit linear pcm data input ye s encoder data input processing encode processing call amr_encodeframe encoder data output processing 160 samples?
chapter 2 library specifications user ? s manual u15165ej3v0um 17 figure 2-2. example of application processing flow (decoder) start speech output initialization processing ? ad/da initial settings ? interrupt enable, etc. decoder initialization call amr_initdecoder no speech output interrupt handler 16-bit linear pcm data output ye s decoder data input processing decode processing call amr_decodeframe decoder data output processing 160 samples?
chapter 2 library specifications user ? s manual u15165ej3v0um 18 2.2 function specifications 2.2.1 amr_initencoder function the amr_initencoder function initializes the constants, coefficient table, and buffers used for the encoder. call this function only once when using the encoder. [classification] encoder initialization function [function name] amr_initencoder [summary of function] initializes the ram area necessary for processing the amr speech codec encoder, sets the vad mode, calls the amr_resetencoder function, and initializes parameters. [format] call amr_initencoder [argument] [return value] none [registers used] r0, r1, dp0, dp1, dp4, dp5 [hardware resources] maximum stack level: 4 maximum loop stack level: 1 maximum number of repetitions: 320 maximum number of cycles: 1256 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure . table 2-1. dtx mode dtx mode value description dtx_off 0 silent compression function off dtx_on_vad1 1 silent compression function on (vad1 option) dtx_on_vad2 2 silent compression function on (vad2 option) type argument description register r0l turns on/off dtx (silence compression function) (see table 2-1)
chapter 2 library specifications user ? s manual u15165ej3v0um 19 2.2.2 amr_resetencoder function the amr_resetencoder function resets the constants, coefficient table, and buffers used for the encoder to the initial status. [classification] encoder reset function [function name] amr_resetencoder [summary of function] resets the parameters necessary for processing the amr speech codec encoder to the initial status. [format] call amr_resetencoder [argument] none [return value] none [registers used] r0, r1, dp0, dp1, dp4, dp5 [hardware resources] maximum stack level: 3 maximum loop stack level: 1 maximum number of repetitions: 320 maximum number of cycles: 1248 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure .
chapter 2 library specifications user ? s manual u15165ej3v0um 20 2.2.3 amr_encodeframe function the amr_encodeframe function compresses speech data of 16 bits 160 samples at a specified bit rate. when the silence compression function is set to on during initialization, the silence compression function is automatically enabled in accordance with speech input. [classification] encode processing function [function name] amr_encodeframe [summary of function] compresses speech of one frame (160 samples) at a specified bit rate. [format] call amr_encodeframe [argument] [return value] [registers used] r0, r1, r2, r3, r4, r5, r6, r7, dp0, dp1, dp2, dp3, dp4, dp5, dp6, dp7, dn0, dn1, dn2, dn3, dn4, dn5, dn6, dn7, dmx, dmy [hardware resources] maximum stack level: 5 maximum loop stack level: 3 maximum number of repetitions: 239 maximum number of mips: 21.7 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure . table 2-2. operation mode of encoder/decoder codec mode value description mr475 0 compression/decompression mode at 4.75 kbps mr515 1 compression/decompression mode at 5.15 kbps mr59 2 compression/decompression mode at 5.90 kbps mr67 3 compression/decompression mode at 6.70 kbps mr74 4 compression/decompression mode at 7.40 kbps mr795 5 compression/decompression mode at 7.95 kbps mr102 6 compression/decompression mode at 10.20 kbps mr122 7 compression/decompression mode at 12.20 kbps mrdtx 8 compression/decompression mode when silence compression function is enabled type argument description register r0l encode mode (see table 2-2, excluding mrdtx) register dp4 first address of speech input buffer register dp0 first address of bit stream output buffer type return value description register r0l encode mode used for compression (see table 2-2)
chapter 2 library specifications user ? s manual u15165ej3v0um 21 2.2.4 amr_initdecoder function the amr_initdecoder function initializes the constants, coefficient table, and buffers used for the decoder. call this function only once when using the decoder. [classification] decoder initialization function [function name] amr_initdecoder [summary of function] initializes the ram area necessary for processing the amr speech codec decoder, calls the amr_resetdecoder function, and initializes parameters. [format] call amr_initdecoder [argument] none [return value] none [registers used] r0, r1, r2, dp0, dp1, dp2, dp4, dp5, dp6, dn5 [hardware resources] maximum stack level: 3 maximum loop stack level: 1 maximum number of repetitions: 154 maximum number of cycles: 2545 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure .
chapter 2 library specifications user ? s manual u15165ej3v0um 22 2.2.5 amr_resetdecoder function the amr_resetdecoder function resets the constants, coefficient table, and buffers used for the decoder to the initial status. [classification] decoder reset function [function name] amr_resetdecoder [summary of function] resets the parameters necessary for processing the amr speech codec decoder to the initial status. [format] call amr_resetdecoder [argument] none [return value] none [registers used] r0, r1, r2, dp0, dp1, dp2, dp4, dp5, dp6, dn5 [hardware resources] maximum stack level: 2 maximum loop stack level: 1 maximum number of repetitions: 154 maximum number of cycles: 1009 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure .
chapter 2 library specifications user ? s manual u15165ej3v0um 23 2.2.6 amr_decodeframe function the amr_decodeframe function decompresses compressed bit stream data to speech data of 16 bits 160 samples. [classification] decode processing function [function name] amr_decodeframe [summary of function] decompresses speech of one frame (160 samples) from a bit stream. [format] call amr_decodeframe [argument] note when the receive frame type is rx_no_data, use the decode mode of the preceding frame as the argument. [return value] none [registers used] r0, r1, r2, r3, r4, r5, r6, r7, dp0, dp1, dp2, dp3, dp4, dp5, dp6, dp7, dn0, dn1, dn2, dn3, dn4, dn5, dn6, dn7 [hardware resources] maximum stack level: 5 maximum loop stack level: 2 maximum number of repetitions: 170 maximum number of mips: 2.9 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure . table 2-3. receive frame type rx_type value description rx_speech_good 0 speech frame (without error) rx_speech _degraded 1 speech frame (with error of at least 1 bit) rx_onset 2 onset frame rx_speech_bad 3 speech frame (with error) rx_sid_first 4 start of sid frame rx_sid_update 5 updates sid frame (without error) rx_sid_bad 6 updates sid frame (with error) rx_no_data 7 frame without data type argument description register r0l decode mode note (see table 2-2 operation mode of encoder/ decoder . except for mrdtx.) register r1l receive frame type (see table 2-3) register dp4 first address of speech output buffer register dp0 first address of bit stream input buffer
chapter 2 library specifications user ? s manual u15165ej3v0um 24 2.2.7 amr_sid_sync_init function the amr_sid_sync_init function initializes the constants, coefficient table, and buffers used for the sid (silence descriptor) synchronization function. call this function only once when using the encoder. [classification] sid synchronization initialization function [function name] amr_sid_sync_init [summary of function] initializes the ram area necessary for the sid synchronization function, calls the amr_sid_sync_reset function, and initializes parameters. [format] call amr_sid_sync_init [argument] none [return value] none [registers used] r0 [hardware resources] maximum stack level: 1 maximum loop stack level: 0 maximum number of repetitions: 0 maximum number of cycles: 15 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure . 2.2.8 amr_sid_sync_reset function the amr_sid_sync_reset function resets the constants, coefficient table, and buffers used for the sid (silence descriptor) synchronization function to the initial status. [classification] sid synchronization initialization function [function name] amr_sid_sync_reset [summary of function] resets the parameters necessary for the sid synchronization function to the initial status. [format] call amr_sid_sync_reset [argument] none [return value] none [registers used] r0 [hardware resources] maximum stack level: 0 maximum loop stack level: 0 maximum number of repetitions: 0 maximum number of cycles: 8 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure .
chapter 2 library specifications user?s manual u15165ej3v0um 25 2.2.9 amr_sid_sync function the amr_sid_sync function determines the transmit frame type in accordance with the encode mode used for compression. call this function once per encode processing of one frame. [classification] sid synchronization function [function name] amr_sid_sync [summary of function] determines the frame type from the encode mode used for compression. [format] call amr_sid_sync [argument] [return value] [registers used] r0, r1 [hardware resources] maximum stack level: 0 maximum loop stack level: 0 maximum number of repetitions: 0 maximum number of cycles: 30 remark when calling this function, be sure to first secure static memory and scratch memory areas. for details, refer to 2.3 memory structure . table 2-4. transmit frame type tx_type value description tx_speech_good 0 speech frame tx_sid_first 1 start of sid frame tx_sid_update 2 sid frame update tx_no_data 3 frame without data type argument description register r0l encode mode used for compression (see table 2-2 operation mode of encoder/decoder .) type return value description register r0l transmit frame type (see table 2-4)
chapter 2 library specifications user?s manual u15165ej3v0um 26 2.2.10 amr_tx_to_rx function the amr_tx_to_rx function converts a transmit frame type (tx_type) to a receive frame type (rx_type). [classification] frame type conversion function [function name] amr_tx_to_rx [summary of function] converts a transmit frame type to a receive frame type. [format] call amr_tx_to_rx [argument] [return value] [registers used] r1, r2, r3 [hardware resources] maximum stack level: 0 maximum loop stack level: 0 maximum number of repetitions: 0 maximum number of cycles: 30 remark table 2-5 shows the receive frame type corresponding to each transmit frame type. the values in parentheses are the values of each transmit/receive frame type. if any other transmit frame type is specified, 0xffff is returned. table 2-5. transmit/receive frame type transmit frame type receive frame type tx_speech_good (= 0) rx_speech_good (= 0) tx_sid_first (= 1) rx_sid_first (= 4) tx_sid_update (= 2) rx_sid_update (= 5) tx_no_data (= 3) rx_sid_no_data (= 7) tx_speech_degrade (= 4) rx_speech_degrade (= 1) tx_speech_bad (= 5) rx_speech_bad (= 3) tx_sid_bad (= 6) rx_sid_bad (= 6) tx_onset (= 7) rx_onset (= 2) type argument description register r1l transmit frame type (tx_type) type return value description register r1l receive frame type (rx_type)
chapter 2 library specifications user ? s manual u15165ej3v0um 27 2.2.11 amr_ehf_test function the amr_ehf_test function checks whether the input speech signal is the homing frame of the encoder. [classification] encoder homing frame test function [function name] amr_ehf_test [summary of function] identifies the homing frame of the speech data. [format] call amr_ehf_test [argument] [return value] [registers used] r0, r1, dp4 [hardware resources] maximum stack level: 0 maximum loop stack level: 1 maximum number of repetitions: 0 maximum number of cycles: 967 2.2.12 amr_dhf_test function the amr_dhf_test function checks whether the input bit stream is the homing frame of the decoder. [classification] decoder homing frame test function [function name] amr_dhf_test [summary of function] identifies the homing frame of the bit stream data. [format] call amr_dhf_test [argument] [return value] [registers used] r0, r1, r2, r3, r4, r5, r6, r7, dp0, dp1, dp2, dp4, dp5, dp6, dp7 [hardware resources] maximum stack level: 2 maximum loop stack level: 1 maximum number of repetitions: 0 maximum number of cycles: 1858 type argument description register dp4 first address of speech buffer type return value description register r0l test result 0: no homing frame 1: homing frame type argument description register dp0 first address of bit stream buffer register r6l decode mode (see table 2-2 operation mode of encoder/ decoder , excluding mrdtx) type return value description register r0l test result 0: no homing frame 1: homing frame
chapter 2 library specifications user ? s manual u15165ej3v0um 28 2.2.13 amr_getversion function the amr_getversion function returns the version information of the amr speech codec library. [classification] version information acquisition function [function name] amr_getversion [summary of function] returns the version information. [format] call amr_getversion [argument] none [return value] [function] returns the version numbers of the library and amr speech codec. example: when r0 = 0x00 ? 0x0002 ? 0x0000, library version: ver 2.00.00 when r1 = 0x00 ? 0x0007 ? 0x0600, version of amr speech codec: ver 7.6.0 [registers used] r0, r1 [hardware resources] maximum stack level: 0 maximum loop stack level: 0 maximum number of repetitions: 0 maximum number of cycles: 10 type value description register r0h major version number of library register r0l minor version number of library register r1h major version number of amr speech codec register r1l minor version number of amr speech codec
chapter 2 library specifications user ? s manual u15165ej3v0um 29 2.3 memory structure this section explains the structure of the memory required for the sap77016-b06 library. in the sap77016-b06, scratch memory and static memory areas must be defined separately. be sure to use the public quasi directive to define a symbol name. for the size of each memory, refer to table 2-6. (1) scratch memory area this area does not have to be saved. the user can use this area freely after encoding/decoding one frame. example: public lib_scratch_x public lib_scratch_y scratch_x xramseg lib_scratch_x: ds amr_max_scratch_x_size scratch_y yramseg lib_scratch_y: ds amr_max_scratch_y_size (2) static memory area this area always includes saved data. if the user manipulates this area after initialization processing, normal operation of the sap77016-b06 library is not guaranteed. example: public amr_static_enc_x public amr_static_enc_y public amr_static_dec_x public amr_static_dec_y amr_static_x xramseg amr_static_enc_x: ds amr_max_static_enc_x_size amr_static_dec_x: ds amr_max_static_dec_x_size amr_static_y yramseg amr_static_enc_y: ds amr_max_static_enc_y_size amr_static_dec_y: ds amr_max_static_dec_y_size table 2-6. symbol name and size of memory symbol name size [words] x/y plane description lib_scratch_x 2025 x encoder/decoder common scratch area lib_scratch_y 909 y encoder/decoder common scratch area amr_static_enc_x 509 x static area for encoder amr_static_enc_y 955 y static area for encoder amr_static_dec_x 402 x static area for decoder amr_static_dec_y 525 y static area for decoder remark the memory area can be allocated by a macro defined by amr_lib.h (refer to 2.4 macro ).
chapter 2 library specifications user ? s manual u15165ej3v0um 30 (3) i/o buffer this is an area that is used to input/output speech data and bit stream data. the user can use the i/o buffer used by the encoder/decoder after encoding/decoding one frame. if the buffer is manipulated during encoding/decoding processing, normal operation of the sap77016-b06 is not guaranteed. ? ? ? ? i/o buffer necessary for encoder output buffer of bit stream data: 16 words in x memory space input buffer of speech data: 160 words in y memory space example: i_o_buffer_x xramseg bitstream_out: ds 16 i_o_buffer_y yramseg speech_in: ds 160 ? ? ? ? i/o buffer necessary for decoder input buffer of bit stream data: 16 words in x memory space output buffer of speech data: 160 words in y memory space example: i_o_buffer_x xramseg bitstream_in: ds 16 i_o_buffer_y yramseg speech_out: ds 160 remark generally, the i/o buffer of speech data is configured as a double buffer when compression/decompression is executed in real time. in this case, a 320-word data memory is required in the y memory space as an i/o buffer used by the encoder/decoder, and another 320- word data memory is required in either the x or y memory space as an i/o buffer used for serial i/o. [notes on simulator] the library of the sap77016-b06 reads a memory space other than an allocated area for faster pointer processing. therefore, the simulator may issue a warning, depending on the status of memory allocation. table 2-7. memory access range area name description amr_static_enc_x memory space other than this area is not accessed. amr_static_enc_y memory space other than this area is not accessed. amr_static_dec_x memory space other than this area is not accessed. amr_static_dec_y memory space other than this area is not accessed. lib_scratch_x memory in a range from this area to +5 words is accessed. lib_scratch_y memory in a range from the beginning of this area to ? 1 word is accessed.
chapter 2 library specifications user ? s manual u15165ej3v0um 31 2.4 macros 2.4.1 amr_allocatescratchmemory macro [classification] scratch memory allocation [macro name] amr_allocatescratchmemory [summary of function] allocates the scratch memory necessary for amr speech codec processing and declares a symbol name. [format] %amr_allocatescratchmemory [argument] none [return value] none [definition symbol] ib_scratch_x, lib_scratch_y 2.4.2 amr_allocatestaticmemoryforencoder macro [classification] static memory allocation for encoder [macro name] amr_allocatestaticmemoryforencoder [summary of function] allocates the static memory necessary for encoding processing of amr speech codec and declares a symbol name. [format] %amr_allocatestaticmemoryforencoder [argument] none [return value] none [definition symbol] amr_static_enc_x, amr_static_enc_y 2.4.3 amr_allocatestaticmemoryfordecoder macro [classification] static memory allocation for decoder [macro name] amr_allocatestaticmemoryfordecoder [summary of function] allocates the static memory necessary for decoding processing of amr speech codec and declares a symbol name. [format] %amr_allocatestaticmemoryfordecoder [argument] none [return value] none [definition symbol] amr_static_dec_x, amr_static_dec_y remark the macro used for the library of the sap77016-b06 is defined by amr_lib.h. to use the macro, include amr_lib.h.
32 user?s manual u15165ej3v0um chapter 3 bit stream format tables 3-1 through 3-9 show the bit allocation of the bit stream in each mode of the sap77016-b06. table 3-1. bit allocation in mr122 mode bit position description b1 to b7 index of 1st lsf submatrix b8 to b15 index of 2nd lsf submatrix b16 to b23 index of 3rd lsf submatrix b24 sign of 3rd lsf submatrix b25 to b32 index of 4th lsf submatrix b33 to b38 index of 5th lsf submatrix first subframe b39 to b47 adaptive codebook index b48 to b51 adaptive codebook gain b52 sign information for 1st and 6th pulses b53 to b55 position of 1st pulse b56 sign information for 2nd and 7th pulses b57 to b59 position of 2nd pulse b60 sign information for 3rd and 8th pulses b61 to b63 position of 3rd pulse b64 sign information for 4th and 9th pulses b65 to b67 position of 4th pulse b68 sign information for 5th and 10th pulses b69 to b71 position of 5th pulse b72 to b74 position of 6th pulse b75 to b77 position of 7th pulse b78 to b80 position of 8th pulse b81 to b83 position of 9th pulse b84 to b86 position of 10th pulse b87 to b91 fixed codebook gain second subframe b92 to b97 adaptive codebook index (relative) b98 to b141 same description as b48 to b91 third subframe b142 to b194 same description as b39 to b91 fourth subframe b195 to b244 same description as b92 to b141
chapter 3 bit stream format user?s manual u15165ej3v0um 33 table 3-2. bit allocation in mr102 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b17 index of 2nd lsf subvector b18 to b26 index of 3rd lsf subvector first subframe b27 to b34 adaptive codebook index b35 sign information for 1st and 5th pulses b36 sign information for 2st and 6th pulses b37 sign information for 3rd and 7th pulses b38 sign information for 4th and 8th pulses b39 to b48 position of 1st, 2nd, and 5th pulse b49 to b58 position of 3rd, 6th, and 7th pulse b59 to b65 position of 4th and 8th pulse b66 to b72 codebook gains second subframe b73 to b77 adaptive codebook index (relative) b78 to b115 same description as b35 to b72 third subframe b116 to b161 same description as b27 to b72 fourth subframe b162 to b204 same description as b73 to b115
chapter 3 bit stream format user?s manual u15165ej3v0um 34 table 3-3. bit allocation in mr795 mode bit position description b1 to b9 index of 1st lsf subvector b10 to b18 index of 2nd lsf subvector b19 to b27 index of 3rd lsf subvector first subframe b28 to b35 adaptive codebook index b36 to b39 position of 4th pulse b40 to b42 position of 3rd pulse b43 to b45 position of 2nd pulse b46 to b48 position of 1st pulse b49 sign information for 4th pulse b50 sign information for 3rd pulse b51 sign information for 2nd pulse b52 sign information for 1st pulse b53 to b56 adaptive codebook gain b57 to b61 fixed codebook gain second subframe b62 to b67 adaptive codebook index (relative) b68 to b93 same description as b36 to b61 third subframe b94 to b127 same description as b28 to b61 fourth subframe b128 to b159 same description as b62 to b93
chapter 3 bit stream format user?s manual u15165ej3v0um 35 table 3-4. bit allocation in mr74 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b17 index of 2nd lsf subvector b18 to b26 index of 3rd lsf subvector first subframe b27 to b34 adaptive codebook index b35 to b38 position of 4th pulse b39 to b41 position of 3rd pulse b42 to b44 position of 2nd pulse b45 to b47 position of 1st pulse b48 sign information for 4th pulse b49 sign information for 3rd pulse b50 sign information for 2nd pulse b51 sign information for 1st pulse b52 to b58 codebook gains second subframe b59 to b63 adaptive codebook index (relative) b64 to b87 same description as b35 to b58 third subframe b88 to b119 same description as b27 to b58 fourth subframe b120 to b148 same description as b59 to b87
chapter 3 bit stream format user?s manual u15165ej3v0um 36 table 3-5. bit allocation in mr67 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b17 index of 2nd lsf subvector b18 to b26 index of 3rd lsf subvector first subframe b27 to b34 adaptive codebook index b35 to b38 position of 3rd pulse b39 to b42 position of 2nd pulse b43 to b45 position of 1st pulse b46 sign information for 3rd pulse b47 sign information for 2nd pulse b48 sign information for 1st pulse b49 to b55 codebook gains second subframe b56 to b59 adaptive codebook index (relative) b60 to b80 same description as b35 to b55 third subframe b81 to b109 same description as b27 to b55 fourth subframe b110 to b134 same description as b56 to b80
chapter 3 bit stream format user?s manual u15165ej3v0um 37 table 3-6. bit allocation in mr59 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b17 index of 2nd lsf subvector b18 to b26 index of 3rd lsf subvector first subframe b27 to b34 adaptive codebook index b35 to b39 position of 2nd pulse b40 to b43 position of 1st pulse b44 sign information for 2nd pulse b45 sign information for 1st pulse b46 to b51 codebook gains second subframe b52 to b55 adaptive codebook index(relative) b56 to b72 same description as b35 to b51 third subframe b73 to b97 same description as b27 to b51 fourth subframe b98 to b118 same description as b52 to b72
chapter 3 bit stream format user?s manual u15165ej3v0um 38 table 3-7. bit allocation in mr515 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b16 index of 2nd lsf subvector b17 to b23 index of 3rd lsf subvector first subframe b24 to b31 adaptive codebook index b32 position subset b33 to b35 position of 2nd pulse b36 to b38 position of 1st pulse b39 sign information for 2nd pulse b40 sign information for 1st pulse b41 to b46 codebook gains second subframe b47 to b50 adaptive codebook index (relative) b51 to b65 same description as b32 to b46 third subframe b66 to b84 same description as b47 to b65 fourth subframe b85 to b103 same description as b47 to b65
chapter 3 bit stream format user?s manual u15165ej3v0um 39 table 3-8. bit allocation in mr475 mode bit position description b1 to b8 index of 1st lsf subvector b9 to b16 index of 2nd lsf subvector b17 to b23 index of 3rd lsf subvector first subframe b24 to b31 adaptive codebook index b32 position subset b33 to b35 position of 2nd pulse b36 to b38 position of 1st pulse b39 sign information for 2nd pulse b40 sign information for 1st pulse b41 to b48 codebook gains second subframe b49 to b52 adaptive codebook index(relative) b53 to b61 same description as b32 to b40 third subframe b62 to b65 same description as b49 to b52 b66 to b82 same description as b32 to b48 fourth subframe b83 to b95 same description as b49 to b61 table 3-9. bit allocation in mrdtx mode bit position description b1 to b3 index of reference vector b4 to b11 index of 1st lsf subvector b12 to b20 index of 2nd lsf subvector b21 to b29 index of 3rd lsf subvector b30 to b35 index of logarithmic frame energy
chapter 3 bit stream format user?s manual u15165ej3v0um 40 the relationship between the bit allocation (b1 through b242) in tables 3-1 through 3-9 and word data is shown below. figure 3-1. relationship between bit allocation and word offset msb lsb 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 +0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15 b16 +1 b17 ???? b32 +2 b33 ???? b48 +3 b49 ???? b64 +4 b65 ???? b80 +5 b81 ???? b96 +6 b97 ???? b112 +7 b113 ???? b128 +8 b129 ???? b144 +9 b145 ???? b160 +10 b161 ???? b176 +11 b177 ???? b192 +12 b193 ???? b208 +13 b209 ???? b224 +14 b225 ???? b240 +15 b241 ???? b256
user?s manual u15165ej3v0um 41 chapter 4 installation 4.1 installation procedure the sap77016-b06 is supplied in a 3.5? floppy disk (1.44 mb). how to install the sap77016-b06 in a host machine is described below. install the sap77016-b06 in a host machine in which an os such as windows 95, 98, 2000, or windows nt tm 4.0 or later has been installed. <1> set the floppy disk in the floppy disk drive. <2> execute amr_mw.exe from the floppy disk (the files of the sap77016-b06 are compressed in a self- extracting format). the following is an example of when files are copied from the a drive to the c drive. a:\>amr_mw.exe <3> a dialog box to specify the directory for installing the sap77016-b06 is displayed. specify a directory. any directory may be specified. in this example, it is assumed that c:\dsptools is specified. <4> click the ok button and expansion of the files begins. <5> confirm that the files have been expanded. for each directory, refer to 1.3.4 directory configuration . a:\>dir c:\dsptools
chapter 4 installation user?s manual u15165ej3v0um 42 4.2 sample creation procedure the sample programs for a single channel and multiple channels (2 channels) are stored in the smp directory (refer to 1.3.4 directory configuration ). for the source program for a single channel, refer to appendix a sample program source . an amr speech codec system can be evaluated using a sample program by actually connecting a cd player, dat, microphone, or speaker to the sap77016-b06. note that additional code such as for a system-dependent block may be required. figure 4-1. example of sample program evaluation system cd player or dat line out line in dsp linear codec evaluation board speaker microphone an example of how to build a sample program (for a single channel) of the sap77016-b06 is shown below. (1) start up the wb77016 (workbench). (2) open the sample.prj project file. example: specify sample.prj with the open project command from the project menu. (3) execute build and confirm that sample.lnk has been created. example: the sample.lnk file can be created by selecting the build all command from the make menu. (4) download sample.lnk to the target system using the id77016 (debugger) and execute it.
chapter 4 installation user ? s manual u15165ej3v0um 43 4.3 change of location the section names shown in table 4-1 are given to the library of the sap77016-b06. the location can be changed in accordance with the user target system. table 4-1. section name section name type description _ _amr_const_x_ _ xromseg/xramseg constant data storage area _ _amr_const_y_ _ yromseg/yramseg constant data storage area _ _amr_codec_ _ iromseg/iramseg amr speech codec program 4.4 symbol naming regulations the symbols used for the library of the sap77016-b06 are named in accordance with the following regulation. make sure not to duplicate these symbol names when using the sap77016-b06 in combination with another application. table 4-2. symbol naming regulations classification naming regulation function name amr_xxxx constant symbol name amr_cnst_xxxx static ram area symbol name amr_static_[enc|dec]_[x|y] scratch ram area symbol name lib_scratch_[x|y] code segment name (imseg) _ _amr_codec_ _ constant segment name (romseg/ramseg) _ _amr_const_[x|y]_ _ macro, constant name (such as #define and equ declarations) amr_xxxx file name amrxxxx. ? remark ? xxxx ? indicates arbitrary alphanumeric characters.
44 user?s manual u15165ej3v0um appendix a sample program source this appendix shows a sample source of the sap77016-b06 (amr speech codec middleware). this sample source was created by referring to the sample source of 3gpp (3rd generation partnership project). for details of each processing, refer to the sample source of 3gpp. ? sample.asm (1/7) /*---------------------------------------------------------------------- */ /* file information */ /*---------------------------------------------------------------------- */ /* name : sample.asm */ /* type : assembler program module */ /* version : 2.00 */ /* date : 2002 apr 24 */ /* cpu : upd7701x family */ /* assembler: wb77016 */ /* about : gsm amr speech codec version 7.6.0 */ /* */ /*---------------------------------------------------------------------- */ /* copyright (c) nec corporation 1999, 2000, 2001, 2002 */ /* nec confidential and proprietary */ /* all rights reserved by nec corporation. */ /* use of copyright notice does not evidence publication */ /*---------------------------------------------------------------------- */ /* ========================================================================= * include files * ====================================================================== */ #include "upd7701x.mac" #include "amr_lib.h" /* ========================================================================= * memory allocate for amr codec * ====================================================================== */ %amr_allocatescratchmemory %amr_allocatestaticmemoryforencoder %amr_allocatestaticmemoryfordecoder /* ========================================================================= * local variables and tables * ====================================================================== */ #define dtx dtx_off /* set dtx mode. dtx_off, dtx_on_vad1, dtx_on_vad2 */ #define multi 0 /* set multi mode. 0: normal mode. 1:multi mode */ #define l_frame 160 work_x xramseg at 0x0000 f_run: ds 1 ; codec start flag, "1" is start codec. f_reset: ds 1 ; test sequence reset flag, "-1" is reset. f_multi: dw multi ; multi mode flag, not "0" is multi rate mode. frame_type: ds 1 ; rx/tx frame type. used_mode: ds 1 ; used amr encoder mode. bitstream: ds 16 ; bitstream load/store buffer. e_mode: dw mr475 ; amr encoder mode.
appendix a sample program so urce user?s manual u15165ej3v0um 45 ? sample.asm (2/7) d_mode: ds 1 ; amr decoder mode. prev_d_mode: ds 1 ; amr previous codec mode dtx_mode: dw dtx ; dtx mode. f_e_reset: ds 1 ; encoder reset flag. f_d_reset: ds 1 ; decoder reset flag. f_d_reset_old:ds 1 ; decoder old reset flag. r7save: ds 3 ; r7 register load/sotre buffer for interrupt handler. dp7save: ds 1 ; dp7 register load/sotre buffer for interrupt handler. mode_cnt: ds 1 ; coder mode count for multi rate mode. frame_cnt: ds 1 ; frame count. work_y yramseg at 0x0000 si1_ptr: ds 1 ; si1_buff: ds l_frame ; so1_buff: ds l_frame ; speech_in: ds l_frame ; speech_out: ds l_frame ; #define f_run *f_run:x #define f_reset *f_reset:x #define f_multi *f_multi:x #define tx_type *frame_type:x #define rx_type *frame_type:x #define used_mode *used_mode:x #define e_mode *e_mode:x #define d_mode *d_mode:x #define dtx_mode *dtx_mode:x #define prev_d_mode *prev_d_mode:x #define e_reset_flag *f_e_reset:x #define d_reset_flag *f_d_reset:x #define d_reset_flag_old *f_d_reset_old:x #define mode_count *mode_cnt:x #define frame_count *frame_cnt:x /* ========================================================================= * vector registration * =========================================================================*/ %beginvector(startup) ;regist start up routine %notusevector(vectorint1) ; %notusevector(vectorint2) ; %notusevector(vectorint3) ; %notusevector(vectorint4) ; %registvector(vectorsi1, si1handler) ;regist si1 handler %notusevector(vectorso1) ; %notusevector(vectorsi2) ; %notusevector(vectorso2) ; %notusevector(vectorhi) ; %notusevector(vectorho) ; %endvector
appendix a sample program so urce user?s manual u15165ej3v0um 46 ? sample.asm (3/7) /* ========================================================================= * programe code section * =========================================================================*/ main_code imseg at 0x4000 startup: ;;==============================================================;; ;; initialize upd7701x ;; ;;==============================================================;; %initializesystemregister ;initialize system register %clearallregister ;clear all upd7701x register ;;==============================================================;; ;; initialize register & peripheral units ;; ;;==============================================================;; r0l = 0x0200 ; *sst1:x = r0l ; ;;==============================================================;; ;; initialize amr codec module ;; ;;==============================================================;; /* initialize amr encoder */ clr(r0) ; r0l = dtx_mode ;set dtx mode call amr_initencoder ; call amr_sid_sync_init ; /* initialize amr decoder */ call amr_initdecoder ; ;;==============================================================;; ;; initialize buffer ;; ;;==============================================================;; /* clear serial input/output buffer */ r0l = si1_buff ;initialize serial i/o buffer pointer. *si1_ptr:y = r0l ; dp4 = si1_buff ;initialize serial i/o buffer. rep l_frame*2 ; *dp4++ = r0h ; /* clear speech input/output buffer */ dp4 = speech_in ; dp5 = speech_out ; loop l_frame { ; *dp4++ = r0h ; *dp5++ = r0h ; } ; /* clear flags */ clr(r0) ; f_run = r0l ;clear codec start flag. f_reset = r0l ;clear codec rest flag. tx_type = r0l ;clear tx type. rx_type = r0l ;clear rx type. used_mode = r0l ;clear used amr encoder mode. d_mode = r0l ;clear amr decoder mode. prev_d_mode = r0l ;clear prev amr decoder mode. e_reset_flag = r0l ;clear encoder reset flag. d_reset_flag = r0l ;clear decoder reset flag.
appendix a sample program so urce user?s manual u15165ej3v0um 47 ? sample.asm (4/7) mode_count = r0l ;clear mode count. frame_count = r0l ;clear frame count. r0l = 1 ; d_reset_flag_old = r0l ;set decoder old reset flag. ;;==============================================================;; ;; set interrupt mask ;; ;;==============================================================;; %disableinterrupt ; %setmask(sr_all) ; %unsetmask(sr_si1) ; %enableinterrupt ; ;;==============================================================;; ;; main routine ;; ;;==============================================================;; mainloop: /* check reset codec flag */ r0 = f_reset ; if(r0 < 0) jmp startup ; /* check start codec flag */ r0 = f_run ; if(r0 == 0) jmp mainloop ; clr(r0) ; f_run = r0l ;clear codec start flag. /* increment frame count */ r0l = frame_count ; r0 = r0 + 1 ; frame_count = r0l ; /* copy input/output pcm data */ dp4 = speech_in ; dp5 = speech_out ; dp6 = si1_buff ; loop l_frame { ; r0l = *dp6++ ;read input pcm data from si1_buff. r0 = r0 & 0xfff8 ; *dp4++ = r0l ;store pcm data to speech_in. } ; loop l_frame { ; r0l = *dp5++ ;read output pcm data from speech_out. r0 = r0 & 0xfff8 ; *dp6++ = r0l ;store pcm data to so1_buff. } ; /* encode process */ call proc_amr_encoder ; /* decode process */ call proc_amr_decoder ; jmp mainloop ; /* ========================================================================= [function name] proc_amr_encoder =========================================================================*/ proc_amr_encoder: /* check for homing frame */ dp4 = speech_in ;set speech buffer address. call amr_ehf_test ;test homing frame. e_reset_flag = r0l ;save reset flag.
appendix a sample program so urce user?s manual u15165ej3v0um 48 ? sample.asm (5/7) /* multi rate mode */ r0 = f_multi ; if(r0 != 0) call multiratemode ; /* encode speech */ clr(r0) ; r0l = e_mode ;set amr encoder mode. dp4 = speech_in ;set speech buffer address. dp0 = bitstream ;set bitstream buffer address. call amr_encodeframe ;encode speech data. used_mode = r0l ;save used amr encoder mode. /*include frame type and mode information in serial bitstream */ clr(r0) ; r0l = used_mode ;set used amr encoder mode. call amr_sid_sync ; tx_type = r0l ;save tx frame type. r0 = r0 - tx_no_data ; if( r0 != 0 ) jmp proc_enc_noupdate_mode; clr(r0) ; r0 = r0 - 1 ; d_mode = r0l ; jmp proc_enc_next ; proc_enc_noupdate_mode: clr(r0) ; r0l = e_mode ; d_mode = r0l ; proc_enc_next: /* perform homing if homing frame was detected at encoder input */ r0 = e_reset_flag ; if(r0 == 0) ret ; call amr_resetencoder ; call amr_sid_sync_reset ; ret ; /* ========================================================================= [function name] proc_amr_decoder =========================================================================*/ proc_amr_decoder: /* convert tx frame type to rx frame type*/ clr(r1) ; r1l = tx_type ;set tx frame type. call amr_tx_to_rx ; rx_type = r1l ;save rx frame type. clr(r1) ; r1l = rx_type ; r0 = r1 - rx_no_data ; if(r0 != 0) jmp proc_dec_set_prev_mode; r0l = prev_d_mode ; d_mode = r0l ; jmp proc_dec_set_prev_mode_end; proc_dec_set_prev_mode: r0l = d_mode ; prev_d_mode = r0l ; proc_dec_set_prev_mode_end:
appendix a sample program so urce user?s manual u15165ej3v0um 49 ? sample.asm (6/7) /* if homed: check if this frame is another homing frame */ r0 = d_reset_flag_old ; if(r0 == 0) jmp proc_dec_next_1 ; /* only check until end of first subframe */ clr(r6) ; r6l = d_mode ;set amr decoder mode. dp0 = bitstream ;set bitstream buffer address. call amr_dhf_test ;test homing frame. d_reset_flag = r0l ;save reset flag. proc_dec_next_1: /* produce encoder homing frame if homed & input=decoder homing frame */ r0 = d_reset_flag ; if(r0 == 0) jmp proc_dec_start ; r0 = d_reset_flag_old ; if(r0 == 0) jmp proc_dec_start ; r0l = ehf_mask ; dp4 = speech_out ; rep l_frame ; *dp4++ = r0l ; jmp proc_dec_next_2 ; proc_dec_start: /* decode frame */ clr(r0) ; clr(r1) ; r0l = d_mode ;set amr decoder mode. r1l = rx_type ;set rx_type = rx_speech. dp0 = bitstream ;set bitstream buffer address. dp4 = speech_out ;set speech buffer address. call amr_decodeframe ;decoder bitstream. /* if not homed: check whether current frame is a homing frame */ proc_dec_next_2: r0 = d_reset_flag_old ; if(r0 != 0) jmp proc_dec_next_3 ; /* check whole frame */ clr(r6) ; r6l = d_mode ;set amr decoder mode. dp0 = bitstream ;set bitstream buffer address. call amr_dhf_test ;test homing frame. d_reset_flag = r0l ;save reset flag. /* reset decoder if current frame is a homing frame */ proc_dec_next_3: r0 = d_reset_flag ; if(r0 != 0) call amr_resetdecoder; r0 = d_reset_flag ; d_reset_flag_old = r0h ; ret ;
appendix a sample program so urce user?s manual u15165ej3v0um 50 ? sample.asm (7/7) /* ========================================================================= [function name] multiratemode =========================================================================*/ multiratemode: clr(r0) ; r0l = mode_count ; r1 = r0 & 0x7 ; e_mode = r1l ; r1 = r1 + 1 ; mode_count = r1l ; ret ; /* ========================================================================= [handler name] si1handler [ram] si1_buff, so1_buff, si1_ptr, f_run [use register] r7, dp7 [mips] 0.200[mips] (25*159+27*1[cycle]) [use stacks] loop stack: 0, call stack: 0, repeat: 0 =========================================================================*/ si1handler: /* save r7, dp7 register */ *r7save+0:x = r7l ;save r7l *r7save+1:x = r7h ;save r7h *r7save+2:x = r7e ;save r7e r7l = dp7 ;save dp7 *dp7save:x = r7l ; /* input/output pcm data */ r7l = *si1_ptr:y ; dp7 = r7l ; r7h = *sdt1:x ; *dp7##160 = r7h ; r7h = *dp7##-159 ; *sdt1:x = r7h ; /* check frame count */ clr(r7) ; r7l = dp7 ; *si1_ptr:y = r7l ; r7 = r7 - ( si1_buff + l_frame ); if(r7 != 0) jmp si1_end ; r7l = 1 ; f_run = r7l ; r7l = si1_buff ; *si1_ptr:y = r7l ; si1_end: /* restore r7, dp7 register */ r7l = *dp7save:x ; dp7 = r7l ;load dp7 r7e = *r7save+2:x ;load r7e r7h = *r7save+1:x ;load r7h r7l = *r7save+0:x ;load r7l reti ; /* end of file */ end
user?s manual u15165ej3v0um 51 appendix b related documents the recommendations related to the amr speech codec published by 3gpp are as follows. ? 3gpp ts 26.071 amr speech codec; general description ? 3gpp ts 26.073 amr speech codec; c-source code ? 3gpp ts 26.074 amr speech codec; test sequences ? 3gpp ts 26.090 amr speech codec; transcoding functions ? 3gpp ts 26.091 amr speech codec; error concealment of lost frames ? 3gpp ts 26.092 amr speech codec; comfort noise ? 3gpp ts 26.093 amr speech codec; source controlled rate operation ? 3gpp ts 26.094 amr speech codec; voice activity detector ? 3gpp ts 26.101 amr speech codec; frame structure ? 3gpp ts 26.102 amr speech codec; interface to iu and uu
52 user?s manual u15165ej3v0um [memo]
although nec has taken all possible steps to ensure that the documentation supplied to our customers is complete, bug free and up-to-date, we readily accept that errors may occur. despite all the care and precautions we've taken, you may encounter problems in the documentation. please complete this form whenever you'd like to report errors or suggest improvements to us. hong kong, philippines, oceania nec electronics hong kong ltd. fax: +852-2886-9022/9044 korea nec electronics hong kong ltd. seoul branch fax: +82-2-528-4411 p.r. china nec electronics shanghai, ltd. nec electronics taiwan ltd. fax: +86-21-6841-1137 address north america nec electronics inc. corporate communications dept. fax: +1-800-729-9288 +1-408-588-6130 europe nec electronics (europe) gmbh market communication dept. fax: +49-211-6503-274 south america nec do brasil s.a. fax: +55-11-6462-6829 taiwan asian nations except philippines nec electronics singapore pte. ltd. fax: +886-2-2719-5951 fax: +65-250-3583 japan nec semiconductor technical hotline fax: +81- 44-435-9608 i would like to report the following error/make the following suggestion: document title: document number: page number: thank you for your kind support. if possible, please fax the referenced page or drawing. excellent good acceptable poor document rating clarity technical accuracy organization cs 02.3 name company from: tel. fax facsimile message


▲Up To Search▲   

 
Price & Availability of USAB13AP77016-XXX-B06

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X