200 likes | 317 Vues
This project focuses on enhancing the performance of the MPEG-4 decoder by simplifying the reference software to a Simple Profile version and utilizing MMX instruction sets to accelerate decoding speed. Key improvements include analyzing the decoding process to identify time-consuming components, and modifying crucial parts to take advantage of MMX capabilities, resulting in significant speed enhancements. The study covers aspects such as shape decoding, motion compensation, and texture decoding, ultimately aiming to reduce the executable size below 200KB while implementing fast inverse discrete cosine transform (IDCT) methods.
E N D
Toward Optimized MPEG-4 Decoder 羅仲耘 吳方荃 楊士萱教授 指導
Outline • 專題方向簡介 • 改善項目 • 改善方法 • 未來工作
專題方向 • 將reference software 簡化為Simple Profile版本 • 利用MMX指令集加快解碼速度
改善階段 • Trace decoding流程 • 刪除Simple Profile不需要的部份 • 分析decoding時主要部份花費比率 • 將佔decoding比率比較大的部分以MMX去做改善
Video_object_layer_shape PreviousReconstructedVOP ShapeDecoding Coded Bit Stream(Motion) MotionDecoding MotionCompen-sation VOPRecon-struction TextureDecoding Coded Bit Stream(texture) Demultiplexer Simplified Video Decoding Process
Cost time analysis • 各部份佔程式總執行時間
Cost time analysis (cont.) • PVOP佔decode的99%以上 • Decode PVOP各部份所佔時間
MMX 介紹 • SIMD(Single Instruction Multiple Data) • 57 條新的 operand code • 8 個 64 bits 暫存器 • 對於 8bits, 16 bits, 32 bits的資料處理優異
MMX 提供的資料型態 • Packed byte Eights bytes packed into one 64-bit quantity • Packed word Four words packed into one 64-bit quantity • Packed doubleword Two doublewords packed into one 64-bit quantity • Quandword one 64-bit quantity
MMX 指令組 • 拷貝指令 (movq /movd) • 分組指令 • punpcklbw / punpcklwd / punpckldq • packuswb • packsswb/packssdw • 運算指令
MMX 優點 • 提升程式速度50~400% • 可一次擷取64-bit記憶體資料 • MMX與standard integer code可同時執行 • MMX指令集完全管線化(pipelined),每次執行時間在1 clock cycle之內。 • MMX指令中的multiple instruction亦可在1 clock cycle內執行完畢
MMX 缺點 • MMX code和 floating point code不能同時執行 • MMX registers不可以存放address • 不是所有的處理器都支援MMX指令集
如何利用MMX做加速 • 兩個 block 相加的程式用MMX取代 • 一次可處理兩筆資料
Block 資料型態 • m_ppxlcPredMBY -- unsigned short • m_ppxliErrorMBY -- int
處理方法 • 從m_ppxlcPredMBY的位置搬兩筆資料到MMX register • 將m_ppxlcPred在MMX register的資料做對齊 • 從m_ppxlcErrorMBY的位置搬兩筆資料到MMX register • 相加後結果pack後放回記憶體
處理方法(cont.) m_ppxlcPred punpcklbw punpcklbw
處理方法 (cont.) M_ppxlcPredMBY M_ppxlcErrorMBY 相加後的結果
處理方法 (cont.) 相加的結果 packusbw packusbw
目前進度 • Code size • Cost time ( AddErrorAndPredToCurrQ)
未來工作 • 判斷 Half Block 及 Full Block 用MMX加速 • Fast IDCT 資料搬移用MMX加速 • 執行檔減少至200KB以下