Huffman coding paradigm

2010-08-20  来源:本站原创  分类:Tech  人气:153 

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.

相关文章
  • Huffman coding paradigm 2010-08-20

    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

  • Huffman coding based on a simple flow chart of compression software 2010-05-29

    Huffman coding based on a simple flow chart of compression software

  • Visualization of Huffman coding Java 2010-08-17

    Oh, after several days of efforts, finally Huffman coding to engage them, and although the process encountered in the preparation of a variety of issues, but in the end to ask and look at the basis of the information, to solve problems , especially i

  • Huffman coding algorithm and C language (1) 2010-09-01

    Huffman encoding algorithm depends on the Huffman Tree model Huffman Tree is? Suppose there are n-weights (w1, w2, w3 ...... wn), construct a test with n-leaf binary tree nodes (node a total of m = 2 * n-1), each leaf weighted value of wi, which WPL

  • Huffman coding algorithm and C language (2) 2010-09-01

    HT array structure after the completion of the state as follows: By huffman tree, each leaf node by the huffman coding. Used in this leaf node to the root node from the requirements of each character huffman coding. C starting from the leaves through

  • Huffman coding algorithm, C language (2) 2010-09-01

    HT array structure after the completion of the state as follows: By huffman tree, each leaf node by the huffman coding. Used in this leaf node to the root node from the requirements of each character huffman coding. C starting from the leaves through

  • 霍夫曼编码摘录(Huffman coding) 2014-04-13

    在计算机资料处理中,霍夫曼编码使用变长编码表对源符号(如文件中的一个字母)进行编码,其中变长编码表是通过一种评估来源符号出现机率的方法得到的,出现机率高的字母使用较短的编码,反之出现机率低的则使用较长的编码,这便使编码之后的字符串的平均长度.期望值降低,从而达到无损压缩数据的目的. 霍夫曼树又称最优二叉树,是一种带权路径长度最短的二叉树.所谓树的带权路径长度,就是树中所有的叶结点的权值乘上其到根结点的路径长度(若根结点为0层,叶结点到根结点的路径长度为叶结点的层数).树的路径长度是从树根到每一结

  • <In-depth Search engine-vast amounts of information compression. Indexing and query> --- book review of compression code (a) 2010-12-27

    The book is a blessing of information retrieval course Andean bear one of the preferred materials. Dangdang entrance http://product.dangdang.com/product.aspx?product_id=20617442&ref=search-1-pub , the Internet can download book PDF document, given th

  • Huffman tree + double buffering to achieve compression algorithm (Updated) 2010-03-29

    The first thing we know before the Huffman tree to find out the simple binary tree, it is easy to understand, is a binary tree each node have only two sub-nodes in the tree structure, and also divided into parent node (parent node), the left sub-tree

  • Havermann tree coding to create and Havermann 2010-05-04

    This evening spent several hours writing this procedure. . . I blame its inefficiency. . . Well ado, here, give me the code. (This code reference to the strict teacher Wei-Min algorithm) One specific implementation is not to say, because I wrote a no

  • Information entropy in arithmetic coding 2010-08-20

    Arithmetic Coding (change) We have learned in the last chapter, Huffman coding using the integer number of bits to encode the symbols, this method can not be in many cases the best compression. Suppose a character is 80% probability that the characte

  • java Huffman compression algorithm analysis and implementation [source] [photo] 2010-10-07

    First, the needs analysis: In their daily work life, for file storage, transmission requirements, the need for file compression. Huffman compression is based on the Huffman tree compression of a lossless compression algorithm. Huffman algorithm is a

  • The most simple file compression program huffman 2010-11-21

    Are cramming data structure, today saw the binary tree, huffman coding, compression program that is very interesting to huffman coding according to an ideology, not through algorithm improvement, but did not use third-party libraries, but also a litt

  • Compression software to write himself, super detailed explanation (Huffman implementation) 2010-12-04

    Speaking of file compression is all very easy to rar, zip, etc. The most common compression format. However, there is a data structure that we learn the most commonly seen in the Huffman tree data structure, before he did not know what use, in fact,

  • Compression software (Huffman algorithm) Project Summary 2010-12-12

    First, before talking about specific code, give us universal knowledge about compression software. Quote Compression software is to use lossy or lossless algorithms to handle the file, most file information to reach the reservation, thus making the f

  • java source coding to achieve three 2010-12-18

    Information through the transmission to the destination channel is the communication process. The purpose of source coding is to reduce redundancy and improve coding efficiency. First, Shannon coding steps: 1) a decrease in probability of source symb

  • On the character encoding (b) - common coding 2011-05-22

    · ASCII and ISO 8859-1 · ISO 8859-1 is relatively simple, we know that ASCII code is 0x00 to 0x7F, which is also one not used, ISO 8859-1 is vacant 0xA0-0xFF in the context of letters and adding 192 symbols, to use diacritical marks for Latin alphabe

  • Huffman encoding and decoding (C language) 2011-05-26

    #include<stdio.h> #include<stdlib.h> #include<string.h> #include<conio.h> #define MAXNUM 60 typedef struct { char ch; int weight; // Weight, frequency of occurrence of this character int parent; int left; int right; }HuffNode; type

  • (Data structure) Huffman tree and code 2011-05-29

    #include <STDIO.H> #include <stdlib.h> #include <string.h> typedef unsigned int unint; #define MAX 1000; typedef struct { unint weight; unint parent, lchild, rchild; }HTNode, *HuffmanTree; typedef char ** HuffmanCode; void Select(Huffman

  • chromium dependent libraries 2010-03-03

    bsdiff and bspatch Description: generate / apply a patch between two binary files bsdiff and bspatch are tools for building and applying patches to binary files. By using suffix sorting (specifically, Larsson and Sadakane's qsufsort) and taking advan