Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: opus/celt/tests/test_unit_rotation.c

Issue 11196031: Add copy of opus library in deps/third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « opus/celt/tests/test_unit_mdct.c ('k') | opus/celt/tests/test_unit_types.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #ifndef CUSTOM_MODES
6 #define CUSTOM_MODES
7 #endif
8
9 #define CELT_C
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include "vq.c"
14 #include "cwrs.c"
15 #include "entcode.c"
16 #include "entenc.c"
17 #include "entdec.c"
18 #include "mathops.c"
19 #include "bands.h"
20 #include <math.h>
21 #define MAX_SIZE 100
22
23 int ret=0;
24 void test_rotation(int N, int K)
25 {
26 int i;
27 double err = 0, ener = 0, snr, snr0;
28 opus_val16 x0[MAX_SIZE];
29 opus_val16 x1[MAX_SIZE];
30 for (i=0;i<N;i++)
31 x1[i] = x0[i] = rand()%32767-16384;
32 exp_rotation(x1, N, 1, 1, K, SPREAD_NORMAL);
33 for (i=0;i<N;i++)
34 {
35 err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
36 ener += x0[i]*(double)x0[i];
37 }
38 snr0 = 20*log10(ener/err);
39 err = ener = 0;
40 exp_rotation(x1, N, -1, 1, K, SPREAD_NORMAL);
41 for (i=0;i<N;i++)
42 {
43 err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
44 ener += x0[i]*(double)x0[i];
45 }
46 snr = 20*log10(ener/err);
47 printf ("SNR for size %d (%d pulses) is %f (was %f without inverse)\n", N, K, snr, snr0);
48 if (snr < 60 || snr0 > 20)
49 {
50 fprintf(stderr, "FAIL!\n");
51 ret = 1;
52 }
53 }
54
55 int main(void)
56 {
57 ALLOC_STACK;
58 test_rotation(15, 3);
59 test_rotation(23, 5);
60 test_rotation(50, 3);
61 test_rotation(80, 1);
62 return ret;
63 }
OLDNEW
« no previous file with comments | « opus/celt/tests/test_unit_mdct.c ('k') | opus/celt/tests/test_unit_types.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698