Ejemplo n.º 1
0
/* This is a cos() approximation designed to be bit-exact on any platform. Bit exactness
   with this approximation is important because it has an impact on the bit allocation */
static opus_int16 bitexact_cos(opus_int16 x)
{
   opus_int32 tmp;
   opus_int16 x2;
   tmp = (4096+((opus_int32)(x)*(x)))>>13;
   celt_assert(tmp<=32767);
   x2 = tmp;
   x2 = (32767-x2) + FRAC_MUL16(x2, (-7651 + FRAC_MUL16(x2, (8277 + FRAC_MUL16(-626, x2)))));
   celt_assert(x2<=32766);
   return 1+x2;
}
Ejemplo n.º 2
0
static int bitexact_log2tan(int isin,int icos)
{
   int lc;
   int ls;
   lc=EC_ILOG(icos);
   ls=EC_ILOG(isin);
   icos<<=15-lc;
   isin<<=15-ls;
   return (ls-lc)*(1<<11)
         +FRAC_MUL16(isin, FRAC_MUL16(isin, -2597) + 7932)
         -FRAC_MUL16(icos, FRAC_MUL16(icos, -2597) + 7932);
}
Ejemplo n.º 3
0
/* This is a cos() approximation designed to be bit-exact on any platform. Bit exactness
   with this approximation is important because it has an impact on the bit allocation */
static int16_t bitexact_cos(int16_t x)
{
	int32_t tmp;
	int16_t x2;
	tmp = (4096 + ((int32_t) (x) * (x))) >> 13;
	assert(tmp <= 32767);
	x2 = tmp;
	x2 = (32767 - x2) + FRAC_MUL16(x2,
				       (-7651 +
					FRAC_MUL16(x2,
						   (8277 +
						    FRAC_MUL16(-626, x2)))));
	assert(x2 <= 32766);
	return 1 + x2;
}