The algorithm is now at v.5.2 after a bug fix in respect of the detection of the lhs chord endpoint ie near tone 40. The pseudocode for the paragraph determining x4, y4 code is now replaced by:
/* Algorithm v 5.2 */
uint x4 = find the x value for which y[ x ] = max( [ y[40], y[43], y45] ); /* test three points just above tone 40, find the highest y */
double y4 = y[ x4 ];
There was a stupid bug here before. We want to find the highest y so as to get the best vertical drop value into the middle of any hollow. Any stalactites just above x=40 are irrelevant because they won’t win in the ‘max y’ determination algorithm anyway, as stalactites go down not up.
This change was motivated by the need to handle the latest extremely severe late-stage HCD case. See below. Here’s the relevant picture of horror, line 4, at 288 kbps downstream, 350 kbps upstream. Weird shape, slightly, and it was this that required the small revision of the HCD detection algorithm to also this case, the lhs shape being odd.
The result is now successful:
--
* HCD:❗So-called ‘hollow curve disease’ (HCD) defect detected in the downstream SNR-vs-tones curve of link #4. Serious fault. 🔺
Link #4: Summary: tone 52 is 2.36932 dB below chord 2: (tones 40-62); ❗
Link #4: Details: chord 2: [ tone 40: 35.0625 dB; curve midpoint test tone 52: 28.875 dB; tone 62: 28.0625 dB ]; chord midpoint test tone 52: 31.24432 dB.
One minor annoyance that I’d like to correct is that while this is being reported as a failure against a chord 2 test, I suspect that it is could also be a failure against chord 1, and although there’s nothing wrong with the result, I’d prefer to report the chord 1 failure somehow where there’s a choice. Re-ordering the tests would fix this, as for some reason the code currently tests for chord 2 first, and first test wins. Moving blocks of code around is a nightmare in the iOS Shortcuts’ code editor and I’d have to think of some clever tricks to make it doable.
Note that unfortunately the picture below is from somewhat earlier today and the numbers don’t match those of the analysis above.