FFmpeg
Functions | Variables
celp_math.c File Reference
#include <stdint.h>
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/intmath.h"
#include "mathops.h"
#include "celp_math.h"

Go to the source code of this file.

Functions

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...
 
float ff_dot_productf (const float *a, const float *b, int length)
 Return the dot product. More...
 
void ff_celp_math_init (CELPMContext *c)
 Initialize CELPMContext. More...
 

Variables

static const uint16_t tab_log2 [33]
 Table used to compute log2(x) More...
 

Function Documentation

◆ ff_log2_q15()

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 79 of file celp_math.c.

Referenced by ff_acelp_update_past_gain(), and main().

◆ ff_dot_product()

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 99 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().

◆ ff_dot_productf()

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 110 of file celp_math.c.

Referenced by ff_celp_math_init(), and main().

◆ ff_celp_math_init()

void ff_celp_math_init ( CELPMContext c)

Initialize CELPMContext.

Definition at line 121 of file celp_math.c.

Referenced by amrnb_decode_init(), and amrwb_decode_init().

Variable Documentation

◆ tab_log2

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 64 of file celp_math.c.

Referenced by ff_log2_q15().