forked from len0rd/rockbox
Code clean up.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13825 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3233e9651a
commit
899212858c
1 changed files with 24 additions and 117 deletions
|
@ -117,8 +117,8 @@ FFTComplex *exparray[5]; //these are the fft
|
||||||
|
|
||||||
uint16_t *revarray[5];
|
uint16_t *revarray[5];
|
||||||
|
|
||||||
FFTComplex exptab0[512] IBSS_ATTR;//, exptab1[256], exptab2[128], exptab3[64], exptab4[32]; //folded these in!
|
FFTComplex exptab0[512] IBSS_ATTR;
|
||||||
uint16_t revtab0[1024];//, revtab1[512], revtab2[256], revtab3[128], revtab4[64];
|
uint16_t revtab0[1024];
|
||||||
|
|
||||||
uint16_t *runtabarray[2], *levtabarray[2]; //these are VLC lookup tables
|
uint16_t *runtabarray[2], *levtabarray[2]; //these are VLC lookup tables
|
||||||
|
|
||||||
|
@ -148,17 +148,7 @@ int fft_inits(FFTContext *s, int nbits, int inverse)
|
||||||
|
|
||||||
s->nbits = nbits;
|
s->nbits = nbits;
|
||||||
n = 1 << nbits;
|
n = 1 << nbits;
|
||||||
//s->exptab = exparray[10-nbits]; //not needed
|
|
||||||
|
|
||||||
//s->exptab = av_malloc((n >> 1) * sizeof(FFTComplex));
|
|
||||||
//if (!s->exptab)
|
|
||||||
// goto fail;
|
|
||||||
|
|
||||||
//s->revtab = revarray[10-nbits];
|
|
||||||
|
|
||||||
//s->revtab = av_malloc(n * sizeof(uint16_t));
|
|
||||||
//if (!s->revtab)
|
|
||||||
// goto fail;
|
|
||||||
s->inverse = inverse;
|
s->inverse = inverse;
|
||||||
|
|
||||||
s2 = inverse ? 1 : -1;
|
s2 = inverse ? 1 : -1;
|
||||||
|
@ -196,26 +186,7 @@ int fft_inits(FFTContext *s, int nbits, int inverse)
|
||||||
// s->fft_calc = fft_calc;
|
// s->fft_calc = fft_calc;
|
||||||
s->exptab1 = NULL;
|
s->exptab1 = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* compute bit reverse table */
|
|
||||||
/*
|
|
||||||
for(i=0;i<n;i++)
|
|
||||||
{
|
|
||||||
m=0;
|
|
||||||
for(j=0;j<nbits;j++)
|
|
||||||
{
|
|
||||||
m |= ((i >> j) & 1) << (nbits-j-1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
s->revtab[i]=m;
|
|
||||||
} */
|
|
||||||
return 0;
|
return 0;
|
||||||
//fail:
|
|
||||||
// av_freep(&s->revtab);
|
|
||||||
// av_freep(&s->exptab);
|
|
||||||
// av_freep(&s->exptab1);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* butter fly op */
|
/* butter fly op */
|
||||||
|
@ -324,15 +295,7 @@ int fft_calc_unscaled(FFTContext *s, FFTComplex *z)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//needless since we're statically allocated
|
|
||||||
void fft_end(FFTContext *s)
|
|
||||||
{
|
|
||||||
// av_freep(&s->revtab);
|
|
||||||
// av_freep(&s->exptab);
|
|
||||||
// av_freep(&s->exptab1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* VLC decoding */
|
/* VLC decoding */
|
||||||
|
|
||||||
#define GET_VLC(code, name, gb, table, bits, max_depth)\
|
#define GET_VLC(code, name, gb, table, bits, max_depth)\
|
||||||
|
@ -407,10 +370,7 @@ static int alloc_table(VLC *vlc, int size)
|
||||||
vlc->table_size += size;
|
vlc->table_size += size;
|
||||||
if (vlc->table_size > vlc->table_allocated)
|
if (vlc->table_size > vlc->table_allocated)
|
||||||
{
|
{
|
||||||
// rb->splash(HZ*10, "OH CRAP, TRIED TO REALLOC A STATIC VLC TABLE!");
|
|
||||||
vlc->table_allocated += (1 << vlc->bits);
|
vlc->table_allocated += (1 << vlc->bits);
|
||||||
// vlc->table = av_realloc(vlc->table,
|
|
||||||
// sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
|
|
||||||
if (!vlc->table)
|
if (!vlc->table)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -533,8 +493,6 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
|
||||||
const void *codes, int codes_wrap, int codes_size)
|
const void *codes, int codes_wrap, int codes_size)
|
||||||
{
|
{
|
||||||
vlc->bits = nb_bits;
|
vlc->bits = nb_bits;
|
||||||
// vlc->table = NULL;
|
|
||||||
// vlc->table_allocated = 0;
|
|
||||||
vlc->table_size = 0;
|
vlc->table_size = 0;
|
||||||
|
|
||||||
if (build_table(vlc, nb_bits, nb_codes,
|
if (build_table(vlc, nb_bits, nb_codes,
|
||||||
|
@ -542,11 +500,9 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
|
||||||
codes, codes_wrap, codes_size,
|
codes, codes_wrap, codes_size,
|
||||||
0, 0) < 0)
|
0, 0) < 0)
|
||||||
{
|
{
|
||||||
// av_free(vlc->table);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//dump_table("Tab 1",vlc->table[0],vlc->table_size);
|
|
||||||
//dump_table("Tab 2",vlc->table[1],vlc->table_size);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,13 +522,6 @@ int ff_mdct_init(MDCTContext *s, int nbits, int inverse)
|
||||||
n4 = n >> 2;
|
n4 = n >> 2;
|
||||||
s->tcos = tcosarray[12-nbits];
|
s->tcos = tcosarray[12-nbits];
|
||||||
s->tsin = tsinarray[12-nbits];
|
s->tsin = tsinarray[12-nbits];
|
||||||
//s->tcos = av_malloc(n4 * sizeof(fixed32)); //this allocates between 1024 and 64 elements
|
|
||||||
//if (!s->tcos)
|
|
||||||
// goto fail;
|
|
||||||
//s->tsin = av_malloc(n4 * sizeof(fixed32));
|
|
||||||
//if (!s->tsin)
|
|
||||||
// goto fail;
|
|
||||||
//
|
|
||||||
for(i=0;i<n4;i++)
|
for(i=0;i<n4;i++)
|
||||||
{
|
{
|
||||||
//fixed32 pi2 = fixmul32(0x20000, M_PI_F);
|
//fixed32 pi2 = fixmul32(0x20000, M_PI_F);
|
||||||
|
@ -672,14 +621,6 @@ void ff_imdct_calc(MDCTContext *s,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mdct_end(MDCTContext *s)
|
|
||||||
{
|
|
||||||
(void)s;
|
|
||||||
|
|
||||||
// av_freep(&s->tcos);
|
|
||||||
// av_freep(&s->tsin);
|
|
||||||
// fft_end(&s->fft);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper functions for wma_window.
|
* Helper functions for wma_window.
|
||||||
|
@ -1375,7 +1316,6 @@ static int wma_decode_block(WMADecodeContext *s)
|
||||||
{
|
{
|
||||||
int n, v, a, ch, code, bsize;
|
int n, v, a, ch, code, bsize;
|
||||||
int coef_nb_bits, total_gain;
|
int coef_nb_bits, total_gain;
|
||||||
//static fixed32 window[BLOCK_MAX_SIZE * 2]; //crap can't do this locally on the device! its big as the whole stack
|
|
||||||
int nb_coefs[MAX_CHANNELS];
|
int nb_coefs[MAX_CHANNELS];
|
||||||
fixed32 mdct_norm;
|
fixed32 mdct_norm;
|
||||||
|
|
||||||
|
@ -1409,8 +1349,7 @@ static int wma_decode_block(WMADecodeContext *s)
|
||||||
}
|
}
|
||||||
v = get_bits(&s->gb, n);
|
v = get_bits(&s->gb, n);
|
||||||
|
|
||||||
//rb->fdprintf(filehandle,"v %d \n prev_block_len_bits %d\n block_len_bits %d\n", v, s->prev_block_len_bits, s->block_len_bits);
|
|
||||||
//rb->close(filehandle);
|
|
||||||
|
|
||||||
LOGF("v was %d", v);
|
LOGF("v was %d", v);
|
||||||
if (v >= s->nb_block_sizes)
|
if (v >= s->nb_block_sizes)
|
||||||
|
@ -2040,36 +1979,4 @@ fail:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void free_vlc(VLC *vlc)
|
|
||||||
{
|
|
||||||
//av_free(vlc->table);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int wma_decode_end(WMADecodeContext *s)
|
|
||||||
{
|
|
||||||
(void)s;
|
|
||||||
/* WMADecodeContext *s = avctx->priv_data;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 0; i < s->nb_block_sizes; ++i)
|
|
||||||
ff_mdct_end(&s->mdct_ctx[i]);
|
|
||||||
// for(i = 0; i < s->nb_block_sizes; ++i) //now statically allocated
|
|
||||||
// av_free(s->windows[i]);
|
|
||||||
|
|
||||||
if (s->use_exp_vlc)
|
|
||||||
{
|
|
||||||
free_vlc(&s->exp_vlc);
|
|
||||||
}
|
|
||||||
if (s->use_noise_coding)
|
|
||||||
{
|
|
||||||
free_vlc(&s->hgain_vlc);
|
|
||||||
}
|
|
||||||
for(i = 0;i < 2; ++i)
|
|
||||||
{
|
|
||||||
// free_vlc(&s->coef_vlc[i]);
|
|
||||||
// av_free(s->run_table[i]);
|
|
||||||
// av_free(s->level_table[i]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue