160 likes | 351 Views
Introduce the Windows audio & video techniques. Reference: ms-help://MS.MSDNQTR.2004JAN.1033/wmcodecs/htm /windowsmediaaudioandvideocodecinterfaces.htm. Introduction. Windows Media Audio and Video Codec Interfaces. compress and decompress audio and video content
E N D
Introduce the Windows audio & video techniques Reference: ms-help://MS.MSDNQTR.2004JAN.1033/wmcodecs/htm /windowsmediaaudioandvideocodecinterfaces.htm
Windows Media Audio and Video Codec Interfaces • compress and decompress audio and video content • The codec is implemented by DirectX media objects (DOMs)
Overview of the Windows Media Format SDK • 提供存取 Advanced Systems Format(ASF) 的功能 • Configure the content of ASF files • Encode audio and video • Retrieve the content of ASF files • You can access the metadata using the Windows Media codecs stored in the header of ASF files. bit rate, # of video frame
Windows Media SDK VS. Windows Media Audio and Video Codec Interface 接下頁
Video Interlacing 簡單介紹 Deinterlaced properly before deinterlaced 參考資料: http://www.100fps.com/
類比攝影機的情況 1) Record field 1 (=frame1) (odd scan lines) 2) Record field 2 (=frame2) (even scan lines) 3) Record field 3 (=frame3) (odd scan lines) 4) Record field 4 (=frame4) (even scan lines) 甚麼叫做 interlacing • Your digital camcorder does the following • Records 50 pictures per second • intermixing every 2 consecutive pictures (with half the height) into1 frame • This mixing is called interlacing fields the timeline of your digital camcorder 1) Record field 1 2) Record field 2 3) Mix (=interlace) field 1 and field 2 into one frame and save the frame as frame 1. 4) Record field 3 5) Record field 4 6) Mix (=interlace) field 3 and field 4 into one frame and save the frame as frame 2
數位攝影機到底幫我們做了甚麼事? Field1 captures at half the height Field2 captures at half the height 看起來一樣, 可是兩張圖確實不一樣
組合成完整的 frame 實際上, 數位攝影機存放的 資料就是長這樣
設定編譯環境 Setting Debug value Release value C/C++ Runtime library Debug Multithreaded DLL Ignore all default library Link tab, General Link tab, Library Msvcrtd.lib and Wmvcore.lib. Do not include Libc.lib Directories C:\WMSDK\WMFSDK9\include C:\WMSDK\WMFSDK9\lib
程式碼注意事項 1 * 呼叫任何 creation function 之前, 要先初始 COM HRESULT hr=CoInitialize(NULL); if (FAILED(hr)){ printf(“ERROR – 無法初始 COM library"); return -1; } 2 檢查錯誤: 應該使用 FAILED macro HRESULT hr; hr = SomeFunction(); if (FAILED(hr)) { // Check for specific error values. }
程式碼注意事項 3 Release 物件: 使用 SAFE_RELEASE macro 與 SAFE_ARRAY_DELETE macro #ifndef SAFE_RELEASE #define SAFE_RELEASE(x) if(x != NULL) { x->Release(); x = NULL; } #endif #ifndef SAFE_ARRAY_DELETE #define SAFE_ARRAY_DELETE(x) if(x != NULL) { delete[] x; x = NULL; } #endif