Concepts of Multimedia Processing and Transmission IT 481, Lecture 5 Dennis McCaughey, Ph.D. 19 February, 2007
02/12/2007 Dennis Mccaughey, IT 481, Spring GIF Compression Principles: Basic Operational Mode
02/12/2007 Dennis Mccaughey, IT 481, Spring GIF Compression Principles: Dynamic Mode Using LZW Encoding
02/12/2007 Dennis Mccaughey, IT 481, Spring GIF interlaced mode
02/12/2007 Dennis Mccaughey, IT 481, Spring ITU-T Facsimile Standards T2 (Group1) – no longer used T3 (Group 2) – no longer used T4 (Group 3) –Intended for use with modems on analog PSTN lines T6 (Group 4) –All digital for use with digital networks such as ISDN Compression ratios of 10:1 are common
02/12/2007 Dennis Mccaughey, IT 481, Spring Termination and Make-up Codes Termination Codes –White or black run-lengths from 0 to 63 pixels Make-up Codes –For run lengths that are multiples of 64 pixels Overscanning –All lines start with a minimum of one white pixel –Receiver knows the first codeword relates to white pixels and the alternates between black and white Since two code tables are used they are denoted Modified Huffman Codes Examples: –Run-length of 12 black pixels is encoded –A Run-length of 140 black pixels = is encoded as
02/12/2007 Dennis Mccaughey, IT 481, Spring Group 3 (T4) Group 3 provides no error correction –If one or more pixels is corrupted, receiver will lose synchronization –Each line is terminated with a known EOL code –If synch is lost receiver searches for the EOL code and if not found within a preset number of lines, it aborts the reception process and informs the sending machine the sending machine to terminate One dimensional process –Works well for documents contain significant areas of black and white pixels such as letter documents –For documents containing half-tones it can result in a negative compression ratio
02/12/2007 Dennis Mccaughey, IT 481, Spring Group 4 (T6) T6 is an optional feature in Group 3, but is compulsory in Group 4 2-D scheme –Identified black and white run-lengths by comparing adjacent scan lines –Known as Modified Relative Element Address Designate (READ) (MMR) coding MMR encoding exploits the fact that most scan lines differ from the previous ones by only a few pixels –Always assume the first reference line is an imaginary “all white” line
02/12/2007 Dennis Mccaughey, IT 481, Spring Modified READ Coding Procedure
02/12/2007 Dennis Mccaughey, IT 481, Spring Two-Dimensional Code Table Additional Codes necessary to identify mode Extension Mode –Aborts the encoding prematurely before the end of the page –Allows a portion of the page to e sent in its uncompressed form or with a different encoding scheme Mode Run- Length AbbreviationsCodeword Passb1b2b1b2 P0001+b 1 b 2 Horizontala 0 a 1,a 1 a 2 H001+a 0 a 1 +a 1 a 2 Vertical a 1 b 1 = 0 a 1 b 1 = -1 a 1 b 1 = -2 a 1 b 1 = -3 a 1 b 1 = +1 a 1 b 1 = +2 a 1 b 1 = +3 V(0) V R (1) V R (2) V R (3) V L (1) V L (2) V L (3) Extensions
02/12/2007 Dennis Mccaughey, IT 481, Spring Figure 3.11
02/12/2007 Dennis Mccaughey, IT 481, Spring Some example run-length possibilities: pass mode This is the case when the run-length in the reference line (b 1,b 2 ) is to the left of the next run-length in the coding line ( a 1,a 2 ), that is b 2 is to the left of a 1. The run-length b 1 b 2 is coded using the code words given in Figure 3.11 If the next pixel on the coding line, a 1, is directly below b 2 this is not pass mode
02/12/2007 Dennis Mccaughey, IT 481, Spring Some example run-length possibilities: vertical mode This is the case when the run-length in the reference line (b 1,b 2 ) overlaps the next run-length in the coding line (a 1,a 2 ) by a maximum of + 3 pixels that is b 2 is to the left of a 1. Two examples are shown, and for this mode just the difference run length a 1 b 2 is coded Most codewords are in this category
02/12/2007 Dennis Mccaughey, IT 481, Spring Some example run-length possibilities: horizontal mode This is the case when the run-length in the reference line (b 1,b 2 ) overlaps the next run-length in the coding line (a 1,a 2 ) by more than + 3 pixels that is b 2 is to the left of a 1. Two examples are shown, and for this mode the two run-lengths a 0 a 1 and a 1 a 2 are coded using the code words given in Figure 3.11
02/12/2007 Dennis Mccaughey, IT 481, Spring JPEG Joint Photographic Experts Group Standard- ISO/IEC10918 Lossy algorithm Focus attention on the Baseline Mode Five main stages 1.Image/Block Preparation 2.Forward DCT 3.Quantization 4.Entropy Encoding 5.Frame Building
02/12/2007 Dennis Mccaughey, IT 481, Spring JPEG Encoder Schematic
02/12/2007 Dennis Mccaughey, IT 481, Spring Image/block preparation: image preparation Block Image planes into 8x8 Blocks Can use either: R,G,B or Y,Cb,Cr
02/12/2007 Dennis Mccaughey, IT 481, Spring Image/block preparation: block preparation
02/12/2007 Dennis Mccaughey, IT 481, Spring Forward DCT
02/12/2007 Dennis Mccaughey, IT 481, Spring DCT Computation Features
02/12/2007 Dennis Mccaughey, IT 481, Spring Quantization Eye responds primarily to the DC and lower frequency components –If the magnitude of the higher frequency components is less than a certain threshold the eye will not perceive it –Within the quantization process frequencies below a threshold are zeroed Quantization process reduces the magnitude of the DC and the AC coefficients so that less bandwidth is required for transmission This is achieved by dividing the coefficients by a normalization matrix which will zero the smaller coefficients
02/12/2007 Dennis Mccaughey, IT 481, Spring Example computation of a set of quantized DCT coefficients
02/12/2007 Dennis Mccaughey, IT 481, Spring Observations The computation of the quantized coefficients involves divideing the coefficients by a normalization factor and rounding the coefficients to the nearest integer value The normalization values used, in general, increase in magnitude with increasing spatial frequency The DC coefficient in the matrix is the largest Many of the higher frequency coefficients are zero
02/12/2007 Dennis Mccaughey, IT 481, Spring Example 3.4
4. Entropy Coding
02/12/2007 Dennis Mccaughey, IT 481, Spring Vectoring Using a Zigzag Scan: (a) Principle; (b) for previous example AC ={(0,6) (0,7) (0,3) (0,3) (0,3) (0,2) (0,2) (0,2) (0,2) (0,0)}
02/12/2007 Dennis Mccaughey, IT 481, Spring AC Coefficient Encoding AC coefficients are encoded within a block using run-length coding Most coefficients are zeros due to normalization Codes indicate the length of the zero run- length and the coefficient value terminating it. i.e. –(Skip, Value) (Skip, Value) are mapped to (SSS, Value) –SSS is Huffman Encoded, Value is encoded in 1’s complement binary code words of length specified by SSS
02/12/2007 Dennis Mccaughey, IT 481, Spring SSS vs. Value Null 0,1 00,01,10,11 000,001,010,011,100,101,110, ,1 -3,2,2, , …-8,8…15 -31…,-16,16… ….-32,32… ……-64,64…… … ,128…… …… ,256……… ….…..-512,512……… ….....,-1023,1023…..… Encoded ValueSSSDifference Value
02/12/2007 Dennis Mccaughey, IT 481, Spring Process
02/12/2007 Dennis Mccaughey, IT 481, Spring Default Huffman Code Words for SSS (DC Coefficients)
02/12/2007 Dennis Mccaughey, IT 481, Spring DC Coefficients DC coefficients are differentially encoded across the blocks –Takes advantage of the local correlation in the average value among local blocks –{12,13,11,11,10} -> {12,1,-2,0,-1}
02/12/2007 Dennis Mccaughey, IT 481, Spring Frame Building Frame Header –Overall width and height of the image in pixels –The number and type of components that are used to represent the image (CLUT, RGB, YC b C r ) –Digitization format used: (4:2:2,4;2;0, etc) Scan Header –Identity of the components (RGB etc) –The number of bits used to digitize each component; –The quantizatio table of values used to encode each component
02/12/2007 Dennis Mccaughey, IT 481, Spring JPEG Encoder Output Bit Stream Format
02/12/2007 Dennis Mccaughey, IT 481, Spring JPEG decoder schematic