Does Play handle HDCD encoded discs?

Discuss Play, an open source multi-format audio player.
Post Reply
randian
Posts: 34
Joined: Sun Apr 20, 2008 7:59 am

Does Play handle HDCD encoded discs?

Post by randian » Wed Sep 02, 2009 7:32 am

Or more precisely, decode HDCD information present from ripped images of disks?

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Re: Does Play handle HDCD encoded discs?

Post by sbooth » Thu Sep 03, 2009 2:13 am

What format/codec is the audio in?

randian
Posts: 34
Joined: Sun Apr 20, 2008 7:59 am

Re: Does Play handle HDCD encoded discs?

Post by randian » Thu Sep 03, 2009 6:45 am

High Definition Compatible Digital

You can identify an HDCD disc by the HDCD logo Image somewhere on the back cover. If you have an extensive CD collection, or know somebody who does, there's a good chance you/they have at least one HDCD disc.

Charles Hansen
Posts: 4
Joined: Sun Nov 15, 2009 11:20 pm

Re: Does Play handle HDCD encoded discs?

Post by Charles Hansen » Mon Nov 16, 2009 12:30 am

Hello Stephen,

HDCD stands for "High Definition Compatible Disc". It was a system developed for CD in the early '90s and released in the mid '90s. Essentially it was a "compansion" scheme that expanded the dynamic range available from a 16-bit format. The clever part was that the instructions for changing the gain were hidden is bursts of code ten times per second in the LSB, so that the normal side-effects of compansion ("breathing", "pumping", etc.) were completely avoided. It was commercialized by a company called Pacific Microsonics, but just as it was gaining momentum SACD and DVD-Audio were released, negating the need for HDCD. The company and process was purchased by Microsoft several years ago. The original patents for the process have apparently expired. An overview is available at: http://en.wikipedia.org/wiki/High_Defin ... le_Digital

There is a side story, and then the heart of the matter.

The side story is that Pacific Microsonics had a brilliant engineering team. Not only did they develop a clever scheme for improving 16-bit audio, but they built the first truly good sounding A/D converter (which also optionally compressed the audio and added the decoding flags into the "subcode" hidden in the LSB). So the HDCD releases were pretty much guaranteed to sound much better than the average CD of the day. But they also had a slimy marketing arm that made many deceptive and misleading claims for the process. The upshot is that many mastering studios still use the HDCD encoders as their main A/D converter as it still sounds quite good, but it always includes the HDCD subcode, even when no compansion features have been turned on by the mastering engineer. So there are many lists on the internet of "HDCD" discs that are misleading -- these discs will light up the "HDCD" light on a CD player equipped to decode the format, but they actually don't require any decoding whatsoever.

The heart of the matter is decoding HDCD discs. Properly done, a decoder will detect the hidden flags in the LSB and do one of two things:

a) Apply a gain expansion of the top 3 dB of the signal, expanding it to a 9 dB range (adding one bit of range).

b) Apply gain expansion of the quietest passages. This occurs in 0.5 dB steps (to avoid obvious jumps in level) with a total range of 4 dB (adding almost another bit of range).

When the first feature is decoded, it requires lowering the overall level by one bit so that the peaks can be accommodated without clipping. Decoding the second feature simply lowers the gain of the signal on-the-fly.

There have been numerous hacks, as well as a great deal of mis-information published on the internet. The most well-known decoder is here: http://forum.doom9.org/showthread.php?t=129136

I'm not sure how *precise* that version of the decoder is. There are three issues at the heart of decoding:

a) What is the exact algorithm used for the expansion from the top 3 dB into 9 dB? I have looked at the table used by the code linked above, and while it is probably close enough for most purposes, it definitely is not exact.

b) When the flag is given to signal a level change for the gain expansion of quiet passages, precisely when (to the exact sample) should the gain change occur? Again, the code linked above is probably very close, but not exact.

c) Reverse engineering the flags hidden in the LSB. Again, I'm not sure about the code linked above. It turns out that there were two distinct codes. One was used very rarely, apparently by a prototype encoder. The second one was probably used on all commercial HDCD releases.

Should you choose to build a decoder into Play, the above link should get you well on your way. If you want to get more exact, let me know as I have a couple of contacts that are working on a more precise reverse engineering of the process.

Thanks,
Charles Hansen

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests