shithub: opus

Download patch

ref: b91d00d1e2bbaa8939e031a36770f555bf4eb459
parent: a8ac44b670765b201503325d92de902b730bce7d
author: Jean-Marc Valin <[email protected]>
date: Fri Aug 5 05:41:22 EDT 2011

Fixes two test cases

--- a/libcelt/tests/rotation-test.c
+++ b/libcelt/tests/rotation-test.c
@@ -2,9 +2,16 @@
 #include "config.h"
 #endif
 
+#define CELT_C
+
 #include <stdio.h>
 #include <stdlib.h>
-#include "celt_types.h"
+#include "vq.c"
+#include "cwrs.c"
+#include "entcode.c"
+#include "entenc.c"
+#include "entdec.c"
+#include "mathops.c"
 #include "bands.h"
 #include <math.h>
 #define MAX_SIZE 100
@@ -19,7 +26,7 @@
    int nb_rotations = (N+4*K)/(8*K);
    for (i=0;i<N;i++)
       x1[i] = x0[i] = rand()%32767-16384;
-   exp_rotation(x1, N, 1, 1, nb_rotations);
+   exp_rotation(x1, N, 1, 1, K, SPREAD_NORMAL);
    for (i=0;i<N;i++)
    {
       err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
@@ -27,7 +34,7 @@
    }
    snr0 = 20*log10(ener/err);
    err = ener = 0;
-   exp_rotation(x1, N, -1, 1, nb_rotations);
+   exp_rotation(x1, N, -1, 1, K, SPREAD_NORMAL);
    for (i=0;i<N;i++)
    {
       err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
@@ -36,11 +43,15 @@
    snr = 20*log10(ener/err);
    printf ("SNR for size %d (%d pulses) is %f (was %f without inverse)\n", N, K, snr, snr0);
    if (snr < 60 || snr0 > 20)
+   {
+      fprintf(stderr, "FAIL!\n");
       ret = 1;
+   }
 }
 
 int main(void)
 {
+   ALLOC_STACK;
    test_rotation(15, 3);
    test_rotation(23, 5);
    test_rotation(50, 3);
--- a/libcelt/tests/type-test.c
+++ b/libcelt/tests/type-test.c
@@ -2,7 +2,7 @@
 #include "config.h"
 #endif
 
-#include "celt_types.h"
+#include "opus_types.h"
 #include <stdio.h>
 
 int main(void)
@@ -11,7 +11,7 @@
    i <<= 14;
    if (i>>14 != 1)
    {
-      fprintf(stderr, "celt_int16 isn't 16 bits\n");
+      fprintf(stderr, "opus_int16 isn't 16 bits\n");
       return 1;
    }
    if (sizeof(opus_int16)*2 != sizeof(opus_int32))