emit_bits_s() called by encode_one_block() in jchuff.c
所做的事就是單純地把bit 輸出
put_buffer 32bit 只用到右邊24bit
每次進來的bits 最多是16bit
再加上之前殘餘的最多不超過8bit( <= 7bit )
所以24bit 就足夠了
At most 16 bits can be passed to emit_bits
in one call, and we never retain more than 7 bits in put_buffer
between calls, so 24 bits are sufficient.
前次殘餘的bit + 這次進來的 bit
超過8bit 就輸出一個byte
1. 進來的code
2. 往左shift 靠在第24bit的位置
3. OR 之前的bit
4. 每8個bit 輸出一個byte 直到資料小於8bit
2010年2月1日 星期一
MP4 Audio Mux & AAC header format
用 DVBPortal (mp4creator) mux AVC & AAC
總共有2個trak
2個 mdat section
AAC Header
(參考 http://mp4tech.net/document/audiocomp/0000207.asp )
和 http://www.hydrogenaudio.org/forums/lofiversion/index.php/t21617.html
AAC的音频文件格式有以下两种:
ADIF:Audio Data Interchange Format 音频数据交换格式。这种格式的特征是可以确定的找到这个音频数据的开始,不需进行在音频数据流中间开始的解码,即它的解码必须在明确定义的开始处进行。故这种格式常用在磁盘文件中。
ADTS:Audio Data Transport Stream 音频数据传输流。这种格式的特征是它是一个有同步字的比特流,解码可以在这个流中任何位置开始。它的特征类似于mp3数据流格式。
Mux 完在mp4 mdat section 中的aac 比原始的aac 少了n個 7bytes的header
這些header 的格式為 FF F1 DC 40 XX XX XX
emphasis field 2 bit 現在沒有用了,所以是 Fixed header( 28bits) + Variable header(28bits) = 7 bytes
sync word 12bit : 1111 1111 1111 所以是 FF F
ID 1 0: MPEG-4, 1: MPEG-2
layer 2 always: '00'
protection_absent 1
profile 2
sampling_frequency_index 4
private_bit 1
channel_configuration 3
original/copy 1
home 1
ADTS Variable header: these can change from frame to frame
copyright_identification_bit 1
copyright_identification_start 1
aac_frame_length 13 length of the frame including header (in bytes)
adts_buffer_fullness 11 0x7FF indicates VBR
no_raw_data_blocks_in_frame 2
ADTS Error check
crc_check 16 only if protection_absent == 0
After that come (no_raw_data_blocks_in_frame+1) raw_data_blocks.
Some elaborations:
profile
bits ID == 1 (MPEG-2 profile) ID == 0 (MPEG-4 Object type)
00 (0) Main profile AAC MAIN
01 (1) Low Complexity profile (LC) AAC LC
10 (2) Scalable Sample Rate profile (SSR) AAC SSR
11 (3) (reserved) AAC LTP
ADTS詳細格式請參考 14496-3
由上可知 AAC Frame Length 為13bit, 所以一個AAC Frame最大值為8K
ADIF格式主要是應用在一般的檔案資料中,而ADTS格式則主要利用在網路的傳輸 上,為了避免傳輸產生的錯誤,ADTS格式在AAC檔案的每一個音框(frame)中都傳一次檔 頭;而ADIF格式只有一個檔頭。
ADTS 每一個frame前都有加檔頭 7bytes,
然後檔頭後面的格式 為raw format
有七種格式
常見的為
CPE
請參考 14496-3
http://www.aeroquartet.com/movierepair/aac.html
CPE 格式
21 0B CF or 21 0B CD
0010 0001 0000 1011 1100
1. 前3個bit 代表格式 在這邊 001 代表 此frame 為CPE ( Channel Pair Element )
其它還有 000 SCE ( Single Channel Element )
010 CCE
011 LFE ....
2. 再來 4個bit 為 element_instance_tag
3. 再來1個bit 為 common_window
4. 如果 common_windows 為1 在CPE中 接下來就是 ics_info
5. window_sequence 如果等於 EIGHT_SHORT_SEQUENCE (10) 就 ...
在此我們可以看到 window_sequence 不等於 EIGHT_SHORT_SEQUENCE
6. maxsfb 在此為 6bit 101111 (47) 剛好是呼叫 AACQuantize() 時 參數num_cb 的值
總共有2個trak
2個 mdat section
AAC Header
(參考 http://mp4tech.net/document/audiocomp/0000207.asp )
和 http://www.hydrogenaudio.org/forums/lofiversion/index.php/t21617.html
AAC的音频文件格式有以下两种:
ADIF:Audio Data Interchange Format 音频数据交换格式。这种格式的特征是可以确定的找到这个音频数据的开始,不需进行在音频数据流中间开始的解码,即它的解码必须在明确定义的开始处进行。故这种格式常用在磁盘文件中。
ADTS:Audio Data Transport Stream 音频数据传输流。这种格式的特征是它是一个有同步字的比特流,解码可以在这个流中任何位置开始。它的特征类似于mp3数据流格式。
Mux 完在mp4 mdat section 中的aac 比原始的aac 少了n個 7bytes的header
這些header 的格式為 FF F1 DC 40 XX XX XX
emphasis field 2 bit 現在沒有用了,所以是 Fixed header( 28bits) + Variable header(28bits) = 7 bytes
sync word 12bit : 1111 1111 1111 所以是 FF F
ID 1 0: MPEG-4, 1: MPEG-2
layer 2 always: '00'
protection_absent 1
profile 2
sampling_frequency_index 4
private_bit 1
channel_configuration 3
original/copy 1
home 1
ADTS Variable header: these can change from frame to frame
copyright_identification_bit 1
copyright_identification_start 1
aac_frame_length 13 length of the frame including header (in bytes)
adts_buffer_fullness 11 0x7FF indicates VBR
no_raw_data_blocks_in_frame 2
ADTS Error check
crc_check 16 only if protection_absent == 0
After that come (no_raw_data_blocks_in_frame+1) raw_data_blocks.
Some elaborations:
profile
bits ID == 1 (MPEG-2 profile) ID == 0 (MPEG-4 Object type)
00 (0) Main profile AAC MAIN
01 (1) Low Complexity profile (LC) AAC LC
10 (2) Scalable Sample Rate profile (SSR) AAC SSR
11 (3) (reserved) AAC LTP
ADTS詳細格式請參考 14496-3
由上可知 AAC Frame Length 為13bit, 所以一個AAC Frame最大值為8K
ADIF格式主要是應用在一般的檔案資料中,而ADTS格式則主要利用在網路的傳輸 上,為了避免傳輸產生的錯誤,ADTS格式在AAC檔案的每一個音框(frame)中都傳一次檔 頭;而ADIF格式只有一個檔頭。
ADTS 每一個frame前都有加檔頭 7bytes,
然後檔頭後面的格式 為raw format
有七種格式
常見的為
CPE
請參考 14496-3
http://www.aeroquartet.com/movierepair/aac.html
CPE 格式
21 0B CF or 21 0B CD
0010 0001 0000 1011 1100
1. 前3個bit 代表格式 在這邊 001 代表 此frame 為CPE ( Channel Pair Element )
其它還有 000 SCE ( Single Channel Element )
010 CCE
011 LFE ....
2. 再來 4個bit 為 element_instance_tag
3. 再來1個bit 為 common_window
4. 如果 common_windows 為1 在CPE中 接下來就是 ics_info
5. window_sequence 如果等於 EIGHT_SHORT_SEQUENCE (10) 就 ...
在此我們可以看到 window_sequence 不等於 EIGHT_SHORT_SEQUENCE
6. maxsfb 在此為 6bit 101111 (47) 剛好是呼叫 AACQuantize() 時 參數num_cb 的值
2010年1月6日 星期三
Y Color Range, Color space problem
Old standard use ITU 601
HD format use ITU 709
ITU 709 使用不同的轉換公式
Rec. 601 Y' = 0.299 R' + 0.587 G' + 0.114 B'
Rec. 709 Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'
請參考
http://www.glennchan.info/articles/technical/hd-versus-sd-color-space/hd-versus-sd-color-space.htm
還有Rec. 709 in wikipedia
http://en.wikipedia.org/wiki/Rec._709
http://dcmc.ee.ncku.edu.tw/pdf/course/Reports/Adaptive_Logarithmic_Mapping_For_Displaying_High_Contrast_Scenes.pdf
sRGB 和 Rec. 709 的primaries 一樣
Color 校正討論
http://my3c.com/D5/archiver/?tid-3187.html
Color system ( Color appearance model )
CIEXYZ 1931
CIELAB 1976
Munsell 1930s
CIECAM 2002
CIECAM02 is used in Windows Vista's Windows Color System.
HD format use ITU 709
ITU 709 使用不同的轉換公式
Rec. 601 Y' = 0.299 R' + 0.587 G' + 0.114 B'
Rec. 709 Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'
請參考
http://www.glennchan.info/articles/technical/hd-versus-sd-color-space/hd-versus-sd-color-space.htm
還有Rec. 709 in wikipedia
http://en.wikipedia.org/wiki/Rec._709
http://dcmc.ee.ncku.edu.tw/pdf/course/Reports/Adaptive_Logarithmic_Mapping_For_Displaying_High_Contrast_Scenes.pdf
sRGB 和 Rec. 709 的primaries 一樣
Color 校正討論
http://my3c.com/D5/archiver/?tid-3187.html
Color system ( Color appearance model )
CIEXYZ 1931
CIELAB 1976
Munsell 1930s
CIECAM 2002
CIECAM02 is used in Windows Vista's Windows Color System.
2009年12月28日 星期一
WINCE 不SUPPORT的函數
MFC for Windows CE does not support the following methods of the CWnd class:
ArrangeIconicWindows
CancelToolTips
ChangeClipboardChain
CreateCaret
CreateGrayCaret
DlgDirList
DlgDirListComboBox
DlgDirSelect
DlgDirSelectComboBox
DragAcceptFiles
DrawMenuBar
EnableScrollBar
EnableToolTips
FilterToolTipMessage
FlashWindow
GetClipboardViewer
GetDCEx
GetDSCCursor
GetLastActivePopup
GetSystemMenu
GetUpdateRgn
GetWindowContextHelpId
GetWindowPlacement
GetWindowRgn
HiliteMenuItem
InvalidateRgn
IsZoomed
LockWindowUpdate
OnActivateApp
OnAskCbFormatName
OnChangeCbChain
OnChildActivate
OnCompacting
OnContextMenu
OnDeviceChange
OnDevModeChange
OnDrawClipboard
OnDropFiles
OnDSCNotify
OnEndSession
OnEnterIdle
OnEnterMenuLoop
OnExitMenuLoop
OnGetMinMaxInfo
OnHScrollClipboard
OnIconEraseBkgnd
OnInitMenu
OnMButtonDblClk
OnMButtonDown
OnMButtonUp
OnMDIActivate
OnMenuSelect
OnMouseActivate
OnMouseWheel
OnMoving
OnNcActivate
OnNcCalcSize
OnNcCreate
OnNcHitTest
OnNcLButtonDblClk
OnNcLButtonDown
OnNcLButtonUp
OnNcMButtonDblClk
OnNcMButtonDown
OnNcMButtonUp
OnNcMouseMove
OnNcPaint
OnNcRButtonDblClk
OnNcRButtonDown
OnNcRButtonUp
OnPaintClipboard
OnPaletteIsChanging
OnParentNotify
OnQueryDragIcon
OnQueryEndSession
OnQueryNewPalette
OnQueryOpen
OnRButtonDblClk
OnRButtonDown
OnRButtonUp
OnRegisteredMouseWheel
OnSetCursor
OnSizeClipboard
OnSizing
OnSpoolerStatus
OnStyleChanging
OnSysColorChange
OnTimeChange
OnToolHitTest
OnVScrollClipboard
OnWindowPosChanging
SetClipboardViewer
SetMenu
SetWindowContextHelpId
SetWindowPlacement
SetWindowRgn
ShowOwnedPopups
ShowScrollBar
UnockWindowUpdate
ValidateRgn
http://msdn.microsoft.com/ja-jp/library/ms930331.aspx
ArrangeIconicWindows
CancelToolTips
ChangeClipboardChain
CreateCaret
CreateGrayCaret
DlgDirList
DlgDirListComboBox
DlgDirSelect
DlgDirSelectComboBox
DragAcceptFiles
DrawMenuBar
EnableScrollBar
EnableToolTips
FilterToolTipMessage
FlashWindow
GetClipboardViewer
GetDCEx
GetDSCCursor
GetLastActivePopup
GetSystemMenu
GetUpdateRgn
GetWindowContextHelpId
GetWindowPlacement
GetWindowRgn
HiliteMenuItem
InvalidateRgn
IsZoomed
LockWindowUpdate
OnActivateApp
OnAskCbFormatName
OnChangeCbChain
OnChildActivate
OnCompacting
OnContextMenu
OnDeviceChange
OnDevModeChange
OnDrawClipboard
OnDropFiles
OnDSCNotify
OnEndSession
OnEnterIdle
OnEnterMenuLoop
OnExitMenuLoop
OnGetMinMaxInfo
OnHScrollClipboard
OnIconEraseBkgnd
OnInitMenu
OnMButtonDblClk
OnMButtonDown
OnMButtonUp
OnMDIActivate
OnMenuSelect
OnMouseActivate
OnMouseWheel
OnMoving
OnNcActivate
OnNcCalcSize
OnNcCreate
OnNcHitTest
OnNcLButtonDblClk
OnNcLButtonDown
OnNcLButtonUp
OnNcMButtonDblClk
OnNcMButtonDown
OnNcMButtonUp
OnNcMouseMove
OnNcPaint
OnNcRButtonDblClk
OnNcRButtonDown
OnNcRButtonUp
OnPaintClipboard
OnPaletteIsChanging
OnParentNotify
OnQueryDragIcon
OnQueryEndSession
OnQueryNewPalette
OnQueryOpen
OnRButtonDblClk
OnRButtonDown
OnRButtonUp
OnRegisteredMouseWheel
OnSetCursor
OnSizeClipboard
OnSizing
OnSpoolerStatus
OnStyleChanging
OnSysColorChange
OnTimeChange
OnToolHitTest
OnVScrollClipboard
OnWindowPosChanging
SetClipboardViewer
SetMenu
SetWindowContextHelpId
SetWindowPlacement
SetWindowRgn
ShowOwnedPopups
ShowScrollBar
UnockWindowUpdate
ValidateRgn
http://msdn.microsoft.com/ja-jp/library/ms930331.aspx
2009年12月10日 星期四
Audio 知識
Sound --> ADC --> Digital Form ( CD, SACD, XRCD )
Digital Form --> DAC --> Analog --> Amplifier --> Speaker
Digital Form Enhance
1. Upsampling ( Dithering + Noise Shaping(Shaving?) + ...
24bit/176.4KHz Best
24bit Dynamic Range ( Equal Segment) is 144dB
20bit Dynamic Range is 120dB
16bit Dynamic Range is 96dB
XRCD Dynamic Range is around 108dB
Formula
20 * log10( 2^24 ) = 20 * 7.22 = 144 dB
SNR = Dynamic Range + 1.76dB
The dynamic range of human hearing is roughly 140 dB.
2. Digital Transfer
by SPDIF
by XLR
by HDMI
transmiiter IC --> wire --> receiver IC--> I2S ( DAC accepted form ) --> DAC
DAC
Dynamic Range
SNR
THD ( Total Harmonic Distortion )
IMD
PCM1792 Datasheet recommended using NE5534 & LT1028 op
The operational amplifier recommended for the IV circuit is the NE5534, and the operational amplifier recommended for the differential circuit is the Linear Technology LT1028, because its input noise is low.
The circuit of Figure 37 can realize the highest performance. In this case the output level is set to 4.5 V rms and 129 dB S/N is achieved (stereo mode). In monaural mode, if the output of the L-channel and R-channel is used as a balanced output, 132 dB S/N is achieved (see Figure 39).
Balanced Output (XLR, TRS)
Digital Form --> DAC --> Analog --> Amplifier --> Speaker
Digital Form Enhance
1. Upsampling ( Dithering + Noise Shaping(Shaving?) + ...
24bit/176.4KHz Best
24bit Dynamic Range ( Equal Segment) is 144dB
20bit Dynamic Range is 120dB
16bit Dynamic Range is 96dB
XRCD Dynamic Range is around 108dB
Formula
20 * log10( 2^24 ) = 20 * 7.22 = 144 dB
SNR = Dynamic Range + 1.76dB
The dynamic range of human hearing is roughly 140 dB.
2. Digital Transfer
by SPDIF
by XLR
by HDMI
transmiiter IC --> wire --> receiver IC--> I2S ( DAC accepted form ) --> DAC
DAC
Dynamic Range
SNR
THD ( Total Harmonic Distortion )
IMD
PCM1792 Datasheet recommended using NE5534 & LT1028 op
The operational amplifier recommended for the IV circuit is the NE5534, and the operational amplifier recommended for the differential circuit is the Linear Technology LT1028, because its input noise is low.
The circuit of Figure 37 can realize the highest performance. In this case the output level is set to 4.5 V rms and 129 dB S/N is achieved (stereo mode). In monaural mode, if the output of the L-channel and R-channel is used as a balanced output, 132 dB S/N is achieved (see Figure 39).
Balanced Output (XLR, TRS)
2009年11月29日 星期日
Making Money Thought
1. increase C/P
2. Automatic increase
3. Mass Customer
1. 能隨時間 經驗增加價值
2. 自動工作 (365天24小時無休)
3. 服務更多的人
Don't be a labor, be a Consultant
2. Automatic increase
3. Mass Customer
1. 能隨時間 經驗增加價值
2. 自動工作 (365天24小時無休)
3. 服務更多的人
Don't be a labor, be a Consultant
2009年11月26日 星期四
目錄無法Delete Copy Rename 的問題
在USB300 發現一個問題 就是在網路中無法將目錄改名
那是因為目錄名稱最後是空白字元 ( Trailing Space )
參考 http://support.microsoft.com/?scid=kb%3Ben-us%3B320081&x=15&y=12
那是因為目錄名稱最後是空白字元 ( Trailing Space )
參考 http://support.microsoft.com/?scid=kb%3Ben-us%3B320081&x=15&y=12
訂閱:
文章 (Atom)