An Adaptive Algorithm for video compression

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume...
Author: Harold Gilbert
1 downloads 0 Views 411KB Size
International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012)

An Adaptive Algorithm for video compression T. Sravanthi1 1

Assistant Professor, Department of ECE, VBIT, JNTUH, A.P, India Steps to achieve the algorithm are 1. Record a video. 2. MPEG compression is considered for all frames in a video. 3. Motion estimation algorithms (full search, diamond search, adaptive motion estimation algorithm) are carried out to find motion vectors. 4. Comparison is performed to algorithms based on motion estimation performance parameters. Video compression is applied on a series of consecutive images in a video stream, making use of similarities between neighboring images. Video compression uses a similar method as that of still image compression. One of the best-known audio and video streaming techniques is called MPEG-4 utilizes one frame as a reference. Each additional frame saves and transports only the image information that is different from the original. Frame sequence of MPEG standard is I B B P B B P B B P B B as shown in the figure [7]

Abstract— We investigate the increasing popularity of technologies such as Internet streaming video and video conferencing, video compression has became an essential component of broadcast and entertainment media. Here we make use of new motion estimation algorithm with a video coding standard MPEG-4, has achieved significant compression by utilizing several advanced techniques. Here we use three types of Motion estimation algorithms are full search algorithm, diamond search algorithm, adaptive motion estimation algorithm. These algorithms are compared based on number of check points, execution time and visual quality. At last we conclude that adaptive motion estimation algorithm is the faster algorithm than compare to the other algorithms. Index Terms- MPEG-4, discrete cosine transforms (DCT), PSNR, Check points, execution time, search range, search area.

I. INTRODUCTION Video is nowadays much more than an instrument of leisure. It is used in fields like Medicine and Security in which it demands both quality and manageability. Compression plays here a key role: a good compression should supply easy storage and transmission without lost of information. Many methods have been developed and some standards published to ensure the compatibility between systems. Video Compression makes it possible to use, transmit, or manipulate videos easier and faster. Many applications benefits from video compression. Compression is the process of converting data to a format that requires fewer bits. If there exists with a loss of information along this process, the compression is lossy. Lossless compression is a manner in which no data is lost. The compression ratio obtained is usually not sufficient and lossy compression is required. This paper is based on MPEG-4 video compression standard.

Fig 1: MPEG-4 frame sequence order

Where I-frame is reference frame compressed by using discrete cosine transform, P-frame is called prediction in forward direction [4, 5] which is compressed by taking motion vectors along the reference frame and B-frame is prediction in forward direction as well as in reverse direction which is compressed by taking motion vectors along the reference frame, P-frame and I-frame. Each and individual frames in a sequence are transformed by using discrete cosine transform(DCT) , is a lossy compression algorithm analyzes the frequency components present in the sample, and discards those frequencies which do not affect the image as the human eye perceives it. The transform tends to concentrate the energy into the low-frequency coefficients and many of the other coefficients are near-zero [2].

II. TECHNICAL APPROACH This paper presents a multi stage technique for motion estimation process called content adaptive search technique for block based video compression. It provides adaptability to the video content to maximize the overall performance and achieves minimum motion vector by compressing video as compare to the full search and diamond search algorithm. 335

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012) The frequency domain is a better representation for the data because it makes it possible for you to separate out and throw away information that isn’t very important to human perception. The human eye is not very sensitive to high frequency changes especially in photographic images, so the high frequency data can, to some extent be discarded.

Below figure 3 [9]shows an example of a particular macro block from Frame 2 of previous figure, relative to various macro blocks of Frame 1. As can be seen, the top frame has a bad match with the macro block to be coded. The middle frame has a fair match, as there is some commonality between the 2 macro blocks [10, 12]. The bottom frame has the best match, with only a slight error between the 2 macro blocks. Because a relatively good match has been found, the encoder assigns motion vectors to the macro block, which indicate how far horizontally and vertically the macro block must be moved so that a match is made As such, each forward and backward predicted macro block may contain 2 motion vectors, so true bi-directionally predicted macro blocks will utilize 4 motion vectors.

A. Motion Estimation for Video Compression Figure 2 shows an example of a frame with 2 stick figures and a tree. The second half of this figure is an example of a possible next frame, where panning has resulted in the tree moving down and to the right, and the figures have moved farther to the right because of their own movement outside of the panning. The problem for motion estimation to solve is how to adequately represent the changes, or differences, between these two video frames. The way that motion estimation goes about solving this problem is that a comprehensive 2-dimensional spatial search is performed for each macro block. Motion estimation is not applied directly to MPEG video, as it is assumed that the color motion can be adequately represented with the same motion information. It should be noted at this point that MPEG does not define how this search should be performed. This is a detail that the system designer can choose to implement in one of many possible ways. This is similar to the bit-rate control algorithms in respect that complexities vs. quality issues need to be addressed relative to the individual application. It is well known that a full, exhaustive search over a wide 2-dimensional area yields the best matching results in most cases, but this performance comes at an extreme computational cost to the encoder [3, 8].

Figure 3: Motion Estimation Macro block Example

Below figure 4 shows how a potential predicted Frame 2 can be generated from Frame 1 by using motion estimation. In this figure, the predicted frame is subtracted from the desired frame, leaving a (hopefully) less complicated residual error frame that can then be encoded much more efficiently than before motion estimation. It can be seen that the more accurate the motion is estimated and matched, the more likely it will be that the residual error will approach zero, and the coding efficiency will be highest. Further coding efficiency is accomplished by taking advantage of the fact that motion vectors tend to be highly correlated between macro blocks. Because of this, the horizontal component is compared to the previously valid horizontal motion vector and only the difference is coded. This same difference is calculated for the vertical component before coding. These difference codes are then described with a variable length code for maximum compression efficiency.

Fig.2 Example of Motion Estimation

As motion estimation usually is the most computationally expensive portion of the video encoder, some lower cost encoders might choose to limit the pixel search range, or use other techniques such as telescopic searches, usually at some cost to the video quality.

336

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012) Then, difference of two blocks as residual (motion compensated residual) and the distance of them as motion vector, is coded and transmitted. Here we use three types of motion estimation algorithms B. Full Search Algorithm Steps to get the motion estimation using full search algorithm is to divide each frame in a video into macro blocks. Each MB in reference frame compared with all blocks in P or B frame. If match founds take difference along horizontal & vertical. Calculate SAD (Sum of Absolute Difference). Calculate MAD (minimum absolute difference) based on SAD generates motion vector.

Figure 4: Final Motion Estimation Prediction

Of course not every macro block search will result in an acceptable match. If the encoder decides that no acceptable match exists (again, the "acceptable" criterion is not MPEG defined, and is up to the system designer) then it has the option of coding that particular macro block as an intra macro block, even though it may be in a P or B frame. In this manner, high quality video is maintained at a slight cost to coding efficiency. The temporal prediction technique used in MPEG video is based on motion estimation. The basic premise of motion estimation is that in most cases, consecutive video frames will be similar except for changes induced by objects moving within the frames. In the trivial case of zero motion between frames (and no other differences caused by noise, etc.), it is easy for the encoder to efficiently predict the current frame as a duplicate of the prediction frame. When this is done, the only information necessary to transmit to the decoder becomes the syntactic overhead necessary to reconstruct the picture from the original reference frame. When there is motion in the images, the situation is not as simple. Motion Estimation (ME) is an important part of any video compression system, since it can achieve significant compression by exploiting the temporal redundancy existing in a video sequence. Unfortunately it is also the most computationally intensive function of the entire encoding process. In motion estimation the current image is divided into macro Blocks (MB) .Most of algorithms have been proposed for motion estimation use from BMA based (Block Matching Algorithms) methods. In this methods, motion estimation is performed for a N×M blocks of current frame, It is done with checking entire N×M blocks from search area situated in the reference frame(s) and calculating the difference between the current block and other reference blocks and finally choosing the block that has the most similarity (minimum SAD) to the early block in current frame.

C. Diamond Search Algorithm To find motion estimation it is having two search patterns are 1. LDSP (Large Diamond Search Pattern) If search matches with its center switch to SDS Otherwise, create another LDSP for matched point. Process continues until search matches with its center. 2. SDSP (Small Diamond Search Pattern) If search matches with its center take that as MAD, Otherwise, check other points in SDSP. Process continues until search matches with its center. D. Adaptive Motion Estimation Algorithm Accurate motion vector is calculated according to the following procedure 1. MV field (MVF) Prediction: This stage predicts the MVF from the previous coded frame and current frame using the Weighted Mean Inertia (WMI) prediction technique. 2. Motion Analysis: These stages clusters or decomposes MB’s (macro blocks) into different regions and extract motion characteristics of each region and calculates the motion parameters and 3. Motion Estimation: This stage performs motion estimation and finds the accurate motion vector by assuming initial search point (ICP) which is having minimum distortion, and then create cross search pattern. If distortion of surround point is minimum than compare to ICP search goes in exponential direction. In this if distortion at one point is maximum search stops & come back to previous point. Process continues until search is matched with center of cross search pattern. Full search, diamond search and adaptive motion estimation algorithms are compared by using motion estimation performance parameters are 1. Elapsed time (seconds) 2. Total number of check points (TCP) to find accurate motion vector. 337

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012) 3. Visual quality: Quality of picture calculated in peak signal to noise ratio (PSNR) which is expressed in decibels. PSNR = 10log10 (NxX2/Y) (1) Where N is Length of reconstructed signal and X is maximum absolute value of original signal

Computations on processing on B2 Frame = 6203 Computations on processing on B3 Frame = 6227 Computations on processing on P7 Frame = 5419 Total Check Points= 43259 Elapsed time is 11.359000 seconds. Motion vectors are displayed as shown in figure 6

III. SIMULATION RESULTS E

F

Steps in Simulation Process 1. Read the video in frames. 2. Compression ratio is limited to 256M bytes that are why Motion vectors are displayed in 2x256 matrixes because the video system is reader as NTSC video system. 3. The video is divided into group of pictures (GOP).Each picture read as a frame 4. Each frame or image is resized to 128x128.this image is further divided into macro blocks after that compression process is performed based on MPEG frame sequencing.

Figure 6: Motion vectors for I1-B2 field

Visual quality of a video is calculated by using pefcal function.Pefcal function is used for performance calculations. This function calculates the signal to noise ratio, peak signal to noise ratio and normalized root mean square error. Pefcal (B2, B2d) = 82.5882 dB Pefcal (B2, B2t) =49.9114 dB Pefcal (I1, I1d) = 81.716 dB

Performance Analysis of Full Search Algorithm After processing the main program in command file number of computations, total checks points, processing times are displayed as when macro block size is 8. Computations on processing on P4 Frame = 5107 Computations on processing on B2 Frame = 51076 Computations on processing on B3 Frame = 51076 Computations on processing on P7 Frame = 51076 Total Check Points= 408608 Elapsed time is 40.922000 seconds. Motion vectors are displayed as shown in figure 5

H

Figure 5: Motion vectors for I1-B2 field

G

Performance Analysis of Diamond Search Algorithm After processing the main program in command file number of computations, total check points, processing time are demonstrated. When macro block size is 8. Computations on processing on P4 Frame = 6270

338

Performance Analysis of Adaptive Motion Estimation Algorithm After processing the main program in command file number of computations, total check points, processing time are demonstrated. When macro block size is 8. Computations on processing on P4 Frame = 2686 Computations on processing on B2 Frame = 2702 Computations on processing on B3 Frame = 2707 Computations on processing on P7 Frame = 2704 Total Check Points= 21561 Elapsed time is 9.594000 seconds. Visual quality of a video is calculated by using pefcal function.Pefcal function is used for performance calculations. This function calculates the signal to noise ratio, peak signal to noise ratio and normalized root mean square error. Pefcal (B2, B2d) = 83.1050 dB Pefcal (B2, B2t) = 49.9146 dB Pefcal (I1, I1d) = 81.7168 dB

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012) Motion vectors are displayed as shown in figure 7

Content adaptive search technique algorithm improves time by 15% and peak signal to noise ratio by 0.0086 as compared the full search algorithm. This paper can also be implemented by using PMVFAST (predictive motion vector field adaptive search technique) and APDZS (advanced predictive diamond zonal search). REFERENCES [1 ] Jiancong Luo, Ishfaq Ahmad ,Yongfang Liang, “A Fast Adaptive Motion Estimation Algorithm “,IEEE Transactions on Circuits and Systems for Video Technology VOL.16, NO.3 March 2006, 420438. [2 ] Jiancong Luo, Ishfaq Ahmad, Viswanathan Swami Nathan, “A multistage fast motion estimation scheme for video compression”, IEEE Transaction on image processing March, 2004, pp. 1441-1444. [3 ] Jiancong Luo, Yongfang Liang,” Motion estimation for the content adaptive video compression” IEEE Transactions on Circuits and Systems for Video Technology, vol.18, No.7, July 2008, pp.900909. [4 ] J. Feng, K. T. Lo, H. Mehrpour, and A. E. Karbowiak, “Adaptive block matching motion estimation algorithm for video coding,” IEE Electron. Lett. vol.31, no.18, pp. 1542–1543, 1995. [5 ] M.M.Azadfar, A.Ahmadi “Implementation of fast motion algorithms and comparison with the full search method in H.264”, IJCSNS International Journal of Computer Science and Network Security VOL.8, No.3, March 2008, pp.139-143. [6 ] M. Ezhilarasan and P. Thambidurai”Simplified Block Matching Algorithm for Fast Motion Estimation in Video Compression”, Journal of Computer Science 282-289, 2008. ISSN 1549-3636 © Science Publications [7 ] Shan Zhu and Kai-Kuang Ma “ A New Diamond Search Algorithm for Fast Block Matching Motion Estimation”, International Conference on Information, Communications and Signal Processing ICICS '97 Singapore, 9-12 September 1997 ,pp. 292-296. [8 ] Yoshihiro Noguchit, Jun Furukawatt and Hitoshi Kiyatt” A Fast Full Search Block Matching Algorithm for MPEG-4 Video”, IEEE Transactions on Circuits and Systems for Video Technology, 1996, pp 61-65. [9 ] M. Brand, N. Oliver, and A. Pentland, “Coupled Hidden Markov Models for Complex Action Recognition”, proceedings of CVPR 97. [10 ] S. Chandrasekaran, B. S. Manjunath, Y. F. Wang, J. Winkeler, and H. Zhang, “An Eigenspace Update Algorithm for Image Analysis”, Graphical Models and Image Processing, Vol.59, pp.321–332, 1997. [11 ] R. Collins, A. Lipton, et al. A System for Video Surveillance and Monitoring. CMU-RI-TR-00-12, Robotics Institute, CMU, May, 2000. [12 ] D. Cunado, J.M. Nash, M.S. Nixon, and J. N. Carter, “Gait extraction and description by evidence- gathering,” Proc. of the International Conference on Audio and Video Based Biometric Person Authentication, pp. 43–48, 1995. [13 ] N. Contour, A. Kale and R. Chellappa, “Combining MultipleEvidences for Gait Recognition”, ICASSP 2003. [14 ] [11] Q. Delamarre, O. Faugeras, “3D Articulated Models and MultiView Tracking with Physical Forces”, CVIU Vol. 81, pp328-357, 2001. [15 ] D.M. Gavrila, "The Visual Analysis of Human Movement: A Survey", Computer Vision and Image Understanding, Vol.73, No.1, pp.82-98, 1999.

Figure 7: Motion vectors for I1-B2 field\

IV. PERFORMANCE ANALYSIS The performance comparison of three algorithms based on number of check points, total time to compute the estimation process and visual quality of an image interims of peak signal to noise ratio are resulted in table 1. Table 1: Performance evaluation of full search, diamond search and CAST algorithms

ME scheme Full Search Algorithm Diamond Search Algorithm Adaptive Motion Estimation Algorithm

TCP 408608

Time(sec) 40.922

PSNR 83.5406

43259

11.359

83.5882

21561

9.594

83.5950

V. CONCLUSION AND FUTURE SCOPE MPEG-4 reduces the amount of storage needed, increases the amount of time video can be stored, reduces the network bandwidth used by the surveillance system. So, MPEG-4 standard is best suited for video compression than compared to all other standards. Based on the performance parameters i.e. minimum absolute difference, number of checkpoints and image visual quality the CAST algorithm is best and fastest algorithm to find the accurate motion vectors to compress a video and also it provides adaptability to various types of video contents than compared to the all other algorithms. Diamond search algorithm improves time by 72.2% and peak signal to noise ratio by 0.056 as compared the full search algorithm. Content adaptive search technique algorithm improves time by 76.5% and peak signal to noise ratio by 0.0650 as compared the full search algorithm. 339

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 2, Issue 12, December 2012) [16 ] I. Haritaoglu, D. Harwood, and L. Davis. W4: Who, when, where, what: A real time system for detecting and tracking people. In Third Face and Gesture Recognition Conference, pages: 222-227, 1998. [17 ] A. Kale, N. Cuntoor, B Yegnanarayana, A.N Rajagopalan, R. Chellappa, “Gait analysis for human identification”, Proceedings of the 3rd International conference on Audio and Video Based Person Authentication, 2003. [18 ] A. Kale, A. K. Roy Chowdhury and R. Chellappa, “Towards a View Invariant Gait Recognition Algorithm”, AVSS, 2003.

Ms. T. Sravanthi working at Vignana Bharathi Institute of Technology (VBIT). She qualified ME from Chaitanya Bharathi Insistute of Technology (Affiliated to Osmania University) & B.Tech from Bhoj Reddy Engineering College for Women (Affiliated to Jawaharlal Nehru Technology University, Hyderabad).Her areas of interest are image registration, tracking, data fusion and video compression.

340

Suggest Documents