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

Break out the Atrac3/Atrac3+ decoders from FFMPEG to a separate library #19033

Merged
merged 31 commits into from
Apr 11, 2024

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Apr 11, 2024

Followup to #19026

I grabbed a chunk of ffmpeg, then pared it down to only contain the decoders themselves, plus some math utils and stuff.

This I put in /ext/at3_standalone, and it's exposed by a very simple interface in /ext/at3_standalone/at3_decoders.h

Also, we now use this instead of FFMPEG for decoding music in the menu, and wherever SimpleDecoder was previously used for AT3 playback (sceAudiocodec, MediaEngine video playback).

It's not yet used for background music in-game, porting sceAtrac to use this instead of ffmpeg will be a bigger job. But worthwhile, since we'll be able to debug much easier now.

This is one more step towards getting rid of our huge pre-built FFMPEG as a dependency. Much work remains. Also this isn't yet using SIMD so might be slightly slower than the ffmpeg build.

EDIT: Profiled a little bit, it's not really substantially slower. The functions decode_qu_spectra and ff_atrac3p_ipqf are the hotspot and the former is a huffman decoder, so not very easy to optimize. The latter though is very SIMD-able.

@hrydgard hrydgard added the Atrac3+ Issue involves sceAtrac features. label Apr 11, 2024
@hrydgard hrydgard added this to the v1.18.0 milestone Apr 11, 2024
@hrydgard hrydgard marked this pull request as ready for review April 11, 2024 12:50
@hrydgard hrydgard marked this pull request as draft April 11, 2024 13:51
@hrydgard
Copy link
Owner Author

Noticed a crash in crisis core, converting to draft.

@hrydgard hrydgard marked this pull request as ready for review April 11, 2024 14:30
@hrydgard hrydgard merged commit 3f09e43 into master Apr 11, 2024
18 checks passed
@hrydgard hrydgard deleted the at3-standalone branch April 11, 2024 14:34
@hrydgard hrydgard added the Code Cleanup Cleanup to make future work easier. Needs to be done sometimes. label Apr 11, 2024
@LunaMoo
Copy link
Collaborator

LunaMoo commented Apr 11, 2024

Is the same planned to encoders?(Recording feature)
I guess the plan is to unify experience and stop linux users break theirs by using system ffmpeg^_^;.

@hrydgard
Copy link
Owner Author

hrydgard commented Apr 11, 2024

Encoders no, I think we'll still gonna use ffmpeg for that, or OS-native encoders - or remove encoding and leave it to OBS, although there are some arguments that we shouldn't - no decision there. There's nothing to stop us from still linking ffmpeg just for encoding features.

And yes, getting rid of bugs and bug reports caused by weird combinations of system ffmpegs is definitely a big goal! But the biggest goal is to make debugging and working on decoder stuff easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Atrac3+ Issue involves sceAtrac features. Code Cleanup Cleanup to make future work easier. Needs to be done sometimes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants