Information AboutJpeg |
| CATEGORIES ABOUT JPEG | |
| graphics file formats | |
| iso standards | |
| lossy compression algorithms | |
|
name = Joint Photographic Experts Group
In Computing , JPEG (pronounced jay-peg) is a commonly used standard method of Lossy Compression for photographic images. The File Format which employs this compression is commonly also called JPEG; the most common File Extension s for this format are .jpeg, .jfif, .jpg, .JPG, or .JPE although .jpg is the most common on all platforms. JPEG itself specifies only how an image is transformed into a stream of Byte s, but not how those bytes are encapsulated in any particular storage medium. A further standard, created by the Independent JPEG Group, called '''JFIF''' (JPEG File Interchange Format) specifies how to produce a file suitable for computer storage and transmission (such as over the Internet ) from a JPEG stream. In common usage, when one speaks of a "JPEG file" one generally means a JFIF file, or sometimes an Exif JPEG file. There are, however, other JPEG-based file formats, such as JNG , and the TIFF format can carry JPEG data as well. JPEG/JFIF is the format most used for storing and transmitting photographs on the World Wide Web . For this application, it is preferred to formats such as GIF , which has a limit of 256 distinct colors that is insufficient for colour photographs, and PNG , which produces much larger image files for this type of image. It is ''not'' as well suited for line drawings and other textual or iconic graphics because its compression method performs badly on these types of images, for which the PNG and GIF formats are more commonly used. The MIME media type for JPEG is ''image/jpeg'' (defined in RFC 1341). The name JPEG stands for Joint Photographic Experts Group, the name of the joint ISO / CCITT committee which created the standard. The group was organized in 1986 , issuing a standard in 1992 which was approved in 1994 as ISO 10918-1. ENCODING Many of the options in the JPEG standard are little used. Here is a brief description of one of the more common methods of encoding when applied to an input that has 24 Bits Per Pixel (eight each of Red, Green, And Blue ). This particular option is a Lossy Data Compression method. Color space transformation First, the image is converted from RGB into a different Color Space called YCbCr . This is similar to the color space used by NTSC and PAL color Television transmission, but is most similar to the way the MAC television transmission system works.
This encoding system is useful because the human eye can see more detail in the Y component than in Cb and Cr. Using this knowledge, encoders can be designed to compress images more efficiently. Downsampling The above transformation enables the next step, which is to reduce the Cb and Cr components (called " (reduce by factor of 2 in horizontal and vertical directions). For the rest of the compression process, Y, Cb and Cr are processed separately and in a very similar manner. Discrete cosine transform of these 64 squares]] ]] Next, each component (Y, Cb, Cr) of the image is "tiled" into sections of eight by eight pixels each, then each tile is converted to frequency space using a two-dimensional forward Discrete Cosine Transform (DCT, type II). If one such 8×8 8-bit subimage is: : which is then shifted by 128 results in : and then taking the DCT and rounding to the nearest integer results in : Note the rather large value of the top-left corner. This is the DC Coefficient . Quantization The human eye is fairly good at seeing small differences in Brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation. This fact allows one to get away with greatly reducing the amount of information in the high frequency components. This is done by simply dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer. This is the main lossy operation in the whole process. As a result of this, it is typically the case that many of the higher frequency components are rounded to zero, and many of the rest become small positive or negative numbers. A common quantization matrix is: : Using this quantization matrix with the DCT coefficient matrix from above results in: : For example, using −415 (the DC coefficient) and rounding to the nearest integer : Entropy coding Entropy coding is a special form of Lossless Data Compression . It involves arranging the image components in a "zigzag" order employing Run-length Encoding (RLE) algorithm that groups similar frequencies together, inserting length coding zeros, and then using Huffman Coding on what is left. The JPEG standard also allows, but does not require, the use of Arithmetic Coding which is mathematically superior to Huffman coding. However, this feature is rarely used as it is covered by Patent s and because it is much slower to encode and decode compared to Huffman coding. Arithmetic coding typically makes files about 5% smaller. The zig-zag sequence for the above quantized coefficients would be: −26, −3, 0, −3, −2, −6, 2, −4, 1, −4, 1, 1, 5, 1, 2, −1, 1, −1, 2, 0, 0, 0, 0, 0, −1, −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, 0, 0, 0, 0, 0, 0, 0 JPEG has a special Huffman code word for ending the sequence prematurely when the remaining coefficients are zero. Using this special code word, EOB, the sequence becomes: −26, −3, 0, −3, −2, −6, 2, −4, 1, −4, 1, 1, 5, 1, 2, −1, 1, −1, 2, 0, 0, 0, 0, 0, −1, −1, EOB Compression ratio and artifacts The resulting compression ratio can be varied according to need by being more or less aggressive in the divisors used in the quantization phase. Ten to one compression usually results in an image that can't be distinguished by eye from the original. 100 to one compression is usually possible, but will look distinctly Artifacted compared to the original. The appropriate level of compression depends on the use to which the image will be put. Those who use the World Wide Web may be familiar with the irregularities known as Compression Artifact s that appear in JPEG digital images. These are due to the quantization step of the JPEG algorithm. They are especially noticeable around eyes in pictures of faces. They can be reduced by choosing a lower level of Compression ; they may be eliminated by saving an image using a Lossless file format, though for photographic images this will usually result in a larger file size. Compression artifacts make low-quality JPEGs unacceptable for storing Heightmap s. The images created with ray-tracing programs have noticeable blocky shapes on the terrain. Some programs allow the user to vary the amount by which individual blocks are compressed. Stronger compression is applied to areas of the image that show less artifacts. This way it is possible to make a JPEG file smaller/prettier by hand. Decoding Decoding to display the image consists of doing all the above in reverse. Taking the DCT coefficient matrix (after adding the difference of the DC coefficient back in) : and multiplying it by the quantization matrix from above results in : which closely resembles the original DCT coefficient matrix for the top-left portion. Taking the inverse DCT (type-III DCT) results in an image with values (still shifted down by 128) : and adding 128 to each entry : This is the uncompressed subimage and can be compared to the original subimage (also see images to the right) by taking the difference (original - uncompressed) results in error values : |
|
|