Lines Matching refs:st
84 SpeexDecorrState *st = speex_alloc(sizeof(SpeexDecorrState)); in speex_decorrelate_new() local
85 st->rate = rate; in speex_decorrelate_new()
86 st->channels = channels; in speex_decorrelate_new()
87 st->frame_size = frame_size; in speex_decorrelate_new()
89 st->psy = vorbis_psy_init(rate, 2*frame_size); in speex_decorrelate_new()
90 spx_drft_init(&st->lookup, 2*frame_size); in speex_decorrelate_new()
91 st->wola_mem = speex_alloc(frame_size*sizeof(float)); in speex_decorrelate_new()
92 st->curve = speex_alloc(frame_size*sizeof(float)); in speex_decorrelate_new()
94 st->y = speex_alloc(frame_size*sizeof(float)); in speex_decorrelate_new()
96 st->buff = speex_alloc(channels*2*frame_size*sizeof(float)); in speex_decorrelate_new()
97 st->ringID = speex_alloc(channels*sizeof(int)); in speex_decorrelate_new()
98 st->order = speex_alloc(channels*sizeof(int)); in speex_decorrelate_new()
99 st->alpha = speex_alloc(channels*sizeof(float)); in speex_decorrelate_new()
100 st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float)); in speex_decorrelate_new()
103 st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float)); in speex_decorrelate_new()
105 st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) ); in speex_decorrelate_new()
106 st->seed = rand(); in speex_decorrelate_new()
111 st->ring[ch][i] = 0; in speex_decorrelate_new()
112 st->ringID[ch] = 0; in speex_decorrelate_new()
113 st->alpha[ch] = 0; in speex_decorrelate_new()
114 st->order[ch] = 10; in speex_decorrelate_new()
116 return st; in speex_decorrelate_new()
137 EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int st… in speex_decorrelate() argument
148 for (ch=0;ch<st->channels;ch++) in speex_decorrelate()
151 int N=2*st->frame_size; in speex_decorrelate()
162 buff = st->buff+ch*2*st->frame_size; in speex_decorrelate()
163 ring = st->ring[ch]; in speex_decorrelate()
164 ringID = st->ringID[ch]; in speex_decorrelate()
165 order = st->order[ch]; in speex_decorrelate()
166 alpha = st->alpha[ch]; in speex_decorrelate()
168 for (i=0;i<st->frame_size;i++) in speex_decorrelate()
169 buff[i] = buff[i+st->frame_size]; in speex_decorrelate()
170 for (i=0;i<st->frame_size;i++) in speex_decorrelate()
171 buff[i+st->frame_size] = in[i*st->channels+ch]; in speex_decorrelate()
173 x = buff+st->frame_size; in speex_decorrelate()
183 for (i=0;i<st->frame_size;i++) in speex_decorrelate()
185 …st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->fra… in speex_decorrelate()
186 + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i] in speex_decorrelate()
189 ring[ringID++]=st->y[i]; in speex_decorrelate()
190 st->y[i] *= st->vorbis_win[st->frame_size+i]; in speex_decorrelate()
194 order = order+(irand(&st->seed)%3)-1; in speex_decorrelate()
204 alpha = alpha + .4*uni_rand(&st->seed); in speex_decorrelate()
212 for (i=0;i<st->frame_size;i++) in speex_decorrelate()
214 …float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+ord… in speex_decorrelate()
215 + x[i-ALLPASS_ORDER]*st->vorbis_win[i] in speex_decorrelate()
219 tmp *= st->vorbis_win[i]; in speex_decorrelate()
222 st->y[i] += tmp; in speex_decorrelate()
228 for (i=0;i<2*st->frame_size;i++) in speex_decorrelate()
232 compute_curve(st->psy, buff, st->curve); in speex_decorrelate()
233 for (i=1;i<st->frame_size;i++) in speex_decorrelate()
238 x1 = uni_rand(&st->seed); in speex_decorrelate()
239 x2 = uni_rand(&st->seed); in speex_decorrelate()
241 gain = coef*sqrt(.1+st->curve[i]); in speex_decorrelate()
245 frame[0] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[0]); in speex_decorrelate()
246 frame[2*st->frame_size-1] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[st->frame_size-1]); in speex_decorrelate()
247 spx_drft_backward(&st->lookup,frame); in speex_decorrelate()
248 for (i=0;i<2*st->frame_size;i++) in speex_decorrelate()
249 frame[i] *= st->vorbis_win[i]; in speex_decorrelate()
252 for (i=0;i<st->frame_size;i++) in speex_decorrelate()
255 float tmp = st->y[i] + frame[i] + st->wola_mem[i]; in speex_decorrelate()
256 st->wola_mem[i] = frame[i+st->frame_size]; in speex_decorrelate()
258 float tmp = st->y[i]; in speex_decorrelate()
264 out[i*st->channels+ch] = tmp; in speex_decorrelate()
267 st->ringID[ch] = ringID; in speex_decorrelate()
268 st->order[ch] = order; in speex_decorrelate()
269 st->alpha[ch] = alpha; in speex_decorrelate()
274 EXPORT void speex_decorrelate_destroy(SpeexDecorrState *st) in speex_decorrelate_destroy() argument
277 vorbis_psy_destroy(st->psy); in speex_decorrelate_destroy()
278 speex_free(st->wola_mem); in speex_decorrelate_destroy()
279 speex_free(st->curve); in speex_decorrelate_destroy()
281 speex_free(st->buff); in speex_decorrelate_destroy()
282 speex_free(st->ring); in speex_decorrelate_destroy()
283 speex_free(st->ringID); in speex_decorrelate_destroy()
284 speex_free(st->alpha); in speex_decorrelate_destroy()
285 speex_free(st->vorbis_win); in speex_decorrelate_destroy()
286 speex_free(st->order); in speex_decorrelate_destroy()
287 speex_free(st->y); in speex_decorrelate_destroy()
288 speex_free(st); in speex_decorrelate_destroy()