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()
178 /* Check for standard mode */ in compute_allocation_table()
179 if (mode->Fs == 400*(opus_int32)mode->shortMdctSize) in compute_allocation_table()
181 for (i=0;i<BITALLOC_SIZE*mode->nbEBands;i++) in compute_allocation_table()
183 mode->allocVectors = allocVectors; in compute_allocation_table()
186 /* If not the standard mode, interpolate */ in compute_allocation_table()
190 for (j=0;j<mode->nbEBands;j++) in compute_allocation_table()
195 … if (400*(opus_int32)eband5ms[k] > mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize) in compute_allocation_table()
199 allocVectors[i*mode->nbEBands+j] = band_allocation[i*maxBands + maxBands-1]; in compute_allocation_table()
202 … a1 = mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize - 400*(opus_int32)eband5ms[k-1]; in compute_allocation_table()
203 … a0 = 400*(opus_int32)eband5ms[k] - mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize; in compute_allocation_table()
204 allocVectors[i*mode->nbEBands+j] = (a0*band_allocation[i*maxBands+k-1] in compute_allocation_table()
213 for (j=0;j<mode->nbEBands;j++) in compute_allocation_table()
214 printf ("%d ", allocVectors[i*mode->nbEBands+j]); in compute_allocation_table()
219 mode->allocVectors = allocVectors; in compute_allocation_table()
228 CELTMode *mode=NULL; in opus_custom_mode_create() local
308 mode = opus_alloc(sizeof(CELTMode)); in opus_custom_mode_create()
309 if (mode==NULL) in opus_custom_mode_create()
311 mode->Fs = Fs; in opus_custom_mode_create()
318 mode->preemph[0] = QCONST16(0.3500061035f, 15); in opus_custom_mode_create()
319 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
320 mode->preemph[2] = QCONST16(0.2719968125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
321 mode->preemph[3] = QCONST16(3.6765136719f, 13); in opus_custom_mode_create()
324 mode->preemph[0] = QCONST16(0.6000061035f, 15); in opus_custom_mode_create()
325 mode->preemph[1] = -QCONST16(0.1799926758f, 15); in opus_custom_mode_create()
326 mode->preemph[2] = QCONST16(0.4424998650f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
327 mode->preemph[3] = QCONST16(2.2598876953f, 13); in opus_custom_mode_create()
330 mode->preemph[0] = QCONST16(0.7799987793f, 15); in opus_custom_mode_create()
331 mode->preemph[1] = -QCONST16(0.1000061035f, 15); in opus_custom_mode_create()
332 mode->preemph[2] = QCONST16(0.7499771125f, SIG_SHIFT); /* exact 1/preemph[3] */ in opus_custom_mode_create()
333 mode->preemph[3] = QCONST16(1.3333740234f, 13); in opus_custom_mode_create()
336 mode->preemph[0] = QCONST16(0.8500061035f, 15); in opus_custom_mode_create()
337 mode->preemph[1] = QCONST16(0.0f, 15); in opus_custom_mode_create()
338 mode->preemph[2] = QCONST16(1.f, SIG_SHIFT); in opus_custom_mode_create()
339 mode->preemph[3] = QCONST16(1.f, 13); in opus_custom_mode_create()
342 mode->maxLM = LM; in opus_custom_mode_create()
343 mode->nbShortMdcts = 1<<LM; in opus_custom_mode_create()
344 mode->shortMdctSize = frame_size/mode->nbShortMdcts; in opus_custom_mode_create()
345 res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize); in opus_custom_mode_create()
347 mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands); in opus_custom_mode_create()
348 if (mode->eBands==NULL) in opus_custom_mode_create()
353 if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM > in opus_custom_mode_create()
359 mode->effEBands = mode->nbEBands; in opus_custom_mode_create()
360 while (mode->eBands[mode->effEBands] > mode->shortMdctSize) in opus_custom_mode_create()
361 mode->effEBands--; in opus_custom_mode_create()
364 mode->overlap = ((mode->shortMdctSize>>2)<<2); in opus_custom_mode_create()
366 compute_allocation_table(mode); in opus_custom_mode_create()
367 if (mode->allocVectors==NULL) in opus_custom_mode_create()
370 window = (opus_val16*)opus_alloc(mode->overlap*sizeof(opus_val16)); in opus_custom_mode_create()
375 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
376 …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()
378 for (i=0;i<mode->overlap;i++) in opus_custom_mode_create()
379 …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()
381 mode->window = window; in opus_custom_mode_create()
383 logN = (opus_int16*)opus_alloc(mode->nbEBands*sizeof(opus_int16)); in opus_custom_mode_create()
387 for (i=0;i<mode->nbEBands;i++) in opus_custom_mode_create()
388 logN[i] = log2_frac(mode->eBands[i+1]-mode->eBands[i], BITRES); in opus_custom_mode_create()
389 mode->logN = logN; in opus_custom_mode_create()
391 compute_pulse_cache(mode, mode->maxLM); in opus_custom_mode_create()
393 if (clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts, in opus_custom_mode_create()
394 mode->maxLM, arch) == 0) in opus_custom_mode_create()
400 return mode; in opus_custom_mode_create()
404 if (mode!=NULL) in opus_custom_mode_create()
405 opus_custom_mode_destroy(mode); in opus_custom_mode_create()
411 void opus_custom_mode_destroy(CELTMode *mode) in opus_custom_mode_destroy() argument
415 if (mode == NULL) in opus_custom_mode_destroy()
422 if (mode == static_mode_list[i]) in opus_custom_mode_destroy()
429 opus_free((opus_int16*)mode->eBands); in opus_custom_mode_destroy()
430 opus_free((unsigned char*)mode->allocVectors); in opus_custom_mode_destroy()
432 opus_free((opus_val16*)mode->window); in opus_custom_mode_destroy()
433 opus_free((opus_int16*)mode->logN); in opus_custom_mode_destroy()
435 opus_free((opus_int16*)mode->cache.index); in opus_custom_mode_destroy()
436 opus_free((unsigned char*)mode->cache.bits); in opus_custom_mode_destroy()
437 opus_free((unsigned char*)mode->cache.caps); in opus_custom_mode_destroy()
438 clt_mdct_clear(&mode->mdct, arch); in opus_custom_mode_destroy()
440 opus_free((CELTMode *)mode); in opus_custom_mode_destroy()