Lines Matching full:mode
167 static void compute_allocation_table(CELTMode *mode) in compute_allocation_table() argument
173 mode->nbAllocVectors = BITALLOC_SIZE; in compute_allocation_table()
174 allocVectors = opus_alloc(sizeof(unsigned char)*(BITALLOC_SIZE*mode->nbEBands)); in compute_allocation_table()
177 mode->allocVectors = NULL; in compute_allocation_table()
181 /* Check for standard mode */ in compute_allocation_table()
182 if (mode->Fs == 400*(opus_int32)mode->shortMdctSize) in compute_allocation_table()
184 for (i=0;i<BITALLOC_SIZE*mode->nbEBands;i++) in compute_allocation_table()
186 mode->allocVectors = allocVectors; in compute_allocation_table()
189 /* If not the standard mode, interpolate */ in compute_allocation_table()
193 for (j=0;j<mode->nbEBands;j++) in compute_allocation_table()
198 … if (400*(opus_int32)eband5ms[k] > mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize) in compute_allocation_table()
202 allocVectors[i*mode->nbEBands+j] = band_allocation[i*maxBands + maxBands-1]; in compute_allocation_table()
205 … a1 = mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize - 400*(opus_int32)eband5ms[k-1]; in compute_allocation_table()
206 … a0 = 400*(opus_int32)eband5ms[k] - mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize; in compute_allocation_table()
207 allocVectors[i*mode->nbEBands+j] = (a0*band_allocation[i*maxBands+k-1] in compute_allocation_table()
216 for (j=0;j<mode->nbEBands;j++) in compute_allocation_table()
217 printf ("%d ", allocVectors[i*mode->nbEBands+j]); in compute_allocation_table()
222 mode->allocVectors = allocVectors; in compute_allocation_table()
231 CELTMode *mode=NULL; in opus_custom_mode_create() local
311 mode = opus_alloc(sizeof(CELTMode)); in opus_custom_mode_create()
312 if (mode==NULL) in opus_custom_mode_create()
314 mode->Fs = Fs; in opus_custom_mode_create()
321 mode->preemph[0] = QCONST16(0.3500061035f, 15); in opus_custom_mode_create()
322 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
323 mode->preemph[2] = QCONST16(0.2719968125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
324 mode->preemph[3] = QCONST16(3.6765136719f, 13); in opus_custom_mode_create()
327 mode->preemph[0] = QCONST16(0.6000061035f, 15); in opus_custom_mode_create()
328 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
329 mode->preemph[2] = QCONST16(0.4424998650f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
330 mode->preemph[3] = QCONST16(2.2598876953f, 13); in opus_custom_mode_create()
333 mode->preemph[0] = QCONST16(0.7799987793f, 15); in opus_custom_mode_create()
334 mode->preemph[1] = -QCONST16(0.1000061035f, 15); in opus_custom_mode_create()
335 mode->preemph[2] = QCONST16(0.7499771125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
336 mode->preemph[3] = QCONST16(1.3333740234f, 13); in opus_custom_mode_create()
339 mode->preemph[0] = QCONST16(0.8500061035f, 15); in opus_custom_mode_create()
340 mode->preemph[1] = QCONST16(0.0f, 15); in opus_custom_mode_create()
341 mode->preemph[2] = QCONST16(1.f, SIG_SHIFT); in opus_custom_mode_create()
342 mode->preemph[3] = QCONST16(1.f, 13); in opus_custom_mode_create()
345 mode->maxLM = LM; in opus_custom_mode_create()
346 mode->nbShortMdcts = 1<<LM; in opus_custom_mode_create()
347 mode->shortMdctSize = frame_size/mode->nbShortMdcts; in opus_custom_mode_create()
348 res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize); in opus_custom_mode_create()
350 mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands); in opus_custom_mode_create()
351 if (mode->eBands==NULL) in opus_custom_mode_create()
356 if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM > in opus_custom_mode_create()
362 mode->effEBands = mode->nbEBands; in opus_custom_mode_create()
363 while (mode->eBands[mode->effEBands] > mode->shortMdctSize) in opus_custom_mode_create()
364 mode->effEBands--; in opus_custom_mode_create()
367 mode->overlap = ((mode->shortMdctSize>>2)<<2); in opus_custom_mode_create()
369 compute_allocation_table(mode); in opus_custom_mode_create()
370 if (mode->allocVectors==NULL) in opus_custom_mode_create()
373 window = (opus_val16*)opus_alloc(mode->overlap*sizeof(opus_val16)); in opus_custom_mode_create()
378 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
379 …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()
381 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
382 …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()
384 mode->window = window; in opus_custom_mode_create()
386 logN = (opus_int16*)opus_alloc(mode->nbEBands*sizeof(opus_int16)); in opus_custom_mode_create()
390 for (i=0;i<mode->nbEBands;i++) in opus_custom_mode_create()
391 logN[i] = log2_frac(mode->eBands[i+1]-mode->eBands[i], BITRES); in opus_custom_mode_create()
392 mode->logN = logN; in opus_custom_mode_create()
394 compute_pulse_cache(mode, mode->maxLM); in opus_custom_mode_create()
396 if (clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts, in opus_custom_mode_create()
397 mode->maxLM, arch) == 0) in opus_custom_mode_create()
403 return mode; in opus_custom_mode_create()
407 if (mode!=NULL) in opus_custom_mode_create()
408 opus_custom_mode_destroy(mode); in opus_custom_mode_create()
414 void opus_custom_mode_destroy(CELTMode *mode) in opus_custom_mode_destroy() argument
418 if (mode == NULL) in opus_custom_mode_destroy()
425 if (mode == static_mode_list[i]) in opus_custom_mode_destroy()
432 opus_free((opus_int16*)mode->eBands); in opus_custom_mode_destroy()
433 opus_free((unsigned char*)mode->allocVectors); in opus_custom_mode_destroy()
435 opus_free((opus_val16*)mode->window); in opus_custom_mode_destroy()
436 opus_free((opus_int16*)mode->logN); in opus_custom_mode_destroy()
438 opus_free((opus_int16*)mode->cache.index); in opus_custom_mode_destroy()
439 opus_free((unsigned char*)mode->cache.bits); in opus_custom_mode_destroy()
440 opus_free((unsigned char*)mode->cache.caps); in opus_custom_mode_destroy()
441 clt_mdct_clear(&mode->mdct, arch); in opus_custom_mode_destroy()
443 opus_free((CELTMode *)mode); in opus_custom_mode_destroy()