Huffman coding paradigm is a formal code relative to operate much simpler in terms of coding, and its effects can play and huffman encoding the same effect.

Huffman coding paradigm based on or rely on the huffman coding.

1, first need to compress the data huffman order, arrived at the huffman binary tree data model.

The data obtained is useful, that is, each data sample in the end has been assigned several bit. Such data appear in the data a, after this step the data obtained after the huffman code a few bit. For example, doing we are two, is that the data a, huffman coding, with a 2-bit data to represent a.

2, by the above data, we must determine the data sample in each sample corresponding huffman code value.

Such as the above data a, has identified the huffman encoded code word for the two, then by following the rules, you can determine the two values a corresponding huffman code value in the end is.

3, in order to achieve two purposes, in accordance with the following order to operate.

a, are assigned the median for each data sample, for example as follows:

Symbol Length

a 2

b 2

c 3

d 3

e 4

f 4

i 4

g 5

h 5

b, according to the table, able to draw up the code huffman code bits, for example, is 5. And statistics, from the five long coding start to a long code so far (a total of 5 codes), length of each code number appears (for example, encoded data sample is 4 out of the data after the number of samples ), you can get another table, as follows:

Length Num

52

43

32

22

10

This table shows the code length for a fixed value of the sample number is. The first line of that length, the number of samples of 5 to 2.

c, above table can be calculated simply another form

Length start code

500 000

40001

3010

210

Calculation of this table is very simple, and from this table to calculate the code table, now calculated are summarized as follows:

Code points to the most up to the beginning of the sample huffman code value is set to 0, of course, is to determine the median (in the above example, the 00000), because the code number 5 with 2, 0 with 2 equal to 2, and then shifted to the right a value of 4 yards as the beginning of the code value for 0010, because the value of the number of 4 yards plus 3 to 3,0010 to 0101, shifted to the right one for three yards of the starting start code value for the 010, because the number of 3 yards to 2, then add 2 010 100, shifted to the right one to 10, as two yards of the start code value.

d, above table, determine the length of the huffman code for each different code value of the initial sample code from the above table can be very easy to get all the sample code value. As follows:

Move 5 yards long huffman code as an example: start the code value of 00000, which corresponds to h, ie 00 000 when h, huffman coding. However g is 5-digit codes, for g, as long as the 00 000 plus 1 on the back was 00001, this is the g's code, if there is a third five yards, then its code is 00001 + 1 = 00010 (of course, in this case only two five yards)

Other yards in the same treatment, according to the order plus one way to get all the samples can be coded value.

As noted, paradigm huffman coding is complete.

It is worth noting, however, in the jpeg encoding, storing the huffman table is not as stated above. On the contrary, in the jpeg system, decoding of the huffman table is the number along the contrary, is the lowest given 0, and each time left to get the other code values.