Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st July 2003, 14:16   #1  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
A better Dolby Pro Logic II downmix

The Dolby Pro Logic II downmix used in programs such as Azid.dll, BeSweet, HeadAc3he and AC3Filter, was derived in this thread: http://forum.doom9.org/showthread.php?s=&threadid=27936

A test sample of 5 channels active one at a time, downmixed to 2 channels with this matrix, should be able to be decoded by a Dolby Pro Logic II decoder back to the original 5 channels. However, I have been disappointed by the rear channel separation of the current DPL2 downmix.

The rear channel separation can be improved by altering the 'balance' of the surround channel downmix while maintaining constant power. That is, BL is downmixed more to Lt, while BR is downmixed more to Rt. However, by skewing the balance too much to either side, we lose phase information, resulting in reduced front-back separation.

Here I describe a method for deriving a better DPL2 downmix

Methods
Contents of 5.1 AC3 test source 'Avia ac3test' (http://www.digital-digest.com/dvd/do.../trailers.html)
Code:
time (sec)	channel		contents (announcer says: )
12-14		L		'left front'
14-16		C		'centre'
16-18		R		'right front'
18-20		BR		'right surround'
20-22		BL		'left surround'
22-24		L		'LFE'
		LFE		[rumble]
'surround2' downmix
"C:\tmp\BeSweetv1.5b19\BeSweet.exe" -core( -input "c:\tmp\ac3test.DELAY 0ms.ac3" -output "c:\tmp\ac3test.surround2.wav" -2ch -logfilea "C:\tmp\BeSweetv1.5b19\BeSweet.log" ) -azid( -s surround2 -L -3db )

'4.8 dB' downmix
Using AC3Filter in GraphEdit. Exact values of surround downmix coefficients are SQRT(3/4) and SQRT(1/4). The surround power difference is triple, hence 4.8 dB

Lt = L + 0.7071 C + 0.7071 LFE - 0.866 BL - 0.5 BR
Rt = R + 0.7071 C + 0.7071 LFE + 0.5 BL + 0.866 BR

'6 dB' downmix
Lt = L + 0.7071 C + 0.7071 LFE - 0.8944 BL - 0.4472 BR
Rt = R + 0.7071 C + 0.7071 LFE + 0.4472 BL + 0.8944 BR


DPL2 decoding as per thread: http://forum.doom9.org/showthread.php?s=&threadid=57736

Notation of decoded channels: L' R' C' LFE' BL' BR'

Screenshots taken from Cool Edit Pro

Separation between channels calculated from difference in total RMS power of 2 sec segments

Results
Figures at http://www.geocities.com/bleo98

Figure 1: surround2 BL'
18-20 sec, BR leaks into BL'. Separation ~ 9 dB

Figure 2: 4.8 dB BL'
18-20 sec, more separation between BL' and BR' ~ 26 dB

Figure 3: 6 dB BL'
18-20 sec, even more separation between BL' and BR' ~ 31 dB

Figure 4: 6 dB L'
BUT! 20-22 sec, BL leaks into L'!

Figure 5: 4.8 dB L'
20-22 sec, no leakage of BL into L'

Discussion
The 4.8 dB downmix provides optimal separation of all 5 channels. I now use this matrix in AC3Filter, but should the azid.dll matrix be changed?

surround2 is quieter because the downmix coefficients were normalised to prevent arithmetic overload. The 4.8 dB and 6 dB coefficients are not normalised. Overload would only occur if all 6 channels were at full scale during EXACTLY the same time sample, which is highly unlikely. In fact, this did not occur during testing with the Lord of the Rings soundtrack.

The 'pulses' every two seconds are steering artifacts: a delay in steering inherent in the decoder's feedback design (?)

DPL2 cannot steer 5 independent channels simultaneously. For example, during 22-24 sec, L contains 'LFE' and LFE contains [rumble]. Note, LFE is supposed to be decoded to C'. However, DPL2 steers BOTH to L' AND C'.

Last edited by bleo; 27th July 2003 at 11:38.
bleo is offline   Reply With Quote
Old 24th July 2003, 23:48   #2  |  Link
Sycho
This Is How It Goes
 
Sycho's Avatar
 
Join Date: Mar 2003
Location: Ontario Canada
Posts: 235
good job, must to have been lots of work, but, would you be able to post the setting you used for decoding the stream
Sycho is offline   Reply With Quote
Old 25th July 2003, 02:05   #3  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
DPL2 decoder: InterVideo EXP DMO filter
Settings (as per standard Movie mode):
- Expansion: On
- Algorithm: ProLogic2
- Autobalance: on
- Surround channel shelf filter: off
- Rs polarity inversion: off
- Panorama mode: off
- Output channel config: 3/2
- Dimension setting: 3
- Decode mode: movie/standard mode
- Center width control setting: 0 (no spreading)
bleo is offline   Reply With Quote
Old 4th August 2003, 21:18   #4  |  Link
FuPP
TotalEclipseOfTheBrain
 
FuPP's Avatar
 
Join Date: Sep 2002
Posts: 347
I know that DG has left. Any chance though this "4.8db matrix" will be incorporated into besweet ?

FuPP.
FuPP is offline   Reply With Quote
Old 5th August 2003, 09:48   #5  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
You mean into azid.dll?

In the mean time, you can modify and compile DSPguru's plugin http://dspguru.notrace.dk/BS_Downmix.zip.

Unfortunately I don't know how to compile. Any help?

Code:
buffer[j]   =buffer[i++];					// fl. -> l.   
buffer[j]  +=buffer[i]  * 0.70710678118654752440084436210485; 	// c. -3db -> l.
buffer[j+1] =buffer[i++]* 0.70710678118654752440084436210485;	// c. -3dB -> r.
buffer[j+1]+=buffer[i++];					// fr. -> r.
buffer[j]  +=buffer[i]  *-0.86602540378443864676372317075294;	// sl -1.2dB -> l.
buffer[j+1]+=buffer[i++]* 0.5;					// sl -6dB -> r.
buffer[j]  +=buffer[i]  *-0.5;					// sr -6dB -> l.
buffer[j+1]+=buffer[i++]* 0.86602540378443864676372317075294;	// sr -1.2dB -> r.
// put LFE in here??
buffer[j]  +=buffer[i]  * 0.70710678118654752440084436210485; 	// lfe -3db -> l.
buffer[j+1]+=buffer[i++]* 0.70710678118654752440084436210485;	// lfe -3dB -> r.

Last edited by bleo; 9th August 2003 at 05:45.
bleo is offline   Reply With Quote
Old 5th August 2003, 15:22   #6  |  Link
frank
Banned
 
Join Date: Oct 2001
Location: https://t.me/pump_upp
Posts: 811
DPL2 decoders are built with (analogue) operational amplifiers, and complicated control circuits. You'll never get the same results with simplified Software Direct Show Filters.

I don't trust InterVideo. I trust my ears and hardware DPL2 decoders in Pioneer or Kenwood receivers. And they decode the BeSweet generated DPL2 tracks very fine.

The channel separation of DPL2 cannot reach the quality of AC3 tracks because of their analogue characteristics.

What we need are some measurements on hardware decoders.
frank is offline   Reply With Quote
Old 5th August 2003, 20:45   #7  |  Link
FuPP
TotalEclipseOfTheBrain
 
FuPP's Avatar
 
Join Date: Sep 2002
Posts: 347
@Frank
I have a hardware decoder (Onkio) but only my ears for measurements


@Bleo
I thought it was in besweet (as I don't use BS downmix plugin) and I thought That Midas did not update Azid for a long time (far before DG incorporated DS2) But you are probably right !

Sorry, but can't help you for compiling...

Regards,
FuPP
FuPP is offline   Reply With Quote
Old 6th August 2003, 11:44   #8  |  Link
frank
Banned
 
Join Date: Oct 2001
Location: https://t.me/pump_upp
Posts: 811
Yes, the DPL2 downmix is implemented in BeSweet, not in Azid.
Only DSPGuru can compile.
frank is offline   Reply With Quote
Old 6th August 2003, 12:39   #9  |  Link
Fr4nz
Registered User
 
Join Date: Feb 2003
Posts: 448
Frank could you have a look at this thread in the hydrogenaudio forum? http://www.hydrogenaudio.org/index.p...=0&#entry47454

In here it's stated that MP3 encodes badly surround informations altough in many other threads it's said that MP3 (LAME) preserves phase informations thanks to the safe joint stereo mode...anyway many people who have used LAME to encode movies AC3 audio in surround 1/2 says that lame is good also at --alt-preset 128 while others claim that only at high bitrates (for e.g. > --alt-preset insane(!!!)) Lame can reproduce surround informations decently. Could you clarify this point to me? Tnx!

ps: in my encoded soundtracks it quite good to me the --alt-preset standard for surround...

Last edited by Fr4nz; 6th August 2003 at 12:41.
Fr4nz is offline   Reply With Quote
Old 7th August 2003, 01:42   #10  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
Yes! We do need measurements from hardware decoders, which is why I posted here!

I was about to post some predownmixed AC3 test files but had some trouble finding webspace

However, the downmix is easy to test if your receiver is connected to your computer. Just use AC3Filter and the custom downmix!

[/edit]Actually, are there any DVD movies out there that have a premastered DPL2 soundtrack and a DD 5.1 soundtrack?

Last edited by bleo; 7th August 2003 at 11:00.
bleo is offline   Reply With Quote
Old 7th August 2003, 17:09   #11  |  Link
FuPP
TotalEclipseOfTheBrain
 
FuPP's Avatar
 
Join Date: Sep 2002
Posts: 347
if you have some short samples using normal matrix and 4.8 matrix, you could convert them to mp2 (bitrate = 192) and post them ; I will be able to burn them and test with my dvd player connected to the DPL2 receiver and tell you the result.

You are right though , I could do that myself using AC3filter and burn the result...

"are there any DVD movies out there that have a premastered DPL2 soundtrack and a DD 5.1 soundtrack".

A premastered DPL2 track from a DVD would not systematically be mixed from the 5.1 one, so I'm not convinced this is the best way to test and compare with one made using the 4.8dB matrix and a 5.1 track (I maybe did not get though...)

Cheers,
FuPP.
FuPP is offline   Reply With Quote
Old 7th August 2003, 22:29   #12  |  Link
Sycho
This Is How It Goes
 
Sycho's Avatar
 
Join Date: Mar 2003
Location: Ontario Canada
Posts: 235
I don't think there are any movies availble with a Dolby Surround Prologic II sound track, the only thing you can get readly avalible would probaly be GC PS2 XBOX games. there may be music discs out with DPL2
Sycho is offline   Reply With Quote
Old 8th August 2003, 17:13   #13  |  Link
Sycho
This Is How It Goes
 
Sycho's Avatar
 
Join Date: Mar 2003
Location: Ontario Canada
Posts: 235
Re: A better Dolby Pro Logic II downmix

Quote:
Originally posted by bleo
DPL2 cannot steer 5 independent channels simultaneously. For example, during 22-24 sec, L contains 'LFE' and LFE contains [rumble]. Note, LFE is supposed to be decoded to C'. However, DPL2 steers BOTH to L' AND C'. [/B]
That is why dolby does not want the LFE included in the downmix
Sycho is offline   Reply With Quote
Old 9th August 2003, 05:32   #14  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
Very good lateral thinking sycho! I didn't even think about this when I wrote it! So if I understand correctly, including LFE causes the sound field to collapse towards C'?

On the other hand, I don't want to miss out on those LFEs What to do? Yes I know DPL2 is already a huge compromise!
bleo is offline   Reply With Quote
Old 9th August 2003, 20:15   #15  |  Link
Sycho
This Is How It Goes
 
Sycho's Avatar
 
Join Date: Mar 2003
Location: Ontario Canada
Posts: 235
just don't worry about it, unless the LFE has simaler information as the left or right channel, again, it will be confused. It is a lot simplier if there is no LFE, sometimes the decoder will just lock on the bass, and it will turn into a Dolby Surround decoder again.

If its an action movie, it is kinda iffy weather or not to keep the LFE
If its a comedy keep it
Muscial, I wound'nt use it (the decoder may get confused)
drama, again, kinda iffy
Horror, again, iffy

But in the end, the only real way to try would be trial and error

PS. when i'm watch DVD in my little cinema of mine, all my speakers are set to large and sometime (well lots of times) i forget to turn on my sub (which is only feed the LFE) it's not that much of a difference, exept my parents screaming

Last edited by Sycho; 9th August 2003 at 20:17.
Sycho is offline   Reply With Quote
Old 18th August 2003, 12:28   #16  |  Link
Valex
Registered User
 
Join Date: Sep 2002
Posts: 144
@bleo

Very good! I'll update AC3Filter's downmix matrix in the next version.

But however I think that real DPLII downmixer is little more complicated thing that just a passive matrix downmixer so I consider all this as just a simple hack. .

I think that downmix coefficients depend on relative audio level in input channels. So it is needed to know coefficients as function of input levels:
Lt = L + 0.7 C + K1 * BL + K2 * BR
Rt = R + 0.7 C + K3 * BL + K4 * BR
where K1..K4 are functions of input levels.

To know this functions we need better to analyze encoder but not decoder.

Imagine that we have 2 signals at input: L with level lev_L and frequency f1 and BR with level lev_BR and frequency f2. After downmixing we have 2 signals Lt and Rt. Lt should contain f1 and f2 frequencies. Rt should contain only f2. We supposed that L level at output does not depends on anything (but we may be wrong), so f1 level in L should not depend on other channels level, but f2 level in Lt and Rt is nothing else that K2 and K4 coefficients! When changing f1 and f2 levels at input we can get K2 and K4 as functions K2(lev_L, lev_BR) and K4(lev_L, lev_BR) and then devise the total function!

I do not think that this functions are too complicated. It should be very simple. Somewhere at Dolby site I've read that DPLII encoder is rather simple thing but decoder is very complicated (it is why better to analyze the encoder).

@all
Anybody can make such a complicated experiment?
Valex is offline   Reply With Quote
Old 18th August 2003, 13:55   #17  |  Link
bleo
Registered User
 
Join Date: Jul 2003
Posts: 78
Yes this would be a good experiment! But of course, *IF* I could get my hands on a 'real' DPL2 encoder, finding out how it works should be easy!

Actually I don't think that a DPL2 encoder is complicated, except for the proper phase shifting rather than just phase inversion (?) I believe that the 'complication' arises because when mastering a 'real' DPL2 soundtrack, the producer in the studio has to monitor the downmix through a DPL2 encoder AND a DPL2 decoder (5:2:5 monitoring) and MANUALLY adjust the 5 input channel levels (NOT the downmix coefficients themselves) so that after all the matrixing and steering, the end result is to his liking.

So, without going to this trouble, I would be happy enough to use a "simple hack" constant passive matrix

One question: can we do these proper phase shifts?
bleo is offline   Reply With Quote
Old 18th August 2003, 15:26   #18  |  Link
Valex
Registered User
 
Join Date: Sep 2002
Posts: 144
I did not want to say that it is very complicated, I just wanted to say that it is not just a passive matrix. For example it may be something like CS encoding:
http://www.smartdev.com/CS-paper.html
(encoding system is at the bottom of this page, very simple...)

But of course, *IF* I could get my hands on a 'real' DPL2 encoder

Yes, it is a main problem.....
Valex is offline   Reply With Quote
Old 18th August 2003, 17:59   #19  |  Link
Sycho
This Is How It Goes
 
Sycho's Avatar
 
Join Date: Mar 2003
Location: Ontario Canada
Posts: 235
Quote:
Originally posted by bleo
One question: can we do these proper phase shifts?
theorecally: yes
easily: no

to do a 90 degree phase shif properly you need to take waht ever sound are going to be shifted and delay them by one 1/4 wave length of that sound, very hard to do for all frequences but it could be done on lets say anywhere from 1kHz - 4kHz and there should be not cancelation effect, the only reson for the phase shifts is, lets say you have 1.0 on the center channel and 1.0 total on the surround channels, well dump those through the downmix matrix (for simpicty dolby surround)

Lt = L(0) + 0.7071C(1) + 0.7071S(1) = 0.7071 - 0.7071 = 0
Rt = R(0) + 0.7071C(1) - 0.7071S(1) = 0.7071 + 0.7071 = 1

other than when you have the same thing on the centre and both suround you don't need a 90degree phase shift

but i know of no way of doing this on a computer except rendering the entire stream

PS. what some people do when doing there own dolby surround mixes is put a small delay in the sum of the surround going to the right channel and don't invert it ether
Sycho is offline   Reply With Quote
Old 18th August 2003, 21:31   #20  |  Link
Valex
Registered User
 
Join Date: Sep 2002
Posts: 144
@sycho
90 degree phase shift can be done at the IDCT stage. As you know the compressed data is fourier-transfrmed. Phase shift in frequency domain is just a 'rotation' of all complex frequency coeffitients, that for 90 degree shift is just swap of real and imaginary parts. So if we do this before the inverse fourier transform we can make this phase shift in all-frequencies range easily and without any processing cost!

So the only problem is to direct myself to rewrite the IDCT code. ...
Valex is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.