FFmpeg
Data Structures | Functions
celp_math.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  CELPMContext
 

Functions

void ff_celp_math_init (CELPMContext *c)
 Initialize CELPMContext. More...
 
void ff_celp_math_init_mips (CELPMContext *c)
 
int ff_exp2 (uint16_t power)
 fixed-point implementation of exp2(x) in [0; 1] domain. More...
 
int ff_log2_q15 (uint32_t value)
 Calculate log2(x). More...
 
int64_t ff_dot_product (const int16_t *a, const int16_t *b, int length)
 Calculate the dot product of 2 int16_t vectors. More...
 
static int bidir_sal (int value, int offset)
 Shift value left or right depending on sign of offset parameter. More...
 
float ff_dot_productf (const float *a, const float *b, int length)
 Return the dot product. More...
 

Function Documentation

void ff_celp_math_init ( CELPMContext c)

Initialize CELPMContext.

Definition at line 120 of file celp_math.c.

Referenced by amrnb_decode_init(), and amrwb_decode_init().

void ff_celp_math_init_mips ( CELPMContext c)

Definition at line 87 of file celp_math_mips.c.

Referenced by ff_celp_math_init().

int ff_exp2 ( uint16_t  power)

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

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

Definition at line 48 of file celp_math.c.

Referenced by ff_acelp_decode_gain_code().

int ff_log2_q15 ( uint32_t  value)

Calculate log2(x).

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

Definition at line 78 of file celp_math.c.

Referenced by ff_acelp_update_past_gain(), and main().

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

Calculate the dot product of 2 int16_t vectors.

Parameters
ainput data array
binput data array
lengthnumber of elements
Returns
dot product = sum of elementwise products

Definition at line 98 of file celp_math.c.

Referenced by acb_search(), comp_autocorr(), comp_harmonic_coeff(), estimate_pitch(), ff_g723_1_dot_product(), ff_g723_1_gen_acb_excitation(), and main().

static int bidir_sal ( int  value,
int  offset 
)
inlinestatic

Shift value left or right depending on sign of offset parameter.

Parameters
valuevalue to shift
offsetshift offset
Returns
value << offset, if offset>=0; value >> -offset - otherwise

Definition at line 81 of file celp_math.h.

Referenced by ff_acelp_decode_gain_code(), and ff_g729_adaptive_gain_control().

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

Return the dot product.

Parameters
ainput data array
binput data array
lengthnumber of elements
Returns
dot product = sum of elementwise products

Definition at line 109 of file celp_math.c.

Referenced by bidir_sal(), ff_celp_math_init(), and main().