240 likes | 361 Views
An Efficient Mode Decision Algorithm for H.264/AVC Encoding Optimization. IEEE TRANSACTION ON MULTIMEDIA Hanli Wang, Student Member, IEEE , Sam Kwong, Senior Member, IEEE , and Chi-Wah Kok, Senior Member, IEEE. Outline. Introduction
E N D
An Efficient Mode Decision Algorithm for H.264/AVC Encoding Optimization IEEE TRANSACTION ON MULTIMEDIA Hanli Wang, Student Member, IEEE, Sam Kwong, Senior Member, IEEE, and Chi-Wah Kok, Senior Member, IEEE
Outline • Introduction • Proposed Early Termination of Motion Estimation and Mode Decision • Proposed Algorithm for H.264 Mode Decision • Experimental Results • Conclusion
Introduction • The computational complexity in H.264 is increased due to mode decision where variable block size ME is employed • In this paper, we propose a more efficient and robust algorithm than *Variable Block size Best Motion Detection (VBBMD) to early terminate ME and mode decision. *L.Yang, K. Yu, J. Li, and S. Li, “An effective variable block-size early termination algorithm for H.264 video coding,” IEEE Trans. Circuits Syst. Video Technol., vol 15, no. 6, pp. 784-788, Jun. 2005.
Proposed Early Termination of Motion Estimation and Mode Decision • In video coding, it’s common that all DCT coefficients in a block are quantized to zeros. • ME can be early terminated if an all-zero block is detected.
Proposed Early Termination of Motion Estimation and Mode Decision • 4x4 DCT • C(n)= , for n=0, C(n)=1, otherwise • denotes to round x to the nearest integer • Quantization • f is
A. Sufficient Condition to Detect All-Zero Blocks • From(2), the sufficient condition for to be quantized to zero is • From(1) • indicates each element of is multiplied by the element in the same position in matrix
A. Sufficient Condition to Detect All-Zero Blocks • The case of u=v=1 is firstly analyzed. • A 4x4 block is divided into four regions , • The sum of absolute difference , for each region • The sum of absolute difference SAD for a 4x4 block
A. Sufficient Condition to Detect All-Zero Blocks • Considering (4)-(7) • Form(3)(4), the sufficient condition to detect zero quantized DCT coefficient at (u,v) is . Thus
A. Sufficient Condition to Detect All-Zero Blocks • According to the three categories in Table I, three threshold are derived as • If , then all the DCT coefficients in the ith category will be quantized to zeros. • The sufficient condition to detect all-zero block
A. Sufficient Condition to Detect All-Zero Blocks • False rejection rate (FRR) • The smaller FRR is, the more efficiency all-zero DCT blocks can be detected. • False acceptance rate (FAR) • The smaller FAR is, the less the video quality degrades. • [10] Y.H. Moon, G. Y. Kim, and J. H. Kim, “An improved early detection algorithm for all-zero blocks in H.264 video coding,” IEEE Trans. Circuits Syst. Video Technol., vol. 15, no. 8, pp. 1053-1057, Aug. 2005.
B. Early Termination of Motion Estimation and Mode Decision • Early Motion Estimation Termination • We can early terminate ME if all the 4x4 blocks within current block are determined as all-zero blocks under the condition(13). • In the assumption on spatial-temporal homogeneity, we may not get the best motion vector… • Early Mode Decision Termination • If EMET is true for all the partitioned blocks in a MB, we can consider this MB is an all-zero MB and skip checking the other modes. • The additional overhead of calculation (10)–(13)… =>we can early stop checking EMET if one of the 4x4 blocks does not satisfy the condition in (13).
Proposed Algorithm for H.264 Mode Decision • We have executed a number of experiments and observed that • 1. SKIP and 16x16 have a large proportion in MB partitions. • 2. 8x8 occupies a large proportion in sub-MB partitions. • 3. INTRA4 and INTRA16 have a very small proportion in inter coding. • M16 : the best mode of SKIP and 16x16 • : RD cost of M16 • : RD cost of 8x8
A. Temporal-Spatial Checking • M(n,x,y) : a MB which is in the nth frame with top left pixel in (x,y) • The temporal set is defined as • The spatial set is defined as • If( nonboundary MBs in and were encoded as SKIP or 16x16) => skip 8x4, 4x8, 4x4, INTRA4 and INTRA16 • If( ) => skip 16x8 and 8x16 • Additional computation : few comparison operations
B. Thresholds Based Prediction • We define two thresholds and • If( ) => skip 8x4, 4x8, 4x4, INTRA4, and INTRA16 • If( ) => skip 16x8 and 8x16 • From our exhaustive experiments, we found good results can be achieved when and are set to 50 and 200 respectively.
C. Monotonic Error Surface Based Prediction • : RD cost of 4x4 • If( ) => skip 16x8 and 8x16 • If( ) => only check 16x8 and 8x16 and skip all the other unchecked modes
D. Overall Algorithm Set all modes active. Select M16 and record C16 16x8 inactive TSC Record C4 and EMDT C4 True false false True True false EMDT 16x8 Set 8x4,4x8,4x4,I4, and I16 to inactive Done True True EMDT C16 C16>C8 and C8>C4 false Done Done 8x16 inactive False, record C8 True True false True false C8-C16>Th16 EMDT C8 C16<C8 and C8<C4 false Done EMDT 8x16 True false True false True Done false C16-C8>Th8 false Set 8x4,4x8,I4, and I16 to inactive TSC and C16<C8 True Done 8x4 inactive Set 16x8 and 8x16 to inactive True Set 16x8 and 8x16 to inactive false True false
D. Overall Algorithm True false EMDT 8x4 True Done false 4x8 inactive True false EMDT 4x8 True Done false Check I4 and I16 if they are active. Select the best mode
Experimental Results • H.264 reference software : JM9.5 • ME with ¼ pixel resolution • Number of reference frames : 1 • Motion search range : 16 • Without B-frames • The period of I-frames : 10 • Five values : 24, 28, 32, 36, and 40
Experimental Results • With B-frames • The period of I-frames : 4 • GOP structure is IBBP • The other encoding parameters are the same.
Conclusion • A theoretical analysis is carried out to study the sufficient condition to detect all-zero blocks in H.264. • The proposed algorithm also introduces TSC, TBP, and MESBP methods to further skip examining redundant modes. • In the future, we will consider other fast mode decision techniques such as [3],[4],[7] to further optimize the proposed algorithm.