Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
util.c
Package: g729a_c_linux.rar [view]
Upload User: zhouyunkk
Upload Date: 2013-01-10
Package Size: 59k
Code Size: 3k
Category:
Voice Compress
Development Platform:
C/C++
- /*
- ITU-T G.729 Annex C - Reference C code for floating point
- implementation of G.729
- Version 1.01 of 15.September.98
- */
- /*
- ----------------------------------------------------------------------
- COPYRIGHT NOTICE
- ----------------------------------------------------------------------
- ITU-T G.729 Annex C ANSI C source code
- Copyright (C) 1998, AT&T, France Telecom, NTT, University of
- Sherbrooke. All rights reserved.
- ----------------------------------------------------------------------
- */
- /*
- File : UTIL.C
- Used for the floating point version of both
- G.729 main body and G.729A
- */
- /*****************************************************************************/
- /* auxiliary functions */
- /*****************************************************************************/
- #include "typedef.h"
- #include "version.h"
- #ifdef VER_G729A
- #include "ld8a.h"
- #else
- #include "ld8k.h"
- #endif
- /*-------------------------------------------------------------------*
- * Function set zero() *
- * ~~~~~~~~~~ *
- * Set vector x[] to zero *
- *-------------------------------------------------------------------*/
- void set_zero(
- FLOAT x[], /* (o) : vector to clear */
- int L /* (i) : length of vector */
- )
- {
- int i;
- for (i = 0; i < L; i++)
- x[i] = (F)0.0;
- return;
- }
- /*-------------------------------------------------------------------*
- * Function copy: *
- * ~~~~~ *
- * Copy vector x[] to y[] *
- *-------------------------------------------------------------------*/
- void copy(
- FLOAT x[], /* (i) : input vector */
- FLOAT y[], /* (o) : output vector */
- int L /* (i) : vector length */
- )
- {
- int i;
- for (i = 0; i < L; i++)
- y[i] = x[i];
- return;
- }
- /* Random generator */
- INT16 random_g729(void)
- {
- static INT16 seed = 21845;
- seed = (INT16) (seed * 31821L + 13849L);
- return(seed);
- }
- /*-----------------------------------------------------------*
- * fwrite16 - writes a FLOAT array as a Short to a a file *
- *-----------------------------------------------------------*/
- void fwrite16(
- FLOAT *data, /* input: inputdata */
- int length, /* input: length of data array */
- FILE *fp /* input: file pointer */
- )
- {
- int i;
- INT16 sp16[L_FRAME];
- FLOAT temp;
- if (length > L_FRAME) {
- printf("error in fwrite16n");
- exit(16);
- }
- for(i=0; i<length; i++)
- {
- /* round and convert to int */
- temp = data[i];
- if (temp >= (F)0.0)
- temp += (F)0.5;
- else temp -= (F)0.5;
- if (temp > (F)32767.0 ) temp = (F)32767.0;
- if (temp < (F)-32768.0 ) temp = (F)-32768.0;
- sp16[i] = (INT16) temp;
- }
- fwrite( sp16, sizeof(INT16), length, fp);
- }