comparison data/fileio/test/AudioFileReaderTest.h @ 1309:2e7fcdd5f627 mp3-gapless

Test fixes
author Chris Cannam
date Tue, 29 Nov 2016 14:35:27 +0000
parents 80c77916fe85
children ff9697592bef
comparison
equal deleted inserted replaced
1308:80c77916fe85 1309:2e7fcdd5f627
118 double meanLimit = 0.001; 118 double meanLimit = 0.001;
119 double edgeLimit = maxLimit * 10; // in first or final edgeSize frames 119 double edgeLimit = maxLimit * 10; // in first or final edgeSize frames
120 int edgeSize = 100; 120 int edgeSize = 100;
121 121
122 if (nominalDepth < 16) { 122 if (nominalDepth < 16) {
123 maxLimit *= 2; 123 maxLimit = 0.02;
124 meanLimit *= 20; 124 meanLimit = 0.02;
125 } else if (extension == "ogg" || extension == "mp3") { 125 } else if (extension == "ogg" || extension == "mp3") {
126 maxLimit *= 10; 126 maxLimit = 0.1;
127 meanLimit *= 10; 127 meanLimit = 0.035;
128 edgeLimit = maxLimit * 3; 128 edgeLimit = maxLimit * 3;
129 } else if (extension == "aac" || extension == "m4a") { 129 } else if (extension == "aac" || extension == "m4a") {
130 maxLimit *= 30; // seems max diff can be quite large here 130 maxLimit = 0.3; // seems max diff can be quite large here
131 // even when mean is fairly small 131 // even when mean is fairly small
132 meanLimit *= 10; 132 meanLimit = 0.01;
133 edgeLimit = maxLimit * 3; 133 edgeLimit = maxLimit * 3;
134 } 134 }
135 135
136 // And we ignore completely the last few frames when upsampling 136 // And we ignore completely the last few frames when upsampling
137 int discard = 1 + int(round(readRate / nominalRate)); 137 int discard = 1 + int(round(readRate / nominalRate));
196 } 196 }
197 } 197 }
198 } 198 }
199 199
200 // check for spurious material at end 200 // check for spurious material at end
201 for (int i = refFrames; i + offset < read; ++i) { 201 for (sv_frame_t i = refFrames; i + offset < read; ++i) {
202 int ix = i + offset; 202 sv_frame_t ix = i + offset;
203 float quiet = 1e-6; 203 float quiet = 1e-6f;
204 float mag = fabsf(test[ix * channels + c]); 204 float mag = fabsf(test[ix * channels + c]);
205 if (mag > quiet) { 205 if (mag > quiet) {
206 cerr << "ERROR: audiofile " << audiofile << " contains spurious data after end of reference (found sample " << test[ix * channels + c] << " at index " << ix << " of channel " << c << ")" << endl; 206 cerr << "ERROR: audiofile " << audiofile << " contains spurious data after end of reference (found sample " << test[ix * channels + c] << " at index " << ix << " of channel " << c << ")" << endl;
207 QVERIFY(mag < quiet); 207 QVERIFY(mag < quiet);
208 } 208 }