The starting point for the JPEG compression process is a baseline compression algorithm that's defined by the standard. All JPEG systems must be able to handle this baseline algorithm, and most go not further. Even the baseline algorithm allows for several optional processing steps.
The first step in the baseline JPEG transformation is the optional translation of the color space in which the image is stored. Most PC display systems use RGB data for storing and displaying an image, but a luminance/chrominance color space allows the JPEG system to better compress the image. Moving to a luminance/chrominance color space allows the next optional step to reduce the image data by about one-third without any apparent loss in detail.
If the image is stored in a luminance/chrominance color space, the compression system can reduce the resolution of the chrominance information without reducing the perceived resolution of the image. The human eye cannot see color differences as sharply as it can detect changes in brightness. Preserving the high resolution of the luminance information makes the overall image appear sharp even when the actual resolution of the color information is reduced.
The resolution is reduced by averaging together adjacent pixels, a process termed downsampling. The average can be taken either horizontally or vertically-the pixels may be either side by side or one above the other-or the pixels can be averaged in both directions. In typical JPEG processing, two pixels are averaged horizontally without vertical averaging (termed 2h1v sampling) or two pixels are averaged bother horizontally and vertically (termed 2h2v sampling). Because 2h1v sampling reduces the size of two of the three image components by half, it yields a one-third reduction in the size of the image data. By reducing the two components to one-quarter their unprocessed size, 2h2v sampling results in an overall reduction of the image data by one-half.
Another data conversion step is key to the sliding compressibility scale of JPEG. Using a mathematical function called a discrete cosine transformation or DCT, image pixels are converted into a frequency map. The transformation results in a series of numbers that represent the pixels in increasing detail. JPEG slices the image into blocks of 64 made from squares of pixels measuring eight to a side. After the discrete cosine transformation, the image becomes 64 values, the first of which contains the lowest frequency of the block-corresponding to an overall average of the block data. Each value supplies higher frequency data until the last, which yields the data necessary to run the DCT algorithm backwards and completely reconstruct the image. The DCT process does not compress the image. Nor does it affect the quality of the reconstructed image, within the limits of the precision of the calculations. Strictly speaking, however, the DCT process is not completely lossless because of the inevitable round-off errors in its calculation. Truly lossless JPEG compression consequently does not use the DCT.
The bulk of the compression in the JPEG process comes from applying quantization coefficients to the values derived by the DCT. JPEG applies a separate coefficient to each of the 64 DCT values. Different combinations of coefficients affect the relationship between compression ratio and quality. Getting the best compromise is a black art only slightly less arcane than curing warts, making yourself invisible, or putting a curse on your neighbors. The values used may vary with each image, so the JPEG data stream or file of any image contains a complete table of all 64 values used in that particular image. Most software that produces images with JPEG compression simply uses the values given as examples by the JPEG committee. Although the exact amount varies with the coefficients that are used, this step results in the greatest amount of compression in the JPEG system and the greatest amount of information loss.
The values resulting after the application of the quantization coefficients are finally compressed as ordinary digital data. The JPEG standard allows two chief options, Huffman coding (which essentially replaces a string with a single value and a multiplier) or arithmetic coding. Although the latter results in files that may be 5 to 10 percent smaller, the algorithm is patented and requires licensing. Most JPEG systems use only Huffman coding.
To enable a JPEG decoder to properly reconstruct the image, the encoder adds a header to the image data that defines the various steps taken in processing the image, including the table of quantization coefficients. Standard JPEG image disk files have yet another header added to further identify the image. Microsoft has defined and published a specific file format for JPEG images and the associated header.
Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.
This article was sent to us by:
Robert Marcus at
06142010
1. Convert All Audio Formats to Your MP3 Player
All articles in this directory are property of their respective authors. Additionally, read our Privacy Policy
© 2010 WebWorldarticles.com - All Rights Reserved. Partners: Gunblade Saga