Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Medical Image Compression by Paramjeet Singh J... 1357 views
- Image compression by ezw combining ... by IAEME Publication 719 views
- An approach for color image compres... by IAEME Publication 299 views
- An Introduction to Tele - medicine:... by Vijay Sardana 1263 views
- Lossless Compression by Puchpa Oks 898 views
- Computer notes - Huffman Encoding by ecomputernotes 1873 views

No Downloads

Total views

2,607

On SlideShare

0

From Embeds

0

Number of Embeds

66

Shares

0

Downloads

189

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Lossless Compression CIS 658 Multimedia Computing
- 2. Compression <ul><li>Compression : the process of coding that will effectively reduce the total number of bits needed to represent certain information. </li></ul>
- 3. Compression <ul><li>There are two main categories </li></ul><ul><ul><li>Lossless </li></ul></ul><ul><ul><li>Lossy </li></ul></ul><ul><li>Compression ratio: </li></ul>
- 4. Information Theory <ul><li>We define the entropy of an information source with alphabet S = { s 1 , s 2 , …, s n } as </li></ul><ul><li>p i - probability that s i occurs in the source and log 2 1/ p i is amount of information in s i </li></ul>
- 5. Information Theory <ul><li>Figure (a) has a maximum entropy of 256 (1/256 log 2 256) = 8. </li></ul><ul><li>Any other distribution has lower entropy </li></ul>
- 6. Entropy and Code Length <ul><li>The entropy gives a lower bound on the average number of bits needed to code a symbol in the alphabet </li></ul><ul><ul><li> l where l is the average bit length of the code words produced by the encoder assuming a memoryless source </li></ul></ul>
- 7. Run-Length Coding <ul><li>Run-length coding is a very widely used and simple compression technique which does not assume a memoryless source </li></ul><ul><ul><li>We replace runs of symbols (possibly of length one) with pairs of ( run-length, symbol ) </li></ul></ul><ul><ul><li>For images, the maximum run-length is the size of a row </li></ul></ul>
- 8. Variable Length Coding <ul><li>A number of compression techniques are based on the entropy ideas seen previously. </li></ul><ul><li>These are known as entropy coding or variable length coding </li></ul><ul><ul><li>The number of bits used to code symbols in the alphabet is variable </li></ul></ul><ul><ul><li>Two famous entropy coding techniques are Huffman coding and Arithmetic coding </li></ul></ul>
- 9. Huffman Coding <ul><li>Huffman coding constructs a binary tree starting with the probabilities of each symbol in the alphabet </li></ul><ul><ul><li>The tree is built in a bottom-up manner </li></ul></ul><ul><ul><li>The tree is then used to find the codeword for each symbol </li></ul></ul><ul><ul><li>An algorithm for finding the Huffman code for a given alphabet with associated probabilities is given in the following slide </li></ul></ul>
- 10. Huffman Coding Algorithm <ul><li>Initialization: Put all symbols on a list sorted according to their frequency counts. </li></ul><ul><li>Repeat until the list has only one symbol left: </li></ul><ul><ul><li>a. From the list pick two symbols with the lowest frequency counts. Form a Huffman subtree that has these two symbols as child nodes and create a parent node. </li></ul></ul>
- 11. Huffman Coding Algorithm <ul><ul><li>b. Assign the sum of the children's frequency counts to the parent and insert it into the list such that the order is maintained. </li></ul></ul><ul><ul><li>c. Delete the children from the list. </li></ul></ul><ul><li>3. Assign a codeword for each leaf based on the path from the root. </li></ul>
- 12. Huffman Coding Algorithm
- 13. Huffman Coding Algorithm
- 14. Properties of Huffman Codes <ul><li>No Huffman code is the prefix of any other Huffman codes so decoding is unambiguous </li></ul><ul><li>The Huffman coding technique is optimal (but we must know the probabilities of each symbol for this to be true) </li></ul><ul><li>Symbols that occur more frequently have shorter Huffman codes </li></ul>
- 15. Huffman Coding <ul><li>Variants: </li></ul><ul><ul><li>In extended Huffman coding we group the symbols into k symbols giving an extended alphabet of n k symbols </li></ul></ul><ul><ul><ul><li>This leads to somewhat better compression </li></ul></ul></ul><ul><ul><li>In adaptive Huffman coding we don’t assume that we know the exact probabilities </li></ul></ul><ul><ul><ul><li>Start with an estimate and update the tree as we encode/decode </li></ul></ul></ul><ul><li>Arithmetic Coding is a newer (and more complicated) alternative which usually performs better </li></ul>
- 16. Dictionary-based Coding <ul><li>LZW uses fixed-length codewords to represent variable-length strings of symbols/characters that commonly occur together, e.g., words in English text. </li></ul><ul><li>The LZW encoder and decoder build up the same dictionary dynamically while receiving the data. </li></ul><ul><li>LZW places longer and longer repeated entries into a dictionary, and then emits the code for an element, rather than the string itself, if the element has already been placed in the dictionary. </li></ul>
- 17. LZW Compression Algorithm
- 18. LZW Compression Example <ul><li>We will compress the string </li></ul><ul><ul><li>"ABABBABCABABBA" </li></ul></ul><ul><li>Initially the dictionary is the following </li></ul>
- 19. LZW Example Code String 1 a 2 b 2 c
- 20. LZW Example
- 21. LZW Decompression
- 22. LZW Decompression Example
- 23. Quadtrees <ul><li>Quadtrees are both an indexing structure for and compression scheme for binary images </li></ul><ul><ul><li>A quadtree is a tree where each non-leaf node has four children </li></ul></ul><ul><ul><li>Each node is labelled either B (black), W (white) or G (gray) </li></ul></ul><ul><ul><li>Leaf nodes can only be B or W </li></ul></ul>
- 24. Quadtrees <ul><li>Algorithm for construction of a quadtree for an N N binary image: </li></ul><ul><ul><li>1. If the binary images contains only black pixels, label the root node B and quit. </li></ul></ul><ul><ul><li>2. Else if the binary image contains only white pixels, label the root node W and quit. </li></ul></ul><ul><ul><li>3. Otherwise create four child nodes corresponding to the 4 N/4 N/4 quadrants of the binary image. </li></ul></ul><ul><ul><li>4. For each of the quadrants, recursively repeat steps 1 to 3. (In worst case, recursion ends when each sub-quadrant is a single pixel). </li></ul></ul>
- 25. Quadtree Example
- 26. Quadtree Example
- 27. Quadtree Example
- 29. Lossless JPEG <ul><li>JPEG offers both lossy (common) and lossless (uncommon) modes. </li></ul><ul><li>Lossless mode is much different than lossy (and also gives much worse results) </li></ul><ul><ul><li>Added to JPEG standard for completeness </li></ul></ul>
- 30. Lossless JPEG <ul><li>Lossless JPEG employs a predictive method combined with entropy coding. </li></ul><ul><li>The prediction for the value of a pixel (greyscale or color component) is based on the value of up to three neighboring pixels </li></ul>
- 31. Lossless JPEG <ul><li>One of 7 predictors is used (choose the one which gives the best result for this pixel). </li></ul>
- 32. Lossless JPEG <ul><li>Now code the pixel as the pair (predictor-used, difference from predicted method) </li></ul><ul><li>Code this pair using a lossless method such as Huffman coding </li></ul><ul><ul><li>The difference is usually small so entropy coding gives good results </li></ul></ul><ul><ul><li>Can only use a limited number of methods on the edges of the image </li></ul></ul>

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment