Part Number Hot Search : 
AK4113VF LXE1710 UDQ2596 MAZL100H M100A LTC2222 AGM3224S 03518
Product Description
Full Text Search
 

To Download USAB17AP77016-XXX-B19 Datasheet File

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


  Datasheet File OCR Text:
  sap77016-b19 mp3 audio encoder middleware document no. u16553ej1v0um00 (1st edition) date published march 2003 ns cp(n) printed in japan 2003 user?s manual target device pd77110 pd77113a pd77114 pd77115 pd77210 pd77213
user?s manual u16553ej1v0um 2 [memo]
user?s manual u16553ej1v0um 3 windows is either a registered trademark or a trademark of microsoft corporation in the united states and/or other countries. the information in this document is current as of march, 2003. the information is subject to change without notice. for actual design-in, refer to the latest publications of nec electronics data sheets or data books, etc., for the most up-to-date specifications of nec electronics products. not all products and/or types are available in every country. please check with an nec electronics 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 the prior written consent of nec electronics. nec electronics assumes no responsibility for any errors that may appear in this document. nec electronics 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 electronics 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 pr operty rights of nec electronics 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 a customer's equipment shall be done under the full responsibility of the customer. nec electronics assumes no responsibility for any losses incurred by customers or third pa rties arising from the use of these circuits, software and information. while nec electronics endeavors to enhance the quality, reliability and safety of nec ele ctronics 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 electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. nec electronics products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to nec electronics products developed based on a customer- designated "quality assurance program" for a specific application. the recommended applications of an nec electronics product depend on its quality grade, as indicated below. customers must check the quality grade of each nec electronics product before using it in a pa rticular application. the quality grade of nec electronics products is "standard" unless otherwise expressly specified in nec electronics data sheets or data books, etc. if cust omers wish to use nec electronics products in applications not intended by nec electronics, they must contact an nec electronics sales representative in advance to determine nec electronics' willingness to support a given application. (note) ? ? ? ? ? ? m8e 02. 11-1 (1) (2) "nec electronics" as used in this statement means nec electronics corporation and also includes its majority-owned subsidiaries. "nec electronics products" means any product developed or manufactured by or for nec electronics (as defined above). computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. 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). aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. "standard": "special": "specific":
user ? s manual u16553ej1v0um 4 regional information ? 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 america, 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: 6253-8311 fax: 6250-3583 j02.11 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  tyskland filial 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 some information contained in this document may vary from country to country. before using any nec electronics product in your application, piease contact the nec electronics office in your country to obtain a list of authorized representatives and distributors. they will verify:
user ? s manual u16553ej1v0um 5 preface target readers this manual is for users who design and develop pd77016 family application systems. pd77016 family is the generic name for the pd7701x family ( pd77015, 77016, 77017, 77018a, 77019), the pd77111 family ( pd77110, 77111, 77112, 77113a, 77114, 77115) and the pd77210 family ( pd77210, 77213). however, this manual is for pd77110, 77113a, 77114, 77115, 77210, and 77213 devices. purpose the purpose of this manual is to help users understand the supporting middleware when designing and developing pd77016 family application systems. organization this manual consists of the following contents. ? overview ? library specifications ? installation ? system example ? sample program source 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 pd77111 family hardware functions refer to pd77111 family user ? s manual architecture. to learn about pd77210 family hardware functions refer to pd77210 family user ? s manual architecture. to learn about pd77016 family instructions 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: xxx (overscore over pin or signal name) note: footnote for item marked with note in the text caution: information requiring particular attention remark: supplementary information numerical representation: binary ... xxxx or 0bxxxx decimal ... xxxx hexadecimal ... 0xxxxx
user ? s manual u16553ej1v0um 6 related documents the related documents listed below may include preliminary versions. however, preliminary versions are not marked as such. documents related to devices part number pamphlet data sheet user ? s manual application note architecture instructions basic software pd77110 u12395e u12801e u14623e u13116e u11958e pd77111 pd77112 pd77113a u14373e pd77114 pd77115 u14867e pd77210 u15203e u15807e pd77213 documents related to development tools document name document no. rx77016 user ? s manual function u14397e configuration tool u14404e rx77016 application note host api u14371e documents related to middleware document name document no. sap77106-b07 user's manual (mp3 decoder) u15134e sap77106-b19 user's manual (mp3 encoder) this manual documents related to standard document name iso/iec 11172-3:1993 information technology - coding of moving pictures and associated audio for digital storage media at up to about 1.5 mbit/s - part3 jis x 4323-1995 information technology of japan industrial standard - coding of moving pictures and associated audio for digital storage media at up to about 1.5 mbit/s - part3: audio (mr-4284 1995.10.27) iso/iec 13818-3 information technology - generic coding of moving pictures and associated audio information - part 3: audio jis x 4327 generic coding of moving pictures and associated audio information - part 3: audio 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 u16553ej1v0um 7 contents chapter 1 overview ........................................................................................................... ...............10 1.1 middleware................................................................................................................ ....................................10 1.2 mp3 audio encoder ......................................................................................................... ............................10 1.2.1 encoder outline ......................................................................................................... ........................11 1.3 compressed data format .................................................................................................... .......................14 1.3.1 header .................................................................................................................. ............................15 1.3.2 crc ..................................................................................................................... .............................16 1.3.3 side information ........................................................................................................ ........................17 1.3.4 audio data .............................................................................................................. ...........................17 1.3.5 additional data ......................................................................................................... .........................17 1.4 product overview.......................................................................................................... ...............................18 1.4.1 features ................................................................................................................ ............................18 1.4.2 function ................................................................................................................ ............................18 1.4.3 operating environment................................................................................................... ...................19 1.4.4 performance............................................................................................................. .........................20 1.4.5 directory configuration ................................................................................................. .....................21 chapter 2 library specifications ............................................................................................ .22 2.1 library overview.......................................................................................................... ................................22 2.2 application processing flow ............................................................................................... .......................23 2.3 function specifications ................................................................................................... ...........................24 2.3.1 mp3enc_start function ................................................................................................... .................24 2.3.2 mp3enc_encode function .................................................................................................. .............25 2.3.3 mp3enc_stop function .................................................................................................... ................26 2.3.4 mp3enc_getversion function .............................................................................................. ............27 2.4 parameters necessary for compression ...................................................................................... .............28 2.5 memory structure .......................................................................................................... ..............................29 2.5.1 scratch area............................................................................................................ ..........................29 2.5.2 static area ............................................................................................................. ............................29 2.5.3 input buffer ............................................................................................................ ............................30 2.5.4 output buffer ........................................................................................................... ..........................31 chapter 3 installation ....................................................................................................... ............32 3.1 installation procedure .................................................................................................... .............................32 3.2 sample program creation procedure ......................................................................................... ...............33 3.3 symbol naming conventions ................................................................................................. ....................34 chapter 4 system example .................................................................................................... .......35 4.1 simulation environment using timing file .................................................................................. .............35 4.2 operation ................................................................................................................. .....................................35
user ? s manual u16553ej1v0um 8 appendix sample program source ..........................................................................................36 a.1 header file (mp3enc.h).................................................................................................... ........................... 36 a.2 sample source file (sample.asm) ........................................................................................... .................. 37 a.3 timing file for parameter information (value.tmg) .............................................................................. 47 a.4 timing file for data input (pcm_in.tmg) ................................................................................... ................ 49 a.5 timing file for data output (stream_out.tmg).............................................................................. ............ 52
user ? s manual u16553ej1v0um 9 list of figures figure no. title page 1-1. encoder configuration example ............................................................................................ ..............................11 1-2. system configuration example............................................................................................. ...............................11 1-3. timing diagram........................................................................................................... .........................................13 1-4. compressed data format................................................................................................... .................................14 2-1. application processing flow .............................................................................................. ..................................23 2-2. structure consisting of parameters necessary for compression ............................................................. ...........28 2-3. user-defined input buffer (pcm buffer)................................................................................... ............................30 2-4. output buffer (bit stream buffer) ........................................................................................ .................................31 list of tables table no. title page 1-1. sampling frequencies ..................................................................................................... ....................................10 1-2. number of words of input data ............................................................................................ ...............................11 1-3. selectable bit rates..................................................................................................... ........................................12 1-4. details of header section ................................................................................................ ....................................15 1-5. relationship of bit values to bit rates.................................................................................. ...............................16 1-6. relationship of bit values to sampling frequencies....................................................................... .....................16 1-7. size of side information ................................................................................................. ......................................17 1-8. required memory sizes.................................................................................................... ...................................19 1-9. software tools........................................................................................................... ...........................................19 1-10. mips values of 1-frame compression processing (measured values) ......................................................... ...20 2-1. list of library functions................................................................................................ .......................................22 2-2. values to specify sampling frequency..................................................................................... ...........................28 2-3. symbol name/memory sizes................................................................................................. ..............................29 2-4. input buffer size........................................................................................................ ...........................................30 3-1. symbol naming conventions................................................................................................ ...............................34
user ? s manual u16553ej1v0um 10 chapter 1 overview 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 electronics 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. sap77016-b19 is middleware that provides mp3-technology encoding functions. 1.2 mp3 audio encoder mp3 is a method used for coding or decoding high-quality audio signals for storage media. it includes mpeg-1 audio layer-3 and mpeg-2 audio layer-3 lsf (low sampling frequency). the sap77016-b19 conforms to this coding method. the compressed data format of mpeg-1 audio layer-3 conforms to ? iso/iec 11172-3 ? , and that of mpeg-2 audio layer-3 conforms to ? iso/iec 13818-3 ? . mp3 handles 16-bit linear pcm audio data sampled at a frequency from 16 khz to 48 khz (refer to table 1-1). table 1-1. sampling frequencies mpeg-1 audio layer-3 [hz] mpeg-2 audio layer-3 lsf [hz] 32000 16000 44100 22050 48000 24000
chapter 1 overview user ? s manual u16553ej1v0um 11 1.2.1 encoder outline figure 1-1 shows an example of the configuration of an encoder using the sap77016-b19. figure 1-2 shows an example of the configuration of a system that includes an encoder using the sap77016-b19. figure 1-1. encoder configuration example in out sampling frequency 16 khz to 48 khz selectable bit rates 8 kbps to 320 kbps (analog audio data) (16-bit linear pcm data) (compression data) encoder (mp3) 16-bit adc figure 1-2. system configuration example cd player pc dsp audio serial interface line in parallel port evaluation board (1) input data the input data is 16-bit linear pcm data sampled at 16 khz to 48 khz (refer to table 1-1). table 1-2 shows the number of words of input data per frame. table 1-2. number of words of input data compression ratio number of channels number of words of input audio data mpeg-1 1 1152 audio layer-3 2 2304 mpeg-2 1 576 audio layer-3 lsf 2 1152 remark 1 word = 16 bits
chapter 1 overview user ? s manual u16553ej1v0um 12 (2) mp3 audio encoder the mp3 audio encoder reads 16-bit linear pcm data and outputs data while controlling the code quantity at a set bit rate. the bit rate per frame is variable. table 1-3 shows the bit rates that can be set. table 1-3. selectable bit rates mpeg-1 audio layer-3 [kbps] mpeg-2 audio layer-3 lsf [kbps] 32 8 40 16 48 24 56 32 64 40 80 48 96 56 112 64 128 80 160 96 192 112 224 128 256 144 320 160
chapter 1 overview user ? s manual u16553ej1v0um 13 (3) timing diagram figure 1-3 shows the timing diagram of the mp3 audio encoder. figure 1-3. timing diagram bit stream output mp3 compression processing audio input data length of 1 frame 0 16-bit linear pcm data of 1 frame time compressed data of 1 frame <1> <2> <3> <4> user application audio serial input interrupt handler <1> 16-bit linear pcm data of one frame is input. <2> the 16-bit linear pcm data of one frame is buffered and compressed. <3> the compressed data is buffered and output. <4> the user performs appropriate processing.
chapter 1 overview user ? s manual u16553ej1v0um 14 1.3 compressed data format the compressed data format conforms to iso/iec 11172-3 and/or jis x4323. however, the sap77016-b19 does not support the free format when the bitrate_index is 0000. the compressed data consists of a number of bit streams, each of which is called a frame. figure 1-4 shows the structure of the compressed data format. figure 1-4. compressed data format frame frame frame frame frame header crc side information audio data additional data compressed data (1 file) 1 frame
chapter 1 overview user ? s manual u16553ej1v0um 15 1.3.1 header headers contain information such as the sampling frequency, bit rate, and mode for synchronizing. table 1-4. details of header section information number of bits used value frame sync word 12 ? 1111 1111 1111 ? : fixed value id 1 ? 1 ? : mpeg-1 ? 0 ? : mpeg-2 layer 2 ? 11 ? : layer1/ ? 10 ? : layer2/ ? 01 ? : layer3 (fixed to 01 in the sap77016-b19.) protection bit 1 ? 0': has crc ? 1 ? : no crc (fixed to 1 in the sap77016-b19.) bit rate 4 refer to table 1-5 relationship of bit values to bit rates . sampling frequency 2 refer to table 1-6 relationship of bit values to sampling frequencies . padding bit 1 ? 1 ? : 1 byte is added to frame note 1 ? 0 ? : 1 byte not added to frame private bit 1 not used (fixed to 0 in the sap77016-b19.) mode 2 ? 00 ? : stereo ? 01 ? : joint_stereo ? 10 ? : dual_channel ? 11 ? : single_channel (in the sap77016-b19, fixed to 01 in the case of stereo, and 11 in the case of mono.) mode extension note 2 2 ? 00 ? : is_off, ms_off ? 01 ? : is_on, ms_off ? 10 ? : is_off, ms_on ? 11 ? : is_on, ms_on (fixed to 10 in the sap77016-b19.) copyright 1 ? 0 ? : no copyright ? 1 ? : copyright protected (fixed to 0 in the sap77016-b19.) original/copy distinction 1 ? 0 ? : copy ? 1 ? : original (fixed to 1 in the sap77016-b19.) emphasis 2 ? 00 ? : no emphasis ? 01 ? : 50/15 s ? 10 ? : reserved ? 11 ? : ccitt j.17 (fixed to 00 in the sap77016-b19.) notes 1. for a sampling frequency of 44.1 khz, 1 byte is added to adjust frame ends. 2. ? is ? designates intensity stereo and ? ms ? ms stereo.
chapter 1 overview user ? s manual u16553ej1v0um 16 table 1-5. relationship of bit values to bit rates value mpeg-1 audio layer-3 [kbps] mpeg-2 audio layer-3 lsf [kbps] ? 0000 ? free format note ? 0001 ? 32 8 ? 0010 ? 40 16 ? 0011 ? 48 24 ? 0100 ? 56 32 ? 0101 ? 64 40 ? 0110 ? 80 48 ? 0111 ? 96 56 ? 1000 ? 112 64 ? 1001 ? 128 80 ? 1010 ? 160 96 ? 1011 ? 192 112 ? 1100 ? 224 128 ? 1101 ? 256 144 ? 1110 ? 320 160 ? 1111 ? setting prohibited note not supported by sap77016-b19 table 1-6. relationship of bit values to sampling frequencies value mpeg-1 audio layer-3 [hz] mpeg-2 audio layer-3 lsf [hz] ? 00 ? 44100 22050 ? 01 ? 48000 24000 ? 10 ? 32000 16000 ? 11 ? setting prohibited 1.3.2 crc there are two bytes of information that follow the header only when the header protection bit indicates that crc is in effect. if it is not in effect, the two bytes of information do not exist. in the case of the sap77016-b19, the data is output without crc.
chapter 1 overview user ? s manual u16553ej1v0um 17 1.3.3 side information side information includes information such as the starting position of audio data in a frame and the decoding method as information needed in decoding audio data. the size of side information is shown in table 1-7. table 1-7. size of side information mpeg-1 audio layer-3 [byte] mpeg-2 audio layer-3 lsf [byte] mono 17 9 stereo 32 17 1.3.4 audio data this is data related to an audio sample. the starting position of the audio data is set in the side information. audio data can start in the same frame as the side information that shows the position of the audio data or it can start in a preceding frame. moreover, the starting position of audio data is not limited to one frame before. it also can start two frames before. refer to iso/iec 11172-3 for details about audio data. 1.3.5 additional data this is a segment in which data that the user can define is loaded. this data sometimes does not exist in a frame. this data is not appended in the sap77016-b19.
chapter 1 overview user ? s manual u16553ej1v0um 18 1.4 product overview 1.4.1 features ? supports mono (single channel) and stereo (joint stereo). ? 16-bit linear pcm data input. ? code quantity control at set bit rate (refer to table 1-5 relationship of bit values to bit rates ). the bit rate per frame is variable. a variable bit rate (vbr) is not supported. ? sampling frequency: 32 khz/44.1 khz/48 khz for mpeg-1 audio layer-3; 16 khz/22.05 khz/24 khz for mpeg-2 audio layer-3 lsf (refer to table 1-6 relationship of bit values to sampling frequencies ). ? in mono mode (1 channel), codes 1152 samples/frame for mpeg-1 audio layer-3, and 576 samples/frame for mpeg-2 audio layer-3 lsf. ? in stereo mode (2 channels), codes 2304 samples/frame for mpeg-1 audio layer-3, and 1152 samples/frame for mpeg-2 audio layer-3 lsf. ? ms stereo supported; intensity stereo not supported. 1.4.2 function the sap77016-b19 converts 16-bit linear pcm data of one frame into compressed data.
chapter 1 overview user ? s manual u16553ej1v0um 19 1.4.3 operating environment (1) operable dsps: pd77110, 77113a, 77114, 77115, 77210, 77213 (2) required memory size: the sap77016-b19 requires memory sizes shown in the following table. table 1-8. required memory sizes memory type size [kwords] instruction memory ? 6.6 x memory ram scratch area 4.9 static area 2.3 rom 3.1 y memory ram scratch area 2.5 static area 3.2 library area 0.2 rom 0.8 caution place the x memory and y memory areas used for the library in the internal rom/ram space. the sap77016-b19 uses a certain area as both a scratch area and bit stream buffer area. the required memory size shown above does not include the input buffer (pcm buffer) for audio data. refer to 2.5.3 input buffer. remark one word of instruction memory is 32 bits. one word of x memory or y memory is 16 bits. (3) required a/d converter specifications 2 channels, 16-bit resolution, sampling frequency shown in table 1-1 sampling frequencies . (4) software tools (windows ? version) table 1-9. software tools relevant dsp software tools pd77110 family wb77016 (workbench (assembler/linker)) hsm77016 (high-speed simulator) id77016 (debugger) pd77210 family atair developer studio (workbench (assembler/linker)) pd7721x high-speed simulator pd7721x debugger remark these dsp software tools are produced by atair software gmbh.
chapter 1 overview user ? s manual u16553ej1v0um 20 1.4.4 performance table 1-10 shows the mips values (measured values) necessary for real-time execution of processing of one frame. ? measurement conditions simulator: hsm77016 ( pd77016 high-speed simulator) evaluation result: the processing speed is measured when a stereo/mono audio file is compressed, and the average value and maximum value are calculated. the processing speed of only the mp3enc_encode function is included in compression. the processing speed of the other functions and interrupt handlers is not included. table 1-10. mips values of 1-frame compression processing (measured values) (a) mpeg-1 audio layer-3 sampling frequency [khz] 32 44.1 48 setting bit rate [kbps] 64 96 128 64 96 128 64 96 128 average value stereo 44.5 45.0 47.5 49.3 50.0 53.8 51.4 51.6 56.0 [mips] mono 22.7 23.0 23.0 25.1 25.9 25.9 26.2 26.9 27.0 maximum value stereo 68.0 69.2 70.7 77.3 75.5 79.1 76.2 73.7 84.2 [mips] mono 37.6 38.0 38.3 42.4 42.6 40.9 41.3 42.7 44.0 (b) mpeg-2 audio layer-3 lsf sampling frequency [khz] 16 22.05 24 setting bit rate [kbps] 64 96 128 64 96 128 64 96 128 average value stereo 22.6 23.0 23.2 30.8 31.1 31.5 31.7 34.1 34.8 [mips] mono 11.2 11.5 11.9 15.3 15.5 15.8 17.1 16.9 17.4 maximum value stereo 36.2 37.4 36.8 51.7 48.8 51.9 54.7 53.4 56.5 [mips] mono 21.2 20.9 20.7 27.6 28.2 29.0 30.3 33.7 33.6 remark these mips values were measured when evaluation was made by nec electronics. the maximum values do not guarantee the worst values.
chapter 1 overview user ? s manual u16553ej1v0um 21 1.4.5 directory configuration the directory configuration of the psap77016-b19 is shown below. library mp3enc.h: m3eram.lib: smp mp3enc m3erom.lib: sample.prj: sample.asm: value.tmg: pcm_in.tmg: stream_out.tmg: library for pd77113a, 77114, 77213 library for pd77110, 77115, 77210 timing file for parameter information sample source file project file header file timing file for data input timing file for data output a summary of each directory is shown below. ? library this directory contains library files. ? smp/mp3enc this directory contains sample program source files, header files and timing files.
user ? s manual u16553ej1v0um 22 chapter 2 library specifications 2.1 library overview sap77016-b19 provides the following four functions. table 2-1. list of library functions function name function mp3enc_start initialization mp3enc_encode compression process mp3enc_stop termination process mp3enc_getversion obtain version information
chapter 2 library specifications user ? s manual u16553ej1v0um 23 2.2 application processing flow figure 2-1 shows an example of the processing of an application that uses sap77016-b19. figure 2-1. application processing flow encode processing call mp3enc_encode start encoder initialization call mp3enc_start audio serial input interrupt handler 1 frame of sampling count? processing to input data to pcm buffer no yes processing to output compressed data of bit stream buffer from host i/f muted data input to pcm buffer data i/o initialization processing ad initial setup interrupt enable, etc. 16-bit liner pcm data input end of encoder? yes no processing to output compressed data of bit stream buffer from host i/f encode processing call mp3enc_encode processing to output compressed data of bit stream buffer from host i/f encode processing call mp3enc_encode termination processing call mp3enc_stop processing to output compressed data of bit stream buffer from host i/f encode processing call mp3enc_encode termination processing call mp3enc_stop remark the 16-bit linear pcm data input processing of the interrupt handler is dependent upon the hardware of the target system. therefore, the user should design the input processing in accordance with their target system.
chapter 2 library specifications user ? s manual u16553ej1v0um 24 2.3 function specifications 2.3.1 mp3enc_start function the mp3enc_start function initializes each parameter used by the encoder. call this function only once before using the mp3enc_encode function. [classification] mp3 encoder initialization processing [function name] mp3enc_start [summary of function] initializes the parameters used by the sap77016-b19 [format] call mp3enc_start [arguments] r0l first address of static area in x memory note r1l first address of scratch area in x memory note r2l first address of static area in y memory note r3l first address of scratch area in y memory note [return value] none [registers used] r0, r1, r2, r3, r4, r7, dp0, dp4, dp5 [hardware resources] maximum stack level 2 maximum loop stack level 1 maximum number of repeats 3214 maximum number of cycles 11642 note for the memory, refer to 2.5 memory structure . caution secure the scratch memory area and static memory area before calling this function.
chapter 2 library specifications user ? s manual u16553ej1v0um 25 2.3.2 mp3enc_encode function the mp3enc_encode function compresses audio data equivalent to the number of words of data shown in table 1-2 number of words of input data at a specified bit rate. [classification] mp3 encode processing [function name] mp3enc_encode [summary of function] compresses the 16-bit linear pcm data in the pcm buffer and then outputs the compressed data to the bit stream buffer. [format] call mp3enc_encode [arguments] r0l first address of structure consisting of parameters necessary for compressing in x memory note 1 r1l first address of input buffer (pcm buffer) for data input for encoder in x memory note 2 r2l first address of output buffer (bit stream buffer) for data output from encoder in x memory note 2, 3 r3l first address of static area in x memory note 2 r4l first address of static area in y memory note 2 [return value] r0l when 0 or greater: size of compressed bit stream (number of bytes) when negative: error [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 7 maximum loop stack level 2 maximum number of repeats 31 maximum mips value 84.2 mips (48 khz sampling, 128 kbps, stereo) notes 1. for the parameters necessary for compression, refer to 2.4 parameters necessary for compression . 2. for the memory area and i/o buffers, refer to 2.5 memory structure . 3. the first address of the output buffer (bit stream buffer) is the same as that of the scratch area in x memory. caution on completion of encoding, the user should perform the following procedure. this can prevent the previous audio data from affecting compression of the next audio data. (1) input muted data of 1 frame to the pcm buffer frame (refer to table 1-2 number of words of input data ). (2) call the mp3enc_encode function twice. (3) call the mp3enc_stop function once. (4) call the mp3enc_encode function once. (5) call the mp3enc_stop function once.
chapter 2 library specifications user ? s manual u16553ej1v0um 26 2.3.3 mp3enc_stop function the mp3enc_stop function terminates encoder processing. for the procedure after terminating encoding, refer to figure 2-1 application processing flow . [classification] mp3 encoder termination processing [function name] mp3enc_stop [function] terminates the encoder processing of the sap77016-b19. [format] call mp3enc_stop [arguments] r0l: 1 (during the encode termination processing: first call) 0 (during the encode termination processing: second call) during the encode terminating processing, when calling the mp3enc_stop function for the first time, set 1; for the second time, set 0. [return value] none [registers used] r0, r7, dp4, dp5 [hardware resources] maximum stack level 2 maximum loop stack level 1 maximum number of repeats 0 maximum number of cycles 79
chapter 2 library specifications user ? s manual u16553ej1v0um 27 2.3.4 mp3enc_getversion function the mp3enc_getversion function returns the version number of the sap77016-b19. [classification] version information acquisition [function name] mp3enc_getversion [function] returns the version number of the sap77016-b19 library in a 32-bit value. version when r0 = 0x00 ? 0x0001 ? 0x0100: v1.01 [format] call mp3enc_getversion [arguments] none [return value] r0h major version number r0l minor version number [registers used] r0 [hardware resources] maximum stack level 0 maximum loop stack level 0 maximum number of repeats 0 maximum number of cycles 6
chapter 2 library specifications user ? s manual u16553ej1v0um 28 2.4 parameters necessary for compression secure a structure (refer to figure 2-2) consisting of the parameters necessary for compression on x memory. set the information for each parameter to this structure just once between the execution of the mp3enc_start and mp3enc_encoder functions. figure 2-2. structure consisting of parameters necessary for compression <1> _header_bitrate_index: 1 word first address of structure: r0l 5 words <3> _header_padding_bit: 1 word <2> _header_sampling_frequency: 1 word <4> _header_mode: 1 word <5> _header_mode_extension: 1 word <1> _header_bitrate_index (1 word): this parameter sets the bit rate. for the setting values, refer to table 1-5 relationship of bit values to bit rates . for example, to set a bit rate of 16 kbps using mpeg-2 audio layer-3 lsf, set 0x2. <2> _header_sampling_frequency (1 word): this parameter specifies the sampling frequency. the setting values for this word are listed in table 2-2. for example, to set a frequency of 16000 hz using mpeg-2 audio layer-3 lsf, set 0x6. table 2-2. values to specify sampling frequency compression method value frequency [hz] mpeg-1 0x0 44100 audio layer-3 0x1 48000 0x2 32000 0x3 setting prohibited mpeg-2 0x4 22050 audio layer-3 lsf 0x5 24000 0x6 16000 0x7 setting prohibited <3> _header_padding_bit (1 word): this parameter does not need to be specified by users. set any values here. <4> _header_mode (1 word): set 0x3 when the number of channels is one and 0x1 when two. <5> _header_mode_extension (1 word): this parameter does not need to be specified by users. set any values here.
chapter 2 library specifications user ? s manual u16553ej1v0um 29 2.5 memory structure with the sap77016-b19, the user must define the memory area and input buffer area necessary for processing. the scratch memory area and static memory area must be separately defined. for the size of each memory area, refer to table 2-3. table 2-3. symbol name/memory sizes symbol name size [words] x/y plane description scratch_x_area 5000 x scratch area scratch_y_area 2533 y scratch area static_x_area 2304 x static area static_y_area 3214 y static area caution place the x memory and y memory areas used for the library in the internal rom/ram space. the size of the scratch memory area and static memory area shown above does not include the input buffer (pcm buffer). refer to 2.5.3 input buffer. 2.5.1 scratch area the scratch area is a memory area that can be discarded when it is not used by the sap77016-b19. the user can use the scratch area freely after encoding processing of one frame. when the sap77016-b19 uses this area again, however, the information set by the user to this area is not guaranteed. example scratch_x xramseg scratch_x_area: ds 5000 scratch_y yramseg scratch_y_area: ds 2533 caution the sap77016-b19 also uses the scratch area in x memory as the bit stream buffer. therefore, copy the encode data (bit stream) that is output to the scratch area (bit stream buffer) in x memory to another area after completing encoding of one frame, and then perform the encoding for the next frame. 2.5.2 static area the static area is a memory area that cannot be discarded even when the sap77016-b19 does not operate. the user must not use the static area. if the user manipulates this area after initialization, the correct operation of the sap77016-b19 cannot be guaranteed. example static_x xramseg static_x_area: ds 2304 static_y yramseg static_y_area: ds 3214
chapter 2 library specifications user ? s manual u16553ej1v0um 30 2.5.3 input buffer the input buffer is an area to which audio data (16-bit linear pcm data) is input. the user must secure an area for the input buffer in x memory. the required input buffer size is shown in table 2-4. the user can freely use the input buffer area after encoding of one frame. if the input buffer area is manipulated during encoding, correct operation is not guaranteed. table 2-4. input buffer size compression ratio number of channels number of words of input audio data required input buffer size [word] mpeg-1 1 1152 1152 or more audio layer-3 2 2304 2304 or more mpeg-2 1 576 576 or more audio layer-3 lsf 2 1152 1152 or more remark 1 word = 16 bits figure 2-3. user-defined input buffer (pcm buffer) first address of input buffer: r1l size of input buffer mpeg-1 audio layer-3 mono (1 channel): 1152 words or more stereo (2 channels): 2304 words or more mpeg-2 audio layer-3 lsf mono (1 channel): 576 words or more stereo (2 channels): 1152 words or more l r
chapter 2 library specifications user ? s manual u16553ej1v0um 31 2.5.4 output buffer the output buffer (bit stream buffer) is an area from which bit stream data is output. the sap77016-b19 specifies a certain area as both a scratch area and bit stream buffer area. therefore, the user does not need to secure the output buffer in an area other than the scratch area in x memory. after encoding of one frame, the user can use the output buffer area freely when the output encode data (bit stream) note is copied to another area. if the output buffer area is manipulated during encoding, correct operation is not guaranteed. note the maximum size of the bit stream that is output during encoding of one frame is 1872 words. caution the sap77016-b19 also uses the scratch area in x memory as the bit stream buffer. therefore, copy the encode data (bit stream) that is output to the scratch area (bit stream buffer) in x memory to another area after completing encoding of one frame, and then perform the encoding for the next frame. figure 2-4. output buffer (bit stream buffer) first address of output buffer: r2l size of output buffer 5000 words remark the first address of the output buffer (bit stream buffer) is the same as that of the scratch area in x memory.
user ? s manual u16553ej1v0um 32 chapter 3 installation 3.1 installation procedure the sap77016-b19 (mp3 audio encoder middleware) is supplied on a cd-rom. the procedure for installing the sap77016-b19 in the host machine is outlined below. <1> set the cd-rom in the cd-rom drive and copy the files to the directory where wb77016 and hsm77016 (dsp tools) are used (e.g. c:\dsptools). the following is an example of when files are copied from the q drive to the c drive. q:\>xcopy /s *.* c:\dsptools <2> confirm that the files have been copied. refer to 1.4.5 directory configuration for details on the directories. c:\>dir c:\dsptools
chapter 3 installation user ? s manual u16553ej1v0um 33 3.2 sample program creation procedure a sample program is stored in the smp directory. the sample program operates on hsm77016 (high-speed simulator) ver. 2.32 or later. using the timing files described later makes it possible to simulate data i/o. refer to appendix sample program source regarding timing files. the following is an explanation of how to build a sample program of the sap77016-b19. <1> start up the wb77016 (workbench) ver.2.4 or later. <2> open the sample.prj project file. example specify sample.prj with the open project command on 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> start up the hsm77016 (high-speed simulator) ver.2.32 or later. <5> open the sample.lnk file. example specify sample.lnk with the open command on the file menu. <6> open timing files (value.tmg, pcm_in.tmg, stream_out.tmg). example specify value.tmg with the open command on the file menu.
chapter 3 installation user ? s manual u16553ej1v0um 34 3.3 symbol naming conventions table 3-1 shows the naming conventions of the symbols used for the sap77016-b19. do not use symbol names in duplicate when other applications are used in combination. table 3-1. symbol naming conventions classification convention function name, code segment name (imseg), constant segment name (romseg/ramseg), constant name, variable area name mp3enc_xxxx remark xxxx is an alphanumeric character string.
user ? s manual u16553ej1v0um 35 chapter 4 system example 4.1 simulation environment using timing file the simulation environment of the compression processing of the sap77016-b19 is shown below. audio data (16-bit linear pcm data) is input and compressed in 1-frame units, and the compressed data is output. [software environment] ? high-speed simulator: hsm77016 ver.2.32 or later ? sample program: sample.lnk (created in 3.2 sample program creation procedure ) ? timing file: value.tmg, pcm_in.tmg, stream_out.tmg 4.2 operation <1> start up the high-speed simulator. <2> open sample.lnk created in 3.2 sample program creation procedure . example specify sample.lnk by clicking ? file open ? . <3> open the timing files (value.tmg, pcm_in.tmg, stream_out.tmg). example specify value.tmg by clicking ? file open ? . <4> execute using run.
user ? s manual u16553ej1v0um 36 appendix sample program source a.1 header file (mp3enc.h) /*----------------------------------------------------------------------*/ /* file information */ /*----------------------------------------------------------------------*/ /* name : mp3enc.h */ /* type : header file */ /* version : 1.00 */ /* date : 2002 nov 26 */ /* cpu : upd7701x family */ /* assembler : wb77016 ver 2.4 */ /* about : header */ /* */ /*----------------------------------------------------------------------*/ /* copyright (c) nec electronics corporation 2002 */ /* nec electronics confidential and proprietary */ /* all rights reserved by nec electronics corporation. */ /* use of copyright notice does not evidence publication */ /*----------------------------------------------------------------------*/ #ifndef _ _ mp3enc_h #define _ _ mp3enc_h #define mp3enc_scratch_area_x_size 5000 #define mp3enc_scratch_area_y_size 2533 #define mp3enc_static_area_x_size 2304 #define mp3enc_static_area_y_size 3214 #define headersize 5 ;typedef struct { ; short bitrate_index ; short sampling_frequency ; short padding_bit ; short mode ; short mode_extension ;} extrn mp3enc_start extrn mp3enc_encode extrn mp3enc_stop extrn mp3enc_getversion #endif
appendix sample program source user ? s manual u16553ej1v0um 37 a.2 sample source file (sample.asm) (1/10) /*----------------------------------------------------------------------*/ /* file information */ /*----------------------------------------------------------------------*/ /* name : sample.asm */ /* type : assembler program module */ /* version : 1.00 */ /* date : 2002 nov 26 */ /* cpu : upd7701x family */ /* assembler : wb77016 ver 2.4 */ /* about : sample */ /* */ /*----------------------------------------------------------------------*/ /* copyright (c) nec electronics corporation 2002 */ /* nec electronics confidential and proprietary */ /* all rights reserved by nec electronics corporation. */ /* use of copyright notice does not evidence publication */ /*----------------------------------------------------------------------*/ #include "mp3enc.h" /*----------------------------------------------------------------------*/ #definebitstreambuffersize mp3enc_scratch_area_x_size #definepcmbuffersize 1152*2 #defineheader_bitrate_index _header_bitrate_index:x #defineheader_sampling_frequency _header_sampling_frequency:x #defineheader_padding_bit _header_padding_bit:x #defineheader_mode _header_mode:x #defineheader_mode_extension _header_mode_extension:x #defineoutputbufferflag _outputbufferflag:x #definevalued _valued:x #definebitstreamlength_h _bitstreamlength:x #definebitstreamlength_l _bitstreamlength+1:x #defineframe _frame:x #definechannel _channel:x #definebitrate_h _bitrate:x #definebitrate_l _bitrate+1:x #definestream_length _stream_length:x #definefw_out_flag _fw_out_flag:x #definefw_run_flag _fw_run_flag:x /*----------------------------------------------------------------------*/ main_ctrl_workxramseg at 0x0ff0 _channel: ds 1 _bitrate: ds 2 _outputbufferflag: ds 1 _valued: ds 1
appendix sample program source user ? s manual u16553ej1v0um 38 (2/10) header: _header_bitrate_index: ds 1 _header_sampling_frequency: ds 1 _header_padding_bit: ds 1 _header_mode: ds 1 ; use in timing file _header_mode_extension: ds 1 _bitstreamlength: ds 2 _frame: ds 1 _stream_length: ds 1 ; use in timing file _fw_out_flag: ds 1 ; use in timing file _fw_run_flag: ds 1 ; use in timing file main_x_work1 xramseg at 0x2000 pcm: ds pcmbuffersize main_y_work yramseg at 0x2000 outbitstreambuffer: ds 0x1000 static_x xramseg static_x_area: ds mp3enc_static_area_x_size scratch_x xramseg _ _ bitstreambuffer: ds mp3enc_scratch_area_x_size static_y yramseg static_y_area: ds mp3enc_static_area_y_size scratch_y yramseg scratch_y_area: ds mp3enc_scratch_area_y_size ;------------------------------------------------ vector imseg at 0x200 %define (jmpvect(addr)) ( jmp addr; nop; nop; nop; ) %define (nopvect) ( nop; reti; nop; nop; )
appendix sample program source user ? s manual u16553ej1v0um 39 (3/10) ivreset: %jmpvect(startup) ; %nopvect ; %nopvect ; %nopvect ; ivint1: %nopvect ; ivint2: %nopvect ; ivint3: %nopvect ; ivint4: %nopvect ; ivint5: %nopvect ; ivint6: %nopvect ; ivint7: %nopvect ; ivint8: %nopvect ; ivint9: %nopvect ; ivint10: %nopvect ; ivint11: %nopvect ; ivint12: %nopvect ; main imseg at 0x240 %define(initialize) ( clr (r0) ; r1 = r0 ; r2 = r0 ; r3 = r0 ; r4 = r0 ; r5 = r0 ; r6 = r0 ; r7 = r0 ; dp0 = r0l ; dp1 = r0l ; dp2 = r0l ; dp3 = r0l ; dp4 = r0l ; dp5 = r0l ; dp6 = r0l ; dp7 = r0l ; dn0 = r0l ;
appendix sample program source user ? s manual u16553ej1v0um 40 (4/10) dn1 = r0l ; dn2 = r0l ; dn3 = r0l ; dn4 = r0l ; dn5 = r0l ; dn6 = r0l ; dn7 = r0l ; dmx = r0l ; dmy = r0l ; sp = r0l ; lsp = r0l ; r0l = 0xffff ; sr = r0l ; eir = r0l ; ) startup: %initialize ; clr (r0) ; dp0 = _ _ bitstreambuffer ; rep bitstreambuffersize ; *dp0++ = r0h ; dp0 = pcm ; rep pcmbuffersize ; *dp0++ = r0h ; *outputbufferflag = r0h ; *valued = r0h ; *stream_length = r0h ; r0l = static_x_area ; mp3enc_start (static_x_area, (scratch_y_area=)_ _bitstreambuffer, r1l = _ _ bitstreambuffer ; static_y_area, scratch_y_area) r2l = static_y_area ; r3l = scratch_y_area ; call mp3enc_start ; clr (r0) ;run_flag = 0 *fw_run_flag = r0h ; r0 = *fw_run_flag ;while (run_flag == 0) {} if (r0 == 0) jmp $-1 ; ;; header analysis ;; (msb) ;; 22+2+4+16 = 44byte -> 22word dp0 = pcm ; rep 22/2 ;fread (buff, 1, 22, fi) r0 = *dp0++ ; r0 = *dp0++ ;fread (&channel, 1, 2, fi) *channel = r0h ; r0l = *dp0++ ;fread (&freq, 1, 4, fi) r0eh = *dp0++ ; ;fread (buff, 1, 16, fi)
appendix sample program source user ? s manual u16553ej1v0um 41 (5/10) clr (r1) ;index = 0 r2 = r0 - 44100 ;switch (freq) { if (r2 == 0) jmp _break ;case 44100: index = 0; break r1 = r1 + 1 ; r2 = r0 - 48000 ;case 48000: index = 1; break if (r2 == 0) jmp _break ; r1 = r1 + 1 ; r2 = r0 - 32000 ;case 32000: index = 2; break if (r2 == 0) jmp _break ; r1 = r1 + 2 ; r2 = r0 - 22050 ;case 22050: index = 4; break if (r2 == 0) jmp _break ; r1 = r1 + 1 ; r2 = r0 - 24000 ;case 24000: index = 5; break if (r2 == 0) jmp _break ; r1 = r1 + 1 ; r2 = r0 - 16000 ;case 16000: index = 6; break if (r2 == 0) jmp _break ; jmp $ ;defualt: exit _break: ;} *header_sampling_frequency = r1l;header.sampling_frequency = index clr (r0) ; r1 = r0 + 1 ;k = 1 r0l = *channel ;if (channel != 2) r2 = r0 - 2 ; k += 2 if (r2 != 0) r1 = r1 + 1 ; if (r2 != 0) r1 = r1 + 1 ; *header_mode = r1l ;header.mode = k clr (r1) ; r0 = r1 + 64000 ;64kbps nop ; *bitrate_h = r0h ; *bitrate_l = r0l ; r1l = *header_sampling_frequency; r2 = r1 - 4 ; r0 = *bitrate_h ; r0l = *bitrate_l ; clr (r1) ; if (r2 >= 0) jmp _mpeg2 ;if (header.sampling_frequency < 4) { _mpeg1: ; r2 = r0 & 7 ; switch (bitrate) { if (r2 != 0) jmp _break2 ; r0 = r0 sra 3 ; r2 = r0 - (32000/8) ; case 32000: r1 = r1 + 1 ; index = 1 if (r2 == 0) jmp _break2 ; break r2 = r0 - (40000/8) ; case 40000: r1 = r1 + 1 ; index = 2
appendix sample program source user ? s manual u16553ej1v0um 42 (6/10) if (r2 == 0) jmp _break2 ; break r2 = r0 - (48000/8) ; case 48000: r1 = r1 + 1 ; index = 3 if (r2 == 0) jmp _break2 ; break r2 = r0 - (56000/8) ; case 56000: r1 = r1 + 1 ; index = 4 if (r2 == 0) jmp _break2 ; break r2 = r0 - (64000/8) ; case 64000: r1 = r1 + 1 ; index = 5 if (r2 == 0) jmp _break2 ; break r2 = r0 - (80000/8) ; case 80000: r1 = r1 + 1 ; index = 6 if (r2 == 0) jmp _break2 ; break r2 = r0 - (96000/8) ; case 96000: r1 = r1 + 1 ; index = 7 if (r2 == 0) jmp _break2 ; break r2 = r0 - (112000/8) ; case 112000: r1 = r1 + 1 ; index = 8 if (r2 == 0) jmp _break2 ; break r2 = r0 - (128000/8) ; case 128000: r1 = r1 + 1 ; index = 9 if (r2 == 0) jmp _break2 ; break r2 = r0 - (160000/8) ; case 160000: r1 = r1 + 1 ; index = 10 if (r2 == 0) jmp _break2 ; break r2 = r0 - (192000/8) ; case 192000: r1 = r1 + 1 ; index = 11 if (r2 == 0) jmp _break2 ; break r2 = r0 - (224000/8) ; case 224000: r1 = r1 + 1 ; index = 12 if (r2 == 0) jmp _break2 ; break r2 = r0 - (256000/8) ; case 256000: r1 = r1 + 1 ; index = 13 if (r2 == 0) jmp _break2 ; break r2 = r0 - (320000/8) ; case 320000: r1 = r1 + 1 ; index = 14 if (r2 == 0) jmp _break2 ; clr (r1) ; default: jmp _break2 ; index = 0 ;} _mpeg2: ;} else { r2 = r0 & 3 ; switch (bitrate) { if (r2 != 0) jmp _break2 ; r0 = r0 sra 2 ; r2 = r0 - (8000/4) ; case 8000: r1 = r1 + 1 ; index = 1 if (r2 == 0) jmp _break2 ; break r2 = r0 - (16000/4) ; case 16000: r1 = r1 + 1 ; index = 2 if (r2 == 0) jmp _break2 ; break r2 = r0 - (24000/4) ; case 24000: r1 = r1 + 1 ; index = 3
appendix sample program source user ? s manual u16553ej1v0um 43 (7/10) if (r2 == 0) jmp _break2 ; break r2 = r0 - (32000/4) ; case 32000: r1 = r1 + 1 ; index = 4 if (r2 == 0) jmp _break2 ; break r2 = r0 - (40000/4) ; case 40000: r1 = r1 + 1 ; index = 5 if (r2 == 0) jmp _break2 ; break r2 = r0 - (48000/4) ; case 48000: r1 = r1 + 1 ; index = 6 if (r2 == 0) jmp _break2 ; break r2 = r0 - (56000/4) ; case 56000: r1 = r1 + 1 ; index = 7 if (r2 == 0) jmp _break2 ; break r2 = r0 - (64000/4) ; case 64000: r1 = r1 + 1 ; index = 8 if (r2 == 0) jmp _break2 ; break r2 = r0 - (80000/4) ; case 80000: r1 = r1 + 1 ; index = 9 if (r2 == 0) jmp _break2 ; break r2 = r0 - (96000/4) ; case 96000: r1 = r1 + 1 ; index = 10 if (r2 == 0) jmp _break2 ; break r2 = r0 - (112000/4) ; case 112000: r1 = r1 + 1 ; index = 11 if (r2 == 0) jmp _break2 ; break r2 = r0 - (128000/4) ; case 128000: r1 = r1 + 1 ; index = 12 if (r2 == 0) jmp _break2 ; break r2 = r0 - (144000/4) ; case 144000: r1 = r1 + 1 ; index = 13 if (r2 == 0) jmp _break2 ; break r2 = r0 - (160000/4) ; case 160000: r1 = r1 + 1 ; index = 14 if (r2 == 0) jmp _break2 ; clr (r1) ; default: ; index = 0 ;} _break2: ;} *header_bitrate_index = r1l ; clr (r0) ; *frame = r0h ;frame = 0 *bitstreamlength_h = r0h ;bitstreamlength = 0 *bitstreamlength_l = r0l ; _while1: ;while (1) { clr (r0) ; run_flag = 0 *fw_run_flag = r0h ; r0 = *fw_run_flag ; while (run_flag == 0) {} if (r0 == 0) jmp $-1 ; if (r0 < 0) jmp _break1 ; if (run_flag < 0) break
appendix sample program source user ? s manual u16553ej1v0um 44 (8/10) r0l = header ; ret = mp3enc_encode (&header, pcm, bitstreambuffer, r1l = pcm ; static_x_area, static_y_area) r2l = _ _ bitstreambuffer ; r3l = static_x_area ; r4l = static_y_area ; call mp3enc_encode ; if (r0 < 0) jmp _exit ; if (ret < 0) exit(ret) call copyoutputbuffer ; copyoutputbuffer (ret, bitstreambuffer) r1l = *frame ; frame++ r1 = r1 + 1 ; *frame = r1l ; jmp _while1 ;} _break1: ;; mp3enc_stop process ;; clr (r0) ; dp0 = pcm ; rep 1152*2 ; *dp0++ = r0h ; r1 = r0 + pcm ;ret = mp3enc_encode (&header, pcm, bitstreambuffer, r2 = r0 + _ _ bitstreambuffer ; static_x_area, static_y_area) r0l = header ; r3l = static_x_area ; r4l = static_y_area ; call mp3enc_encode ; if (r0 < 0) jmp _exit ;if (ret < 0) exit(ret) call copyoutputbuffer ;copyoutputbuffer (ret, bitstreambuffer) r0l = header ;ret = mp3enc_encode (&header, pcm, bitstreambuffer, r1l = pcm ; static_x_area, static_y_area) r2l = _ _ bitstreambuffer ; r3l = static_x_area ; r4l = static_y_area ; call mp3enc_encode ; if (r0 < 0) jmp _exit ;if (ret < 0) exit(ret) call copyoutputbuffer ;copyoutputbuffer (ret, bitstreambuffer) r0l = 1 ;finalframe = 1 call mp3enc_stop ; r0l = header ;ret = mp3enc_encode (&header, pcm, bitstreambuffer, r1l = pcm ; static_x_area, static_y_area) r2l = _ _ bitstreambuffer ; r3l = static_x_area ; r4l = static_y_area ; call mp3enc_encode ; if (r0 < 0) jmp _exit ;if (ret < 0) exit(ret) call copyoutputbuffer ;copyoutputbuffer (ret, bitstreambuffer)
appendix sample program source user ? s manual u16553ej1v0um 45 (9/10) clr (r0) ;finalframe = 0 call mp3enc_stop ; r0 = *outputbufferflag ; if (r0 == 0) jmp _exit ; r0 = *valued ; *outbitstreambuffer:y = r0h ; r0l = 1 ; *stream_length = r0l ; clr (r1) ; *fw_out_flag = r1h ; r1 = *fw_out_flag ; if (r1 == 0) jmp $-1 ; _exit: clr (r0) ; r0l = 0x2222 ;length = 0x2222 *stream_length = r0l ; *fw_out_flag = r0h ;out_flag = 0 *fw_run_flag = r0h ;run_flag = 0 jmp startup ; ;; copy from bitstreambuffer to output buffer ;; copyoutputbuffer: if (r0 == 0) ret ; r1 = *bitstreamlength_h ; r1l = *bitstreamlength_l ; r1 += r0 ; *bitstreamlength_h = r1h ; *bitstreamlength_l = r1l ; dp4 = outbitstreambuffer ;wpt = outbitstreambuffer dp0 = _ _ bitstreambuffer ;rpt = bitstreambuffer r2 = *outputbufferflag ;if (outputbufferflag == 0) { if (r2 != 0) jmp _l1 ; r1 = r0 sra 1 ; count = len >> 1 *stream_length = r1l ; r2 = r0 & 1 ; loop r1l { ; for ( ; count > 0; count--) { r1 = *dp0++ ; tmp = *rpt++ *dp4++ = r1h ; *wpt++ = tmp };} *outputbufferflag = r2l ; if (r2 == 0) jmp _l2 ; if (len & 1) { r1 = *dp0 ; valued = *rpt *valued = r1h ; }
appendix sample program source user ? s manual u16553ej1v0um 46 (10/10) jmp _l2 ;} _l1: ;else { r1 = r0 sra 1 ; count = len >> 1 r2 = r0 & 1 ; if (len & 1) if (r2 != 0) r1 = r1 + 1 ; count++ *stream_length = r1l ; r0 = *valued ; tmp = valued << 8 r0 = r0 sra 8 ; loop r1l { ; for ( ; count > 0; count--) { r0l = *dp0++ ; tmp |= *rpt++ r0 = r0 sll 8 ; tmp <<= 8 *dp4++ = r0h ; *wpt++ = (tmp >> 16) r0 = r0 sll 8 ; tmp <<= 8 };} r0 = r0 sll 8 ; *valued = r0h ; valued = tmp >> 16 clr (r1) ; *wpt = valued if (r2 == 0) r1 = r1 + 1 ; *outputbufferflag = r1l ; _l2: ;} clr (r1) ; *fw_out_flag = r1l ; r1 = *fw_out_flag ; if (r1 == 0) jmp $-1 ; ret ;return end
appendix sample program source user ? s manual u16553ej1v0um 47 a.3 timing file for parameter information (value.tmg) (1/2) ;;---------------------------------------------------------------------- ;; file information ;;---------------------------------------------------------------------- ;; name : value.tmg ;; type : timing file ;; version : 1.00 ;; date : 2002 nov 26 ;; cpu : upd7701x family ;; assembler : wb77016 ver2.4 ;; about : for mp3 audio encoder version 1.00 ;; ;;---------------------------------------------------------------------- ;; copyright (c) nec electronics corporation 2002 ;; nec electronics confidential and proprietary ;; all rights reserved by nec corporation. ;; use of copyright notice does not evidence publication ;;---------------------------------------------------------------------- global channel, fw_run_flag, fw_out_flag, stream_length, pcm_start, stream_start global instaddrbitrate, instaddrlsf, sampling ; mpeg1 / 32khz / stereo global s32_01, s32_02, s32_03 ; bitrate global b320, b256, b224, b192 ; for mpeg1 global b144, b024, b016, b008 ; for mpeg2 global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032 ; for mpeg1/2 local mpeg1_mask, mpeg2_mask ;;; address setting ;;; set channel = 0x0ff0;; set sampling = 0x0ff6;; set stream_length = 0x0ffd;; set fw_out_flag = 0x0ffe;; set fw_run_flag = 0x0fff;; set pcm_start = 0x2000;; set stream_start = 0x2000;; set instaddrbitrate = 0x0296;; set instaddrlsf = 0x02fd;; ;;; bitrate flag setting ;;; set b320 = 1 << 17 set b256 = 1 << 16 set b224 = 1 << 15 set b192 = 1 << 14 set b160 = 1 << 13 set b144 = 1 << 12 set b128 = 1 << 11
appendix sample program source user ? s manual u16553ej1v0um 48 (2/2) set b112 = 1 << 10 set b096 = 1 << 9 set b080 = 1 << 8 set b064 = 1 << 7 set b056 = 1 << 6 set b048 = 1 << 5 set b040 = 1 << 4 set b032 = 1 << 3 set b024 = 1 << 2 set b016 = 1 << 1 set b008 = 1 << 0 ;;; mask flag setting ;;; set mpeg1_mask = b320|b256|b224|b192|b160|b128|b112|b096|b080|b064|b056|b048|b040|b032 set mpeg2_mask = b160|b144|b128|b112|b096|b080|b064|b056|b048|b040|b032|b024|b016|b008 sub flagclear ;;; zero clear ;;; set s32_01 = 0 set s32_02 = 0 set s32_03 = 0 endsub sub flagmask ;;; masking ;;; set s32_01 = s32_01 & mpeg1_mask set s32_02 = s32_02 & mpeg1_mask set s32_03 = s32_03 & mpeg1_mask endsub ;;; main ;;; flagclear set s32_02 = b040 flagmask end
appendix sample program source user ? s manual u16553ej1v0um 49 a.4 timing file for data input (pcm_in.tmg) (1/3) ;;---------------------------------------------------------------------- ;; file information ;;---------------------------------------------------------------------- ;; name : pcm_in.tmg ;; type : timing file ;; version : 1.00 ;; date : 2002 nov 26 ;; cpu : upd7701x family ;; assembler : wb77016 ver2.4 ;; about : for mp3 audio encoder version 1.00 ;; ;;---------------------------------------------------------------------- ;; copyright (c) nec electronics corporation 2002 ;; nec electronics confidential and proprietary ;; all rights reserved by nec corporation. ;; use of copyright notice does not evidence publication ;;---------------------------------------------------------------------- global channel, fw_run_flag, fw_out_flag, stream_length, pcm_start global instaddrbitrate, instaddrlsf, sampling ; mpeg1 / 32khz / stereo global s32_01, s32_02, s32_03 ; bitrate global b320, b256, b224, b192 ; for mpeg1 global b144, b024, b016, b008 ; for mpeg2 global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032 ; for mpeg1/2 global size, sz local data, pcm local bitrate sub hanten ; (data) set data = ((data >> 8) & 0xff) | ((data & 0xff) << 8) endsub sub writedata hanten set *pcm:x = data set pcm = pcm + 1 endsub sub writting ; (size, sz) local tmp set pcm = pcm_start if (size >= sz) rept sz input data writedata endrept
appendix sample program source user ? s manual u16553ej1v0um 50 (2/3) set size = size - sz else set tmp = sz - size rept size input data writedata endrept set data = 0 rept tmp writedata endrept set size = 0 endif endsub sub wave2stream input format hex input size set *fw_run_flag:x = 1 wait cond (*fw_run_flag:x != 1) set sz = 22 writting set *fw_run_flag:x = 1 wait cond ip == instaddrbitrate set r0 = bitrate wait cond ip == instaddrlsf set sz = 576 if (*sampling:x < 4) set sz = sz << 1 endif if (*channel:x != 1) set sz = sz << 1 endif do set *fw_run_flag:x = 1 wait cond (*fw_run_flag:x != 1) exit (size < sz) writting enddo set *fw_run_flag:x = -1 wait cond (*fw_run_flag:x != -1) endsub
appendix sample program source user ? s manual u16553ej1v0um 51 (3/3) ;;; wait for initialize ;;; wait 1 if (s32_02) if (s32_02 & b040) open input "02u32.dat" set bitrate = 40000 wave2stream close input endif endif break end
appendix sample program source user ? s manual u16553ej1v0um 52 a.5 timing file for data output (stream_out.tmg) (1/2) ;;---------------------------------------------------------------------- ;; file information ;;---------------------------------------------------------------------- ;; name : stream_out.tmg ;; type : timing file ;; version : 1.00 ;; date : 2002 nov 26 ;; cpu : upd7701x family ;; assembler : wb77016 ver2.4 ;; about : for mp3 audio encoder version 1.00 ;; ;;---------------------------------------------------------------------- ;; copyright (c) nec electronics corporation 2002 ;; nec electronics confidential and proprietary ;; all rights reserved by nec corporation. ;; use of copyright notice does not evidence publication ;;---------------------------------------------------------------------- global fw_out_flag, stream_length, stream_start ; mpeg1 / 32khz / stereo global s32_01, s32_02, s32_03 ; bitrate global b320, b256, b224, b192 ; for mpeg1 global b144, b024, b016, b008 ; for mpeg2 global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032 ; for mpeg1/2 sub wave2stream2 local data, rpt, length output #10 format dec do set *fw_out_flag:x = 1 wait cond *fw_out_flag:x != 1 set length = *stream_length:x exit length >= 0x2000 if (length) set rpt = stream_start rept length set data = *rpt:y output #10 data set rpt = rpt + 1 endrept endif enddo endsub
appendix sample program source user ? s manual u16553ej1v0um 53 (2/2) ;;; main ;;; wait 1 if (s32_02) if (s32_02 & b040) open output #10 "02u32u40.dat" wave2stream2 close output #10 endif endif end
user ? s manual u16553ej1v0um 54 [memo]


▲Up To Search▲   

 
Price & Availability of USAB17AP77016-XXX-B19

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