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

Side by Side Diff: opus/celt/tests/test_unit_cwrs32.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/static_modes_float.h ('k') | opus/celt/tests/test_unit_dft.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 #include <stdio.h>
6 #include <string.h>
7
8 #ifndef CUSTOM_MODES
9 #define CUSTOM_MODES
10 #else
11 #define TEST_CUSTOM_MODES
12 #endif
13
14 #define CELT_C
15 #include "stack_alloc.h"
16 #include "entenc.c"
17 #include "entdec.c"
18 #include "entcode.c"
19 #include "cwrs.c"
20 #include "mathops.c"
21 #include "rate.h"
22
23 #define NMAX (240)
24 #define KMAX (128)
25
26 #ifdef TEST_CUSTOM_MODES
27
28 #define NDIMS (46)
29 static const int pn[NDIMS]={
30 2, 3, 4, 5, 6, 7, 8, 9, 10,
31 11, 12, 13, 14, 15, 16, 18, 20, 22,
32 24, 26, 28, 30, 32, 36, 40, 44, 48,
33 52, 56, 60, 64, 72, 80, 88, 96, 104,
34 112, 120, 128, 144, 160, 176, 192, 208, 224,
35 240
36 };
37 static const int pkmax[NDIMS]={
38 128, 128, 128, 128, 88, 52, 36, 26, 22,
39 18, 16, 15, 13, 12, 12, 11, 10, 9,
40 9, 8, 8, 7, 7, 7, 7, 6, 6,
41 6, 6, 6, 5, 5, 5, 5, 5, 5,
42 4, 4, 4, 4, 4, 4, 4, 4, 4,
43 4
44 };
45
46 #else /* TEST_CUSTOM_MODES */
47
48 #define NDIMS (22)
49 static const int pn[NDIMS]={
50 2, 3, 4, 6, 8, 9, 11, 12, 16,
51 18, 22, 24, 32, 36, 44, 48, 64, 72,
52 88, 96, 144, 176
53 };
54 static const int pkmax[NDIMS]={
55 128, 128, 128, 88, 36, 26, 18, 16, 12,
56 11, 9, 9, 7, 7, 6, 6, 5, 5,
57 5, 5, 4, 4
58 };
59
60 #endif
61
62 int main(void){
63 int t;
64 int n;
65 ALLOC_STACK;
66 for(t=0;t<NDIMS;t++){
67 int pseudo;
68 n=pn[t];
69 for(pseudo=1;pseudo<41;pseudo++)
70 {
71 int k;
72 opus_uint32 uu[KMAX+2U];
73 opus_uint32 inc;
74 opus_uint32 nc;
75 opus_uint32 i;
76 k=get_pulses(pseudo);
77 if (k>pkmax[t])break;
78 printf("Testing CWRS with N=%i, K=%i...\n",n,k);
79 nc=ncwrs_urow(n,k,uu);
80 inc=nc/20000;
81 if(inc<1)inc=1;
82 for(i=0;i<nc;i+=inc){
83 opus_uint32 u[KMAX+2U];
84 int y[NMAX];
85 int sy;
86 int yy[5];
87 opus_uint32 v;
88 opus_uint32 ii;
89 int kk;
90 int j;
91 memcpy(u,uu,(k+2U)*sizeof(*u));
92 cwrsi(n,k,i,y,u);
93 sy=0;
94 for(j=0;j<n;j++)sy+=ABS(y[j]);
95 if(sy!=k){
96 fprintf(stderr,"N=%d Pulse count mismatch in cwrsi (%d!=%d).\n",
97 n,sy,k);
98 return 99;
99 }
100 /*printf("%6u of %u:",i,nc);
101 for(j=0;j<n;j++)printf(" %+3i",y[j]);
102 printf(" ->");*/
103 ii=icwrs(n,k,&v,y,u);
104 if(ii!=i){
105 fprintf(stderr,"Combination-index mismatch (%lu!=%lu).\n",
106 (long)ii,(long)i);
107 return 1;
108 }
109 if(v!=nc){
110 fprintf(stderr,"Combination count mismatch (%lu!=%lu).\n",
111 (long)v,(long)nc);
112 return 2;
113 }
114 #ifndef SMALL_FOOTPRINT
115 if(n==2){
116 cwrsi2(k,i,yy);
117 for(j=0;j<2;j++)if(yy[j]!=y[j]){
118 fprintf(stderr,"N=2 pulse vector mismatch ({%i,%i}!={%i,%i}).\n",
119 yy[0],yy[1],y[0],y[1]);
120 return 3;
121 }
122 ii=icwrs2(yy,&kk);
123 if(ii!=i){
124 fprintf(stderr,"N=2 combination-index mismatch (%lu!=%lu).\n",
125 (long)ii,(long)i);
126 return 4;
127 }
128 if(kk!=k){
129 fprintf(stderr,"N=2 pulse count mismatch (%i,%i).\n",kk,k);
130 return 5;
131 }
132 v=ncwrs2(k);
133 if(v!=nc){
134 fprintf(stderr,"N=2 combination count mismatch (%lu,%lu).\n",
135 (long)v,(long)nc);
136 return 6;
137 }
138 }
139 else if(n==3){
140 cwrsi3(k,i,yy);
141 for(j=0;j<3;j++)if(yy[j]!=y[j]){
142 fprintf(stderr,"N=3 pulse vector mismatch "
143 "({%i,%i,%i}!={%i,%i,%i}).\n",yy[0],yy[1],yy[2],y[0],y[1],y[2]);
144 return 7;
145 }
146 ii=icwrs3(yy,&kk);
147 if(ii!=i){
148 fprintf(stderr,"N=3 combination-index mismatch (%lu!=%lu).\n",
149 (long)ii,(long)i);
150 return 8;
151 }
152 if(kk!=k){
153 fprintf(stderr,"N=3 pulse count mismatch (%i!=%i).\n",kk,k);
154 return 9;
155 }
156 v=ncwrs3(k);
157 if(v!=nc){
158 fprintf(stderr,"N=3 combination count mismatch (%lu!=%lu).\n",
159 (long)v,(long)nc);
160 return 10;
161 }
162 }
163 else if(n==4){
164 cwrsi4(k,i,yy);
165 for(j=0;j<4;j++)if(yy[j]!=y[j]){
166 fprintf(stderr,"N=4 pulse vector mismatch "
167 "({%i,%i,%i,%i}!={%i,%i,%i,%i}.\n",
168 yy[0],yy[1],yy[2],yy[3],y[0],y[1],y[2],y[3]);
169 return 11;
170 }
171 ii=icwrs4(yy,&kk);
172 if(ii!=i){
173 fprintf(stderr,"N=4 combination-index mismatch (%lu!=%lu).\n",
174 (long)ii,(long)i);
175 return 12;
176 }
177 if(kk!=k){
178 fprintf(stderr,"N=4 pulse count mismatch (%i!=%i).\n",kk,k);
179 return 13;
180 }
181 v=ncwrs4(k);
182 if(v!=nc){
183 fprintf(stderr,"N=4 combination count mismatch (%lu!=%lu).\n",
184 (long)v,(long)nc);
185 return 14;
186 }
187 }
188 #endif /* SMALL_FOOTPRINT */
189 /*printf(" %6u\n",i);*/
190 }
191 /*printf("\n");*/
192 }
193 }
194 return 0;
195 }
OLDNEW
« no previous file with comments | « opus/celt/static_modes_float.h ('k') | opus/celt/tests/test_unit_dft.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698