摘要
H.264/AVC作为ITU-T VCEG(Video Coding Experts Group视频专家组)和ISO/IEC MPEG(Moving Picture Experts Group运动图像专家组)联合制定的最新视频编码标准,近年来已经在学术界和工程界得到深入研究,并开始引入实际应用领域。相比之前的视频标准,H.264在压缩率、图像质量、传输鲁棒性等方面都有着无可比拟的优势,但这些优越性能是以大幅度增加视频算法的复杂度为代价的,在标准推出的初期,很难应用到实际项目中。随着对视频算法研究的深入和巨大潜在市场的吸引,目前设计实时视频编码器已成为各大厂商和科研机构追求的目标。
本文以H.264实时视频编码器的设计、移植和优化为主题,完成从建立MATLAB仿真模型到提出改进的快速编码算法,再到基于VC++和DM643平台完成H.264实时视频编码器设计、移植和优化。在运动估计部分,针对大多快速搜索算法易陷入局部极小值或引入错误的搜索方向,本文提出一种基于八边形网格的块匹配算法,使搜索速度提高42.4%;在帧内预测模块,本文采用Sobel算子预先检测图像纹理,并利用检测信息快速剔除多余的候选模式,使帧内预测速度提高61%;在帧间预测模块,本文采取利用CBP(Coded Block Pattern)和MVD(Move Vector Difference)信息和早期判决SKIP模式的策略对帧间预测模式进行预先分析和处理,使帧间预测模块速度提高了53%。基于实现H.264基本档次编码器的设计要求,本文在VC++坏境下完成H.264视频算法的裁剪、移植和优化,使H.264视频编码器的编码速度达到CIF 44fps。最后,本文在TI DM643平台上完成了H.264代码的算法级、系统级和指令级优化,将H.264视频编码器的编码性能达到CIF 20fps。
在取得与原有图像质量相当的前提下,本文力求降低视频编码的复杂度并尽可能地提高H.264的编码速度。改进的H.264编码算法为设计H.264实时编码器提供了理论支持,基于VC++和TI DM643所做的设计、移植和优化也为实现H.264实时编码器提供了参考方案,对开发H.264产品具有一定的理论和实践意义。
H.264/AVC as the the latest video encoding standards,which has been studied deeply in academia and engineering fields and begins to practical application,jointly developed by the ITU-T VCEG and ISO/IEC MPEG.Comparing with the previous video coding standards,H.264 has incomparable advantages on compression rate, image quality,robust transmission,but superior performance is at the heavy price of complexity.When the standards was introduced,it is difficult to apply into actual projects,but with the deep study and the attraction of huge potential market,design a real-time video encoder has became the competing goal for the major manufacturers and research institutes recently.
Focuse on the theme of design,migration and optimization a real-time H.264 video encoder,this paper worked from the establishment of MATLAB simulation model to new rapid improvements algorithms,and then to the transplant and optimize the whole process based on VC++ and DM643 platform.In the motion estimation module,because most fast algorithms easily lead to local minimum or the wrong search direction,a new block-matching algorithm based on muti-octagon-grid was put forward in the paper and the search speed was improved by 42.4%;In the intra-prediction module,this paper made a pre-detection by using the sobel algorithm to pick out the redundant candidates and the intra-predict speed was improved by 61%. In the inter-prediction module,the paper took various measures in advance based on CBPand MVD as well as early SKIP mode decision and the inter-predict speed raised 53%.Based on the realization of basic level design requirements,this paper completed cutting,grafting and optimizing of H.264 video algorithm under the VC++ and achieved the performance CIF 44fps.Finally,the article completed code-level, system-level and instruction-level optimization on TI DM643 platform and achieved the performance CIF 20fps.
To achieve the considerable image quality as the origin's,this article seeks to reduce the complexity and improve the speed as much as possible.The improved algorithm proposed in paper provides a theoretical support and the design,migration and optimization based on VC++ and TI DM643 will provide a reference design for the real-time H.264 encoder and has important theoretical and practical significance for the development of practical products.
引文
[1]ISO/IEC International Standard 14496-10:2003(S),Information technology-Coding of audio-visual objects-Part 10:Advanced Video Coding,Dec.2003.
[2]F.Zhang,Y.He.Performance and complexity joint optimization for H.264 video coding,[A].Proceeding of international symposium on circuit and system[C].Bangkok:PISCS,2003.888-891.
[3]Z.Chen,P.Zhou,and Y.He.Fast Integer and Fracitonal Pel Motion Estimation for JVT[A].JVT-F017,Awaji,Japan,Dec.5-13,2002.
[4]Wiegand T,Sullivan GJ,Bjntegaard Q et al.Overview of the H.264/AVC Video Coding Standard[J].IEEE Trans Circuits Syst Video Tech,2003,13(7):560-576.
[5]ISO/IEC.IS 11172:Information technology-conding of moving Pictuers and associated audio for digital storage media at up to about 1.5mbit/s,1993.(MPEG-1).
[6]ITU-T and ISO/IEC JTCI,Generic coding of moving Pictures and associated audio information-part2:Video,IUT-T Recommendation H.262-ISO/ IEC13818-2(MPEG-2),Nov.1994.
[7]TU-T Recommendation H.261:Video codec for audiovisual sevrices at px64kbi/ts,Geneva,1990.revised at Helsinki,March1993.
[8]ITU-T SG16,Gary Sullivan,ed.,Dratf text of Recommendation H.263 Version 2(“H.263+”)for Decision.September.1997.
[9]ISO/IEC JTCI,Coding of audio-visual objects-Part2:Visual,ISO/IEC 14496-2(MPEG-4 visual versionl),April 1999;Amendment 1(version2),Feburary,2000;Amendment 4(streaming porfile),January,2001.
[10]Joint Video Team of ITU-T and ISO/IEC JTCI.Dratf ITU-T Reocmmendation and Final Draft Intenrational Standard of Joint Video Specification(IUT-T Rec.H.264|ISO/IEC 14496-10 AVC)[S].Joint Video Team(JVT)of ISO/IEC MPEG and ITU-T VCEG JVT-G050,March 2005.
[11]Intel VTune Performance Analyzer[EB].http://www.intel.com/software/product/vtune,Intel Corporation.
[12]Shan Z,Ma Kai-kuang.A New Diamond Search Algorithm for Fast Block-Matching Motion Estimation[J].IEEE Trans.Circuits Syst.Video Technol.,2000,9(2):287-290.
[13]Ce Zhu,Xiao Lin,and Lap-Pui Chau.Hexagon-Based Search Pattern for Fast Block Motion Estimation[J].IEEE Trans.Circuits and Syst.Video Techonol.,vol.12,NO.5,May.2002.
[14]Yao Nie,Kai-Kuang Ma.Adaptive rood pattern search for fast block-matching motion estimation[J].IEEE Trans.on Image Processing,2002,12(11):1442-1449.
[15]Tourapis A M,Au O C,Lion M L,Shen G.Fast block-matching motion estimation using predictive motion vector field adaptive search technique(PMVFAST).MPEG2000/m5866,March 2000.
[16]Tourapis C H Y,Tourapis A M.Fast motion estimation within the JVT codec[A].JVT-E023,Oct 2002.
[17]X.Xu,Y.He.Modification of Dynamic Search Range for JVT[J].JVT-Q088,Nice,Oct 2005.
[18]Wiegand T,Schwarz H,Joch A.Rate-constrained coder control and comparison of video coding standard[J].IEEE Trans.Circuits Syst.Video Technol,2003,13(7):688-703.
[19]ZhiboChen,PengZhou,Yun He.Fast Motion Estimation for JVT[A].JVT-G016,Thailand,March,2003.
[20]Libo Yang,Yu K.,Jiang Li,Shipeng Li.An effective variable block-size early termination algorithm for H.264 video coding[J].IEEE Trans.Circuits Syst.Video Technol,June 2005.page(s):784-788.
[21]CW Lam,LM Po,CH Cheung.A Novel Kite-Cross-Diamond Search Algorithm For Fast Block Matching Motion Estimation[J].IEEE International Symposium on Circuits and Systems,Canada 2004.
[22]T.Wiegand,G.J.Sullivan,G.Bjntegaard,A.Luthra.Overview of the H.264/AVC Video Coding Standard[J].IEEE Trans Circuits Syst Video Tech,2003,13(7):560-576.
[23]Steve McConnell.Code Complete[M].2d ed,2004.中译本《代码大全第2版》,电子工业出版社,2006年.
[24]Texas Insturments,TMS320DM643 Video/Imaging fixed-point digital signal processor,SPRS269C,January,2007.
[25]李方慧,王飞,何佩琨.TMS320C6000系列DSPs的原理与应用.第二版.北京:电子工业出版社.2005.
[26]Aho A V,Sethi R,Ullman J D.Compilers:Principles,techniques and tools[M].Massachusetts:Addison Wesley,1986.
[27]Texas Insturments,田黎育,何佩琨,朱梦宇编译.TMS320C6000系列DSP编程工具与指南[M],清华大学出版社,2006.
[28]Texas Insturments,TMS320C64x/C64x+ DSP CPU and Instruction Set Reference Guide,SPRU732H,October,2008.
[29]Texas Insturments,TMS320C6000 Programmer's Guide,SPRU 1981,March,2006
[30]Texas Insturments,TMS320C6000 Chip Support Library API Reference Guide,SPRU401J,August,2004.
[31]Elana Granston,Hand-Tuning Loops and Control Code on the TMS320C6000,SPRA666,August,2006.
[32]Texas Insturments,TMS320C6000 Assembly Language Toolsv 6.1 User's Guide,SPRU186Q,July,2008.