media/libopus/celt/modes.c

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial