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 #include "libavutil/mem.h"
00031
00032 #define LP_FILTER_ORDER_16k 16
00033 #define L_SUBFR_16k 80
00034 #define PITCH_MIN 30
00035 #define PITCH_MAX 281
00036
00037 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
00038
00039 #define LP_FILTER_ORDER 10
00040
00042 #define L_INTERPOL (LP_FILTER_ORDER + 1)
00043
00045 #define SUBFR_SIZE 48
00046
00047 #define SUBFRAME_COUNT_16k 2
00048
00049 typedef enum {
00050 MODE_16k,
00051 MODE_8k5,
00052 MODE_6k5,
00053 MODE_5k0,
00054 MODE_COUNT
00055 } SiprMode;
00056
00057 typedef struct SiprParameters {
00058 int ma_pred_switch;
00059 int vq_indexes[5];
00060 int pitch_delay[5];
00061 int gp_index[5];
00062 int16_t fc_indexes[5][10];
00063 int gc_index[5];
00064 } SiprParameters;
00065
00066 typedef struct SiprContext {
00067 AVCodecContext *avctx;
00068 AVFrame frame;
00069
00070 SiprMode mode;
00071
00072 float past_pitch_gain;
00073 float lsf_history[LP_FILTER_ORDER_16k];
00074
00075 float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
00076
00077 DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
00078
00079 float lsp_history[LP_FILTER_ORDER];
00080 float gain_mem;
00081 float energy_history[4];
00082 float highpass_filt_mem[2];
00083 float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00084
00085
00086 float tilt_mem;
00087 float postfilter_agc;
00088 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
00089 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
00090
00091
00092 int pitch_lag_prev;
00093 float iir_mem[LP_FILTER_ORDER_16k+1];
00094 float filt_buf[2][LP_FILTER_ORDER_16k+1];
00095 float *filt_mem[2];
00096 float mem_preemph[LP_FILTER_ORDER_16k];
00097 float synth[LP_FILTER_ORDER_16k];
00098 double lsp_history_16k[16];
00099
00100 void (*decode_frame)(struct SiprContext *ctx, SiprParameters *params,
00101 float *out_data);
00102 } SiprContext;
00103
00104 extern const float ff_pow_0_5[16];
00105
00106 void ff_sipr_init_16k(SiprContext *ctx);
00107
00108 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
00109 float *out_data);
00110
00111 #endif