29
Page 1 CS Department llel Design of JPEG2000 Image Compress Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 1CS Department

Parallel Design of JPEG2000 Image Compression

Xiuzhen Huang

CS DepartmentUC Santa Barbara

April 30th, 2003

Page 2: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 2CS Department

Outline

• Introduction to image compression• JPEG2000 compression scheme• Parallel implementation of JPEG2000

– On distributed-memory multiprocessors– On shared-memory multiprocessors

• Conclusion

Page 3: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 3CS Department

Introduction to Image Compression

Why do we need image compression?

1280 pixels

800 pixels

1280 800 3 (RGB)= 3 M bytes

File size of a small digital photo without compression:

To speedup the image transmission over Internetand reduce image storage space, we need compression

Page 4: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 4CS Department

Introduction to Image Compression

Original Picture3 M bytes

JPEG2000 Compression19 K bytes

• Compression Ratio: >150 times !• No noticeable difference in picture quality

Page 5: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 5CS Department

JPEG2000 International Standard

JPEG2000: the new international standard for image compression, is much more efficient than the old JPEG international standard.For the same compression ratio / bit rate / file size, the JPEG2000 picturehas much better quality.

JPEG JPEG2000Original Picture

Compression ratio : 50:1

Strong blockiness

Page 6: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 6CS Department

JPEG2000 International Standard

JPEG2000 has a much Higher computational complexity than JPEG,especially for larger pictures.

Need parallelimplementation to reduce compressiontime.

Page 7: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 7CS Department

JPEG2000 Compression Scheme

WaveletTransform

Input BlockwisePartition

Codingof each block

BinaryCompressed data

Major steps of JPEG2000 image compression

• Wavelet transform uses most of the image compression time (>80%)• parallel implementation should focus on wavelet transform

Page 8: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 8CS Department

JPEG2000 Compression Scheme

Brief Introduction to Wavelet Transform

Step 1: Horizontal wavelet transform of an image

for each rowdo 1-D wavelet transform;

end

What is 1-D wavelet transform ?

Page 9: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 9CS Department

A simple example: 1-D Haar wavelet transform

One array of image data

[1, 1]

[1, -1]

2

2

First half of the output

Second half of the output

JPEG2000 Compression Scheme

HorizontalWavelet

Transformof Each Row

Averageof neighboringpixels

Differenceof neighboringpixels

Low-Frequencycoefficients

High-Frequencycoefficients

Low High

Low-pass filter

high-pass filter

Down-sample by 2

Page 10: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 10

CS Department

JPEG2000 Compression Scheme

Wavelet Transform

Step 2: Vertical transform of image

for each column of the new imagedo 1-D wavelet transform;

end

Page 11: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 11

CS Department

HorizontalWavelet

Transformof Each Row

Low High

VerticalWavelet

Transform of Each Column

LowLow

HighLow

LowHigh

HighHigh

JPEG2000 Compression Scheme

Page 12: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 12

CS Department

Parallel Design of JPEG2000 Compression

Two Parallel Computing Architectures

Shared-Memory Multiprocessors

• Has a single address space. • Allow processors to communicate through variables stored in a

shared address space• Programming tool: openMP

Distributed-Memory Multiprocessors

• Each processor has its own memory module

• Processors communicate to each other over a high-speed network

• Programming tool: MPI (Message Passing Interface)

Page 13: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 13

CS Department

Parallel Implementation of JPEG2000 Compressionon Distributed-Memory Multiprocessors

Page 14: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 14

CS Department

Parallel Design of JPEG2000 Compression-DMP

Traditional Approach

• The image is first divided into n regions on rows.

• Each processor performs 1-D horizontal wavelet transform

• Then, the new image is divided into n regions on columns.

• Each processor performs 1-D vertical wavelet transform.This approach requires intensive data transmission among processors, has very high network communication cost.

Page 15: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 15

CS Department

Parallel Design of JPEG2000 Compression-DMP

Tiling Approach

• JPEG2000 international standard supports tile-based image compression.

• A large image is divided into several tiles and each image tile is compressed independently.

P1 P2 P3

P5

P8P7

P4 P6

P9

Page 16: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 16

CS Department

Choose MPI for parallel implementation of JPEG2000, because the JPEG2000 software is written in C, which supported by MPI. Basic framework is:

Parallel Design of JPEG2000 Compression-DMP

Page 17: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 17

CS Department

Number of processors

Com

pres

sion

Tim

e (S

ec)

The picture shows the compression time using different tile size.For each tile size,processor number increases,compression time is reduced.The small tile need larger computation overhead.

Size: 32

Size: 256

Image:512x512

Parallel Design of JPEG2000 Compression-DMP

Page 18: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 18

CS Department

• There is a jump between one process and two processes.

• When there is only one process, JPEG2000 compression is sequential

• If there are more than two processes involved in the program, Process 1 is responsible for collecting data, while the others are responsible for processing different tiles and sending processed data back to the Process 1.

Note

Parallel Design of JPEG2000 Compression-DMP

Page 19: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 19

CS Department

Parallel Implementation of JPEG2000 Compressionon Shared-Memory Multiprocessors

Page 20: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 20

CS Department

Parallel Design of JPEG2000 Compression-SMP

A problem with tile-based approach

Images compressed by JPEG, JPEG2000, and JPEG2000 with relatively small tiles.

Each tile is compressed independently, which causes discontinuity across tile edges, also called blockiness.

Page 21: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 21

CS Department

Parallel Design of JPEG2000 Compression-SMP

• Another parallel architecture is shared-memory multiprocessors.

• The excellent price-performance ratio of Intel-based SMPs make such systems very popular in many data processing applications.

• There are also many available programming tools for shared memory processor, such as openMP and Java Threads.

Page 22: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 22

CS Department

• In SMP, we do not need worry about data communication over network, because the data is in the shared memory. So there is no need for tile partitioning.

• Therefore, we can use the traditional data partitioning approach for horizontal and vertical wavelet transforms.

Parallel Design of JPEG2000 Compression-SMP

Page 23: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 23

CS Department

Parallel Design of JPEG2000 Compression-SMP

• JPEG2000 image compression is implemented on a 4-processor SMP system using direct openMP.

• The speedup in wavelet transform is only about 1.6 times, which is supposed to be near 4 times.

• Why?

Page 24: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 24

CS Department

Parallel Design of JPEG2000 Compression-SMP

It is found that the vertical wavelet transform requires more than 10 times the horizontal transform.

But we know that both vertical and horizontal transforms have the same number of operations.

vertical horizontal

Page 25: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 25

CS Department

Cache Miss Problem

Parallel Design of JPEG2000 Compression-SMP

• In computer memory, the image data is stored line by line in a raster-scan order (from left to right, from top to bottom).

• Each continuous block of image data is brought into the cache from memory for wavelet transform.

• In horizontal wavelet transform, as the filter window is moving, the data of next transform is often available, few cache miss.

Page 26: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 26

CS Department

Cache Miss Problem

Parallel Design of JPEG2000 Compression-SMP

• In vertical wavelet transform, the filtering is done in the vertical direction, however, the data is brought into cache in a horizontal way. So, there are very frequent cache miss.

data

filt

erin

g

Solution

Do vertical transform of several columns at the same time to make full use of the existing data in the cache. , instead of column by column Significantly reduces cache miss.

Page 27: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 27

CS Department

Original Verticaltransform

Parallel Design of JPEG2000 Compression-SMP

Improved Verticaltransform

The vertical transform is speed upby about 10 times.

Page 28: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 28

CS Department

Parallel Design of JPEG2000 Compression-SMP

Using the improved vertical wavelet transform, the overall speedup times of wavelet transform is now close to the number of processors.

Page 29: Page 1 CS Department Parallel Design of JPEG2000 Image Compression Xiuzhen Huang CS Department UC Santa Barbara April 30th, 2003

Page 29

CS Department

• Give a brief review JPEG2000 image compression.

• Discussed two approaches for parallel implementation of JPEG2000 image compression: distributed memory multiprocessor and shared memory multiprocessor.

Conclusion

Question?