Slightly increasing the range of value by making sure the "start fs" is even
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sun, 24 May 2009 01:53:57 +0000 (21:53 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sun, 24 May 2009 01:53:57 +0000 (21:53 -0400)
(rounding towards zero).

libcelt/laplace.c

index db4e5fc..52fb702 100644 (file)
 
 int ec_laplace_get_start_freq(int decay)
 {
-   return (((ec_uint32)32768)*(16384-decay))/(16384+decay);
+   int fs = (((ec_uint32)32768)*(16384-decay))/(16384+decay);
+   /* Making fs even so we're sure that all the range is used for +/- values */
+   fs -= (fs&1);
+   return fs;
 }
 
 void ec_laplace_encode_start(ec_enc *enc, int *value, int decay, int fs)