Mercurial > hg > svcore
comparison data/fileio/test/AudioFileReaderTest.h @ 1603:6d9881e59cc2 bqaudiostream
WMA test cases
author | Chris Cannam |
---|---|
date | Wed, 30 Jan 2019 14:30:49 +0000 |
parents | d2555df635ec |
children | dbd13eb7dad1 |
comparison
equal
deleted
inserted
replaced
1602:08a389e96582 | 1603:6d9881e59cc2 |
---|---|
112 // could probably pass it with a signal that sounds | 112 // could probably pass it with a signal that sounds |
113 // nothing like the original | 113 // nothing like the original |
114 maxLimit = 0.2; | 114 maxLimit = 0.2; |
115 rmsLimit = 0.1; | 115 rmsLimit = 0.1; |
116 | 116 |
117 } else if (format == "wma") { | |
118 | |
119 maxLimit = 0.05; | |
120 rmsLimit = 0.01; | |
121 | |
117 } else if (format == "mp3") { | 122 } else if (format == "mp3") { |
118 | 123 |
119 if (resampled && !gapless) { | 124 if (resampled && !gapless) { |
120 | 125 |
121 // We expect worse figures here, because the | 126 // We expect worse figures here, because the |
158 maxLimit = 0.06; | 163 maxLimit = 0.06; |
159 rmsLimit = 0.015; | 164 rmsLimit = 0.015; |
160 | 165 |
161 } else if (format == "aac") { | 166 } else if (format == "aac") { |
162 | 167 |
163 maxLimit = 0.1; | 168 maxLimit = 0.2; |
164 rmsLimit = 0.1; | 169 rmsLimit = 0.1; |
170 | |
171 } else if (format == "wma") { | |
172 | |
173 maxLimit = 0.05; | |
174 rmsLimit = 0.01; | |
165 | 175 |
166 } else if (format == "mp3") { | 176 } else if (format == "mp3") { |
167 | 177 |
168 // all mp3 figures are worse when not normalising | 178 // all mp3 figures are worse when not normalising |
169 maxLimit = 0.1; | 179 maxLimit = 0.1; |
225 foreach (QString filename, files) { | 235 foreach (QString filename, files) { |
226 for (int rate: readRates) { | 236 for (int rate: readRates) { |
227 for (bool norm: norms) { | 237 for (bool norm: norms) { |
228 for (bool gapless: gaplesses) { | 238 for (bool gapless: gaplesses) { |
229 | 239 |
230 if (format != "mp3" && !gapless) { | 240 #ifdef Q_OS_WIN |
231 continue; | 241 if (format == "aac") { |
242 if (gapless) { | |
243 // Apparently no support for AAC | |
244 // encoder delay compensation in | |
245 // MediaFoundation, so these tests | |
246 // are only available non-gapless | |
247 continue; | |
248 } | |
249 } else if (format != "mp3") { | |
250 if (!gapless) { | |
251 // All other formats but mp3 are | |
252 // intrinsically gapless, so we | |
253 // can skip the non-gapless option | |
254 continue; | |
255 } | |
232 } | 256 } |
257 #else | |
258 if (format != "mp3") { | |
259 if (!gapless) { | |
260 // All other formats but mp3 are | |
261 // intrinsically gapless | |
262 // everywhere except for Windows | |
263 // (see above), so we can skip the | |
264 // non-gapless option | |
265 continue; | |
266 } | |
267 } | |
268 #endif | |
233 | 269 |
234 QString desc = testName | 270 QString desc = testName |
235 (format, filename, rate, norm, gapless); | 271 (format, filename, rate, norm, gapless); |
236 | 272 |
237 QTest::newRow(strOf(desc)) | 273 QTest::newRow(strOf(desc)) |
304 sv_frame_t read = test.size() / channels; | 340 sv_frame_t read = test.size() / channels; |
305 | 341 |
306 bool perceptual = (extension == "mp3" || | 342 bool perceptual = (extension == "mp3" || |
307 extension == "aac" || | 343 extension == "aac" || |
308 extension == "m4a" || | 344 extension == "m4a" || |
345 extension == "wma" || | |
309 extension == "opus"); | 346 extension == "opus"); |
310 | 347 |
311 if (perceptual && !gapless) { | 348 if (perceptual && !gapless) { |
312 // allow silence at start and end | 349 // allow silence at start and end |
313 QVERIFY(read >= refFrames); | 350 QVERIFY(read >= refFrames); |
381 | 418 |
382 // Anyway, mp3s should have 0 offset in gapless mode and | 419 // Anyway, mp3s should have 0 offset in gapless mode and |
383 // "something else" otherwise. | 420 // "something else" otherwise. |
384 | 421 |
385 if (gapless) { | 422 if (gapless) { |
386 if (format == "aac") { | 423 if (format == "aac" |
424 #ifdef Q_OS_WIN | |
425 || (format == "mp3" && (readRate != fileRate)) | |
426 #endif | |
427 ) { | |
387 // ouch! | 428 // ouch! |
388 if (offset == -1) offset = 0; | 429 if (offset == -1) offset = 0; |
389 } | 430 } |
390 QCOMPARE(offset, 0); | 431 QCOMPARE(offset, 0); |
391 } | 432 } |