Friday, July 27, 2007

A Tale of TrueHD

There is probably nothing about the new HD DVD and Blu-ray high-definition disc players more confusing to consumers than how the various "next-generation" digital audio codecs get handled. In this post I'll look into one of the most promising, Dolby TrueHD.

Dolby Labs, creators of TrueHD, are the nice folks that brought you Dolby Digital surround sound, the type of 5.1-channel audio found on the soundtrack of virtually every DVD sold in the U.S. The venerable Dolby Digital 5.1 codec (coder-decoder) offers up to six channels of digitally compressed surround sound: three front channels and two surrounds, complemented by a single Low Frequency Effects channel, the ".1" in the 5.1 designation.

DD sound is digitally compressed as it is being encoded by hardware or software that implements the Dolby Digital 5.1 codec. This happens as a step in the process by which the DVD is "authored." The same codec is implemented in the DVD player or in an outboard A/V receiver fed by the player, this time to decode the DD 5.1 bitstream that has been recorded on the disc.

DD 5.1 compression is "lossy." When the player or receiver decodes the bitstream, the result is not a carbon copy of the original input to the encoder. The ear can hear the difference in subtle, hard-to-define ways. So the Dolby folks looked for ways to up the ante on perceived realism and, not incidentally, to increase the number of available channels of sound from 5.1 to 7.1 (or more) for an even better surround effect.

One way they did this was to enhance lossy Dolby Digital into Dolby Digital Plus. DD+ is still a lossy digital audio compression format, but it is less lossy than DD without the "+", and it can contain 7.1 channels of sound, which DD can't. DD+ audio files on a disc contain more information (more bits) than plain old DD. So the bits have to be read in from the disc, decoded, and otherwise processed at a faster clip (a higher bitrate).

Dolby's next step was to add yet more bits to DD/DD+ to come up with a fully "lossless" digital audio compression format: Dolby TrueHD. Because it's lossless, the output of the decoder is exactly the same as the original input to the encoder. The increase in realism over DD+ or DD is said to be stunning. TrueHD bitrates are necessarily higher than DD+ bitrates.



Handling TrueHD


When an HD player, be it HD DVD or Blu-ray, encounters a TrueHD soundtrack on a disc, it can do several things with it.

The first and most basic thing is to decode it — which in part means unpacking it into multiple channels of uncompressed linear PCM, inside the player. PCM stands for "pulse code modulation," which is a technique for turning an analog waveform into a series of numbers. The amplitude or height of the waveform for each audio channel is, prior to the authoring of the disc, sampled at the rate of, say, 48 or 96 or 192 kHz. 48,000 or 96,000 or 192,000 samples of each waveform's amplitude are accordingly captured every second as numbers expressed in bits: 0's and 1's.

The raw streams of binary numbers are linear PCM: "linear," because the digital streams are not yet encoded and compressed. That happens next, as the multiple raw PCM streams are tamped down by means of the Dolby TrueHD codec into a smaller digital stream to be recorded on disc.

The HD player simply decodes that linear PCM (LPCM) bitstream and unpacks it back into its original multichannel form. The result is absolutely identical to the original, since TrueHD is lossless. Which means, among other things, that if the original had eight (i.e., 7.1) channels, so does the decoded-and-unpacked LPCM. If the original was six-channel (5.1), then so is the decoded-and-unpacked LPCM. And so on.


Downmixing, Downsampling, Downrezzing


The simplest thing that can happen next is what occurs if the TrueHD track is 5.1-channel and the HD player has six standard RCA jacks for routing multichannel analog audio to an A/V receiver. The player simply converts the existing six channels of decoded-and-unpacked linear PCM to analog form and outputs them on the six provided RCA jacks. The receiver inputs the same six analog signals and routes them to the appropriate speakers.

The next most basic option is downmixing the six channels from the TrueHD 5.1 track into two: the traditional stereo right-and-left analog channels. These can then be conveyed to, say, a TV via two standard RCA output jacks on the player, one red and the other white. While the audio is still in its digital linear PCM form inside the player, the information from the to-be-discarded channels is folded into the channels which will remain after the downmixing, so no important sound information disappears.

Downmixing is what happens whenever the number of discrete audio channels is reduced from an original quantity to a lower one. So if the original TrueHD track had 7.1 channels, it's downmixed to 5.1 for the multichannel analog jacks and (again) to 2.0 for the stereo analog jacks.

Thus there can be at least two derivatives of the linear PCM audio present in the player at any moment. As we will be seeing, these or possibly yet other LPCM derivatives can feed the player's digital audio outputs as well.

Some of those digital LPCM derivatives may be downsampled ones. Downsampling involves taking, say, a PCM stream whose sampling rate was originally 96 kHz and reducing it to 48 kHz, by throwing out a fraction (in this case, 50%) of the samples. Downsampling can be useful when the bandwidth of the digital output is less than the original PCM bitrate. It can also be useful if the device doing the processing at the receiving end of the digital connection can't keep up with the original 96 kHz bitrate. Unfortunately, though, downsampling degrades the quality of the sound somewhat.

Another way to economize on bandwidth/bitrate is downrezzing. Downrezzing is slang for "down-resolution," a downscaling process by which the size in bits of each PCM sample is lowered. Say the original samples had 24 bits each. Recomputing them as 16-bit samples saves 1/3 of the digital bandwidth or bitrate. Of course, it noticeably lowers the quality of the sound. For this reason, few if any HD disc players downrez/downscale LPCM.



Players' Digital Audio Outputs


TrueHD can be output by the HD player in various digital forms, using either of two digital connections.

One of these digital connections is usually called something like "digital optical out" or, if it uses a coaxial, non-fiber-optic cable, "digital coaxial out." It's also called Toslink or S/PDIF. I'll just refer to it as "digital audio out," or DAO. The non-optical kind of DAO uses an RCA jack and a coaxial cable much like the type often used for analog video signals. The optical kind uses a fiber-optic cable with special plugs and jacks.

The other digital connection is HDMI, for High-Definition Multimedia Interface. HDMI also carries digital video, along with audio, while DAO does not.

One digital format of TrueHD-derived audio output that can be carried by HDMI and DAO is the above-discussed multichannel linear PCM. It can be output by the player:

  • in its full-fledged player-internal form
  • or as a downmixed and/or downsampled digital derivative



Linear PCM and Bitstream Modes


For each of the two digital audio connections, HDMI and DAO, the HD player typically lets you use one of its setup menus to determine whether or not the uncompressed Linear PCM version (or some derivative thereof) should be output, for decoded audio tracks that were originally encoded in a digital compression codec such as TrueHD. The other menu choice is Bitstream.

When Linear PCM (sometimes just called PCM) is chosen as a player option, the decoded and unpacked audio is routed to HDMI and/or DAO in one of its PCM forms: the original form with all its channels, samples, and bits intact, or a derivative form with fewer channels and/or fewer samples per second.

When Bitstream is chosen, if the original audio track from the disc is TrueHD, then the TrueHD track can be (depending on the player's capabilities — see "Deriving Dolby Digital" below) passed through to the HDMI and/or DAO output jack intact, with no conversion to PCM and no downgrading to a lossy compression codec. The assumption is that the device at the other end of the digital connecting cable — usually an A/V receiver or a TV — knows how to decode TrueHD audio on its own.

In some HD players, the second menu choice for the DAO output is Bitstream while that for the HDMI output is called Auto (not Bitstream). The Auto choice functions pretty much like Bitstream when the HDMI "sink" (usually an A/V receiver) is TrueHD-capable. That is, it sends the original TrueHD bitstream to the sink for decoding.

But when the HDMI sink has no TrueHD decoder, the Auto setting typically reverts to sending multichannel linear PCM to the sink. Virtually all HDMI-equipped receivers can handle that.

Some HD players let you choose among three options for HDMI audio: PCM, Auto, or Bitstream. If you choose Bitstream, you're saying you want a compressed digital bitstream, not uncompressed PCM, always to be sent to the sink.



Deriving Dolby Digital


If that compressed digital output bitstream happened to be in the original TrueHD format, the result might be either no sound at all, or a lot of random noise ... if, that is, the receiver truly has no TrueHD decoder. But HD players that let you choose Bitstream instead of Auto for HDMI often lack the ability to send out on HDMI a TrueHD stream in all its lossless glory, anyway.

What they can have instead is the ability to strip away from TrueHD all the extra bits of information that distinguish such "next-generation" audio streams as Dolby TrueHD from those in the codec's venerable old ancestor format, in this case, Dolby Digital. One player that extracts Dolby Digital 5.1 from Dolby TrueHD bitstreams is Sony's original Blu-ray player, the BDP-S1.

Remember: TrueHD compression is lossless, while DD is lossy. Throw away the extra TrueHD bits that avoid DD's lousiness, and you'll wind up with plain old, lossy DD. So downgrading TrueHD to DD stands to be a relatively simple chore.

In fact — and this factoid is true, as far as I can tell, of Blu-ray players and discs but not of HD DVD players and discs — TrueHD (and Dolby Digital Plus as well) is stored on the Blu-ray disc as two separate components: the independently playable "core" Dolby Digital bitstream, at a bitrate of 640 kilobits per second; and an "extension" bitstream at 1.024 megabits per second. The core bitstream is essentially identical with Dolby Digital 5.1. The extension bitstream is what makes Dolby TrueHD lossless and can also give it extra channels, above and beyond the usual 5.1.

If the TrueHD stream in fact has more than DD's 5.1 channels — say, 7.1 — the extra channels are also carried, in downmixed form, in the core 5.1 bitstream on the Blu-ray disc. They are thus carried separately in the extension bitstream. If the full TrueHD 7.1 audio stream is output on HDMI per the disc player's Bitstream mode, the downmixed "extra copy" of the additional two surround channels being carried in the 5.1 core stream is simply thrown away. If the core 5.1 bitstream is output, the extension bitstream is thrown away.

This would seem to be the strategy used in Blu-ray players, at least. HD DVD discs don't separate TrueHD audio (or DD+, for that matter) into distinct core and extension streams on the disc — one reason being that decoding of DD, DD+, and TrueHD codecs is mandatory for HD DVD players, while only DD decoding is mandatory for Blu-ray, and the ability to decode DD+ and TrueHD is optional. So HD DVD players need to do elaborate tricks in order to extract DD from DD+ or TrueHD for output on DAO or HDMI.

To repeat for clarity's sake: the same thing that happens with TrueHD happens also with Dolby's intermediate-quality format, the lossy-but-not-terribly-so Dolby Digital Plus. On Blu-ray at least, DD+ has a core, DD 5.1-equivalent bitstream alongside an extension bitstream recorded on the disc. So Blu-ray players such as the Sony BDP-S1 that can't output a DD+ bitstream on HDMI downgrade DD+ to DD 5.1 simply by throwing out the extension bitstream. HD DVD players have to do some fancier bitstream manipulations to extract DD from DD+.



What Actually Comes Out, Then?


All the above serves to catalogue some of the kinds of digital audio streams that can come out of a Blu-ray or HD DVD disc player. But what kind of stream actually comes out when a particular TrueHD track is read from a particular Blu-ray or HD DVD disc depends on a few more considerations.

The player's optical or coaxial digital audio output (DAO) has much less bandwidth than HDMI, so the choices there are pretty much limited to a downgraded-to-Dolby Digital 5.1 bitstream or a downmixed 2.o-channel PCM output, depending on whether Bitstream or PCM is chosen in the player's user menu. Moreover, if the TrueHD stream was sampled at 96 kHz or 192 kHz instead of 48 kHz, it's generally downsampled to 48 kHz for DAO, no matter what.

As for the HDMI connection, if it's not implemented as HDMI version 1.3 at both ends, but only as version 1.2 or less, chances are the only improvement over DAO is that the PCM output can be multichannel (up to 5.1 or even 7.1 channels) and not just 2.0-channel.

But if an HDMI connection spans a pair of devices that both implement HDMI version 1.3, there are more possibilities. Of course, HDMI 1.3 (as does every previous version) supports multichannel PCM output, where the maximum total bitrate is 36.86 megabits per second. In PCM mode, that allows for up to eight channels of uncompressed digital audio, each sampled at rates up to 192 kHz, with up to 24 bits per sample.

Now, as of HDMI 1.3, an HDMI source (such as a high-def disc player) in Bitstream mode can export a lossless next-gen digital audio bitstream such as TrueHD as is for decoding by an HDMI sink (such as an A/V receiver or preprocessor).

Because HDMI sources such as disc players and sinks such as receivers compare notes about each other's capabilities before picking the type of audio stream to be transmitted, the actual HDMI 1.3 output of the disc player can depend on the receiver. For example, if the receiver cannot decode TrueHD but can handle Dolby Digital, then TrueHD can in theory be downgraded by the player to DD, which then may be sent across the HDMI 1.3 connection instead.

That being said, chances are that the many HDMI 1.3-capable receivers now just beginning to arrive on the market will all duly decode TrueHD and the other lossless (or lossy) next-gen bitstreams on Blu-ray and HD DVD discs that get passed along to them by HDMI 1.3-enabled disc players in Bitstream output mode.

Alternatively — depending on exactly how digital audio conversion is implemented by the particular model of disc player — TrueHD may be unpacked to multichannel linear PCM and sent to the receiver over HDMI in that uncompressed way ... even though Bitstream has been selected in the player's HDMI setup menu! This is what the Sony PlayStation 3 does when used as a Blu-ray player to play a TrueHD-encoded disc.

Got that? Some high-def disc players may override the Bitstream output mode and substitute PCM output instead, for particular audio compression codecs!

Notice that multichannel linear PCM is compatible with most existing HDMI receivers that don't implement HDMI 1.3, so an HDMI 1.1 or 1.2 A/V receiver usually works just fine with it. (The exception would be some of the cheaper HDMI receivers which do not actually support audio over HDMI and are often labeled as "HDMI passthrough" devices.)



Bitstream Mode and HD DVD "Advanced Content"


There is yet another proviso affecting Bitstream-mode output. It applies to HD DVD players, as distinct from Blu-ray players. Those HD DVD discs that are authored with "advanced content" require audio tracks to be decoded in the player itself.

"Advanced content" uses HDi — see HDi Interactive Format — a disc-authoring option which provides an extra dollop of information on an HD DVD disc which allows the player to do such things as mix the soundtrack of a movie with the director's voiceover commentary and/or provide sound effects keyed to the use of on-screen disc menus. These menus, when invoked, overlay the video of the movie as it continues to play behind the menu on the TV screen.

Mixing multiple video and audio sources in this fashion is one of the ways HD DVD beats regular DVD. For it to work in the HD DVD player's Bitstream mode, the player must internally decode all the audio for all the sources on the disc, mix it together, and output it in one of the player's "blessed" digital audio output formats.

What is a "blessed" format? It is, unsurprisingly, one the HD DVD player uses when the output mode is set to Bitstream in the player's audio setup menu, and the disc being played has been authored with "advanced content."

On current Toshiba HD DVD players, that "blessed" digital audio output format, whether using the HDMI output or the non-HDMI digital audio output connection, tends to be (drum roll, please) DTS 5.1. That's right: even though none of the original audio sources on the disc uses DTS — in any of its versions, DTS, DTS-HD High Resolution or DTS-HD Master Audio — the "advanced content" output on DAO or HDMI can be DTS! Go figure.

Again, what the "blessed" digital audio output format actually is for any current or future HD DVD player, on any particular digital output connection on that player, can vary with the model of player.



Multichannel PCM Mode and "Advanced Content"


When playing "advanced content" with the output mode is set to PCM in the player's audio setup menu, rather than to Bitstream, an HD DVD player will typically play the combined audio as multichannel PCM over HDMI and as downmixed 2.0-channel PCM over DAO.

Virtually all HD DVD discs are authored with "advanced content." The fact that TrueHD and other next-gen audio codecs get turned, by the HD DVD player when in Bitstream mode, into DTS in effect nullifies most of the advantages that typically are thought go along with Bitstream-mode output.

Bitstream
-mode output is generally intended to let an outboard A/V receiver do the heavy lifting of audio decoding, rather than requiring the disc player to be able to do it. For example, many regular DVDs have extra, non-standard audio tracks in formats such as, for example, an enhanced version of the original DTS that carries more than the usual 5.1 channels. If the player can pass such an audio track through to an A/V receiver as an undecoded bitstream, the receiver (assuming it has the proper decoder) can decode it and use it appropriately.

It is accordingly not surprising that some technophiles resent the "advanced content" restriction on Bitstream-mode outputs from HD DVD players. But the (multichannel) PCM output option on HDMI would seem to answer their objections. The player internally decodes TrueHD and unpacks it to into the requisite number of channels of multichannel PCM. Any secondary audio sources are mixed in as needed. The resulting mix is output on HDMI (any version) as is, or it is output on DAO after downmixing to 2.0 channels. The A/V receiver inputs it and makes appropriate use of it.

Notice that the multichannel PCM output on HDMI is just as lossless as the original TrueHD — as long as there has been no internal downsampling or downrezzing of PCM in the disc player.

Notice also that all this works using any HDMI version, with the player's audio mix played into any receiver that can input multichannel PCM on HDMI. The receiver need have no onboard decoder for TrueHD or any other compressed audio formats.



Interactive Content on Blu-ray


The Blu-ray camp doesn't actually use the designation "advanced content" — it was invented by HD DVD bigshot Toshiba to avoid confusing the customer with unfamiliar terms like HDi — but Blu-ray discs can likewise be authored with extra information which allows mixing by the player of multiple audio sources from the disc, and also makes available other ways of using "interactive" audio and video content.

In the case of Blu-ray, the function if HDi in the world of HD DVD is performed by BD-Java. BD-Java, or BD-J for short, stands for Blu-Ray Disc Java, a variation of the Java programming language used widely on the World Wide Web. All Blu-ray players to date support BD-Java.

However, the Blu-ray players that have appeared on the market so far do not yet support the soon-to-arrive bundle of interactive capabilities designated BD-Video 1.1. That "profile" of BD-Video implements basic interactivity features like picture-in-picture, persistent snapshots of video frames, and internal audio mixing. The Blu-ray camp, to speed their format's arrival on the competitive market scene, decided not to require these features on the earliest players. Thus, current Blu-ray players support only BD-Video 1.0.

BD-Video 1.0 as found in today's players does not perform internal mixing of audio. Hence, today's Blu-ray players are fully able to play today's Blu-ray discs, which don't call for internal audio mixing anyway. Some but not all of these early players can provide (if the user prefers) uncompromised Bitstream-mode output of TrueHD, if that is what is on the disc. Others can only extract DD 5.1 bitstreams from TrueHD, when in Bitstream mode. Or, when in PCM mode, uncompressed PCM versions of TrueHD (or of player-extracted DD 5.1) can be output. In none of these cases will internal mixing of audio be necessary.

Eventually, we will see titles on Blu-ray that require internal decoding and mixing of audio by the player, if all the interactive content on the disc is to be used. Players that don't implement BD-Video 1.1 (or its successor profile, BD-Video 2.0, also called BD-Live) will not be able to access this added content, but they will still play the movie itself, with its soundtrack intact.

Again, older players will still (as will the newer, BD-Video 1.1-capable players) allow uncompromised Bitstream-mode output of TrueHD, if that is what is on the disc, and if they have the hardware/firmware to do so (many early players lack that). However, unless the TrueHD from the disc is converted to multichannel PCM inside the player (in PCM mode, not Bitstream), secondary audio sources will not be able to be mixed into it in the final output.

Note, then, the differences between HD DVD advanced content and Blu-ray interactive content. HD DVD advanced content appears on virtually every HD DVD disc and requires player-internal audio mixing in the PCM domain for purposes of PCM audio output on HDMI or optical/coaxial digital connections. Blu-ray interactive content (using the forthcoming BD-Video 1.1 profile) is optional on the disc and can simply be ignored by a non-1.1-compliant player, should it exist on the disc. It can also be ignored by a 1.1-compliant player, if the player is set to Bitstream mode, at the expense of omitting the extra audio information that would otherwise be mixed in from secondary audio sources on the disc.



Viva PCM Mode!


Considering all the above, an interesting notion begins to emerge: It is not clear that using Bitstream mode is ever preferable to using PCM mode on HDMI!

Bitstream mode might (erroneously) be thought to be the only way to get a lossless digital data stream out of the disc player on HDMI when the input to the player from the disc is Dolby TrueHD. TrueHD is inherently lossless, the thinking might go, and exporting it as is to an A/V receiver that can decode it without compromise would seem to be the best way to go.

But the player itself, assuming it can decode TrueHD at all — and, so far, most Blu-ray and all HD DVD players can — does so without compromise. (The Samsung BD-P1000 and BD-P1200 are examples of Blu-ray players that can't decode TrueHD. The BD-P1200 has HDMI 1.3, but lacks TrueHD decoding.) When TrueHD is unpacked to multichannel linear PCM inside the player, it loses nothing: no downmixed audio channels, no tossed-aside digital samples, no discarded bits per sample.

True, when that multichannel PCM is output on a optical/coaxial digital audio connection, it may have to be compromised. To save bandwidth, it may need to be downmixed to 2.0-channel PCM.

When it is output on HDMI, though, the player's internal multichannel PCM should in no way have to be downconverted — downmixed, downsampled, or downrezzed — with the following exceptions:

  • TrueHD sampled at 192 kHz may get downmixed to 2.0-channel PCM (some early players seem to do this, even though it's not clear why)
  • Some of the very first HD DVD and Blu-ray players originally downmixed all TrueHD to 2.0-channel PCM; that limitation has been corrected by firmware updates and in follow-on models
  • Some HDMI-passthrough A/V receivers are not compatible with digital audio input at all
Notice that no exception need be made when the HDMI version in use is earlier than 1.3. By way of comparison, TrueHD cannot be output in Bitstream mode unless the HDMI version is (at least) 1.3.

What's more, TrueHD cannot be output in Bitstream mode unless a disc player that implements HDMI 1.3 also contains the necessary hardware chipsets and/or firmware smarts to pass along TrueHD bitstreams on HDMI. It is admittedly not easy to find out which HDMI 1.3 players, if any, have or lack this capability. But the question becomes moot if PCM mode is selected instead of Bitstream, anyway.

And so it looks as if setting the player to use PCM output mode on HDMI is just about always the right way to go. On HDMI, multichannel PCM covers all bases in terms of losslessness and the number of channels supported.

On coaxial/optical digital audio outputs, on the other hand, Bitstream mode is useful as the only way to convert TrueHD into a multichannel codec — Dolby Digital 5.1 or DTS 5.1 — that uses less bandwidth and can accordingly work. If PCM mode is selected for DAO, the result will be only 2.0-channel linear PCM. The surround sound capabilities of TrueHD will be lost.

No comments: