comparison sipr.h @ 10891:ff7c1c90b6f5 libavcodec

SIPR16k decoder
author vitor
date Sat, 16 Jan 2010 03:54:55 +0000
parents de32bff741ea
children 34a65026fa06
comparison
equal deleted inserted replaced
10890:36587d8c1201 10891:ff7c1c90b6f5
26 26
27 #include "avcodec.h" 27 #include "avcodec.h"
28 #include "dsputil.h" 28 #include "dsputil.h"
29 #include "acelp_pitch_delay.h" 29 #include "acelp_pitch_delay.h"
30 30
31 #define LP_FILTER_ORDER_16k 16
32 #define L_SUBFR_16k 80
33 #define PITCH_MIN 30
34 #define PITCH_MAX 281
35
31 #define LSFQ_DIFF_MIN (0.0125 * M_PI) 36 #define LSFQ_DIFF_MIN (0.0125 * M_PI)
32 37
33 #define LP_FILTER_ORDER 10 38 #define LP_FILTER_ORDER 10
34 39
35 /** Number of past samples needed for excitation interpolation */ 40 /** Number of past samples needed for excitation interpolation */
36 #define L_INTERPOL (LP_FILTER_ORDER + 1) 41 #define L_INTERPOL (LP_FILTER_ORDER + 1)
37 42
38 /** Subframe size for all modes except 16k */ 43 /** Subframe size for all modes except 16k */
39 #define SUBFR_SIZE 48 44 #define SUBFR_SIZE 48
45
46 #define SUBFRAME_COUNT_16k 2
40 47
41 typedef enum { 48 typedef enum {
42 MODE_16k, 49 MODE_16k,
43 MODE_8k5, 50 MODE_8k5,
44 MODE_6k5, 51 MODE_6k5,
51 DSPContext dsp; 58 DSPContext dsp;
52 59
53 SiprMode mode; 60 SiprMode mode;
54 61
55 float past_pitch_gain; 62 float past_pitch_gain;
56 float lsf_history[LP_FILTER_ORDER]; 63 float lsf_history[LP_FILTER_ORDER_16k];
57 64
58 float excitation[L_INTERPOL + PITCH_DELAY_MAX + 5*SUBFR_SIZE]; 65 float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
59 66
60 DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]); 67 DECLARE_ALIGNED_16(float, synth_buf[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6]);
61 68
62 float lsp_history[LP_FILTER_ORDER]; 69 float lsp_history[LP_FILTER_ORDER];
63 float gain_mem; 70 float gain_mem;
68 /* 5k0 */ 75 /* 5k0 */
69 float tilt_mem; 76 float tilt_mem;
70 float postfilter_agc; 77 float postfilter_agc;
71 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER]; 78 float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
72 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5]; 79 float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
80
81 /* 16k */
82 int pitch_lag_prev;
83 float iir_mem[LP_FILTER_ORDER_16k+1];
84 float filt_buf[2][LP_FILTER_ORDER_16k+1];
85 float *filt_mem[2];
86 float mem_preemph[LP_FILTER_ORDER_16k];
87 float synth[LP_FILTER_ORDER_16k];
88 double lsp_history_16k[16];
73 } SiprContext; 89 } SiprContext;
74 90
75 typedef struct { 91 typedef struct {
92 int ma_pred_switch; ///< switched moving average predictor
76 int vq_indexes[5]; 93 int vq_indexes[5];
77 int pitch_delay[5]; ///< pitch delay 94 int pitch_delay[5]; ///< pitch delay
78 int gp_index[5]; ///< adaptive-codebook gain indexes 95 int gp_index[5]; ///< adaptive-codebook gain indexes
79 int16_t fc_indexes[5][10]; ///< fixed-codebook indexes 96 int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
80 int gc_index[5]; ///< fixed-codebook gain indexes 97 int gc_index[5]; ///< fixed-codebook gain indexes
81 } SiprParameters; 98 } SiprParameters;
82 99
100 extern const float ff_pow_0_5[16];
101
102 void ff_sipr_init_16k(SiprContext *ctx);
103
104 void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
105 float *out_data);
106
83 #endif /* AVCODEC_SIPR_H */ 107 #endif /* AVCODEC_SIPR_H */