International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 Implementation of Novel Threshold Diamond Search (TDS) Algorithm for Fast Motion Estimation Chandana Pandey#1, Deependra Pandey *2 # Department Of Electronics and Communication Engineering Amity School of Engineering & Technology Amity University, Lucknow Campus, India Abstract— In entire video compression process the motion estimation requires significant amount of computation. There are many computational effective block motion estimation algorithms. These fast motion estimation algorithms reduce the computational complexity, at the expense of reduced performance. This results a significant interest in the research community to develop novel algorithms that are capable of saving computations with minimal effects on the coding quality. A novel Threshold Diamond Search (TDS) algorithm for fast block matching motion estimation has been proposed in this paper. In this algorithm we assumed monotonic error surface. A threshold condition to early terminate the Diamond Search (DS) block matching process is used to speed up motion estimation time and to reduce the computation. Simulation results show that this algorithm reduces the average computation with a very low degradation in video quality by providing speed improvement of about 90% to 96% over Exhaustive Search (ES) algorithm and about 17% to 37% over DS algorithm. Keywords— Video compression, motion estimation algorithms, Diamond Search, Exhaustive Search, early termination. useful for the video images that have little changes in their quality. In this method the current Mean Absolute Difference (MAD) value is compared with a threshold ‗th‘. If the MAD<=‘th‘, the searching process will stop in advance so that we can improve the searching speed and can reduce computational complexity. In this paper we specifically reviewed the diamond search algorithm and then a new modified fast block matching algorithm has been proposed called Threshold Diamond Search (TDS). The performance of this algorithm is compared with ES and DS in terms of Peak Signal to Noise Ratio (PSNR) and computations performed. Coming up in section II, review on the diamond search algorithm is presented. Following that, in section III we have discussed in detail our new proposed searching algorithm. In section IV performance metrics are defined. In section V the algorithm is implemented and comparisons are made between the proposed TDS and other fast motion estimation algorithms. Finally, we draw conclusion in section VI. I. INTRODUCTION Video processing is expensive in terms of computations and storage requirements. This is the reason for an extensive and ongoing research in video compression leading to existing standards and algorithms in this field [1]. Motion estimation plays a key role in the entire process of video compression. Motion estimation algorithms can be of three kinds - pixel based, block based and region based [2]. The block based motion estimation (BBME) is the best in terms of quality and simplicity. Block matching motion estimation algorithms such as the three-step search and the diamond search algorithms are currently being used in video coding schemes as alternatives to full search algorithms [3-4]. Fast motion estimation algorithms reduce the computational complexity, at the expense of reduced performance. In order to speed up these algorithms assume monotonic error surface. In block based motion estimation computations can be reduced by reducing number of search points and by the use of early termination process [5]. In early termination strategy a premature end is done to reduce block matching computation in the search process [6]. This technique is II. DIAMOND SEARCH ALGORITHM DS is the most accurate suboptimal ME algorithm among others. This is why it was chosen to be implemented in the reference software of the standard H.264 [7]. The Diamond Search algorithm (DS) is a fast BBME. It was proposed by Shan Zhu and Kai-Kuang Ma in the year 2000. The DS [7-8] algorithm makes use of two types of search patterns. The first type of search pattern is called large diamond search pattern (LDSP) and it contains nine checking points out of which eight points are surrounding the center one point to compose a shape of diamond. The second type of search pattern contains five checking points to compose a small shape of diamond. Hence it is called as small diamond search pattern (SDSP). In the searching procedure of the DS algorithm, LDSP is repeatedly used until the minimum block distortion (MBD) occurs at the center of the search pattern. The switching from LDSP to SDSP takes place when it reaches the final search stage. Out of the five checking points in SDSP, the position yielding the minimum block distortion (MBD) provides the motion vector of the best matching block. The whole process is summarized in the following Fig 1. ISSN: 2231-5381 . http://www.ijettjournal.org Page 268 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 Step 5: Stop searching. The center point is the final solution of the motion vector which points to the best matching block. Start Video Frames Fig. 1 Working of Diamond Search (DS) algorithm from (a) to (d) [8] But DS cannot stop the search early even when the SAD at a particular checking point is already small enough, e.g., below a threshold value [9]. Therefore by incorporating threshold technique in this method, we can stop unnecessary searching. Hence we can easily reduce the computational complexity by accepting a little degradation in the quality of the video sequences. III. PROPOSED ALGORITHM The motion field of consecutive frames in a video sequence is smooth and gentle. Therefore the optimum Global Motion Vectors (GMVs) are located at or very close to the search center most of the time [10]. In this paper, we exploit the centre bias property of the real world video sequences to reduce the computational complexity by comparing the MAD value of initial search center with a predefined threshold value (‗th‘=100). The TDS algorithm is summarized as follows: Step 1: The MAD of the search center (0,0) is calculated and is compared with the threshold value ‗th‘. If MAD(0,0)<=‘th‘, then jump to step 5 otherwise go to step 2. Step 2: Test the nine checking points of LDSP. If the MBD point is located at the center position then go to step 3, otherwise reposition the MBD point found in the previous step as the center point to form a new LDSP and recursively repeat this step till the MBD point is found at center. Step 3: If MAD of center point is less than or equal to ‗th‘ then go to step 5 otherwise go to step 4. Step 4: Change the search pattern to SDSP and find the MBD point then stop. ISSN: 2231-5381 Current frame Reference frame Divide frame in macroblocks Divide frame in macroblocks Calculate MAD at the center of search window (0,0) Select a macroblock Yes If MAD(0,0) is <=‘th‘ No Test 9 checking points of LDSP If MBD point is located at center No Re-position the MBD point as center point to form a new LDSP Yes If MAD of MBD point <=‘th‘ Yes No Change from LDSP to SDSP to find the MBD point Stop Fig. 2 Flowchart of TDS algorithm http://www.ijettjournal.org Page 269 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 IV. PERFORMANCE METRICS The best match for a block present in the current frame can be found in the reference frame by making use of some matching criterion [11]. There are a number of criteria available to evaluate the ―goodness‖ of a match. Three popular matching criteria used for block-based motion estimation are- mean of squared error (MSE), mean absolute difference (MAD) [12] and matching pixel count (MPC). Among these distortion criteria, the most common MAD has the minimum computational load [13]. MAD between current and reference blocks with size N×N is calculated as: (a) Salesman Frame (b) Miss America Fame (c) Caltrain Frame (d) Surfside Frame (e) Trivor Frame …………………………….. (1) MSE between current and reference blocks with size N×N is calculated as: …………………………….. (2) Peak Signal to Noise Ratio (PSNR) given by equation (3) characterizes the motion compensated image that is created by using motion vectors and macro clocks from the reference frame. PSNR [14] is used for quality comparison between different algorithms. …………………………….. (3) V. IMPLEMENTATION AND RESULT This section contains the implementation results of the exhaustive search algorithm [15], diamond search algorithm and the proposed threshold diamond search algorithm. The experiments were performed on Intel(R) Core(TM) i3-3217U CPU@1.80GHz configured system using MATLAB version R2010a. The Fig. 3 shows the first frame for input video sequences. In these video sequences the reference frames are divided into macro blocks of size (l6,16) pixels and to find where the macro blocks present in the reference frame moves in the next frame we have applied the above mentioned motion estimation algorithms. To find motion vectors we used the search range ‗p‘ of (+7,-7) and mean absolute difference (MAD). Table I displays average PSNR and the computation values required to find the motion vectors for ES, DS and TDS algorithms using different video sequences. The proposed algorithm provides speed improvement of about 90% to 96% over Exhaustive Search (ES) algorithm and about 17% to 37% over DS algorithm. The comparison graph for computation values acquired from 'Salesman', ‘Miss America‘, ‘Caltrain‘, ‘Surfside‘ and ‗Trevor‘ video sequences for ES, DS and TDS algorithms are presented in Fig. 4-8.respectively. ISSN: 2231-5381 Fig. 3 First frame of input video sequences http://www.ijettjournal.org Page 270 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 Table 1 PSNR and the computation values for ES, DS and TDS algorithms using different video sequences . Video Sequences Block Matching Algorithm Average PSNR ES 35.05 204.28 DS 34.93 13.07 TDS 34.29 8.27 SALESMAN MISS AMERICA CALTRAIN SURFSIDE TREVOR Average Computations ES 37.80 204.28 DS 37.50 16.24 TDS 36.85 11.40 ES 30.37 207.41 DS 30.24 15.92 TDS 26.72 11.05 ES 34.84 218.48 DS 34.48 26.17 TDS 34.41 21.66 ES 34.88 199.51 DS 34.85 12.6455 TDS 34.36 7.89 Speed Improvement Ratio (SIR) Over ES Over DS 95.94 36.69 94.41 29.78 94.67 30.62 90.08 17.24 96.04 37.56 Fig. 4 computation comparision for salesman video sequences ISSN: 2231-5381 http://www.ijettjournal.org Page 271 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 Fig. 5 computation comparision for missa video sequences . 6 computation comparision for caltain video sequences ISSN: 2231-5381 http://www.ijettjournal.org Page 272 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 Fig Fig. 7 computation comparision for surfside video sequences Fig. 8 computation comparision for trevor video sequences ISSN: 2231-5381 http://www.ijettjournal.org Page 273 International Journal of Engineering Trends and Technology (IJETT) – Volume 23 Number 5- May 2015 VI. CONCLUSION In this work the conventional DS algorithm is modified by adopting early termination method to reduce the search points, computational cost and computation time in the block based motion estimation process. Its performance is compared with Exhaustive Search (ES) and Diamond Search (DS) by measuring the PSNR values and computations performed. The results obtained shows that the proposed algorithm has improvements over the existing DS algorithms in terms of average number of computations with a very low degradation in quality of video sequences. Hence TDS algorithm speeds up the searching process in BMME. REFERENCES [1]. N. A. Hamid, A. M. Darsono, N.A. Manap, R. A. Manap, and H. A. Sulaiman, ―A New Orthogonal – Diamond Search Algorithm for Motion Estimation‖, International Conference on Computer, Communication, and Control Technology, pp. 467-471, Sept. 2014. [13]. Fenta Adnew Mogus , Xinying Liu, and Lei Wang, ―Evaluation of the Performance of Motion Estimation Algorithms in Video Coding‖, IEEE, 2010. [14]. D.Vijendra Babu, P.Subramanian, and C.Karthikeyan, ―Performance Analysis of Block Matching Algorithms for Highly Scalable Video Compression‖, IEEE, pp. 179-182, 2006. [15]. M. Ahmadi, and M. Azadfar, "Implementation of Fast Motion Estimation Algorithms & Comparison with Full Search Method in H.264", IJCSNS International Journal of Computer Science & Network Security, vol. 8(3), pp. 139143, 2008. Acknowledgment The authors would like to thank Maj. General K. K. Ohri (AVSM, Retd.) Pro-VC & Director General, Amity University, Uttar Pradesh Lucknow, Wg. Cdr. (Dr.) Anil Kumar (Retd.) (Director ASET, Lucknow Campus), Brig. U. K. Chopra (Director AIIT & Dy. Director ASET) and Prof. O. P. Singh (HOD, Electronics) for their valuable comments and suggestions that helped to improve this paper. [2]. Shaifali Madan Arora, and Navin Rajpal, ―Comparative Analysis of Motion Estimation Algorithms on Slow, Medium and Fast Video Sequences‖, International Conference on Reliability, Optimization and Information Technology, pp. 422-427, February 2014. [3]. K. R. Namuduri, and Aiyuan Ji, ―Computation and Performance Trade-offs in Motion Estimation Algorithms‖, IEEE, pp. 263-276, 2001. [4]. Aroh Barjatya, ―Block Matching Algorithms for Motion Estimation‖ spring 2004. [5]. Atalla I.Hashad, and Rowayda A. Sadek, ―A Novel Reduced Diamond Search (RDS) Algorithm with Early Termination for Fast Motion Estimation‖, International Journal of Video& Image Processing and Network Security, vol. 10, no. 4, pp. 14-22, August 2010. [6]. QuanFei, and Wei Wei, ―Research on the Motion Estimation Algorithm in Video Coding‖, Information Technology Journal, vol. 11, pp. 1660-1663,August 2012. [7]. Shan Zhu, and Kai-Kuang Ma, ― A New Diamond Search Algorithm for Fast Block-Matching Motion Estimation‖, IEEE Trans. Image Processing, vol 9, no. 2, pp. 287-290, February 2000. [8]. A.Anusooya Devi, M.R.Sumalatha, N.Mohana Priya, B.Sukruthi, and M.Minisha, ―Modified Diamond-Square Search Technique for Efficient Motion Estimation‖, IEEEInternational Conference on Recent Trends in Information Technology, pp. 1149-1153, June 2011. [9]. Xuan-Quang Banh, and Yap-Peng Tan, ―Adaptive DualCross Search Algorithm for Block-Matching Motion Estimation‖, IEEE Trans. on Consumer Electronics, vol. 50, no. 2, pp. 766-775, May 2004. [10]. Yasser Ismail, and Sherif El-etriby, ―Fast Diamond Search Algorithm for Real Time Video Coding‖, IEEEInternational Conference on Computing, Networking and Communications, Multimedia Computing and Communications Symposium, pp. 729-733, 2012. [11]. S.R. Subramanya, Hiral Patel, and Ilker Ersoy, ―Performance Evaluation of Block-Based Motion Estimation Algorithms and Distortion Measures‖, IEEEInternational Conference on Information Technology: Coding and Computing, 2004. [12]. Hussain Ahmed Choudhury, and Monjul Saikia, ―Comparative Study of Block Matching Algorithms for Motion Estimation‖, International Journal of Advanced Computational Engineering and Networking, vol. 1(10), pp. 73-78, Dec.2013. ISSN: 2231-5381 http://www.ijettjournal.org Page 274