ref: be607256398ef5494063e23c7d0f528939e4d8d8
parent: ce02e1b49dc13fbf29359f4634beef8022e6f128
author: Jean-Marc Valin <[email protected]>
date: Sat May 23 10:17:02 EDT 2009
Making use of previously unused range of the laplace encoder to have a slightly wider range of values.
--- a/libcelt/laplace.c
+++ b/libcelt/laplace.c
@@ -63,13 +63,18 @@
fs = (fs*(ec_int32)decay)>>14;
if (fs == 0)
{
- fs = tmp_s;
- fl = tmp_l;
- if (s)
- *value = -i;
- else
- *value = i;
- break;
+ if (fl+2 <= ft)
+ {
+ fs = 1;
+ } else {
+ fs = tmp_s;
+ fl = tmp_l;
+ if (s)
+ *value = -i;
+ else
+ *value = i;
+ break;
+ }
}
}
if (fl < 0)
@@ -103,6 +108,10 @@
{
fl = fh;
fs = (fs*(ec_int32)decay)>>14;
+ if (fs == 0 && fh+2 <= ft)
+ {
+ fs = 1;
+ }
fh += fs*2;
val++;
}