Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao.

Similar presentations


Presentation on theme: "Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao."— Presentation transcript:

1 Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao

2 Department of Computer Engineering University of California at Santa Cruz JPEG Compression n JPEG is the image compression standard developed by the Joint Photographic Experts Group n JPEG was designed for natural image compression n It convert the original image into YIQ space and compress each channel as a separate gray image n The compression ratio and the quality of the decoded images is controlled by quality factor (1-100) Quality factor > 35 - no big difference Quality factor < 10 – significant difference

3 Department of Computer Engineering University of California at Santa Cruz Quality factor n Original Quality factor = 20 Quality factor = 75 Quality factor = 5

4 Department of Computer Engineering University of California at Santa Cruz JPEG Compression – Algorithm Overview n An input image is divided into 8x8 blocks. Each block is encoded based on DCT transform n DCT coefficients are quantized according to a quatization matrix n Entropy coding is used to encode positions and the magnitudes of the coefficients

5 Department of Computer Engineering University of California at Santa Cruz Color space conversion n Human visual system has less resolution in color than in intensity. As a result, the original color images are converted into intensity and color channels. One such transformation is RGB->YIQ

6 Department of Computer Engineering University of California at Santa Cruz JPEG – 8x8 DCT Transformation n After DCT compression, only a few DCT coefficients have large values in each 8x8 block n These coefficients are floating-point numbers

7 Department of Computer Engineering University of California at Santa Cruz Quantization of the DCT Coefficients n Each coefficients are converted into an integer number using quatization n The choices of quatization steps Large quantization step - Large rounding errors, smaller quantized values Small quatization step – Small rounding errors, large quantized coefficients The same quatization step for all coefficients ? – Human visual system is more sensitive to relative low frequency changes in images, which implies that for high frequency coefficients, larger quantization steps can be used without causing noticeable image distortion What does all this means ?

8 Department of Computer Engineering University of California at Santa Cruz JPEG Quantization Matrix n The low frequency coefficients (upper-left corner) have smaller quantization steps, therefore more accurately encoded 357911131517 5791113151719 79111315171921 911131517192123 1113151719212325 1315171921232527 1517192123252729 1719212325272931

9 Department of Computer Engineering University of California at Santa Cruz JPEG Quantization Using the Quantization Matrix 923-9-7302 -39-581217-2242 -84621-1834-55 -52-36-1014-104-20 -86-4049-717-6-25 -6265-12-23-8-20 -1714-3617-1133 -5432-9 22013 30000000 -7-8110000 -12600000 -5-3000000 -7-3300000 -44000000 0 00000 -31000000 Before quantization After quantization 900-700000 -35-569110000 -84540-130000 -45-33000000 -77-394500000 -5260000000 -150-1900000 -5119000000 After reconstruction

10 Department of Computer Engineering University of California at Santa Cruz Encoding n We need to compress the quantized coefficients n Lossless methods are used to Encode the position of non-zero coefficients Encode the magnitudes of these coefficients 30000000 -7-8110000 -12600000 -5-3000000 -7-3300000 -44000000 0 00000 -31000000

11 Department of Computer Engineering University of California at Santa Cruz Encoding n Zig-Zag encoding of coefficient positions Non-zero coefficients and the number of 0’s in front of them are encoded along the zig-zag path

12 Department of Computer Engineering University of California at Santa Cruz Example n The following quantized coefficient matrix is represented as (30,0), (-7,1), (-12, 0), (-8, 0), (-1, 0), (1,1),(6,0),(-5,0),(-7,0),(-3,0), (1,1), (-1,3),(-3,1),(-4,0), (-1,0), (4,0), (3,0),(-3,11),(1,0), (-1,0),(end) n These pairs are encoded using a entropy coding method 30000000 -7-8110000 -12600000 -5-3000000 -7-3300000 -44000000 0 00000 -31000000

13 Department of Computer Engineering University of California at Santa Cruz JPEG bit stream n

14 Department of Computer Engineering University of California at Santa Cruz JPEG Bitstream n Terminology Frame – image Block – 8x8 image block Segment – a group of blocks n Frame header Sample precision (width, height) of image number of components unique ID (for each component) horizontal/vertical sampling factors (for each component) quantization table to use (for each component)

15 Department of Computer Engineering University of California at Santa Cruz JPEG Bitstream n Scan header Number of components in scan component ID (for each component) Huffman table for each component (for each component) n Misc. (can occur between headers) Quantization tables Huffman Tables Arithmetic Coding Tables Comments Application Data

16 Department of Computer Engineering University of California at Santa Cruz Various JPEG modes n Baseline/Sequential n Lossless mode n Progressive mode Display low quality image first, and then transmit and display more details Method 1: Send DC components first, then a few low frequency components, and then more components Method 2: Send significant bits first, then more less significant bits

17 Department of Computer Engineering University of California at Santa Cruz Decoding n Decoding is the inverse process of the encoding Recover the quantized coefficient matrix Recover the coefficient matrix IDCT n JPEG is lossy because of the quatization process

18 Department of Computer Engineering University of California at Santa Cruz Evaluation n To evaluate an image compression algorithm, there are two criteria Subjective - The visual quality vs. bit rate (subjective) Objective - The rate distortion curve (Peak SNR vs. bit rate) The difference image when the quality factor is 3

19 Department of Computer Engineering University of California at Santa Cruz Evaluation n The rate distortion curve


Download ppt "Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao."

Similar presentations


Ads by Google