Commit 468c5395 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

More code for laplace decoding (doesn't work)

parent 6887fb51
......@@ -63,15 +63,27 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
ec_encode(enc, fl, fs, ft);
void ec_laplace_decode(ec_dec *dec, int decay)
int ec_laplace_decode(ec_dec *dec, int decay)
int val;
int fl, fh, fs, ft, fm;
ft = ec_laplace_get_total(decay);
fm = ec_decode(dec, ft);
printf ("dec: %d/%d\n", fm, ft);
//loop on values here to find fl, fh
//ec_dec_update(dec, fl, fh, ft);
fl = 0;
fs = 1<<15;
fh = fs;
while (fm >= fh)
fl = fh;
fs = (fs*decay)>>14;
fh += fs*2;
if (fm >= fl+fs)
val = -val;
ec_dec_update(dec, fl, fh, ft);
#if 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment