Coverage Report

Created: 2026-10-28 08:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opus/celt/modes.c
Line
Count
Source
1
/* Copyright (c) 2007-2008 CSIRO
2
   Copyright (c) 2007-2009 Xiph.Org Foundation
3
   Copyright (c) 2008 Gregory Maxwell
4
   Written by Jean-Marc Valin and Gregory Maxwell */
5
/*
6
   Redistribution and use in source and binary forms, with or without
7
   modification, are permitted provided that the following conditions
8
   are met:
9
10
   - Redistributions of source code must retain the above copyright
11
   notice, this list of conditions and the following disclaimer.
12
13
   - Redistributions in binary form must reproduce the above copyright
14
   notice, this list of conditions and the following disclaimer in the
15
   documentation and/or other materials provided with the distribution.
16
17
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21
   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
#ifdef HAVE_CONFIG_H
31
#include "config.h"
32
#endif
33
34
#include "celt.h"
35
#include "modes.h"
36
#include "rate.h"
37
#include "os_support.h"
38
#include "stack_alloc.h"
39
#include "quant_bands.h"
40
#include "cpu_support.h"
41
42
static const opus_int16 eband5ms[] = {
43
/*0  200 400 600 800  1k 1.2 1.4 1.6  2k 2.4 2.8 3.2  4k 4.8 5.6 6.8  8k 9.6 12k 15.6 */
44
  0,  1,  2,  3,  4,  5,  6,  7,  8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 78, 100
45
};
46
47
/* Alternate tuning (partially derived from Vorbis) */
48
#define BITALLOC_SIZE 11
49
/* Bit allocation table in units of 1/32 bit/sample (0.1875 dB SNR) */
50
static const unsigned char band_allocation[] = {
51
/*0  200 400 600 800  1k 1.2 1.4 1.6  2k 2.4 2.8 3.2  4k 4.8 5.6 6.8  8k 9.6 12k 15.6 */
52
  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
53
 90, 80, 75, 69, 63, 56, 49, 40, 34, 29, 20, 18, 10,  0,  0,  0,  0,  0,  0,  0,  0,
54
110,100, 90, 84, 78, 71, 65, 58, 51, 45, 39, 32, 26, 20, 12,  0,  0,  0,  0,  0,  0,
55
118,110,103, 93, 86, 80, 75, 70, 65, 59, 53, 47, 40, 31, 23, 15,  4,  0,  0,  0,  0,
56
126,119,112,104, 95, 89, 83, 78, 72, 66, 60, 54, 47, 39, 32, 25, 17, 12,  1,  0,  0,
57
134,127,120,114,103, 97, 91, 85, 78, 72, 66, 60, 54, 47, 41, 35, 29, 23, 16, 10,  1,
58
144,137,130,124,113,107,101, 95, 88, 82, 76, 70, 64, 57, 51, 45, 39, 33, 26, 15,  1,
59
152,145,138,132,123,117,111,105, 98, 92, 86, 80, 74, 67, 61, 55, 49, 43, 36, 20,  1,
60
162,155,148,142,133,127,121,115,108,102, 96, 90, 84, 77, 71, 65, 59, 53, 46, 30,  1,
61
172,165,158,152,143,137,131,125,118,112,106,100, 94, 87, 81, 75, 69, 63, 56, 45, 20,
62
200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,
63
};
64
65
#ifndef CUSTOM_MODES_ONLY
66
 #ifdef FIXED_POINT
67
  #include "static_modes_fixed.h"
68
 #else
69
  #include "static_modes_float.h"
70
 #endif
71
#endif /* CUSTOM_MODES_ONLY */
72
73
#ifndef M_PI
74
#define M_PI 3.1415926535897931
75
#endif
76
77
#ifdef CUSTOM_MODES
78
79
/* Defining 25 critical bands for the full 0-20 kHz audio bandwidth
80
   Taken from http://ccrma.stanford.edu/~jos/bbt/Bark_Frequency_Scale.html */
81
#define BARK_BANDS 25
82
static const opus_int16 bark_freq[BARK_BANDS+1] = {
83
      0,   100,   200,   300,   400,
84
    510,   630,   770,   920,  1080,
85
   1270,  1480,  1720,  2000,  2320,
86
   2700,  3150,  3700,  4400,  5300,
87
   6400,  7700,  9500, 12000, 15500,
88
  20000};
89
90
static opus_int16 *compute_ebands(opus_int32 Fs, int frame_size, int res, int *nbEBands)
91
{
92
   opus_int16 *eBands;
93
   int i, j, lin, low, high, nBark, offset=0;
94
95
   /* All modes that have 2.5 ms short blocks use the same definition */
96
   if (Fs == 400*(opus_int32)frame_size)
97
   {
98
      *nbEBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1;
99
      eBands = opus_alloc(sizeof(opus_int16)*(*nbEBands+1));
100
      for (i=0;i<*nbEBands+1;i++)
101
         eBands[i] = eband5ms[i];
102
      return eBands;
103
   }
104
   /* Find the number of critical bands supported by our sampling rate */
105
   for (nBark=1;nBark<BARK_BANDS;nBark++)
106
    if (bark_freq[nBark+1]*2 >= Fs)
107
       break;
108
109
   /* Find where the linear part ends (i.e. where the spacing is more than min_width */
110
   for (lin=0;lin<nBark;lin++)
111
      if (bark_freq[lin+1]-bark_freq[lin] >= res)
112
         break;
113
114
   low = (bark_freq[lin]+res/2)/res;
115
   high = nBark-lin;
116
   *nbEBands = low+high;
117
   eBands = opus_alloc(sizeof(opus_int16)*(*nbEBands+2));
118
119
   if (eBands==NULL)
120
      return NULL;
121
122
   /* Linear spacing (min_width) */
123
   for (i=0;i<low;i++)
124
      eBands[i] = i;
125
   if (low>0)
126
      offset = eBands[low-1]*res - bark_freq[lin-1];
127
   /* Spacing follows critical bands */
128
   for (i=0;i<high;i++)
129
   {
130
      int target = bark_freq[lin+i];
131
      /* Round to an even value */
132
      eBands[i+low] = (target+offset/2+res)/(2*res)*2;
133
      offset = eBands[i+low]*res - target;
134
   }
135
   /* Enforce the minimum spacing at the boundary */
136
   for (i=0;i<*nbEBands;i++)
137
      if (eBands[i] < i)
138
         eBands[i] = i;
139
   /* Round to an even value */
140
   eBands[*nbEBands] = (bark_freq[nBark]+res)/(2*res)*2;
141
   if (eBands[*nbEBands] > frame_size)
142
      eBands[*nbEBands] = frame_size;
143
   for (i=1;i<*nbEBands-1;i++)
144
   {
145
      if (eBands[i+1]-eBands[i] < eBands[i]-eBands[i-1])
146
      {
147
         eBands[i] -= (2*eBands[i]-eBands[i-1]-eBands[i+1])/2;
148
      }
149
   }
150
   /* Remove any empty bands. */
151
   for (i=j=0;i<*nbEBands;i++)
152
      if(eBands[i+1]>eBands[j])
153
         eBands[++j]=eBands[i+1];
154
   *nbEBands=j;
155
156
   for (i=1;i<*nbEBands;i++)
157
   {
158
      /* Every band must be smaller than the last band. */
159
      celt_assert(eBands[i]-eBands[i-1]<=eBands[*nbEBands]-eBands[*nbEBands-1]);
160
      /* Each band must be no larger than twice the size of the previous one. */
161
      celt_assert(eBands[i+1]-eBands[i]<=2*(eBands[i]-eBands[i-1]));
162
   }
163
164
   return eBands;
165
}
166
167
static void compute_allocation_table(CELTMode *mode)
168
{
169
   int i, j;
170
   unsigned char *allocVectors;
171
   int maxBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1;
172
173
   mode->nbAllocVectors = BITALLOC_SIZE;
174
   allocVectors = opus_alloc(sizeof(unsigned char)*(BITALLOC_SIZE*mode->nbEBands));
175
   if (allocVectors==NULL)
176
   {
177
      mode->allocVectors = NULL;
178
      return;
179
   }
180
181
   /* Check for standard mode */
182
   if (mode->Fs == 400*(opus_int32)mode->shortMdctSize)
183
   {
184
      for (i=0;i<BITALLOC_SIZE*mode->nbEBands;i++)
185
         allocVectors[i] = band_allocation[i];
186
      mode->allocVectors = allocVectors;
187
      return;
188
   }
189
   /* If not the standard mode, interpolate */
190
   /* Compute per-codec-band allocation from per-critical-band matrix */
191
   for (i=0;i<BITALLOC_SIZE;i++)
192
   {
193
      for (j=0;j<mode->nbEBands;j++)
194
      {
195
         int k;
196
         for (k=0;k<maxBands;k++)
197
         {
198
            if (400*(opus_int32)eband5ms[k] > mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize)
199
               break;
200
         }
201
         if (k>maxBands-1)
202
            allocVectors[i*mode->nbEBands+j] = band_allocation[i*maxBands + maxBands-1];
203
         else {
204
            opus_int32 a0, a1;
205
            a1 = mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize - 400*(opus_int32)eband5ms[k-1];
206
            a0 = 400*(opus_int32)eband5ms[k] - mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize;
207
            allocVectors[i*mode->nbEBands+j] = (a0*band_allocation[i*maxBands+k-1]
208
                                             + a1*band_allocation[i*maxBands+k])/(a0+a1);
209
         }
210
      }
211
   }
212
213
   /*printf ("\n");
214
   for (i=0;i<BITALLOC_SIZE;i++)
215
   {
216
      for (j=0;j<mode->nbEBands;j++)
217
         printf ("%d ", allocVectors[i*mode->nbEBands+j]);
218
      printf ("\n");
219
   }
220
   exit(0);*/
221
222
   mode->allocVectors = allocVectors;
223
}
224
225
#endif /* CUSTOM_MODES */
226
227
CELTMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error)
228
1.21M
{
229
1.21M
   int i;
230
#ifdef CUSTOM_MODES
231
   CELTMode *mode=NULL;
232
   int res;
233
   celt_coef *window;
234
   opus_int16 *logN;
235
   int LM;
236
   int arch = opus_select_arch();
237
   ALLOC_STACK;
238
#if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA)
239
   if (global_stack==NULL)
240
      goto failure;
241
#endif
242
#endif
243
244
1.21M
#ifndef CUSTOM_MODES_ONLY
245
1.21M
   for (i=0;i<TOTAL_MODES;i++)
246
1.21M
   {
247
1.21M
      int j;
248
1.21M
      for (j=0;j<4;j++)
249
1.21M
      {
250
1.21M
         if (Fs == static_mode_list[i]->Fs &&
251
1.21M
               (frame_size<<j) == static_mode_list[i]->shortMdctSize*static_mode_list[i]->nbShortMdcts)
252
1.21M
         {
253
1.21M
            if (error)
254
0
               *error = OPUS_OK;
255
1.21M
            return (CELTMode*)static_mode_list[i];
256
1.21M
         }
257
1.21M
      }
258
1.21M
   }
259
0
#endif /* CUSTOM_MODES_ONLY */
260
261
0
#ifndef CUSTOM_MODES
262
0
   if (error)
263
0
      *error = OPUS_BAD_ARG;
264
0
   return NULL;
265
#else
266
267
   /* The good thing here is that permutation of the arguments will automatically be invalid */
268
269
   if (Fs < 8000 || Fs > 96000)
270
   {
271
      if (error)
272
         *error = OPUS_BAD_ARG;
273
      return NULL;
274
   }
275
#ifdef ENABLE_QEXT
276
   /* Frames longer than 1024 samples are only supported for the 96 kHz modes
277
      for which the encoder and decoder double their internal buffers
278
      (qext_scale == 2, i.e. a short MDCT of 240 or 180 samples). */
279
   if (frame_size < 40 || frame_size%2!=0 ||
280
       (frame_size > 1024 && !(Fs == 96000 && (frame_size == 1920 || frame_size == 1440))))
281
#else
282
   if (frame_size < 40 || frame_size > 1024 || frame_size%2!=0)
283
#endif
284
   {
285
      if (error)
286
         *error = OPUS_BAD_ARG;
287
      return NULL;
288
   }
289
   /* Frames of less than 1ms are not supported. */
290
   if ((opus_int32)frame_size*1000 < Fs)
291
   {
292
      if (error)
293
         *error = OPUS_BAD_ARG;
294
      return NULL;
295
   }
296
297
   if ((opus_int32)frame_size*75 >= Fs && (frame_size%16)==0)
298
   {
299
     LM = 3;
300
   } else if ((opus_int32)frame_size*150 >= Fs && (frame_size%8)==0)
301
   {
302
     LM = 2;
303
   } else if ((opus_int32)frame_size*300 >= Fs && (frame_size%4)==0)
304
   {
305
     LM = 1;
306
   } else
307
   {
308
     LM = 0;
309
   }
310
311
   /* Shorts longer than 3.3ms are not supported. */
312
   if ((opus_int32)(frame_size>>LM)*300 > Fs)
313
   {
314
      if (error)
315
         *error = OPUS_BAD_ARG;
316
      return NULL;
317
   }
318
319
   mode = opus_alloc(sizeof(CELTMode));
320
   if (mode==NULL)
321
      goto failure;
322
   mode->Fs = Fs;
323
324
   /* Pre/de-emphasis depends on sampling rate. The "standard" pre-emphasis
325
      is defined as A(z) = 1 - 0.85*z^-1 at 48 kHz. Other rates should
326
      approximate that. */
327
#ifdef ENABLE_QEXT
328
   if(Fs == 96000) /* 96 kHz */
329
   {
330
      mode->preemph[0] =  QCONST16(0.9230041504f, 15);
331
      mode->preemph[1] =  QCONST16(0.2200012207f, 15);
332
      mode->preemph[2] =  QCONST16(1.5128347184f, SIG_SHIFT); /* exact 1/preemph[3] */
333
      mode->preemph[3] =  QCONST16(0.6610107422f, 13);
334
   } else
335
#endif
336
   if(Fs < 12000) /* 8 kHz */
337
   {
338
      mode->preemph[0] =  QCONST16(0.3500061035f, 15);
339
      mode->preemph[1] = -QCONST16(0.1799926758f, 15);
340
      mode->preemph[2] =  QCONST16(0.2719968125f, SIG_SHIFT); /* exact 1/preemph[3] */
341
      mode->preemph[3] =  QCONST16(3.6765136719f, 13);
342
   } else if(Fs < 24000) /* 16 kHz */
343
   {
344
      mode->preemph[0] =  QCONST16(0.6000061035f, 15);
345
      mode->preemph[1] = -QCONST16(0.1799926758f, 15);
346
      mode->preemph[2] =  QCONST16(0.4424998650f, SIG_SHIFT); /* exact 1/preemph[3] */
347
      mode->preemph[3] =  QCONST16(2.2598876953f, 13);
348
   } else if(Fs < 40000) /* 32 kHz */
349
   {
350
      mode->preemph[0] =  QCONST16(0.7799987793f, 15);
351
      mode->preemph[1] = -QCONST16(0.1000061035f, 15);
352
      mode->preemph[2] =  QCONST16(0.7499771125f, SIG_SHIFT); /* exact 1/preemph[3] */
353
      mode->preemph[3] =  QCONST16(1.3333740234f, 13);
354
   } else /* 48 kHz */
355
   {
356
      mode->preemph[0] =  QCONST16(0.8500061035f, 15);
357
      mode->preemph[1] =  QCONST16(0.0f, 15);
358
      mode->preemph[2] =  QCONST16(1.f, SIG_SHIFT);
359
      mode->preemph[3] =  QCONST16(1.f, 13);
360
   }
361
362
   mode->maxLM = LM;
363
   mode->nbShortMdcts = 1<<LM;
364
   mode->shortMdctSize = frame_size/mode->nbShortMdcts;
365
   res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize);
366
367
   mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands);
368
   if (mode->eBands==NULL)
369
      goto failure;
370
#if !defined(SMALL_FOOTPRINT)
371
   /* Make sure we don't allocate a band larger than our PVQ table.
372
      208 should be enough, but let's be paranoid. */
373
   if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM >
374
    208) {
375
       goto failure;
376
   }
377
#endif
378
379
   mode->effEBands = mode->nbEBands;
380
   while (mode->eBands[mode->effEBands] > mode->shortMdctSize)
381
      mode->effEBands--;
382
383
   /* Overlap must be divisible by 4 */
384
   mode->overlap = ((mode->shortMdctSize>>2)<<2);
385
386
   compute_allocation_table(mode);
387
   if (mode->allocVectors==NULL)
388
      goto failure;
389
390
   window = (celt_coef*)opus_alloc(mode->overlap*sizeof(*window));
391
   if (window==NULL)
392
      goto failure;
393
394
#ifndef FIXED_POINT
395
   for (i=0;i<mode->overlap;i++)
396
      window[i] = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap));
397
#else
398
# ifdef ENABLE_QEXT
399
   for (i=0;i<mode->overlap;i++)
400
      window[i] = MIN32(2147483647, 2147483648*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap)));
401
# else
402
   for (i=0;i<mode->overlap;i++)
403
      window[i] = MIN32(32767,floor(.5+32768.*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap))));
404
# endif
405
#endif
406
   mode->window = window;
407
408
   logN = (opus_int16*)opus_alloc(mode->nbEBands*sizeof(opus_int16));
409
   if (logN==NULL)
410
      goto failure;
411
412
   for (i=0;i<mode->nbEBands;i++)
413
      logN[i] = log2_frac(mode->eBands[i+1]-mode->eBands[i], BITRES);
414
   mode->logN = logN;
415
416
   compute_pulse_cache(mode, mode->maxLM);
417
#ifdef ENABLE_QEXT
418
   OPUS_CLEAR(&mode->qext_cache, 1);
419
   if ( (mode->Fs == 48000 && (mode->shortMdctSize==120 || mode->shortMdctSize==90)) || (mode->Fs == 96000 && (mode->shortMdctSize==240 || mode->shortMdctSize==180)) ) {
420
      CELTMode dummy;
421
      compute_qext_mode(&dummy, mode);
422
      compute_pulse_cache(&dummy, dummy.maxLM);
423
      OPUS_COPY(&mode->qext_cache, &dummy.cache, 1);
424
   }
425
#endif
426
427
   if (clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts,
428
           mode->maxLM, arch) == 0)
429
      goto failure;
430
431
   if (error)
432
      *error = OPUS_OK;
433
434
   return mode;
435
failure:
436
   if (error)
437
      *error = OPUS_ALLOC_FAIL;
438
   if (mode!=NULL)
439
      opus_custom_mode_destroy(mode);
440
   return NULL;
441
#endif /* !CUSTOM_MODES */
442
1.21M
}
443
444
#if defined(CUSTOM_MODES) || defined(ENABLE_OPUS_CUSTOM_API)
445
void opus_custom_mode_destroy(CELTMode *mode)
446
{
447
   int arch = opus_select_arch();
448
449
   if (mode == NULL)
450
      return;
451
#ifndef CUSTOM_MODES_ONLY
452
   {
453
     int i;
454
     for (i=0;i<TOTAL_MODES;i++)
455
     {
456
        if (mode == static_mode_list[i])
457
        {
458
           return;
459
        }
460
     }
461
   }
462
#endif /* CUSTOM_MODES_ONLY */
463
#ifdef CUSTOM_MODES
464
#ifdef ENABLE_QEXT
465
   if (mode->qext_cache.index) opus_free((opus_int16*)mode->qext_cache.index);
466
   if (mode->qext_cache.bits) opus_free((unsigned char*)mode->qext_cache.bits);
467
   if (mode->qext_cache.caps) opus_free((unsigned char*)mode->qext_cache.caps);
468
#endif
469
   opus_free((opus_int16*)mode->eBands);
470
   opus_free((unsigned char*)mode->allocVectors);
471
472
   opus_free((opus_val16*)mode->window);
473
   opus_free((opus_int16*)mode->logN);
474
475
   opus_free((opus_int16*)mode->cache.index);
476
   opus_free((unsigned char*)mode->cache.bits);
477
   opus_free((unsigned char*)mode->cache.caps);
478
   clt_mdct_clear(&mode->mdct, arch);
479
480
   opus_free((CELTMode *)mode);
481
#else
482
   (void)arch;
483
   celt_assert(0);
484
#endif
485
}
486
#endif
487
488
#ifdef ENABLE_QEXT
489
490
static const opus_int16 qext_eBands_180[] = {
491
/* 20k  22k  24k  26k  28k  30k  33k  35k  37k  39k  41k  43k  45k  46k  48k */
492
    74,  82,  90,  98, 106, 114, 122, 130, 138, 146, 154, 162, 168, 174, 180
493
};
494
495
static const opus_int16 qext_logN_180[] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 21, 21, 21};
496
497
/* Extra bands. */
498
static const opus_int16 qext_eBands_240[] = {
499
/* 20k  22k  24k  26k  28k  30k  32k  34k  36k  38k  40k  42k  44k  47k  48k */
500
   100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240
501
};
502
503
static const opus_int16 qext_logN_240[] = {27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27};
504
505
void compute_qext_mode(CELTMode *qext, const CELTMode *m)
506
{
507
   OPUS_COPY(qext, m, 1);
508
   if (m->shortMdctSize*48000 == 120*m->Fs) {
509
      qext->eBands = qext_eBands_240;
510
      qext->logN = qext_logN_240;
511
   } else if (m->shortMdctSize*48000 == 90*m->Fs) {
512
      qext->eBands = qext_eBands_180;
513
      qext->logN = qext_logN_180;
514
   } else {
515
      celt_assert(0);
516
   }
517
   qext->nbEBands = qext->effEBands = NB_QEXT_BANDS;
518
   while (qext->eBands[qext->effEBands] > qext->shortMdctSize)
519
      qext->effEBands--;
520
   qext->nbAllocVectors = 0;
521
   qext->allocVectors = NULL;
522
   OPUS_COPY(&qext->cache, &m->qext_cache, 1);
523
}
524
#endif