Don't destroy stereo history when switching to mono.
The first version of the mono decoder with stereo output collapsed the historic energy values stored for anti-collapse down to one channel (by taking the max). This means that a subsequent switch back would continue on using the the maximum of the two values instead of the original history, which would make anti-collapse produce louder noise (and potentially more pre-echo than otherwise). This patch moves the max into the anti_collapse function itself, and does not store the values back into the source array, so the full stereo history is maintained if subsequent frames switch back. It also fixes an encoder mismatch, which never took the max (assuming, apparently, that the output channel count would never change).
Loading
Please register or sign in to comment