📄 ivfilt.c
字号:
/*
$Log: ivfilt.c,v $
Revision 1.1 2006/06/26 03:02:53 joegenbaclor
I have decided to include the latest development realease of OPAL tagged Deimos Devel 1 (June 8 2006) as inegrated classes to opensipstack to avoid future version conflicts due to the fast pace in OPAL development. This move is also aimed to reduce the size of projects using OPAL componets such as the soon to be relased OpenSIPPhone.
Revision 2.2 2005/08/08 03:28:42 dereksmithies
Eradicate all "/ * within comments" messages from GCC compilations.
Revision 2.1 2003/03/14 09:53:27 robertj
Updated to openH323 v1.11.7
Revision 1.2 2002/02/15 03:57:55 yurik
Warnings removed during compilation, patch courtesy of Jehan Bing, jehan@bravobrava.com
Revision 1.1 2000/06/05 04:45:12 robertj
Added LPC-10 2400bps codec
* Revision 1.1 1996/08/19 22:31:53 jaf
* Initial revision
*
*/
#ifdef P_R_O_T_O_T_Y_P_E_S
extern int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real *ivrc);
#endif
/* -- translated by f2c (version 19951025).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* ********************************************************************* */
/* IVFILT Version 48
* $Log: ivfilt.c,v $
* Revision 1.1 2006/06/26 03:02:53 joegenbaclor
* I have decided to include the latest development realease of OPAL tagged Deimos Devel 1 (June 8 2006) as inegrated classes to opensipstack to avoid future version conflicts due to the fast pace in OPAL development. This move is also aimed to reduce the size of projects using OPAL componets such as the soon to be relased OpenSIPPhone.
*
* Revision 2.2 2005/08/08 03:28:42 dereksmithies
* Eradicate all "/ * within comments" messages from GCC compilations.
*
* Revision 2.1 2003/03/14 09:53:27 robertj
* Updated to openH323 v1.11.7
*
* Revision 1.2 2002/02/15 03:57:55 yurik
* Warnings removed during compilation, patch courtesy of Jehan Bing, jehan@bravobrava.com
*
* Revision 1.1 2000/06/05 04:45:12 robertj
* Added LPC-10 2400bps codec
*
* Revision 1.1 1996/08/19 22:31:53 jaf
* Initial revision
* */
/* Revision 1.3 1996/03/15 21:36:29 jaf */
/* Just added a few comments about which array indices of the arguments */
/* are used, and mentioning that this subroutine has no local state. */
/* Revision 1.2 1996/03/13 00:01:00 jaf */
/* Comments added explaining that none of the local variables of this */
/* subroutine need to be saved from one invocation to the next. */
/* Revision 1.1 1996/02/07 14:47:34 jaf */
/* Initial revision */
/* ********************************************************************* */
/* 2nd order inverse filter, speech is decimated 4:1 */
/* Input: */
/* LEN - Length of speech buffers */
/* NSAMP - Number of samples to filter */
/* LPBUF - Low pass filtered speech buffer */
/* Indices LEN-NSAMP-7 through LEN read. */
/* Output: */
/* IVBUF - Inverse filtered speech buffer */
/* Indices LEN-NSAMP+1 through LEN written. */
/* IVRC - Inverse filter reflection coefficients (for voicing) */
/* Indices 1 and 2 both written (also read, but only after writing).
*/
/* This subroutine has no local state. */
/* Subroutine */ int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *
nsamp, real *ivrc)
{
/* System generated locals */
integer i__1;
/* Local variables */
integer i__, j, k;
real r__[3], pc1, pc2;
/* Arguments */
/* Local variables that need not be saved */
/* Local state */
/* None */
/* Calculate Autocorrelations */
/* Parameter adjustments */
--ivbuf;
--lpbuf;
--ivrc;
/* Function Body */
for (i__ = 1; i__ <= 3; ++i__) {
r__[i__ - 1] = 0.f;
k = i__ - (1 << 2);
i__1 = *len;
for (j = (i__ << 2) + *len - *nsamp; j <= i__1; j += 2) {
r__[i__ - 1] += lpbuf[j] * lpbuf[j - k];
}
}
/* Calculate predictor coefficients */
pc1 = 0.f;
pc2 = 0.f;
ivrc[1] = 0.f;
ivrc[2] = 0.f;
if (r__[0] > 1e-10f) {
ivrc[1] = r__[1] / r__[0];
ivrc[2] = (r__[2] - ivrc[1] * r__[1]) / (r__[0] - ivrc[1] * r__[1]);
pc1 = ivrc[1] - ivrc[1] * ivrc[2];
pc2 = ivrc[2];
}
/* Inverse filter LPBUF into IVBUF */
i__1 = *len;
for (i__ = *len + 1 - *nsamp; i__ <= i__1; ++i__) {
ivbuf[i__] = lpbuf[i__] - pc1 * lpbuf[i__ - 4] - pc2 * lpbuf[i__ - 8];
}
return 0;
} /* ivfilt_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -