diff options
author | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-06-10 10:25:45 +0400 |
---|---|---|
committer | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-06-10 10:25:45 +0400 |
commit | 5aff7c04d46e55b29a67bf1aa96731cc299bf88a (patch) | |
tree | 884ce8bf86e39676117a168449509407b7ca707f /libcelt/rate.c | |
parent | 7806230829e896c1c9e9ae699e17de49ea5bc057 (diff) |
Implemented a cleaner way to detect whether CWRS codebooks fit in 32 or 64 bits
Diffstat (limited to 'libcelt/rate.c')
-rw-r--r-- | libcelt/rate.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libcelt/rate.c b/libcelt/rate.c index dbf2ca4..97546b1 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -44,7 +44,7 @@ #define BITRES 4 #define BITROUND 8 -#define BITOVERFLOW 10000 +#define BITOVERFLOW 30000 #ifndef STATIC_MODES #if 0 @@ -131,11 +131,10 @@ celt_int16_t **compute_alloc_cache(CELTMode *m, int C) bits[i][j] = 0; else { celt_uint64_t nc; + if (!fits_in64(N, pulses)) + break; nc=pulses?ncwrs_unext64(N, u):ncwrs_u64(N, 0, u); bits[i][j] = log2_frac64(nc,BITRES); - /* FIXME: Could there be a better test for the max number of pulses that fit in 64 bits? */ - if (bits[i][j] > (60<<BITRES)) - done = 1; /* Add the intra-frame prediction sign bit */ if (eBands[i] >= m->pitchEnd) bits[i][j] += (1<<BITRES); |