📄 ld8cp.h
字号:
void Poste(
Word16 t0, /* (i) : 1st subframe delay given by coder */
Word16 *signal_ptr, /* (i) : input signal (pointer to current subframe */
Word16 *coeff, /* (i) : LPC coefficients for current subframe */
Word16 *sig_out, /* (o) : postfiltered output */
Word16 *vo, /* (o) : voicing decision 0 = uv, > 0 delay */
Word16 gamma1, /* input: short term postfilt. den. weighting factor*/
Word16 gamma2, /* input: short term postfilt. num. weighting factor*/
Word16 gamma_harm, /* input: long term postfilter weighting factor*/
Word16 long_h_st, /* input: impulse response length*/
Word16 m_pst, /* input: LPC order */
Word16 Vad /* input : active/inactive flag indicator */
);
/*--------------------------------------------------------------------------*
* protypes of functions containing G729 source code + specific G729E code *
*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*
* gain VQ functions. *
*--------------------------------------------------------------------------*/
void Dec_gaine(
Word16 index, /* (i) :Index of quantization. */
Word16 code[], /* (i) Q13 :Innovative vector. */
Word16 L_subfr, /* (i) :Subframe length. */
Word16 bfi, /* (i) :Bad frame indicator */
Word16 *gain_pit, /* (o) Q14 :Pitch gain. */
Word16 *gain_cod, /* (o) Q1 :Code gain. */
Word16 rate, /* input : rate selector/frame =0 8kbps,= 1 11.8 kbps*/
Word16 gain_pit_mem,
Word16 gain_cod_mem,
Word16 *c_muting,
Word16 count_bfi,
Word16 stationnary
);
/*--------------------------------------------------------------------------*
* Bitstream functions *
*--------------------------------------------------------------------------*/
void bits2prm_ld8c(
Word16 bits[], /* I serial bits (nb_bits) */
Word16 prm[] /* O output: decoded parameters (11 parameters) */
);
void prm2bits_ld8c(
Word16 prm[], /* input : encoded parameters (PRM_SIZE parameters) */
Word16 bits[] /* output: serial bits (SERIAL_SIZE ) bits[0] = bfi
bits[1] = nbbits */
);
/*--------------------------------------------------------------------------*
* functions specific to G729E *
*--------------------------------------------------------------------------*/
/* backward LPC analysis and switch forward/backward */
void autocorr_hyb_window(
Word16 *x, /* Input speech signal */
Word32 *r_bwd, /* (out) Autocorrelations */
Word32 *rexp /* (in/out) */
);
void Lag_window_bwd(Word32 *r_bwd, Word16 *r_h_bwd, Word16 *r_l_bwd);
void Int_bwd(Word16 *a_bwd, Word16 *prev_filter, Word16 *C_int );
void set_lpc_mode(Word16 *signal_ptr, Word16 *a_fwd, Word16 *a_bwd,
Word16 *lp_mode, Word16 *lspnew, Word16 *lspold,
Word16 *bwd_dominant, Word16 prev_lp_mode, Word16 *prev_filter,
Word16 *C_int, Word16 *glob_stat, Word16 *stat_bwd, Word16 *val_stat_bwd);
void update_bwd( Word16 *lp_mode, Word16 *bwd_dominant, Word16 *C_int,
Word16 *glob_stat);
Word16 ener_dB(Word16 *synth, Word16 L);
void tst_bwd_dominant(Word16 *high_stat, Word16 mode);
void perc_vare (
Word16 *gamma1, /* Bandwidth expansion parameter */
Word16 *gamma2, /* Bandwidth expansion parameter */
Word16 high_stat /* high_stat indication (see file bwfw.c) */
);
Word16 Pitch_fr3cp( /* (o) : pitch period. */
Word16 exc[], /* (i) : excitation buffer */
Word16 xn[], /* (i) : target vector */
Word16 h[], /* (i) Q12 : impulse response of filters. */
Word16 L_subfr, /* (i) : length of subframe */
Word16 t0_min, /* (i) : minimum value in the searched range. */
Word16 t0_max, /* (i) : maximum value in the searched range. */
Word16 i_subfr, /* (i) : indicator for first subframe. */
Word16 *pit_frac, /* (o) : chosen fraction. */
Word16 rate /* (i) : frame rate */
);
Word16 Enc_lag3cp( /* (o) : Return index of encoding */
Word16 T0, /* (i) : Pitch delay */
Word16 T0_frac, /* (i) : Fractional pitch delay */
Word16 *T0_min, /* (i/o) : Minimum search delay */
Word16 *T0_max, /* (i/o) : Maximum search delay */
Word16 pit_min, /* (i) : Minimum pitch delay */
Word16 pit_max, /* (i) : Maximum pitch delay */
Word16 pit_flag, /* (i) : Flag for 1st subframe */
Word16 rate /* (i) : frame rate */
);
void Dec_lag3cp( /* (o) : return integer pitch lag */
Word16 index, /* (i) : received pitch index */
Word16 pit_min, /* (i) : minimum pitch lag */
Word16 pit_max, /* (i) : maximum pitch lag */
Word16 i_subfr, /* (i) : subframe flag */
Word16 *T0, /* (o) : integer part of pitch lag */
Word16 *T0_frac, /* (o) : fractional part of pitch lag */
Word16 rate /* (i) : frame rate */
);
/*--------------------------------------------------------------------------*
* G729E fixed (ACELP) codebook excitation. *
*--------------------------------------------------------------------------*/
void ACELP_12i40_44bits(
Word16 x[], /* (i) Q0 : target vector */
Word16 cn[], /* (i) Q0 : residual after long term prediction */
Word16 H[], /* (i) Q12: impulse response of weighted synthesis filter */
Word16 code[], /* (o) Q12: algebraic (fixed) codebook excitation */
Word16 y[], /* (o) Q11: filtered fixed codebook excitation */
Word16 indx[] /* (o) : index 5 words: 13,10,7,7,7 = 44 bits */
);
void ACELP_10i40_35bits(
Word16 x[], /* (i) Q0 : target vector */
Word16 cn[], /* (i) Q0 : residual after long term prediction */
Word16 H[], /* (i) Q12: impulse response of weighted synthesis filter */
Word16 code[], /* (o) Q12: algebraic (fixed) codebook excitation */
Word16 y[], /* (o) Q11: filtered fixed codebook excitation */
Word16 indx[] /* (o) : index 5 words: 7,7,7,7,7 = 35 bits */
);
void Dec_ACELP_12i40_44bits(
Word16 *index, /* (i) : 5 words index (positions & sign) */
Word16 cod[] /* (o) Q13 : algebraic (fixed) codebook excitation */
);
void Dec_ACELP_10i40_35bits(
Word16 *index, /* (i) : 5 words index (positions & sign) */
Word16 cod[] /* (o) Q13 : algebraic (fixed) codebook excitation */
);
Word16 ACELP_Codebook64( /*(o) : index of pulses positions */
Word16 x[], /* (i) : Target vector */
Word16 h[], /* (i) Q12 : Impulse response of filters */
Word16 T0, /* (i) : Pitch lag */
Word16 pitch_sharp,/* (i) Q14: Last quantized pitch gain */
Word16 code[], /* (o) Q13 : Innovative codebook */
Word16 y[], /* (o) Q12 : Filtered innovative codebook */
Word16 *sign /* (o) : Signs of 4 pulses */
);
void Decod_ACELP64(
Word16 sign, /* (i) : signs of 4 pulses. */
Word16 index, /* (i) : Positions of the 4 pulses. */
Word16 cod[] /* (o) Q13 : algebraic (fixed) codebook excitation */
);
void PhDisp(
Word16 x[], /* (i) : input signal */
Word16 y[], /* (o) : output signal */
Word16 cbGain, /* (i) Q1 : codebook gain */
Word16 ltpGain, /* (i) Q14 : pitch gain */
Word16 inno[] /* (i/o) : innovation vector */
);
void Update_PhDisp(
Word16 ltpGain, /* (i) Q14 : pitch gain */
Word16 cbGain /* (i) Q1 : codebook gain */
);
/* pitch tracking routine */
void track_pit(Word16 *T0, Word16 *T0_frac, Word16 *prev_pitch,
Word16 *stat_pitch, Word16 *pitch_sta, Word16 *frac_sta);
Word16 Qua_gain_6k(
Word16 code[], /* (i) Q13 : Innovative vector. */
Word16 g_coeff[], /* (i) : Correlations <xn y1> -2<y1 y1> */
/* <y2,y2>, -2<xn,y2>, 2<y1,y2> */
Word16 exp_coeff[],/* (i) : Q-Format g_coeff[] */
Word16 L_subfr, /* (i) : Subframe length. */
Word16 *gain_pit, /* (o) Q14 : Pitch gain. */
Word16 *gain_cod, /* (o) Q1 : Code gain. */
Word16 tameflag /* (i) : flag set to 1 if taming is needed */
);
void Dec_gain_6k(
Word16 index, /* (i) : Index of quantization. */
Word16 code[], /* (i) Q13 : Innovative vector. */
Word16 L_subfr, /* (i) : Subframe length. */
Word16 bfi, /* (i) : Bad frame indicator */
Word16 *gain_pit, /* (o) Q14 : Pitch gain. */
Word16 *gain_cod /* (o) Q1 : Code gain. */
);
Word16 Random_g729cp(Word16 *seed);
/*--------------------------------------------------------------------------*
* taming functions *
*--------------------------------------------------------------------------*/
void Init_exc_err(void);
Word16 test_err(Word16 t0, Word16 t0_frac);
void update_exc_err(Word16 gain_pit, Word16 t0);
void musdetect( Word16 rate, Word16 r_h, Word16 r_l, Word16 exp_R0, Word16 *rc,
Word16 *lags, Word16 *pgains, Word16 stat_flg,
Word16 frm_count, Word16 prev_vad, Word16 *Vad, Word16 Energy_db);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -