CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 1 CM613 Multimedia storage and retrieval Lossy Compression D.Miller.

Slides:



Advertisements
Similar presentations
T.Sharon-A.Frank 1 Multimedia Compression Basics.
Advertisements

M-JPEG M-JPEG April 15, 2015 INF5063: Programming heterogeneous multi-core processors.
School of Computing Science Simon Fraser University
JPEG.
Image (and Video) Coding and Processing Lecture: DCT Compression and JPEG Wade Trappe Again: Thanks to Min Wu for allowing me to borrow many of her slides.
CS :: Fall 2003 MPEG-1 Video (Part 1) Ketan Mayer-Patel.
JPEG Still Image Data Compression Standard
CMPT 365 Multimedia Systems
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Multimedia Data The DCT and JPEG Image Compression Dr Mike Spann Electronic, Electrical and Computer.
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.
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
1 JPEG Compression CSC361/661 Burg/Wong. 2 Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg.
Image Compression JPEG. Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg and can be embedded.
CSE679: MPEG r MPEG-1 r MPEG-2. MPEG r MPEG: Motion Pictures Experts Group r Standard for encoding videos/movies/motion pictures r Evolving set of standards.
Image and Video Compression
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
Lossy Compression Based on spatial redundancy Measure of spatial redundancy: 2D covariance Cov X (i,j)=  2 e -  (i*i+j*j) Vertical correlation   
JPEG C OMPRESSION A LGORITHM I N CUDA Group Members: Pranit Patel Manisha Tatikonda Jeff Wong Jarek Marczewski Date: April 14, 2009.
Chapter 2 Source Coding (part 2)
Introduction to JPEG Alireza Shafaei ( ) Fall 2005.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
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.
Image Processing and Computer Vision: 91. Image and Video Coding Compressing data to a smaller volume without losing (too much) information.
Multimedia Data DCT Image Compression
Indiana University Purdue University Fort Wayne Hongli Luo
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
JPEG CIS 658 Fall 2005.
Hardware/Software Codesign Case Study : JPEG Compression.
Understanding JPEG MIT-CETI Xi’an ‘99 Lecture 10 Ben Walter, Lan Chen, Wei Hu.
Digital Image Processing Image Compression
1 Image Formats. 2 Color representation An image = a collection of picture elements (pixels) Each pixel has a “color” Different types of pixels Binary.
Image Compression Fasih ur Rehman. Goal of Compression Reduce the amount of data required to represent a given quantity of information Reduce relative.
Compression There is need for compression: bandwidth constraints of multimedia applications exceed the capability of communication channels Ex. QCIF bit.
Compression video overview 演講者:林崇元. Outline Introduction Fundamentals of video compression Picture type Signal quality measure Video encoder and decoder.
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014.
The task of compression consists of two components, an encoding algorithm that takes a file and generates a “compressed” representation (hopefully with.
JPEG (Joint Photographic Expert Group)
JPEG Image Compression Standard Introduction Lossless and Lossy Coding Schemes JPEG Standard Details Summary.
JPEG.
CS654: Digital Image Analysis
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Introduction to JPEG m Akram Ben Ahmed
JPEG. Introduction JPEG (Joint Photographic Experts Group) Basic Concept Data compression is performed in the frequency domain. Low frequency components.
MPEG CODING PROCESS. Contents  What is MPEG Encoding?  Why MPEG Encoding?  Types of frames in MPEG 1  Layer of MPEG1 Video  MPEG 1 Intra frame Encoding.
By Dr. Hadi AL Saadi Lossy Compression. Source coding is based on changing of the original image content. Also called semantic-based coding High compression.
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM M ULTIMEDIA OF D ATA C OMPRESSION Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny.
1 Chapter 3 Text and image compression Compression principles u Source encoders and destination decoders u Lossless and lossy compression u Entropy.
JPEG Compression What is JPEG? Motivation
IMAGE COMPRESSION.
Chapter 9 Image Compression Standards
JPEG Image Coding Standard
Discrete Cosine Transform
JPEG.
Data Compression.
CMPT 365 Multimedia Systems
UNIT IV.
Judith Molka-Danielsen, Oct. 02, 2000
JPEG Still Image Data Compression Standard
Image Coding and Compression
Presentation transcript:

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 1 CM613 Multimedia storage and retrieval Lossy Compression D.Miller

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 2 What is “lossy compression” Trade-offs A design trade-off is necessary when there is a contradiction in requirements: Examples: Cost versus quality Cost versus performance Usability for occasional or inexperienced users versus power or flexibility for expert users. Size or download time versus resolution of image Decisions are made using criteria based on sufficiency for purpose.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 3 What is “lossy compression” In lossy compression, as opposed to “Lossless compression” data is compressed then decompressing so that the retrieved data, although different from the original, is still "close enough" to be useful in some way. Depending on the design of the format lossy data compression often suffers from generation loss, that is compressing and decompressing multiple times will do more damage to the data than doing it once.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 4 What is “lossy compression” There are two basic lossy compression schemes: Transform In lossy transform codecs, samples of picture or sound are taken, chopped into small segments, transformed into a new basis space, and quantized. The resulting quantized values are then given variable length codes, depending on their frequency of occurrence (entropy coding).

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 5 What is “lossy compression” The second type of scheme is: Predictive: In lossy predictive codecs, previous and/or subsequent decoded data is used to predict the current sound sample or image frame. The error between the predicted data and the real data, together with any extra information needed to reproduce the prediction, is then quantized and coded.quantized In some systems transform and predictive techniques are combined, with transform codecs being used to compress the error signals generated by the predictive stage.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 6 How it works: human perception perspective JPEG exploits the characteristics of human vision, eliminating or reducing data to which the eye is less sensitive. JPEG works well on grayscale and color images, especially on photographs, but it is not intended for two-tone images. Original Lena Image (12KB size) Lena Image, Compressed (85% less information, 1.8KB) Lena Image, Highly Compressed (96% less information, 0.56KB)

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 7 How it works: technical process Example: JPEG

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 8 JPEG (Joint Photographic Experts Group) JPEG (pronounced jay-peg) is a most commonly used standard method of lossy compression for photographic images. JPEG itself specifies only how an image is transformed into a stream of bytes, 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 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. JPEG/JFIF is the format most used for storing and transmitting photographs on the web.. 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

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 9 Baseline JPEG compression

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 10 YCbCb colour space is based on YUV colour space YUV signals are created from an original RGB (red, green and blue) source. The weighted values of R, G and B are added together to produce a single Y (lumsignal, representing the overall brightness, or luminance, of that spot. The U signal is then created by subtracting the Y from the blue signal of the original RGB, and then scaling; and V by subtracting the Y from the red, and then scaling by a different factor. This can be accomplished easily with analog circuitry.RGBredgreenblue The following equations can be used to derive Y, U and V from R, G and B: Y= 0.299R G B U= 0.492(B − Y)= − 0.147R − 0.289G B V= 0.877(R − Y)= 0.615R − 0.515G − 0.100B Y = luminance Cr, Cb = chrominance

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 11 Discrete cosine transform DCT transforms the image from the spatial domain into the frequency domain 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).discrete cosine transform The 64 DCT basis functions

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 12 …the coefficient in the output DCT matrix at (2,1) corresponds to the strength of the correlation between the basis function at (2,1) and the entire 8x8 input image block. The coefficients corresponding to high- frequency details are located to the right and bottom of the DCT block, and it is precisely these weights which we try to nullify -- the more zeroes in the 8x8 DCT block, the higher the compression that is achieved. In the Quantization step below, we'll discuss how to maximize the number of zeroes in the matrix.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 13 Quantization This is the main lossy operation in the whole process. After the DCT has been performed on the 8x8 image block, the results are quantized in order to achieve large gains in compression ratio. Quantization refers to the process of representing the actual coefficient values as one of a set of predetermined allowable values, so that the overall data can be encoded in fewer bits (because the allowable values are a small fraction of all possible values). Example of a quantizing matrix The aim is to greatly reduce 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. 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.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 14 Quantization Quantization is the key irreversible step in the jpeg process. Jpeg Quality Settings Typically the only thing that the user can control in Jpeg compression is the quality setting (and rarely the chroma sub-sampling). The value chosen is used in the quantization stage, where less common values are discarded by using tables tuned to visual perception. This reduces the amount of information while preserving the perceived quality.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 15 Zig-zag sorting The quantized data needs to be in an efficient format for encoding. The quantized coefficients have a greater chance of being zero as the horizontal and vertical frequency values increase. To exploit this behavior, we can rearrange the coefficients into a one- dimensional array sorted from the DC value to the highest-order spatial frequency coefficient

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 16 The first element in each 64x1 array represents the DC coefficient from the DCT matrix, and the remaining 63 coefficients represent the AC components. These two types of information are different enough to warrant separating them and applying different methods of coding to achieve optimal compression efficiency. All of the DC coefficients (one from each DCT output block) must be grouped together in a separate list. At this point, the DC coefficients will be encoded as a group and each set of AC values will be encoded separately.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 17 Coding the DC Coefficients The DC components represent the intensity of each 8x8 pixel block. Because of this, significant correlation exists between adjacent blocks. So, while the DC coefficient of any given input array is fairly unpredictable by itself, real images usually do not vary widely in a localized area. As such, the previous DC value can be used to predict the current DC coefficient value. By using a differential prediction model (DPCM), we can increase the probability that the value we encode will be small, and thus reduce the number of bits in the compressed image. To obtain the coding value we simply subtract the DC coefficient of the previously processed 8x8 pixel block from the DC coefficient of the current block. This value is called the "DPCM difference". Once this value is calculated, it is compared to a table to identify the symbol group to which it belongs (based on its magnitude), and it is then encoded appropriately using an entropy encoding scheme such as Huffman coding.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 18 Coding the AC Coefficients (Run-Length Coding) Because the values of the AC coefficients tend towards zero after the quantization step, these coefficients are run-length encoded. The concept of run-length encoding is a straightforward principle. In real image sequences, pixels of the same value can always be represented as individual bytes, but it doesn't make sense to send the same value over and over again. For example, we have seen that the quantized output of the DCT blocks produces many zero-value bytes. The zig-zag ordering helps produce these zeros in groups at the end of each sequence. Instead of coding each zero individually, we simply encode the number of zeros in a given 'run.' This run-length coded information is then variable-length coded (VLC), usually using Huffman codes.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 19 Entropy encoder Fixed length codes are most often applied in systems where each of the symbols occurs with equal probability. Example of a fixed length code In reality, most symbols do not occur with equal probability. In these cases, we can take advantage of this fact and reduce the average number of bits used to compress the sequence. This is a final lossless compression performed on the quantized DCT coefficients to increase the overall compression ratio achieved. Example of entropy encoding with weighted symbol probabilities. Entropy encoding is a compression technique that uses a series of bit codes to represent a set of possible symbols. The length of the code that is used for each symbol can be varied based on the probability of the symbol's occurrence. By encoding the most common symbols with shorter bit sequences and the less frequently used symbols with longer bit sequences, we can easily improve on the average number of bits used to encode a sequence.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 20 JPEG File Interchange Format (JFIF) The encoded data is written into the JPEG File Interchange Format (JFIF), which, as the name suggests, is a simplified format allowing JPEG-compressed images to be shared across multiple platforms and applications. JFIF includes embedded image and coding parameters, framed by appropriate header information. Specifically, aside from the encoded data, a JFIF file must store all coding and quantization tables that are necessary for the JPEG decoder to do its job properly.

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 21 So now we can all grow beards! Quality factor =20 Quality factor = 5 Quality factor = 3

CM613 Multimedia storage and retrieval Lecture: Lossy Compression Slide 22 Sources end