diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/celt.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/celt.h | 100 |
1 files changed, 98 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/celt.h b/lib/rbcodec/codecs/libopus/celt/celt.h index 218cd883df..0911c72f72 100644 --- a/lib/rbcodec/codecs/libopus/celt/celt.h +++ b/lib/rbcodec/codecs/libopus/celt/celt.h | |||
@@ -50,7 +50,19 @@ extern "C" { | |||
50 | #define CELTDecoder OpusCustomDecoder | 50 | #define CELTDecoder OpusCustomDecoder |
51 | #define CELTMode OpusCustomMode | 51 | #define CELTMode OpusCustomMode |
52 | 52 | ||
53 | #define _celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (const CELTMode**)(ptr))) | 53 | typedef struct { |
54 | int valid; | ||
55 | opus_val16 tonality; | ||
56 | opus_val16 tonality_slope; | ||
57 | opus_val16 noisiness; | ||
58 | opus_val16 activity; | ||
59 | opus_val16 music_prob; | ||
60 | int bandwidth; | ||
61 | }AnalysisInfo; | ||
62 | |||
63 | #define __celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (const CELTMode**)(ptr))) | ||
64 | |||
65 | #define __celt_check_analysis_ptr(ptr) ((ptr) + ((ptr) - (const AnalysisInfo*)(ptr))) | ||
54 | 66 | ||
55 | /* Encoder/decoder Requests */ | 67 | /* Encoder/decoder Requests */ |
56 | 68 | ||
@@ -81,12 +93,27 @@ extern "C" { | |||
81 | 93 | ||
82 | #define CELT_GET_MODE_REQUEST 10015 | 94 | #define CELT_GET_MODE_REQUEST 10015 |
83 | /** Get the CELTMode used by an encoder or decoder */ | 95 | /** Get the CELTMode used by an encoder or decoder */ |
84 | #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x) | 96 | #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, __celt_check_mode_ptr_ptr(x) |
85 | 97 | ||
86 | #define CELT_SET_SIGNALLING_REQUEST 10016 | 98 | #define CELT_SET_SIGNALLING_REQUEST 10016 |
87 | #define CELT_SET_SIGNALLING(x) CELT_SET_SIGNALLING_REQUEST, __opus_check_int(x) | 99 | #define CELT_SET_SIGNALLING(x) CELT_SET_SIGNALLING_REQUEST, __opus_check_int(x) |
88 | 100 | ||
101 | #define CELT_SET_TONALITY_REQUEST 10018 | ||
102 | #define CELT_SET_TONALITY(x) CELT_SET_TONALITY_REQUEST, __opus_check_int(x) | ||
103 | #define CELT_SET_TONALITY_SLOPE_REQUEST 10020 | ||
104 | #define CELT_SET_TONALITY_SLOPE(x) CELT_SET_TONALITY_SLOPE_REQUEST, __opus_check_int(x) | ||
105 | |||
106 | #define CELT_SET_ANALYSIS_REQUEST 10022 | ||
107 | #define CELT_SET_ANALYSIS(x) CELT_SET_ANALYSIS_REQUEST, __celt_check_analysis_ptr(x) | ||
108 | |||
109 | #define OPUS_SET_LFE_REQUEST 10024 | ||
110 | #define OPUS_SET_LFE(x) OPUS_SET_LFE_REQUEST, __opus_check_int(x) | ||
111 | |||
112 | #define OPUS_SET_ENERGY_SAVE_REQUEST 10026 | ||
113 | #define OPUS_SET_ENERGY_SAVE(x) OPUS_SET_ENERGY_SAVE_REQUEST, __opus_check_val16_ptr(x) | ||
89 | 114 | ||
115 | #define OPUS_SET_ENERGY_MASK_REQUEST 10028 | ||
116 | #define OPUS_SET_ENERGY_MASK(x) OPUS_SET_ENERGY_MASK_REQUEST, __opus_check_val16_ptr(x) | ||
90 | 117 | ||
91 | /* Encoder stuff */ | 118 | /* Encoder stuff */ |
92 | 119 | ||
@@ -110,6 +137,75 @@ int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned cha | |||
110 | #define celt_encoder_ctl opus_custom_encoder_ctl | 137 | #define celt_encoder_ctl opus_custom_encoder_ctl |
111 | #define celt_decoder_ctl opus_custom_decoder_ctl | 138 | #define celt_decoder_ctl opus_custom_decoder_ctl |
112 | 139 | ||
140 | |||
141 | #ifdef CUSTOM_MODES | ||
142 | #define OPUS_CUSTOM_NOSTATIC | ||
143 | #else | ||
144 | #define OPUS_CUSTOM_NOSTATIC static inline | ||
145 | #endif | ||
146 | |||
147 | static const unsigned char trim_icdf[11] = {126, 124, 119, 109, 87, 41, 19, 9, 4, 2, 0}; | ||
148 | /* Probs: NONE: 21.875%, LIGHT: 6.25%, NORMAL: 65.625%, AGGRESSIVE: 6.25% */ | ||
149 | static const unsigned char spread_icdf[4] = {25, 23, 2, 0}; | ||
150 | |||
151 | static const unsigned char tapset_icdf[3]={2,1,0}; | ||
152 | |||
153 | #ifdef CUSTOM_MODES | ||
154 | static const unsigned char toOpusTable[20] = { | ||
155 | 0xE0, 0xE8, 0xF0, 0xF8, | ||
156 | 0xC0, 0xC8, 0xD0, 0xD8, | ||
157 | 0xA0, 0xA8, 0xB0, 0xB8, | ||
158 | 0x00, 0x00, 0x00, 0x00, | ||
159 | 0x80, 0x88, 0x90, 0x98, | ||
160 | }; | ||
161 | |||
162 | static const unsigned char fromOpusTable[16] = { | ||
163 | 0x80, 0x88, 0x90, 0x98, | ||
164 | 0x40, 0x48, 0x50, 0x58, | ||
165 | 0x20, 0x28, 0x30, 0x38, | ||
166 | 0x00, 0x08, 0x10, 0x18 | ||
167 | }; | ||
168 | |||
169 | static inline int toOpus(unsigned char c) | ||
170 | { | ||
171 | int ret=0; | ||
172 | if (c<0xA0) | ||
173 | ret = toOpusTable[c>>3]; | ||
174 | if (ret == 0) | ||
175 | return -1; | ||
176 | else | ||
177 | return ret|(c&0x7); | ||
178 | } | ||
179 | |||
180 | static inline int fromOpus(unsigned char c) | ||
181 | { | ||
182 | if (c<0x80) | ||
183 | return -1; | ||
184 | else | ||
185 | return fromOpusTable[(c>>3)-16] | (c&0x7); | ||
186 | } | ||
187 | #endif /* CUSTOM_MODES */ | ||
188 | |||
189 | #define COMBFILTER_MAXPERIOD 1024 | ||
190 | #define COMBFILTER_MINPERIOD 15 | ||
191 | |||
192 | extern const signed char tf_select_table[4][8]; | ||
193 | |||
194 | int resampling_factor(opus_int32 rate); | ||
195 | |||
196 | void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, | ||
197 | opus_val16 g0, opus_val16 g1, int tapset0, int tapset1, | ||
198 | const opus_val16 *window, int overlap); | ||
199 | |||
200 | void init_caps(const CELTMode *m,int *cap,int LM,int C); | ||
201 | |||
202 | #ifdef RESYNTH | ||
203 | void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, const opus_val16 *coef, celt_sig *mem, celt_sig * OPUS_RESTRICT scratch); | ||
204 | |||
205 | void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X, | ||
206 | celt_sig * OPUS_RESTRICT out_mem[], int C, int LM); | ||
207 | #endif | ||
208 | |||
113 | #ifdef __cplusplus | 209 | #ifdef __cplusplus |
114 | } | 210 | } |
115 | #endif | 211 | #endif |