Skip to content
Snippets Groups Projects
Commit 7cdc5a34 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Making it easier to debug laplace testcase

parent a556694e
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,7 @@ void ec_laplace_encode(ec_enc *enc, int value, int decay)
fl = 0;
if (s)
fl += fs;
/*DEBUG*/
/*printf ("enc: %d %d %d\n", fl, fs, ft);*/
ec_encode(enc, fl, fl+fs, ft);
}
......@@ -82,6 +83,7 @@ int ec_laplace_decode(ec_dec *dec, int decay)
ft = ec_laplace_get_total(decay);
fm = ec_decode(dec, ft);
/*DEBUG*/
/*printf ("fm: %d/%d\n", fm, ft);*/
fl = 0;
fs = ((ec_uint32)1)<<15;
......@@ -106,6 +108,8 @@ int ec_laplace_decode(ec_dec *dec, int decay)
/* Preventing an infinite loop in case something screws up in the decoding */
if (fl==fh)
fl--;
/*DEBUG*/
/*printf ("update: %d %d %d\n", fl, fh, ft);*/
ec_dec_update(dec, fl, fh, ft);
return val;
}
......
......@@ -17,12 +17,16 @@ int main()
ec_byte_writeinit(&buf);
ec_enc_init(&enc,&buf);
val[0] = 3; decay[0] = 6000;
val[1] = 0; decay[1] = 5800;
val[2] = -1; decay[2] = 5600;
for (i=0;i<10000;i++)
{
val[i] = rand()%15-7;
decay[i] = rand()%11000+5000;
ec_laplace_encode(&enc, val[i], decay[i]);
}
for (i=0;i<10000;i++)
ec_laplace_encode(&enc, val[i], decay[i]);
ec_enc_done(&enc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment