Support and General Use > Audio Playback, Database and Playlists

Distortion near peak level, specific to OGG, OPUS and AAC

<< < (2/2)

mayreg:
Sorry for this 2-year delay. ;) I only had so much spare time now to set up a Rockbox build & test environment and do the experiments saratoga suggested.

I successfully reproduced the issue on the simulator during regular playback. I built rockbox from HEAD 8f5128da16 and tried test_codec in both Write WAV and Write WAV with DSP modes.

The pure WAV output isn't distorted but the one with DSP is. So it's now more obvious that there's something going wrong in the compressor or between the decoder and the compressor within the DSP chain, but not inside the decoder.

The clipping occurs when the compressor attacks and there seems to be something wrong with the Makeup Gain because when I turn it off, the distortion goes away. Playing around with attack time is also interesting, the higher the attack time, the longer the distortion.

Attached samples and demonstration video in the bug report: https://www.rockbox.org/tracker/task/13375#comment44819

One more question should be answered: Why just OGG/Vorbis, OPUS and AAC? Someone could answer this who's an expert in this part of Rockbox, which I'm not. Maybe the decoders of OGG and OPUS codecs send out a "little bit more" gain to the Compressor than other codecs or something may go wrong in the resample part as the decoders of these formats all produce 24-bit output but Sansa output is 16-bit.

Bilgus:
Do you think perhaps those tracks had more than 4 audio channels?

I fixed a buffer overflow bug in the compressor yesterday

https://gerrit.rockbox.org/r/c/rockbox/+/6268/4/lib/rbcodec/dsp/compressor.c#459

bahus:

--- Quote from: Bilgus on December 27, 2024, 03:51:49 PM ---Do you think perhaps those tracks had more than 4 audio channels?

--- End quote ---

AAC(faad/alac) decoding is limited to 2 channels:
https://github.com/Rockbox/rockbox/blob/bfef0a2d6cf88ab99f267acce2d015602cb3860c/lib/rbcodec/codecs/libfaad/structs.h#L40

So not the case for AAC... Maybe the same limitation is applied for ogg and opus I didn't really check.

mayreg:

--- Quote from: Bilgus on December 27, 2024, 03:51:49 PM ---Do you think perhaps those tracks had more than 4 audio channels?
--- End quote ---
Definitely not. The samples I provided have 2 channels and all the media on my Sansa have max. 2 channels.


--- Quote from: Bilgus on December 27, 2024, 03:51:49 PM ---I fixed a buffer overflow bug in the compressor yesterday
--- End quote ---
I tried the latest build with your patch on but it didn't fix the distortion issue. It must be something related to the resampler or the compressor. Looking at the code, at least OGG must be resampled from 24-bit to 16-bit as its decoder provides PCM data with higher bit depth.

Navigation

[0] Message Index

[*] Previous page

Go to full version