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

Fixes two test cases

parent a8ac44b6
No related branches found
No related tags found
No related merge requests found
......@@ -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 @@ void test_rotation(int N, int K)
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 @@ void test_rotation(int N, int K)
}
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 @@ void test_rotation(int N, int K)
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);
......
......@@ -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 @@ int main(void)
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))
......
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