libavcodec/celp_math.c File Reference

#include <inttypes.h>
#include <limits.h>
#include <assert.h>
#include "avcodec.h"
#include "mathops.h"
#include "celp_math.h"

Go to the source code of this file.

Functions

int16_t ff_cos (uint16_t arg)
 fixed-point implementation of cosine in [0; PI) domain.
int ff_exp2 (uint16_t power)
 fixed-point implementation of exp2(x) in [0; 1] domain.
int ff_log2 (uint32_t value)
 Calculate log2(x).
int64_t ff_dot_product (const int16_t *a, const int16_t *b, int length)
 returns the dot product of 2 int16_t vectors.
float ff_dot_productf (const float *a, const float *b, int length)
 Return the dot product.

Variables

static const int16_t tab_cos [65]
 Cosine table: base_cos[i] = (1<<15) * cos(i*PI/64).
static const uint16_t exp2a []
static const uint16_t exp2b []
static const uint16_t tab_log2 [33]
 Table used to compute log2(x).


Function Documentation

int16_t ff_cos ( uint16_t  arg  ) 

fixed-point implementation of cosine in [0; PI) domain.

Parameters:
arg fixed-point cosine argument, 0 <= arg < 0x4000
Returns:
value of (1<<15) * cos(arg * PI / (1<<14)), -0x8000 <= result <= 0x7fff

Definition at line 138 of file celp_math.c.

Referenced by ff_acelp_lsf2lsp().

int64_t ff_dot_product ( const int16_t a,
const int16_t b,
int  length 
)

returns the dot product of 2 int16_t vectors.

Parameters:
a input data array
b input data array
length number of elements
Returns:
dot product = sum of elementwise products

Definition at line 200 of file celp_math.c.

Referenced by autocorr_max(), comp_interp_index(), comp_ppf_coeff(), formant_postfilter(), and gen_acb_excitation().

float ff_dot_productf ( const float *  a,
const float *  b,
int  length 
)

int ff_exp2 ( uint16_t  power  ) 

fixed-point implementation of exp2(x) in [0; 1] domain.

Parameters:
power argument to exp2, 0 <= power <= 0x7fff
Returns:
value of (1<<20) * exp2(power / (1<<15)) 0x8000c <= result <= 0xfffea

Definition at line 148 of file celp_math.c.

Referenced by ff_acelp_decode_gain_code().

int ff_log2 ( uint32_t  value  ) 

Calculate log2(x).

Parameters:
value function argument, 0 < value <= 7fff ffff
Returns:
value of (1<<15) * log2(value)

Definition at line 180 of file celp_math.c.

Referenced by ff_acelp_decode_gain_code(), and ff_acelp_update_past_gain().


Variable Documentation

const uint16_t exp2a[] [static]

Initial value:

{
     0,  1435,  2901,  4400,  5931,  7496,  9096, 10730,
 12400, 14106, 15850, 17632, 19454, 21315, 23216, 25160,
 27146, 29175, 31249, 33368, 35534, 37747, 40009, 42320,
 44682, 47095, 49562, 52082, 54657, 57289, 59979, 62727,
}

Definition at line 122 of file celp_math.c.

const uint16_t exp2b[] [static]

Initial value:

{
     3,   712,  1424,  2134,  2845,  3557,  4270,  4982,
  5696,  6409,  7124,  7839,  8554,  9270,  9986, 10704,
 11421, 12138, 12857, 13576, 14295, 15014, 15734, 16455,
 17176, 17898, 18620, 19343, 20066, 20790, 21514, 22238,
}

Definition at line 130 of file celp_math.c.

const int16_t tab_cos[65] [static]

Initial value:

{
  32767,  32738,  32617,  32421,  32145,  31793,  31364,  30860,
  30280,  29629,  28905,  28113,  27252,  26326,  25336,  24285,
  23176,  22011,  20793,  19525,  18210,  16851,  15451,  14014,
  12543,  11043,   9515,   7965,   6395,   4810,   3214,   1609,
      1,  -1607,  -3211,  -4808,  -6393,  -7962,  -9513, -11040,
 -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
 -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
 -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
}
Cosine table: base_cos[i] = (1<<15) * cos(i*PI/64).

Definition at line 110 of file celp_math.c.

const uint16_t tab_log2[33] [static]

Initial value:

{






      4,   1459,   2870,   4240,   5572,   6867,   8127,   9355,
  10552,  11719,  12858,  13971,  15057,  16120,  17158,  18175,
  19170,  20145,  21100,  22036,  22954,  23854,  24738,  25605,
  26457,  27294,  28116,  28924,  29719,  30500,  31269,  32025,  32769,

}
Table used to compute log2(x).

tab_log2[i] = (1<<15) * log2(1 + i/32), i=0..32

Definition at line 165 of file celp_math.c.


Generated on Fri Oct 26 02:47:55 2012 for FFmpeg by  doxygen 1.5.8