inverse_nl.c

来自「ears-0.32, linux下有用的语音信号处理工具包」· C语言 代码 · 共 64 行

C
64
字号
/************************************************************************* *                                                                       * *               ROUTINES IN THIS FILE:                                  * *                                                                       * *                      inverse_nl(): nonlinear processing; intended as  * *                              a kind of inverse for pre-rasta          * *                              nonlinearities                           * *                                                                       * ************************************************************************/#include <stdio.h>#include "others/mymath.h"#include "rasta.h"#include "functions.h"/* *	This routine computes a nonlinear function of *	an fvec array (floats). *	Currently this is  just the exp, which is the inverse *	of the log compression used in log rasta. * *	The first time that this program is called, we do *	the usual allocation. */struct fvec *inverse_nonlin( const struct param *pptr, struct fvec *in){	int i, lastfilt;	char *funcname;	static struct fvec *outptr = NULL; 			/* array for nonlinear auditory spectrum */	funcname = "inverse_nonlin";	if(outptr == (struct fvec *)NULL)	{		outptr = alloc_fvec( pptr->nfilts );	}	lastfilt = pptr->nfilts - pptr->first_good;	/* We only check on the incoming vector, as the output		is allocated here so we know how long it is. */	fvec_check(funcname, in, lastfilt - 1);	for(i=pptr->first_good; i<lastfilt; i++)	{		if(pptr->lrasta == TRUE || pptr->jrasta == TRUE)		{			outptr->values[i] 			= exp((in->values[i]));		}		else		{			outptr->values[i] 			= (in->values[i]);		}	}	return( outptr );}

⌨️ 快捷键说明

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