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

📄 mexcite.c

📁 语音CELP压缩解压源代码(C语音)
💻 C
字号:
#define mmax(A,B)      ((A)>(B)?(A):(B))#define mmin(A,B)       ((A)<(B)?(A):(B))/**************************************************************************** NAME*		mexcite** FUNCTION*		Modify the stochastic code book excitation gain** SYNOPSIS*		subroutine mexcite1(l)*		subroutine mexcite2(l)*		subroutine mexcite3(cgain)**   formal *                       data    I/O*       name            type    type    function*       ------------------------------------------------------------------*       l		int	i	length of error signal*	cgain		float	i/o	stochastic code book gain**   global *                       data    I/O*       name            type    type    function*       ------------------------------------------------------------------* 	/ccsub/		see description include file*       e0		float	i	error signal array*	***************************************************************************** DESCRIPTION**	Depending on the current system state, the stochastic code book*	excitation is reduced to a level that is low enough to produce*	positive perceptual effects, yet is high enough so as not to upset*	the dynamics of the system.  The main effect of the method is that*	during sustained voiced sounds, the excitation level is attenuated*	and in unvoiced and transition regions the level is amplified to a*	level slightly more than that of standard CELP.**	The relative adaptive code book excitation component is*	increased in voiced regions by decreasing the stochastic code book*	excitation component.  The amount of decrease in the stochastic*	component depends on the efficiency of the adaptive component.*	More reconstruction burden is placed on the adaptive component as*	its efficiency increases.  The efficiency is measured by the*	closeness (in the crosscorrelation sense) of the residual signals*       before and after pitch prediction.  When the efficiency is high*       (e.g., > 0.9), the stochastic component is amplified slightly*       (e.g., one quantizer level). **	The procedure for modifying the stochastic gain outside the*	search loop is:*	1)  Measure the efficiency of the adaptive component (ccor)*	2)  Search the stochastic code book for the optimum codeword*	3)  Modify the stochastic code book gain**	This method is compatible with Federal Standard 1016.******************************************************************************** CALLED BY**	csub csearch** CALLS***************************************************************************** REFERENCES**	Shoham, Yair, "Constrained-Stochastic Excitation Coding of Speech*	at 4.8 kbps," in Advances in Speech Coding, ed. B. Atal, V.*	Cuperman, and A. Gersho, submitted to Kluwer Academic Publishers.**	Shoham, Yair, "Constrained-Stochastic Excitation Coding of Speech," *	Abstracts of the IEEE Workshop on Speech Coding for*	Telecommunications, 1989, p. 65.****************************************************************************/#include <math.h>#include "ccsub.h"#ifdef SUNGRAPHextern int gain_vid, ccor_vid;#endifextern float e0[MAXLP];static float ccor;static float e1, e0save[60];mexcite1(l)int l;{  int i;  /* *e1 = Euclidean norm of the first error signal		*/  /* (note: the error signal array e0 is reused)		*/  e1 = 1e-6;  for (i = 0; i < l; i++)  {    e0save[i] = e0[i];    e1 += e0[i] * e0[i];  }}mexcite2(l)int l;{  int i;  /* *ccor = crosscorrelation of the residual signals before 	*/  /* *and after pitch prediction				*/  /* *(note: the error signal array e0 is reused		*/  ccor = 1e-6;  for (i = 0; i < l; i++)    ccor += e0[i] * e0save[i];  /* *normalize the crosscorrelation				*/  ccor = ccor / e1;}mexcite3(cgain)float *cgain;{  float scale;  /* *square root crosscorrelation scaling			*/  scale = sqrt(fabs(ccor));  /* *modify scale						*/  if (scale < 0.2)    scale = 0.2;  else if (scale > 0.9)     scale = scale * 1.4;  /* *modify the stochastic component				*/  *cgain = *cgain * scale;#ifdef SUNGRAPH  save_sg(gain_vid, &scale, 1, "save gain_vid");  save_sg(ccor_vid, &ccor, 1, "save ccor_vid");#endif}

⌨️ 快捷键说明

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