Go to the documentation of this file.
45 static void lsf2lsp(
const float *lsf,
double *lsp)
53 static void dequant(
float *
out,
const int *idx,
const float *
const cbs[])
57 for (
i = 0;
i < 4;
i++)
58 memcpy(
out + 3*
i, cbs[
i] + 3*idx[
i], 3*
sizeof(
float));
60 memcpy(
out + 12, cbs[4] + 4*idx[4], 4*
sizeof(
float));
64 const int* parm,
int ma_pred)
72 isp_new[
i] = (1 -
qu[ma_pred]) * isp_q[
i]
85 return 3 *
index - 690;
93 pit_min, pit_max - 19);
94 return 3 * pitch_delay_min +
index - 2;
135 for (
i = 0,
s = 0;
i < 30;
i++,
s += 1.0/30)
136 out_data[
i] = tmpbuf[
i] +
s * (
synth[
i] - tmpbuf[
i]);
143 const double *lsp_2nd,
const double *lsp_prev)
150 lsp_1st[
i] = (lsp_2nd[
i] + lsp_prev[
i]) * 0.5;
162 float mr_energy,
const float *quant_energy,
164 int subframe_size,
int ma_pred_order)
169 mr_energy = gain_corr_factor *
exp(
M_LN10 / 20. * mr_energy) /
174 #define DIVIDE_BY_3(x) ((x) * 10923 >> 15)
185 float pitch_fac, gain_code;
209 float gain_corr_factor;
211 int pitch_delay_frac;
218 ctx->pitch_lag_prev);
221 f.pitch_fac =
FFMIN(pitch_fac, 1.0);
223 ctx->pitch_lag_prev =
f.pitch_lag;
226 pitch_delay_frac = pitch_delay_3x + 2 - 3*pitch_delay_int;
234 memset(fixed_vector, 0,
sizeof(fixed_vector));
242 gain_code = gain_corr_factor *
248 ctx->energy_history[1] =
ctx->energy_history[0];
249 ctx->energy_history[0] = 20.0 *
log10f(gain_corr_factor);
252 fixed_vector, pitch_fac,
278 ctx->filt_mem[0] =
ctx->filt_buf[0];
279 ctx->filt_mem[1] =
ctx->filt_buf[1];
281 ctx->pitch_lag_prev = 180;
void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params, float *out_data)
#define LP_FILTER_ORDER
linear predictive coding filter order
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
static const float gain_cb_16k[32]
float lsf_history[LP_FILTER_ORDER_16k]
#define LSFQ_DIFF_MIN
minimum LSF distance (3.2.4) 0.0391 in Q13
static int dec_delay3_2nd(int index, int pit_min, int pit_max, int pitch_lag_prev)
#define LP_FILTER_ORDER_16k
int gc_index[5]
fixed-codebook gain indexes
static void postfilter(float *out_data, float *synth, float *iir_mem, float *filt_mem[2], float *mem_preemph)
static void dequant(float *out, const int *idx, const float *const cbs[])
Sparse representation for the algebraic codebook (fixed) vector.
static const float pred_16k[2]
static void acelp_lp_decodef(float *lp_1st, float *lp_2nd, const double *lsp_2nd, const double *lsp_prev)
Floating point version of ff_acelp_lp_decode().
float synth[LP_FILTER_ORDER_16k]
int ma_pred_switch
switched moving average predictor
#define L_INTERPOL
Number of past samples needed for excitation interpolation.
static int dec_delay3_1st(int index)
void ff_decode_10_pulses_35bits(const int16_t *fixed_index, AMRFixed *fixed_sparse, const uint8_t *gray_decode, int half_pulse_count, int bits)
Decode the algebraic codebook index to pulse positions and signs and construct the algebraic codebook...
av_cold void ff_sipr_init_16k(SiprContext *ctx)
int16_t fc_indexes[5][10]
fixed-codebook indexes
float mem_preemph[LP_FILTER_ORDER_16k]
const uint8_t ff_fc_4pulses_8bits_tracks_13[16]
int pitch_delay[5]
pitch delay
static const uint16_t ma_prediction_coeff[4]
MA prediction coefficients (3.9.1 of G.729, near Equation 69)
static const float mean_lsf_16k[16]
static void lsf_decode_fp_16k(float *lsf_history, float *isp_new, const int *parm, int ma_pred)
float excitation[L_INTERPOL+PITCH_MAX+2 *L_SUBFR_16k]
static float acelp_decode_gain_codef(float gain_corr_factor, const float *fc_v, float mr_energy, const float *quant_energy, const float *ma_prediction_coeff, int subframe_size, int ma_pred_order)
Floating point version of ff_acelp_decode_gain_code().
#define i(width, name, range_min, range_max)
static void iir_mem(const float *x, const float *den, float *y, int N, int ord, float *mem)
void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, float weight_coeff_a, float weight_coeff_b, int length)
float implementation of weighted sum of two vectors.
#define FFSWAP(type, a, b)
static const float *const lsf_codebooks_16k[]
static const float sinc_win[40]
Hamming windowed sinc function, like in AMR.
void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
Add fixed vector to an array from a sparse representation.
#define SUBFRAME_COUNT_16k
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors of floats.
static void lsf2lsp(const float *lsf, double *lsp)
Convert an lsf vector into an lsp vector.
int gp_index[5]
adaptive-codebook gain indexes
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
Reconstruct LPC coefficients from the line spectral pair frequencies.
void ff_acelp_interpolatef(float *out, const float *in, const float *filter_coeffs, int precision, int frac_pos, int filter_length, int length)
Floating point version of ff_acelp_interpolate()
static const float gain_pitch_cb_16k[16]
void ff_set_min_dist_lsf(float *lsf, double min_spacing, int size)
Adjust the quantized LSFs so they are increasing and not too close.