45 static void lsf2lsp(
const float *lsf,
double *lsp)
50 lsp[i] =
cosf(lsf[i]);
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]
73 +
qu[ma_pred] * lsf_history[i]
77 memcpy(lsf_history, isp_q, LP_FILTER_ORDER_16k *
sizeof(
float));
85 return 3 * index - 690;
92 int pitch_delay_min = av_clip(pitch_lag_prev - 10,
93 pit_min, pit_max - 19);
94 return 3 * pitch_delay_min + index - 2;
110 memcpy(tmpbuf - LP_FILTER_ORDER_16k, mem_preemph,
111 LP_FILTER_ORDER_16k*
sizeof(*buf));
114 LP_FILTER_ORDER_16k);
116 memcpy(synth - LP_FILTER_ORDER_16k, mem_preemph,
117 LP_FILTER_ORDER_16k *
sizeof(*synth));
120 LP_FILTER_ORDER_16k);
122 memcpy(out_data + 30 - LP_FILTER_ORDER_16k,
123 synth + 30 - LP_FILTER_ORDER_16k,
124 LP_FILTER_ORDER_16k *
sizeof(*synth));
128 LP_FILTER_ORDER_16k);
131 memcpy(mem_preemph, out_data + 2*
L_SUBFR_16k - LP_FILTER_ORDER_16k,
132 LP_FILTER_ORDER_16k *
sizeof(*synth));
134 FFSWAP(
float *, filt_mem[0], filt_mem[1]);
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;
226 pitch_delay_frac = pitch_delay_3x + 2 - 3*pitch_delay_int;
229 &excitation[i_subfr] - pitch_delay_int + 1,
234 memset(fixed_vector, 0,
sizeof(fixed_vector));
242 gain_code = gain_corr_factor *
252 fixed_vector, pitch_fac,
253 gain_code, L_SUBFR_16k);
256 &excitation[i_subfr], L_SUBFR_16k,
void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params, float *out_data)
int gp_index[5]
adaptive-codebook gain indexes
int pitch_delay[5]
pitch delay
void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, const float *in, int buffer_length, int filter_length)
LP synthesis filter.
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...
static const uint16_t ma_prediction_coeff[4]
MA prediction coefficients (3.9.1 of G.729, near Equation 69)
static const float pred_16k[2]
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.
double lsp_history_16k[16]
float iir_mem[LP_FILTER_ORDER_16k+1]
#define SUBFRAME_COUNT_16k
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 LSFQ_DIFF_MIN
minimum LSF distance (3.2.4) 0.0391 in Q13
static const float gain_pitch_cb_16k[16]
float synth_buf[LP_FILTER_ORDER+5 *SUBFR_SIZE+6]
Macro definitions for various function/variable attributes.
static const float mean_lsf_16k[16]
float mem_preemph[LP_FILTER_ORDER_16k]
float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
Return the scalar product of two vectors.
float lsf_history[LP_FILTER_ORDER_16k]
static const float *const lsf_codebooks_16k[]
Sparse representation for the algebraic codebook (fixed) vector.
static void postfilter(float *out_data, float *synth, float *iir_mem, float *filt_mem[2], float *mem_preemph)
static int dec_delay3_2nd(int index, int pit_min, int pit_max, int pitch_lag_prev)
static void dequant(float *out, const int *idx, const float *const cbs[])
#define L_INTERPOL
Number of past samples needed for excitation interpolation.
av_cold void ff_sipr_init_16k(SiprContext *ctx)
#define LP_FILTER_ORDER
linear predictive coding filter order
static void lsf_decode_fp_16k(float *lsf_history, float *isp_new, const int *parm, int ma_pred)
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().
static int dec_delay3_1st(int index)
int16_t fc_indexes[5][10]
fixed-codebook indexes
float synth[LP_FILTER_ORDER_16k]
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().
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
Reconstruct LPC coefficients from the line spectral pair frequencies.
const uint8_t ff_fc_4pulses_8bits_tracks_13[16]
Track|Pulse| Positions 1 | 0 | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75 2 | 1 | 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76 3 | 2 | 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57, 62, 67, 72, 77
static const float gain_cb_16k[32]
common internal and external API header
int gc_index[5]
fixed-codebook gain indexes
float excitation[L_INTERPOL+PITCH_MAX+2 *L_SUBFR_16k]
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.
#define LP_FILTER_ORDER_16k
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 void lsf2lsp(const float *lsf, double *lsp)
Convert an lsf vector into an lsp vector.
static const float sinc_win[40]
Hamming windowed sinc function, like in AMR.
int ma_pred_switch
switched moving average predictor
#define FFSWAP(type, a, b)
float filt_buf[2][LP_FILTER_ORDER_16k+1]