Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>2008-02-26 02:28:20 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2008-02-26 02:28:20 +0300
commit508de38d228e3412e3cafb7f2890384f8bb424bd (patch)
tree75ca2535b354f5c5ce742b275351102e0b0a5911 /libcelt/laplace.c
parent65d79e44190d9e3391b9e94e6b206d06ebfade9c (diff)
Trying to be nice with 16-bit chips.
Diffstat (limited to 'libcelt/laplace.c')
-rw-r--r--libcelt/laplace.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libcelt/laplace.c b/libcelt/laplace.c
index c35faf3..b06b851 100644
--- a/libcelt/laplace.c
+++ b/libcelt/laplace.c
@@ -37,12 +37,13 @@
static int ec_laplace_get_total(int decay)
{
- return (1<<30)/((1<<14) - decay) - (1<<15) + 1;
+ return (((ec_uint32)1)<<30)/((((ec_uint32)1)<<14) - decay) - (((ec_uint32)1)<<15) + 1;
}
void ec_laplace_encode(ec_enc *enc, int value, int decay)
{
- int i, fl, fs, ft;
+ int i;
+ ec_int32 fl, fs, ft;
int s = 0;
if (value < 0)
{
@@ -50,8 +51,8 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
value = -value;
}
ft = ec_laplace_get_total(decay);
- fl = -(1<<15);
- fs = 1<<15;
+ fl = -(((ec_uint32)1)<<15);
+ fs = ((ec_uint32)1)<<15;
for (i=0;i<value;i++)
{
int tmp_l, tmp_s;
@@ -77,13 +78,13 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
int ec_laplace_decode(ec_dec *dec, int decay)
{
int val=0;
- int fl, fh, fs, ft, fm;
+ ec_int32 fl, fh, fs, ft, fm;
ft = ec_laplace_get_total(decay);
fm = ec_decode(dec, ft);
/*printf ("fm: %d/%d\n", fm, ft);*/
fl = 0;
- fs = 1<<15;
+ fs = ((ec_uint32)1)<<15;
fh = fs;
while (fm >= fh && fs != 0)
{