📄 proto_func.h
字号:
float Aq[], /* input: coefficients 4xAz_q[M+1] */
float speech[], /* input: speech[-M..lg] */
float *mem_wsp, /* in/out: wsp memory */
float *mem_wsyn, /* in/out: wsyn memory */
float synth[], /* in/out: synth[-M..lg] */
float exc[], /* in/out: exc[-(PIT_MAX+L_INTERPOL)..lg+1] */
float wovlp[], /* in/out: wovlp[0..lg+128] */
int lg, /* input: frame length */
int codec_mode, /* input: AMR_WB+ mode (see cnst.h) */
float norm_corr, float norm_corr2, int T_op, /* input: open-loop LTP */
int T_op2, /* input: open-loop LTP */
int T_out[], /* output: integer pitch-lag */
float p_out[], /* output: pitch gain */
float c_out[], /* output: fixed codebook gain */
int fscale,
int *prm); /* output: acelp parameters */
void decoder_acelp(
int prm[], /* input: parameters */
float A[], /* input: coefficients NxAz[M+1] */
int lg, /* input: frame length */
int codec_mode, /* input: AMR-WB+ mode (see cnst.h)*/
int bfi, /* input: 1=bad frame */
float exc[], /* i/o: exc[-(PIT_MAX+L_INTERPOL)..lg] */
float synth[], /* i/o: synth[-M..lg] */
int T_out[], /* out: LTP lag for high band */
float p_out[], /* out: LTP gain for high band */
int *pT, /* out: pitch for all subframe */
float *pgainT, /* out: pitch gain for all subfr */
int pit_adj,
float stab_fac, /* input: stability of isf */
Decoder_State_Plus *st);/* i/o : coder memory state */
/*---------------------------------------------------------------------*
* TCX routines *
*---------------------------------------------------------------------*/
void coder_tcx(float A[], /* input: coefficients NxAz[M+1] */
float speech[], /* input: speech[-M..lg] */
float *mem_wsp, /* in/out: wsp memory */
float *mem_wsyn, /* in/out: wsyn memory */
float synth[], /* in/out: synth[-M..lg] */
float exc[], /* output: exc[0..lg] */
float wovlp[], /* i/o: wovlp[0..127] */
int ovlp_size, /* input: 0, 64 or 128 (0=acelp) */
int lg, /* input: frame length */
int nb_bits, /* input: number of bits allowed */
int prm[]); /* output: tcx parameters */
void decoder_tcx(int prm[], /* input: parameters */
int nbits_AVQ[], /* input: nbits in parameters of AVQ */
float A[], /* input: coefficients NxAz[M+1] */
int lg, /* input: frame length */
int bad_frame[], float exc[], /* output: exc[-lg..lg] */
float synth[], /* in/out: synth[-M..lg] */
Decoder_State_Plus * st); /* i/o : coder memory state */
/*---------------------------------------------------------------------*
* misc *
*---------------------------------------------------------------------*/
float segsnr( /* return: segmential signal-to-noise ratio in dB */
float x[], /* input : input sequence of length n samples */
float xe[], /* input : estimate of x */
short n, /* input : signal length */
short nseg /* input : segment length */
);
float get_gain( /* output: codebook gain (adaptive or fixed) */
float x[], /* input : target signal */
float y[], /* input : filtered codebook excitation */
int L_subfr /* input : subframe size */
);
/*----------------------------------------------*
* LPC routines. *
*----------------------------------------------*/
void cos_window(float *fh, int n1, int n2);
void q_isf_hf_new(float *isf1, /* input : ISF in the frequency domain (0..6400) */
float *isf_q, /* output: quantized ISF */
int *indice /* output: quantization indices (7 words) */
);
void d_isf_hf_new(int *indice, /* input: quantization indices */
float *isf_q, /* output: quantized ISFs in the cosine domain */
float *isfold, /* input : past quantized ISF */
int bfi /* input : Bad frame indicator */
);
void q_isf_hf_16k_new(float *isf1, /* input : ISF in the frequency domain (0..6400) */
float *isf_q, /* output: quantized ISF */
int *indice /* output: quantization indices (7 words) */
);
void d_isf_hf_16k_new(int *indice, /* input: quantization indices */
float *isf_q, /* output: quantized ISFs in the cosine domain */
float *isfold, /* input : past quantized ISF */
int bfi /* input : Bad frame indicator */
);
int q_gain_hf_new( /* output: indices */
float *gain, /* input : gain of 4 subfr */
float *gainold, /* input : past quantized gains */
float *gain_q /* output: quantized gains */
);
void d_gain_hf_new(int indice, /* input: quantization indices */
float *gain_q, /* output: quantized gains */
float *gainold, /* input : past quantized gains */
int bfi /* input : Bad frame indicator */
);
/*---------------------------------------------------------------------*
* TCX.H *
*---------------------------------------------------------------------*
* Prototypes of signal processing routines *
*---------------------------------------------------------------------*/
float AVQ_cod( /* output: comfort noise gain factor */
float *xri, /* input: vector to quantize */
int *xriq, /* output: quantized vector (normalized) */
int NB_BITS, /* input: number of bits allowed */
int Nsv); /* input: number of subvector (lg=Nsv*8) */
void AVQ_encmux(int n_pack, int *xriq, int *param, int *n_bits, int Nsv);
void AVQ_demuxdec(int n_pack, int *param, int *n_bits, float *xriq, int Nsv, int *bfi);
int q_gain2_plus( /* (o) : index of quantizer */
float code[], /* (i) : Innovative code vector */
int lcode, /* (i) : Subframe size */
float *gain_pit, /* (i/o): Pitch gain / Quantized pitch gain */
float *gain_code, /* (i/o): code gain / Quantized codebook gain */
float *coeff, /* (i) : correlations <y1,y1>, -2<xn,y1>, */
/* <y2,y2>, -2<xn,y2> and 2<y1,y2> */
float mean_ener, /* (i) : mean_ener defined in open-loop (2 bits) */
float *g0); /* (o) : 'correction factor' */
float d_gain2_plus( /* (o) : 'correction factor' */
int index, /* (i) : index of quantizer */
float code[], /* (i) : Innovative code vector */
int lcode, /* (i) : Subframe size */
float *gain_pit, /* (o) : Quantized pitch gain */
float *gain_code, /* (o) : Quantized codebook gain */
int bfi, /* (i) : Bad frame indicato */
float mean_ener, /* (i) : mean_ener defined in open-loop (2 bits) */
float *past_gpit, /* (i) : past gain of pitch */
float *past_gcode); /* (i/o): past gain of code */
void extrapol_mod(int *bad_frame, int last_mode, int *mod);
float match_gain_6k4_new(float *AqLF, float *AqHF, int lg);
void smooth_ener_hf_new(float *HF, float *threshold, int l_frame);
void find_wsp(float A[], float speech[], /* speech[-M..lg] */
float wsp[], /* wsp[0..lg] */
float *mem_wsp, /* memory */
int lg);
/*----------------------------------------------*
* LPC routines. *
*----------------------------------------------*/
/* new */
void init_lag_wind_hb(float bwe, /* input : bandwidth expansion */
float f_samp, /* input : sampling frequency */
float wnc, /* input : white noise correction factor */
int m /* input : order of LP filter */
);
/* new */
void lag_wind_hb(float r[], /* in/out: autocorrelations */
int m /* input : order of LP filter */
);
void isf2isp(float isf[], /* input : isf[m] normalized (range: 0<=val<=6400) */
float isp[], /* output: isp[m] (range: -1<=val<1) */
int m /* input : LPC order */
);
/* new */
void isp2isf_hb(float isp[], /* input : isf[m] normalized (range: 0<=val<=6400) */
float isf[], /* output: isp[m] (range: -1<=val<1) */
int m /* input : LPC order */
);
/* new */
void isp2isf_hb_16k(float isp[], /* input : isp[m] (range: -1<=val<1) */
float isf[], /* output: isf[m] normalized (range: 0<=val<=5600) */
int m /* input : LPC order */
);
/* new */
void int_isp(float isp_old[], /* input : isps from past frame */
float isp_new[], /* input : isps from present frame */
float a[], /* output: LP coefficients in both subframes */
float frac[], /* input : fraction for all subframe */
int nb_subfr, /* input: number of subframe */
int m /* input : order of LP filter */
);
/* new */
void isf2isp_hb(float isf[], /* input : isf[m] normalized (range: 0<=val<=5600) */
float isp[], /* output: isp[m] (range: -1<=val<1) */
int m /* input : LPC order */
);
/* new */
void isf2isp_hb_16k(float isf[], /* input : isf[m] normalized (range: 0<=val<=5600) */
float isp[], /* output: isp[m] (range: -1<=val<1) */
int m /* input : LPC order */
);
void init_q_gain2(float *mem /* output :static memory (4 words) */
);
int q_gain2( /* (o) : index of quantizer */
float code[], /* (i) : Innovative code vector */
int lcode, /* (i) : Subframe size */
int nbits, /* (i) : number of bits (6 or 7) */
float *gain_pit, /* (i/o): Pitch gain / Quantized pitch gain */
float *gain_code, /* (o) : Quantized codebook gain */
float *coeff, /* (i) : correlations <y1,y1>, -2<xn,y1>, */
/* <y2,y2>, -2<xn,y2> and 2<y1,y2> */
int gp_clip, /* (i) : gain pitch clipping flag (1 = clipping) */
float *mem /* (i/o):static memory (4 words) */
);
void init_d_gain2(float *mem /* output :static memory (6 words) */
);
void d_gain2(int indice, /* (i) : Quantization index */
int nbits, /* (i) : number of bits (6 or 7) */
float code[], /* (i) : Innovative code vector */
int lcode, /* (i) : Subframe size */
float *gain_pit, /* (o) : Quantized pitch gain */
float *gain_code, /* (o) : Quantized codeebook gain */
int bfi, /* (i) : Bad frame indicator */
int prev_bfi, /* (i) : Previous BF indicator */
int state, /* (i) : State of BFH */
short unusable_frame, /* (i) : UF indicator */
short vad_hist, /* (i) : number of non-speech frames */
int i_subfr, float *mem /* (i/o):static memory (6 words) */
);
void copy_coder_state(
Coder_State_Plus *wbP, /* AMR-WB+ state struct */
void *st, /* AMR-WB state struct */
short sw, /* sw=0 -> switch from WB to WB+, sw=1 -> switch from WB+ to WB */
short use_case_mode
);
void copy_decoder_state(
Decoder_State_Plus *wbP,
void *st,
short sw
);
void WriteHeader(EncoderConfig conf, short length, short offset, FILE * f_serial);
void WriteBitstreamPlus(EncoderConfig conf, short length, short offset, short * serial, FILE * f_serial);
void WriteBitstream(EncoderConfig conf, short length, short offset, unsigned char * serial, FILE * f_serial);
short ReadRawFile(short *tfi, int *bfi, DecoderConfig *conf, short *extension, short *mode, short *st_mode, short *fst, FILE *f_serial, void *serial);
int get_nb_bits(short extension, short mode, short st_mode);
short ReadHeader(short *tfi, int *bfi, short FileFormat, short *extension, short *mode, short *st_mode, short *fst, short offset, FILE *f_serial);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -