📄 029-031.html
字号:
<!DOCTYPE HTML PUBLIC "html.dtd"><HTML><HEAD><TITLE>The Data Compression Book-:The Dawn Age: Minimum Redundancy Coding</TITLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><SCRIPT><!--function displayWindow(url, width, height) { var Win = window.open(url,"displayWindow",'width=' + width +',height=' + height + ',resizable=1,scrollbars=yes');}//--></SCRIPT></HEAD><BODY BGCOLOR="#FFFFFF" VLINK="#DD0000" TEXT="#000000" LINK="#DD0000" ALINK="#FF0000"><TD WIDTH="540" VALIGN="TOP"><!-- <CENTER><TABLE><TR><TD><FORM METHOD="GET" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-foldocsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE="Glossary Search"></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD><TD><IMG SRC="http://www.itknowledge.com/images/dotclear.gif" WIDTH="15" HEIGHT="1"></TD><TD><FORM METHOD="POST" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-subscriptionsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE=" Book Search "></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="backlink" TYPE="hidden" VALUE="http://search.itknowledge.com:80/excite/AT-subscriptionquery.html"><INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD></TR></TABLE></CENTER> --><!-- ISBN=1558514341//--><!-- TITLE=The Data Compression Book-//--><!-- AUTHOR=Mark Nelson//--><!-- PUBLISHER=IDG Books Worldwide, Inc.//--><!-- IMPRINT=M & T Books//--><!-- CHAPTER=3//--><!-- PAGES=029-031//--><!-- UNASSIGNED1//--><!-- UNASSIGNED2//--><CENTER><TABLE BORDER><TR><TD><A HREF="027-029.html">Previous</A></TD><TD><A HREF="../ewtoc.html">Table of Contents</A></TD><TD><A HREF="031-034.html">Next</A></TD></TR></TABLE></CENTER><P><BR></P><P>The Shannon-Fano tree shown in Figure 3.1 was developed from the table of symbol frequencies shown next.</P><TABLE WIDTH="100%"><TR><TH COLSPAN="2"><HR><TR><TH WIDTH="20%" ALIGN="LEFT">Symbol<TH WIDTH="80%" ALIGN="LEFT">Count<TR><TH COLSPAN="2"><HR><TR><TD>A<TD>15<TR><TD>B<TD>7<TR><TD>C<TD>6<TR><TD>D<TD>6<TR><TD>E<TD>5<TR><TD COLSPAN="2"><HR></TABLE><P>Putting the dividing line between symbols B and C assigns a count of 22 to the upper group and 17 to the lower, the closest to exactly half. This means that A and B will each have a code that starts with a 0 bit, and C, D, and E are all going to start with a 1 as shown:</P><TABLE WIDTH="100%"><TR><TH COLSPAN="3"><HR><TR><TH WIDTH="20%" ALIGN="LEFT">Symbol<TH WIDTH="20%" ALIGN="LEFT">Count<TH WIDTH="60%"><TR><TD>A<TD>15<TD>0<TR><TD>B<TD>7<TD>0<TR><TD COLSPAN="2"><HR><TD>First division<TR><TD>C<TD>6<TD>1<TR><TD>D<TD>6<TD>1<TR><TD>E<TD>5<TD>1<TR><TD COLSPAN="3"><HR></TABLE><P>Subsequently, the upper half of the table gets a new division between A and B, which puts A on a leaf with code 00 and B on a leaf with code 01. After four division procedures, a table of codes results. In the final table, the three symbols with the highest frequencies have all been assigned 2-bit codes, and two symbols with lower counts have 3-bit codes as shown next.</P><TABLE WIDTH="100%"><TR><TH COLSPAN="5"><HR><TR><TH WIDTH="20%" ALIGN="LEFT">Symbol<TH WIDTH="20%" ALIGN="LEFT">Count<TH WIDTH="20%"><TH WIDTH="20%"><TH WIDTH="20%"><TR><TD>A<TD>15<TD>0<TD>0<TD><TR><TD COLSPAN="3"><HR><TD>Second division<TR><TD>B<TD>7<TD>0<TD>1<TD><TR><TD COLSPAN="2"><HR><TD COLSPAN="2">First division<TD><TR><TD>C<TD>6<TD>1<TD>0<TD><TR><TD COLSPAN="3"><HR><TD>Third division<TR><TD>D<TD>6<TD>1<TD>1<TD>0<TR><TD COLSPAN="4"><HR><TD>Fourth division<TR><TD>E<TD>5<TD>1<TD>1<TD>1<TR><TD COLSPAN="5"><HR></TABLE><P>That symbols with the higher probability of occurence have fewer bits in their codes indicates we are on the right track. The formula for information content for a given symbol is the negative of the base two logarithm of the symbol’s probability. For our theoretical message, the information content of each symbol, along with the total number of bits for that symbol in the message, are found in the following table.</P><TABLE WIDTH="100%"><TR><TH COLSPAN="4"><HR><TR><TH WIDTH="20%" ALIGN="LEFT">Symbol<TH WIDTH="20%" ALIGN="LEFT">Count<TH WIDTH="20%" ALIGN="LEFT">Info Cont.<TH WIDTH="40%" ALIGN="LEFT">Info Bits<TR><TH COLSPAN="4"><HR><TR><TD>A<TD>15<TD>1.38<TD>20.68<TR><TD>B<TD>7<TD>2.48<TD>17.35<TR><TD>C<TD>6<TD>2.70<TD>16.20<TR><TD>D<TD>6<TD>2.70<TD>16.20<TR><TD>E<TD>5<TD>2.96<TD>14.82<TR><TD COLSPAN="4"><HR></TABLE><P>The information for this message adds up to about 85.25 bits. If we code the characters using 8-bit ASCII characters, we would use 39 × 8 bits, or 312 bits. Obviously there is room for improvement.</P><P>When we encode the same data using Shannon-Fano codes, we come up with some pretty good numbers, as shown below.</P><TABLE WIDTH="100%"><TR><TH COLSPAN="6"><HR><TR><TH WIDTH="15%" ALIGN="LEFT">Symbol<TH WIDTH="15%" ALIGN="LEFT">Count<TH WIDTH="17%" ALIGN="LEFT">Info Cont.<TH WIDTH="15%" ALIGN="LEFT">Info Bits<TH WIDTH="15%" ALIGN="LEFT">SF Size<TH WIDTH="23%" ALIGN="LEFT">SF Bits<TR><TH COLSPAN="6"><HR><TR><TD>A<TD>15<TD>1.38<TD>20.68<TD>2<TD>30<TR><TD>B<TD>7<TD>2.48<TD>17.35<TD>2<TD>14<TR><TD>C<TD>6<TD>2.70<TD>16.20<TD>2<TD>12<TR><TD>D<TD>6<TD>2.70<TD>16.20<TD>3<TD>18<TR><TD>E<TD>5<TD>2.96<TD>14.82<TD>3<TD>15<TR><TD COLSPAN="6"><HR></TABLE><P>With the Shannon-Fano coding system, it takes only 89 bits to encode 85.25 bits of information. Clearly we have come a long way in our quest for efficient coding methods. And while Shannon-Fano coding was a great leap forward, it had the unfortunate luck to be quickly superseded by an even more efficient coding system: Huffman coding.</P><P><BR></P><CENTER><TABLE BORDER><TR><TD><A HREF="027-029.html">Previous</A></TD><TD><A HREF="../ewtoc.html">Table of Contents</A></TD><TD><A HREF="031-034.html">Next</A></TD></TR></TABLE></CENTER></TD></TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -