www.pudn.com > AVS_M_ver10.rar > isp_isf.c


/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2007 Audio Video Coding Standard, Part ¢ú
*
* This software module was developed by AVS Audio sub-group
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the users without any
* license fee or royalty on an "as is" basis. The AVS disclaims
* any and all warranties, whether express, implied, or statutory,
* including any implied warranties of merchantability or of fitness
* for a particular purpose. In no event shall the contributors or
* the AVS be liable for any incidental, punitive, or consequential
* damages of any kind whatsoever arising from the use of this program.
*
* This disclaimer of warranty extends to the user of this program
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The AVS does not represent or warrant that the program furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy is available from the AVS Web site at
* http://www.avs.org.cn
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
************************************************************************
*/

/*-----------------------------------------------------------------------*
* Functions : isp2isf and isf2isp *
* *
* isp2isf Transformation isp to isf *
* isf2isp Transformation isf to isp *
* *
* ISP are immitance spectral pair in cosine domain (-1 to 1). *
* ISF are immitance spectral pair in frequency domain (0 to 6400). *
*-----------------------------------------------------------------------*/
#include <math.h>
#include <float.h>
#include "../include/amr_plus.h"
#define SCALE1 (6400.0/PI)
#define SCALE2 (PI/6400.0)
#ifndef PI
#define PI 3.141592654
#endif
void isf2isp(
float isf[], /* input : isf[m] normalized (range: 0<=val<=6400) */
float isp[], /* output: isp[m] (range: -1<=val<1) */
int m /* input : LPC order */
)
{
int i;
/* convert ISFs to the cosine domain */
for(i=0; i<m-1; i++) {
isp[i] = (float)cos(isf[i] * SCALE2);
}
isp[m-1] = (float)cos(isf[m-1] * SCALE2 * 2.0);
return;
}