OLD | NEW |
1 /* Copyright (c) 2008-2011 Xiph.Org Foundation, Mozilla Corporation, | 1 /* Copyright (c) 2008-2011 Xiph.Org Foundation, Mozilla Corporation, |
2 Gregory Maxwell | 2 Gregory Maxwell |
3 Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */ | 3 Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */ |
4 /* | 4 /* |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions | 6 modification, are permitted provided that the following conditions |
7 are met: | 7 are met: |
8 | 8 |
9 - Redistributions of source code must retain the above copyright | 9 - Redistributions of source code must retain the above copyright |
10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
(...skipping 18 matching lines...) Expand all Loading... |
29 #ifdef HAVE_CONFIG_H | 29 #ifdef HAVE_CONFIG_H |
30 #include "config.h" | 30 #include "config.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #ifndef CUSTOM_MODES | 33 #ifndef CUSTOM_MODES |
34 #define CUSTOM_MODES | 34 #define CUSTOM_MODES |
35 #endif | 35 #endif |
36 | 36 |
37 #define CELT_C | 37 #define CELT_C |
38 | 38 |
| 39 #include <stdio.h> |
| 40 #include <math.h> |
39 #include "mathops.c" | 41 #include "mathops.c" |
40 #include "entenc.c" | 42 #include "entenc.c" |
41 #include "entdec.c" | 43 #include "entdec.c" |
42 #include "entcode.c" | 44 #include "entcode.c" |
43 #include "bands.c" | 45 #include "bands.c" |
44 #include "quant_bands.c" | 46 #include "quant_bands.c" |
45 #include "laplace.c" | 47 #include "laplace.c" |
46 #include "vq.c" | 48 #include "vq.c" |
47 #include "cwrs.c" | 49 #include "cwrs.c" |
48 #include <stdio.h> | 50 #include "pitch.c" |
49 #include <math.h> | 51 #include "celt_lpc.c" |
| 52 |
| 53 #if defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2) |
| 54 #include "x86/pitch_sse.c" |
| 55 #if defined(OPUS_X86_MAY_HAVE_SSE4_1) |
| 56 #include "x86/celt_lpc_sse.c" |
| 57 #endif |
| 58 #include "x86/x86_celt_map.c" |
| 59 #elif ((defined(OPUS_ARM_ASM) && defined(FIXED_POINT)) \ |
| 60 || defined(OPUS_ARM_NEON_INTR)) |
| 61 #if defined(OPUS_ARM_NEON_INTR) |
| 62 #include "arm/celt_neon_intr.c" |
| 63 #endif |
| 64 #include "arm/arm_celt_map.c" |
| 65 #endif |
50 | 66 |
51 #ifdef FIXED_POINT | 67 #ifdef FIXED_POINT |
52 #define WORD "%d" | 68 #define WORD "%d" |
53 #else | 69 #else |
54 #define WORD "%f" | 70 #define WORD "%f" |
55 #endif | 71 #endif |
56 | 72 |
57 int ret = 0; | 73 int ret = 0; |
58 | 74 |
59 void testdiv(void) | 75 void testdiv(void) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 223 |
208 void testexp2(void) | 224 void testexp2(void) |
209 { | 225 { |
210 opus_val16 x; | 226 opus_val16 x; |
211 for (x=-32768;x<15360;x++) | 227 for (x=-32768;x<15360;x++) |
212 { | 228 { |
213 float error1 = fabs(x/1024.0-(1.442695040888963387*log(celt_exp2(x)/65536.
0))); | 229 float error1 = fabs(x/1024.0-(1.442695040888963387*log(celt_exp2(x)/65536.
0))); |
214 float error2 = fabs(exp(0.6931471805599453094*x/1024.0)-celt_exp2(x)/65536
.0); | 230 float error2 = fabs(exp(0.6931471805599453094*x/1024.0)-celt_exp2(x)/65536
.0); |
215 if (error1>0.0002&&error2>0.00004) | 231 if (error1>0.0002&&error2>0.00004) |
216 { | 232 { |
217 » fprintf (stderr, "celt_exp2 failed: x = "WORD", error1 = %f, error2 = %
f\n", x,error1,error2); | 233 fprintf (stderr, "celt_exp2 failed: x = "WORD", error1 = %f, error2 = %
f\n", x,error1,error2); |
218 ret = 1; | 234 ret = 1; |
219 } | 235 } |
220 } | 236 } |
221 } | 237 } |
222 | 238 |
223 void testexp2log2(void) | 239 void testexp2log2(void) |
224 { | 240 { |
225 opus_val32 x; | 241 opus_val32 x; |
226 for (x=8;x<65536;x+=(x>>3)) | 242 for (x=8;x<65536;x+=(x>>3)) |
227 { | 243 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 testdiv(); | 282 testdiv(); |
267 testsqrt(); | 283 testsqrt(); |
268 testlog2(); | 284 testlog2(); |
269 testexp2(); | 285 testexp2(); |
270 testexp2log2(); | 286 testexp2log2(); |
271 #ifdef FIXED_POINT | 287 #ifdef FIXED_POINT |
272 testilog2(); | 288 testilog2(); |
273 #endif | 289 #endif |
274 return ret; | 290 return ret; |
275 } | 291 } |
OLD | NEW |