| OLD | NEW |
| 1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
| 2 Copyright (c) 2007-2009 Xiph.Org Foundation | 2 Copyright (c) 2007-2009 Xiph.Org Foundation |
| 3 Copyright (c) 2008 Gregory Maxwell | 3 Copyright (c) 2008 Gregory Maxwell |
| 4 Written by Jean-Marc Valin and Gregory Maxwell */ | 4 Written by Jean-Marc Valin and Gregory Maxwell */ |
| 5 /* | 5 /* |
| 6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
| 7 modification, are permitted provided that the following conditions | 7 modification, are permitted provided that the following conditions |
| 8 are met: | 8 are met: |
| 9 | 9 |
| 10 - Redistributions of source code must retain the above copyright | 10 - Redistributions of source code must retain the above copyright |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 338 } |
| 339 | 339 |
| 340 mode->maxLM = LM; | 340 mode->maxLM = LM; |
| 341 mode->nbShortMdcts = 1<<LM; | 341 mode->nbShortMdcts = 1<<LM; |
| 342 mode->shortMdctSize = frame_size/mode->nbShortMdcts; | 342 mode->shortMdctSize = frame_size/mode->nbShortMdcts; |
| 343 res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize); | 343 res = (mode->Fs+mode->shortMdctSize)/(2*mode->shortMdctSize); |
| 344 | 344 |
| 345 mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands); | 345 mode->eBands = compute_ebands(Fs, mode->shortMdctSize, res, &mode->nbEBands); |
| 346 if (mode->eBands==NULL) | 346 if (mode->eBands==NULL) |
| 347 goto failure; | 347 goto failure; |
| 348 #if !defined(SMALL_FOOTPRINT) |
| 349 /* Make sure we don't allocate a band larger than our PVQ table. |
| 350 208 should be enough, but let's be paranoid. */ |
| 351 if ((mode->eBands[mode->nbEBands] - mode->eBands[mode->nbEBands-1])<<LM > |
| 352 208) { |
| 353 goto failure; |
| 354 } |
| 355 #endif |
| 348 | 356 |
| 349 mode->effEBands = mode->nbEBands; | 357 mode->effEBands = mode->nbEBands; |
| 350 while (mode->eBands[mode->effEBands] > mode->shortMdctSize) | 358 while (mode->eBands[mode->effEBands] > mode->shortMdctSize) |
| 351 mode->effEBands--; | 359 mode->effEBands--; |
| 352 | 360 |
| 353 /* Overlap must be divisible by 4 */ | 361 /* Overlap must be divisible by 4 */ |
| 354 mode->overlap = ((mode->shortMdctSize>>2)<<2); | 362 mode->overlap = ((mode->shortMdctSize>>2)<<2); |
| 355 | 363 |
| 356 compute_allocation_table(mode); | 364 compute_allocation_table(mode); |
| 357 if (mode->allocVectors==NULL) | 365 if (mode->allocVectors==NULL) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 opus_free((opus_int16*)mode->logN); | 429 opus_free((opus_int16*)mode->logN); |
| 422 | 430 |
| 423 opus_free((opus_int16*)mode->cache.index); | 431 opus_free((opus_int16*)mode->cache.index); |
| 424 opus_free((unsigned char*)mode->cache.bits); | 432 opus_free((unsigned char*)mode->cache.bits); |
| 425 opus_free((unsigned char*)mode->cache.caps); | 433 opus_free((unsigned char*)mode->cache.caps); |
| 426 clt_mdct_clear(&mode->mdct); | 434 clt_mdct_clear(&mode->mdct); |
| 427 | 435 |
| 428 opus_free((CELTMode *)mode); | 436 opus_free((CELTMode *)mode); |
| 429 } | 437 } |
| 430 #endif | 438 #endif |
| OLD | NEW |