1 / 43

Video Compression

Video Compression. MPEG: Motion Picture Expert Group Lossy compression of video First approximation: JPEG on each frame Added compression: remove inter-frame redundancy Frame types I frames: intrapicture P frames: predicted picture B frames: bidirectional predicted picture.

rowland
Download Presentation

Video Compression

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Video Compression • MPEG: Motion Picture Expert Group • Lossy compression of video • First approximation: JPEG on each frame • Added compression: remove inter-frame redundancy • Frame types • I frames: intrapicture • P frames: predicted picture • B frames: bidirectional predicted picture

  2. Motion Compensation

  3. Encoding

  4. Color frame ´ 16 16 macroblock ´ with Y component 16 16 pixel region ´ 8 8 macroblock with U component ´ 8 8 macroblock with V component Luminance

  5. Input Frame 1 Frame 2 Frame 3 Frame 4 Frame 5 Frame 6 Frame 7 stream MPEG compression Forward prediction Compressed I frame B frame B frame P frame B frame B frame I frame stream Bidirectional prediction Example • Example sequence transmitted as I P B B I B B

  6. B and P frames • coordinate for the macroblock in the frame • motion vector relative to previous reference frame • motion vector relative to subsequent reference frame (B only) • delta for each pixel in the macro block

  7. Effectiveness • typically 90-to-1 • as high as 150-to-1 • 30-to-1 for I frames • P & B frames get another 3 to 5x

  8. Frame at time N

  9. Frame at time N+1

  10. Error without motion compensation

  11. Error with motion compensation

  12. Coding Order

  13. SeqHdr Group of pictures SeqHdr Group of pictures SeqEndCode … GOPHdr Picture Picture Picture … PictureHdr Slice Slice Slice … SliceHdr Macroblock Macroblock Macroblock MBHdr Block(0) Block(1) Block(2) Block(3) Block(4) Block(5) MPEG Stream Format

  14. Example • Assume a 3x3 Macroblock after the DCT • Given the JPEG Quantization table • The Quantized frequency coefficients • DCT(1,0)=250 • 250/15+.5= 17.16=17 • RLE(42,5,17,2,0,0,0,0,0)=1-42,1-5,1-17,1-2,5-0 • Now do Huffman encoding with symbols 1,42,5,17,2, 0

  15. Huffman Encoding • Huffman encoding allows you to encode data with the minimal number of bits • We need to encode the RLE 1-42,1-5,1-17,1-2,5-0 • There are 10 occurrences of symbols • 1 occurs 4/10=40% of the time • 42 occurs 1/10=10% • 5 occurs 2/10=20% • 17 occurs 1/10=10% • 2 occurs 1/10=10% • 0 occurs 1/10=10%

  16. Algorithm • Given a alphabet A, construct a Huffman encoding tree T :• Create one node for each character of the alphabet A. • Let each node have a field containing its weight which is the probability of that letter appearing in a message. • Now repeatedly perform the following two steps :    1) pick two nodes n1 and n2 that have the smallest weights    2) and replace them with a new node whose children are n1 and n2 and whose weight is the sum of the weights of n1 and n2. Each time we perform this step will replace two nodes in the alphabet with one, until eventually only one single node remains; as this is the root of the tree T.

  17. Building Huffman Tree 1-42,1-5,1-17,1-2,5-0=1 0010 1 01 1 0011 1 0000 01 0001= 1001 0101 1001 1100 0001 0001=0x959c11 W=4 I5 0 1 1 W=6 I4 1 0 W=4 I3 5 0 1 I1 W=2 I2 W=2 0 0 1 1 2 0 42 17

  18. LZ encoding example Encode for characters a,b,c a b b c c a b a c a b b b a b a b a b b b b 1 2 2 3 3 4 1 8 5 2 9 13 12 2

  19. LZ decoding 1 2 2 3 3 4 1 8 5 2 9 13 12 2 a b b c c a b a c a b b b a b a b a b b b b

  20. PNG • The Portable Network Graphics (PNG) format was designed to replace the older and simpler GIF format and, to some extent, the much more complex TIFF format. • For the Web, PNG really has three main advantages over GIF: • alpha channels (variable transparency), • gamma correction (cross-platform control of image brightness), and • two-dimensional interlacing (a method of progressive display).

  21. PNG • For image editing, either professional or otherwise, PNG provides a useful format for the storage of intermediate stages of editing. Since PNG's compression is fully lossless--and since it supports up to 48-bit truecolor or 16-bit grayscale--saving, restoring and re-saving an image will not degrade its quality, unlike standard JPEG (even at its highest quality settings). • Most of all, PNG is not patented

  22. MP3 • MPis short for MPEG, or Motion Picture Experts Group, a widely accepted way to compress digital video and audio. • MP3is short for MPEG-1, audio layer 3. It is a subset of MPEG compression that can take a 20-megabyte, two-minute track on a music CD loaded into a PC's CD-ROM drive and reduce it to just a tad over 1.4 megabytes, about the size of a single floppy disk. Layer 3 quality is better than layer 2, but not as good as layer 4, which is coming soon and will provide full CD quality. MP3 was invented in 1991.

  23. Overview

  24. Details • The filter bank used in MPEG Layer-3 uses Discrete Cosine Transform • The perceptual model gives preference to frequencies we are more sensitive to •  Joint stereo coding takes advantage of the fact that both channels are frequently the same  • Quantization, larger values are automatically coded with less accuracy •  The quantized values are coded by Huffman coding.  

  25. Network Security Chapter 8

  26. Cryptography • Cryptography functions • Secret key (e.g., DES) • Public key (e.g., RSA) • Message digest (e.g., MD5) • Security services • Privacy: preventing unauthorized release of information • Authentication: verifying identity of the remote participant • Integrity: making sure message has not been altered

  27. Security Cryptography Security Algorithms Services Secret Public Message Privacy Authentication Message Key Key Digest Integrity (e.g., DES) (e.g., RSA) (e.g., MD5) Taxonomy

  28. plain text Initial Permutation Round 1 Round 2 56bit Key . . . plaintext plaintext Encrypt w/ Decrypt w/ Secret Key Secret Key Round 16 ciphertext Final Permutation Encryption Algorithms Private Key (DES) • 64-bit key (56-bits + 8-bit parity) • 16 rounds

  29. L R i -1 i 1 K F i + • Each round • Function F and generation of Ki for each round not shown • Repeat for larger messages L R i i

  30. Public Key (RSA) • Generate a public and private key • choose two large prime numbers p and q (each 256 bits) • multiply p and q together to get n (at most 512 bits) • chose the encryption key e, such that e and n are relatively prime e=(p-1) x (q-1). • two numbers are relatively prime if they have no common factor greater than one. • compute decryption key d such that d = e-1 mod(n) • construct public key as <e, n> • construct private key as <d, n> • discard (do not disclose) original primes p and q

  31. Multiplicative inverse • With n=7 • 4*2 mod 7 = 1 • 4 and 2 are multiplicative inverses mod 7

  32. Encryption & Decryption • c = me mod n • m = cd mod n=(me mod n)d mod n=medmod n • Since e and d are multiplicitive inverses = m plaintext plaintext Encrypt w/ Decrypt w/ Public Key Private Key ciphertext

  33. Breaking RSA • 1977 challenge to break 430-bit message with RSA-129 • Estimated 40 Quadrillion years to factor large composites • April 1994 broken with 5000 MIP-years of CPU • On Aug. 22, 1999, a group led by H. te Riele completed factorization of RSA-155, 35.7 CPU years= 8000MIP Years • Breakage can be easier if something is known about the key generation (time of day)

  34. Breaking DES • 1999 56-bit DES broken in 22 hours on network of machines

  35. Message Digest • Cryptographic checksum: • just as a regular checksum protects the receiver from accidental changes to the message, a cryptographic checksum protects the receiver from malicious changes to the message.

  36. One-way function: • given a cryptographic checksum for a message, it is virtually impossible to figure out what message produced that checksum; it is not computationally feasible to find two messages that hash to the same cryptographic checksum.

  37. Relevance: • if you are given a checksum for a message and you are able to compute exactly the same checksum for that message, then it is highly likely this message produced the checksum you were given.

  38. Speed • DES on 175MHz Alpha = 36Mbps • RSA = 1Kbps • MD5 = 80Mbps (as much as 10x DES) • In hardware DES=1Gbps, RSA=64Kbps

  39. Client Server ClientID, E(x, CHK) E(x+1, SHK), E(y, SHK) E(y+1, CHK) E(SK, SHK) Authentication Protocols • Three-way handshake

  40. Kerberos B S A • Trusted third party (Kerberos) A, B E((T,L,K,B),K ), A E((T,L,K,A),K ) B E((A,T),K), E(T,L,K,A),K ) B E(T+1,K)

  41. Public key authentication A B E(x, Public ) B x

  42. Message Integrity Protocols • Digital signature using RSA • special case of a message integrity where the code can only have been generated by one participant • compute signature with private key and verify with public key

  43. Keyed MD5 • sender m + MD5(m + k) + E(k, private) • receiver • recovers random key using the sender's public key • applies MD5 to the concatenation of this random key message • compares result with checksum sent with message

More Related