Hi, all – I’ve been studying the Braids quantizer code and I’m wondering if anyone here can explain a very specific thing I don’t understand: why, after running
std::upper_bound to find the nearest pitch that’s larger than the pitch to be quantized, does it then (at line 86) check two other values before/below that pitch to see if they’re closer? Wouldn’t either the value (codeword) at
upper_bound_index or the one at
upper_bound_index - 1 always be closer to the input pitch than the one at
upper_bound_index - 2?
I’ve read enough of Émilie’s code to be sure she wrote it this way for a reason, but I haven’t figured it out so far.