Image Processing Architecture, © 2001-2004 Oleh TretiakPage 1Lecture 3 ECE-C490 Winter 2004 Image Processing Architecture Lecture 3, 1/13/2004 Lossless.

Slides:



Advertisements
Similar presentations
Introduction to H.264 / AVC Video Coding Standard Multimedia Systems Sharif University of Technology November 2008.
Advertisements

15 Data Compression Foundations of Computer Science ã Cengage Learning.
Data Compression CS 147 Minh Nguyen.
Image Compression. Data and information Data is not the same thing as information. Data is the means with which information is expressed. The amount of.
T h e U n i v e r s i t y o f B r i t i s h C o l u m b i a Bi-Level Image Compression EECE 545: Data Compression by Dave Tompkins.
SWE 423: Multimedia Systems
2015/6/15VLC 2006 PART 1 Introduction on Video Coding StandardsVLC 2006 PART 1 Variable Length Coding  Information entropy  Huffman code vs. arithmetic.
Spatial and Temporal Data Mining
Fundamentals of Multimedia Chapter 7 Lossless Compression Algorithms Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
CMPT 365 Multimedia Systems
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
2015/7/12VLC 2008 PART 1 Introduction on Video Coding StandardsVLC 2008 PART 1 Variable Length Coding  Information entropy  Huffman code vs. arithmetic.
CS430 © 2006 Ray S. Babcock Lossy Compression Examples JPEG MPEG JPEG MPEG.
5. 1 JPEG “ JPEG ” is Joint Photographic Experts Group. compresses pictures which don't have sharp changes e.g. landscape pictures. May lose some of the.
Why Compress? To reduce the volume of data to be transmitted (text, fax, images) To reduce the bandwidth required for transmission and to reduce storage.
©Brooks/Cole, 2003 Chapter 15 Data Compression. ©Brooks/Cole, 2003 Realize the need for data compression. Differentiate between lossless and lossy compression.
Image and Video Compression
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
Software Research Image Compression Mohamed N. Ahmed, Ph.D.
Lossy Compression Based on spatial redundancy Measure of spatial redundancy: 2D covariance Cov X (i,j)=  2 e -  (i*i+j*j) Vertical correlation   
Basics of Compression Goals: to understand how image/audio/video signals are compressed to save storage and increase transmission efficiency to understand.
Huffman Coding Vida Movahedi October Contents A simple example Definitions Huffman Coding Algorithm Image Compression.
15-853Page :Algorithms in the Real World Data Compression II Arithmetic Coding – Integer implementation Applications of Probability Coding – Run.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
296.3Page 1 CPS 296.3:Algorithms in the Real World Data Compression: Lecture 2.5.
Klara Nahrstedt Spring 2011
Concepts of Multimedia Processing and Transmission IT 481, Lecture 5 Dennis McCaughey, Ph.D. 19 February, 2007.
JPEG. The JPEG Standard JPEG is an image compression standard which was accepted as an international standard in  Developed by the Joint Photographic.
JPEG CIS 658 Fall 2005.
8. 1 MPEG MPEG is Moving Picture Experts Group On 1992 MPEG-1 was the standard, but was replaced only a year after by MPEG-2. Nowadays, MPEG-2 is gradually.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 2 ECE-C490 Winter 2004 Image Processing Architecture Lecture 2, 1/8/2004 Lossless.
1 Classification of Compression Methods. 2 Data Compression  A means of reducing the size of blocks of data by removing  Unused material: e.g.) silence.
Lossless Compression CIS 465 Multimedia. Compression Compression: the process of coding that will effectively reduce the total number of bits needed to.
Image Compression – Fundamentals and Lossless Compression Techniques
1 Image Formats. 2 Color representation An image = a collection of picture elements (pixels) Each pixel has a “color” Different types of pixels Binary.
Huffman Code and Data Decomposition Pranav Shah CS157B.
Lecture 4: Lossless Compression(1) Hongli Luo Fall 2011.
Multimedia- and Web-based Information Systems Lecture 6.
CS654: Digital Image Analysis Lecture 34: Different Coding Techniques.
Digital Image Processing Lecture 22: Image Compression
JPEG (Joint Photographic Expert Group)
JPEG Image Compression Standard Introduction Lossless and Lossy Coding Schemes JPEG Standard Details Summary.
JPEG.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 4 ECE-C490 Winter 2004 Image Processing Architecture Lecture 4, 1/20/2004 Principles.
Chapter 7 Lossless Compression Algorithms 7.1 Introduction 7.2 Basics of Information Theory 7.3 Run-Length Coding 7.4 Variable-Length Coding (VLC) 7.5.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 7 ECEC 453 Image Processing Architecture Lecture 8, February 5, 2004 JPEG: A Standard.
1 Part A Multimedia Production Chapter 2 Multimedia Basics Digitization, Coding-decoding and Compression Information and Communication Technology.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 5 ECEC 453 Image Processing Architecture Lecture 5, 1/22/2004 Rate-Distortion Theory,
JPEG Compression What is JPEG? Motivation
IMAGE COMPRESSION.
Data Compression.
Algorithms in the Real World
Discrete Cosine Transform
JPEG.
Data Compression.
Image Compression Standards (JPEG)
Huffman Coding, Arithmetic Coding, and JBIG2
Data Compression CS 147 Minh Nguyen.
Context-based Data Compression
CMPT 365 Multimedia Systems
Why Compress? To reduce the volume of data to be transmitted (text, fax, images) To reduce the bandwidth required for transmission and to reduce storage.
UNIT IV.
JPEG Still Image Data Compression Standard
Image Coding and Compression
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Chapter 8 – Compression Aims: Outline the objectives of compression.
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Presentation transcript:

Image Processing Architecture, © Oleh TretiakPage 1Lecture 3 ECE-C490 Winter 2004 Image Processing Architecture Lecture 3, 1/13/2004 Lossless Coding Standards Oleh Tretiak Drexel University

Image Processing Architecture, © Oleh TretiakPage 2Lecture 3 Announcements Meeting room change: Tu, Th 11-12:20 in Curtis 328-B Homework 1 due today Homework 2 due on 20 January

Image Processing Architecture, © Oleh TretiakPage 3Lecture 3 Review: Entropy Coding Conversion from ‘symbols’ to ‘codes’ Symbols from ‘alphabet’ with N distinct ‘letters’ Without encoding, bits are needed per symbol With encoding, Information Theory tells us that we can compress to bits per symbol

Image Processing Architecture, © Oleh TretiakPage 4Lecture 3 Review: Coding Methods Huffman codes  Encode one symbol at a time  Minimum of one bit per source symbol

Image Processing Architecture, © Oleh TretiakPage 5Lecture 3 Code construction example A=k,w B=u,A C=B,? D=l,r E=e,C H = 2.55

Image Processing Architecture, © Oleh TretiakPage 6Lecture 3 Huffman and VLC For a Huffman code, H ≤ L ave ≤ H + 1 also 1 ≤ L ave Codes used in pactice are variable length tree codes, and are called Variable Length Codes (VLC) A VLC may not be as good as a Huffman code, but may have other good properties  Reduced max code word length  Simpler implementation

Image Processing Architecture, © Oleh TretiakPage 7Lecture 3 This Lecture Arithmetic Coding Run-length encoding Predictive encoding Lossless encoding standards  Fax  JBIG  Lossless JPEG

Image Processing Architecture, © Oleh TretiakPage 8Lecture 3 Huffman vs. Arithmetic Code Lowest L ave for Huffman codes is 1. Suppose H << 1?  One option: use one code symbol for several source symbols  Another option: Arithmetic code. Idea behind arithmetic code:  Represent the probability of a sequence by a binary number.

Image Processing Architecture, © Oleh TretiakPage 9Lecture 3 Arithmetic Encoding Assume source alphabet has values 0 and 1, p 0 = p, p 1 = 1 – p. A sequence of symbols s 1, s 2, … s m is represented by a probability interval found as follows:  Initialize, lo = 0; range = 1  For i = 0 to m  if s i = 0 range = range*p  else // s i = 1 lo = lo + range*p range = range*(1-p)  end  end Send binary fraction x such that lo ≤ x < hi. This will require

Image Processing Architecture, © Oleh TretiakPage 10Lecture 3 Arithmetic coding: example p 0 = 0.2, source sequence is 1101 Number of bits = ceiling(-log 2 (0.1024)) = 4 low 2 = , (low+range) 2 = Bits sent: 0111

Image Processing Architecture, © Oleh TretiakPage 11Lecture 3 Arithmetic Encoding Assume source alphabet has values 0 and 1, p 0 = p, p 1 = 1 – p. A sequence of symbols s 1, s 2, … s m is represented by a probability interval found as follows: Initialize, lo = 0; hi = 1; range = 1 For i = 0 to m if s i = 0 range = range*p 0 hi = lo + range else lo = lo + range*p 0 range = range*p 1 end Send binary fraction x such that lo ≤ x < hi. This will require ceiling(log 2 range) bits. Note that this is equal to

Image Processing Architecture, © Oleh TretiakPage 12Lecture 3 Review: Arithmetic encoding example p 0 = 0.2, source sequence is 1101 Number of bits = ceiling(-log2(0.1024)) = 4 Binary code for low: Binary code for high: Code sent: 0111 = X

Image Processing Architecture, © Oleh TretiakPage 13Lecture 3 Arithmetic Decoding We receive x, a binary fraction, p = prob(0) lo = 0; hi = 1; range = 1 for i = 1 to m if (x - lo) < p*range s i = 0 range = range*p hi = lo + range else s i = 1 lo = lo + range*p range = range*(1-p) end

Image Processing Architecture, © Oleh TretiakPage 14Lecture 3 Arithmetic decoding example Receive 0111 (0.4375), decode 4 bits, p 0 = 0.2

Image Processing Architecture, © Oleh TretiakPage 15Lecture 3 Arithmetic decoding example Receive 0111 (0.4375), decode 4 bits, p0 = 0.2

Image Processing Architecture, © Oleh TretiakPage 16Lecture 3 Magic Features of Arithmetic Coding Remember I (information) = - log 2 p  p = 0.5, I = 1  p = 0.125, I = 3  p = 0.99, I = 0,0145 (wow!) High p symbol, less than 1 code bit per symbol! In encoder, hi - lo = ∑ I(symbols)

Image Processing Architecture, © Oleh TretiakPage 17Lecture 3 Review: Typical Encoder System Reasons for pre-processing  Signal samples are independent, but the entropy coder (e. g. Huffman coder) cannot code them efficiently (match samples to coder)  Signal samples are statistically dependent. Pre-processing produces a sequence of new symbols that are statistically independent and can be coded more efficiently

Image Processing Architecture, © Oleh TretiakPage 18Lecture 3 Run-length Encoding Idea Pre-processing method, good when one symbol occurs with high probability or when symbols are dependent Count how many repeated symbol occur Source ‘letter’ = length of run

Image Processing Architecture, © Oleh TretiakPage 19Lecture 3 Run Length Encoding Example Example source produces ‘one’s and ‘zeros’, zeros Run length coding: 23, 3, 15, 3, 17, 3,17, 3, 17, 7, 4, 4, 6,... 20x18 array

Image Processing Architecture, © Oleh TretiakPage 20Lecture 3 Predictive Coding Example Idea, at transmitter predict the pixel value on the basis of past pixels Send ‘0’ if prediction is correct, ‘1’ if prediction is not correct 1-D example, binary picture  Prediction rule: previous value. If previous value = 0, predict 0; if previous value = 1, predict 1  Sequence (14 symbols, 7 zeros, 7 ones, p = 0.5, H = 1)  Coded sequence (10 symbols, 11 zeros, 3 ones, H = 0.75)

Image Processing Architecture, © Oleh TretiakPage 21Lecture 3 2-D Predictive Coding Image is 2-D array of 0’s and 1’s Scan left to right, top to bottom Previous sample prediction. 20x18 array Original Predicted

Image Processing Architecture, © Oleh TretiakPage 22Lecture 3 2-D Predictive Coding Image is 2-D array of 0’s and 1’s Scan left to right, top to bottom Predict on past sample and past line 20x18 array Original x - sample being predicted, a - previous sample, b, c - previous line. Prediction rule: majority value.

Image Processing Architecture, © Oleh TretiakPage 23Lecture 3 Lossless Encoding Standards Importance of Standards  Intercommunication Complexity of Standards  Many parts of standards are not implemented Some standards are very successful!  Some don’t get mentioned much at all…

Image Processing Architecture, © Oleh TretiakPage 24Lecture 3 Fax Standards Bilevel (binary) documents Both graphics and pictures (halftone) Halftone Graphic (line art)

Image Processing Architecture, © Oleh TretiakPage 25Lecture 3 ITU Standard Fax Methods International standards, vintage ~1980  Both analog and digital standards, only digital in use now ITU-T, Rec. T.4 (Group 3)  Code uses special symbols to indicate end-of-line, to recover from transmission errors.  MH (modified Huffman): run length coding, pre-defined code tables. Different tables for runs of ‘1’s and ‘0’s.  MR (modified read): run length measured from either previous line or current line.  Most common method used in practice ITU-T, Rec. T.6 (Group 5).  MMR (modified modified read): same as MR, except not robustified

Image Processing Architecture, © Oleh TretiakPage 26Lecture 3 JBIG: ISO Bilevel Standard Prepared by Joint Bilevel Image Group in ~ 1992 Features  Progressive (multiresolution) coding  Adaptive Model Templates  Adaptive Arithmetic Coding  Better compression than MMR  2-3 longer running time on conventional computers than MMR  Complex!

Image Processing Architecture, © Oleh TretiakPage 27Lecture 3 JBIG: Progressive Coding I d — full resolution image, each layer reduces resolution by 2 C 0 — code for base layer image, used to reconstruct I 0 I d is reconstructed from I d–1 and C d (bottom-up) Advantage: Full resolution image may be of graphics arts quality, cannot be displayed on monitor. Sometimes only base layer encoder is used.

Image Processing Architecture, © Oleh TretiakPage 28Lecture 3 JBIG: Encoder Structure The baselayer encoder is shown below. It consists of prediction algorithms followed by entropy coding with an adaptive arithmetic encoder The interlayer encoder is similar, except that it form its prediction from I d and I d–1 to generate C d

Image Processing Architecture, © Oleh TretiakPage 29Lecture 3 JBIG and Prediction Each pixel is predicted on the basis of a context. The context is 10 bits for baselayer coding and 12 bits in interlayer coding. The predictor consists of a table lookup into a table, indexed by the context. The table consists of 2 10 entries for baselayer and 2 12 entries for interlayer. Example of context in baselayer encoder: Templates: fixed and adaptive. The context is compared to a template. The coder can estimate templates from image data. This allows the detection of periodicities in a half-tone image.

Image Processing Architecture, © Oleh TretiakPage 30Lecture 3 JBIG Arithmetic Coding Encoder  Differences between predicted and actual bits are sent to an arithmetic encoder.  The JBIG arithmetic encoder is adaptive: p 1 is determined by the values of recently encoded bits.  Only 112 possible values of p 1 are used. Decoder  The value of p 1 in the decoder is computed from the bits already decoded (past bits) with the same algorithm as that in the encoder.  The decoder p 1 varies from bit to bit, just as in the encoder!

Image Processing Architecture, © Oleh TretiakPage 31Lecture 3 JBIG: context decoding The decoder has the same set of context values (previously decoded pixels) as the encoder. It performs the same context- based prediction. If the bit from the arithmetic decoder is 0, the predicted value is used. If the bit from the arithmetic decoder is 1, the predicted value is complemented.

Image Processing Architecture, © Oleh TretiakPage 32Lecture 3 JBIG Coding Performance Comparison with MMR (fax standard), business-type documents  Compression for letter (graphics) document  MMR: 33,JBIG: 48  Compression for halftone document  MMR: 1.5,JBIG: 5.2 JBIG is much better than MMR for high-resolution images JBIG has the advantage of progressive coding

Image Processing Architecture, © Oleh TretiakPage 33Lecture 3 New Work JBIG 2 is on the way! Visit the web site:  “JBIG2 is a format for bi-level (black/white) image compression that offers significant advantages over other compression formats:  large increases in compression performance (typically 3-5 times smaller than Group 4/MMR, 2-4 times smaller than JBIG1)  special compression methods for text, halftones, and other binary image content  lossy and lossless compression  multi-page document compression  flexible format, designed for easy embedding in other image file formats, such as TIFF  high-performance decompression: using some coding modes, images can be decompressed at over 250 million pixels/second in software” JBIG 2 document is on course web site.

Image Processing Architecture, © Oleh TretiakPage 34Lecture 3 JPEG Sources ISO standards cost money (not distributed on web) Excellent book:  William B Pennbaker and Joan L. Mitchell, JPEG Still Image Compression Standard, Van Nostrand Reinhold,  Includes ISO DIS Requirements and Guidelines (JPEG standard) ISO standard, in PDF is available on our web site

Image Processing Architecture, © Oleh TretiakPage 35Lecture 3 Lossless Coding of Grey-Value Images Not much compression  Rule of thumb: 50% compression Lossy compression used much more

Image Processing Architecture, © Oleh TretiakPage 36Lecture 3 JPEG: Overview Standards for color image compression (also usable for monochrome) Four modes  Sequential DCT (Discrete Cosine Transform) —lossy  Most common JPEG method  Progressive DCT (lossy), low resolution images sent first, then higher resolution  Lossless mode  Hierarchical (pyramid) mode. Like JPEG progressive  Baseline: low resolution image  Subsequent layers: difference between low resolution and higher resolution.  Layers sent with lossy or lossless modes

Image Processing Architecture, © Oleh TretiakPage 37Lecture 3 JPEG: Lossless Mode Entropy coding of image gray values usually offers very little compression Encode difference between predicted values and actual gray values Prediction context: previously coded lines previously coded sample on current line x — pixel being predicted

Image Processing Architecture, © Oleh TretiakPage 38Lecture 3 JPEG: Predictor Choices The same prediction choice is used for each group of several lines, and is transmitted in a header. Transmitted value: x - predicted value Our book: prediction value - x. Who is right?

Image Processing Architecture, © Oleh TretiakPage 39Lecture 3 Example: DPCM prediction This example: Selection-value = 1 (previous pixel)

Image Processing Architecture, © Oleh TretiakPage 40Lecture 3 JPEG: Encoding the Residuals Residuals (difference between pixel value and prediction) are encoded into one of 17 categories, as indicated in the table below The residual is encoded as a (category, value), except for category 0 the value is omitted. For category k the value is represented by a 2 k bit number, the last k bits of the 1’s complement value of the residual.  Example: residual = 5 (101 2 ) Category = 3, code = 101  Example: residual = -10, ( ) Category = 4, code = 0101 The category is Huffman-encoded, and the code is used without encoding.

Image Processing Architecture, © Oleh TretiakPage 41Lecture 3 JPEG Encoding: Continued Predictive encoding, Selection Value = 1

Image Processing Architecture, © Oleh TretiakPage 42Lecture 3 DPCM Lossless JPEG - More Example: a =100, b = 191, c =100, x = 180. Assume we are using selection value 7  prediction value = y = (a + b)/2 y = ( )/2 = 145 residual = = 35 =  Category = 6, code =  Assume that the Huffman code for 6 is The full code value for x is Same a, b, c, but x = 100  y = ( )/2 = 145 residual = = -45 =  Category = 6, code = (1’s complement of )

Image Processing Architecture, © Oleh TretiakPage 43Lecture 3 Gray Value Encoding in JBIG Encode each bit plane with JBIG  On the right, we show a gray-value (8 bit) image, and its top three bit planes Typically, lossless JPEG is more efficient than JBIG for images with more than 6 bits

Image Processing Architecture, © Oleh TretiakPage 44Lecture 3 New Work in JPEG JPEG-LS, (lossless and near lossless methods)  Influenced by JBIG Features:  Context modeling  Run-length coder  nonlinear predictor  Golomb-Rice entropy coder Context modeling:  Compute signature from gray value neighbors of point to be coded. 364 contexts (signature values)

Image Processing Architecture, © Oleh TretiakPage 45Lecture 3 New Work in JPEG Run-mode coder: encode constant values in image with run length (not much value in lossless version). Run-lengths are coded with Golomb-Rice method. Predictor: nonlinear predictor that automatically selects formula (edge detector) Error coding: use Golomb-Rice Code, the parameter k depends on the context, and is adapted to the average absolute value of residuals.

Image Processing Architecture, © Oleh TretiakPage 46Lecture 3 JPEG-LS performance Compression is about 10% better than JPEG-H (original lossless JPEG. Arithmetic coding has been considered, but it seems to offer an advantage only in compound documents (mixture of grayscale and line art).

Image Processing Architecture, © Oleh TretiakPage 47Lecture 3 JPEG 2000 New approach Wavelet encoding, both lossy and lossless Later