comparison TestMultipleRuns.cpp @ 28:b1bc4d045a4b vamp-plugin-tester-v1.0

* Solaris build fixes
author cannam
date Thu, 24 Sep 2009 14:11:14 +0000
parents df121992f23a
children 07144cdcbedf
comparison
equal deleted inserted replaced
27:5dcdc86d45d4 28:b1bc4d045a4b
45 #include <memory> 45 #include <memory>
46 using namespace std; 46 using namespace std;
47 47
48 #include <cmath> 48 #include <cmath>
49 49
50 #ifndef __GNUC__
51 #include <alloca.h>
52 #endif
53
50 Tester::TestRegistrar<TestDistinctRuns> 54 Tester::TestRegistrar<TestDistinctRuns>
51 TestDistinctRuns::m_registrar("D1 Consecutive runs with separate instances"); 55 TestDistinctRuns::m_registrar("D1 Consecutive runs with separate instances");
52 56
53 Tester::TestRegistrar<TestReset> 57 Tester::TestRegistrar<TestReset>
54 TestReset::m_registrar("D2 Consecutive runs with a single instance using reset"); 58 TestReset::m_registrar("D2 Consecutive runs with a single instance using reset");
74 for (int run = 0; run < 2; ++run) { 78 for (int run = 0; run < 2; ++run) {
75 auto_ptr<Plugin> p(load(key, rate)); 79 auto_ptr<Plugin> p(load(key, rate));
76 if (!initAdapted(p.get(), channels, _step, _step, r)) return r; 80 if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
77 if (!data) data = createTestAudio(channels, _step, count); 81 if (!data) data = createTestAudio(channels, _step, count);
78 for (size_t i = 0; i < count; ++i) { 82 for (size_t i = 0; i < count; ++i) {
83 #ifdef __GNUC__
79 float *ptr[channels]; 84 float *ptr[channels];
85 #else
86 float **ptr = (float **)alloca(channels * sizeof(float));
87 #endif
80 size_t idx = i * _step; 88 size_t idx = i * _step;
81 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 89 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
82 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 90 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
83 Plugin::FeatureSet fs = p->process(ptr, timestamp); 91 Plugin::FeatureSet fs = p->process(ptr, timestamp);
84 appendFeatures(f[run], fs); 92 appendFeatures(f[run], fs);
117 for (int run = 0; run < 2; ++run) { 125 for (int run = 0; run < 2; ++run) {
118 if (run == 1) p->reset(); 126 if (run == 1) p->reset();
119 else if (!initAdapted(p.get(), channels, _step, _step, r)) return r; 127 else if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
120 if (!data) data = createTestAudio(channels, _step, count); 128 if (!data) data = createTestAudio(channels, _step, count);
121 for (size_t i = 0; i < count; ++i) { 129 for (size_t i = 0; i < count; ++i) {
130 #ifdef __GNUC__
122 float *ptr[channels]; 131 float *ptr[channels];
132 #else
133 float **ptr = (float **)alloca(channels * sizeof(float));
134 #endif
123 size_t idx = i * _step; 135 size_t idx = i * _step;
124 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 136 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
125 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 137 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
126 Plugin::FeatureSet fs = p->process(ptr, timestamp); 138 Plugin::FeatureSet fs = p->process(ptr, timestamp);
127 appendFeatures(f[run], fs); 139 appendFeatures(f[run], fs);
164 return r; 176 return r;
165 } 177 }
166 if (!data) data = createTestAudio(channels, _step, count); 178 if (!data) data = createTestAudio(channels, _step, count);
167 } 179 }
168 for (size_t i = 0; i < count; ++i) { 180 for (size_t i = 0; i < count; ++i) {
181 #ifdef __GNUC__
169 float *ptr[channels]; 182 float *ptr[channels];
183 #else
184 float **ptr = (float **)alloca(channels * sizeof(float));
185 #endif
170 size_t idx = i * _step; 186 size_t idx = i * _step;
171 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 187 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
172 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 188 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
173 for (int run = 0; run < 2; ++run) { 189 for (int run = 0; run < 2; ++run) {
174 Plugin::FeatureSet fs = p[run]->process(ptr, timestamp); 190 Plugin::FeatureSet fs = p[run]->process(ptr, timestamp);
210 for (int run = 0; run < 2; ++run) { 226 for (int run = 0; run < 2; ++run) {
211 auto_ptr<Plugin> p(load(key, rate)); 227 auto_ptr<Plugin> p(load(key, rate));
212 if (!initAdapted(p.get(), channels, _step, _step, r)) return r; 228 if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
213 if (!data) data = createTestAudio(channels, _step, count); 229 if (!data) data = createTestAudio(channels, _step, count);
214 for (size_t i = 0; i < count; ++i) { 230 for (size_t i = 0; i < count; ++i) {
231 #ifdef __GNUC__
215 float *ptr[channels]; 232 float *ptr[channels];
233 #else
234 float **ptr = (float **)alloca(channels * sizeof(float));
235 #endif
216 size_t idx = i * _step; 236 size_t idx = i * _step;
217 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; 237 for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx;
218 RealTime timestamp = RealTime::frame2RealTime(idx, rate); 238 RealTime timestamp = RealTime::frame2RealTime(idx, rate);
219 if (run == 1) timestamp = timestamp + RealTime::fromSeconds(10); 239 if (run == 1) timestamp = timestamp + RealTime::fromSeconds(10);
220 Plugin::FeatureSet fs = p->process(ptr, timestamp); 240 Plugin::FeatureSet fs = p->process(ptr, timestamp);