Change strategies for allocation hole prevention.
In commit ffe10574 JM added a "done" flag to the allocation interpolation loop: whenver a band did not have enough bits to pass its threshold for receiving PVQ pulses, all of the rest of band were given just enough bits for fine energy only. This patch implements JM's "backwards done" idea: instead work backwards, dropping bands until the first band that is over the threshold is encountered, and don't artificially reduce the allocation any more after that. This is much more stable: we can continue to signal manual skips if we want to, but we aren't forced to skip a large number of bands because of an isolated hole in he allocation. This makes low-bitrate 120-sample frames much less rough. It also reduces the force skip threshold from alloc_floor+(1<<BITRES)+1 to just alloc_floor+(1<<BITRES), because the former can now cascade to cause many bands to be skipped. The difference here is subtle, and increases signaling overhead by 0.11% of the total bitrate, but Monty confirmed that removing the +1 reduces noise in the bass (i.e., in N=1 bands where such a skip could cascade). Finally the 64*C<<BITRES<<LM ceiling is moved into the bisection search, instead of just being imposed afterwards, again because I wouldn't want to try to explain in a spec why they're different.
Please register or sign in to comment