FFmpeg
Functions | Variables
g723_1.c File Reference
#include <stdint.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/intmath.h"
#include "acelp_vectors.h"
#include "celp_math.h"
#include "g723_1.h"

Go to the source code of this file.

Functions

int ff_g723_1_scale_vector (int16_t *dst, const int16_t *vector, int length)
 Scale vector contents based on the largest of their absolutes. More...
 
int ff_g723_1_normalize_bits (int num, int width)
 Calculate the number of left-shifts required for normalizing the input. More...
 
int ff_g723_1_dot_product (const int16_t *a, const int16_t *b, int length)
 
void ff_g723_1_get_residual (int16_t *residual, int16_t *prev_excitation, int lag)
 Get delayed contribution from the previous excitation vector. More...
 
void ff_g723_1_gen_dirac_train (int16_t *buf, int pitch_lag)
 Generate a train of dirac functions with period as pitch lag. More...
 
void ff_g723_1_gen_acb_excitation (int16_t *vector, int16_t *prev_excitation, int pitch_lag, G723_1_Subframe *subfrm, enum Rate cur_rate)
 Generate adaptive codebook excitation. More...
 
static void lsp2lpc (int16_t *lpc)
 Convert LSP frequencies to LPC coefficients. More...
 
void ff_g723_1_lsp_interpolate (int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
 Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients. More...
 
void ff_g723_1_inverse_quant (int16_t *cur_lsp, int16_t *prev_lsp, uint8_t *lsp_index, int bad_frame)
 Perform inverse quantization of LSP frequencies. More...
 

Variables

const int16_t ff_g723_1_cos_tab [COS_TBL_SIZE+1]
 
const int16_t ff_g723_1_lsp_band0 [LSP_CB_SIZE][3]
 LSP VQ tables. More...
 
const int16_t ff_g723_1_lsp_band1 [LSP_CB_SIZE][3]
 
const int16_t ff_g723_1_lsp_band2 [LSP_CB_SIZE][4]
 
const int32_t ff_g723_1_combinatorial_table [PULSE_MAX][SUBFRAME_LEN/GRID_SIZE]
 Used for the coding/decoding of the pulses positions for the MP-MLQ codebook. More...
 
const int16_t ff_g723_1_fixed_cb_gain [GAIN_LEVELS]
 
const int16_t ff_g723_1_adaptive_cb_gain85 [85 *20]
 
const int16_t ff_g723_1_adaptive_cb_gain170 [170 *20]
 

Function Documentation

◆ ff_g723_1_scale_vector()

int ff_g723_1_scale_vector ( int16_t *  dst,
const int16_t *  vector,
int  length 
)

Scale vector contents based on the largest of their absolutes.

Definition at line 1104 of file g723_1.c.

Referenced by comp_autocorr(), comp_interp_index(), formant_postfilter(), and g723_1_encode_frame().

◆ ff_g723_1_normalize_bits()

int ff_g723_1_normalize_bits ( int  num,
int  width 
)

Calculate the number of left-shifts required for normalizing the input.

Parameters
numinput number
widthwidth of the input, 16 bits(0) / 32 bits(1)

Definition at line 1121 of file g723_1.c.

Referenced by acb_search(), comp_autocorr(), comp_harmonic_coeff(), comp_ppf_coeff(), estimate_pitch(), gain_scale(), get_fcb_param(), lpc2lsp(), and lsp_quantize().

◆ ff_g723_1_dot_product()

int ff_g723_1_dot_product ( const int16_t *  a,
const int16_t *  b,
int  length 
)

◆ ff_g723_1_get_residual()

void ff_g723_1_get_residual ( int16_t *  residual,
int16_t *  prev_excitation,
int  lag 
)

Get delayed contribution from the previous excitation vector.

Definition at line 1132 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().

◆ ff_g723_1_gen_dirac_train()

void ff_g723_1_gen_dirac_train ( int16_t *  buf,
int  pitch_lag 
)

Generate a train of dirac functions with period as pitch lag.

Definition at line 1146 of file g723_1.c.

Referenced by fcb_search(), gen_fcb_excitation(), and get_fcb_param().

◆ ff_g723_1_gen_acb_excitation()

void ff_g723_1_gen_acb_excitation ( int16_t *  vector,
int16_t *  prev_excitation,
int  pitch_lag,
G723_1_Subframe subfrm,
enum Rate  cur_rate 
)

Generate adaptive codebook excitation.

Definition at line 1158 of file g723_1.c.

Referenced by g723_1_decode_frame(), g723_1_encode_frame(), and generate_noise().

◆ lsp2lpc()

static void lsp2lpc ( int16_t *  lpc)
static

Convert LSP frequencies to LPC coefficients.

Parameters
lpcbuffer for LPC coefficients

Definition at line 1190 of file g723_1.c.

Referenced by ff_g723_1_lsp_interpolate().

◆ ff_g723_1_lsp_interpolate()

void ff_g723_1_lsp_interpolate ( int16_t *  lpc,
int16_t *  cur_lsp,
int16_t *  prev_lsp 
)

Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients.

Parameters
lpcbuffer for LPC coefficients
cur_lspthe current LSP vector
prev_lspthe previous LSP vector

Definition at line 1252 of file g723_1.c.

Referenced by g723_1_decode_frame(), and g723_1_encode_frame().

◆ ff_g723_1_inverse_quant()

void ff_g723_1_inverse_quant ( int16_t *  cur_lsp,
int16_t *  prev_lsp,
uint8_t *  lsp_index,
int  bad_frame 
)

Perform inverse quantization of LSP frequencies.

Parameters
cur_lspthe current LSP vector
prev_lspthe previous LSP vector
lsp_indexVQ indices
bad_framebad frame flag

Definition at line 1273 of file g723_1.c.

Referenced by g723_1_decode_frame(), and g723_1_encode_frame().

Variable Documentation

◆ ff_g723_1_cos_tab

const int16_t ff_g723_1_cos_tab[COS_TBL_SIZE+1]

Definition at line 33 of file g723_1.c.

Referenced by lpc2lsp(), and lsp2lpc().

◆ ff_g723_1_lsp_band0

const int16_t ff_g723_1_lsp_band0[LSP_CB_SIZE][3]

LSP VQ tables.

Definition at line 101 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_lsp_band1

const int16_t ff_g723_1_lsp_band1[LSP_CB_SIZE][3]

Definition at line 190 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_lsp_band2

const int16_t ff_g723_1_lsp_band2[LSP_CB_SIZE][4]

Definition at line 279 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_combinatorial_table

const int32_t ff_g723_1_combinatorial_table[PULSE_MAX][SUBFRAME_LEN/GRID_SIZE]

Used for the coding/decoding of the pulses positions for the MP-MLQ codebook.

Definition at line 410 of file g723_1.c.

Referenced by gen_fcb_excitation(), and pack_fcb_param().

◆ ff_g723_1_fixed_cb_gain

const int16_t ff_g723_1_fixed_cb_gain[GAIN_LEVELS]
Initial value:
= {
1, 2, 3, 4, 6, 9, 13, 18,
26, 38, 55, 80, 115, 166, 240, 348,
502, 726, 1050, 1517, 2193, 3170, 4582, 6623,
}

Definition at line 454 of file g723_1.c.

Referenced by g723_1_decode_frame(), gen_fcb_excitation(), and get_fcb_param().

◆ ff_g723_1_adaptive_cb_gain85

const int16_t ff_g723_1_adaptive_cb_gain85[85 *20]

Definition at line 460 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().

◆ ff_g723_1_adaptive_cb_gain170

const int16_t ff_g723_1_adaptive_cb_gain170[170 *20]

Definition at line 676 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().