+ All Categories
Home > Documents > ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector...

ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector...

Date post: 13-Aug-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
17
ECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan
Transcript
Page 1: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

ECE 508

Project 2

Performance Comparison Between Vector andJPEG Quantization of Images

Brankov Jovan

Page 2: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

Comparison of two GLA programsIn this experiment the performance comparison of given GLA, written in C, and

my GLA code, written in Matlab, was performed.

Experiment set up:

♦ The speech signals and parameters set up from project 1♦ Threshold for both ∆SNR=0.01dB♦ Initialization :

♦ C: Randomly taken training samples♦ Matlab: Randomly generated points through the max/min space of the

sample space.♦ Elimination of empty cells:

♦ C: by assigning one sample from the most populated cell to emptycell

♦ Matlab: by assigning 20% of the population of the most populatedcell to empty cell

♦ Same training set for both programs

Note: The given GLA code, written in C, has some problem with empty cellelimination. Some times it get stacked in the loop of trying to eliminated empty cells.

Comparison:

Note: Comparison is performed for two sets of parameter values. One set thathighly utilizes Matlab features (optimized build in function) and second set where the useof for-next loop degraded the speed performance of Matlab code.

Parameter set: k=1 r=8 Less influence by “for loop”

C:Training set: SNR=29.75dBTest set: SNR=23.736dBExecution Time: 742.28 in 35 iterations ~21sec/iteration

Matlab: Training set: SNR=39.0168Test set: SNR=26.5794dBExecution Time: 939.313 in 9 iterations ~100sec/iteration

Page 3: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

Parameter set: k=8 r=1 Influenced by “for loop”

C:Training set: SNR=10.85dBTest set: SNR=7,298dBExecution Time: 488.5 sec in 30 iterations ~16sec/iteration

Matlab:Training set: SNR=11.39dBTest set: SNR=7.825dBExecution Time: 1748.11sec in 12 iterations ~145sec/iteration

Voronoi cells for k=8 r=1, 1-2 view:

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5-0.5

-0.4

-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5-0.5

-0.4

-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

0.5

Figure 1. Estimated Voronoi plot of Code book values in pairs x x1 2, for r=1,k=8.Left from C code, right from Matlab code.

From Figure 1 one can notice that the first code book is denser around the zero.That is probably influenced by codebook initialization scheme.

Conclusion:The C code run faster then Matlab code, but in this set up C code takes more

iteration to converge to a minimum.The difference in the execution time becomes significant for code that can not

utilized Matlab build in function.The performance of the Matlab code is slightly better in terms of the SNR.

Page 4: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ for images

Training set contains from 10 images shown on Figure 2.

50

100

150

200

50

100

150

200

250

50

100

150

200

0

100

200

50

100

150

200

50

100

150

200

50

100

150

200

250

50

100

150

200

0

100

200

50

100

150

0 0.5 10

0.5

1

0 0.5 10

0.5

1

Figure 2. Training set

0 50 100 150 200 250 3000

0.005

0.01

0.015

0.02

0.025

Pixel Intensity

Est

imat

ed p

df

Figure 3. Estimated pdf of the training set.

Page 5: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

Test set contains two images shown in Figure 4.

Forman

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

240 Akiyo

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

20

40

60

80

100

120

140

160

180

200

Figure 4. Test set ‘Forman’ and ‘Akiyo’

0 50 100 150 200 2500

200

400

600

800

1000

1200

Pixel Intensity

Est

imat

ed p

df

Forman

0 50 100 150 200 2500

200

400

600

800

1000

1200

1400

Pixel Intensity

Est

imat

ed p

df

Akiyo

Figure 5. Estimated pdf for the ‘Forman’ and ‘Akiyo’

From estimated pdf’s one can notice that the first test image is not representedwell in training set. We can expect poorer performance of VQ quantizator for the‘Forman’ image compare to the ‘Akiyo’ image.

Block scanningFour scanning strategies were explored: horizontal, vertical, zigzag and random.

In fist strategy we scan pixels in the block row by row, in second column by column. Inthe third the same zigzag strategy as for JPEG was used. And in fourth the pixels aretaken in random order.

The difference in PSNR due to different scanning scheme was about 0.05dB. Theonly observed effect was a slight difference in the edge preservation for low bit rate. Forhorizontal scanning the horizontal the edges were better preserved. The same observationcan be made for vertical scanning. In zigzag scanning both, the horizontal and verticaledges were preserved. So, in the following experiments the zigzag strategy was used.

Page 6: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ and JPEG performance measurements:PSNR and coding rate

The measure of the distortion was peak signal-to-noise ratio (PSNR), in dB.

PSNR

Nx xi i

i

N=

-

����

����

10 10255

1

2

2

1

*log$1 6

where xi and $xi are the ith pixel of lexicography ordered original image x andquantizied image $x , respectively.

Codeword length:

The length of ith codeword is obtained from the codebook as:l ld pi i= - 1 6

where pi is empirical probability measured during codebook training phase.

Coding rate:

rq l

m n

i ii

level

= =Ê

1

*

where qi is empirical probability measured for particular image during codingphase, li as defined above, and m ,n are the block size.

VQ and JPEG performance

The operational rate-distortion performance (ORDP) is defined as PSNR vs. thecoding rate for given image and coding scheme. The coding scheme is better if the graphof the ORDP of the scheme lies above that of another scheme.

Page 7: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

ORDP for 3x3 VQ and JEPG

10

15

20

25

30

35

40

0 0.2 0.4 0.6 0.8 1 1.2

Average bit/pixel

PS

NR

[d

B]

Form an_VQ_3x3

Form an_jpeg

Akiyo_jpeg

Akiyo_VQ_3x3

Figure 6. Performance Comparison 3x3 VQ and JPEG

From Figure 6 on can notice that the performance of the 8x8 block JPEG over 3x3block VQ is better for both test images. If we compare the PSNR for 4x4 VQ whit the8x8 JPEG, see Figure 7, it can be seen that the performance of the VQ becomes betterthen JPEG.

4x4 VQ and JEPG performance

10

15

20

25

30

35

40

0 0.2 0.4 0.6 0.8 1 1.2

Average bit/pixel

PS

NR

[d

B]

Forman_jpeg

Akiyo_jpeg

Forman_VQ_4x4

Akiyo_VQ_4x4

Figure 7. Performance Comparison 4x4 VQ and JPEG

In Figure 8 and Figure 9 the performance of VQ for different block size is given.It can be seen that, as the block size increases the performance becomes better.

Page 8: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ performan for different block size

10

15

20

25

30

35

0 0.2 0.4 0.6 0.8 1 1.2

Avereg bit/pixel

PS

NR

[d

B]

Forman_VQ_2x2

Forman_VQ_3x3

Forman_VQ_4x4

Forman_VQ_5x5

Forman_VQ_8x8

Figure 8. Performance Comparison for different Block Size of the VQapplied on the ‘Forman’ image

VQ performan for different block size

10

15

20

25

30

35

40

0 0.2 0.4 0.6 0.8 1 1.2

Avereg bit/pixel

PS

NR

[d

B]

Akiyo_VQ_2x2

Akiyo_VQ_3x3

Akiyo_VQ_4x4

Akiyo_VQ_5x5

Akiyo_VQ_8x8

Figure 9. Performance Comparison for different block size of the VQapplied on the ‘Akiyo’ image

Page 9: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ quantized images:This section contains the 3x3 VQ qunatized images.

2 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 70

80

90

100

110

120

130

1402 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 70

80

90

100

110

120

130

140

Figure 10. Images obtained by VQ of 2 code point codebook.left image r=0.019 , right image r=0.066

4 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14060

80

100

120

140

160

180

200

4 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14060

80

100

120

140

160

180

200

Figure 11. Images obtained by VQ of 4 code point codebook.left image r=0.25 , right image r=0.12

8 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14060

80

100

120

140

160

180

200

220

8 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

Figure 12. Images obtained by VQ of 8 code point codebook.left image r=0.31 , right image r=0.21

Page 10: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

16 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

220

16 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14050

100

150

200

Figure 13. Images obtained by VQ of 16 code point codebook.left image r=0.41 , right image r=0.31

32 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

220

32 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

Figure 14. Images obtained by VQ of 32 code point codebook.left image r=0.50 , right image r=0.41

64 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

40

60

80

100

120

140

160

180

200

220

24064 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

Figure 15. Images obtained by VQ of 64 code point codebook.left image r=0.57 , right image r=0.469

Page 11: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

128 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

40

60

80

100

120

140

160

180

200

220

128 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

Figure 16. Images obtained by VQ of 128 code point codebook.left image r=0.67 , right image r=0.56

256 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

240256 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

20

40

60

80

100

120

140

160

180

200

220

Figure 17. Images obtained by VQ of 256 code point codebook.left image r=0.78 , right image r=0.64

512 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14040

60

80

100

120

140

160

180

200

220

240512 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14020

40

60

80

100

120

140

160

180

200

220

Figure 18. Images obtained by VQ of 512 code point codebook.left image r=0.87 , right image r=0.75

Page 12: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

1024 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14040

60

80

100

120

140

160

180

200

220

2401024 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

20

40

60

80

100

120

140

160

180

200

220

Figure 19. Images obtained by VQ of 1024 code point codebook.left image r=0.96 , right image r=0.86

2048 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14040

60

80

100

120

140

160

180

200

220

240

2048 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 20

40

60

80

100

120

140

160

180

200

220

Figure 20. Images obtained by VQ of 2048 code point codebook.left image r=1.08 , right image r=1.012

Forman

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

240 Akiyo

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

20

40

60

80

100

120

140

160

180

200

Figure 21. Test set ‘Forman’ and ‘Akiyo’

Page 13: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ and JPEG images for the same bit reat

4 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14060

80

100

120

140

160

180

200

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

250

Figure 22. Images obtained by VQ (left ) and JPEG (right)left image r=0.25 , right image r=0.251

11 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

Figure 23. Images obtained by VQ (left ) and JPEG (right)left image r=0.261 , right image r=0.256

32 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

50

100

150

200

250

Figure 24. Images obtained by VQ (left ) and JPEG (right)left image r=0.50 , right image r=0.513

Page 14: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

128 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

Figure 25. Images obtained by VQ (left ) and JPEG (right)left image r=0.56 , right image r=0.513

256 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 40

60

80

100

120

140

160

180

200

220

240

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

50

100

150

200

250

Figure 26. Images obtained by VQ (left ) and JPEG (right).left image r=0.78 , right image r=0.756

512 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14020

40

60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

Figure 27. Images obtained by VQ (left ) and JPEG (right).left image r=0.75 , right image r=0.75

Page 15: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

2048 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

14040

60

80

100

120

140

160

180

200

220

240

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

50

100

150

200

250

Figure 28. Images obtained by VQ (left ) and JPEG (right)left image r=1.08 , right image r=1.04

2048 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 20

40

60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

Figure 29. Images obtained by VQ (left ) and JPEG (right)left image r=1.04 , right image r=1.02

By visual comparison I can say that for very low bit rate e.g. r=0.25, the 3x3 VQis better then 8x8 JPEG, but for higher bit rate the JPEG is better. JPEG gives ussmoother images.

Page 16: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

VQ codebook as imageDuring image VQ coding we are basically matching the target block from the

original image with one block from the “VQ code book image”, see Figure 30. The oneblock from VQ “codeblocks” that matches the target block the best, e.g. has minimumdistance is output as a code point for target block.

20 40 60 80 100 120 140 160 180

10

20

30

40

50

60

70

80

90

50

100

150

200

250

Figure 30. VQ codebook for 3x3 block and 2048 code point presented as an image

0.5 1 1.5 2 2.5 3 3.5

0.5

1

1.5

2

2.5

3

3.5 40

60

80

100

120

140

160

180

200

220

240

Figure 31. The most probably code point during the training phase.The pixels values are around the 135.

The most probably code point

Page 17: ECE 508 - Illinois Institute of TechnologyECE 508 Project 2 Performance Comparison Between Vector and JPEG Quantization of Images Brankov Jovan Comparison of two GLA programs In this

Visual comparison of VQ and JPEG for the sameblock size.The first image, in Figure 32, is obtained by 64 level VQ for 8x8 block size and

the second by 8x8 JPEG. One can say that the fist image, obtained by 8x8 VQ, has morevisual information then second, obtained by JPEG. The PSNR for both images are close:PSNR_VQ=21.6dB and PSNR_JPEG=22.15dB. The code rates are quite different,r_VQ=0.0845 and r_JPEG=0.251.

So, to summarize observation above: by applying 8x8 VQ instead 8x8 JPEG, weobtained the better image, which can be represented by fewer bits.

The price for applying the VQ is the execution time that is much bigger then forJPEG. Also the execution time increases rapidly as the number of code points increases.This prevents us from using the VQ for large codebooks.

64 code book levels

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140 60

80

100

120

140

160

180

200

220

20 40 60 80 100 120 140 160

20

40

60

80

100

120

140

0

50

100

150

200

250

Figure 32. Images for visual comparison between VQ and JPEG. The left image is obtained by 8x8 VQ and the right by 8x8 JPEG

PSNR_VQ 21.6dB and PSNR_JPEG 22.15dB, r_VQ=0.0845 and r_JPEG=0.251


Recommended