diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2011-02-04 07:21:00 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2011-02-04 07:21:00 +0300 |
commit | 23340e2249c660af3cd1914128e1845fceddeb97 (patch) | |
tree | b792cd7706463806b8989b4643cfa6c5318f5a1f | |
parent | 752287825c3b7e706c3bcbf1e5f5920e222b76cf (diff) |
Fixes an int overflow in the VBR code
Also properly applies the MDCT filtering for resampling
-rw-r--r-- | libcelt/celt.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libcelt/celt.c b/libcelt/celt.c index bfc1561..8c30af9 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -950,7 +950,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i if (st->vbr) { - vbr_rate = ((2*st->bitrate*frame_size<<BITRES)+st->mode->Fs)/(2*st->mode->Fs); + celt_int32 den=st->mode->Fs>>BITRES; + vbr_rate=(st->bitrate*frame_size+(den>>1))/den; effectiveBytes = vbr_rate>>3; } else { celt_int32 tmp; @@ -2399,7 +2400,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da int bound = M*st->mode->eBands[effEnd]; if (st->downsample!=1) bound = IMIN(bound, N/st->downsample); - for (i=M*st->mode->eBands[effEnd];i<N;i++) + for (i=bound;i<N;i++) freq[c*N+i] = 0; } while (++c<C); |