⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptcode.c

📁 语音CELP压缩解压源代码(C语音)
💻 C
字号:
/**************************************************************************** ROUTINE*		pitchencode** FUNCTION**		encode and quantize pitch gain (bb(3)) for various*		quantizer types.** SYNOPSIS*		subroutine pitchencode(input, index)**   formal**                       data    I/O*       name            type    type    function*       -------------------------------------------------------------------*	input		int	i	pitch gain input (true value)*	index		float	o	encoded pitch gain index*	pitchencode	float	fun	encoded pitch gain****************************************************************************** DESCRIPTION**	This funtion uses output level data obtained by Max's minimum*	distortion quantization priciples and quantizes to the nearest*	level (L1 norm).  (Using level data only was found superior to*	using both of Max's level and boundry data.)****************************************************************************** CALLED BY**	psearch** CALLS**	***************************************************************************** REFERENCES**	Quantizing for Minimum Distorion*	J. Max*	IRE Trans. Inform. Theory, vol. IT-6, pp.7-12, Mar. 1960******************************************************************************	The data used in the table generation is from 3m3f.spd.***************************************************************************/#include <math.h>static float pitch2max5[32] ={  -0.993, -0.831, -0.693, -0.555, -0.414, -0.229,    0.0,  0.139,   0.255,  0.368,  0.457,  0.531,  0.601,  0.653,  0.702,  0.745,   0.780,  0.816,  0.850,  0.881,  0.915,  0.948,  0.983,  1.020,    1.062,  1.117,  1.193,  1.289,  1.394,  1.540,  1.765,  1.991};floatpitchencode(input, index)int *index;float input;{  int i;  float dist, low;    low = dist = fabs(input - *pitch2max5);  *index = 0;  for (i = 1; i < 32; i++)  {    dist = fabs(input - pitch2max5[i]);    if (dist < low)    {      low = dist;      *index = i;    }  }  return (pitch2max5[*index]);}/**************************************************************************** ROUTINE*		pitchdecode** FUNCTION**		decode pitch gain (bb(3)) from pitch index and bit*		index (bits)** SYNOPSIS*		subroutine pitchdecode(pindex, pitch)**   formal**                       data    I/O*       name            type    type    function*       -------------------------------------------------------------------*	pindex		int	i	pitch index value*	pitch		float	o	pitch gain decoded****************************************************************************** DESCRIPTION******************************************************************************* CALLED BY**	dcodpg** CALLS*******************************************************************************	The data used in the table generation is from 3m3f.spd.****************************************************************************** REFERENCES**	Quantizing for Minimum Distorion*	J. Max*	IRE Trans. Inform. Theory, vol. IT-6, pp.7-12, Mar. 1960******************************************************************************	The data used in the table generation is from 3m3f.spd.***************************************************************************/pitchdecode(pindex, pitch)int pindex;float *pitch;{  *pitch = pitch2max5[pindex];}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -