• 沒有找到結果。

# JPEG Image Compression

N/A
N/A
Protected

Share "JPEG Image Compression"

Copied!
23
0
0

(1)

## JPEG Image Compression

Rahul Garg, Varun Gulshan December 6, 2005

JPEG Image Compression

(2)

## Basic Data Redundancies

• Interpixel Redundancy

• Psychovisual Redundancy

• Coding Redundancy

(3)

## A Bit of Information Theory

Entropy of a source : Average amount of information obtained by observing a single source output.

H(z) = −

N

X

i=1

P (ai)logP (ai)

where (a1, a2, ..., aN) forms the set of possible outputs.Shannon’s First Theorem states that

min(Lavg) = H(z)

where Lavg is average code word length per source symbol.

JPEG Image Compression 2

(4)

(5)

## Handling Redundancies

• Interpixel Redundancy: Captured by the DCT coefficients(more zeros in coeffs).

• Psychovisual Redundancy: Captured by the high frequency DCT coefficients.

• Coding Redundancy: Captured by variable length codes.

JPEG Image Compression 4

(6)

## The DCT transform

• Break up image into 8x8 image blocks.

• Change the basis for representing the block image.

(7)

The (u, v)th DCT coefficient is given by the dot product

dct (u, v) =

N −1

X

x=0

N −1

X

y=0

image (x, y) ∗ h (x, y, u, v)

where

h (x, y, u, v) = α(u)α(v)cos

h(2x+1)uπ 2N

i

cos

h(2y+1)vπ 2N

i

JPEG Image Compression 6

(8)

(9)

## DCT vs FT

Comparison of packing for a one dimensional test signal:[8, 16, 32, 40, 48, 56, 64]

JPEG Image Compression 8

(10)

Effect of truncation

(11)

Result on images

JPEG Image Compression 10

(12)

## Quantization

• Equivalent to truncating coefficients corresponding to high frequency.

• Lossy step in JPEG compression.

• Quantization values specified in a 8x8 Q-table.

• Table based on heuristically determined perceptual importance of each coefficient.

(13)

JPEG Image Compression 12

(14)

## Coding of the DCT coefficients

Done in two parts

• The DC coefficient (u, v) = (0, 0) is coded using difference encoding.

• The AC coefficients(the rest of the coefficients) are run length encoded and then huffman coded.

(15)

## Coding the DC coefficients

Step 1: Take difference with the DC coefficient of the previous block.

JPEG Image Compression 14

(16)

Step 2: Differences are encoded using variable length codes.These variable length codes are standardized for jpeg.

DC coeffs -869 -861 -876 -933 -867 -845 -863 ...

Differences 8 -15 -57 66 22 -18 ...

Codes for differences are looked up from a table.

(17)

## Coding the AC coefficients

Step 1: Convert the AC coefficients into a sequence by traversing the coefficients in a zig-zag way.

Zig-zag parse clusters the zeros together.

JPEG Image Compression 16

(18)

Example zig zag parse

-26 -3 1 -3 -2 -6 2 -4 1 -4 1 1

5 0 2 0 0 -1 2 0 0 0 0 0 -1 -1 EOB

(19)

Step 2: Non zero AC coefficients are divided into categories.

Figure 1: AC categories The sequence is then run length coded.

JPEG Image Compression 18

(20)

Original AC coeff -26 -3 1 -3 -2 -6 2 -4 1 -4 1 1 5 0

2 0 0 -1 2 0 0 0 0 0 -1 -1 EOB

Category codes 5 2 1 2 2 3 2 3 1 3 1 1 3 -

2 - - 1 2 - - - - - 1 1 EOB

Run length codes 0/5 0/2 0/1 0/2 0/2 0/3 0/2 0/3 0/1 0/3 0/1 0/1 0/3

1/2 2/1 0/2 5/1 0/1 EOB

Run length codes form our symbol set for coding. They are coded using a standardized table. Hence, code for each non zero AC coefficient is composed of a basecode (corresponding to runlength/category) and a code corresponding to offset in

(21)

## Standard tables vs Optimized tables

JPEG Image Compression 20

(22)

## JPEG Variants

• Progressive JPEG : Image stored in series of scans with image becoming sharper with each scan.

• Lossless JPEG : Utilizes Predictive Differential Coding method.

(23)

## References

• Digital Image Processing by R.C. Gonzalez and R.E. Woods

• http://www.jpeg.org

• http://cnx.rice.edu

• http://www.datacompression.info

• http://www.cs.sfu.ca

• http://www.wikipedia.org

JPEG Image Compression 22

Graduate Masters/mistresses will be eligible for consideration for promotion to Senior Graduate Master/Mistress provided they have obtained a Post-Graduate

An additional senior teacher post, to be offset by a post in the rank of CM or Assistant Primary School Master/Mistress (APSM) as appropriate, is provided to each primary

An additional senior teacher post, to be offset by a post in the rank of Certificated Master/Mistress or Assistant Primary School Master/ Mistress as appropriate, is provided

An additional senior teacher post, to be offset by a post in the rank of CM or Assistant Primary School Master/Mistress (APSM) as appropriate, is provided to each primary

An additional senior teacher post, to be offset by a post in the rank of CM or Assistant Primary School Master/Mistress (APSM) as appropriate, is provided to each primary

An additional senior teacher post, to be offset by a post in the rank of Certificated Master/Mistress or Assistant Primary School Master/Mistress as appropriate, is provided to

An additional senior teacher post, to be offset by a post in the rank of APSM, is provided to each primary special school/special school with primary section that operates six or

(ii) “The dismissal of any teacher who is employed in the school – (a) to occupy a teacher post in the establishment of staff provided for in the code of aid for primary