An Efficient INTER-Coding Algorithm for H.264 - eurasip

1 downloads 0 Views 901KB Size Report
One pixel local diamond search is performed around the position corresponding to the ... contain camera movement while susie contains foreground movement.
15th European Signal Processing Conference (EUSIPCO 2007), Poznan, Poland, September 3-7, 2007, copyright by EURASIP

AN EFFICIENT INTER-CODING ALGORITHM FOR H.264 Laeeq Aslam and Nadeem Ahmad Khan Department of Computer Science, Lahore University of Management Sciences Opposite Sector ‘U’, DHA, 54792, Lahore, Pakistan phone: + (92)42-5722670-9, fax: + (92)42-5722591, email: {laeeq, nkhan}@lums.edu.pk web: http://cs.lums.edu.pk

ABSTRACT An efficient inter-coding algorithm for H.264 video coding standard is presented that gives a simultaneous improvement of encoding time and bit rate without a loss in SNR. This is an extension of 3DRS algorithm for variable block sizes which was previously known for fixed block sizes. We use central difference to find boundaries in a consistent motion vector field to make macroblock partition decision. In comparison to Full Search (FS) algorithm the proposed algorithm on average takes 66.65% less computational time, producing 2.9% less number of bits with an average SNR gain of 0.053 dB. The proposed algorithm, on average, saves 6.31% of computational time and 1.5% number of bits as compared to Fast Motion Estimation (FME) reference algorithm with a gain of 0.072 dB of SNR. Experimental results using six different sequences are presented to demonstrate the advantage of using the proposed algorithm.

In general, a large area with consistent motion is more likely to be coded using large block size, and the area containing the boundaries of motion are more likely to be coded using smaller block sizes. The basic idea is to exploit the homogeneity of motion in the scene. The encoder selects the best macroblock partition and mode of prediction for each macroblock, such that the video coding performance is optimized.

1. INTRODUCTION H.264 defines three key profiles: Baseline, Main, and Extended. The Baseline profile is the simplest profile which targets applications with limited processing resources and low delay requirements. The Main profile adds features that improve video quality at the expense of a significant increase in computational complexity. The Extended profile targets streaming video, and includes features to improve error resilience and to facilitate switching between different bit streams [1]. To overcome the high computational complexity of the codec we need fast algorithms, efficient implementation and enhanced computational resources. All three profiles use inter-coding to exploit the temporal redundancy. This work is regarding inter-coding and is more useful for the baseline profile due to limited processing resources, however other profiles will also get benefit of the proposed scheme. Inter coding in H.264 is done with macroblocks partitioned into different ways as shown in figure 1; with a minimum luma-block size of 4x4 to a maximum of 16x16. The primary macroblock partition patterns are 16x16, 16x8, 8x16 and 8x8. If the 8x8 partitioning is selected, it can be further partitioned into 8x4, 4x8 or 4x4 [1]. If we take object coding and fixed block coding as two extreme approaches, H.264 gives the flexibility to use variable block sizes to explore the tradeoffs between the two approaches.

©2007 EURASIP

1260

Figure 1 - Allowed macroblock and sub-macroblock partitioning in H.264

In the next section we will give an overview of the related work from the literature. Third section will cover the suggested algorithm and fourth section contains the experimental results after which we give conclusions. 2. OVERVIEW OF RELATED WORK A lot of work in recent years has been done suggesting algorithms to find the best mode and partition [2, 3, 6, 7]. If we can identify, prior to motion estimation, the macroblocks that are likely to be skipped, we can save a lot of computations. One such technique is suggested in [2] which can reduce the encoding time by 29.67% on average without significant loss in rate-distortion performance. This is achieved by estimating a Lagrangian rate-distortion cost function. In [3] an early termination algorithm is given for variable block-size motion estimation by concentrating on zero motion. If the rate distortion cost of a partition in a macroblock at (0, 0) is less than a threshold, it is declared as a zero motion block. For sequences with less motion this technique can save up to 93.4% search points per macroblock while reduction in PSNR is not more than .05 dB, whereas, in se-

15th European Signal Processing Conference (EUSIPCO 2007), Poznan, Poland, September 3-7, 2007, copyright by EURASIP

quences with high motion, this technique can save up to 60% of search points with a negligible loss in PSNR. According to [6], homogeneity decision of a block is dependent on edge information, and macroblock differencing can be used to judge whether the macroblock is time stationary or not. Based on these facts a fast algorithm for intercoding is presented in [6] which can reduce the encoding time up to 30% with a loss of 0.03 dB in PSNR and 0.6% increase in bit rate. In [7], a prediction algorithm for block size and mode is presented which have speedup factor of 30% in comparison to fast full search algorithm with a PSNR loss of 0.071 dB and a bit rate increase of 2.78%. In [9], 3DRS based variable block size motion estimation algorithm is presented which achieves 80% encoding time improvement over full search and up to 55% over FME by compromising around 0.15 dB SNR. The bit-stream size is slightly less as compared to FS and FME. 3. THE PROPOSED ALGORITHM We focus on inter-coding which starts at second frame of any sequence while the first one is intra coded. We suggest an algorithm which is motion adaptive and exploits the motion information to decide that whether a certain macroblock is at the discontinuity of motion vector field or not. Consistent or true motion field is obtained using 3DRS algorithm with fixed block size [8]. The examples of such motion field are shown in figure 3. Scaled absolute central difference is applied on motion field to find the macroblocks containing the motion boundaries. Such macroblocks are partitioned to obtain high coding efficiency. The suggested algorithm consists of two steps: 1. Keep the mode of each macroblock as inter 16x16 and find the motion vectors using 3DRS algorithm [8]. Apply fine search to refine the motion vectors found. 2. Based on motion vector information found in above step, decide about the macroblock partitions and encode. 3-D recursive search algorithm has been previously used for fixed block size in [8], and for variable block-size in [9]. Key idea of this algorithm is to use known motion vectors of spatial and temporal neighbours to find motion vector for the current block. Spatial neighbours are those for which we have already found the motion vector. Temporal neighbours are those for which current frame does not have the motion vector information yet but the information for the previous frame is still available and is not overwritten. Two estimators ‘a’ and ‘b’ are defined with diagonally opposite convergence directions. Each estimator provides a set of candidates consisting of a temporal predictor and up to four other candidates from spatial predictor by adding random update vectors to it. These candidates are spatial and temporal neighbours of the current block. All candidates are evaluated based on some distortion measure like SAD and the best candidate is selected for assignment of motion vectors to the current block. In fine search further four points are evaluated based on SAD to refine the motion vector. These four points are left, right, top and bottom points of the already determined motion vector.

©2007 EURASIP

1261

In the first step, our algorithm obtains the consistent motion field using 3DRS algorithm with fixed block size of 16x16. In the second step obtained motion field is used to determine whether a certain macroblock is on the motion vector field discontinuity or not and what is the right partition of that macroblock. This process is performed as follows: Assume that we have (j x k) blocks in a given frame. After the first step motion vector field can be represented as: MV = {(Xxy, Yxy) | 0≤ x < j & 0≤ y