| H.264 is a new video coding standard on behalf of the recent research in the field of video communication. Compared to previous video coding standards, H.264 has better performance on video data compression and network adaptability. However, the algorithm complexity of H.264 encoding and decoding is higher, which to some extent, affects the application of H.264, especially in some real-time occasions. Context-based Adaptive Variable Length Coding(CAVLC) and Context-based Adaptive Binary Arithmetic Coding(CABAC) are advanced entropy coding methods used in H.264 to increase the degree of data compression due to their use of context information compared to common entropy coding methods. However, the complex processes of these two methods increase the encoding/decoding time of H.264 and reduce its speed. Optimization on the algorithm of these two entropy coding methods can speed up the H.264 encoding/decoding and promote its application in actual applications.In this paper, some key aspects of H.264 including intra/inter frame prediction, transform and quantization are introduced at first, then Context-based Adaptive Variable Length Coding and Context-based Adaptive Binary Arithmetic Coding are analyzed and their advantages and disadvantages are studied. Finally the decoding process of Context-based Adaptive Variable Length Coding and encoding process of Context-based Adaptive Binary Arithmetic Coding while encoding macroblock type in I slices are optimized.For Context-based Adaptive Variable Length Coding, the values of the parameter NC and the number of bits used to decode Coeff_token are collected and studied. The results show that the probability of NC = 6 is relatively low and the number of bits used to decode Coeff_token is more probable less or equal to 3.Based on the statistical results, an optimization for Context-based Adaptive Variable Length Coding is proposed in this paper. After optimization, the decoding time can be reduced by about 1% compared to the original algorithm.For Context-based Adaptive Binary Arithmetic Coding, an improved algorithm to encode macroblock type in I slices is proposed. The results show that the calls of encoding function can be reduced by about 20% in the improved algorithm and the encoding time can be reduced by about 3%.After improvement on the two entropy coding methods, the real-time performance of H.264 is better than before, which is very important in some real-time occasions. |