Statistical Encoding Use set of code words to transmit source information. 7/8 bits ASCII code
Two steps identifying most frequent bit or byte patterns in data coding these patterns with fewer bits than initially represented
11000100110
=> eaace
Source Encoding
Differential encoding (predictive encoding)
Used extensively in applications where the amplitude of a value or signal covers a large range but the difference in amplitude between successive values/signal is relatively small. Can be a lossless or lossy Lossless - if the number of bits used is sufficient to cater for the maximum difference value then it is lossless.
Lossy - when the difference value exceeds the maximum numbe of bits being used.
Frequency components
scan the matrix in either the horizontal or the vertical direction, give rise to a term horizontal and vertical frequency components.
Text Compression
Three different types of text Unformatted Formatted
Hypertext
Any compression algorithm associated with text must be lossless since the
loss of just a single character could modify the meaning of a complete string.
Static Huffman Coding Dynamic Huffman Coding
Text Compression(contd)
Static Huffman Coding
Static Huffman coding assigns variable length codes to symbols based on their frequency of occurrences in the given message. Low frequency symbols are encoded using many bits, and high frequency symbols are encoded using fewer bits.
The message to be transmitted is first analyzed to find the relative frequencies of its constituent characters.
The coding process generates a binary tree, the Huffman code tree, with branches labeled with bits (0 and 1).
The Huffman tree (or the character codeword pairs) must be sent with the compressed information to enable the receiver decode the message.
a 45
e 65
l 13
n 45
o 18
s 22
t 53
Use Huffman technique to answer the following questions: Build the Huffman code tree for the message. Use the Huffman tree to find the codeword for each character. If the data consists of only these characters, what is the total number of bits to be transmitted? What is the compression ratio? Verify that your computed Huffman codewords satisfy the Prefix property.
The sequence of zeros and ones that are the arcs in the path from the root to each leaf node are the desired codes:
character Huffman codeword a 110 e 10 l 0110 n 111 o 0111 s 010 t 00
If the message is sent uncompressed with 8-bit ASCII representation for the characters, we have 261(addition of all frequencies)*8 = 2088 bits.
Number of bits for the transmitted file = bits(7) + bits(characters) + bits(codewords) + bits(compressed message) = 3 + (7*8) + 21 + 696 = 776 Compression ratio = bits for ASCII representation / number of bits transmitted = 2088 / 776 = 2.69
Decode a bit-stream by starting at the root and proceeding down the tree according to the bits in the message (0 = left, 1 = right). When a leaf is encountered, output the character at that leaf and restart at the root .If a leaf cannot be reached, the bitstream cannot be decoded.
(b) 11101110101011
The decoding fails because the corresponding node for 11 is not a leaf
Image Compression
Types of images:
Computer generated images(Graphical Images) represented in the form of computer program, hence require less memory space.
If the color is present in the table then add that index value of that color into the color table after 256 colors.
So, the number of entries in the table is allowed to increase incrementally by extending the length of the index by 1 bit. GIF allows an image to be stored and transfer over the network in an interlaced mode. With this mode, organize data in such a way so that the decompressed image is build up in progressive way as the data arrives.
3)
4)