I got a strange request for LDAC decoder as it may help to “…verify (or debunk) Sony’s quality claims.” This made me want to write a post about the known BT codecs and what’s my opinion on them.
Bluetooth codecs can be divided into three categories: the standard ones defined in A2DP that nobody uses (MP3 and ATRAC), the standard ones that are widely used (AAC and SBC) and custom codecs supported by specific vendors.
So, let’s start with mandatory A2DP codecs:
- SBC—a codec designed specifically for Bluetooth. It works like MPEG Audio Layer II but with 4 or 8 sub-bands and parametric bit allocation instead of fixed tables. This allows it to change bitrate at any frame (which allows it to adapt to changing transmission quality). I heard an opinion that it beats newer codecs at their bitrates in quality but the standard intentionally capped it to prevent that. I find that not that hard to believe;
- MPEG-1,2 Audio—I’ve not heard that anybody actually uses them and it’s fro the best;
- MPEG-2,4 AAC—it should give better quality than SBC but for a much larger delay and decoding complexity;
- ATRAC family—this feels like a proprietary replacement of AAC to me. I’ve not heard that anybody actually supports any of the codecs in their products (it’s not that I’ve heard much about BT in general though).
Here I should also mention a candidate codec named LC3 (and LC3plus). Whatever audio codec FhG IIS develops, it’ll be AAC. LC3 is no exception as by the first glance it looks like like AAC LC with an arithmetic coding and some additional coding tools glued to it.
There’s CVSD codec for speech transmission over BT. It’s a speech codec and that’s enough about it.
Now let’s move to the proprietary codecs:
- aptX—a rather simple codec with 4:1 compression ration (four 16-bit samples into single 16-bit word). The codec works by splitting audio into four sub-bands, applying ADPCM and quantising to the fixed amount. Beside inability to adapt to bad channels it should produce about the same quality as SBC (at least from a feature comparison point of view);
- aptX HD—the same as non-HD version but works on 24-bit samples (and probably the only honest high-res/high-definition codec here);
- aptX other variants—they exist but there’s no solid information about them;
- LDAC—will be discussed below in more detail. For now suffice to say it’s on MP2 level and hi-res claims are just marketing;
- LHDC and LLAC—not much is known about the codecs but after seeing quality comparison picture (with a note) on the official website I don’t expect anything good;
- Ultra Audio Transmission—there’s no information about it except for a name mentioned in Wikipedia list of BT codecs and some marketing materials on the page with smartphone description by the same vendor;
- Samsung BT codecs—see above.
Now let’s review LDAC specifically. I’m somewhat surprised nobody has written a decoder for it yet. It’s so easy to reconstruct the format from the open-source encoder that Paul B. Mahol could do it in a couple of days (before returning to Bink2 decoder hopefully). aptX has only binary encoder and yet people have managed to RE it. I’m not going to do it because I don’t care much about Bluetooth codecs in general and it’s not a good fit for NihAV
either.
To the technical details. The codec frame is either one long MDCT or two interlaced half-size MDCTs (just like ATSC A/52B), coefficients are coded as pairs, quads or larger single values (which reminds me of MP3 and MP2, quantisation is very similar as well). Coefficients (in pairs and quads as well) are stored in bit fields, the only variable-length codebooks are used to code quantiser differences. There’s bit allocation information transmitted for each frame so different coefficients can have different bit sizes (and thus precision). Nevertheless the maximum it can have is just 15 bits per coefficient (plus sign), which makes it hardly any hi-resier than AAC LC or SBC. And the only excuse that can be said here is the one I heard about MP3 being hi-res: with the large scales and coefficients you can have almost infinite precision. Disproving it is left as an exercise to the reader.
I hope now it’s clear why I don’t look at the development of Bluetooth codecs much. Back to slacking.
I’m more old fashioned, not using bluetooth tech because i listen lossless quality bitrate only thus unless there is way to listen lossless pcm at least 44.1 khz over wirelessly i not gonna do it, expecially not for 0$. Btw i finally fixed that CD+G scroll bug. Now can freely sing karaoke… awfully.
I just pointed out you’re able to do it in a short time, whether you’re going to do it or not is up to you. Personally I prefer wired headphones: constant audio quality, you don’t have to charge them and you don’t have BT-specific problems (like losing pairing). And for earbuds wires makes them harder to lose (iFans won’t understand).
And from what I heard, karaoke is usually sung while drunk where it does not matter how good you are as long as you enjoy it. It’s nice to hear that you’ve fixed that bug though.
Yeah, I liked this joke about “Paul can do it in days”)) because this is Realistic joke, even practical.
That was not a joke but rather an accurate assessment. He really can do it in a matter of days (but lacks any desire to do it, which I can understand), the codec is really simple.
At least LC3plus has an opensource encoder/decoder (makefile just works in GNU/Linux):
https://www.etsi.org/deliver/etsi_ts/103600_103699/103634/01.03.01_60/ts_103634v010301p0.zip
Double-blind subjective test was done here:
https://hydrogenaud.io/index.php?topic=121850.0
Yes, having source code is a good thing. The quality of that source code might be an issue though.
As for the test, the results are more or less expected. They had to sacrifice compression gains from using a larger window for lower latency after all.
Actually, there is a decoder for LDAC. One of its forks (https://github.com/anonymix007/libldacdec) even works with BlueALSA.
And as expected it’s really simple.