### Paper Menu >>

### Journal Menu >>

Wireless Sensor Network, 2009, 3, 182-188 doi:10.4236/wsn.2009.13024 ctober 2009 (http://www.SciRP.org/journal/wsn/). Copyright © 2009 SciRes. WSN Published Online O Novel Rate-Control Algorithm Based on TM5 Framework Zhongjie ZHU1,2, Yongqiang BAI1,2, Zhiyong DUAN1,2, Feng LIANG1 1Ningbo Key Laboratory of DSP, Zhejiang Wanli University, Ningbo, China 2Physical Engineering College, Zhengzhou University, Zhengzhou, China E-mail: zhongjiezhu@hotmail.com Received April 9, 2009; revised April 25, 2009; accepted May 30, 2009 Abstract Rate control is a key technology in the fields of video coding and transmission, and it has attracted a great attention and has been studied extensively. The TM5 framework of MPEG-2 is a classical rate control algo- rithm and has being widely used. However, it has some underlying drawbacks during practical applications such as the poor rate control precision and high computational complexity. Hence, in this paper, a novel rate-control algorithm based on the TM5 framework is proposed. The drawback of the target bit allocation method of the original TM5 algorithm is firstly analyzed and improved. Then, a new rate-distortion model is incorporated into the rate control algorithm to implement rate prediction to enhance the rate-control precision. Meanwhile, the macro-block (MB) level rate control is adapted to be frame level to reduce the computational complexity. Experiments are conducted and some results are given. Compared with the original TM5 algo- rithm, the improved novel algorithm not only can enhance the rate-control precision but also can reduce the complexity and the fluctuation of decoded image quality. Keywords: Rate Control, TM5, Target Bit Allocat i o n, R a t e- D ist o rt i o n Mod e l 1. Introduction Rate control is a key technology in the fields of video coding and transmission [1,2]. With the rapid progress of video coding technology and explosion of video applica- tions, it has attracted a great attention and has been stud- ied extensively. The main objective of rate control is to optimally allocate available bits within video sequences to minimize visual distortion under the bit rate constraint. For a rate control algorithm, the rate-distortion perform- ance and the computational complexity are two main issues that should be addressed. Although rate control is a normative part in video coding standards, almost all the main existing video coding standards have proposed their own recommendations on rate control over the last few years such as the TM5 algorithm of MPEG-2, the VM8 algorithm of MPEG-4, the TMN8 algorithm of H.263 and the F086/G012 of H.264 [3,4]. As mentioned above, the rate contro l is an informative part in video coding standard, which means that this part is still open for research. It leaves the flexibility for de- signers to develop suitable scheme for specific applica- tions. Hence, this topic is still being studied extensively. Xu et al have proposed a novel Dynamic Video Rate Control (DVRC) technique which can enable adaptive video delivery over the Internet [5]. But its performance in heterogeneous network environments should be fur- ther enhanced. Papadimitriou et al have proposed a novel rate control algorithm when hierarchical B-picture cod- ing is used in H.264/AVC, where sign ificant PSNR gains as well as accurate rate control precision can be achieved [6]. However, the computational load is high. For more other related works, the readers are referred to [2]. It is noted that, the TM5 rate control algorithm of MPEG-2 has obtained great attention and has been widely used. It implements rate control in macro-block level and mainly consists of th ree steps: target bit alloca- tion, rate control and adaptive quantization. However, it also has drawbacks including poor rate-control precision and not low computational complex due to its macro- level quantification [7,8]. In this paper, a novel rate- control algorithm based on TM5 framewo rk is proposed. The target bit-allocation of TM5 is improved and a new rate-distortion model is incorporated to implement rate prediction to enhance the rate-control precision. Mean- while, the macro-block level rate control is adapted to frame level to reduce the computationa l complexity. The remaining of the paper is organized as follows: Z. J. ZHU ET AL. 183 The TM5 rate control algorithm is briefly reviewed in Section 2; the target bit allocation is analyzed and an improved rate-distortion model is introduced in Section 3; the proposed novel algorithm is introduced in Section 4; Section 5 shows the experimental results to evaluate our work; Section 6 concludes the paper. 2. TM5 Rate Control Algorithm The TM5 rate control algorithm has been designed for MPEG-2 standard. It mainly consists of the following three steps: 2.1. Target Bit Allocation The target number of bits for the next picture depends on picture-type and “universal” weighting factors. The tar- get number of bits for different type of frames (, , ) are calculated by [9]: I TP T B T IB BB IP PP I XK XN XK XN R T 1 (1) PB BPB P P XK XKN N R T (2) BP BBP B B XK XKN N R T (3) where is the remaining number of bits assigned to GOP, , are the number of P-pictures and B-pictures remaining in the current GOP, , are universal constants depending on the quantization matri- ces. In most cases, = 1.0 and = 1.4. R P NB N P KB K P KB K (a) KP-QP curves of three P-frames (b) KB-QP curves of the six B-frames Figure 1. The (KP, KB)-QP curves of Alex sequence from one GOP. (a) KP-QP curves of the three P-frames (b) KB-QP curves of the six B-frames Figure 2. The (KP, KB)-QP curves of the Claire sequence from one GOP. C opyright © 2009 SciRes. WSN Z. J. ZHU ET AL. 184 (a) KP-QP curves of the three P-frames (b) KB-QP curves of the six B-frames Figure 3. The (KP, KB)-QP curves of the Train sequence from one GOP. 2.2. Rate Control The reference value of the quantization parameter for each macro-block (MB) is set as follows: j Q ) 31 ( r d Qj j (4) where r is the reaction parameter and given by f R r2 (5) where denotes the bit rate, denotes the frame rate. Rf 2.3. Adaptive Quantization The final quantification parameter for the jth Macro-block is given by j mquant j MB mquant jjj actNQ _ (6) where is the normalized spatial activity meas- ured for . j act j N_ MB 3. Improved Target Bit Allocation and Rate Distortion Model 3.1. Improved Target Bit Allocation From Formulas (1), (2) and (3), it can be seen that , are universal constants depending on the quantifi- cation matrix, which can be viewed as the ratio of num- ber of bits of I frame to that of P frame or B frame, re- spectively, that is P K B K B I B P I PR R K R R K P R R KP (7) , where , , denote the number of bits of I, P, B frames respectively. I RB In practical video coding applications, and are not constant, they are usually related to the quantifi- cation parameter of I-frame. Hence, rate control error and video quality fluctuation may increase if and keep constant during the whole encoding process. P KB K P K B K To investigate the actual relations between, quantification parameter of I-frame, experiments are conducted. Some standard test sequences, including Alex, Claire, and Train, are used to implement coding experi- ments to investigate this phenomenon. The GOP struc- ture is set to IBBPBBPBBP [10]. Some experimental results are given in Figures 1–3 where the values of and are normalized and the actual curves of three P-frames and the curves of six B-frames from the same GOP are given. From the ex- perimental results, it can be observed that the decrease of or is approximately linear to the increment of of I-frame. P K P K B K P K QP B K QPKP QPKB B K Hence, the QP or relations can be ap- proximately modeled as QPKB bQPK a i },{ BPi (8) where denotes the frame-level bit-allocation coeffi- cient of P or B frames, is the quantificatio n parame- ter of I frame, a and b are model parameters. i K QP Copyright © 2009 SciRes. WSN Z. J. ZHU ET AL. 185 3.2. Novel Rate-Distortion Model R-D models have been introduced since MPEG-4 and H.263. These models are helpful in rate control since they can provide sufficient information for determining quantification parameters. Once the target bit rate for the current encoding frame is acquired, the quantization pa- rameter can be determined through the R-Q models. In order to improve the precision of the trad ition al quadratic R-D model, based on empirical observations and lots of experiments, we improved the quadric R-Q model and proposed a novel one [11]: c Q b Q a R 2 (9) where a, b, c are model parameters which can be calcu- lated by linear regression method explained as follows. Define 2 11 )( Q Qx , Q Qx 1 )( 2 (10) Suppose ,,…, are existing samples, and define ),,( 12111 Rxx ),,( 22212 Rxx),,( 21nnn Rxx nn xx xx xx M 21 2212 2111 1 1 1 ,, (11) 1 2 1 n R R R R a b c C Then based on linear regression method, the parameters can be estimated: RMMMC TT 1 )( , (12) where T M is the transpose of M and is the inverse matrix of 1 )( MMT M M T. 4. Proposed Algorithm Based on the above observations, the traditional TM5 rate con trol framework is ad apted and a new rate contro l algorithm is proposed. The target bit-allocation is im- proved and a new rate-distortion model is incorporated to implement rate prediction to enhance the rate-control precision. Meanwhile, the macro-block level rate control is adapted to frame level to reduce the computational complexity. The key steps of the rate control are briefly introduced as follows: 4.1. Target Bits Calculation Suppose is the length of GOP, is the frame- rate, is the bit-rate, the initial target number of bits for a GOP is calculated as: G Nr f r b ))0(( 2 )0( 0cG r rBBN f b T (13) where denotes the initial value of virtual buffer, denotes the occupancy of virtual buffer after en- coding the jth frame, denotes the occupancy of virtual buffer after encoding the former GOP, denotes the remaining bits available for the current GOP after encoding the jth frame. After encoding one frame, is updated as: 0 B )(jBc )( jT )0( c B )( jT )1()1()( jAjTjT (14) where is the number of bits generated by encoding the jth frame . )( jA K For frame-level bit-allocation, it is very important to properly select and. The bigger the values of and are, the smaller the distortion of encoded I frame will be. However, if and are set too large values, not only will the stream fluctuation increase but also video quality will decrease. Hence, in our algo- rithm, and are selected acc ording to Equation (8). P K B K B K P KB K P P KB K 4.2. Frame-Level Rate Control After the target number of bits for each frame is esti- mated, the quantification parameter can be calculated through the fo llowing rate-distortion model: c Q b Q a X HR 2 (15) where a, b, c are model parameters, H is the head infor- mation. The complexity X of current frame is expressed by SAD predicted from that of the former frame, which is calculated as: ),( )),(),(( yx yxfyxfabsSAD (16) 4.3. Model Update When finishing encoding one frame, the SAD model and the R-Q model are updated until the whole video se- quence is encoded. 5. Experiment Results In order to evaluate the performance of the proposed rate control algorithm, we conduct theoretical analysis as C opyright © 2009 SciRes. WSN Z. J. ZHU ET AL. 186 (a) 160Kbps (b) 150Kbps (c) 130Kbps Figure 4. Rate-control precisions of the Alex sequence at different bit rates. (a) 1.2Mbps (b) 1.0Mbps (c) 0.6Mbps Figure 5. Rate-control precisions of the Train sequence at different bit rates. Copyright © 2009 SciRes. WSN Z. J. ZHU ET AL. 187 (a) 160Kbps (b) 150Kbps (c) 130Kbps Figure 6. Image qualities of the Alex sequence at different bit rates. (a) 1.2Mbps (b) 1.0Mbps (c) 0.6Mbps Figure 7. Image qualities of the Train sequence at different bit rates. C opyright © 2009 SciRes. WSN Z. J. ZHU ET AL. Copyright © 2009 SciRes. WSN 188 well as simulation experiments. Two indexes are inves- tigated, algorithm complexity and rate-control precision. In TM5 algorithm, the final selection of the quantifi- cation parameter should consider the MB’s spatial activ- ity. The spatial activity of the jth MB can be calculated by ),,,min(1821vblkvblkvblkactj (17) where 2 64 1 )_( 64 1n k n kn meanPPvblk (18) 64 1 64 1 _ k n kn PmeanP (19) Pk are the sample values in the n-th original 8* 8 block. Based on above analysis, the complexity of TM5 algo- rithm is o(n12) according to Formula (18). The complex- ity of proposed novel algorithm is o(n22) according to Formulas (8) and (15), where n1 is the number of MBs in one frame and n2 is the number of available QPs. Since n1>>n2, one can see that the complexity of the improved algorithm reduces greatly compared with the original TM5 algorithm. To further evaluate the overall performance of the proposed algorithm, simulations are conducted on some standard sequences including Alex, Train and so on. We mainly investigate the rate-control precision and image quality fluctuation. Here, image quality is computed by PSNR and rate-control precision is defined as: RRRsqrt ])[( 2 (20) where is the target number of bits of GOP and R R is the actual generated number of bits. Figures 4–7 give partial experimental results, where Figure 4 and Figure 5 are the results of rate-control pre- cision of TM5 algorithm and the improved algorithm at different bit rates; Figure 6 and Figure 7 are the results of image quality of the two algorithms. From the experi- mental results, it can be seen that, compared with the TM5 algorithm, the proposed algorithm can both im- prove the rate-control precision and reduce the image quality fluctuation. 6. Conclusions and Future Work The paper proposed a novel rate-control algorithm based on the TM5 framework of MPEG-2. The drawback of the target bit allocation method of the original TM5 al- gorithm is improved and a new rate-distortion model is incorporated. The MB-level rate control is adapted to be frame level. As a result, compared with the original TM5 algorithm, the improved novel algorithm not only can enhance the rate-control precision but also can reduce the complexity and the fluctuation of decoded image quality. In our future work, the HVS features will be analyzed and is to incorporate into our rate control algorithm to further enhance the subjective visual quality of coded videos. 7. Acknowledgments This work was supported in part by the Natural Science Foundation of Zhejiang Province (No.Y107740); the Open Project Foundation of Ningbo Key Laboratory (No.2007A22002); the Natural Science Foundation of Ningbo (No.2008A610015). 8. References [1] M. Loren and V. Rahul, “Improved rate control and mo- tion estimation for H.264 encoder,” Proceedings of IEEE International Conference on Image Processing, pp. 309– 312, 2007. [2] Z. Z. Chen and K. N. Ngan, “Recent advances in rate control for video coding,” Signal Processing: Image Communication, pp. 19–38, 2007. [3] P. F. Zhao, J. W. Liu, and Q. Li, “A rate control idea and algorithm realization for H.264/AVC,” Computer Engi- neering, pp. 233–249, 2006. [4] K. Nejat, A. Yucel, and M. M. Russell, “Frame bit allo- cation for the H.264/AVC video coder via cauchy-den- sity-based rate and distortion models,” IEEE Transactions on Circuits and Systems for Video Technology, pp. 994–1006, 2005. [5] P. Papadimitriou and V. Tsaoussidis, “A rate control scheme for adaptive video streaming over the internet,” [Online], http://www.comp.lancs.ac.uk/~pap- adimp/icc07.pdf. [6] L. Xu, W. Gao, X. Y. Ji, and D. B. Zhao, “Rate control for hierarchical B-picture coding with scaling-factors,” [Online], http://idm.pku.edu.cn/lunwen/2007_2008619101121.pdf. [7] H. Li and Z. Z. Fu, “Improvement research based on H.264 TM5 rate control algorithm,” Journal of Computer Applications, pp. 749–751, 2007. [8] T. Y. Tian, “Research and applications of rate control in video coding,” Journal of University of Electronic Sci- ence and Technology of China, pp. 24–32, 2006. [9] W. Yuan, “Research for the ratio control algorithm in H.264,” Ph.D thesis, Hefei University of Technology, pp. 9–32, 2006. [10] H. J. Bi, New Generation Video Compression Coding Standard H.264, Posts and Telecommunications Press, pp. 114–117, 2005. [11] Z. J. Zhu, F. Liang, G. Y. Jiang, and M. Yu, “Bit-alloca- tion and rate-control algorithm for stereo video coding,” Journal on Communications, pp. 15–19, 2007. |