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

📄 prefilt.c

📁 this the source code of addio compression standard CELP. Also, it is optimizied for the execution sp
💻 C
字号:
#define TC 0.01

/**************************************************************************
*
* NAME
*		prefilt
*
* FUNCTION
*	
*		pitch prefilter
*
* SYNOPSIS
*		subroutine prefilt(s, l, dpp)
*
*   formal 
*                       data    I/O
*       name            type    type    function
*       -------------------------------------------------------------------
*	s		float	i/o	speech input/postfiltered output
*	l		int	i	subframe size
*	dpp		float	i/o	filter memory	
*
*
*   external
*                       data    I/O
*       name            type    type    function
*       -------------------------------------------------------------------
*	bb[]		float	i/o
*	prewt		real	i
*	idb		int	i
*
***************************************************************************
*
* DESCRIPTION
*	Note:  The pitch prefilter using a weighting factor 0.4 does not
*       alter the output speech quality (as determinted in blind listening 
*       tests) and therefore we do not use the prefilter.  However we are 
*       providing this code for research purposes.  Perhaps with other
*       enhancements or other conditions other than what we have tested,
*       the prefilter will enhance speech quality sufficiently to warrant
*       its extra computational burden.*
*
***************************************************************************
*
* REFERENCES
*	Gerson, Ira A. and Mark A. Jasuik, "Vector Sum Excited Linear
*	Prediction (VSELP) Speech Coding at 8 kbps", Proceedings of ICASSP
*	'90, p. 461.
*
***************************************************************************
*
* CALLED BY
*
*	celp
*
* CALLS
*
*	pitchvq
*
***************************************************************************/
#include "ccsub.h"
#include <math.h>
#include <stdio.h>

extern float bb[MAXNP+1], prewt;
extern int idb;

prefilt(s, l, dpp)
float s[], dpp[];
int l;
{
  float scale2, powerin, powerout;
  int i;

  /* estimate input power					*/
  powerin = 0.0;
  for (i = 0; i < l; i++)
    powerin += s[i] * s[i];
    /* powerin = (1.0 - TC) * powerin + TC * (s[i] * s[i]);	*/
  bb[2] = prewt * bb[2];
  pitchvq(s, l, dpp, idb, bb, "short");

  /* estimate output power 					*/

  powerout = 0.0;
  for (i = 0; i < l; i++)
    powerout += s[i] * s[i];
    /* powerout = (1.0 - TC) * powerout + TC * (s[i] * s[i]);	*/

  if (powerout > 0.0) 
  {
    scale2 = sqrt(powerin / powerout);
    for (i = 0; i < l; i++)
      s[i] = scale2 * s[i];
  }
}

⌨️ 快捷键说明

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