📄 acelp.h
字号:
Word16 x[], /* (i) : speech (values x[-m..-1] are needed */
Word16 y[], /* (o) : residual signal */
Word16 lg /* (i) : size of filtering */
);
void Syn_filt(
Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */
Word16 m, /* (i) : order of LP filter */
Word16 x[], /* (i) : input signal */
Word16 y[], /* (o) : output signal */
Word16 lg, /* (i) : size of filtering */
Word16 mem[], /* (i/o) : memory associated with this filtering. */
Word16 update /* (i) : 0=no update, 1=update of memory. */
);
void Syn_filt_32(
Word16 a[], /* (i) Q12 : a[m+1] prediction coefficients */
Word16 m, /* (i) : order of LP filter */
Word16 exc[], /* (i) Qnew: excitation (exc[i] >> Qnew) */
Word16 Qnew, /* (i) : exc scaling = 0(min) to 8(max) */
Word16 sig_hi[], /* (o) /16 : synthesis high */
Word16 sig_lo[], /* (o) /16 : synthesis low */
Word16 lg /* (i) : size of filtering */
);
/*-----------------------------------------------------------------*
* pitch prototypes *
*-----------------------------------------------------------------*/
Word16 Pitch_ol( /* output: open loop pitch lag */
Word16 signal[], /* input : signal used to compute the open loop pitch */
/* signal[-pit_max] to signal[-1] should be known */
Word16 pit_min, /* input : minimum pitch lag */
Word16 pit_max, /* input : maximum pitch lag */
Word16 L_frame /* input : length of frame to compute pitch */
);
Word16 Pitch_med_ol( /* output: open loop pitch lag */
Word16 wsp[], /* input : signal used to compute the open loop pitch */
/* wsp[-pit_max] to wsp[-1] should be known */
Word16 L_min, /* input : minimum pitch lag */
Word16 L_max, /* input : maximum pitch lag */
Word16 L_frame, /* input : length of frame to compute pitch */
Word16 L_0, /* input : old_ open-loop pitch */
Word16 * gain, /* output: normalize correlation of hp_wsp for the Lag */
Word16 * hp_wsp_mem, /* i:o : memory of the hypass filter for hp_wsp[] (lg=9) */
Word16 * old_hp_wsp, /* i:o : hypass wsp[] */
Word16 wght_flg /* input : is weighting function used */
);
Word16 Med_olag( /* output : median of 5 previous open-loop lags */
Word16 prev_ol_lag, /* input : previous open-loop lag */
Word16 old_ol_lag[5]
);
void Init_Hp_wsp(Word16 mem[]);
void scale_mem_Hp_wsp(Word16 mem[], Word16 exp);
void Hp_wsp(
Word16 wsp[], /* i : wsp[] signal */
Word16 hp_wsp[], /* o : hypass wsp[] */
Word16 lg, /* i : lenght of signal */
Word16 mem[] /* i/o : filter memory [9] */
);
Word16 Pitch_fr4( /* (o) : pitch period. */
Word16 exc[], /* (i) : excitation buffer */
Word16 xn[], /* (i) : target vector */
Word16 h[], /* (i) Q15 : impulse response of synth/wgt filters */
Word16 t0_min, /* (i) : minimum value in the searched range. */
Word16 t0_max, /* (i) : maximum value in the searched range. */
Word16 * pit_frac, /* (o) : chosen fraction (0, 1, 2 or 3). */
Word16 i_subfr, /* (i) : indicator for first subframe. */
Word16 t0_fr2, /* (i) : minimum value for resolution 1/2 */
Word16 t0_fr1, /* (i) : minimum value for resolution 1 */
Word16 L_subfr /* (i) : Length of subframe */
);
void Pred_lt4(
Word16 exc[], /* in/out: excitation buffer */
Word16 T0, /* input : integer pitch lag */
Word16 frac, /* input : fraction of lag */
Word16 L_subfr /* input : subframe size */
);
/*-----------------------------------------------------------------*
* gain prototypes *
*-----------------------------------------------------------------*/
Word16 G_pitch( /* (o) Q14 : Gain of pitch lag saturated to 1.2 */
Word16 xn[], /* (i) : Pitch target. */
Word16 y1[], /* (i) : filtered adaptive codebook. */
Word16 g_coeff[], /* : Correlations need for gain quantization. */
Word16 L_subfr /* : Length of subframe. */
);
void Init_Q_gain2(
Word16 * mem /* output :static memory (2 words) */
);
Word16 Q_gain2( /* Return index of quantization. */
Word16 xn[], /* (i) Q_xn:Target vector. */
Word16 y1[], /* (i) Q_xn:Adaptive codebook. */
Word16 Q_xn, /* (i) :xn and y1 format */
Word16 y2[], /* (i) Q9 :Filtered innovative vector. */
Word16 code[], /* (i) Q9 :Innovative vector. */
Word16 g_coeff[], /* (i) :Correlations <xn y1> <y1 y1> */
/* Compute in G_pitch(). */
Word16 L_subfr, /* (i) :Subframe lenght. */
Word16 nbits, /* (i) : number of bits (6 or 7) */
Word16 * gain_pit, /* (i/o)Q14:Pitch gain. */
Word32 * gain_cod, /* (o) Q16 :Code gain. */
Word16 gp_clip, /* (i) : Gp Clipping flag */
Word16 * mem /* (i/o) :static memory (2 words) */
);
void Init_D_gain2(
Word16 * mem /* output :static memory (4 words) */
);
void D_gain2(
Word16 index, /* (i) :index of quantization. */
Word16 nbits, /* (i) : number of bits (6 or 7) */
Word16 code[], /* (i) Q9 :Innovative vector. */
Word16 L_subfr, /* (i) :Subframe lenght. */
Word16 * gain_pit, /* (o) Q14 :Pitch gain. */
Word32 * gain_cod, /* (o) Q16 :Code gain. */
Word16 bfi, /* (i) :bad frame indicator */
Word16 prev_bfi, /* (i) : Previous BF indicator */
Word16 state, /* (i) : State of BFH */
Word16 unusable_frame, /* (i) : UF indicator */
Word16 vad_hist, /* (i) :number of non-speech frames */
Word16 * mem /* (i/o) :static memory (4 words) */
);
/*-----------------------------------------------------------------*
* acelp prototypes *
*-----------------------------------------------------------------*/
void cor_h_x(
Word16 h[], /* (i) Q12 : impulse response of weighted synthesis filter */
Word16 x[], /* (i) Q0 : target vector */
Word16 dn[] /* (o) <12bit : correlation between target and h[] */
);
void ACELP_2t64_fx(
Word16 dn[], /* (i) <12b : correlation between target x[] and H[] */
Word16 cn[], /* (i) <12b : residual after long term prediction */
Word16 H[], /* (i) Q12: impulse response of weighted synthesis filter */
Word16 code[], /* (o) Q9 : algebraic (fixed) codebook excitation */
Word16 y[], /* (o) Q9 : filtered fixed codebook excitation */
Word16 * index /* (o) : index (12): 5+1+5+1 = 11 bits. */
);
void DEC_ACELP_2t64_fx(
Word16 index, /* (i) : 12 bits index */
Word16 code[] /* (o) :Q9 algebraic (fixed) codebook excitation */
);
void ACELP_4t64_fx(
Word16 dn[], /* (i) <12b : correlation between target x[] and H[] */
Word16 cn[], /* (i) <12b : residual after long term prediction */
Word16 H[], /* (i) Q12: impulse response of weighted synthesis filter */
Word16 code[], /* (o) Q9 : algebraic (fixed) codebook excitation */
Word16 y[], /* (o) Q9 : filtered fixed codebook excitation */
Word16 nbbits, /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits */
Word16 ser_size, /* (i) : bit rate */
Word16 _index[] /* (o) : index (20): 5+5+5+5 = 20 bits. */
/* (o) : index (36): 9+9+9+9 = 36 bits. */
/* (o) : index (44): 13+9+13+9 = 44 bits. */
/* (o) : index (52): 13+13+13+13 = 52 bits. */
/* (o) : index (64): 2+2+2+2+14+14+14+14 = 64 bits. */
/* (o) : index (72): 10+2+10+2+10+14+10+14 = 72 bits. */
/* (o) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */
);
void DEC_ACELP_4t64_fx(
Word16 index[], /* (i) : index (20): 5+5+5+5 = 20 bits. */
/* (i) : index (36): 9+9+9+9 = 36 bits. */
/* (i) : index (44): 13+9+13+9 = 44 bits. */
/* (i) : index (52): 13+13+13+13 = 52 bits. */
/* (i) : index (64): 2+2+2+2+14+14+14+14 = 64 bits. */
/* (i) : index (72): 10+2+10+2+10+14+10+14 = 72 bits. */
/* (i) : index (88): 11+11+11+11+11+11+11+11 = 88 bits. */
Word16 nbbits, /* (i) : 20, 36, 44, 52, 64, 72 or 88 bits */
Word16 code[] /* (o) Q9: algebraic (fixed) codebook excitation */
);
void Pit_shrp(
Word16 * x, /* in/out: impulse response (or algebraic code) */
Word16 pit_lag, /* input : pitch lag */
Word16 sharp, /* input : pitch sharpening factor (Q15) */
Word16 L_subfr /* input : subframe size */
);
/*-----------------------------------------------------------------*
* others prototypes *
*-----------------------------------------------------------------*/
void Copy(
Word16 x[], /* (i) : input vector */
Word16 y[], /* (o) : output vector */
Word16 L /* (i) : vector length */
);
void Set_zero(
Word16 x[], /* (o) : vector to clear */
Word16 L /* (i) : length of vector */
);
void Updt_tar(
Word16 * x, /* (i) Q0 : old target (for pitch search) */
Word16 * x2, /* (o) Q0 : new target (for codebook search) */
Word16 * y, /* (i) Q0 : filtered adaptive codebook vector */
Word16 gain, /* (i) Q14 : adaptive codebook gain */
Word16 L /* (i) : subframe size */
);
Word16 voice_factor( /* (o) Q15 : factor (-1=unvoiced to 1=voiced) */
Word16 exc[], /* (i) Q_exc: pitch excitation */
Word16 Q_exc, /* (i) : exc format */
Word16 gain_pit, /* (i) Q14 : gain of pitch */
Word16 code[], /* (i) Q9 : Fixed codebook excitation */
Word16 gain_code, /* (i) Q0 : gain of code */
Word16 L_subfr /* (i) : subframe length */
);
void Scale_sig(
Word16 x[], /* (i/o) : signal to scale */
Word16 lg, /* (i) : size of x[] */
Word16 exp /* (i) : exponent: x = round(x << exp) */
);
void snr(Word16 x[], Word16 y[], Word16 l, Word16 Q_x);
Word16 Random(Word16 * seed);
void Init_gp_clip(
Word16 mem[] /* (o) : memory of gain of pitch clipping algorithm */
);
Word16 Gp_clip(
Word16 mem[] /* (i/o) : memory of gain of pitch clipping algorithm */
);
void Gp_clip_test_isf(
Word16 isf[], /* (i) : isf values (in frequency domain) */
Word16 mem[] /* (i/o) : memory of gain of pitch clipping algorithm */
);
void Gp_clip_test_gain_pit(
Word16 gain_pit, /* (i) : gain of quantized pitch */
Word16 mem[] /* (i/o) : memory of gain of pitch clipping algorithm */
);
void Init_Phase_dispersion(
Word16 disp_mem[] /* (i/o): static memory (size = 8) */
);
void Phase_dispersion(
Word16 gain_code, /* (i) Q0 : gain of code */
Word16 gain_pit, /* (i) Q14 : gain of pitch */
Word16 code[], /* (i/o) : code vector */
Word16 mode, /* (i) : level, 0=hi, 1=lo, 2=off */
Word16 disp_mem[] /* (i/o) : static memory (size = 8) */
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -