You are on page 1of 6

# This is the html version of the file http://www.cse.ohio-state.edu/~xuan/courses/679/jpeg.ppt.

CSE679: JPEG

## JPEG goals JPEG compression steps Lab

JPEG Goals

JPEG: Joint Photographic Experts Group Applications can tune compression level Should have tractable computational complexity Should be possible to implement in hardware Compression scheme should be independent of data format o PAL/NTSC etc. shouldnt matter o Independent of picture size, colors etc. Lossless, hierarchical, sequential, and progressive coding should be possible.

## JPEG Compression Steps

Picture preparation

Pixel o Block, MCU (Minimum Coded Unit) Picture processing o FDCT Quantization Entropy encoding o Differential encoding (belongs to Source encoding) o Run-length encoding o Huffman encoding
o

Picture Preparation

JPEG specifies a very general image model. A source image consists of at least one and at most 255 components. o Components may be assigned to the three colors RGB, YIQ or YUV signals. Convert each component into 8 8 data blocks Each pixel is represented by p (8, or 12) bits. o If p = 8, each pixel is an integer in the range of 0 to 255.

## Processing Forward DCT

Shift: The pixel values are shifted into the range [-128, 127]. DCT expression

## Some Observations of Forward DCT

All 64 values in the input matrix, P[x, y] contribute to each entry in the transform matrix, F[x, y] to generate 64 new samples F[0,0] is the mean of all 64 values in the matrix, known as the DC coefficient, others are called as the AC coefficients.

## DCT Computation Features DCT Computation Features Quantization

FQ[x, y] = Integer Round (F(x, y)/Q(x, y)) Different coefficients are treated separately based on quantization table.

## An Example of Quantization An Example of Quantization Table Entropy Encoding

Vectoring o 2-D matrix should represent the values in the form of a single-dimension vector. o Scan in zig-zag order

Differential Encoding

The DC coefficient varies only slowly from one block to the next.

12, 13, 11, 11, 10, Only the difference in the preceding block is encoded. o 12, 1, -2, 0, 1
o

Run-length Encoding

The AC coefficients are encoded in the form of a string of pairs of values (skip, value) o (0,6) (0,7) (0,3) (0,3) (0,3) (0,2) (0,2) (0,2) (0,2) (0,0)

Huffman Encoding

Use variable length codes Most frequently used symbols coded with fewest bits The intermediate symbol sequence
o

DC coefficient: (sss, value) sss: the number of bits needed value: the encode value AC coefficient: (skip, sss) (value) with run-length encoding skip: the number of consecutive 0s

sss: the number of bits needed to encode the value value: the encode value Huffman code o DC coefficients: 12 = (4, 12) = (1011100)

## AC coefficient: (0, 6) = (0, 3) (6) = (100110)

Summary

DC coefficient
o o o o

Input: 12, 13, 11, 11, 10, Differential encode: 12, 1, -1,-1,-2 The intermediate symbol sequence: (sss, value) Huffman code: P160 (b) sss P160 (a) value Example: 12 = (4, 12) = (1011100) Input: 6, 7, 3, 0, 0, 3, 3, 2, 0, 0, 0 Run-length encoding: (0,6) (0,7) (0,3) (2,3) (0,3) (0,2) (0,0) The intermediate symbol sequence: (skip, sss) (value) Huffman code: P163-164 (skip, sss) P160(a) value Example: (0, 6) = (0, 3) (6) = (100110)

AC coefficient
o o