mstorsjo / fdk-aac

A standalone library of the Fraunhofer FDK AAC code from Android.
https://sourceforge.net/projects/opencore-amr/
Other
1.18k stars 389 forks source link

AAC-ELD in LOAS format #87

Open CoreTechie opened 6 years ago

CoreTechie commented 6 years ago

AAC profiles LC, HE-AAC and ELD inside LOAS transport formats could be decoded using the "aac-decoder-example" with some modifications. (The modifications included reading the bytes from the encoded bit-stream file only when the decoder internal buffer is empty (after call to aacDecoder_Fill returns valid=0). Else keep feeding the decoder with the aacDecoder_Fill() call in every iteration with the new buffer position and length.)

While playback of LC and HE-AAC decoded wave samples appears to be fine, ELD decoded samples seems to be distorted.

5.1-ELD-LOAS Bitstream: Loas.zip

mstorsjo commented 6 years ago

Do similar ELD bistreams decode correctly if using raw transport format (like in m4a)?

mstorsjo commented 6 years ago

I tested decoding this file using my own example, with a bit of updates and mofidications, see the branch loas - I do get pretty sensible audio out of it (except that it does sound very harshly compressed), with a few cases of Decode failed: 1001 (which is AAC_DEC_TRANSPORT_SYNC_ERROR).

CoreTechie commented 6 years ago

The same ELD bit-stream in raw format decodes correctly, but the audio is similar to the one in loas format. I used your loas example branch and it also produces the same audio quality (as if it compresses some frequencies)

The ELD Raw format file (.m4a) and the Original wav file from which the bit-streams were encoded can be found in this link: https://drive.google.com/drive/folders/19ZuBF4LtfoPOKgQkITlZFwwKSaY_EPar

You can clearly see the difference between the original(uncompressed) and the decoded audio quality.

I understand AAC-ELD compression format was designed mainly for voice / speech communication (mono sound). Does this mean it is not suitable for multi-channel music audio ? Or, some other issue ?

mstorsjo commented 6 years ago

I'm not sure if there's something inherently in the ELD profile that makes it impossible to handle multichannel music well, or if it's only a case of encoder tuning and/or bitrate/quality setting. But it's definitely not one of the goals for this profile at least.

You might want to look at opus, to see if that provides better quality for the same latency/bitrate constraints as AAC-ELD, for your usecase.

CoreTechie commented 6 years ago

Sure, I would have a look at the Opus codec as well.

Just an out of context question: Can multiple instances of the FDK-AAC decoder be created in a multi-threaded environment, where every instance is handling a different input stream and in a thread safe manner ?

mstorsjo commented 6 years ago

Yes, absolutely, it's safe as long as you don't access the same encoder instance from multiple threads at the same time.