comparison data/fileio/test/AudioFileReaderTest.h @ 1605:d83ab62cdc28

Merge from branch bqaudiostream
author Chris Cannam
date Wed, 30 Jan 2019 14:57:12 +0000
parents 6d9881e59cc2
children dbd13eb7dad1
comparison
equal deleted inserted replaced
1586:841b2a3e606d 1605:d83ab62cdc28
96 // actually further from the original if normalised 96 // actually further from the original if normalised
97 97
98 maxLimit = 0.1; 98 maxLimit = 0.1;
99 rmsLimit = 0.03; 99 rmsLimit = 0.03;
100 100
101 } else if (format == "opus") {
102
103 maxLimit = 0.06;
104 rmsLimit = 0.015;
105
101 } else if (format == "aac") { 106 } else if (format == "aac") {
102 107
103 // Terrible performance for this test, load of spill 108 // Terrible performance for this test, load of spill
104 // from one channel to the other. I guess they know 109 // from one channel to the other. I guess they know
105 // what they're doing, it's perceptual after all, but 110 // what they're doing, it's perceptual after all, but
107 // could probably pass it with a signal that sounds 112 // could probably pass it with a signal that sounds
108 // nothing like the original 113 // nothing like the original
109 maxLimit = 0.2; 114 maxLimit = 0.2;
110 rmsLimit = 0.1; 115 rmsLimit = 0.1;
111 116
117 } else if (format == "wma") {
118
119 maxLimit = 0.05;
120 rmsLimit = 0.01;
121
112 } else if (format == "mp3") { 122 } else if (format == "mp3") {
113 123
114 if (resampled && !gapless) { 124 if (resampled && !gapless) {
115 125
116 // We expect worse figures here, because the 126 // We expect worse figures here, because the
146 if (format == "ogg") { 156 if (format == "ogg") {
147 157
148 maxLimit = 0.06; 158 maxLimit = 0.06;
149 rmsLimit = 0.03; 159 rmsLimit = 0.03;
150 160
161 } else if (format == "opus") {
162
163 maxLimit = 0.06;
164 rmsLimit = 0.015;
165
151 } else if (format == "aac") { 166 } else if (format == "aac") {
152 167
153 maxLimit = 0.1; 168 maxLimit = 0.2;
154 rmsLimit = 0.1; 169 rmsLimit = 0.1;
170
171 } else if (format == "wma") {
172
173 maxLimit = 0.05;
174 rmsLimit = 0.01;
155 175
156 } else if (format == "mp3") { 176 } else if (format == "mp3") {
157 177
158 // all mp3 figures are worse when not normalising 178 // all mp3 figures are worse when not normalising
159 maxLimit = 0.1; 179 maxLimit = 0.1;
215 foreach (QString filename, files) { 235 foreach (QString filename, files) {
216 for (int rate: readRates) { 236 for (int rate: readRates) {
217 for (bool norm: norms) { 237 for (bool norm: norms) {
218 for (bool gapless: gaplesses) { 238 for (bool gapless: gaplesses) {
219 239
220 if (format != "mp3" && !gapless) { 240 #ifdef Q_OS_WIN
221 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 }
222 } 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
223 269
224 QString desc = testName 270 QString desc = testName
225 (format, filename, rate, norm, gapless); 271 (format, filename, rate, norm, gapless);
226 272
227 QTest::newRow(strOf(desc)) 273 QTest::newRow(strOf(desc))
293 339
294 sv_frame_t read = test.size() / channels; 340 sv_frame_t read = test.size() / channels;
295 341
296 bool perceptual = (extension == "mp3" || 342 bool perceptual = (extension == "mp3" ||
297 extension == "aac" || 343 extension == "aac" ||
298 extension == "m4a"); 344 extension == "m4a" ||
345 extension == "wma" ||
346 extension == "opus");
299 347
300 if (perceptual && !gapless) { 348 if (perceptual && !gapless) {
301 // allow silence at start and end 349 // allow silence at start and end
302 QVERIFY(read >= refFrames); 350 QVERIFY(read >= refFrames);
303 } else { 351 } else {
370 418
371 // Anyway, mp3s should have 0 offset in gapless mode and 419 // Anyway, mp3s should have 0 offset in gapless mode and
372 // "something else" otherwise. 420 // "something else" otherwise.
373 421
374 if (gapless) { 422 if (gapless) {
375 if (format == "aac") { 423 if (format == "aac"
424 #ifdef Q_OS_WIN
425 || (format == "mp3" && (readRate != fileRate))
426 #endif
427 ) {
376 // ouch! 428 // ouch!
377 if (offset == -1) offset = 0; 429 if (offset == -1) offset = 0;
378 } 430 }
379 QCOMPARE(offset, 0); 431 QCOMPARE(offset, 0);
380 } 432 }