JPEG2000 ENCODER AND DECODER SWETA GIRI REG NO: 1581010040 SRM UNIVERSITY, KATTANKULATHUR , KANCHEEPURAM DISTRICT , TAMILNADU
This paper proposes several techniques for optimizing the JPEG2000 binary arithmetic encoder on Very Long Instruction Word (VLIW) architectures. Binary arithmetic coding (BAC) contains a large amount of conditional and sequential processing steps that make parallelism on VLIW devices difficult to realize. The purpose of this paper is to illustrate an optimized software implementation that can software pipeline on a VLIW device. The Texas Instruments (TI) TMS320C64x Digital Signal Processor (DSP) was chosen as the implementation platform. Results of our optimized code show a 2.4x performance speed-up over a straightforward implementation of the arithmetic encoder as defined in the JPEG2000 standard.
worthy of a new standardization effort, and in 1996 the JPEG2000 working group was created. 2. Encoding
The JPEG2000 standard allows for both lossless and lossy compression. Because lossy compression is more commonly used, it is described in the tutorial. The JPEG2000 compression standard is composed of the stages shown in the flow graph in Figure 1. An explanation of these stages make up the sub-sections of the tutorial's Encoding section.
According to , as technology developed, it became clear that JPEG  was not properly evolving to meet current needs. The widening of the application area for JPEG led to confusion among implementors and technologists, resulting in a standard that was more a list of components than an integrated whole. Afterwards, attempts to improve the standard were met with a naively sated marketplace. It was clear that improvement would only take place if a radical step forward was taken. At the same time, Ricoh Innovations, Inc. unsuccessfully submitted the CREW algorithm  for use in JPEG-LS . However, it was recognized that CREW provided a rich set of features featu res
fig.1 the jpeg2000 encoder
In the first stage, pre-processing is performed. Pre-processing actually contains three sub stages, as shown in Figure 2. These steps must be performed so that the discrete wavelet transformation can be properly performed.
The image to be encoded might be larger than the amount of memory available to the encoder. To solve this problem, JPEG2000 allows for optional tiling. In tiling, the input image is partitioned into rectangular and non-overlapping tiles of equal size (except possibly for those tiles at the image borders), as shown in Figure 3. Each tile is compressed independently using its own set of specified compression parameters. The baboon image  is used throughout the tutorial. Because the image is small, it would in reality only have one tile. Thus, the rest of the tutorial explains the encoding process from the perspective of a one tile image.
fig.3 example tiling of 8-bit baboon image
JPEG2000 compression is most commonly used to compress color images. There are several ways to represent color images numerically, for example: RGB, YCbCr , YCM, and HSB. However, color images are most commonly represented in RGB format. In RGB format, the image is composed of three component planes, one each for the red, green, and blue color components. When the discrete wavelet transformation is performed in JPEG2000, each color layer is transformed independently. However, since Y, Cr and Cb color components are less statistically dependent than R, G and B color components, they independently compress better. Therefore, in JPEG2000 an
irreversible color transform (ICT) is performed to convert RGB data into YCr Cb data according to the following: 2.2 Discrete Wavelet Transformation
JPEG2000 uses discrete wavelet decomposition (DWT) to decompose each image tile into its high and low sub bands as shown in Figure 4. The DWT is performed by filtering each row and column of the pre processed image tile with a high-pass and low-pass filter. Because this process results in double the number of samples, the output from each filter is down sampled by 2 (every other value is removed) so that the sample rate remains constant. Also, it does not matter if the rows or the columns of the component matrix are filtered first. The resulting DWT is the same.
Fig 4. The DWT structure
Fig.5 DWT process for the Y component of baboon image
In JPEG2000, multiple stages of the DWT are performed. The number of stages performed is implementation dependent; however, three stages are demonstrated in
the tutorial. Figure 6.1 shows the Stage 1 DWT for the Y component of the original pre-processed image tile. The four quadrants are defined as follows: LL: low sub bands for row and column filtering HL: high sub bands for row filtering and low sub bands for column filtering LH: low sub bands for row filtering and high sub bands for columns filtering HH: high sub bands for row and column filtering In stage 2 (Figure 6.2), the same process is repeated with the LL1 sub band. Only the LL sub band is further transformed because the high sub band rarely contains any significant samples. Finally, in Stage 3 the DWT is repeated a third time. Again, only the LL2 sub band from Stage 2 is further filtered, as Figure 6.3 shows. JPEG2000 supports from 0 to 32 stages. For natural images, usually between 4 to 8 stages are used.
Fig 6.3 stage 3 Fig 6 DWT of the 8-bit baboon image tile
The wavelet coefficients are quantized using a uniform quantizes with dead zone (Figure 7). For each sub band b, a basic quantizes step size Δb is used to quantize all the coefficients
Fig 7 Deadzone quantizer structure
2.4 Embedded Block Coding Fig 6.1 stage 1
Fig 6.2 stage 2
Before embedded block coding is discussed, the concept of code blocks is explained because they are used in embedded block coding. In JPEG2000, before coding is performed, the sub bands of each tile are further partitioned into relatively small code-blocks (e.g. 64×64 or 32×32 samples) such that code blocks from a sub band have the same size. Code-blocks are used to permit a flexible bit stream organization, which is discussed in Section 2.6 an example of a code-block partitioning is given in Figure 8.
The overall reconstructed image distortion can be represented as a sum of the distortion contributions from each of the code-blocks, where is the distortion contributed by a code-block. Since the code blocks are compressed independently, any bit stream truncation policy can be used. If the overall length of the final compressed bit stream is constrained by Lmax then any set of truncation points can be selected such that Fig 8 example division of sub bands into code blocks In JPEG2000, each code-block is encoded independently. The coding algorithm scans through the matrix of code block quantization indices in a striped manner as shown in Figure 9
Fig 9 stripe scan order within a block
2.5 Rate Control :
Rate control is the process by which the code-stream is altered so that a target bit rate can be reached. Once the entire image has been compressed, a post-processing operation passes over all the compressed blocks and determines the extent to which each block's embedded bit stream should be truncated in order to achieve the target bit rate. The ideal truncation strategy is one that minimizes distortion while still reaching the target bit-rate. Each code-block, Bi, contains a finite number of truncation points, Zi + 1, having lengths such that
2.6 Bit-stream Organization :
In bit stream organization, the compressed data from the bit-plane coding passes are first separated into packets. One packet is generated for each precinct in a tile. A precinct is essentially a grouping of code blocks within a resolution level. Precincts divide a resolution level of a component into rectangles of size ( Px, Py) containing 2 Px×2 Py samples. Since precincts cannot overlap code-blocks and must have dimensions that are exact powers of 2, the precinct size restricts the subordinate code block partitions. An example of precinct partitioning is shown in Figure 10
Fig 10 example precinct partitioning
3 Decoding :
The majority of the JPEG2000 sources do not explicitly explain how the JPEG2000 decoder functions. This is because the decoder basically performs the opposite of the encoder, as shown in Figure 11
Fig 11 the JPEG2000 decoding process The code-stream is received by the decoder according to the progression order stated in the header. The coefficients in the packets are then decoded and dequantized, and the reverse-ICT is performed according to equation below.
In the case of irreversible compression, the decompression results in loss of data. The resulting image is not exactly like the original. One main data loss point lies in rate control and the resulting dequantization of a truncated bit stream. JPEG2000 has the important feature that an image can be compressed in one way and decompressed in many deferent ways. The various practical implementations of this feature are shown in Figure 12.
The baboon image is decompressed in several ways depending on the displaying device and available bit-rate 4. Conclusion : As illustrated, JPEG 2000 is sure to be the next standard for image compression. It offers numerous benefits over current compression methods, including the ability to do both lossless and lossy compression, the ability to obtain higher image quality and higher compression ratios, and the ability to view the same file at multiple resolutions. It also allows one area of the image to be examined more closely using its region of interest capability. JPEG 2000 uses wavelet technology to compress images, and this results in images being compressed more efficiently and with less introduced error than previous methods. Overall, JPEG 2000 is a huge upgrade over current compression methods and looks to be the next image compression standard in the near future. References  D. S. Taubman and M. W. Marcellin, JPEG2000: Fundamentals, Standards and Practice. Kluwer Academic Publishers, Boston, 2002.
 M. D. Adams, \The JPEG-2000 Still Image Compression Standard," Tech. Rep. N2412, ISO/IEC JTC 1/SC 29/WG 1, September 2001.  M. Rabbani and D. Santa Cruz, \The JPEG2000 Still-Image Compression Standard." Course given at the 2001 International Conference in Image Processing (ICIP), October 2001. http://jj2000.epfl.ch/jj_publications/papers/0 11.pdf (as of 01.10.02).
Fig 12 practical application of JPEG2000 standard
 C. Christopoulos and A. Skodras, \JPEG2000 - The Next Generation StillImage Compression Standard." Tutorial given at the IEEE International Conference on Image Processing (ICIP), October 1999. http://www.etro.vub.ac.be/members/christop oulos.charilaos/jpeg2000_cont%ributions.ht m (as of 01.10.02).  S. Saha, \Image Compression - from DCT to Wavalets: A Review," ACM Crossroads Student Magazine, vol. 6.3, Spring 2000. http://www.acm.org/crossroads/xrds63/sahaimgcoding.html (as of 01.10.02).  R. Clark, \An Introduction to JPEG2000 and Watermarking." Elysium Ltd. http://www.jpeg.org/public/jpgintro.pdf (as of 01.10.02).  W. B. Pennebaker and J. L. Mitchell, JPEG: Still Image Compression Standard . Kluwer Academic Publishers, 1993.  Ricoh Innovations, Inc., \Compression with Reversible Embedded Wavelets (CREW)Algorithm." http://www.crc.ricoh.com/CREW/  ISO-14495 and ITU-T Recommendation T.87.” information technology- lossless and near lossless compression of continuoustime still images,”2000.  Official JPEG2000 Homepage. http://www.JPEG.orghtml  ISO/IEC 15444-1 and ITU-T Recommendation T.800, “information technology-JPEG2000 image coding system,”2002.  University Of Southern California, Signal image processing Institute. The USCSIPI image database