shithub: opus

Download patch

ref: 56cf2d6ae0c72ff837618926124e82f56cdca33e
parent: c95ab8ccb2f07773c7e8bfb6ef8322326a23a886
author: Jean-Marc Valin <[email protected]>
date: Mon Apr 28 11:56:38 EDT 2008

Added code for simulating bit errors

--- a/libcelt/testcelt.c
+++ b/libcelt/testcelt.c
@@ -118,16 +118,21 @@
          fprintf (stderr, "celt_encode() returned %d\n", len);
          return 1;
       }
+#if 0
+      /* This simulates random bit error */
+      for (i=30;i<len*8;i++)
+      {
+         if (rand()%1000==0)
+         {
+            data[i/8] ^= 1<<(7-(i%8));
+         }
+      }
+#endif
       /* This is to simulate packet loss */
-#if 1
       if (rand()%100==-1)
          celt_decode(dec, NULL, len, out);
       else
          celt_decode(dec, data, len, out);
-#else
-      for (i=0;i<frame_size*channels;i++)
-         out[i] = in[i];
-#endif
 #if !(defined (FIXED_POINT) && defined(STATIC_MODES))
       for (i=0;i<frame_size*channels;i++)
       {