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
gainncod.f
Package: celp_3.2a.tar.gz [view]
Upload User: szhypcb168
Upload Date: 2007-01-06
Package Size: 2187k
Code Size: 2k
Category:
Voice Compress
Development Platform:
Unix_Linux
- c==========================================================================
- c
- c ROUTINE
- c gainencode
- c
- c FUNCTION
- c
- c encode and quantize code book gain
- c
- c SYNOPSIS
- c subroutine gainencode(input, bits, type, index)
- c
- c formal
- c
- c data I/O
- c name type type function
- c -------------------------------------------------------------------
- c input i i code book gain input (true value)
- c bits i i # bits for encode
- c type c i type of quantization
- c index r o encoded code book gain ZERO BASED index
- c gainencode r f encoded code book gain
- c
- c==========================================================================
- c
- c DESCRIPTION
- c
- c Fast code book gain quantizer to allow practical quantization
- c inside the code book search loop. A binary tree search quantization
- c is implemented below.
- c
- C==========================================================================
- C
- C INPUT FILES
- C cbgain.tbl code book gain coding
- C
- c**************************************************************************
- c
- real function gainencode(input, bits, type, index)
- implicit undefined(a-z)
- c
- real input
- integer bits, index
- character*10 type
- c
- c Hard coded for 5 bit quantization to achieve high speed
- c
- integer bit, bitm1
- parameter (bit = 5)
- parameter (bitm1 = bit-1)
- real gainlog5(2**bit), midpoints(2**bit-1)
- integer i, shift(bitm1)
- data shift/8, 4, 2, 1/
- c
- include './cbgain.tbl'
- convex #include "./cbgain.tbl"
- c
- ccc if (bits .ne. bit) stop ' gainencode: bad bits'
- c
- c *Binary tree search for closest gain
- c
- index = 2**bitm1
- do 69 i = 1, bitm1
- if (input .gt. midpoints(index)) then
- index = index + shift(i)
- else
- index = index - shift(i)
- end if
- 69 continue
- if (input .gt. midpoints(index)) index = index + 1
- c
- c *Return quantized gain and ZERO based index
- c
- gainencode = gainlog5(index)
- index = index - 1
- return
- end