EMBEDDED SYSTEM DESIGN OF JPEG IMAGE DECOMPRESSION Parikshit Nigam

advertisement
EMBEDDED SYSTEM DESIGN OF JPEG IMAGE DECOMPRESSION
Parikshit Nigam
B.E., Sardar Patel University, India, 2006
PROJECT
Submitted in partial satisfaction of
the requirements for the degree of
MASTER OF SCIENCE
in
ELECTRICAL AND ELECTRONIC ENGINEERING
at
CALIFORNIA STATE UNIVERSITY, SACRAMENTO
FALL
2010
EMBEDDED SYSTEM DESIGN OF JPEG IMAGE DECOMPRESSION
A Project
by
Parikshit Nigam
Approved by:
__________________________________, Committee Chair
Jing Pang, Ph. D.
__________________________________, Second Reader
Preetham Kumar, Ph. D.
____________________________
Date
ii
Student: Parikshit Nigam
I certify that this student has met the requirements for format contained in the University
format manual, and that this project is suitable for shelving in the Library and credit is to
be awarded for the project.
_________________________, Department Chair
Preetham Kumar, Ph.D.
Department of Electrical and Electronic Engineering
iii
________________
Date
Abstract
of
EMBEDDED SYSTEM DESIGN OF JPEG IMAGE DECOMPRESSION
by
Parikshit Nigam
Image compression using JPEG algorithm has revolutionized the digital
multimedia industry. JPEG based image compressions requires lower bandwidth for
transmission and reduce storage disk space. Bitmap Image Format stores the pixel values
without any encoding or compression. Hence it has larger size than the JPEG file format.
Decompression of JPEG image involves extracting the pixel values using 2-dimensional
Inverse Discrete Cosine Transform and de-quantization. The pixel values are in zigzag
format in JPEG so they need to be extracted out in the normal format. JPEG header has
discrete quantization tables and Huffman tables encoded in it. These tables need to be
extracted. Apart from this, bitmap header format extraction and reorganizing them along
with the pixel values is needed for converting a jpeg format image to a bmp format
image.
This project explores the various possible architectures for hardware software codesign. The project implements Hardware/Software Co-Design using Atmel ATmega32
micro controller as hardware and Visual C++ is used to implement the software part of
the project. Hardware software co-design combines the best of both. Software gives the
iv
flexibility in design while the hardware guarantees the performance, throughput and
efficient operation.
_________________________________________________, Committee Chair
Jing Pang, Ph.D.
_________________________
Date
v
ACKNOWLEDGMENTS
The road to success is never a smooth. During the journey of completing the
project there were many hurdles and problems. This project was the brainchild of Dr.
Pang, the advisor for this project. She supported me and helped me at all times, with all
the implementations and finer details of the project. This project couldn’t be implemented
without her. She was the architect of this project. I am also thankful to her for valuable
suggestions for report and reviewing it.
At this time, I would also thank Chintan Govani, without whom this project
wouldn’t have been completed. His extensive knowledge at each and every step of
project is commendable and deserves a special mention.
I would also thank Dr. Preetham B. Kumar, graduate coordinator and reader for
the project. Dr. Kumar’s immense knowledge and experience helped me to understand
complexities involved in this project. I would also thank Dr.Suresh Vadhva, department
chair of the Electrical and Electronic Engineering Department, for their valuable
suggestions and support.
Also, I am thankful to all faculty members of the Electrical and Electronic
Engineering Department for helping me finish my requirements for graduation at
California State University, Sacramento.
vi
TABLE OF CONTENTS
Page
Acknowledgements ............................................................................................................ vi
List of Tables ................................................................................................................... viii
List of Figures .................................................................................................................... ix
1. INTRODUCTION .......................................................................................................... 1
2. JPEG DECOMPRESSION ALGORITHM .................................................................... 3
2.1 Introduction ............................................................................................................... 3
2.2 Huffman Encoding .................................................................................................... 4
2.3 Decoding ................................................................................................................... 5
2.4 De-quantization ......................................................................................................... 6
2.5 IDCT (Inverse Discrete Cosine Transform) .............................................................. 8
3. IMAGE HEADER FORMAT....................................................................................... 12
3.1 Introduction ............................................................................................................. 12
3.2 BMP Header Format ............................................................................................... 12
3.3 JPEG Header Format ............................................................................................... 14
4.HARDWARE/SOFTWARE CO-DESIGN ................................................................... 16
4.1 Introduction ............................................................................................................. 16
4.2 Hardware/Software Co-design Partitioning ............................................................ 16
4.3 Hardware Selection & Implementation ................................................................... 17
4.4 Results ..................................................................................................................... 22
5. CONCLUSION & FUTURE WORK ........................................................................... 26
REFERENCES ................................................................................................................. 27
vii
LIST OF TABLES
Page
1. Table 2.2.1 Sample DC Huffman Table…………………………………...…..…
4
2. Table 2.3.1 Sample Pixel Matrix Values………………………………………… 6
3. Table 2.4.1 Quantization Matrix…………………………………………………
7
4. Table 2.4.2 Pixel matrix after De-quantization…………………………………..
8
5. Table 2.5.1 Pixel Values Shifted By 128………………………………………..
9
6. Table 2.5.2 Final Pixel Values after Normalization……………………………..
9
7. Table 3.2.1 Bit Map Image Header Format……………………………………… 13
8. Table 4.4.1 Size of Image in BMP & JPEG Format with Compression Ratio….
22
9. Table 4.4.2 BMP to JPEG Conversion Time ……………………………….......
24
10. Table 4.4.3 JPEG To BMP Conversion Time.…………………………….......
25
viii
LIST OF FIGURES
Page
1. Figure 2.1.1 Different Steps of JPEG Algorithm ……………………………
3
2. Figure 2.2.1 Constructing Binary Tree for Huffman Code ….....……….……
5
3. Figure 2.5.3 2-Dimensinal IDCT………………………………………..……
10
4. Figure 2.5.4 Sine wave………………………………………………………..
10
5. Figure 2.3.5 IDCT of Sine Wave with Various Percentage Loss Coefficients.
11
6. Figure 4.2.1 Atmel Debugger Kit…………………………………………….. 18
7. Figure 4.2.2 Atmel Programmer Kit………………………………………….. 19
8. Figure 4.2.3 Hardware Schematic…………………………………………….
21
9. Figure 4.4.1 Lena……………………………………………………………... 23
10. Figure 4.4.2 Run time details for BMP to JPEG conversion….…………….
23
11. Figure 4.4.3 Run time details for JPEG to BMP conversion………………..
24
ix
1
Chapter 1
INTRODUCTION
JPEG (Joint Photographic Experts Group) image compression has caused
revolution in the digital storage and media industry. JPEG has proven its effectiveness by
reducing the storage size of the image without much losing the quality and resolution. Its
efficiency in compression and widespread use lead to its adoption as an IEEE (Institution
of Electrical and Electronics Engineers) standard in the year 1997. This project emulates
the JPEG advantages by utilizing the flexibility of software combined with the efficiency
of hardware. The field of hardware/software co-design is relatively newer. It emphasizes
the need for symbiotic development and collaborative verification. of hardware and
software The project focuses on implementing the header of JPEG & BMP (Bitmap
Image Format) grey scale image formats and Huffman encoding for pixels using the
Visual C++ and complex JPEG algorithm like 2-Dimensional DCT (Discrete Cosine
Transform), 2-Dimensional IDCT(Inverse Discrete Cosine Transform) , Quantization and
De-Quantization .
Chapter 2 of the report starts with an introduction to JPEG decompression
algorithm. It discusses the various steps like de-quantization, Huffman decoding, Inverse
Discrete Cosine Transform and zigzag decoding in detail.
Chapter 3 of the report discusses the header format and header details of the Bit
Map Image format. It also describes on the header format JPEG image file format and
2
discusses the details presence in JPEG image header with size of the each header
element.
Chapter 4 focuses on the Hardware/Software Co-Design Implementation. It deals
with the possible architectures of the design. This section report also discusses the
implementation of Hardware/Software Co-design for the project. This part also discusses
the various test cases, possible flaws & bottlenecks of the current implementation and
performance of the current design. It also has results from the project.
Chapter 5 summarizes the project with a conclusion and a peek in to possible
future improvements.
3
Chapter 2
JPEG DECOMPRESSION ALGORITHM
2.1 Introduction
JPEG (Joint Photographic Experts Group) has radically changed the way of
compression and storing the data in form of images. JPEG has gained fame and
popularity due to its ability to compress data and reproduce the same without much loss
in the visual information. Its low storage needs along with lower bandwidth requirements
for transmission has made it one of the preferred formats for portability. JPEG
decompression is explained in detail in this chapter. Different steps that are involved in
the JPEG compression and decompression algorithm are shown in the Figure 2.1.1.
Figure 2.1.1 Different Steps of JPEG Algorithm
4
2.2 Huffman Encoding
Huffman decoding is the first step of the image decompression. It is variable
length code in which the symbols are allocated codes based on the probaility of their
occurrence. Since the image used for the project is greyscale the header part of a JPEG
image has two Huffman tables encoded inside it. One table exists for DC coefficients
decoding and another table for AC co-efficients decoding. DC co-efficients are calculated
in a different way than AC co-efficents. Every 8x8 matrix has one DC coefficent
followed by 63 AC coefficents.
Values
Category
Bits for the value
0
0
-
-1,1
1
0,1
-3,-2,2,3
2
00,01,10,11
-7,-6,-5,-4,4,5,6,7
3
000,001,010,011,100,101,110,111
-15,..,-8,8,..,15
4
0000,..,0111,1000,..,1111
-31,..,-16,16,..,31
5
00000,..,01111,10000,..,11111
-63,..,-32,32,..,63
6
000000,…,011111,100000,…,111111
-127,..,-64,64,..,127
7
000000,…,0111111,1000000,…,1111111
-255,..,-128,128,..,255
8
0000000,…,0111111,1000000,…,1111111
-511,..,-256,256,..,511
9
00000000,…,01111111,10000000,…,11111111
-1023,..,-512,512,..,1023
10
000000000,…,011111111,100000000,…,111111111
Table 2.2.1 Sample DC Huffman Table
DC co-efficents have higher values, larger energy and more information than the
corrosponding block AC values DC coefficents are calculated by taking the difference of
current DC value and of the previous block DC value. The difference is then encoded by
Huffman table. The
AC values are encoded by the optmized Huffman table. The
5
optimized huffman table is calculatede by binary serach tree. The binary search tree is
build upon the probability of occurrence of a symbol. Higher is the probabity of
occurrence lower is the number of bits for that synbol. Figure 2.2.2 shows a tree
formation for traversing and decoding the Huffman codes.
Figure 2.2.1 Constructing Binary Tree for Huffman Code
2.3 Decoding
The JPEG decompression algorithm can decode or transform images of any color
space. The encoded image has data for luminance and chrominance for YUV or YCbCr
format. But for the grayscale images luminance values don’t exist. Chrominance values
are normally 8bit values for grey scale images. Sample images for this project are all
grayscale and any subsequent mention of images means grayscale images. All the
operations are performed on 8x8 blocks for JPEG image. Sample Jpeg encoded pixel
values are shown in Table 2.3.1:
6
-26
-3
-6
2
2
-1
0
0
0
-2
-4
1
1
0
0
0
-3
1
5
-1
-1
0
0
0
-4
1
2
-1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Table 2.3.1 Sample Pixel Matrix Values
2.4 De-quantization
Sample image is divided into 8x8 blocks and all the subsequent operations are
performed on these blocks. The encoded pixel 8x8 matrix is multiplied by the
quantization matrix which yields nearly similar matrix to Discrete Cosine Transform
coefficient matrix. Quantization matrix also decides the image quality of the image. If the
co-efficient of the quantization matrix are placed far apart or difference between
neighborhoods co-efficient is large, than the image is of lower quality. If the coefficients
of the quantization matrix are smaller then, the image resolution and clarity is higher and
without any blurry effects on edges. Table 2.4.1 shows a sample quantization matrix and
Table 2.4.2 shows the resultant matrix after applying de-quantization.
7
16
11
10
16
24
40
51
61
12
12
14
19
26
58
60
55
14
13
16
24
40
57
69
56
14
17
22
29
51
87
80
62
18
22
37
56
68
109
103
77
24
35
55
64
81
104
113
92
49
64
78
87
103
121
120
101
72
92
95
98
112
100
103
99
Table 2.4.1 Quantization Matrix
-416
-33
-60
32
48
-40
0
0
0
-24
-56
19
26
0
0
0
-42
13
80
-24
-40
0
0
0
18
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
0
0
0
0
0
0
0
0
Table 2.4.2 Pixel matrix after De-quantization
2.5 IDCT (Inverse Discrete Cosine Transform)
IDCT is invariably most important step in the image decompression. In the Figure
2.4.2, pixel matrix upper leftmost value is termed as a DC coefficient where are all the
other pixel values are called AC coefficients. If the sample image pixel matrix is
observed carefully, it reveals that mostly all the pixel values are clustered in the upper left
corner or on low frequency ranges. Pixel values at higher frequencies are absent. After
performing the IDCT on the pixel values, the resultant pixel matrix is shown in Figure
2.5.1.
-66
-63
-71
-68
-56
-65
-68
-46
-71
-71
-72
-46
-2
-41
66
-57
-70
-78
-68
-17
20
-14
-61
-63
-63
-73
-62
-8
27
-14
-60
-58
-58
-65
-61
-27
-6
-40
-68
-50
57
-57
-64
-58
-48
-66
-72
-47
-53
-46
-61
-74
-65
-63
-61
-45
9
-47
-34
-53
-74
-60
-47
-47
-47
Table 2.5.1 Pixel Values Shifted By 128
Figure2.5.2 shows the pixel values after shifting them by 128. This was done to
restore the offset that was added during the image compression to center around the pixel
values and reduce the dynamic range requirements of DCT.
62
65
57
60
72
63
60
82
57
55
56
82
108
87
62
71
58
50
60
111
148
114
68
70
65
55
66
120
155
114
68
70
70
63
67
101
122
88
60
78
71
71
64
70
80
62
56
81
75
82
67
54
63
65
66
83
81
95
75
54
68
81
81
87
Table 2.5.2 Final Pixel Values after Normalization
.
The mathematical expression of 2-Dimensional IDCT is given by the formula:
10
Where f(m,n) is the DCT of the signal f(x,y) and
and
for
where m and n both are not 0 …………………………………(2.5.1)
2-dimensional IDCT is computed by calculating one dimensional IDCT
horizontally and then doing one dimensional IDCT vertically or vice versa. This is
separability property.
Figure 2.5.3 2-Dimensinal IDCT
Figure 2.5.4 Sine wave
11
IDCT of sine
wave with 0% loss
IDCT of sine wave
with 25% loss
IDCT of sine
wave with 50% loss
IDCT of sine wave
with 75% loss
Figure 2.3.5 IDCT of Sine Wave with Various Percentage Loss Coefficients
In the Figure 2.3.5, the percentage of loss determines the number of IDCT
coefficients that are used for reconstruction of image. In 0% loss there is no loss in the
reconstruction of the image. Here, loss from the IDCT coefficients is not considered. It
can be observed that as the numbers of coefficients are decreased image becomes more
and more blurry.
12
Chapter 3
IMAGE HEADER FORMAT
3.1 Introduction
The images of any format begin with a specific number. This number is termed as
‘Magic Number’. The Magic Number is unique for all formats and decides the type of
file format. All the other details like size of file (given in pixels on height and width
format), numbers of bits needed to represent the pixel values and all other meta-data of
the header is present after this number. For Bitmap Image format, 0x42 is the magic
number while 0xFFD8 is the magic number for JPEG. Section 3.2 discusses the BMP
header format followed by JPEG header format in section 3.3
3.2 BMP Header Format
Bitmap image is windows image file format developed by Microsoft. Bmp image
is one type of raster image format. In this format image pixel values are organized in
grids. The resolution of a bmp image is fixed and cannot be altered. If the resolution of
the image is changed to a higher values image losses its sharpness and becomes more
blurry. Hence, most of the time a bmp image is converted to other image formats before
processing the image and reduce the storage disk space or reduce bandwidth and cost
during transmission. It is one of most simpler and easy file formats. This project uses an 8
bit grey scale bitmap image. Header of a bmp image is simple. Bmp images don’t use
compression. They directly use pixel values. That is one of the reasons their size is large.
A sample bmp image header has 54 bytes and is shown below:
13
Table 3.2.1 Bit Map Image Header Format
14
3.3 JPEG Header Format
Every image format has a specific number assigned to it. This number appears at
the beginning of the image. JPEG header starts with magic number xFFD8. FFD8
indicates the start of image (SOI). Next, tag is SOF0. This indicates start of a frame for a
baseline DCT based JPEG. SOF0 indicates the component sub sampling. If, tag is SOF1
instead of SOF0, it indicates the progressive DCT based JPEG. After DCT tag, DHT
information is present in a jpeg image format. This is indicated by the FFC4. It indicates
the presence of one or more Huffman tables. DQT is comes as next marker and is its
presence is indicated by the FFDB. It specifies one or more quantization tables that are
used for quantization of pixel values in a jpeg based image. DRI is Define Restart
Interval, encoded by value FFDD. It specifies the interval between RSTn markers, in
macro blocks. This marker is followed by two bytes indicating the fixed size so it can be
treated like any other variable size segment. After that, SOS is a next tag. SOS stands for
start of Scan. It has information about the top-to-bottom-scan of the image.
In baseline DCT JPEG images, there is generally a single scan. Progressive DCT
JPEG images usually contain multiple scans. This marker specifies which slice of data it
will contain, and is immediately followed by entropy-coded data. DRI is Define Restart
Interval and is specified by FFDD. It defines the interval between RSTn markers in
macro blocks. It is of 2 bytes in size. RSTn is restart. It is inserted after every r macro
blocks where r is interval that is set by a DRI marker. If no DRI marker is present then
this field is ignored. APPn is application specific marker that has value FFEn and is of
15
variable size. COM is for comment and is of variable size, indicated by the marker FF or
FE. Finally, last marker is end of image (EOI) indicated by FFD9.
typedef struct _JPEGHeader
{
BYTE SOI[2];
BYTE APP0[2];
BYTE Len[2];
/* 00h Start of Image Marker
*/
/* 02h Application Use Marker
/* 04h Length of APP0 Field
*/
*/
BYTE Id[5]; /* 06h "JFIF" (zero terminated) Id String */
BYTE Ver[2];
/* 07h JFIF Format Revision
*/
BYTE Unit;
/* 09h Units used for Resolution */
BYTE Xden[2];
/* 0Ah Horizontal Resolution
BYTE Yden[2];
/* 0Ch Vertical Resolution
BYTE XTmbnl;
/* 0Eh Horizontal Pixel Count
BYTE YTmbnl;
/* 0Fh Vertical Pixel Count
} JPEGHEAD;
*/
*/
*/
*/
16
Chapter 4
HARDWARE/SOFTWARE CO-DESIGN
4.1 Introduction
Hardware/Software co-design is a relatively new field. It explores the flexibility
of software combined with efficiency of the hardware. Both the hardware and software
are used to implement a single function. The development of both the software and the
hardware is done simultaneously. In this approach the traditional approaches to problem
are of no use. This technique is used in microprocessor design, cache and memory
development and in digital signal processing related concepts and problems. The use of
Hardware/Software co-design lowers the performance per unit cost of the system due to
ease in modeling.
4.2 Hardware/Software Co-design Partitioning
In this project, the division of tasks to be taken done by hardware and software
was a critical decision for the success of the project. The division of the task between the
hardware and software is critical to performance of the system. One of the possible
architectures for implementation of the project was to compute the Huffman tables,
Discrete Cosine Transform, Inverse Discrete Cosine Transform with the microcontroller.
This would have increased the throughput and efficiency of system. A microcontroller
could perform digital signal processing functions like DCT and complex mathematical
easily. But, computing the Huffman table & building a binary tree for Huffman codes,
17
formatting of image co-efficient in zigzag format and embedding the Quantization table
requires user defined and complex data structures like hashes of hashes and array of
hashes.
The implementation of these complex and user defined data structure would
have been difficult to implement on a microprocessor. This could considerably decrease
the performance of the complete design by creating a bottleneck. These complex data
structures can be modeled by software with much simplicity. Hence, microcontroller is
used to simulate complex mathematical functions like DCT, IDCT and Quantization
while software boosts the performance of the system by handling the header information
of the image file formats in the current design.
4.3 Hardware Selection & Implementation
The most important task for hardware implementation was selecting the
microcontroller. The main criterion for choosing a microcontroller was cost of
microcontroller per function. Texas Instrument’s TMS320DM6446, popularly, known as
Da Vinci Digital Media System-on-Chip was primary choice for microcontroller. It is
advanced DSP microcontroller and has most of the Digital Signal Processing functions
in-built. It was the fastest with clock speed of 594 MHz but costliest of all the choices
with initial its initial cost crossing thousand dollars. Hence, it was ruled out.
Another option was AVR STK500 kit. This was a medium performance kit and
has an AVR flash microcontroller. This kit was easy for implementation of the design
and didn’t have any advanced features with onboard microcontroller clock speed of 40
18
MHz. its initial cost was around one hundred dollars. It enjoyed all the features of
microcontrollers with an onboard Flash of 128KB. The high amount of flash had
increased the computing power as the number of handshaking between the hardware and
software reduced. This was the ideal kit until the Atmel debugger kit and programmer kit
were used.
Atmel programmer and debugger kit was low speed and low cost kit. The
complete setup cost less than forty dollars and the onboard microcontroller is a basic
microcontroller with clock speed of 16 MHz, Flash of 2KB (code memory) and 32KB of
Ram for data storage. This was ideal for the project implementation as it allowed to
maximize the performance of the system by constraining the design. It was very simple to
use and didn’t need any additional setup for the kit to interface with the computer.
Figure 4.2.1 Atmel Debugger Kit
19
Figure 4.2.2 Atmel Programmer Kit
Atmel Programmer kit downloads the program from the computer COMPORT to
the microcontroller connected to it. It has JTAG interface to communicate with
microcontroller.
Hence, microcontroller was limited to compute DCT, IDCT & Quantization. The
DCT and IDCT took negligible time when the image of size 16X16 pixels. Here, there
were only 4 computations that need to be performed. But, for an 80x80 pixel image, time
for DCT and IDCT was substantial. This was due to the fact that microprocessor had to
perform 100 computations and each computation had more than 60 operations to be done.
One of the other design strategies could have been doing the DCT on complete image
rather than sending 8x8 blocks to the microcontroller. This technique could have saved
some time as fewer handshaking signals would have been needed. But, the cost for this
advantage would have been nullified by the need of large memory to be interfaced with
20
the microcontroller. Another possible way could have been the optimization of DCT and
IDCT algorithms. The flaw in this approach was need of advanced hardware and the cost
would have played at bigger role. Hence, to keep the approach simple and illustrate the
effectiveness of hardware/software co-design, micro processor performed DCT and IDCT
along with quantization. One more to partition the design in between hardware and
software was using microprocessor to compute header and remove header for jpeg and
bmp file format images. But, then number of for loops and computations would have
increased greatly as size of many parameters in a JPEG header format is variable. Hence,
in the current time frame with the given resources the best choice was to implement the
header extraction and insertion using the software as it has advantage of being flexible
and fast and implement the DCT, IDCT and quantization in microprocessor, giving the
efficiency of hardware.
21
.
Figure 4.2.3 Hardware Schematic
22
4.4 Results
The project successfully converted with BMP images to JPEG images and viceversa. The size of bmp images was decreased by the factor of 5 depending upon the
initial size and the quantization table used to encode the data.
Size in
BMP Format
JPEG Format
Compression Ratio= (BMP
pixels
Size (KB)
Size(KB)
Image Size/JPEG Image Size )
8x8
12KB
3KB
4
80x80
41KB
8KB
5.2
200x200
179KB
34KB
5.38
243KB
53KB
4.87
256x256
(Lena)
Table 4.4.1 Size of Image in BMP & JPEG Format with Compression Ratio
The image of Lena in BMP format was converted to JPEG with the project. This
was test image for the project and was of 256x256 pixel size. The sizes of initial bmp
image of Lena 243KB as none of the pixel values were encoded. After the running the
BMP to JPEG image conversion on the image from the project, the JPEG image that was
generated had size of 53KB. This proved the effectiveness of Hardware/Software Design
Co-Design with low cost design methodology.
23
Figure 4.4.1 Lena
Lena.bmp on the left
Lena.jpg on the right
45
40
35
30
Software rime
Hardware time
Total time
25
20
15
10
5
0
8x8
200x200
Figure 4.4.2 Run time details for BMP to JPEG conversion
24
Image size
Software time
Hardware time
Total time
(in pixels)
(seconds)
(seconds)
(seconds)
8x8
1.8
<1
~2
80x80
3.1
8.4
11.5
200x200
5.9
38.3
44.2
Table 4.4.2 BMP to JPEG Conversion Time
60
50
40
Software Time
Hardware Time
Total time
30
20
10
0
8x8
200x200
Figure 4.4.3 Figure 4.4.2 Run time details for JPEG to BMP conversion
sssssssssssss
25
Image size
Software time
Hardware time
Total time
(seconds)
(seconds)
(seconds)
8x8
1.6
<1
~2
80x80
3.7
10.6
14.3
200x200
7.1
47.8
54.9
s(in pixels)
Table 4.4.3 JPEG to BMP Conversion Time
26
Chapter 5
CONCLUSION & FUTURE WORK
Future enhancements could improve upon initial limitations of the project. One
limitation can be use of only grey scale images. This can be expanded to support color
images in future. From the hardware’s perspective one drawback was the presence of
little onboard memory of around 2KB. This could be counteracted by interfacing an
external memory with the microcontroller. The response of the microcontroller was slow
and by optimizing the DCT algorithm s and hardware registers and data flow, throughput
can be increased. One thing that could change the speed of the operation would be using
a higher performance microprocessor. But, this would lead to increase in cost and
complexity of the design.
The project successfully implemented the hardware/software co design strategies.
Various steps in JPEG compression like encoding quantization tables and Huffman tables
zigzag and Huffman encoding were implemented with the software while 2-dimensional
Discrete Cosine Transform and Inverse Discrete Cosine Transform and quantization were
implemented on hardware i.e. Atmel ATmega32 microcontroller. Overall the project met
all the requirements and performed all the tasks satisfactorily.
27
REFERENCES
1.
Edmund Y. Lam and Joseph W. Goodman, “A Mathematical Analysis of the
DCT Coefficient distributions for Images”, IEEE Transactions on Image
Processing, vol. 9, NO. 10, October 2000
2.
Al Bovik, Department of Electrical and Computer Engineering, UTA Texas,
“Handbook of Image & Video Processing”, Academic Press Series, 1999
3.
R. Gonzalez, R. Woods, "Digital Image Processing", Addison-Wesley Publishing
Company, pp 518 - 548, 1992
4.
Andrei Alexandrescu, Modern C++ Design”, Addison-Wesley, 2001
5.
Staunstrup, Wayne,” Hardware/Software Co-Design: Principles and Practice”,
Springer publications, 1997
6.
Texas Instruments, “TMS320DM64x Digital Media Processor – Product Bulletin
(Rev. C)”, 2005
7.
M. I. H. Bhuiyan1 and Rubaiya Rahman, “Modelling of the Video DCT
Coefficients”, 5th International Conference on Electrical and Computer
Engineering, Dhaka, Bangladesh, ICECE 2008, 20-22 December 2008
8.
Ying Luo and Rabab K. Ward, “Removing the Blocking Artifacts ofBlock-Based
DCT Compressed Images”, IEEE Transaction On Image Processing, Vol. 12, No.
7, July 2003
9.
Lukasz Kizewski, “Image Deblocking Using Local Segmentation”, Student
Thesis in Monash University, November 2004
Download