Applications of Hoffman coding in data compression

Top Applications of Hoffman coding

Lossless Image Compression

A simple application of Huffman coding to image compression would be to generate a Huffman code for the set of values that any pixel may take. For monochrome images, this set usually consists of integers from 0 to 255. Examples of such images are contained in the accompanying data sets.

Lossless Image Compression
Lossless Image Compression

Compression using Huffman codes on pixel difference values

Image NameBits/PixelTotal Size (bytes)Compression Ratio
    
Sena4.0232,9681.99
Sensin4.7038,5411.70
Earth4.1333,8801.93
Omaha6.4252,6431.24
Compression using Huffman codes on pixel difference values

Compression using adaptive Huffman codes on pixel difference values

Image NameBits/PixelTotal Size (bytes)Compression Ratio
Sena3.9332,2612.03
Sensin4.6337,8961.73
Earth4.8239,5041.66
Omaha6.3952,3211.25

Text Compression

Text compression seems natural for Huffman coding. In text, we have a discrete alphabet that, in a given class, has relatively stationary probabilities. For example, the probability model for a particular novel will not differ significantly from the probability model for another novel. Similarly, the probability model for a set of FORTRAN programs is not going to be much different than the probability model for a different set of FORTRAN programs. The probabilities in Table 3.26 are the probabilities of the 26 letters (upper- and lowercase) obtained for the U.S. Constitution and are representative of English text. The probabilities in Table 3.27 were obtained by counting the frequency of occurrences of letters in an earlier version of this chapter. While the two documents are substantially different, the two sets of probabilities are very much alike..

T A B L E 3 . 26

 LetterProbability LetterProbability
         
 A 0057305  N0.056035 
    
 B 0014876  O0.058215 
 C 0025775  P0.021034 
 D 0026811  Q0.000973 
 E 0112578  R0.048819 
 F 0022875  S0.060289 
 G 0009523  T0.078085 
 H 0042915  U0.018474 
 I 0053475  V0.009882 
 J 0002031  W0.007576 
 K 0001016  X0.002264 
 L 0031403  Y0.011702 
 M 0015892  Z0.001502 
     
 T A B L E 3 .27    
 
 LetterProbability LetterProbability
        
 A0049855  N0.048039 
    
 B0016100  O0.050642 
 C0025835  P0.015007 
 D0030232  Q0.001509 
 E0097434  R0.040492 
 F0019754  S0.042657 
 G0012053  T0.061142 
 H0035723  U0.015794 
 I0048783  V0.004988 
 J0000394  W0.012207 
 K0002450  X0.003413 
 L0025835  Y0.008466 
 M0016494  Z0.001050 
         

Text Compression

Text compression seems natural for Huffman coding. For example, the probability model for a particular novel will not differ significantly from the probability model for another novel. Similarly, the probability model for a set of FORTRAN programs is not going to be much different than the probability model for a different set of FORTRAN programs.

Audio Compression

Another class of data that is very suitable for compression is CD-quality audio data. The audio signal for each stereo channel is sampled at 44.1 kHz, and each sample is represented by 16 bits. This means that the amount of data stored on one CD is enormous. If we want to transmit this data, the amount of channel capacity required would be significant. Compression is definitely useful in this case. In Table 3.28 we show for a variety of audio material the file size, the entropy, the estimated compressed file size if a Huffman coder is used, and the resulting compression ratio.

Leave a Comment