New pulse cache
This commit is contained in:
parent
ba3a28921a
commit
3ad8db49c5
7 changed files with 111 additions and 175 deletions
|
@ -413,17 +413,6 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
|
|||
#endif
|
||||
mode->window = window;
|
||||
|
||||
mode->bits = mode->_bits+1;
|
||||
for (i=0;(1<<i)<=mode->nbShortMdcts;i++)
|
||||
{
|
||||
mode->bits[i] = (const celt_int16 **)compute_alloc_cache(mode, 1<<i);
|
||||
if (mode->bits[i]==NULL)
|
||||
goto failure;
|
||||
}
|
||||
mode->bits[-1] = (const celt_int16 **)compute_alloc_cache(mode, 0);
|
||||
if (mode->bits[-1]==NULL)
|
||||
goto failure;
|
||||
|
||||
logN = (celt_int16*)celt_alloc(mode->nbEBands*sizeof(celt_int16));
|
||||
if (logN==NULL)
|
||||
goto failure;
|
||||
|
@ -431,6 +420,8 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
|
|||
for (i=0;i<mode->nbEBands;i++)
|
||||
logN[i] = log2_frac(mode->eBands[i+1]-mode->eBands[i], BITRES);
|
||||
mode->logN = logN;
|
||||
|
||||
compute_pulse_cache(mode, mode->maxLM);
|
||||
#endif /* !STATIC_MODES */
|
||||
|
||||
clt_mdct_init(&mode->mdct, 2*mode->shortMdctSize*mode->nbShortMdcts, LM);
|
||||
|
@ -460,8 +451,6 @@ failure:
|
|||
|
||||
void celt_mode_destroy(CELTMode *mode)
|
||||
{
|
||||
int i, m;
|
||||
const celt_int16 *prevPtr = NULL;
|
||||
if (mode == NULL)
|
||||
{
|
||||
celt_warning("NULL passed to celt_mode_destroy");
|
||||
|
@ -481,40 +470,14 @@ void celt_mode_destroy(CELTMode *mode)
|
|||
}
|
||||
mode->marker_start = MODEFREED;
|
||||
#ifndef STATIC_MODES
|
||||
for (m=0;(1<<m)<=mode->nbShortMdcts;m++)
|
||||
{
|
||||
if (mode->bits[m]!=NULL)
|
||||
{
|
||||
for (i=0;i<mode->nbEBands;i++)
|
||||
{
|
||||
if (mode->bits[m][i] != prevPtr)
|
||||
{
|
||||
prevPtr = mode->bits[m][i];
|
||||
celt_free((int*)mode->bits[m][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
celt_free((celt_int16**)mode->bits[m]);
|
||||
}
|
||||
if (mode->bits[-1]!=NULL)
|
||||
{
|
||||
for (i=0;i<mode->nbEBands;i++)
|
||||
{
|
||||
if (mode->bits[-1][i] != prevPtr)
|
||||
{
|
||||
prevPtr = mode->bits[-1][i];
|
||||
celt_free((int*)mode->bits[-1][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
celt_free((celt_int16**)mode->bits[-1]);
|
||||
|
||||
celt_free((celt_int16*)mode->eBands);
|
||||
celt_free((celt_int16*)mode->allocVectors);
|
||||
|
||||
celt_free((celt_word16*)mode->window);
|
||||
celt_free((celt_int16*)mode->logN);
|
||||
|
||||
celt_free(mode->cache.index);
|
||||
celt_free(mode->cache.bits);
|
||||
#endif
|
||||
clt_mdct_clear(&mode->mdct);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue