[FFmpeg-devel] [PATCH] rematrix DPLII fix for channel downmixing. Surround now adds to front rather than taking away.

Peter Robertson Peter at CorrosiveTruths.org
Sat Mar 15 21:58:05 CET 2014


On 15/03/14 19:56, Michael Niedermayer wrote:
> On Sat, Mar 15, 2014 at 07:02:00PM +0000, Peter Robertson wrote:
>> On 15/03/14 18:00, Michael Niedermayer wrote:
>>> On Sat, Mar 15, 2014 at 05:51:09PM +0100, Hendrik Leppkes wrote:
>>>> On Sat, Mar 15, 2014 at 4:46 PM, Peter Robertson
>>>> <Peter at corrosivetruths.org> wrote:
>>>>> This fixes a problem where trying to convert gameplay sound to Dolby Pro
>>>>> Logic II would result in a left channel that would be missing the sounds
>>>>> that were in center and back left at the same time. I also applied it to
>>>>> Dolby Pro Logic as it should work the same way. Sorry if I've done
>>>>> anything wrong, first patch. Fixes #3455
>>>>>
>>>> The encoding matrix for DPL/DPLII is defined by Dolby, and only sounds
>>>> good if you use a DPL compatible decoder to reconstruct the original
>>>> signal.
>>>> Its not necessarily supposed to be played as stereo through stereo speakers.
>>>>
>>>> All Information I could find about DPL encoding suggests that the
>>>> implementation is correct as it is today. Left channel subtracts both
>>>> surrounds, and right channel adds them.
>>> The EAC-3 specs suggested downmix also seems to match this
>>>
>>> [...]
>>>
>>>
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> Could you point me at them? Might help me figure out what's going wrong.
>>
>> Like I think the amounts are wrong.
>>
>>                 matrix[FRONT_LEFT ][BACK_LEFT ] -= s->slev * SQRT3_2;
>>                 matrix[FRONT_LEFT ][BACK_RIGHT] -= s->slev * M_SQRT1_2;
>>                 matrix[FRONT_RIGHT][BACK_LEFT ] += s->slev * M_SQRT1_2;
>>                 matrix[FRONT_RIGHT][BACK_RIGHT] += s->slev * SQRT3_2;
>>
>> Doesn't seem right; I thought it was sqrt of either 6/25 or 19/25 rather
>> than 1/2 3/2.
> the equations in (e)ac3 that i found: (these dont cover this second
> case, only the first)
>
>
>     if (output_mode == 2/0 Dolby Surround compatible)
>     /* 2 ch matrix encoded output requested */
>     {
>         if (input_nfront != 2)
>         {
>                 mix center into left with -3 dB gain ;
>                 mix center into right with -3 dB gain ;
>         }
>         if (input_nrear == 1)
>         {
>                 mix -mono surround into left with -3 dB gain ;
>                 mix mono surround into right with -3 dB gain ;
>         }
>         else if (input_nrear == 2)
>         {
>                 mix -left surround into left with -3 dB gain ;
>                 mix -right surround into left with -3 dB gain ;
>                 mix left surround into right with -3 dB gain ;
>                 mix right surround into right with -3 dB gain ;
>         }
>
>
> And
>
>         Prior to the scaling needed to prevent overflow, the 3/2 downmix equations for an LtRt stereo
>     signal are
>                             Lt = 1.0 * L + 0.707 * C - 0.707 * Ls - 0.707 * Rs ;
>                             Rt = 1.0 * R + 0.707 * C + 0.707 * Ls + 0.707 * Rs ;
>
>
>                             [...]
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
I can't find the source I was thinking about, but there is this document:

http://www.dolby.com/uploadedFiles/Assets/US/Doc/Professional/pa_ch_0408_DP563QSG.pdf

Which has a side-by-side table on the first page in the panel called
'Lt/Rt Output Levels' with the following information.

Pro Logic II Encoding

Left 0 dB <–60 dB
Right <–60 dB 0 dB
Center –3 dB –3 dB
Ls –1.2 dB –6.2 dB
Rs –6.2 dB –1.2 dB
LFE 0 dB 0 dB

Next to this is a table showing Dolby Surround encoding with -3 db so
I'm guessing -3 db to Ls and Rs are more generic settings, with the -1.2
dB and -6.2 db specifically for DPL2?

In terms of actually using these values for the downmix, this does fix
my problem #3455.


More information about the ffmpeg-devel mailing list