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

Side by Side Diff: third_party/opus/src/celt/tests/test_unit_dft.c

Issue 2962373002: [Opus] Update to v1.2.1 (Closed)
Patch Set: Pre-increment instead of post-increment Created 3 years, 5 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
OLDNEW
1 /* Copyright (c) 2008 Xiph.Org Foundation 1 /* Copyright (c) 2008 Xiph.Org Foundation
2 Written by Jean-Marc Valin */ 2 Written by Jean-Marc Valin */
3 /* 3 /*
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions 5 modification, are permitted provided that the following conditions
6 are met: 6 are met:
7 7
8 - Redistributions of source code must retain the above copyright 8 - Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 10
(...skipping 11 matching lines...) Expand all
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include "config.h" 29 #include "config.h"
30 #endif 30 #endif
31 31
32 #define SKIP_CONFIG_H
33
34 #ifndef CUSTOM_MODES
35 #define CUSTOM_MODES
36 #endif
37
38 #include <stdio.h> 32 #include <stdio.h>
39 33
40 #define CELT_C
41 #define TEST_UNIT_DFT_C
42 #include "stack_alloc.h" 34 #include "stack_alloc.h"
43 #include "kiss_fft.h" 35 #include "kiss_fft.h"
44 #include "kiss_fft.c" 36 #include "mathops.h"
45 #include "mathops.c" 37 #include "modes.h"
46 #include "entcode.c"
47
48 #if defined(OPUS_X86_MAY_HAVE_SSE2) || defined(OPUS_X86_MAY_HAVE_SSE4_1)
49 # include "x86/x86cpu.c"
50 #elif defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
51 # include "arm/armcpu.c"
52 # include "celt_lpc.c"
53 # include "pitch.c"
54 # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
55 # include "arm/celt_neon_intr.c"
56 # if defined(HAVE_ARM_NE10)
57 # include "mdct.c"
58 # include "arm/celt_ne10_fft.c"
59 # include "arm/celt_ne10_mdct.c"
60 # endif
61 # endif
62 # include "arm/arm_celt_map.c"
63 #endif
64 38
65 #ifndef M_PI 39 #ifndef M_PI
66 #define M_PI 3.141592653 40 #define M_PI 3.141592653
67 #endif 41 #endif
68 42
69 int ret = 0; 43 int ret = 0;
70 44
71 void check(kiss_fft_cpx * in,kiss_fft_cpx * out,int nfft,int isinverse) 45 void check(kiss_fft_cpx * in,kiss_fft_cpx * out,int nfft,int isinverse)
72 { 46 {
73 int bin,k; 47 int bin,k;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 printf("nfft=%d inverse=%d,snr = %f\n",nfft,isinverse,snr ); 79 printf("nfft=%d inverse=%d,snr = %f\n",nfft,isinverse,snr );
106 if (snr<60) { 80 if (snr<60) {
107 printf( "** poor snr: %f ** \n", snr); 81 printf( "** poor snr: %f ** \n", snr);
108 ret = 1; 82 ret = 1;
109 } 83 }
110 } 84 }
111 85
112 void test1d(int nfft,int isinverse,int arch) 86 void test1d(int nfft,int isinverse,int arch)
113 { 87 {
114 size_t buflen = sizeof(kiss_fft_cpx)*nfft; 88 size_t buflen = sizeof(kiss_fft_cpx)*nfft;
89 kiss_fft_cpx *in;
90 kiss_fft_cpx *out;
91 int k;
92 #ifdef CUSTOM_MODES
93 kiss_fft_state *cfg = opus_fft_alloc(nfft,0,0,arch);
94 #else
95 int id;
96 const kiss_fft_state *cfg;
97 CELTMode *mode = opus_custom_mode_create(48000, 960, NULL);
98 if (nfft == 480) id = 0;
99 else if (nfft == 240) id = 1;
100 else if (nfft == 120) id = 2;
101 else if (nfft == 60) id = 3;
102 else return;
103 cfg = mode->mdct.kfft[id];
104 #endif
115 105
116 kiss_fft_cpx * in = (kiss_fft_cpx*)malloc(buflen); 106 in = (kiss_fft_cpx*)malloc(buflen);
117 kiss_fft_cpx * out= (kiss_fft_cpx*)malloc(buflen); 107 out = (kiss_fft_cpx*)malloc(buflen);
118 kiss_fft_state *cfg = opus_fft_alloc(nfft,0,0,arch);
119 int k;
120 108
121 for (k=0;k<nfft;++k) { 109 for (k=0;k<nfft;++k) {
122 in[k].r = (rand() % 32767) - 16384; 110 in[k].r = (rand() % 32767) - 16384;
123 in[k].i = (rand() % 32767) - 16384; 111 in[k].i = (rand() % 32767) - 16384;
124 } 112 }
125 113
126 for (k=0;k<nfft;++k) { 114 for (k=0;k<nfft;++k) {
127 in[k].r *= 32768; 115 in[k].r *= 32768;
128 in[k].i *= 32768; 116 in[k].i *= 32768;
129 } 117 }
(...skipping 12 matching lines...) Expand all
142 opus_ifft(cfg,in,out, arch); 130 opus_ifft(cfg,in,out, arch);
143 else 131 else
144 opus_fft(cfg,in,out, arch); 132 opus_fft(cfg,in,out, arch);
145 133
146 /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/ 134 /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/
147 135
148 check(in,out,nfft,isinverse); 136 check(in,out,nfft,isinverse);
149 137
150 free(in); 138 free(in);
151 free(out); 139 free(out);
140 #ifdef CUSTOM_MODES
152 opus_fft_free(cfg, arch); 141 opus_fft_free(cfg, arch);
142 #endif
153 } 143 }
154 144
155 int main(int argc,char ** argv) 145 int main(int argc,char ** argv)
156 { 146 {
157 ALLOC_STACK; 147 ALLOC_STACK;
158 int arch = opus_select_arch(); 148 int arch = opus_select_arch();
159 149
160 if (argc>1) { 150 if (argc>1) {
161 int k; 151 int k;
162 for (k=1;k<argc;++k) { 152 for (k=1;k<argc;++k) {
(...skipping 17 matching lines...) Expand all
180 test1d(120,0,arch); 170 test1d(120,0,arch);
181 test1d(120,1,arch); 171 test1d(120,1,arch);
182 test1d(240,0,arch); 172 test1d(240,0,arch);
183 test1d(240,1,arch); 173 test1d(240,1,arch);
184 test1d(480,0,arch); 174 test1d(480,0,arch);
185 test1d(480,1,arch); 175 test1d(480,1,arch);
186 #endif 176 #endif
187 } 177 }
188 return ret; 178 return ret;
189 } 179 }
OLDNEW
« no previous file with comments | « third_party/opus/src/celt/static_modes_float_arm_ne10.h ('k') | third_party/opus/src/celt/tests/test_unit_mathops.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698