Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Jun 2007
Posts: 12
|
HDCD Software Decoder
Hello all,
I've seen comments from a few people wanting to know how hdcd works, so I decided to take a look at it as an academic exercise. Attached is a 'reference decoder', which reads a 16-bit wav from from stdin, upconverts it to 24-bit using embedded hdcd information where present, and writes the output to stdout. To use, simply run: hdcd.exe < 16bit.wav > 24bit.wav If embedded hdcd information is detected, a notification will be written to stderr. Non hdcd's will also work, although the only result will be to halve their volume. Let me know how you get on, Chris |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Jun 2007
Posts: 12
|
Until the attachment's approved, it can be downloaded from,
http://www.srcf.ucam.org/~cjk32/hdcd/hdcd.zip |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
Excellent work! I want to use it in my audio conversion batch. It's too bad that non-HDCD materials will have the volume halved. It is possible to avoid the effect or to implement a test mode (e.g. make a quick scan of a few portions and return an errorlevel of 1 for non-HDCD)?
|
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: Aug 2007
Posts: 1
|
Quote:
(There are several free DOS clones/emulators for Linux; theoretically the current version could perhaps run under Wine emulator, but there are problems with stream redirections, which require the Windows shell, which is not free...) |
|
![]() |
![]() |
![]() |
#9 | Link | |
Registered User
Join Date: Jun 2007
Posts: 12
|
Quote:
In general, it's worth looking at the website to check for newer versions. I'll keep the older versions online too, and hdcd.zip will point to the latest 'stable' version. |
|
![]() |
![]() |
![]() |
#10 | Link | |
Registered User
Join Date: Jun 2007
Posts: 12
|
Quote:
If you can give me some pointers to a suitable toolkit, I'll have a go at compiling for DOS. For other platforms, could you contact me privately. Microsoft want to charge royalties for use of hdcd technology on non MS platforms, so I'd like to keep any such binaries limited to individuals for now. Regards, Chris |
|
![]() |
![]() |
![]() |
#12 | Link |
Registered User
Join Date: Jun 2007
Posts: 12
|
Well, for most HDCDs, the decoded cd will sound better than the original due to the removal of the peak compression the was applied during encoding.
Whether the 24bit decoded version will sound audibly different from a 16bit downsampled version of the same is entirely different question. Anyone care to do some ABXing? Regards, Chris |
![]() |
![]() |
![]() |
#14 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
It's really difficult ABX'ing uncompressed sound with computer audio devices.
BTW, I have problems working with flac.exe and hdcd.exe in a pipe chain. When I do something like "flac -d in_hdcd16.flac - | hdcd | flac -c - out_24.flac" (not the exact commandline, but you can get the idea), flac.exe will prompt an error saying no audio data found. Does anyone have the same problem? Last edited by henryho_hk; 21st September 2007 at 07:32. |
![]() |
![]() |
![]() |
#15 | Link | |
Registered User
Join Date: Jun 2007
Posts: 12
|
Quote:
Less simple is to be able to use dynamic filter switching. This requires knowledge of the filter's characteristics (hopefully gleanable from test tracks played through an upsampling decoder), as well as an algorithm to choose which filter to use. On the other hand, whether there is any actual use for an encoder is another question. I'd really like to perform / see the results of an ABX between the following: A) 24 bit original encoder that's been hdcd encoded and decoded B) 24 bit original truncated / dithered to 16 bit (and then padded back to 24 bit if it makes the technical details any easier) The other benefit I should probably mention is that tracks encoder using peak extension and gain adjustment will play back rather compressed on non hdcd players. In some cases, this may well be what you want, e.g. car audio, portable music players. I suspect I'll probably end up writing an encoder just to play with. It might well make ABXing things a lot easier! Regards, Chris |
|
![]() |
![]() |
![]() |
#16 | Link | ||
Registered User
Join Date: Jun 2007
Posts: 12
|
Quote:
Quote:
Regards, Chris |
||
![]() |
![]() |
![]() |
#17 | Link |
Registered User
Join Date: Mar 2004
Posts: 889
|
Yup, I think mainstream computer audio has difficulty reproducing good signals for us to ABX'ing these "lossless" signals. The first problem would be probably be the dynamic range. I am now actually trying it (16bit dither by foobar, on-board ALC888, desktop speaker). I know headphones would be better but the audio output is too high and too noisy. I wonder if Live24 would do a better job.
R185 is doing great at piping. Something like "flac -d -c hdcd_orig_16bit.flac | hdcd | flac -5 -f - -o decoded_24bit.flac" is now working perfectly. Thanks. A foobar plugin would be great too. |
![]() |
![]() |
![]() |
#18 | Link | |
Registered User
Join Date: Jun 2007
Posts: 12
|
Quote:
Ive no experience with foorbar at all, and am highly unlikely ever to write such a plug in. However, I am finalising an API to the code, and will release the necessary headers along with a static and dynamic library should anyone wish to implement this themselves. Regards, Chris |
|
![]() |
![]() |
![]() |
#20 | Link |
Registered User
Join Date: Jun 2007
Posts: 12
|
HDCD allows the use of three features: peak extend, gain adjustment and reconstruction filter switching. Windows media player supports peak extend and gain adjustment, and it has hence been possible to fully implement these features.
Filter switching, however, only makes sense when you are upsampling, something which wmp doesn't do, and there's hence no reference to implement it from. Investigation of various test CDs and various (usually contradictory) literature has led to the conlusion that there are only two filters available at playback, the normal filter and the transient filter. The reason for this conlusion is that of the three bits of each hdcd code remaining after peak extend and gain adjustment, wmp abandons two, but explicitly stores the remaining one (suggesting that this is the only important remaing bit, giving only two options). An ivestigation of when this bit was set was what lead to the conclusions that it is intended to cover transients. If you take a look at, http://www.srcf.ucam.org/~cjk32/hdcd...3%20Panama.PNG the right channel is untouched, and the left channel shows that value of this remaining bit. It is set to for a period covering each of the drum beats, and similar behaviour is observed with many other tracks. The intention is to try to add upsampling to the code once the filter's responses are known. I'm hoping that someone with a hardware HDCD decoder (which should be upsample and switch filters) will be able to play the following test tracks through it to ascertain the impulse / frequency response, http://www.srcf.ucam.org/~cjk32/hdcd/transient_filter/ These are a frequency sweep and an impulse train with hdcd codes embedded to either enable the normal or trainsient filter (_nf.wav, _tf.wav). If anyone does have a go with these, please don;t put the impulse train through speakers (or amp?), I can't imagine it'll do them any good. Chris |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|