Vous êtes sur la page 1sur 11

3.

5 Golomb Codes
Assumption: Larger the integer, lower is its probability of occurrence Adopted (modified version) In JPEG-LS (lossless and near lossless of continuous tone still images). (http://hpl.hp.com/loco) Also http://www.ece.ubc.ca/image

Unary code for positive integers n 1s followed by a 0 n = 4, code 11110 n = 5, code 111110

Golomb Code:

Split integer into two parts : 1) unary code 2) different code

Ex: integer n (n>0) (m>0) Represent n>0, using q and r q= , r = n - qm (m = parameter)

q = quotient, use unary code to represent q r = remainder = 0,1,2..m-1 n = qm+r In H.264 baseline, profile all syntax elements other than transform coefficients, are coded using FLC or exponential Golomb VLC.
P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 1

If m is a power of two, use log2m bit representation of r Otherwise use bit representation

Alternate:

Use

-bit representation for the first

-m values

and bit binary representation of r+ rest of the values.

-m for the

Ex. 3.5.1 Golomb code Design Golomb code for m = 5 = 3, =2

-m = 8-5 = 3

r = 0,1,2] r = 3,4 3 bit representation of r+3 codeword for 3 0110

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 2

codeword for 21 q=

1111001 = 4 11110

r = 1 01 For m = 5 n = 21 Represent quotient q by its unary code = 3, =2

q=

, r = n qm

q is represented by unary code

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 3

3.7 Tunstall Codes

B.P. Tunstall Synthesis of noisless compression codes Ph.D. Thesis, Georgia Tech, Sept 1967. All codewords are of equal length. Decoding is simple. Errors in codewords do not propagate. Each codeword represents a different number of letters. Ex. 3.7.1 Alphabet A = {A, B} Encode the sequence
P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 4

(use table 3.18) 1. Able to parse a source output sequence into sequences of symbols that appear in the codebook. 2. Maximize the average number of source symbols represented by each codeword. (use table 3.19)

Table 3.19 is not a desirable code for this sequence Tunstall codes Derive n-bit Tunstall code for a source that generates iid letters from an alphabet of size N. Number of codewords = 2n 3 bit Tunstall codes A = (A, B, C) P(A) = 0.6 P(B) = 0.3 P(C) = 0.1

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 5

Table 3.21: Remove A in Table 3.20, highest probability and add two letter strings starting with A

Table 3.22: Remove AA in Table 3.21, highest probability and add 3 letter strings with AA. Next iteration

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 6

Codebook size = 10>8 Go back to previous iteration 3-bit Tunstall code is table 3.22

Remove B Add BA, BB, BC. Each stage codebook size increases by (N-1).

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 7

Figure 3.10: Test Images a b c d a) Sena, b) Sensin, c) Earth, d) Omaha

8 bit PCM, (0-255) levels Number of pixels = (256)2 = 65536

Code: (xn-xn-1) 0 0 0 0 0 0 0 0 0 0 xn-2 xn-1 xn


P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 8

Huffman code for 8 bit PCM (0-255) levels. Generate Huffman code for each image and use this code to encode the image. This is a two pass system. Compression Ratio (CR) = Includes number of bits needed to store the Huffman code Code = = xn-1 , i.e, previous pel predictor = prediction error, residual x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x (First pel in any row, assume previous pel intensity is 128 for 8 bit pixel.)

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 9

Exponential Golomb codes [1],[2] (for data elements other than transform coefficients these codes are actually fixed and are also called Universal Variable Length Codes (UVLC). code Num 0 1 2 3 4 5 6 7 8 code 1 010 011 00100 00101 00110 00111 0001000 0001001 code Num 9 10 11 12 13 14 15 16 17 code 0001010 0001011 0001100 0001101 0001110 0001111 000010000 000010001 000010010

Golomb Codes Some Applications


P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 10

1) H.264/AVC Advanced Video Coding [3] 2) AVS China. [4] 3) JPEG-LS (lossless and near lossless) [5] References [1] R. Yu et al, Bit-plane Golomb coding for sources with Laplacian distribution, IEEE ICASSP, vol. 4, pp. 277-280, April 2003. [2] W. Di et al, An exp-Golomb encoder and decoder architecture for JVT/AVS Proc., 5th International ASIC Conference, vol.2, pp. 910-913, 2003. [3] I. E. Richardson, The H.264 Advanced Video Compression standard, 2 nd edition, Hoboken, NJ:, Wiley, 2010. [4] L. Yu et al, Overview of AVS video coding standard, SP:IC, vol. 24, pp. 263-267, April 2009. [5] M.J. Weinberger, G. Seroussi and G. Sapiro, The LOCO-I Lossless Image Compression Algorithm: Principles and Standardization into JPEG-LS, IEEE Trans. On Image Processing, vol. 9 pp. 1309-1324, Aug. 2000.

P.S: These notes are adopted from K. Sayood, Introduction to data compression, San Francisco, CA: 3rd Edition, Morgan Kaufmann, 2006. Page 11

Vous aimerez peut-être aussi