JPEG Compression What is JPEG n n n
- Slides: 26
JPEG Compression What is JPEG? n n n "Joint Photographic Expert Group". Voted as international standard in 1992. Works with color and grayscale images, e. g. , satellite, medical, . . . Motivation n n The compression ratio of lossless methods (e. g. , Huffman, Arithmetic, LZW) is not high enough for image and video compression, especially when the distribution of pixel values is relatively flat.
JPEG Compression Overview
JPEG Compression 1 -D Discrete Cosine Transform n n A cosine transform is required to compute on a set of N even functioned periodic data points with a sampling interval Ts. The data is made even functioned by folding about the vertical axis. This gives an even periodic function but 2 N-1 data points. By offsetting the sampling point by Ts/2 and then folding the points about the vertical axis an even periodic function is obtained with 2 N points
JPEG Compression 1 -D Discrete Cosine Transform: Example n Applying a discrete cosine transform of length 2 N to the data xn where n = -N to (N-1).
JPEG Compression 1 -D Discrete Cosine Transform: Example n n The forward transform matrix is symmetrical about the A axis. Folding about A axis allows the x(k) coefficients to be computed from the positive x(n) samples (0 to N-1) and forward DCT transform becomes: The reverse transform matrix is symmetrical about the B axis. Folding about B axis allows the x(n) coefficients to be computed from the positive x(k) samples (0 to N-1) and reverse DCT transform becomes: where C 0 = 1 when k 0 and C 0 = 1/2 when k = 0 n Combining the folds and sharing the scaling factor between the forward and reverse transforms allows the basis matrix to be the same and yields the following forward and reverse transforms:
JPEG Compression Discrete Cosine Transform (DCT) n From spatial domain to frequency domain :
JPEG Compression The 64 (8 x 8) DCT basis functions
JPEG Compression Properties n DCT is like FFT, but can approximate linear signals well with few coefficients
JPEG Compression Two 1 -D DCTs n n Factoring allows 2 -D DCT to be computed as a series of 1 D DCTs Most software implementations use fixed point arithmetic. Some fast implementations approximate coefficients so all multiplies are shifts and adds
JPEG Compression Quantization F'[u, v] = round ( F[u, v] / q[u, v] ). n n n Reduce number of bits per sample Example: 101101 = 45 (6 bits). q[u, v] = 4 --> Truncate to 4 bits: 1011 = 11. n Quantization error is the main source of the Lossy Compression. n Uniform Quantization n Each F[u, v] is divided by the same constant N.
JPEG Compression Non-uniform Quantization n Eye is most sensitive to low frequencies (upper left corner), less sensitive to high frequencies (lower right corner) n Quantization tables used to generate non-uniform quantisation n The Luminance Quantization Table q(u, v) n n The Chrominance Quantization Table q(u, v) The numbers in the above quantization tables can be scaled up (or down) to adjust the so called quality factor. Custom quantization tables can also be put in image/scan header.
JPEG Compression Zig-Zag Scan n Groups low frequency coefficients in top of vector n Maps 8 x 8 to a 1 x 64 vector
JPEG Compression: DC & AC Component Coding Differential Pulse Code Modulation (DPCM) on DC component n n DC component is large and varied, but often close to previous value n Encode the difference from previous 8 x 8 blocks -- DPCM Run Length Encode (RLE) on AC components n n 1 x 64 vector has lots of zeros in it Keeps skip and value, where skip is the number of zeros and value is the next non-zero component. Send (0, 0) as end-of-block sentinel value
JPEG Compression Entropy Coding Categorize DC values into SIZE (number of bits needed to represent) and actual bits. n Example: if DC value is 4, 3 bits are needed. n n Send off SIZE as Huffman symbol, followed by actual 3 bits. For AC components two symbols are used: Symbol_1: (skip, SIZE), Symbol_2: actual bits. Symbol_1 (skip, SIZE) is encoded using the Huffman coding, Symbol_2 is not encoded. Huffman Tables can be custom (sent in header) or default.
JPEG Compression Bit Stream
JPEG Compression Four JPEG Modes n Sequential Mode n Lossless Mode n Progressive Mode n Hierarchical Mode
JPEG Compression Sequential Mode Each image component is encoded in a single left-toright, top-to-bottom scan. n Baseline Sequential Mode, the one that we described n above, is a simple case of the Sequential mode: n It supports only 8 -bit images (not 12 -bit images) n It uses only Huffman coding (not Arithmetic coding)
JPEG Compression Sequential Mode n Each image component is encoded in a single leftto-right, top-to-bottom scan.
JPEG Compression Lossless Mode n n A special case of the JPEG where indeed there is no loss. It does not use DCT-based method! Instead, it uses a predictive method.
JPEG Compression Lossless Mode (cont) n A predictor combines the values of up to three neighboring pixels (not blocks as in the Sequential mode) as the predicted value for the current pixel, indicated by "X" in the figure below. The encoder then compares this prediction with the actual pixel value at the position "X", and encodes the difference losslessly.
JPEG Compression Lossless Mode (cont) n n n It can use any one of the following seven predictors Since it uses only previously encoded neighbors, the very first pixel I(0, 0) will have to use itself. Other pixels at the first row always use P 1, at the first column always use P 2. Effect of Predictor (test result with 20 images):
JPEG Compression Progressive Mode n Goal: display low quality image and successively improve. n Two ways to successively improve image: n Spectral selection: Send DC component and first few AC coefficients first, then gradually some more ACs. n Successive approximation: send DCT coefficients MSB (most significant bit) to LSB (least significant bit). (Effectively, it is sending quantized DCT coefficients frist, and then the difference between the quantized and the nonquantized coefficients with finer quantization stepsize. )
JPEG Compression Progressive Mode
JPEG Compression Hierarchical Mode n n Down-sample by factors of 2 in each dimension, e. g. , reduce 640 x 480 to 320 x 240 Code smaller image using another JPEG mode (Progressive, Sequential, or Lossless). Decode and up-sample encoded image Encode difference between the up-sampled and the original using Progressive, Sequential, or Lossless.
JPEG Compression Hierarchical Mode (cont) n Can be repeated multiple times. n Good for viewing high resolution image on low resolution display.
JPEG Compression JPEG 2000 is the upcoming standard for Still Pictures (due Year 2000). n Among many things it will address: n n Low bit-rate compression performance, n Lossless and lossy compression in a single codestream, n Transmission in noisy environment where bit-error is high, n Application to both gray/color images and bi-level (text) imagery, natural imagery and computer generated imagery, n Interface with MPEG-4, n Content-based description.
- Jpeg ls compression algorithm
- Jpeg: still image data compression standard
- Jpeg still image data compression standard
- Block size in block preparation step of jpeg compression is
- Jpeganalyzer
- Mpeg to jpeg
- Jpeg to png
- Fritzing camera
- Jpeg 2000 compressor
- Arm jpeg
- Jpeg fourier transform
- Jpeg in digital image processing
- Fourier basis
- Jpeg xr
- 27/30
- Mpeg vs jpeg
- Cuda jpeg encoder
- Jpeg disadvantages
- B lynch suture
- Distance decay vs time space compression
- Compression approach to innovation
- Time space compression ap human geography
- Kummel disease
- Orc compression
- Fatty bases
- Cus acronimo medicina
- 3 types of tool marks