shithub: opus

Download patch

ref: 7cdc5a34a436f52309e60a54a57244dcf0c7c1f5
parent: a556694e128a10eb03a0cc8311e6516bdbd88674
author: Jean-Marc Valin <[email protected]>
date: Sat Mar 1 15:56:17 EST 2008

Making it easier to debug laplace testcase

--- a/libcelt/laplace.c
+++ b/libcelt/laplace.c
@@ -71,6 +71,7 @@
       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 @@
    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 @@
    /* 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;
 }
--- a/tests/laplace-test.c
+++ b/tests/laplace-test.c
@@ -17,12 +17,16 @@
    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);