Basic concept of entropy coding

Source: Internet
Author: User
Tags arithmetic

Entropy coding is the encoding process by entropy principle without losing any information. Entropy is the average amount of information (measurement of uncertainty) of the source. Common entropy codes are: Shannon (Shannon) encoding, Huffman (Huffman) encoding and arithmetic coding (arithmetic coding). In video coding, Entropy coding transforms a series of element symbols used to represent video sequences into a stream of compressed code for transmission or storage. The input symbols may include quantized transformation coefficients, motion vectors, header information (the size of the macro, the head of the image, the first class of the sequence), and additional information (the tag bit information that is important for proper decoding).

The H264 Standard employs two entropy coding modes: Context-based binary arithmetic encoding CABAC and variable length encoded VLC. The slice layer (picture and sequence) uses a fixed-length or variable-length binary encoding, and the slice layer and the following use VLC or CABAC.

The H264 syntax has an entropy encoding mode option (Entropy_coding_mode) that, when the value of Entropy_coding_mode is 0, uses context-based adaptive variable-length encoding for the transformed and quantized residual block data (CAVLC Context-adaptive varbile length coding) encoding, and other variable-length encodings are encoded using the Unified Codebook (Exp-golomb encoding).

When using the Unified Codebook (Exp-golomb Encoding) encoding, for the presence of high probability symbols using short code word, the probability of low sign using long code word, Exp-golomb coding design structure is very regular, the codec is simple and fast, in the event of a bit error can be quickly synchronized. The CAVLC is used to encode the transformation coefficients of the 4x4 (and 2x2) residuals blocks of the font read out, using CAVLC to play the technical advantages of 4x4 blocks:

(1) After prediction, transformation and quantization, the coefficient block is a sparse matrix containing a large number of 0. CAVLC uses run-length code to 0-string compression.

(2) The largest non-0 coefficients of the scanned font are usually a sequence of +1 or-1, which cavlc the output of +1 or-1.

(3) The number of non-0 transformation coefficients between adjacent blocks is interrelated, the coefficients of the current block are encoded using a lookup table, and the selection of the lookup table depends on the number of non-0 coefficients of the adjacent block.

(4) The number of non-0 coefficients is much higher at the beginning of the reordering array, and less in the High frequency section. CAVLC using this feature, the selection of the lookup table relies on the statistical regularity of the encoded transmitted data content.

CAVLC makes the coefficients of the 4x4 blocks transformed by DCT integers and quantized to obtain higher coding efficiency.

Another entropy coding pattern in H. S is the context-based binary arithmetic encoding cabac. The arithmetic coding starts from the whole sequence, and the average code length can approximate the entropy of the source by using the recursive form of continuous coding.

When the value of Entropy_coding_mode is 1,h.264 use the CABAC arithmetic encoding system to encode the syntax elements. Cabac chooses the probability model suitable for grammatical elements according to the content of elements to achieve good compression effect. CABAC encoding Process steps:

(1) Binary: Cabac encodes a binary number. A non-binary number (for example: a transform factor or motion vector) must be either binary or converted to a binary number before arithmetic encoding. This process is similar to converting data symbols to variable-length encodings, where binary codes are encoded by arithmetic encoders before they are transformed.

Repeat for each bit of the binary symbol (2), (3), and (4).

(2) Context Model selection: Context mode is a probabilistic model of one or more bits of a binary symbol. Select the context model from the available models based on the statistical laws of recently encoded data symbols. The context model stores the probability that each bit number is 0 or 1.

(3) Arithmetic code: The arithmetic encoder is encoded according to the chosen probability model. Note that there are only two sub-ranges for the number of bits (preferably 0 or 1<).

(4) Probability correction: The selected context model is modified according to the actual encoded data, for example, if the number of bits is the probability of a higher.

There are 267 different context models in H264, corresponding to different syntax elements, depending on the type of slice, some models will be used differently. At the beginning of slice, the context model is initialized based on the initial value of the quantization factor.

Cabac according to the past observations, select the appropriate context model to provide the estimation of the conditional probability of the data symbol, and dynamically modify the probabilistic model according to the frequency of the number of bits of the data symbol at the time of encoding, the data symbol can approximate the entropy rate into

Coding efficiency is improved. In the same image quality, using CABAC encoded TV signal will be more than CAVLC

Special rate to reduce 10%~~15%. The complexity of CABAC is higher than that of CAVLC, and the improvement of CABAC coding efficiency is based on the sacrifice complexity.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.