Docsity

Image and Video Compression: Understanding Block Transform Coding, Algorithms, and CODECs, Slides of Electronics engineering

Partial preview of the text

Download Image and Video Compression: Understanding Block Transform Coding, Algorithms, and CODECs and more Slides Electronics engineering in PDF only on Docsity!

Image/Video Compression

Outline

• Background

• Block Transform Coding

• Other Coding Algorithms

• Software/Hardware CODEC’s

• Pragmatic Issues

Video Bit Rate Calculation

width ∼ pixels (160, 320, 640, 720, 1280, 1920, …)

height ∼ pixels (120, 240, 480, 485, 720, 1080, …)

depth ∼ bits (1, 4, 8, 15, 16, 24, …)

fps ∼ frames per second (5, 15, 20, 24, 30, …)

compression factor (1, 6, 24, …)

width * height * depth * fps

compression factor

= bits/sec

Effects of Compression

storage for 1 hour of compressed video in megabytes

1920x1080 1280x720 640x480 320x240 160x 1:1 671,846 298,598 99,533 24,883 6, 3:1 223,949 99,533 33,178 8,294 2, 6:1 111,974 49,766 16,589 4,147 1, 25:1 26,874 11,944 3,981 995 249 100:1 6,718 2,986 995 249 62

3 bytes/pixel, 30 frames/sec

Another View

Data Rate Size/Hour

  • 128 Kbs 60 MB
  • 384 Kbs 170 MB
  • 1.5 Mbs 680 MB
  • 3.0 Mbs 1.4 GB
  • 6.0 Mbs 2.7 GB
  • 25 Mbs 11.0 GB

Perceptual Coding

  • Encode source signal using lossy compression
    • Lossless algorithms typically reduce signal by 3:
    • Must use lossy algorithm to get adequate compression
  • Hide errors where humans will not see or hear it
    • Study hearing and vision system to understand how we see/hear
    • Masking refers to one signal overwhelming/hiding another (e.g., loud siren or bright flash)
    • Audio perception is 20-20 kHz but most sounds in low frequencies (e.g., 2 kHz to 4 kHz)
    • Visual perception influenced by edges and low frequencies

Coding Overview

• Digitize

  • Subsample to reduce data

• Intraframe compression

  • Remove redundancy within frame (spatial

compression)

• Interframe compression

  • Remove redundancy between frames

(temporal compression)

• Symbol coding

  • Efficient coding of sequence of symbols

Digitizing

• Modify color space

  • 24 bit RGB => 15 or 16 bit RGB
  • 24 bit RGB => YUV (8 bit Y, 4 bit U, 4 bit V)
  • 24 bit RGB => 8 bit color map

• Encode only 1 field

• Reduce frame rate

  • Film is 24 fps so why encode 30 frames of

video

  • Is 20 fps good enough? 18? 15? 12? 8? 4? ...
  • Variable frame rate?

Block Encoding

139 144 149 153 144 151 153 156 150 155 160 163 159 161 162 160 original image

DCT

1260 -1 -12 - -23 -17 -6 - -11 -9 -2 2 -7 -2 0 1

DC component

AC components

Quantize

79 0 -1 0 -2 -1 0 0 -1 -1 0 0 0 0 0 0

79 0 -2 -1 -1 -1 0 0 -1 (^0 0 0 0 0 0 0) zigzag

run-length code

0 79 1 - 0 - 0 - 0 - 2 - 0 0

Huffman code 10011011100011...

coded bitstream < 10 bits (0.55 bits/pixel)

Result of Coding/Decoding

139 144 149 153 144 151 153 156 150 155 160 163 159 161 162 160

144 146 149 152 156 150 152 154 155 156 157 158 160 161 161 162

original block reconstructed block

-5 -2 0 1 -4 1 1 2 -5 -1 3 5 -1 0 1 -

errors

Discrete Cosine Transform

F[u,v] =

4C(u)C(v)

n^2

n-1 n-

j=0 k=

f(j,k) cos

(2j+1)uπ

2n

(2k+1)vπ 2n

cos

where

C(w) =

for w=

for w=1,2,…,n-

  • Inverse is very similar
  • DCT better at reducing redundancy than Discrete Fourier Transform but computationally expensive

DCT vs DFT

original signal

• •^

recovered from DCT

recovered from DFT

Background

• JPEG still image (1 bpp)

  • Symmetric codec

• MPEG

  • Interleaved audio and video
  • Low cost decoder at expense of high cost

encoder (asymmetric)

• H.26x

  • Video conferencing standard (QCIF, CIF, 4CIF,

and 16CIF)

  • Variable bit rates and coding flexibility

MPEG Standards

• MPEG1 - vhs quality (1992)

  • CIF images, 4:2:0 sampling, 1.5 Mbs
  • Frame encoding

• MPEG2 - broadcast quality (1994)

  • CCIR 601 images, 4:2:2 sampling, 15 Mbs
  • Interlaced and progressive scanning
  • Frame and field encoding