The principle and application of exponential Grumb entropy coding algorithm used by H264

Source: Internet
Author: User

1 exponential Grumb entropy coding algorithm principle

1.1 unsigned integer k-order exponential Grumb algorithm encoding process:

1) write the number in binary form, remove the lowest k bit, then add 1
2) calculates the number of bits left, minus one, which is the number of leading 0 digits that need to be increased
3) Replace the lowest k bits removed in the first step with the end of the bit string

Example (1-order exponential Grumb algorithm encodes an integer 9):

The 1th step represents the integer 9:a0 = 9 with the symbol A0;

The 2nd step converts the integer 9 into a binary format representation and is represented by a symbolic a1: a1 = 1001;

The 3rd step is to remove the minimum 1 bits and save to the symbol R0, the remainder is recorded as A2:r0 = 1; a2 = 100

4th step A2 plus 1 and recorded as A3:A3 = 101

The 5th step A3 has 3 bits, minus 1 equals 2, so 2 preamble 0, denoted by the symbol A4: a4 = 00101

The 6th step is to add the bits in the r0 to the back of the A4 bit, denoted by the symbol A5: a5 = 001011

So unsigned integer 9 is finally encoded as 001011

1.2 unsigned integer k-order exponential GRUMB algorithm decoding process:

When parsing the K-Order index Columbus Code, the first non-0-bit leadingzerobits is first searched from the current position of the bitstream, and then the value of Code_num is calculated according to the formula:

Code_num = 2^ (leadingzerobits + k)-2^k + values;

Where values are the first non-0-bit followed by (leadingzerobits + K) bits.

Example (1-order exponential GRUMB algorithm decoding 001011): leadingzerobits=2;values=011b=3;code_num=2^3-2^1+3=9

2 H264 4 kinds of exponential Columbus coding algorithm

UE (v): Unsigned exponential Columbus entropy coding algorithm

Se (v): Signed exponential Columbus entropy coding algorithm

Te (v): truncated exponential Columbus entropy coding algorithm

Me (v): Exponential Columbus Entropy coding algorithm for maps

 Note: H264 only uses the 0-order exponential Columbus coding algorithm, because its order is 0, it has a more simplified algorithm for decoding, (for the UE is unsigned integer) briefly described as follows:

1) Encoding algorithm: Add 1 to the unsigned integer to be encoded, then convert to binary representation, calculate its bits number, and then subtract 1 prefix 0 in front of the bits number, for example: 1 encoding 010, 5 encoding 00110

2) decoding algorithm: Code_num = 2^ (leadingzerobits)-1 + values, example: 010 decoding for 2^1-1+0=1,00110 decoding for 2^2-1+2=5

3) The 0-order exponential Columbus Coding algorithm is the UE (v) codec process.

3 SE (v)

1) encode the symbol to encode the value of the code to the unsigned value, and then unsigned to encode the value by the UE (v) Encoding rules, wherein the symbol to encode the value of the code to be encoded into an unsigned rule is: if the symbol to encode a positive number is multiplied by 2-1, otherwise directly multiplied by 2 to its value. Example:-3 conversion to 6, 4 conversion to 7

2) decoding, first with the UE (v) Decoding rules decoding, and then the UE (v) Output value is recorded as K, after the decoding of the decoded value of the attached number is: (–1) k+1 ceil (k÷2)

4 te (v)

1) te (v) is suitable for non-negative integer codecs only

2) The code to determine the value of the maximum range of values to be encoded, if greater than 1, then the UE (v) Rules directly encoded, otherwise if the encoding value is 1 encoded after the value of 0, if the value to be encoded is 0 the value of the encoding is 1

3) The decoding of the value to be encoded before the upper limit of the range of values, if greater than 1, then the UE (v) Rules to decode directly, otherwise if the decoding value is 1 decoded after the value of 0, if the value to be decoded 0 is decoded after the value of 1

5 Me (v)

1) used in H264 to encode grammatical elements Coded_block_pattern

2) Mapping rules when encoding and decoding refer to H264 standard 9.1.2

Summary: The H264 uses the 0-order exponential Columbus codec algorithm, which itself is the UE (v), other SE (v), TE (v), Me (v), is the rule of the body processing after the call UE (v) to complete the final codec task.

The principle and application of exponential Grumb entropy coding algorithm used by H264

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.