opusenc, opusdec: add option to disable phase inversion
Submitted by Hector Martin
When downmixing stereo streams to mono, having phase inversion enabled produces terrible audio quality (it sounds like a low bitrate MP3), since frequency bands randomly cancel out. This should be exposed in the encoder (to produce bitstreams that always sound good when downmixed to mono, regardless of what the decoder does), and in the decoder (to allow any arbitrary bitstream to sound good when downmixed to mono, regardless of what the encoder did). On the decoder, additionally, it should probably default to disabled (i.e. OPUS_SET_PHASE_INVERSION_DISABLED(1)) when the output channel count is 1.
Here's a sample of just how bad decoding opus to mono without this enabled sounds: https://mrcn.st/t/opus_decoding_test.ogg . This is 6 seconds of stereo decoding, 3 seconds of mono decoding, repeatedly. The input bitstream is the same in both cases, with phase inversion enabled, as is the case right now in gstreamer. It gets really bad at 0:50 or so.