[FFmpeg-devel] [PATCH 4/4] opus: Don't invert phase when downmixing to mono (per RFC8251)

James Almer jamrial at gmail.com
Tue Dec 5 00:25:41 EET 2017


On 12/4/2017 4:39 AM, Rostislav Pehlivanov wrote:
> On 2 December 2017 at 17:46, Andrew D'Addesio <modchipv12 at gmail.com> wrote:
> 
>> When decoding to downmixed mono, don't put the channels out of phase,
>> as they will cancel out and create audible artifacts. (See
>> RFC 8251 sec. 10.)
>>
>> Signed-off-by: Andrew D'Addesio <modchipv12 at gmail.com>
>> ---
>>  libavcodec/opus_pvq.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
>> index 2f7aa74..f18c010 100644
>> --- a/libavcodec/opus_pvq.c
>> +++ b/libavcodec/opus_pvq.c
>> @@ -643,7 +643,13 @@ static av_always_inline uint32_t
>> quant_band_template(CeltPVQ *pvq, CeltFrame *f,
>>                  }
>>              } else {
>>                  inv = (b > 2 << 3 && f->remaining2 > 2 << 3) ?
>> ff_opus_rc_dec_log(rc, 2) : 0;
>> +
>> +                /* Don't put the channels out of phase if we are decoding
>> to downmixed
>> +                 * mono as this subjectively sounds bad (RFC 8251 section
>> 10). */
>> +                if (f->channels == 1)
>> +                    inv = 0;
>>              }
>> +
>>              itheta = 0;
>>          }
>>          qalloc = opus_rc_tell_frac(rc) - tell;
>> --
>> 2.15.1.windows.2
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 
> RFC8251 made this optional, pushed a new version which added an option to
> toggle this.

Valgrind complains about your changes in 1b8649c2ce. Conditional jump or
move depends on uninitialised value(s).

http://fate.ffmpeg.org/report.cgi?time=20171204200723&slot=x86_64-archlinux-gcc-valgrind


More information about the ffmpeg-devel mailing list