DOC PREVIEW
U of I CS 414 - Basics of Compression (Part 2)

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2)AdministrativeOutlineHuffman EncodingHuffman Encoding (Example)Slide 6Slide 7Slide 8Huffman DecodingHuffman ExampleCharacteristics of SolutionExample Encoding/DecodingEntropy (Theoretical Limit)Average Codeword LengthCode Length Relative to EntropyExampleGroup ExerciseLimitationsArithmetic CodingArithmetic CodingSlide 21Slide 22Adaptive Encoding (Adaptive Huffman)Adaptive Huffman Coding ExampleHybrid Coding (Usage of RLE/Huffman, Arithmetic Coding)Picture PreparationOther Compression StepsAudio Compression and Formats (Hybrid Coding Schemes)Image Compression and FormatsVideo Compression and Formats (Hybrid Coding Schemes)SummarySolutionCS 414 - Spring 2011CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2)Klara NahrstedtSpring 2011CS 414 - Spring 2011Administrative MP1 is postedOutlineStatistical Entropy Coding Huffman codingArithmetic coding CS 414 - Spring 2011Huffman Encoding Statistical encodingTo determine Huffman code, it is useful to construct a binary treeLeaves are characters to be encodedNodes carry occurrence probabilities of the characters belonging to the sub-treeCS 414 - Spring 2011Huffman Encoding (Example)P(C) = 0.09 P(E) = 0.11P(D) = 0.13P(A)=0.16P(B) = 0.51Step 1 : Sort all Symbols according to their probabilities (left to right) from Smallest to largest these are the leaves of the Huffman treeCS 414 - Spring 2011Huffman Encoding (Example)P(C) = 0.09 P(E) = 0.11P(D) = 0.13P(A)=0.16P(B) = 0.51P(CE) = 0.20P(DA) = 0.29P(CEDA) = 0.49P(CEDAB) = 1Step 2: Build a binary tree from left toRight Policy: always connect two smaller nodes together (e.g., P(CE) and P(DA) had both Probabilities that were smaller than P(B),Hence those two did connect firstCS 414 - Spring 2011Huffman Encoding (Example)P(C) = 0.09 P(E) = 0.11P(D) = 0.13P(A)=0.16P(B) = 0.51P(CE) = 0.20P(DA) = 0.29P(CEDA) = 0.49P(CEDAB) = 10 10101Step 3: label left branches of the treeWith 0 and right branches of the treeWith 101CS 414 - Spring 2011Huffman Encoding (Example)P(C) = 0.09 P(E) = 0.11P(D) = 0.13P(A)=0.16P(B) = 0.51P(CE) = 0.20P(DA) = 0.29P(CEDA) = 0.49P(CEDAB) = 10 10101Step 4: Create Huffman CodeSymbol A = 011Symbol B = 1Symbol C = 000Symbol D = 010Symbol E = 0010 1CS 414 - Spring 2011Huffman DecodingAssume Huffman TableSymbol Code X 0 Y 10 Z 11Consider encoded bitstream: 000101011001110CS 414 - Spring 2011What is the decoded string?Huffman ExampleConstruct the Huffman coding tree (in class)Symbol (S) P(S)A 0.25B 0.30C 0.12D 0.15E 0.18Characteristics of Solution Symbol (S) CodeA 01B 11C 100D 101E 00CS 414 - Spring 2011Example Encoding/DecodingEncode “BEAD”110001101Decode “0101100”Symbol (S) CodeA 01B 11C 100D 101E 00CS 414 - Spring 2011Entropy (Theoretical Limit)= -.25 * log2 .25 + -.30 * log2 .30 + -.12 * log2 .12 + -.15 * log2 .15 + -.18 * log2 .18H = 2.24 bitsNiii spspH1)(log)( 2Symbol P(S) CodeA 0.25 01B 0.30 11C 0.12 100D 0.15 101E 0.18 00Average Codeword Length= .25(2) +.30(2) +.12(3) +.15(3) +.18(2)L = 2.27 bitsNiiiscodelengthspL1)()(Symbol P(S) CodeA 0.25 01B 0.30 11C 0.12 100D 0.15 101E 0.18 00Code Length Relative to EntropyHuffman reaches entropy limit when all probabilities are negative powers of 2i.e., 1/2; 1/4; 1/8; 1/16; etc.H <= Code Length <= H + 1Niii spspH1)(log)( 2NiiiscodelengthspL1)()(CS 414 - Spring 2011ExampleH = -.01*log2.01 + -.99*log2.99 = .08L = .01(1) +.99(1) = 1Symbol P(S) CodeA 0.01 1B 0.99 0CS 414 - Spring 2011Group ExerciseCompute Entropy (H)Build Huffman treeCompute averagecode lengthCode “BCCADE”Symbol (S) P(S)A 0.1B 0.2C 0.4D 0.2E 0.1CS 414 - Spring 2011LimitationsDiverges from lower limit when probability of a particular symbol becomes highalways uses an integral number of bitsMust send code book with the datalowers overall efficiencyMust determine frequency distributionmust remain stable over the data setCS 414 - Spring 2011Arithmetic Coding Optimal algorithm as Huffman coding wrt compression ratioBetter algorithm than Huffman wrt transmitted amount of information Huffman – needs to transmit Huffman tables with compressed dataArithmetic – needs to transmit length of encoded string with compressed dataCS 414 - Spring 2011Arithmetic CodingEach symbol is coded by considering the prior dataEncoded data must be read from the beginning, there is no random access possibleEach real number (< 1) is represented as binary fraction 0.5 = 2-1 (binary fraction = 0.1); 0.25 = 2-2 (binary fraction = 0.01), 0.625 = 0.5+0.125 (binary fraction = 0.101) ….CS 414 - Spring 2011CS 414 - Spring 2011CS 414 - Spring 2011Adaptive Encoding (Adaptive Huffman)Huffman code change according to usage of new words and new probabilities can be assigned to individual lettersIf Huffman tables adapt, they must be transmitted to receiver sideCS 414 - Spring 2011Adaptive Huffman Coding ExampleSymbol Code Original probabilities A 001 P(A) = 0.16B 1 P(B) = 0.51C 011 P( C) = 0.09D 000 P(D) = 0.13E 010 P(E) = 0.11Symbol Code New Probabilities (based on new word BACAAB)A 1 P(A) = 0.5B 01 P(B) = 1/3C 001 P(C ) = 1/6D 0000 P(D) = 0E 0001 P(E) = 0CS 414 - Spring 2011Hybrid Coding (Usage of RLE/Huffman, Arithmetic Coding) CS 414 - Spring 2011RLE, HuffmanArithmeticCodingPicture PreparationGeneration of appropriate digital representationImage division into 8x8 blocksFix number of bits per pixel (first level quantization – mapping from real numbers to bit representation)CS 414 - Spring 2011Other Compression Steps Picture processing (Source Coding)Transformation from time to frequency domain (e.g., use Discrete Cosine Transform)Motion vector computation in video Quantization Reduction of precision, e.g., cut least significant bitsQuantization matrix, quantization valuesEntropy Coding Huffman Coding + RLE CS 414 - Spring 2011Audio Compression and Formats (Hybrid Coding Schemes)MPEG-3 ADPCMu-LawReal AudioWindows Media (.wma)Sun (.au)Apple (.aif)Microsoft (.wav)CS 414 - Spring 2011Image Compression and FormatsRLEHuffmanLZWGIFJPEG / JPEG-2000 (Hybrid Coding)FractalsTIFF, PICT, BMP, etc.CS 414 - Spring 2011Video Compression and Formats (Hybrid Coding Schemes)H.261/H.263/H.264Cinepak (early 1992 Apple’s video codec in


View Full Document

U of I CS 414 - Basics of Compression (Part 2)

Documents in this Course
Lecture 1

Lecture 1

32 pages

LECTURE

LECTURE

30 pages

Load more
Download Basics of Compression (Part 2)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Basics of Compression (Part 2) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Basics of Compression (Part 2) 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?