00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef AVCODEC_SIPR_H
00025 #define AVCODEC_SIPR_H
00026
00027 #include "avcodec.h"
00028 #include "dsputil.h"
00029 #include "acelp_pitch_delay.h"
00030
00031 #define LP_FILTER_ORDER_16k 16
00032 #define L_SUBFR_16k 80
00033 #define PITCH_MIN 30
00034 #define PITCH_MAX 281
00035
00036 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
00037
00038 #define LP_FILTER_ORDER 10
00039
00041 #define L_INTERPOL (LP_FILTER_ORDER + 1)
00042
00044 #define SUBFR_SIZE 48
00045
00046 #define SUBFRAME_COUNT_16k 2
00047
00048 typedef enum {
00049 MODE_16k,
00050 MODE_8k5,
00051 MODE_6k5,
00052 MODE_5k0,
00053 MODE_COUNT
00054 } SiprMode;
00055
00056 typedef struct SiprParameters {
00057 int ma_pred_switch;
00058 int vq_indexes[5];
00059 int pitch_delay[5];
00060 int gp_index[5];
00061 int16_t fc_indexes[5][10];
00062 int gc_index[5];
00063 } SiprParameters;
00064
00065 typedef struct SiprContext {
00066 AVCodecContext *avctx;
00067 AVFrame frame;
00068
00069 SiprMode mode;
00070
00071 float past_pitch_gain;
00072 float lsf_history[LP_FILTER_ORDER_16k];
00073
00074 float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
00075
00076 DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
00077
00078 float lsp_history[LP_FILTER_ORDER];
00079 float gain_mem;
00080 float energy_history[4];
00081 float highpass_filt_mem[2];
00082 float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00083
00084
00085 float tilt_mem;
00086 float postfilter_agc;
00087 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00088 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
00089
00090
00091 int pitch_lag_prev;
00092 float iir_mem[LP_FILTER_ORDER_16k+1];
00093 float filt_buf[2][LP_FILTER_ORDER_16k+1];
00094 float *filt_mem[2];
00095 float mem_preemph[LP_FILTER_ORDER_16k];
00096 float synth[LP_FILTER_ORDER_16k];
00097 double lsp_history_16k[16];
00098
00099 void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
00100 float *out_data);
00101 } SiprContext;
00102
00103 extern const float ff_pow_0_5[16];
00104
00105 void ff_sipr_init_16k(SiprContext *ctx);
00106
00107 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
00108 float *out_data);
00109
00110 #endif