Lines Matching refs:mode

166 static void compute_allocation_table(CELTMode *mode)  in compute_allocation_table()  argument
172 mode->nbAllocVectors = BITALLOC_SIZE; in compute_allocation_table()
173 allocVectors = opus_alloc(sizeof(unsigned char)*(BITALLOC_SIZE*mode->nbEBands)); in compute_allocation_table()
178 if (mode->Fs == 400*(opus_int32)mode->shortMdctSize) in compute_allocation_table()
180 for (i=0;i<BITALLOC_SIZE*mode->nbEBands;i++) in compute_allocation_table()
182 mode->allocVectors = allocVectors; in compute_allocation_table()
189 for (j=0;j<mode->nbEBands;j++) in compute_allocation_table()
194 … if (400*(opus_int32)eband5ms[k] > mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize) in compute_allocation_table()
198 allocVectors[i*mode->nbEBands+j] = band_allocation[i*maxBands + maxBands-1]; in compute_allocation_table()
201 … a1 = mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize - 400*(opus_int32)eband5ms[k-1]; in compute_allocation_table()
202 … a0 = 400*(opus_int32)eband5ms[k] - mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize; in compute_allocation_table()
203 allocVectors[i*mode->nbEBands+j] = (a0*band_allocation[i*maxBands+k-1] in compute_allocation_table()
218 mode->allocVectors = allocVectors; in compute_allocation_table()
227 CELTMode *mode=NULL; in opus_custom_mode_create() local
306 mode = opus_alloc(sizeof(CELTMode)); in opus_custom_mode_create()
307 if (mode==NULL) in opus_custom_mode_create()
309 mode->Fs = Fs; in opus_custom_mode_create()
316 mode->preemph[0] = QCONST16(0.3500061035f, 15); in opus_custom_mode_create()
317 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
318 mode->preemph[2] = QCONST16(0.2719968125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
319 mode->preemph[3] = QCONST16(3.6765136719f, 13); in opus_custom_mode_create()
322 mode->preemph[0] = QCONST16(0.6000061035f, 15); in opus_custom_mode_create()
323 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
324 mode->preemph[2] = QCONST16(0.4424998650f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
325 mode->preemph[3] = QCONST16(2.2598876953f, 13); in opus_custom_mode_create()
328 mode->preemph[0] = QCONST16(0.7799987793f, 15); in opus_custom_mode_create()
329 mode->preemph[1] = -QCONST16(0.1000061035f, 15); in opus_custom_mode_create()
330 mode->preemph[2] = QCONST16(0.7499771125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
331 mode->preemph[3] = QCONST16(1.3333740234f, 13); in opus_custom_mode_create()
334 mode->preemph[0] = QCONST16(0.8500061035f, 15); in opus_custom_mode_create()
335 mode->preemph[1] = QCONST16(0.0f, 15); in opus_custom_mode_create()
336 mode->preemph[2] = QCONST16(1.f, SIG_SHIFT); in opus_custom_mode_create()
337 mode->preemph[3] = QCONST16(1.f, 13); in opus_custom_mode_create()
340 mode->maxLM = LM; in opus_custom_mode_create()
341 mode->nbShortMdcts = 1<<LM; in opus_custom_mode_create()
342 mode->shortMdctSize = frame_size/mode->nbShortMdcts; in opus_custom_mode_create()
343 res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize); in opus_custom_mode_create()
345 mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands); in opus_custom_mode_create()
346 if (mode->eBands==NULL) in opus_custom_mode_create()
351 if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM > in opus_custom_mode_create()
357 mode->effEBands = mode->nbEBands; in opus_custom_mode_create()
358 while (mode->eBands[mode->effEBands] > mode->shortMdctSize) in opus_custom_mode_create()
359 mode->effEBands--; in opus_custom_mode_create()
362 mode->overlap = ((mode->shortMdctSize>>2)<<2); in opus_custom_mode_create()
364 compute_allocation_table(mode); in opus_custom_mode_create()
365 if (mode->allocVectors==NULL) in opus_custom_mode_create()
368 window = (opus_val16*)opus_alloc(mode->overlap*sizeof(opus_val16)); in opus_custom_mode_create()
373 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
374 …window[i] = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overl… in opus_custom_mode_create()
376 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
377 …2(32767,floor(.5+32768.*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->… in opus_custom_mode_create()
379 mode->window = window; in opus_custom_mode_create()
381 logN = (opus_int16*)opus_alloc(mode->nbEBands*sizeof(opus_int16)); in opus_custom_mode_create()
385 for (i=0;i<mode->nbEBands;i++) in opus_custom_mode_create()
386 logN[i] = log2_frac(mode->eBands[i+1]-mode->eBands[i], BITRES); in opus_custom_mode_create()
387 mode->logN = logN; in opus_custom_mode_create()
389 compute_pulse_cache(mode, mode->maxLM); in opus_custom_mode_create()
391 if (clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts, in opus_custom_mode_create()
392 mode->maxLM) == 0) in opus_custom_mode_create()
398 return mode; in opus_custom_mode_create()
402 if (mode!=NULL) in opus_custom_mode_create()
403 opus_custom_mode_destroy(mode); in opus_custom_mode_create()
409 void opus_custom_mode_destroy(CELTMode *mode) in opus_custom_mode_destroy() argument
411 if (mode == NULL) in opus_custom_mode_destroy()
418 if (mode == static_mode_list[i]) in opus_custom_mode_destroy()
425 opus_free((opus_int16*)mode->eBands); in opus_custom_mode_destroy()
426 opus_free((opus_int16*)mode->allocVectors); in opus_custom_mode_destroy()
428 opus_free((opus_val16*)mode->window); in opus_custom_mode_destroy()
429 opus_free((opus_int16*)mode->logN); in opus_custom_mode_destroy()
431 opus_free((opus_int16*)mode->cache.index); in opus_custom_mode_destroy()
432 opus_free((unsigned char*)mode->cache.bits); in opus_custom_mode_destroy()
433 opus_free((unsigned char*)mode->cache.caps); in opus_custom_mode_destroy()
434 clt_mdct_clear(&mode->mdct); in opus_custom_mode_destroy()
436 opus_free((CELTMode *)mode); in opus_custom_mode_destroy()