Lecture 6 Review of Lossless Coding (II)

Similar documents
Lecture 5 Lossless Coding (II)

Lecture 5 Lossless Coding (II) Review. Outline. May 20, Image and video encoding: A big picture

Bi-Level Image Compression

EE67I Multimedia Communication Systems Lecture 4

ECE 499/599 Data Compression & Information Theory. Thinh Nguyen Oregon State University

GUJARAT TECHNOLOGICAL UNIVERSITY

Lecture 8 JPEG Compression (Part 3)

Engineering Mathematics II Lecture 16 Compression

Multimedia Systems. Part 20. Mahdi Vasighi

Lecture 8 JPEG Compression (Part 3)

Distributed source coding

Simple variant of coding with a variable number of symbols and fixlength codewords.

Multimedia Networking ECE 599

Repetition 1st lecture

Chapter 1. Digital Data Representation and Communication. Part 2

Lecture Coding Theory. Source Coding. Image and Video Compression. Images: Wikipedia

Digital Communication Prof. Bikash Kumar Dey Department of Electrical Engineering Indian Institute of Technology, Bombay

Data Compression. An overview of Compression. Multimedia Systems and Applications. Binary Image Compression. Binary Image Compression

G64PMM - Lecture 3.2. Analogue vs Digital. Analogue Media. Graphics & Still Image Representation

Entropy Coding. - to shorten the average code length by assigning shorter codes to more probable symbols => Morse-, Huffman-, Arithmetic Code

IMAGE COMPRESSION. Image Compression. Why? Reducing transportation times Reducing file size. A two way event - compression and decompression

So, what is data compression, and why do we need it?

Fundamentals of Multimedia. Lecture 5 Lossless Data Compression Variable Length Coding

Chapter 7 Lossless Compression Algorithms

Features. Sequential encoding. Progressive encoding. Hierarchical encoding. Lossless encoding using a different strategy

EE-575 INFORMATION THEORY - SEM 092

CS 335 Graphics and Multimedia. Image Compression

7: Image Compression

Image coding and compression

Chapter 5 VARIABLE-LENGTH CODING Information Theory Results (II)

15 Data Compression 2014/9/21. Objectives After studying this chapter, the student should be able to: 15-1 LOSSLESS COMPRESSION

Welcome Back to Fundamentals of Multimedia (MR412) Fall, 2012 Lecture 10 (Chapter 7) ZHU Yongxin, Winson

compression and coding ii

IMAGE COMPRESSION- I. Week VIII Feb /25/2003 Image Compression-I 1

Image Coding and Compression

DigiPoints Volume 1. Student Workbook. Module 8 Digital Compression

2014 Summer School on MPEG/VCEG Video. Video Coding Concept

yintroduction to compression ytext compression yimage compression ysource encoders and destination decoders

Video Compression An Introduction

VC 12/13 T16 Video Compression

Lecture 5: Compression I. This Week s Schedule

CMPT 365 Multimedia Systems. Media Compression - Image

Digital Image Processing

Data Storage. Slides derived from those available on the web site of the book: Computer Science: An Overview, 11 th Edition, by J.

Wireless Communication

06/12/2017. Image compression. Image compression. Image compression. Image compression. Coding redundancy: image 1 has four gray levels

Lossy Coding 2 JPEG. Perceptual Image Coding. Discrete Cosine Transform JPEG. CS559 Lecture 9 JPEG, Raster Algorithms

JPEG: An Image Compression System. Nimrod Peleg update: Nov. 2003

ENSC Multimedia Communications Engineering Topic 4: Huffman Coding 2

Digital Image Representation Image Compression

Data Representation and Networking

Index. 1. Motivation 2. Background 3. JPEG Compression The Discrete Cosine Transformation Quantization Coding 4. MPEG 5.

Perceptual Coding. Lossless vs. lossy compression Perceptual models Selecting info to eliminate Quantization and entropy encoding

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF INFORMATION TECHNOLOGY ACADEMIC YEAR / ODD SEMESTER QUESTION BANK

Lec 04 Variable Length Coding in JPEG

End-to-End Data. Presentation Formatting. Difficulties. Outline Formatting Compression

Lecture 6: Compression II. This Week s Schedule

Operation of machine vision system

JPEG Modes of Operation. Nimrod Peleg Dec. 2005

Image Compression. CS 6640 School of Computing University of Utah

Arithmetic Coding. Arithmetic Coding

Intro. To Multimedia Engineering Lossless Compression

Compression II: Images (JPEG)

A Novel Image Compression Technique using Simple Arithmetic Addition

Ch. 2: Compression Basics Multimedia Systems

ITCT Lecture 8.2: Dictionary Codes and Lempel-Ziv Coding

EFFICIENT IMAGE COMPRESSION AND DECOMPRESSION ALGORITHMS FOR OCR SYSTEMS. Boban Arizanović, Vladan Vučković

David Rappaport School of Computing Queen s University CANADA. Copyright, 1996 Dale Carnegie & Associates, Inc.

Image, video and audio coding concepts. Roadmap. Rationale. Stefan Alfredsson. (based on material by Johan Garcia)

CoE4TN4 Image Processing. Chapter 8 Image Compression

Compression. storage medium/ communications network. For the purpose of this lecture, we observe the following constraints:

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

Data and information. Image Codning and Compression. Image compression and decompression. Definitions. Images can contain three types of redundancy

Source Coding Basics and Speech Coding. Yao Wang Polytechnic University, Brooklyn, NY11201

Bits and Bit Patterns

Dictionary techniques

Compression; Error detection & correction

Basic Compression Library

Lecture 13 Video Coding H.264 / MPEG4 AVC

Image compression. Stefano Ferrari. Università degli Studi di Milano Methods for Image Processing. academic year

ECE 417 Guest Lecture Video Compression in MPEG-1/2/4. Min-Hsuan Tsai Apr 02, 2013

Image Formats. Ioannis Rekleitis

The Standardization process

Fundamentals of Video Compression. Video Compression

IMAGE PROCESSING (RRY025) LECTURE 13 IMAGE COMPRESSION - I

Digital Communication Prof. Bikash Kumar Dey Department of Electrical Engineering Indian Institute of Technology, Bombay

Lossless compression II

Data Compression. Media Signal Processing, Presentation 2. Presented By: Jahanzeb Farooq Michael Osadebey

WIRE/WIRELESS SENSOR NETWORKS USING K-RLE ALGORITHM FOR A LOW POWER DATA COMPRESSION

CS/COE 1501

JPEG: An Image Compression System

Multimedia Communications ECE 728 (Data Compression)

Video Compression Standards (II) A/Prof. Jian Zhang

Compression; Error detection & correction

Interframe coding A video scene captured as a sequence of frames can be efficiently coded by estimating and compensating for motion between frames pri

Multimedia Systems Image III (Image Compression, JPEG) Mahdi Amiri April 2011 Sharif University of Technology

Image Coding and Data Compression

Introduction to Computer Science (I1100) Data Storage

Ch. 2: Compression Basics Multimedia Systems

7.5 Dictionary-based Coding

Transcription:

Shujun LI (李树钧): INF-10845-20091 Multimedia Coding Lecture 6 Review of Lossless Coding (II) May 28, 2009

Outline Review Manual exercises on arithmetic coding and LZW dictionary coding 1

Review

Lossy coding followed by lossless coding A/D Conversion Color Space Conversion Pre-Filtering Partitioning Predictive Coding Differential Coding Motion Estimation and Compensation Context-Based Coding Input Image/Video Pre- Processing Lossy Coding Lossless Coding Post- Processing (Post-filtering) Quantization Transform Coding Model-Based Coding Entropy Coding Dictionary-Based Coding Run-Length Coding Encoded Image/Video 3

Why do we need a new coding algorithm? Problems with Huffman coding Each symbol in X is represented by at least one bit. Coding for X n : A Huffman tree with X n nodes needs to be constructed. The value of n cannot be too large. Encoding with a Huffman tree is quite easy, but decoding can be difficult especially when X is large. Dynamic Huffman coding is slow due to the update of the Huffman tree from time to time. Solution: Arithmetic coding Encode a number of symbols (can be a message of a very large size n) incrementally (progressively) as a binary fraction in a real range [low, high) [0,1). 4

Arithmetic coding: An example X={A,B,C,D}, P=[0.6,0.2,0.1,0.1]. Input: x=acd Output: y [0.534, 0.54) 5

Arithmetic coding: Which fraction? Which fraction in [p c (x), p c (x)+p(x)) should be chosen? One proper choice: 1/2 l p(x)/2 l = dlog 2 (1/p(x))e +1 choose f(x) to be a binary integer i such that (i- 1)/2 l p c (x)<i/2 l <p c (x)+p(x) H b (P) L<H b (P)+2/n p c (x) i/2 l 0 1 Assuming the above choice is used to design a code f:x n Y*, it can be proved that f is a PF code. n can be as large as the size of the input message x. ) p(x) p c (x)+p(x) What is this? 6

Arithmetic coding: Termination problem Termination of the original message x Transmit the size of x to the decoder separately. Add an end of message symbol to X. Termination of the encoded bitstream f(x) Transmit the number of bits to the decoder separately. Use the choice of fraction introduced in last slide. Add an end of message symbol to X. 7

Arithmetic coding: Performance Arithmetic coding: H b (P) L<H b (P)+2/n Huffman coding: H b (P) L<H b (P)+1/n Arithmetic coding < Huffman coding? Theoretically yes if all the entropy coding schemes are working on the same source (X n,p n ). Practically no The complexity of almost all other entropy codes (including Huffman code and Shannon code) will soon reach its computational limit when n. But arithmetic coding works in an incremental way, so n can be as large as the size of the to-beencoded message itself. Arithmetic coding > Huffman coding! 8

Arithmetic coding: Noticeable features Non-block coding (Incremental coding) The output of an encoder is not the concatenation of codewords of consecutive symbols. Range coding The encoded message is actually a range in [0,1]. Separation between coding and the source s statistics The probability is used to divide a range with the coding process (instead of before it). Arithmetic coding is inherently dynamic/adaptive/contextbased coding. Patent-Cumbered A variant called Range Coding is patent-free. 9

Arithmetic coding: Practical issues Finite-precision problem Approximating probabilities and the arithmetic operations in finite-precision loss of coding efficiency, but negligible if the precision is high enough. Common bits of the two end points can be removed immediately and sent out. A renormalization process is needed to re-calculate the new values of the two end points. Carry-over/propagation problem A carry (caused by the probability addition) may propagate over q bits (such as 0.011111110 0.100000000 ), so an extra register has to be used to track this problem. 10

Binary arithmetic coding Solution to carry-over problem X=Y={0,1}, P=[p 0,1-p 0 ] n-bit finite precision is used: initially, [0,1) [0,2 n -1) Update the range as usual: low =low or low+(high-low)*p 0, high =low+(high-low)*p 0 or high. Do nothing if high-low 2 n-1 Do renormalization when high-low<2 n-1 When low, high<2 n-1 output a 0-bit, and [0,2 n-1 ) [0,2 n -1). When low, high 2 n-1 output a 1-bit, subtract 2 n-1 from low, high, and [2 n-1,2 n -1) [0,2 n -1). low<2 n-1 (low=01 ) but high 2 n-1 (high=10 ) store an unknown bit (which is the complement of the next known bit) in the buffer, subtract 2 n-2 from low, high, and [2 n-2,2 n-1 +2 n-2 ) [0,2 n -1) After all symbols are encoded, terminate the process by sending out a sufficient number of bits to represent the value of low. 11

Binary arithmetic coding 12

Multiplication-free implementation For binary arithmetic coding, we can further approximate high-low α=¾ ( high-low=½~1) Then, the update of low and high can be approximated without doing the multiplication. The optimal value of α is actually depends on the probability p 0, and in most cases smaller than ¾ (typical value is ⅔ or around 0.7). When p 0 >1/(2α)=⅔, it is possible αp 0 >½>high-low, so high <low, which is a big mistake. Solution: dynamically exchange p 0 and p 1 such that p 0 <½ always holds. 0 = LPS (less/least probable symbol) and 1 = MPS (more/most probable symbol). 13

Dictionary coding: The basic idea Use a dictionary and encode a symbol or a sequence of symbols as the index of the dictionary. The dictionary can be static (such as in Digram coding) or dynamic (such as in LZ coding family). The dictionary can be implicit (such as in LZ77) or explicit (such as in LZ78). The dictionary can be considered as an (maybe very rough) approximation of the probability distribution of the source. 14

LZ77 LZ78 LZW LZ77 (Sliding window compression) A search buffer which includes a finite number of encoded is used as an implicit dictionary. Output: (o, l, S). LZ78 An explicit dictionary is constructed from empty by adding new symbols or sequences of symbols into it. Output: (i, S) LZW (Patent-Cumbered) An explicit dictionary is initialized to include all single symbols and then expanded to include sequences of symbols. Output: i. 15

1-D run-length coding Statistical model: Discrete Markov Source S={S 1,S 2 } with 4 transition probabilities: P(S i /S j ), i, j {1,2}. S 1 S 2 P(S 1 /S 1 ) P(S 2 /S 2 ) P(S 2 /S 1 ) P(S 1 /S 2 ) Runs: Repetition of symbols S 1 or S 2 How to code: (S i, Run1,Run2, ) All the run-lengths form a new random source, which can be further coded with a (modified) Huffman coder or a universal code. 16

How entropy coding is used Huffman/Arithmetic coding + Dictionary coding + Universal codes + Predictive coding Spatial difference tends to have a monotonic probability distribution Universal codes + Run-length coding The run-length pairs tends to have a monotonic probability distribution 17

Lossless image coding standards JBIG (Joint Bi-level Image Experts Group): QM-coder Lossless JPEG family: Huffman coding/arithmetic coding JBIG 2: MQ-coder GIF (Graphics Interchange Format): LZW PNG (Portable Network Graphics): DELATE = LZ77 + Huffman coding TIFF (Tagged Image File Format): RLE, LZW Compressed BMP and PCX: RLE 18

Manual Exercises

Test arithmetic coding X={A,B,C}, P={0.5,0.3,0.2} x= bcac Please try to find a fraction to as the encoded result of x. Please try to find the proper binary fraction according to the rule l = dlog 2 (1/p(x))e +1 20

Testing LZW X={a,b,c,d,e} Try to encode the following two messages and see how the dynamic dictionaries will be constructed. x= aaaaa x= abcdabc Reference: Khalid Sayood, Introduction to Data Compression, Section 5.4.2 The LZ78 Approach, pp. 130-133, 3rd Edition, Morgan Kaufmann, 2005 21