Emulator Issues #9047

Dolby ProLogic II does not dematrix correctly

Added by LAGonauta over 3 years ago. Updated 3 days ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


Hello everyone,
Recently I got myself a AVR with Dolby ProLogic II decoding and noticed how different it was from the one on Dolphin. The sound was far more precise with no bugs. While playing Zelda: TP using Dolphin decoding sometimes in the sky temple my footstep would incorrectly map to the back speakers (it depended on the footstep type of sound), but this did not happen when using my AVR to decode the sound.
I then downloaded various Dolby ProLogic II samples to compare the FFDShow decoder with my AVR... Instant difference. FFDShow has some steering between the back channels, but it feels more like Dolby ProLogic (mono surround). For simple samples the AVR has almost discreet channel separation.
I tried to find a better open source solution, but found none. I implemented pcsx2 decoder on Dolphin but felt it was worse than ffdshow's.
Then I stumbled upon Foobar2000's component Free Surround. It is open source (GPLv2) and on my tests it decoded perfectly my test samples. Someone needs to implement this as a DirectShow and GStreamer filter, really! It is really good.

Anyway, I am far from being a good programmer so maybe someone more skilled is willing to change the decoder on Dolphin to this one if the license is compatible. I looked at the code and shouldn't be too difficult for someone that knows what he is doing. Is GPLv2 compatible with the one used on Dolphin?

The component and source can be downloaded from here:

dplii_sample.7z (4.21 MB) dplii_sample.7z Dolby ProLogic II sample from Zelda: TP LAGonauta, 10/26/2015 08:30 PM
dplii_sample_decoded_free_surround.7z (3.41 MB) dplii_sample_decoded_free_surround.7z LAGonauta, 10/26/2015 09:13 PM
dplii_sample_decoded_ffdshow.7z (4.43 MB) dplii_sample_decoded_ffdshow.7z LAGonauta, 10/26/2015 09:36 PM


#1 Updated by theincrediblemastere over 3 years ago

If it isn't too much to ask, mind giving us a recording?

Proof of concept is a good thing around these parts.

#2 Updated by delroth over 3 years ago

GPLv2+ is compatible with Dolphin, so we could integrate that.

I'm not completely clear on what you're comparing though. Basically, you're taking the audio dump from Dolphin and using several ways to do DPL2 decoding on that same dump?

#3 Updated by LAGonauta over 3 years ago

Actually I am comparing most of them directly.

The decoding using ffdshow's method (this is the one integrated in dolphin) is doing something wrong to the audio signal and making it sound the way it wasn't meant to sound.
I also integrated the decoding code from PCSX2 to Dolphin to compare real time decoding as I had read that it was better than FFDShow's, but it turned out to be worse.
I tested my AVR decoding (Dolby approved) connecting my computer's HDMI cable to it.

The decoding from foobar2000's DSP plugin was tested taking an audio dump. I also ran this dump on GraphStudioNext to force the use of ffdshow's decoding to be sure that it is not a bug introduced on the code used by Dolphin.
In Zelda: TP the surround effect is very good, I will take an audio dump from it and post it here later today. Sadly I do not know how to record 5.1 audio so one would need to install foobar2000 and the DSP plugin to test "Free Surround" algorithm, and ffdshow codec to test ffdshow's algorithm.

The link that I posted from hydrogenaudio has a Dolby ProLogic II encoded sample (channelcheck.mp3), it is perfect for simple comparisons between all decoding methods.

#4 Updated by delroth over 3 years ago

If you feel like working on integrating that code I have no objection. I'm not sure if many active developers are interested in the feature enough to work on it themselves, but if you care and have the knowledge to do it, sending a patch will likely make it happen.

#5 Updated by LAGonauta over 3 years ago

Here it is, a video dump, an audio dump and both merged.

I merged with ffmpeg, but for some reason the video file ended up with 14s (it should be 16s) so it is not perfectly synchronized.

How to test:
1 - Play the file on your AVR with Dolby ProLogic II decoding
2 - Play with ffdshow installed, enable Dolby decoding and force the use of the codec. On MPC this can be easily done by forcing its use on "External Filters"
3 - Play the audio sample using foobar2000 with the "Free Surround" DSP enabled.

#6 Updated by LAGonauta over 3 years ago

I just discovered it is possible to write to disk the output from foobar2000.

Here is the sample decoded for those who do not want to install it.

#7 Updated by LAGonauta over 3 years ago

Sorry for another post. I just discovered how to decode and write a file using GraphSudioNext. I decoded the sample using ffdshow and uploaded it here.

If you compare both you will clearly hear the difference, and how ffdshow's surround decoding is almost mono. This is the one used in Dolphin.

#8 Updated by theincrediblemastere over 3 years ago

Does a GameCube Service Disc have a test suite, or anything else for any of the sort, for ProLogic II? I feel he may be onto something here.

#9 Updated by LAGonauta over 3 years ago

Just checked, it can only test Left, Center, Right and Disc Streaming.
When emulating on Dolphin (tested with r8062, Direct3D11 and LLE with WiiU's DSP ROM) there are lots of error messages, and for some reason the sound test doesn't work correctly on the OpenAL backend (tested with X-Fi Titanium and OpenAL Soft), only on XAudio2. It seems that the buffers are not played fast enough.

I looked through "Free Surround" source code to try to implement the algorithm on Dolphin, and it is definitely too much for my current skills. Maybe in 1-2 years I might be able to do something unless someone does it before.

#10 Updated by theincrediblemastere over 3 years ago

I sure hope somebody picks this up. Why have a surround sound feature when it's broken?

delroth @JMC4789

#11 Updated by eckso about 3 years ago

Would be great if this is corrected for 5.0

#12 Updated by LAGonauta over 2 years ago

Anyone working on this already?

I managed to capture a sample with proper A/V sync using nVidia's utility, if anyone is interested the file can be downloaded here:!o0dHjRBI!_w-By4njDo4wgiYoKmuslghxZtGqTwPZdCA3LaOxODQ

The first audio track is DPL2 encoded, and the second audio track is the first track decoded into 5.1 channels using foobar2000. With this sample it is far easier to see how better FreeSurround algorithm is compared to FFDShow.

The FreeSurround from Kodi does not depend on boost and seems to be easier for me to understand, so I will try to implement it on Dolphin if no one else is doing so already.

Kodi's FreeSurround plugin source code:

#13 Updated by 618116 over 2 years ago

I'm currently working on this issue, but I'm not sure when I could finish because of my own job.
Yes, Kodi plugin source code is more understandable, however there is a small problem that audio buffer of Kodi is not multiplexed, so the code cannot be used to Dolphin directly.
I'll post again when I have another progression.

#14 Updated by LAGonauta over 2 years ago

OK, thanks.
For those interested, I made another video but now from Super Mario Sunshine. On this sample FreeSurround literally destroys the FFDShow decoder, and I even feel it is a little better than my Dolby-approved reference software-decoder (PowerDVD7).

FFDShow even sends the sounds of the ocean waves to the back speakers, while both FreeSurround and the reference send only the drums to them.!91U2lQgQ!u9qDoeanP1OORYqHCpvNgeVNtlKn7CKPrdW_IURIrms

#15 Updated by JosJuice 3 days ago

  • Fixed in set to 5.0-9608
  • Status changed from New to Fixed

Also available in: Atom PDF