annotate data/model/test/Compares.h @ 1196:c7b9c902642f spectrogram-minor-refactor

Fix threshold in spectrogram -- it wasn't working in the last release. There is a new protocol for this. Formerly the threshold parameter had a range from -50dB to 0 with the default at -50, and -50 treated internally as "no threshold". However, there was a hardcoded, hidden internal threshold for spectrogram colour mapping at -80dB with anything below this being rounded to zero. Now the threshold parameter has range -81 to -1 with the default at -80, -81 is treated internally as "no threshold", and there is no hidden internal threshold. So the default behaviour is the same as before, an effective -80dB threshold, but it is now possible to change this in both directions. Sessions reloaded from prior versions may look slightly different because, if the session says there should be no threshold, there will now actually be no threshold instead of having the hidden internal one. Still need to do something in the UI to make it apparent that the -81dB setting removes the threshold entirely. This is at least no worse than the previous, also obscured, magic -50dB setting.
author Chris Cannam
date Mon, 01 Aug 2016 16:21:01 +0100
parents 9f4505ac9072
children 48e9f538e6e9
rev   line source
Chris@1086 1
Chris@1086 2 #ifndef TEST_COMPARES_H
Chris@1086 3 #define TEST_COMPARES_H
Chris@1086 4
Chris@1086 5 // These macros are used for comparing generated results, and they
Chris@1086 6 // aren't always going to be exact. Adding 0.1 to each value gives
Chris@1086 7 // us a little more fuzz in qFuzzyCompare (which ultimately does
Chris@1086 8 // the comparison).
Chris@1086 9
Chris@1086 10 #define COMPARE_ZERO(a) \
Chris@1086 11 QCOMPARE(a + 0.1, 0.1)
Chris@1086 12
Chris@1086 13 #define COMPARE_ZERO_F(a) \
Chris@1086 14 QCOMPARE(a + 0.1f, 0.1f)
Chris@1086 15
Chris@1086 16 #define COMPARE_FUZZIER(a, b) \
Chris@1086 17 QCOMPARE(a + 0.1, b + 0.1)
Chris@1086 18
Chris@1086 19 #define COMPARE_FUZZIER_F(a, b) \
Chris@1086 20 QCOMPARE(a + 0.1f, b + 0.1f)
Chris@1086 21
Chris@1086 22 #define COMPARE_ALL_TO(a, n) \
Chris@1086 23 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 24 COMPARE_FUZZIER(a[cmp_i], n); \
Chris@1086 25 }
Chris@1086 26
Chris@1086 27 #define COMPARE_ALL(a, b) \
Chris@1086 28 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 29 COMPARE_FUZZIER(a[cmp_i], b[cmp_i]); \
Chris@1086 30 }
Chris@1086 31
Chris@1086 32 #define COMPARE_SCALED(a, b, s) \
Chris@1086 33 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 34 COMPARE_FUZZIER(a[cmp_i] / s, b[cmp_i]); \
Chris@1086 35 }
Chris@1086 36
Chris@1086 37 #define COMPARE_ALL_TO_F(a, n) \
Chris@1086 38 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 39 COMPARE_FUZZIER_F(a[cmp_i], n); \
Chris@1086 40 }
Chris@1086 41
Chris@1086 42 #define COMPARE_ALL_F(a, b) \
Chris@1086 43 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 44 COMPARE_FUZZIER_F(a[cmp_i], b[cmp_i]); \
Chris@1086 45 }
Chris@1086 46
Chris@1086 47 #define COMPARE_SCALED_F(a, b, s) \
Chris@1086 48 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@1086 49 COMPARE_FUZZIER_F(a[cmp_i] / s, b[cmp_i]); \
Chris@1086 50 }
Chris@1086 51
Chris@1086 52 #endif