cis679: jpeg (more)

15
CIS679: JPEG (more) Review of JPEG More about JPEG Lab project

Upload: tamira

Post on 25-Jan-2016

29 views

Category:

Documents


1 download

DESCRIPTION

CIS679: JPEG (more). Review of JPEG More about JPEG Lab project. Review of JPEG. JPEG goals Picture Preparation Component, block, and pixel Picture Processing Shift Forward DCT Quantization Different coefficients are treated separately => quantization table. Differential Encoding. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CIS679: JPEG (more)

CIS679: JPEG (more)

Review of JPEG More about JPEG Lab project

Page 2: CIS679: JPEG (more)

Review of JPEG

JPEG goals Picture Preparation

Component, block, and pixel

Picture Processing Shift Forward DCT

Quantization Different coefficients are treated separately =>

quantization table

Page 3: CIS679: JPEG (more)
Page 4: CIS679: JPEG (more)

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. 12, 1, -2, 0. –1

Page 5: CIS679: JPEG (more)

Run-length Encoding

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

Page 6: CIS679: JPEG (more)

Huffman Encoding

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

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 0• sss: the number of bits needed to encode the value• Value: the encode value

Huffman code DC coefficients: 12 = (4, 12) = (1011100) AC coefficient: (0, 6) = (0, 3) (6) = (100110)

Page 7: CIS679: JPEG (more)

Summary

DC coefficient 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)

AC coefficient 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)

Page 8: CIS679: JPEG (more)

Lab Project

Objective: be familiar with JPEG Description

Input: an original 8*8 block => original data (the value of each pixel is in the range of [0,255]) (given by the Instructor)

Steps:• Shifted to the range of [-128, 127]• FDCT (round: 1.6->2, -1.6->-2, 1.5->2, 1.1->1)• Quantized with the given quantization table (see the given

example) (round) (round: 1.6->2, -1.6->-2, 1.5->2, 1.1->1)• Zig-zag coded• Converted to the intermediate symbol sequence with run-

length encoding on AC coefficients• Encoded to bit sequence with Huffman encoding (based on the

given default Huffman codewords tables) => compressed data • The compression ratio = original data size (i.e. 64*8)/compressed data size

Output: print out all the results of the above steps into different files (The names and formats of output files should follow the files put on the web.)

Page 9: CIS679: JPEG (more)

Lab Project Team: one or 2 students What should be turned in (via email to [email protected]

state.edu, subject: 679 project)? Put all codes into one file (source_jpeg.c (.cpp) with clear comments

(softcopy)• Make sure TA can understand, compile, and run your codes on unix

machines. All the codes should be in C or C++. A report including a summary (2 <= page # <= 5) and the source

code file, and result files (hardcopy or softcopy either in PDF) Due date: Oct. 16, 2006, 5:00pm (EST) (both the code and the

report) How will TA grade?

Correctness: TA will use his own data to test your codes. Clearness: TA will check whether your code and report are

understandable. Fairness:

• Students in the same teams get the same scores.• No copy! All students involved in copy will get ZERO.

Page 10: CIS679: JPEG (more)

140 144 147 140 139 155 179 175

144 152 140 147 140 148 167 179

152 155 136 167 163 162 152 172

168 145 156 160 152 155 136 160

162 148 156 148 140 136 147 162

147 167 140 155 155 140 136 162

136 156 123 167 162 144 140 147

148 155 136 155 152 147 147 136

Example - Original Block

Page 11: CIS679: JPEG (more)

12 16 19 12 11 27 51 47

16 24 12 19 12 20 39 51

24 27 8 39 35 34 24 44

40 17 28 32 24 27 8 32

34 20 28 20 12 8 19 34

19 39 12 27 27 12 8 34

8 28 -5 39 34 16 12 19

20 27 8 27 24 19 19 8

Example - Shifted Block

Page 12: CIS679: JPEG (more)

186 -25 21 -13 33 -13 -20 -27

29 -34 27 -9 -11 11 14 7

-15 -23 -2 6 -18 3 -20 -1

-12 -5 15 -15 -8 -3 -3 8

-5 10 8 1 -11 18 18 15

5 -2 -18 8 8 -3 1 -7

12 1 -3 4 -1 -7 -1 -2

0 -8 -2 2 1 4 -6 0

Example -After FDCT

Page 13: CIS679: JPEG (more)

3 5 7 9 11 13 15 17

5 7 9 11 13 15 17 19

7 9 11 13 15 17 19 21

9 11 13 15 17 19 21 23

11 13 15 17 19 21 23 25

13 15 17 19 21 23 25 27

15 17 19 21 23 25 27 29

17 19 21 23 25 27 29 31

Example - Quantization Table

Page 14: CIS679: JPEG (more)

61 -5 3 -1 3 -1 -1 -2

6 -5 3 -1 -1 1 1 0

-2 -3 0 0 -1 0 -1 0

-1 0 1 -1 0 0 0 0

0 1 1 0 -1 1 1 1

0 0 -1 0 0 0 0 0

1 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

Example - After Quantization

Page 15: CIS679: JPEG (more)

Example – Other StepsZig-zag sequence61,-5,6,-2,-5,3,-1,-3,-1,0,0,0,-1,3,3,-1,-1,0,1,1,0,1,0,1,-1,-1,1,-1,-2,1,3,0,0,-1,0,0,0,0,0,-1,0,-1,0,-1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0Intermediate symbol sequence(6)(61),(0,3)(-5),(0,3)(6),(0,2)(-2),(0,3)(-5), (0,2)(3), (0,1)(-1),(0,2)(-3),(0,1)(-1),(3,1)(-1), (0,2)(3), (0,2)(3),(0,1)(-1),(0,1)(-1), (1,1)(1), (0,1)(1),(1,1)(1), (1,1)(1), (0,1)(-1),(0,1)(-1),(0,1)(1),(0,1)(-1),(0,2)(-2),(0,1)(1),(0,2)(3),(2,1)(-1),(5,1)(-1),(1,1)(-1),(1,1)(-1),(1,1)(1),(6,1)(1),(1,1)(1),(0,0)Encoded bit sequence (total 154 bits)(1110)(111101) (100)(010) (100)(110) (01)(01) (100)(010) (01)(11) (00)(0) (01)(11) (01)(00) (00)(0) (111010)(0) (01)(11) (00)(0) (00)(0) (1100)(1) (00)(1) (1100)(1) (00)(0) (00)(0) (00)(1) (00)(0) (01)(01) (00)(1) (01)(11) (11011)(0) (1111010)(0) (1100)(0) (1100)(0) (1100)(1) (1111011)(1) (1100)(1) (1010)