270 likes | 575 Views
Image Compression GIF, TIFF. GIF: Graphics Interchange Format. Basic mode. A LZW method. Dynamic mode. GIF Interlaced Mode. TIFF: Tagged Image File Format. Supports pixel resolution up to 48 bits (16x3) Intended for transfer both images and digitized documents in different formats
E N D
GIF: Graphics Interchange Format Basic mode A LZW method Dynamic mode
TIFF: Tagged Image File Format • Supports pixel resolution up to 48 bits (16x3) • Intended for transfer both images and digitized documents in different formats • Code #1: uncompressed format • Code # 2, 3, 4: digitized document • Code # 5: LZW-compressed
Digitized Documents • FAX: • T4(Group 3) • T6 (Group 4) for ISDN • Use modified Huffmancodes
What is the JPEG? • JPEG: Joint Photographic Experts Group • general-purpose compression standard of for continuous-tone still image (gray scale and color) • jointly developed by ITU-T and ISO • Encoding modes • Lossless mode • Sequential DCT-based mode (baseline mode) • Progressive DCT-based mode • Hierarchical mode
JPEG Encoding Hierarchical mode Sequential (baseline) mode Progressive mode
Progressive Mode • Each image component is encoded in multiple scans • Successive refinement on a rough image untill reaching the requested quality • Bit rate is same with that of sequential mode • a kind of data re-ordering • Preview image can be generated without he need to completely decode the image
Hierarchical Mode • A progressive presentation • Encodes an image at multiple resolutions • For a low resolution display device a ‘best’ image is available • Hierarchical mode : without receiving unnecessary data for higher resolution • Progressive mode : only after the total transmission time for the full-resolution • Hierarchical mode is more effective in network environment
Major Steps of Image Compression • Picture (Image) Preparation • analogue-to-digital conversion through sampling • A picture is divided into blocks of 8x8 pixels • Picture (Image) Processing: source coding • forward DCT • Quantization: lossy • mapping of the real numbers into integers • Entropy Encoding: lossless • Run length coding • Huffman coding or Arithmetic coding Picture Preparation Picture Processing Quantization Entropy Encoding Compressed Picture Uncompressed Picture
Image Preparation • Separation of source image into color components • 1 ~ 255 components (or plane) • e.g.) 1 component for gray-scale image, 3 components for RGB, or YCbCr • Each component may have different horizontal resolution • e.g.) YUV: 4:2:0 format • Subdivision of components into 8x8 pixel blocks • noninterleaved date ordering: component by component • interleaved data ordering
Image/Block Preparation Block preparation
JPEG Compression/Decompression Compression Steps Decompression Steps
Discrete Cosine Transform • One-dimensional DCT: used in audio • Two-dimensional DCT: used in image • Spatial or temporal domain frequency domain • Each 8x8 block of samples is transformed • Intuition • Sampled values usually vary slightly from point to point • Coefficient of the low frequency high value • Coefficient of high frequencies small or zero • Human eyes is highly sensitive at low-intensity levels, whereas its sensitivity is greatly reduced at high-intensity levels • A reduction of the number of high-frequency DCT coefficients weakly affects image quality
Forward DCT (1) • In theory, DCT is lossless. • In practice, information is lost because of truncation errors in calculation • Forward DCT
Forward DCT (3) 64 DCT coefficients FDCT Frequency domain Spatial domain
64 DCT coefficients are quantized according to an quantization table specified by application. Lossy Quantization levels are different for each frequency more precise level for low freq. determined by experiments Quantization matrices are suggested by JPEG Quantization
Entropy Encoding • DC coefficients from consecutive DCT blocks • Differential encoding • AC coefficients • Run-length encoding • Then, Huffman encoding is used
Vectoring using zig-zag scan • Data reordering: zigzag sequence • low frequency comes first (larger values come first)
Differential Encoding • DC coefficients in consecutive quantized blocks • 12, 13, 11, 11, 10, … • 12, 1, -2, 0, -1, … • Encoded in the form (SSS, value), where SSS: # of bits needed to encode the value
Run-length Encoding • Remaining 63 AC coefficients in the vector may contain long strings of zeros • Use RLE: (skip, value), where skip: # of zeros in the run, value: next nonzero coefficient • (0,6)(0,7)(0,3)(0,3)(0,3)(0,2)(0,2)(0,2)(0,2)(0,0)(0,0) indicates the end of the string for this block • The value field is encoded in the form SSS/value
Huffman Encoding • JPEG provides the Huffman code tables used with DC and AC coefficients for both luminance and chrominance • Arithmetic encoding is also specified in JPEG, but protected by patent
Frame header contains Width and height of a complete image/picture Number and type of components (CLUT, RGB, YCbCr) Digitization format (4:2:2, 4:2:0, etc) Scan: contains a component Scan header contains Identity of components (R/G/B) # of bits used to digitize each component Quantization table Frame Building
JPEG Decoding • In progressive mode, first the DC and low-frequency coefficients of each block are sent • In hierarchical mode, the total image is first sent using a low resolution – i.e. 320x240 – then at high resolution 640x480