📄 g726demo.c
字号:
/* 20/Oct/2005 V1.3 ============================================================================ G726DEMO.C ~~~~~~~~~~ Description: ~~~~~~~~~~~~ Demonstration program for UGST/ITU-T G.726 module (the same as the Blue Book G.726). Takes the input file and processes by the G.726 codec, depending on user's option: for encoding, input must be in either A or mu law (G711), for decoding, in ADPCM format. The modules called have been originally written in Fortran, and were translated into C by the converter f2c, version of October 15, 1990 at 19:58:17. Input data is supposed to be aligned at word boundaries, i.e., organized in 16-bit words, following the operating system normal organization (low-byte first for VMS and DOS; high byte first for most Unix systems). G711 compressed data is supposed to be in the 8 LEAST significant bits of the word and the ADPCM data is in the LEAST 5 bits. Both are without sign extension. Output data will be generated in the same format as decribed above for the input data. Usage: ~~~~~~ $ G726demo [-options] Law Transf Rate InpFile OutFile [BlockSize [1stBlock [NoOfBlocks [Reset]]]] where: Law is the law desired (either A or u) Transf is the desired conversion on the input file: [lolo], (A/u)log -> ADPCM -> (A/u) log [load], (A/u)log -> ADPCM [adlo], ADPCM -> (A/u) log Rate is the number of ADPCM bits per sample: [5],[40] -> 5 bits per sample (40 kbit/s) [4],[32] -> 4 bits per sample (32 kbit/s) [3],[24] -> 3 bits per sample (24 kbit/s) [2],[16] -> 2 bits per sample (16 kbit/s) InpFile is the name of the file to be processed; OutFile is the name with the processed data; BlockSize is the block size, in number of samples 1stBlock is the number of the first block of the input file to be processed; NoOfBlocks is the number of blocks to be processed, starting on block "1stBlock" Reset is the optional reset. If specified as 1, the coder and decoder will be reset at the very beginning of the processings. If 0, the processing will start with the variables at a unknown state. It defaults to 1 (reset ON). Options: -noreset don't apply reset to the encoder/decoder -?/-help print help message Example: $ G726demo u lolo 4 voice.ref voice.rel 256 3 45 *OR* $ G726demo u lolo 32 voice.ref voice.rel 256 3 45 The command above takes the samples in file "voice.ref", already in mu law format, processes the data through the G726 encoder and decoder at a rate of 32 bkit/s, saving them into the file "voice.rel". The processing starts at block 3 for 45 blocks, each block being 256 samples wide. Original authors: ~~~~~~~~~~~~~~~~~ Simao Ferraz de Campos Neto EMail : simao@cpqd.ansp.br (32k) Fernando Tofolli Queiroz EMail : tdfernan@cpqd.ansp.br (extension) CPqD/Telebras Rd. Mogi Mirim-Campinas Km.118 DDS/Pr.11 13.088-061 - Campinas - SP (Brazil) History: ~~~~~~~~ 28/Feb/1994 v1.0 Release of 1st version of this demo program based on the g721demo of the STL92. G.726 functionality added by Fernando Toffoli Queiroz <tdfernan@cpqd.ansp.br>; usage routine and portability tests by Simao. 22/Feb/1996 v1.1 Removed compilation warnings, included headers as suggested by Kirchherr (FI/DBP Telekom) to run under OpenVMS/AXP <simao@ctd.comsat.com> 21/Mar/2000 v1.2 Changed memory allocation of floating point buffers tmp_buf[], inp_buf[] and out_buf[] from static to dynamic, to prevent memory invasion when block sizes larger than 256 are specified. Corrected bug that made incorrect calculation on total number of blocks to process when the block size is not a multiple of the file size. <simao.campos@labs.comsat.com>
20/Oct/2005 v1.3 Filtering of the rate field (if rate is different
of 2/3/4/5 or 16/24/32/40, the program stops).
<Cyril Guillaum
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -