Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dolby Digital/DTS passthrough-decoding #432

Open
mirh opened this issue Jan 16, 2015 · 27 comments
Open

Dolby Digital/DTS passthrough-decoding #432

mirh opened this issue Jan 16, 2015 · 27 comments
Labels

Comments

@mirh
Copy link

mirh commented Jan 16, 2015

I have been lately discussing about PCSX2 and its multichannel audio support.

It seems it's not produced in realtime in-game (besides perhaps some experiments with 4.0 DTS?).. though some FMVs used to be encoded with 5.1

Now, I know pro logic is supported, but that's not real surround. I read rama once said we were waiting for proper decoders.
Then I read gigaherz claiming we cannot license any encoders...
But.. wtf? Why would we need to re-encode audio?

We would just need passthrough (just in case the user was indeed using S/PDIF) and decoding, for everybody else
Afaik FOSS decoders already exist for both standards.

Any idea?

@ramapcsx2
Copy link
Member

I'd say it will be difficult to pass the proper bitstream to decoders (hardware more so than software).
The source (PCSX2) will never deliver a steady stream so some kind of buffering will be required.
If that's given at the decoder side, then it could be done, I guess.
Such a decoder would need to have a compatible license and someone needs to include and attach it to the SPU2-X output. SPU2-X itself would need additions to properly detect a bitstream and pass it to the decoder.

@mirh
Copy link
Author

mirh commented Jan 16, 2015

I quickly found liba52 for DD and libdca for DTS.
Ideally then, AC3Filter/Spdifer should support both (including passthrough). I'm not so apt to really know which could be more or less suitable for PCSX2's needs though.
They are all licensed with GPL. So green light on that :)

Meanwhile, I even found a nice explanation about the process -including hardware offloading- under linux (I'm sure gregory38 will like this)

EDIT: ffmpeg also supports AC3

@gregory38
Copy link
Contributor

Be aware that GPL doesn't protect from patents. Liba52 and libdca seems fine but I don't know for ffmpeg.

I would personally prefer a nice and working implementation ;) Sound is already erratic enough on linux unfortunately...

@mirh
Copy link
Author

mirh commented Jan 25, 2015

I just posted as much as open-source stuff I could find. Liba52 and libdca would be already enough for pcsx2. Ffmpeg is just another option (we don't need dts-hd or dolby truehd after all).

Said this, I barely know the difference between pulseaudio and alsa.. so do what you believe it's better

@turtleli turtleli added the SPU2 label Jun 18, 2016
mirh referenced this issue Jun 18, 2016
It was copied over from SPU2ghz but never actually used.
@mirh
Copy link
Author

mirh commented Jun 18, 2016

Some insights on SPU2 accuracy here.

@MrCK1
Copy link
Member

MrCK1 commented Jun 18, 2016

Unfortunately using libdca may still violate DTS patents. Not sure how this affects ffmpeg

Found on VideoLan's website:

"Provisional Warning: DTS Inc. claims that use of libdca software, to decode DTS compressed sound data on a DVD could violate DTS's patent rights. If you are unsure about the legality of using and distributing this code in your country, in particular in the USA, please consult your lawyer before downloading it."

@mirh
Copy link
Author

mirh commented Jun 18, 2016

Ever heard of patent trolling?
It's no different than the mp3, or libdvdcss situation or h264 situation.
And even DMCA safeguards interoperability (and we aren't talking about encoding).

Said this, it seems libdca is quite outdated compared to libdcadec (for as much as PS2 emu shouldn't need anything past core DTS).
This in turns looks now totally merged in ffmpeg.

So.. if just @gigaherz had time :p
(I know, I'm mentioning him too much today)
EDIT: patents expired

@gigaherz
Copy link
Member

Doesn't matter -- I tried once, and failed epicly. My attempt not only failed to decode any audio, but it prevented all the dolby-enabled games I had from booting. I simply could not figure out the right bit rate that the spdif passthrough works at, or at least my attempts at doing so caused games to stop working. And either way, the data I managed to dump, was never accepted by the lib.

Also, I do have time, I just don't have the brainpower. working a full-time programming job leaves me braindead for the rest of the day. The only moments I have when I can think, are the weekends, and I don't really want to spend those in something like dolby. ;P

@mirh
Copy link
Author

mirh commented Jun 18, 2016

Well, given you would now have a reference implementation to compare, it should be quite easier (prolly still not easy).

Said this, we know the story, it's all in the logs I posted on the forums :)

@gigaherz
Copy link
Member

Reference implementations? Where? Did I miss something?

@mirh
Copy link
Author

mirh commented Jun 18, 2016

Not in the sense "specific to playstation 2", but as I said AC3 and DTS are pretty thoroughly documented standards.
And I believe it's far easier to make stuff work, when you don't have to decrypt an audio compression algorithm too, among other things.

@gigaherz
Copy link
Member

Yeah I never attempted to -- I did use liba52 in my attempt, I just failed at being able to provide liba52 with any sort of meaningful bitstream. Maybe things have changed, but I'm not really interested in trying again. ;P

@weirdbeardgame
Copy link
Contributor

weirdbeardgame commented Mar 4, 2020

@Filoppi
Copy link

Filoppi commented Dec 13, 2020

For your information, I'm reworking DPLII on Dolphin, and it's not been easy (I made some changes and fixes to FreeSurround).
https://github.com/Filoppi/dolphin/blob/audio-input-fixes/Externals/FreeSurround/include/FreeSurround/FreeSurroundDecoder.h
The dolphin decoder was taken from https://hydrogenaud.io/index.php?topic=52235.0 but adsp.freesurround is based on the same source, though it's probably cleaner and better.

@ThreeDeeJay
Copy link

I second FreeSurround, hands down
It's miles better than any alternative I've tested, even compared to the PCSX2 decoder setup (Audio Expansion Mode=Surround + SPU2-X.ini [OUTPUT] DplDecodingLevel=0).
In the meantime, there's EqualizerAPO/HeSuVi decoders that do an okay job, though. Here's some footage I recorded using them.

IMAGE ALT TEXT

IMAGE ALT TEXT

@ThreeDeeJay
Copy link

ThreeDeeJay commented Feb 17, 2023

It's been a while, and I know there's not a lot activity here, but since it's relevant, here's another, recent test: https://youtu.be/a5w-DzR0Xlg
IMAGE ALT TEXT

Still hoping for a FreeSurround implementation 👀🤞

@ISuckGood
Copy link

ISuckGood commented Feb 21, 2023

Ok its owrking only in rpcs3 . I thought it works for pcsx2 also .

@ThreeDeeJay
Copy link

@ISuckGood I think PS3 games use Dolby Digital/DTS, which output discrete 5.1 surround channels, as opposed to Dolby Pro-Logic II in PS2, where surround channels have to be extracted from a stereo signal.
I read some PS2 games use Dolby Digital, but apparently PCSX2 doesn't support it at all.

@MatiasMGz
Copy link

Any news?

@F0bes
Copy link
Member

F0bes commented Dec 28, 2023

No

@stenzek
Copy link
Contributor

stenzek commented Dec 28, 2023

@MMatiasMG please stop bumping issues, if there is anything to be seen, it's clearly visible.

@seta-san
Copy link
Contributor

For those worried about patents. Patents only last 20 years.

@stenzek
Copy link
Contributor

stenzek commented Feb 22, 2024

We are aware. I've brought the AC3/DTS patent situation up internally.

AFAIK it's still unknown how the bitstream is handled by the SPU. Someone would need to reverse that.

@Zoomer1988
Copy link

Zoomer1988 commented Mar 3, 2024

But the Dolby Prologic II decoding has nothing to do with the bitstream, right? Have you guys also been discussing using the aforementioned FreeSurround implementation in PCSX2?

After all, I think, it's somewhat more important than having a couple of cutscenes in surround sound that happen to have AC3 or DTS encoding? Some NFS games (including the exclusive version of NFS:HP2) and others, like Star Ocean, would greatly benefit from decoded DPLII. Especially in the light of the fact that this specific decoder nowadays falls more and more into obscurity.

@Ziemas
Copy link
Contributor

Ziemas commented Mar 3, 2024

But the Dolby Prologic II decoding has nothing to do with the bitstream, right?

Right, the freesurround discussion was off topic to this issue in the first place, this issue is about decoding the digital formats.

@Zoomer1988
Copy link

Zoomer1988 commented Mar 4, 2024

Yeah, fair enough. I've re-read the issue, and it's "Not a real surround" apparently.

It seems, though, that this is the only place, where DPLII is being actively and properly discussed at all with examples and the FreeSurround foobar DSP (the Dolphin implementation) is even mentioned.

Still, has nothing to do with digital stream decoding indeed. My bad, sorry.

@ThreeDeeJay
Copy link

Yeah, usually DPL decoding discussions were redirected here.
And in defense of DPL, while I agree matrix-encoded surround in stereo is inferior to raw/discrete channels because of inherent quality loss, I don't think it's fair or even accurate to say it's "not real surround" given it's decoded properly, like it does now after this update: https://youtu.be/fWIUJqPfpNA
(Just a heads up for anyone finding/watching this thread for DPL decoding. I'll refrain from discussing this here any further to let discussion focus on passthrough)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests