📄 proto_func.h
字号:
#ifndef proto_func_h
#define proto_func_h
#include <stdio.h>
#include "../lib_amr/typedef.h"
#include "../include/mem.h"
#include "../include/amr_plus.h"
/* AMR-WB+ Function prototypes */
/* Decoder files */
/* tcx_ecu.c */
void adapt_low_freq_deemph_ecu(float xri[], int lg, Decoder_State_Plus * st);
void reconst_spect(float xri[], float old_xri[], int n_pack, int bfi[], int lg, int last_mode, float buf[]);
/* Encoder files */
/* lag window lag_wind.c */
void init_lag_wind(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 */
void lag_wind(float r[], /* in/out: autocorrelations */
int m); /* input : order of LP filter */
/* Common files */
/* Adaptive Low freq emphasis in alf_emph.c */
void adap_low_freq_emph(float xri[], int lg);
void adap_low_freq_deemph(float xri[], int lg);
/* bit packing and unpacking functions in bits.c */
int bin2int( /* output: recovered integer value */
int no_of_bits, /* input : number of bits associated with value */
short *bitstream); /* input : address where bits are read */
void int2bin(int value, /* input : value to be converted to binary */
int no_of_bits, /* input : number of bits associated with value */
short *bitstream); /* output: address where bits are written */
int over_fs( /* number of sample oversampled */
float sig_in[], /* input: signal to oversample */
float sig_out[], /* output: signal oversampled */
int lg, /* input: length of output */
int fac_down, /* input: fs*12/fac_down = 44k/48k */
float mem[], /* in/out: mem[2*L_FILT_OVER_FS] */
int *frac_mem /* in/out: interpol fraction memory */
);
int decim_fs( /* number of sample decimated */
float sig_in[], /* input: signal to decimate */
int lg, /* input: length of input */
float sig_out[], /* output: signal decimated */
int fac_up, /* input: 44k/48k *fac_up/12 = fs */
float mem[], /* in/out: mem[2*L_FILT_DECIM_FS] */
int *frac_mem /* in/out: interpol fraction memory */
);
/* Resampling routines in deci12k8.c */
int decim_split_12k8( /* number of sample decimated */
float sig_fs[], /* input: signal to decimate */
int lg_input, /* input: 2*L_FRAME44k if 44kHz */
float sig12k8_lf[], /* output: LF decimated signal */
float sig12k8_hf[], /* output: HF decimated signal */
int lg, /* input: length of LF and HF */
int fac_fs, /* input: >=32 (32 = base fs) */
int fac_up, /* (i) : */
int fac_down, /* (i) : */
int L_frame, /* (i) : */
float mem[], /* in/out: mem[L_MEM_DECIM_SPLIT] */
int *frac_mem); /* in/out: interpol fraction memory */
int join_over_12k8( /* number of sample oversampled */
float sig12k8_lf[], /* input: LF signal (fs=12k8) */
float sig12k8_hf[], /* input: HF signal (fs=12k8) */
int lg, /* input: length of LF and HF */
float sig_fs[], /* output: oversampled signal */
int lg_output, /* input: L_FRAME44k if 44kHz */
int fac_fs, /* input: >=32 (32 = base fs) */
float mem[], /* in/out: mem[L_MEM_JOIN_OVER] */
int *frac_mem); /* in/out: interpol fraction memory */
void decim_12k8(float sig_fs[], /* input: signal to decimate */
int lg, /* input: length of input */
float sig12k8[], /* output: decimated signal */
float mem[], /* in/out: memory (2*L_FILT_FS) */
int band); /* input: 0=0..6.4k, 1=6.4..10.8k */
void oversamp_12k8(float sig12k8[], /* input: signal to oversampling */
float sig_fs[], /* output: oversampled signal */
int lg, /* input: length of output */
float mem[], /* in/out: memory (2*L_FILT) */
int band, /* input: 0=0..6.4k, 1=6.4..10.8k */
int add);
void interpol(float *signal, float *signal_int, int L_frame_int,
const float *filter, int nb_coef, int fac_up, int fac_down, float gain);
/* FFT routines in fft3.c and fft9.c */
void fft3(float X[], float Y[], short n);
void ifft3(float X[], float Y[], short n);
void fft9(float X[], float Y[], short n);
void ifft9(float Y[], float X[], short n);
void fft_rel(float x[], short n, short m);
void ifft_rel(float x[], short n, short m);
/* TCX gain functions in gaintcx.c */
int q_gain_tcx( /* output: return quantization index */
float xnq[], /* (i) : quantized vector */
int lg, /* (i) : frame size */
float *gain); /* in/out: quantized gain */
float d_gain_tcx( /* output: gain */
int index, /* (i) : index */
float code[],/*(i) : quantized vector */
int lcode, /* (i) : frame size */
int bfi, /* (i) : 1=gain lost */
float *old_rms); /* (i/o): for frame recovery */
/* hf_func.c */
float match_gain_6k4(float *AqLF, float *AqHF);
void int_gain(float old_gain, float new_gain, float *gain, int nb_subfr);
void soft_exc_hf(float *exc_hf, float *mem);
void soft_exc_hf_new(float *exc_hf, float *mem, int l_frame);
void smooth_ener_hf(float *HF, float *threshold);
/* High-pass filter in hp50.c */
void hp50_12k8(Float32 signal[], Word32 lg, Float32 mem[], Word32 fscale);
/* int_lpc.c */
void int_lpc_np1(float isf_old[], /* input : LSFs from past frame */
float isf_new[], /* input : LSFs from present frame */
float a[], /* output: LP coefficients in both subframes */
int nb_subfr, /* input: number of subframe */
int m); /* input : order of LP filter */
/* pitch predictor in pit_fr4.c */
void pred_lt4(float exc[], /* in/out: excitation buffer */
int T0, /* input : integer pitch lag */
int frac, /* input : fraction of lag */
int L_subfr); /* input : subframe size */
/* q_gn_hf.c */
void q_gain_hf(float *gain, /* input : gain of 4 subfr */
float *gain_q, /* output: quantized gains */
int *indice); /* output: indices */
void d_gain_hf(int indice, /* input: quantization indices */
float *gain_q, /* output: quantized gains */
float *past_q, /* i/o : past quantized gain (1 word) */
int bfi); /* input : Bad frame indicator */
/* q_isf_hf.c */
void q_isf_hf(float *isf1, /* input : ISF in the frequency domain (0..6400) */
float *isf_q, /* output: quantized ISF */
float *past_q, /* i/o : past quantized isf (for MA prediction) */
int *indice, /* output: quantization indices (7 words) */
const float *mean_isf_hf,
const float *dico1_isf_hf);
void d_isf_hf(int *indice, /* input: quantization indices */
float *isf_q, /* output: quantized ISFs in the cosine domain */
float *past_q, /* i/o : past quantized isf (for MA prediction) */
int bfi, /* input : Bad frame indicator */
const float *mean_isf_hf,
const float *dico1_isf_hf);
/* qpisf_2s.c */
void qpisf_2s_46b(float *isf1, /* input : ISF in the frequency domain (0..6400) */
float *isf_q, /* output: quantized ISF */
float *past_isfq, /* i/0 : past ISF quantizer */
int *indice, /* output: quantization indices (7 words) */
int nb_surv); /* input : number of survivor (1, 2, 3 or 4) */
void dpisf_2s_46b(int *indice, /* input: quantization indices */
float *isf_q, /* output: quantized ISFs in the cosine domain */
float *past_isfq, /* i/0 : past ISF quantizer */
float *isfold, /* input : past quantized ISF */
float *isf_buf, /* input : isf buffer */
int bfi, /* input : Bad frame indicator */
int bfi_2nd_st, /* input : 2nd stage bfi mask (bin: 011111) */
int enc_dec);
/* RE8 lattice quantiser functions in re8_*.c */
void RE8_PPV(float x[], int y[]);
void RE8_cod(int *y, int *n, long *I, int *k); /* encoder only */
void RE8_dec(int nq, long I, int kv[], int y[]);
void RE8_vor(int y[], int *n, int k[], int c[], int *ka);
void re8_coord(int y[], int k[]);
void re8_k2y(int k[], int m, int y[]);
/* rnd_ph16.c */
void rnd_ph16(short *seed, float *xri, int lg);
/* util.c */
void set_zero(float *x, int n);
void mvr2r(float x[], /* input : input vector */
float y[], /* output: output vector */
int n); /* input : vector size */
void mvs2s(short x[], /* input : input vector */
short y[], /* output: output vector */
int n); /* input : vector size */
void mvi2i(int x[], /* input : input vector */
int y[], /* output: output vector */
int n); /* input : vector size */
void mvr2s(float x[], /* input : input vector */
short y[], /* output: output vector */
int n); /* input : vector size */
void mvs2r(short x[], /* input : input vector */
float y[], /* output: output vector */
int n); /* input : vector size */
void pessimize();
/* util_stereo_x.c */
#include "util_stereo_x.h"
float my_max(float x, float y);
float my_min(float x, float y);
void pmsvq(float *y, int **prm, float *x, float *old_x, const PMSVQ * filt_hi_pmsvq);
void pmsvq_inv(float *y, int **prm, float *old_y, const int bfi, const PMSVQ * filt_hi_pmsvq);
void pvq(float *x, float *old_x, float *cb, float *cbm, float a, int n, int cb_size, int *winner);
void syn_filt(float a[], /* input : LP filter coefficients */
int m, /* input : order of LP filter */
float x[], /* input : input signal */
float y[], /* output: output signal */
int l, /* input : size of filtering */
float mem[], /* in/out: initial filter states */
int update_m); /* input : update memory flag: 0 --> no memory update 1 --> update */
void residu(float *a, /* input : LP filter coefficients */
int m, /* input : order of LP filter */
float *x, /* input : input signal (usually speech) */
float *y, /* output: output signal (usually residual) */
int l); /* input : size of filtering */
int cholsolc(float r[HI_FILT_ORDER][HI_FILT_ORDER], float c[HI_FILT_ORDER], float h[HI_FILT_ORDER], int n);
float glev_s(float *b, /* output: filter coefficients */
float *r, /* input : vector of autocorrelations */
float *z, /* input: vector of cross correlations */
int m); /* input : order of LP filte */
void crosscorr(float *vec1, /* (i) : Input vector 1 */
float *vec2, /* (i) : Input vector 2 */
float *result, /* (o) : Output result vector */
int length, /* (i) : Length of input vectors */
int minlag, /* (i) : Minimum lag */
int maxlag); /* (i) : Maximum lag */
/* window.c */
/* File IO interface routines: from
* read_dat.c, wavefiletools.c and writ_dat.c */
int read_data( /* return: number of data successfully read */
FILE * fp, /* input : data file (16-bit words) */
float data[], /* output: speech data */
int size); /* input : number of samples */
void writ_data(float data[], /* input : data */
int size, /* input : number of samples */
FILE * fp); /* output: file pointer */
FILE *Wave_fopen(char *Filename, char *Mode, short *NumOfChannels,
long *SamplingRate, short *BitsPerSample, long *DataSize);
void Wave_fclose(FILE * FilePtr, short BitsPerSample);
/*---------------------------------------------------------------------*
* main routines *
*---------------------------------------------------------------------*/
void init_coder_amrwb_plus(Coder_State_Plus * st, int num_chan, int fscale, short use_case_mode, short full_reset);
int coder_amrwb_plus_stereo(float channel_right[], /* input: used on mono and stereo */
float channel_left[], /* input: used on stereo only */
int codec_mode, /* input: AMR-WB+ mode (see cnst.h) */
int L_frame, /* input: 80ms frame size */
short serial[], /* output: serial parameters */
Coder_State_Plus * st, /* i/o : coder memory state */
short useCaseB, int bwe_flag, /* 32kHz NBWE */
int StbrMode);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -