• No results found

EE25266 ASIC/FPGA Chip Design

N/A
N/A
Protected

Academic year: 2022

Share "EE25266 ASIC/FPGA Chip Design"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

EE25266 – ASIC/FPGA Chip Design

Mahdi Shabany

Electrical Engineering Department Sharif University of Technology

Final Project – Spring 2015 JPEG Image Compression

What is JPEG Compression

JPEG, which stands for Joint Photographic Experts Group (the name of the committee that created the JPEG standard) is a lossy compression algorithm for images. A lossy compression scheme is a way to inexactly represent the data in the image, such that less memory is used yet the data appears to be very similar. This is why JPEG images will look almost the same as the original images they were derived from most of the time, unless the quality is reduced significantly, in which case there will be visible differences. The JPEG algorithm takes advantage of the fact that humans can’t see colors at high frequencies. These high frequencies are the data points in the image that are eliminated during the compression. JPEG compression also works best on images with smooth color transitions, which will make sense when I explain below how the algorithm works.

JPEG Algorithm

The algorithm behind JPEG is relatively straightforward and can be explained through the following steps:

1. Take an image and divide it up into 8-pixel by 8-pixel blocks. If the image cannot be divided into 8-by-8 blocks, then you can add in empty pixels around the edges, essentially zero-padding the image.

2. For each 8-by-8 block, get image data such that you have values to represent the color at each pixel.

3. Take the Discrete Cosine Transform (DCT) of each 8-by-8 block.

4. After taking the DCT of a block, matrix multiply the block by a mask that will zero out certain values from the DCT matrix.

5. Finally, to get the data for the compressed image, take the inverse DCT of each block. All these blocks are combined back into an image of the same size as the original.

As it may be unclear why these steps result in a compressed image, I’ll now explain the mathematics and the logic behind the algorithm.

(2)

Base Principle of JPEG Compression

The JPEG standard is based on the Discrete Cosine Transform (DCT). It gives a lot of flexibility so as to obtain a desired compression ration (CR). As presented in figure 1, the base principle of JPEG

compression for color images considers the four main operations: color space conversion and downsampling, DCT-2D, quantization, Zig-Zag scanning and entropy coding [3] [4].

Color Space Conversion and Downsampling

Three-dimensional space of RGB is commonly used to represent the color space, while three- dimensional space of YCbCr is adopted in the system of JPEG compression. So if the base principle of JPEG compression is employed to deal with the color static image, it is necessary to convert YCbCr color space into RGB color space, which is given by[1]:

( ) (

) ( ) (

)

Considering that it is more insensitive to the information of chrominance than to the information of luminance Y in human visual system, so the method to downsample the data of and by 50% is used to increase compression ration.

DCT-2D

Discrete Cosine Transform (DCT) represents the image as the sum of sinusoids of varying magnitude and frequencies, the DCT calculation is fairly complex; in fact, this is the most costly step in JPEG compression.

DCT is used to produce uncorrelated coefficients, allowing effective compression as each coefficient can be treated independently without risk of affecting compression efficiency. The human visual system is very dependent on spatial frequencies within an image. In fact it is more sensitive to the lower frequencies than to the higher ones. Thus we can discard information that is not perceptible to the human visual system and keep the information that is important to it.

(3)

The DCT-2D is computed as follows: first, the image data is divided into non-overlapped 8*8 matrix blocks; second, all of the 8*8 matrix blocks are transformed by the two dimensional Discrete Cosine Transform, which is given by the following equation.

∑ ∑ *

+ *

+

{√

{√

The result of this equation is an 8*8 matrix representing the frequency domain of the pixel values in the original 8*8 block. Most of the image data will be retained in only a portion of the matrix.

Quantization

Quantization is used to allow for a better compression ration, the quantization is the operation that introduces information losses in the JPEG compression process. The goal of the quantization step is to generate a sparse matrix to allow a large compression rate at the entropy coding operation.

Quantization is defined as division of each DCT coefficient by the corresponding quantization value S(u,v) , followed by rounding to the nearest integer, which is given by equation [4]

(

) The matrix of is represented as follows:

[

]

is also called as the coefficient of DCT, in equation [5], the coefficient of is referred as the DC coefficient, the others are referred as the AC coefficient. Two kinds of table are needed in the quantization step: one is the luminance table; the other is the chrominance table. The typical tables adopted for quantization are given below:

Because Division operations are not efficient for hardware resources, in the most of implementations they are replaced with multiplication and shift operations. For example, dividing an output DCT coefficient by quantization value 13 can be expressed as

*

+

Where [...] represents truncation to integer value. So the DCT coefficient is actually multiplied by 5041 which is stored in the proposed implementation as the corresponding quantization value and then the least significant 16 bits are discarded by a shift operation.

(4)

Zig-Zag Scanning and Entropy Coding

After quantization is used, the DC coefficient and AC coefficient of each 8*8 block should be read in a Zig-Zag order, as depicted in figure 2.

Initially, n new DC coefficient is calculated by differential pulse-code modulation (DPCM). The DC coefficient is the first value in the matrix. It is determined by computing the different value between the current DC coefficient and the last DC coefficient, as shown in figure 3. If there is no previous block, then the previous value is set to zero.

Afterwards, the remaining values in the matrix are called as the AC coefficients. These values are encoded slightly differently using an 8-bit value represented as RRRRSSSS. The run-length, 4 bits RRRR

(5)

value, is the number of zeros preceding a non-zero value using the zigzag format of reading the matrix.

The non-zero value is then coded by size, 4 bits SSSS value, as is described for the difference magnitude.

Finally, all of the DC coefficient and the AC coefficients should be coded by Huffman code. While considering that this is not focus in our research, so it will not be described particularly in this paper.

Your Tasks

You are highly recommended to study the relevant papers available in WEB. Your design should be real time, so use the technics discussed in class.

You should simulate this system in MATLAB, then you should design and implement a hardware for complete system, this part should be done by ISE (over VIRTEX 6), although you should write a testbench and design a test strategy using matlab outputs and ModelSim.

The verified design should be synthesized by Design Compiler and the ASIC flow should be completely done (using DC and SoC encounter).

All the parts should be documented and be delivered according to this timeline:

MATAB simulation and RTL design and hardware implementation of YCbCr and DCT and

Quntization

16 ordibehesht

MATAB simulation and RTL design and hardware implementation zig-zag and entropy coding

30 ordibehesht

The complete ASIC Flow 13 khordad

Preparing the final report 20 khordad

For each part you need to deliver:

1) A report in pdf file. The report should clearly mention the detail of the design. Also it should tell us how to test your design and find the related files (both designs and test benches)

2) All codes both in Matlab and Verilog in two separate folders. The file names and signal names should be consistent in Matlab and Verilog for ease of verification.

3) The designs should be verified with appropriate test vectors. You need to provide post-synthesis simulation results. You need to provide the test vectors too.

References

1. Multiplierless and fully pipelined JPEG compression soft IP targeting FPGAs 2. A Novel Parallel JPEG Compression System Based on FPGA

(6)

References

Related documents

Alain Locke’s Inner Life theory on the other hand considered the African American theatre medium as the vehicle of the New Negro, by which real life, believable

Keywords: Laplacian; spectral zeta function; conformal variation; Casimir energy; homogeneous manifolds.. 2010 AMS Subject Classification: 11M06, 11M36,

Business Administrative Technology Instructor B.A.S., Technical Studies, Valdosta State University A.A.S. Microcomputer Specialist,

The outcome and prognostic factors for lymph node recurrence after node sparing definitive external beam radiotherapy for localized prostate cancer RESEARCH Open Access The outcome

alloys of platinum and rhodium, lately pub- lished in the ‘Philosophical Transactions’, settled the question in favour of the rhodium- platinum thermo-junction, for I

Evans, Nicole M., "The Process of Exercise Participation in the Community for Functional Recovery Post Formal Rehabilitation among Survivors of Stroke: a grounded theory

Classroom behaviour management belief of school science teachers places an affirmative effect on teachers’ positive attitude towards constructivist approach in

In light of our results of similar variability and thus effective population size in the African Drosophila populations, alternative, probably more complex explanations for the