SlideShare a Scribd company logo
CMPT365 Multimedia Systems 1
Media Compression
- Image
Spring 2015
CMPT 365 Multimedia Systems
CMPT365 Multimedia Systems 2
Facts about JPEG
 JPEG - Joint Photographic Experts Group
 International standard: 1992
 Most popular format
 Other formats (.bmp) use similar techniques
 Lossy image compression
 transform coding using the DCT
 JPEG 2000
 New generation of JPEG – well, never succeeds
 DWT (Discrete Wavelet Transform)
CMPT365 Multimedia Systems 3
Three Major Observations
 Observation 1:
 Useful image contents change relatively slowly across the
image, i.e., it is unusual for intensity values to vary widely
several times in a small area, for example, within an 8x8
image block.
- much of the information in an image is repeated,
hence “spatial redundancy".
Compression Ratio: 7.7 Compression Ratio: 33.9
CMPT365 Multimedia Systems 4
Observations
 Observation 2:
 Psychophysical experiments suggest that humans are
much less likely to notice the loss of very high spatial
frequency components than the loss of lower frequency
components.
- the spatial redundancy can be reduced by largely
reducing the high spatial frequency contents.
Compression Ratio: 7.7 Compression Ratio: 33.9
CMPT365 Multimedia Systems 5
Observations
 Observation 3:
 Visual acuity (accuracy in distinguishing closely spaced
lines) is much greater for gray (black and white) than for
color.
- chroma subsampling (4:2:0) is used in JPEG.
CMPT365 Multimedia Systems 6
8x8 DCT Example
Original values of an 8x8 block
(in spatial domain)
Corresponding DCT coefficients
coefficients
(in frequency domain)
(in frequency domain)
DC Component
or u
o
r
v
CMPT365 Multimedia Systems 7
JPEG Steps
1 Block Preparation
- RGB to YUV (YIQ) planes
2 Transform
- 2D Discrete Cosine Transform (DCT) on 8x8 blocks.
3 Quantization
- Quantized DCT Coefficients (lossy).
4 Encoding of Quantized Coefficients
Zigzag Scan
Differential Pulse Code Modulation (DPCM) on DC component
Run Length Encoding (RLE) on AC Components
Entropy Coding: Huffman or Arithmetic
CMPT365 Multimedia Systems 8
JPEG Diagram
CMPT365 Multimedia Systems 9
RGB Input Data
RGB Input Data After Block Preparation
After Block Preparation
JPEG: Block Preparation
Input image: 640 x 480 RGB (24 bits/pixel) transformed to three planes:
Y: (640 x 480, 8-bit/pixel) Luminance (brightness) plane.
U, V: (320 X 240 8-bits/pixel) Chrominance (color) planes.
CMPT365 Multimedia Systems 10
Block Effect
 Using blocks, however, has the effect of isolating
each block from its neighboring context.
 choppy (“blocky") with high compression ratio
Compression Ratio: 60.1
Compression Ratio: 7.7 Compression Ratio: 33.9
CMPT365 Multimedia Systems 11
JPEG: Quantized
DCT Coefficients
Uniform quantization:
Divide by constant N and round result.
In JPEG, each DCT F[u,v] is divided by
a constant q(u,v).
The table of q(u,v) is called quantization table.
q(u,v)
F[u,v]
Rounded
F[u,v]/ Q(u,v)
CMPT365 Multimedia Systems 12
More about Quantization
 Quantization is the main source for loss
 Q(u, v) of larger values towards lower right corner
• More loss at the higher spatial frequencies
• Supported by Observations 1 and 2.
 Q(u,v) obtained from psychophysical studies
• maximizing the compression ratio while minimizing
perceptual losses
CMPT365 Multimedia Systems 13
CMPT365 Multimedia Systems 14
JPEG: Encoding of Quantized
DCT Coefficients
 DC Components (zero frequency)
 DC component of a block is large and varied, but often close
to the DC value of the previous block.
 Encode the difference from previous
• Differential Pulse Code Modulation (DPCM).
 AC components:
 Lots of zeros (or close to zero)
 Run Length Encoding (RLE, or RLC)
• encode as (skip, value) pairs
• Skip: number of zeros, value: next non-zero component
 (0,0) as end-of-block value.
CMPT365 Multimedia Systems 15
JPEG: Zigzag Scan
Maps an 8x8 block into a 1 x 64 vector
Zigzag pattern group low frequency coefficients in top of vector.
CMPT365 Multimedia Systems 16
Recall: 2-D DCT Basis Matrices
For 2-point DCT For 4-point DCT
CMPT365 Multimedia Systems 17
Recall: 2-D DCT Basis Matrices: 8-point DCT
CMPT365 Multimedia Systems 18
Why ZigZag Scan
 RLC aims to turn the block values into sets
<#-zeros-to-skip , next non-zero value>.
 ZigZag scan is more effective
CMPT365 Multimedia Systems 19
Runlength Encoding (RLE)
 Further compression: statistical (entropy) coding
A typical 8x8 block of quantized DCT coefficients.
Most of the higher order coefficients have been quantized to 0.
12 34 0 54 0 0 0 0
87 0 0 12 3 0 0 0
16 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Zig-zag scan: the sequence of DCT coefficients to be transmitted:
12 34 87 16 0 0 54 0 0 0 0 0 0 12 0 0 3 0 0 0 .....
DC coefficient (12) is sent via a separate Huffman table.
Runlength coding remaining coefficients:
34 | 87 | 16 | 0 0 54 | 0 0 0 0 0 0 12 | 0 0 3 | 0 0 0 .....
CMPT365 Multimedia Systems 20
Entropy Coding
 Huffman/arithmetic coding
 Lossless
CMPT365 Multimedia Systems 21
JPEG Modes
 Sequential Mode
 default JPEG mode, implicitly assumed in the discussions
so far. Each graylevel image or color image component is
encoded in a single left-to-right, top-to-bottom scan.
 Progressive Mode.
 Hierarchical Mode.
 Lossless Mode
CMPT365 Multimedia Systems 22
Progressive Mode
 Progressive
 Delivers low quality versions of the image quickly, followed by
higher quality passes.
 Method 1. Spectral selection
- higher AC components provide detail texture information
 Scan 1: Encode DC and first few AC components, e.g., AC1, AC2.
 Scan 2: Encode a few more AC components, e.g., AC3, AC4, AC5.
 ...
 Scan k: Encode the last few ACs, e.g., AC61, AC62, AC63.
CMPT365 Multimedia Systems 23
Progressive Mode cont’d
 Method 2: Successive approximation:
- Instead of gradually encoding spectral bands, all DCT
coefficients are encoded simultaneously but with their
most significant bits (MSBs) first
 Scan 1: Encode the rst few MSBs, e.g., Bits 7, 6, 5, 4.
 Scan 2: Encode a few more less signicant bits, e.g., Bit 3.
 ...
 Scan m: Encode the least signicant bit (LSB), Bit 0.
CMPT365 Multimedia Systems 24
Hierarchical Mode
 Encoding
 First, lowest resolution picture (using low-pass filter)
 Then, successively higher resolutions
• additional details (encoding differences)
 Transmission:
 transmitted in multiple passes
 progressively improving quality
 Similar to Progressive JPEG
CMPT365 Multimedia Systems 25
Lossless Mode
 Using prediction and entropy coding
 Forming a differential prediction:
 A predictor combines the values of up to three
neighboring pixels as the predicted value for the current
pixel
 Seven schemes for combination
 Encoding:
 The encoder compares the prediction with the actual
pixel value at the position `X' and encodes the
difference using entropy coding
CMPT365 Multimedia Systems 26
7 Predictors
CMPT365 Multimedia Systems 27
Comparison with Other Lossless
CMPT365 Multimedia Systems 28
JPEG Bitstream
CMPT365 Multimedia Systems 29
JPEG 2000
 JPEG 1992
 JPEG 2000
 .jp2 for ISO/IEC 15444-1
 .jpx for extended part-2 specifications (ISO/IEC
15444-2)
 Wavelet transform based
 20% gain in compression
CMPT365 Multimedia Systems 30
JPEG 2000 vs JPEG
 Original image
CMPT365 Multimedia Systems 31
JPEG2000 vs JPEG
CMPT365 Multimedia Systems 32
Further Exploration
 Textbook Chapter 9
 Other sources
 The JPEG Still Image Compression Standard by
Pennebaker and Mitchell
 JPEG2000: Image Compression Fundamentals, Standards,
and Practice by Taubman and Marcellin
 Image and Video Compression Standards: Algorithms and
Architectures, 2nd ed. by Bhaskaren and Konstantinides

More Related Content

PDF
Comparison of different Fingerprint Compression Techniques
PPTX
Image compression and it’s security1
PPT
image processing for jpeg presentati.ppt
PDF
Kassem2009
PDF
CyberSec_JPEGcompressionForensics.pdf
PDF
Digital Image Processing - Image Compression
PDF
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
PDF
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
Comparison of different Fingerprint Compression Techniques
Image compression and it’s security1
image processing for jpeg presentati.ppt
Kassem2009
CyberSec_JPEGcompressionForensics.pdf
Digital Image Processing - Image Compression
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...

Similar to Image Compression Digital Image processing (20)

PPTX
Data compression
PPT
notes_Image Compression_edited.ppt
PDF
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
PDF
Squashed JPEG Image Compression via Sparse Matrix
PDF
Squashed JPEG Image Compression via Sparse Matrix
PPT
Multimedia image compression standards
PDF
CMOS Image Sensor Design_h20_10_jpeg.pdf
PDF
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
PPTX
JPEG and MPEG Compression in Digital Image Processing.pptx
PPT
Compression
PPT
Jpeg and mpeg ppt
PDF
Steganography Part 2
PDF
PERFORMANCE EVALUATION OF JPEG IMAGE COMPRESSION USING SYMBOL REDUCTION TECHN...
PPTX
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
PDF
Paralleling Variable Block Size Motion Estimation of HEVC On CPU plus GPU Pla...
PDF
Compression: Images (JPEG)
PPTX
Image compression and jpeg
PDF
Video Compression Basics
PPT
Next generation image compression standards: JPEG XR and AIC
PPTX
JPEG Image Compression
Data compression
notes_Image Compression_edited.ppt
SQUASHED JPEG IMAGE COMPRESSION VIA SPARSE MATRIX
Squashed JPEG Image Compression via Sparse Matrix
Squashed JPEG Image Compression via Sparse Matrix
Multimedia image compression standards
CMOS Image Sensor Design_h20_10_jpeg.pdf
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
JPEG and MPEG Compression in Digital Image Processing.pptx
Compression
Jpeg and mpeg ppt
Steganography Part 2
PERFORMANCE EVALUATION OF JPEG IMAGE COMPRESSION USING SYMBOL REDUCTION TECHN...
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Paralleling Variable Block Size Motion Estimation of HEVC On CPU plus GPU Pla...
Compression: Images (JPEG)
Image compression and jpeg
Video Compression Basics
Next generation image compression standards: JPEG XR and AIC
JPEG Image Compression
Ad

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Well-logging-methods_new................
PPTX
Welding lecture in detail for understanding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT
Project quality management in manufacturing
PDF
Digital Logic Computer Design lecture notes
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
573137875-Attendance-Management-System-original
PPTX
Geodesy 1.pptx...............................................
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Sustainable Sites - Green Building Construction
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
Mechanical Engineering MATERIALS Selection
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Well-logging-methods_new................
Welding lecture in detail for understanding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Lecture Notes Electrical Wiring System Components
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Project quality management in manufacturing
Digital Logic Computer Design lecture notes
Strings in CPP - Strings in C++ are sequences of characters used to store and...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
573137875-Attendance-Management-System-original
Geodesy 1.pptx...............................................
Lesson 3_Tessellation.pptx finite Mathematics
Sustainable Sites - Green Building Construction
Arduino robotics embedded978-1-4302-3184-4.pdf
Ad

Image Compression Digital Image processing

  • 1. CMPT365 Multimedia Systems 1 Media Compression - Image Spring 2015 CMPT 365 Multimedia Systems
  • 2. CMPT365 Multimedia Systems 2 Facts about JPEG  JPEG - Joint Photographic Experts Group  International standard: 1992  Most popular format  Other formats (.bmp) use similar techniques  Lossy image compression  transform coding using the DCT  JPEG 2000  New generation of JPEG – well, never succeeds  DWT (Discrete Wavelet Transform)
  • 3. CMPT365 Multimedia Systems 3 Three Major Observations  Observation 1:  Useful image contents change relatively slowly across the image, i.e., it is unusual for intensity values to vary widely several times in a small area, for example, within an 8x8 image block. - much of the information in an image is repeated, hence “spatial redundancy". Compression Ratio: 7.7 Compression Ratio: 33.9
  • 4. CMPT365 Multimedia Systems 4 Observations  Observation 2:  Psychophysical experiments suggest that humans are much less likely to notice the loss of very high spatial frequency components than the loss of lower frequency components. - the spatial redundancy can be reduced by largely reducing the high spatial frequency contents. Compression Ratio: 7.7 Compression Ratio: 33.9
  • 5. CMPT365 Multimedia Systems 5 Observations  Observation 3:  Visual acuity (accuracy in distinguishing closely spaced lines) is much greater for gray (black and white) than for color. - chroma subsampling (4:2:0) is used in JPEG.
  • 6. CMPT365 Multimedia Systems 6 8x8 DCT Example Original values of an 8x8 block (in spatial domain) Corresponding DCT coefficients coefficients (in frequency domain) (in frequency domain) DC Component or u o r v
  • 7. CMPT365 Multimedia Systems 7 JPEG Steps 1 Block Preparation - RGB to YUV (YIQ) planes 2 Transform - 2D Discrete Cosine Transform (DCT) on 8x8 blocks. 3 Quantization - Quantized DCT Coefficients (lossy). 4 Encoding of Quantized Coefficients Zigzag Scan Differential Pulse Code Modulation (DPCM) on DC component Run Length Encoding (RLE) on AC Components Entropy Coding: Huffman or Arithmetic
  • 8. CMPT365 Multimedia Systems 8 JPEG Diagram
  • 9. CMPT365 Multimedia Systems 9 RGB Input Data RGB Input Data After Block Preparation After Block Preparation JPEG: Block Preparation Input image: 640 x 480 RGB (24 bits/pixel) transformed to three planes: Y: (640 x 480, 8-bit/pixel) Luminance (brightness) plane. U, V: (320 X 240 8-bits/pixel) Chrominance (color) planes.
  • 10. CMPT365 Multimedia Systems 10 Block Effect  Using blocks, however, has the effect of isolating each block from its neighboring context.  choppy (“blocky") with high compression ratio Compression Ratio: 60.1 Compression Ratio: 7.7 Compression Ratio: 33.9
  • 11. CMPT365 Multimedia Systems 11 JPEG: Quantized DCT Coefficients Uniform quantization: Divide by constant N and round result. In JPEG, each DCT F[u,v] is divided by a constant q(u,v). The table of q(u,v) is called quantization table. q(u,v) F[u,v] Rounded F[u,v]/ Q(u,v)
  • 12. CMPT365 Multimedia Systems 12 More about Quantization  Quantization is the main source for loss  Q(u, v) of larger values towards lower right corner • More loss at the higher spatial frequencies • Supported by Observations 1 and 2.  Q(u,v) obtained from psychophysical studies • maximizing the compression ratio while minimizing perceptual losses
  • 14. CMPT365 Multimedia Systems 14 JPEG: Encoding of Quantized DCT Coefficients  DC Components (zero frequency)  DC component of a block is large and varied, but often close to the DC value of the previous block.  Encode the difference from previous • Differential Pulse Code Modulation (DPCM).  AC components:  Lots of zeros (or close to zero)  Run Length Encoding (RLE, or RLC) • encode as (skip, value) pairs • Skip: number of zeros, value: next non-zero component  (0,0) as end-of-block value.
  • 15. CMPT365 Multimedia Systems 15 JPEG: Zigzag Scan Maps an 8x8 block into a 1 x 64 vector Zigzag pattern group low frequency coefficients in top of vector.
  • 16. CMPT365 Multimedia Systems 16 Recall: 2-D DCT Basis Matrices For 2-point DCT For 4-point DCT
  • 17. CMPT365 Multimedia Systems 17 Recall: 2-D DCT Basis Matrices: 8-point DCT
  • 18. CMPT365 Multimedia Systems 18 Why ZigZag Scan  RLC aims to turn the block values into sets <#-zeros-to-skip , next non-zero value>.  ZigZag scan is more effective
  • 19. CMPT365 Multimedia Systems 19 Runlength Encoding (RLE)  Further compression: statistical (entropy) coding A typical 8x8 block of quantized DCT coefficients. Most of the higher order coefficients have been quantized to 0. 12 34 0 54 0 0 0 0 87 0 0 12 3 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Zig-zag scan: the sequence of DCT coefficients to be transmitted: 12 34 87 16 0 0 54 0 0 0 0 0 0 12 0 0 3 0 0 0 ..... DC coefficient (12) is sent via a separate Huffman table. Runlength coding remaining coefficients: 34 | 87 | 16 | 0 0 54 | 0 0 0 0 0 0 12 | 0 0 3 | 0 0 0 .....
  • 20. CMPT365 Multimedia Systems 20 Entropy Coding  Huffman/arithmetic coding  Lossless
  • 21. CMPT365 Multimedia Systems 21 JPEG Modes  Sequential Mode  default JPEG mode, implicitly assumed in the discussions so far. Each graylevel image or color image component is encoded in a single left-to-right, top-to-bottom scan.  Progressive Mode.  Hierarchical Mode.  Lossless Mode
  • 22. CMPT365 Multimedia Systems 22 Progressive Mode  Progressive  Delivers low quality versions of the image quickly, followed by higher quality passes.  Method 1. Spectral selection - higher AC components provide detail texture information  Scan 1: Encode DC and first few AC components, e.g., AC1, AC2.  Scan 2: Encode a few more AC components, e.g., AC3, AC4, AC5.  ...  Scan k: Encode the last few ACs, e.g., AC61, AC62, AC63.
  • 23. CMPT365 Multimedia Systems 23 Progressive Mode cont’d  Method 2: Successive approximation: - Instead of gradually encoding spectral bands, all DCT coefficients are encoded simultaneously but with their most significant bits (MSBs) first  Scan 1: Encode the rst few MSBs, e.g., Bits 7, 6, 5, 4.  Scan 2: Encode a few more less signicant bits, e.g., Bit 3.  ...  Scan m: Encode the least signicant bit (LSB), Bit 0.
  • 24. CMPT365 Multimedia Systems 24 Hierarchical Mode  Encoding  First, lowest resolution picture (using low-pass filter)  Then, successively higher resolutions • additional details (encoding differences)  Transmission:  transmitted in multiple passes  progressively improving quality  Similar to Progressive JPEG
  • 25. CMPT365 Multimedia Systems 25 Lossless Mode  Using prediction and entropy coding  Forming a differential prediction:  A predictor combines the values of up to three neighboring pixels as the predicted value for the current pixel  Seven schemes for combination  Encoding:  The encoder compares the prediction with the actual pixel value at the position `X' and encodes the difference using entropy coding
  • 26. CMPT365 Multimedia Systems 26 7 Predictors
  • 27. CMPT365 Multimedia Systems 27 Comparison with Other Lossless
  • 28. CMPT365 Multimedia Systems 28 JPEG Bitstream
  • 29. CMPT365 Multimedia Systems 29 JPEG 2000  JPEG 1992  JPEG 2000  .jp2 for ISO/IEC 15444-1  .jpx for extended part-2 specifications (ISO/IEC 15444-2)  Wavelet transform based  20% gain in compression
  • 30. CMPT365 Multimedia Systems 30 JPEG 2000 vs JPEG  Original image
  • 31. CMPT365 Multimedia Systems 31 JPEG2000 vs JPEG
  • 32. CMPT365 Multimedia Systems 32 Further Exploration  Textbook Chapter 9  Other sources  The JPEG Still Image Compression Standard by Pennebaker and Mitchell  JPEG2000: Image Compression Fundamentals, Standards, and Practice by Taubman and Marcellin  Image and Video Compression Standards: Algorithms and Architectures, 2nd ed. by Bhaskaren and Konstantinides