1 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
Jan 24, 2016
1
An Efficient Mode Decision Algorithm for H.264/AVC Encoding Optimization
IEEE TRANSACTION ON MULTIMEDIAHanli Wang, Student Member, IEEE, Sam Kwong, Senior Member, IEEE, and Chi-Wah Kok, Senior Member, IEEE
2
Outline
Introduction Proposed Early Termination of Motion
Estimation and Mode Decision Proposed Algorithm for H.264 Mode
Decision Experimental Results Conclusion
3
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.
4
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.
5
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
6
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
7
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
8
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
9
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
10
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.
11
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).
12
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
13
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
14
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.
15
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
16
D. Overall Algorithm
EMDT C16
EMDT C8
False, record C8
TSC and C16<C8
false
TSC
Done
Done
Done
True
True
True
Set 8x4,4x8,4x4,I4, and I16 to inactive
True
C8-C16>Th16
false
True
C16-C8>Th8
false
Set 16x8 and 8x16 to inactivefalse
True
Record C4 and EMDT C4
false
C16>C8 and C8>C4
falseDone
True
C16<C8 and C8<C4
false
16x8 inactive
Set 8x4,4x8,I4, and I16 to inactive
True
false
EMDT 16x8
false
8x16 inactive
falseDone
True
EMDT 8x16
false
8x4 inactive
falseDone
True
Set 16x8 and 8x16 to inactive
True
True
True
True false
Set all modes active. Select M16 and record C16
17
D. Overall Algorithm
EMDT 8x4
false
Done
4x8 inactive
false
True
EMDT 4x8
false
Done
True
Check I4 and I16 if they are active. Select the best mode
false
True
True
18
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
19
Experimental Results
20
Experimental Results
21
Experimental Results
With B-frames The period of I-frames : 4 GOP structure is IBBP The other encoding parameters are the
same.
22
Experimental Results
23
Experimental Results
24
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.