2009年4月8日 星期三

PS3, HDMI, Dolby Digital TrueHD 完全解答

在買了PSP之後 開始又在研究下一代HD 音效的部份
(或多或少跟工作也有關係)
又看了一些 ASUS HDAV13 音效卡的討論
最近剛始想買 PS3
所以對 PS3 能不能解 Dolby TrueHD
及正確的觀念及輸出接法 有了深切的研究

要了解這個問題
必需先對下一代影音的規格 有正確的認識
  1. HDMI、HDMI1.3
  2. Blu-ray disc spec
  3. Dolby Digital, Dolby TrueHD, DTS HD Master
  4. S/PDIF

直接來看問題 比較快
1. PS3 能不能播放 Dolby Digital TrueHD? 能不能點燈?

這個問題 相信在各大討論區都有討論過了 而且大家也都知道正確的答案
那就是 PS3 在播放 Dolby TureHD 時 是用內部解碼成 LPCM 格式從HDMI port輸出
所以是可以"正確"地播放 沒有問題。
但是其輸出並不是TrueHD encoded Bitstream 所以在支援TrueHD 的Amplifier 上是無法點燈的

2. LPCM 比TrueHD bitstream 差, 點燈爽度較高?
實際上來說 沒有差別 很大的部份是心理作用
HDMI LPCM 傳輸也是 Digital 格式和TrueHD Bitstream 一樣 所以線材影響不大(同一線材 2種格式沒有影響)。那麼 差別到底在哪呢? 差別在於 LPCM 格式是 Uncompressed 而 TrueHD(or DTS-MA)是 loseless compressed,差別就在於 TrueHD(DTS-MA)Bitstream 較省HDMI傳輸頻寬,因為是到從HDMI傳輸到 Amplifier之後再行解碼,而PS3 LPCM方式 是由PS3解碼後再傳輸到Amplifier。
假設 支援TrueHD 的Amplifier 和PS3 都正確地解碼,其解出來的資料,"應該"完全一致。

3. HDMI 及Blu-ray 的限制
然而,我相信HDMI及Blu-ray disc spec 的限制 會造成在某種情況下 LPCM較差。
先看 HDMI spec (from wikipedia)

HDMI version 1.0–1.2a 1.3+
Maximum signal bandwidth (MHz) 165 340
Maximum TMDS bandwidth (Gbit/s) 4.95 10.2
Maximum video bandwidth (Gbit/s) 3.96 8.16
Maximum audio bandwidth (Mbit/s) 36.86 36.86
Maximum Color Depth (bit/px) 24 48[A]
Maximum resolution over single link at 24-bit/px[B] 1920×1200p60 2560×1600p75
Maximum resolution over single link at 30-bit/px[C] N/A 2560×1600p60
Maximum resolution over single link at 36-bit/px[D] N/A 1920x1200p75
Maximum resolution over single link at 48-bit/px[E] N/A 1920×1200p60
HDMI version 1.0 1.1 1.2
1.2a
1.3 1.3a
1.3b
1.3b1
1.3c
sRGB YesY YesY YesY YesY YesY
YCbCr YesY YesY YesY YesY YesY
8 channel LPCM/192 kHz/24-bit audio capability YesY YesY YesY YesY YesY
Blu-ray Disc video and audio at full resolution[F] YesY YesY YesY YesY YesY
Consumer Electronic Control (CEC)[G] YesY YesY YesY YesY YesY
DVD-Audio support NoN YesY YesY YesY YesY
Super Audio CD (DSD) support[H] NoN NoN YesY YesY YesY
Deep Color NoN NoN NoN YesY YesY
xvYCC NoN NoN NoN YesY YesY
Auto lip-sync NoN NoN NoN YesY YesY
Dolby TrueHD bitstream capable NoN NoN NoN YesY YesY
DTS-HD Master Audio bitstream capable NoN NoN NoN YesY YesY
Updated list of CEC commands[I] NoN NoN NoN NoN Yes

我們看到 不論是HDMI 1.0或 HDMI 1.3, 其Audio 傳輸的能力都是一樣的
也就是最大 36.86 Mbit/s,8 Channel 24bit 192KHz LPCM

然後看一下TrueHD spec
有說到這一段

In the Blu-ray specification, Dolby TrueHD is an optional codec. Dolby TrueHD audiotracks may carry up to 24 bit audio in up to 8 discrete audio channels at 96 kHz or up to 6 channels at 192 kHz. The maximum encoded bitrate is 18 Mbit/s (the same as the uncompressed rate).

在Blu-ray的規格裡 Dolby TrueHD 音軌 只能儲存 8Channel 24bit 96KHz
或者 24bit 192KHz 6 Channel。其最大的 encoded bitrate 為 18Mbit/s。
有趣的是未壓縮的最大bitrate 也是 18Mbit/s。

(DTS-HD MA )
(DTS-HD MA supports variable bit rates up to 24.5 Mbit/s on a Blu-ray Disc and up to 18.0 Mbit/s for HD DVD)

DTS-HD MA 在Blu-ray 上最大碼率是 24.5Mbit/s。


這代表什麼呢? 也就是 Blu-ray 對LPCM儲存的限制
由HDMI的規格來看 其最大傳輸率為36.86 Mbit/s
在沒有超過最大上限的流量之內 傳LPCM和 TrueHD bitstream 是一樣
但是Blu-ray 的音軌最大是18Mbit/s,所以會造成一種現象
在高碼率高Channel的原始資料下 用LPCM方式儲存的資料量太大
所以通常Blu-ray disc 會用 Dolby Digital (AC3, lossy compression) 或用 Dolby TrueHD
的編碼方式儲存在音軌上。

現在,問題來了,假如高音質Dolby TrueHD 7.1聲道的影片 存滿整個音軌 也就是18Mbit/s 的資料量,但是在傳輸之前經過PS3的解碼 其解碼後的Bitrate (以壓縮率 2:1來說 解完後可達36Mbit/s)
很有可能超過 HDMI能傳輸的最大值。
此時 PS3 會怎麼做呢? 當然就是Downgrade (Re-mix)其內容。
可參考
http://www.avsforum.com/avs-vb/showthread.php?t=1017825
Downgrade 最簡單的方法 就是裁掉一些較不重要的Channel (7.1或 6.1 變成 5.1)
這才會是 LPCM 和 TrueHD, DTS-HD MA bitstream 最大的差別

(PS3 在 firmware 2.3 update 之後 開始支援 DTS-HD MA解碼)

在另一篇討論
http://www.avforums.com/forums/blu-ray-dvd-players/660426-silicon-image-confirms-ps3-will-not-support-bitstream-truehd-dts-hd-ma.html

中 可以看出 其HDMI Transmitter Silicon 9132 的限制(如果現在版本PS3 還是使用這Chip 的話)
由於此限制 要靠firmware update 來讓PS3輸出 bitstream 是不可能的
這也是非戰之罪 在當時的環境 要完整支援HDMI 1.3 的Chip 應該是沒有
所以除非 PS3有改硬體版本 + firmware update 支援
不然是不太可能的

4. 結論
在沒有超過 PS3 LPCM解碼能力或HDMI傳送能力之外的 HD Audio Content。
以LPCM over HDMI或 Bitstream over HDMI方式輸出都是一樣的。就好像在比
APE和WAV 哪個音質比較好?這是沒有意義的。
HDMI 1.3 新增的Dolby TrueHD 及DTS-HD MA Bitstream 只是一種改進,新增一些經無損壓縮的方式,來傳送資料。也因此擴大了
傳輸的效率,達到更高更美好的境界。而這也是在專業的PowerDVD 網站上,
對 Dolby TrueHD 所做的介紹

Dolby TrueHD:專門支援HD DVD播放器及部分藍光光碟。Dolby TrueHD 屬於100%無損耗音效技術,能提供和未壓縮PCM格式完全相同的播放音質,且位元率只有PCM格式的一半到三分之一。更低的位元率使內容能為您帶來更優異的聽覺體驗,且不必犧牲品質。

2009年4月7日 星期二

TV Box 的思考

source output digital ( HDMI ) > YPbPr > S-Video > Composite
middle 1:1 tv
display hdmi or dvi


TV Box
convert analog video ( Composite, YPbPr, S-Video, Cable ) to digital
mixed with Computer (PIP)
output to LCD

WINCE USB Printer

1.
USB Printer Class
  • bInterfaceClass 07
  • bInterfaceSubClass 01
  • bInterfaceProtocol 02

2. USB Host Client Driver
WINCE 5 support 的 Host Client Driver 有四種
  • USB Human Input Device (HID) Class Driver
  • USB Printer Class Driver
  • USB Remote NDIS Class Driver
  • USB Storage Class Driver

Remote NDIS 是屬於

Base Class E0h (Wireless Controller)

This base class is defined for devices that are Wireless controllers. Values not shown in the table below are reserved. These class codes are to be used in Interface Descriptors, with the exception of the Bluetooth class code which can also be used in a Device Descriptor.

Base Class

SubClass

Protocol

Meaning

E0h

01h

01h

Bluetooth Programming Interface. Get specific information from the Bluetooth SIG.

02h

UWB Radio Control Interface. Definition for this is found in the Wireless USB Specification in Chapter 8.

03h

Remote NDIS. Information can be found at: http://www.microsoft.com/windowsmobile/mobileoperators/default.mspx

02h

01h

Host Wire Adapter Control/Data interface. Definition can be found in the Wireless USB Specification in Chapter 8.

02h

Device Wire Adapter Control/Data interface. Definition can be found in the Wireless USB Specification in Chapter 8.

03h

Device Wire Adapter Isochronous interface. Definition can be found in the Wireless USB Specification in Chapter 8.






USB Class Code

Base Class

Descriptor Usage

Description

00h

Device

Use class information in the Interface Descriptors

01h

Interface

Audio

02h

Both

Communications and CDC Control

03h

Interface

HID (Human Interface Device)

05h

Interface

Physical

06h

Interface

Image

07h

Interface

Printer

08h

Interface

Mass Storage

09h

Device

Hub

0Ah

Interface

CDC-Data

0Bh

Interface

Smart Card

0Dh

Interface

Content Security

0Eh

Interface

Video

0Fh

Interface

Personal Healthcare

DCh

Both

Diagnostic Device

E0h

Interface

Wireless Controller

EFh

Both

Miscellaneous

FEh

Interface

Application Specific

FFh

Both

Vendor Specific


2009年4月6日 星期一

音響 音樂之全流程 & Thinking

原始聲音 ---> 錄音 ( Loss, better use 24bit/96KHz) --> Media(CD, SACD, Blu-ray, DVD) --> Extract (抓軌, 最好確定完美)
--> Player (Foobar) --> OS Audio Layer (DirectSound? Waveform API?)( Better use WAS API or ASIO for Low Latency )
--> AC97(x) or HD Audio or PCI, PCI Express (如果放CD的話最好支援原生44.1KHz, No SRC)
--> DAC (需要完美DAC 最好不受干擾,板子Layout) --> 後級 Amplifier ( Analog Amplify )(花錢及功力所在)
--> Speaker (材質, 特性...) --> Environmet (環境, 喇叭擺設) --> 人耳 (原音重現?)



http://www.highdefdigest.com/news/show/1064
這篇文章對釐清觀念很有幫助


Blu-ray discs can provide their movie soundtracks in any of the following formats:

Dolby Digital
What it is: The audio format familiar from DVD, Dolby Digital (sometimes known as AC-3) is one of the base standards of Blu-ray. It works basically the same way that it worked on DVD in configurations from 1.0 to 5.1, though it does offer a higher maximum bit rate of 640 kb/s (which is considered audibly indistinguishable from Dolby Digital Plus at the same rate).
Level of support: Full support for Dolby Digital is mandatory in all Blu-ray disc players.
Examples of discs that use it: Almost all Blu-ray discs from Sony, Warner Bros., Paramount, and Lionsgate, among others.
How to get it:

  • Toslink or Coaxial SPDIF - Using an SPDIF connection, the Dolby Digital bitstream is sent directly to your receiver for decoding, converting to analog, and amplifying to your speakers.
  • HDMI - Depending on the setting chosen in your Blu-ray disc player, the HDMI output can be used to transmit the Dolby Digital bitstream to be decoded in the receiver, or the player itself can perform the decoding to a PCM signal and transmit instead in that form. The receiver will still be needed for digital-to-analog conversion and amplification.
  • Multi-channel analog - With the analog connections, the player itself must decode the Dolby Digital bitstream and convert it from digital to analog. This will then be passed to the receiver for amplification. In this case, calibration adjustments such as speaker sizes and channel levels should be entered into the Blu-ray disc player's setup menus, not the A/V receiver's. The quality of the resulting sound will vary depending on whether the Digital-to-Analog (DAC) components in the player are as good as those in the receiver. If the receiver has superior DACs, a digital connection (either SPDIF or HDMI) will be preferred.

DTS
What it is: Sometimes referred to as DTS Encore (though DTS themselves don't seem to use that name anymore), this sound format is another familiar holdover from standard DVD. Blu-ray, however, more ably supports the codec at its higher 1.5 Mb/s bit rate.
Level of support: All Blu-ray disc players are required to support the transmission of a DTS bitstream over a digital connection and internal decoding up to at least 2 channels. Most players (other than early models such as the Samsung BD-P1000) will decode internally to 5.1.
Examples of discs that use it: 'Terminator 2', 'Lara Croft: Tomb Raider'.
How to get it:

  • Toslink or Coaxial SPDIF - The DTS bitstream will be sent to your receiver for decoding and processing.
  • HDMI - As with Dolby Digital, the HDMI connection can carry the raw DTS bitstream for decoding in the receiver, or the player may decode it to PCM first.
  • Multi-channel analog - The Blu-ray disc player will decode the DTS bitstream (only 2 channel decoding is required, but most players will do 5.1) and convert it to analog, after which it will be sent to the receiver for amplification. Once again, the final sound quality will depend on how well the audio components in the disc player compare to those in the receiver.

Dolby Digital Plus
What it is: An enhancement over standard Dolby Digital, DD+ offers higher bit rates and more efficient compression, resulting in improved sound quality. It can also support movie soundtracks up to 7.1 discrete channels (though honestly, the vast majority of Hollywood movies are only mixed for 5.1). On Blu-ray, DD+ is encoded as an extension to a "core" Dolby Digital AC-3 track.
Level of support: Unfortunately, DD+ is optional on the Blu-ray format, and not all disc players are required to support it. Many players will simply read the 640 kb/s core and disregard the extension. As a result, most movie studios prefer to use either basic Dolby Digital AC-3 or some of the other advanced formats.
Examples of discs that use it: 'A View from Space with Heavenly Music' claims a DD+ track, assuming that the packaging and menus aren't just mislabeled.
How to get it:

  • Toslink or Coaxial SPDIF - SPDIF cannot carry a full DD+ signal. If you use this connection method, the player will limit output to the Dolby Digital AC-3 core.
  • HDMI - If the player does not support DD+, it will simply extract the AC-3 core, in which case see the Dolby Digital listing above. Some players may decode the DD+ to PCM and transmit it over HDMI (any version). Other players will instead choose to transmit the DD+ bitstream to a receiver for decoding, but this requires HDMI 1.3 connections on both ends of the chain.
  • Multi-channel analog - Either the Blu-ray player will extract and decode the AC-3 core, or (on some models) will decode the full DD+ and convert it to analog.

DTS-HD High Resolution
What it is: Similar to Dolby Digital Plus, DTS-HD High Resolution is an enhancement over standard DTS that offers higher bit rates and better compression. DTS-HD HR is also encoded as an extension to a "core" DTS track. (Note that DTS-HD HR is sometimes referred to as just "DTS-HD", which can be confusing and possibly misleading).
Level of support: Since this codec is also optional on Blu-ray, many players will only extract the 1.5 Mb/s DTS core and ignore the extension.
Examples of discs that use it: 'Basic Instinct', 'Total Recall'.
How to get it:

  • Toslink or Coaxial SPDIF - Because SPDIF cannot transmit a full DTS-HD HR signal, the player will extract the DTS core and send the bitstream for that instead.
  • HDMI - If the player does not support DTS-HD HR, it will extract the DTS core, replicating the DTS listing above. Some players may decode the DTS-HD HR to PCM and transmit it over any version of HDMI. Other players will instead transmit the DTS-HD HR bitstream to a receiver for decoding (this requires HDMI 1.3).
  • Multi-channel analog - Either the Blu-ray player will extract and decode the DTS core, or (on some models) will decode the full DTS-HD HR and convert it to analog.

PCM
What it is: A PCM track is an exact replication of the studio master, encoded on disc without compression. The benefit to this is that it maintains the purity of the source without any loss of fidelity that may come from compression. The downside is that an uncompressed audio track takes up a tremendous amount of disc space, which may (especially on single-layer BD25 discs) negatively affect the video quality of the movie. While the Blu-ray format is capable of utilizing PCM audio up to 24-bit resolution, studios may choose to encode at 16-bit resolution instead, depending on the bit depth of the original source or concerns about conserving bandwidth (downsampling a 24-bit master to 16 bits is technically not the same thing as compression).
Level of support: All Blu-ray disc players are required to support PCM audio.
Examples of discs that use it: Almost all discs from Sony and Disney, as well as selected titles from Lionsgate and other studios.
How to get it:

  • Toslink or Coaxial SPDIF - SPDIF does not have enough bandwidth to carry a full 5.1 PCM signal, so the audio track will be downgraded to 2 channels only. This is generally an undesirable result.
  • HDMI - A PCM track can be transmitted in full quality over any version of HDMI and delivered to the receiver for D-to-A conversion and amplification.
  • Multi-channel analog - In this case, the player converts the PCM to analog and sends it to the receiver for amplification. The quality of the DACs in the player will determine the final audio quality. If the disc player has inferior DACs to the receiver, an HDMI connection is preferred.

Dolby TrueHD
What it is: Dolby TrueHD is a "lossless" compression codec. Although it is compressed to take up less disc space than a PCM track, once decoded it is bit-for-bit identical to the studio master (at either 16-bit or 24-bit resolution, at the discretion of the studio). It may help to think of it like a ZIP file that holds a PCM track. Once you unZIP the file, you get a 100% identical copy of the original PCM, without compromising any sound quality.
Level of support: TrueHD is an optional format on Blu-ray. And since TrueHD is not built in a core+extension configuration, Blu-ray discs that contain a TrueHD track are also required to contain a standard Dolby Digital AC-3 track for compatibility with players that don't support TrueHD.
Examples of discs that use it: 'Ghost Rider', 'The Fifth Element' (Remastered).
How to get it:

  • Toslink or Coaxial SPDIF - SPDIF cannot carry a TrueHD signal. If using this connection type, the player will automatically revert to playing back the standard Dolby Digital AC-3 track instead.
  • HDMI - If the player does not support TrueHD, it will revert to the standard Dolby Digital track. Some players may decode the TrueHD to PCM and transmit it over any version of HDMI. Other players will instead transmit the TrueHD bitstream to a receiver for decoding (HDMI 1.3 required).
  • Multi-channel analog - Either the Blu-ray player will decode the standard Dolby Digital track, or (on some models) will decode the TrueHD and convert it to analog.

DTS-HD Master Audio
What it is: Another lossless audio codec similar to Dolby TrueHD. The difference between the two is that DTS-HD MA is built in a core+extension configuration (just like DTS-HD HR). Although a DTS-HD MA track takes up more disc space than a TrueHD track, it does not require a secondary standard track for backwards compatibility. Since both DTS-HD MA and TrueHD are lossless, they are both 100% identical in quality to the studio master, and hence identical in quality to each other.
Level of support: Like DTS-HD HR, Master Audio is optional on the Blu-ray format. If the player does not support DTS-HD MA, it can extract the standard DTS core.
Examples of discs that use it: Almost all titles from Fox Home Entertainment.
How to get it:

  • Toslink or Coaxial SPDIF - SPDIF cannot carry a DTS-HD MA signal. When using this connection type, the player will extract the standard DTS core instead and transmit that as a bitstream.
  • HDMI - If the player does not support DTS-HD MA, it will extract the DTS core. Some players may decode the DTS-HD MA to PCM and transmit it over any version of HDMI. Other players will instead transmit the DTS-HD MA bitstream to a receiver for decoding (HDMI 1.3 required).
  • Multi-channel analog - Either the Blu-ray player will decode the standard DTS core, or (on some models) will decode the DTS-HD MA and convert it to analog.

At the time of this writing, only one Blu-ray disc player (the Samsung BD-P1400) supports the transmission of a DTS-HD Master Audio bitstream over HDMI 1.3. No current Blu-ray disc players will yet decode the DTS-HD MA track to PCM internally. All other players are limited to extraction of the standard DTS core. This situation is expected to change in the near future as more player models are released, and manufacturers issue firmware updates to existing players.



2009年4月2日 星期四

Open Source DVD burning software --- InfraRecorder




zlib 在 Visual Studio 2005 下编译失败的解决办法(转)

最近需要读写 png 文件,按照以前的办法试验,却发现无法编译zlib 1.2.3。出错信息为:

inffas32.asm(594) : error A2070: invalid instruction operands
inffas32.asm(596) : error A2070: invalid instruction operands
inffas32.asm(610) : error A2070: invalid instruction operands
inffas32.asm(667) : error A2070: invalid instruction operands

上网一查,发现别人也遇到相同的问题:http://svn.haxx.se/dev/archive-2005-11/0942.shtml。原因在于

It (Microsoft Macro Assembler 8.0, included with Visual C++ 2005 Express ) refuses to assemble a MOVD instruction with a memory operand with an implied size, and requires that "dword ptr" prefix the memory operand.

微软说这是by design,不是bug:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=6306f7dc-2cc2-4591-bd60-5d802178fdfa

解决办法是把inffas32.asm中的4处出错的类似

movd mm4, [esp+0]

的汇编代码,添加dword ptr修饰符,改为

movd mm4,dword ptr [esp+0]

这样就能顺利编译、通过测试了。

当然,其它的error A2070: invalid instruction operands错误也做同样处理。



InfraRecorder 只是個Shell

實際上它會call cdrecord 去做事


要燒錄DVD

往ATAPI 及 MMC 去 survey

http://www.ata-atapi.com/

http://www.lvr.com/mass_storage.htm


在 USB Mass Storage Spec 中有說,

光碟機 bInterfaceSubClass 通常為02 使用 SFF-8020i, MMC-2 Commands

Flash 隨身碟 bInterfaceSubClass 通常為 06 SCSI transparent command

bInterfaceProtocol 50h 為 bulk-only transport, BOT

bClass 08 Mass Storage Class


SCSI Primary Commands ( SPC-2 -3 -4 )



WINCE

The sample ATAPI driver is in the %_WINCEROOT%\Public\Common\OAK\Drivers\Block\ATAPI directory


ITU 601 656 釋疑

ITU 601 (CCIR 601) 是
is a standard published by International Telecommunication Union - Radiocommunications sector (formerly CCIR) for encoding interlaced analogue video signals in digital form.

是一種Encoding ( Sampling ) 的方式,把類比的Video 訊號轉成數位的一種標準格式。
不論在 PAL 或 NTSC 其 sample rate 為 13.5MHz


而 656是
describes a simple digital video protocol for streaming uncompressed PAL or NTSC Standard Definition TV (525 or 625 lines) signals.

則是一種 protocol, 用來傳送 digital form video 的協定
而這個digital video 就是 601的格式

BT.601 data range ( 16-235)

A BT.656 data stream is a sequence of 8-bit or 10-bit words, transmitted at a rate of 27 Mbyte/s. Horizontal scan lines of video pixel data are delimited in the stream by 4-byte long SAV (Start of Active Video) and EAV (End of Active Video) code sequences.

656 的傳輸速度為 27MB/s。不用 Sync signal, 因為 Sync embedded 在 data 裏面。用 SAV 或 EAV 來判斷。
SAV 或 EAV 有個表可以查。00 和 FF 為保留值,資料範圍只用 ( 1 - 254 )