Lossy Compression Iii_1

Embed Size (px)

Citation preview

  • 8/10/2019 Lossy Compression Iii_1

    1/21

    LOSSY COMPRESSION III

  • 8/10/2019 Lossy Compression Iii_1

    2/21

    IntroductionCompression in all the lossy schemes is achievedthrough quantization.

    The process of representing a large possiblyinfinite set of values with a much smaller set iscalled quantization

    Example: Source generates numbers between -10.0and +10.0 Simple scheme is to represent eachoutput of the source with the integer value closer toit.

  • 8/10/2019 Lossy Compression Iii_1

    3/21

    IntroductionTwo types of quantization

    Scalar Quantization.Vector Quantization.

    The design of the quantizer has a significantimpact on the amount of compression (i.e.,rate) obtained and loss (distortion) incurred ina lossy compression scheme

  • 8/10/2019 Lossy Compression Iii_1

    4/21

    Scalar QuantizationMany of the fundamental ideas of quantization andcompression are easily introduced in the simplecontext of scalar quantization.

    Any real number x can be rounded off to the nearestinteger, say

    Q(x) = round(x)

    Maps the real line R (a continuous space) into adiscrete space.

  • 8/10/2019 Lossy Compression Iii_1

    5/21

    Scalar Quantization Quantizer: encoder mapping and decodermapping.

    Encoder mappingThe encoder divides the range of source into a numberof intervals Each interval is represented by a distinct codeword

    Decoder mappingFor each received codeword, the decoder generates ar econstr uct value

  • 8/10/2019 Lossy Compression Iii_1

    6/21

    Scalar Quantization Encoder mapping: Divides the range of values that thesource generates into a number of intervals. Each interval isthen mapped to a codeword. It is a many-to-one irreversiblemapping. The code word only identifies the interval, not theoriginal value.

    Codes

    000 001 010 011 100 101 110 111

    -3.0 -2.0 -1.0 0 1.0 2.0 3.0 input

  • 8/10/2019 Lossy Compression Iii_1

    7/21

    Scalar Quantization Decoder: Given the code word, the decodergives an estimated value that the source might

    have generated.

    Usually, it is the midpoint of the interval but a

    more accurate estimate will depend on thedistribution of the values in the interval.

  • 8/10/2019 Lossy Compression Iii_1

    8/21

    Mapping of a 3-bit Decoder

    Input Codes Output000 -3.5001 -2.5010 -1.5011 -0.5

    100 0.5101 1.5110 2.5111 3.5

  • 8/10/2019 Lossy Compression Iii_1

    9/21

    Encoder Decoder Example

  • 8/10/2019 Lossy Compression Iii_1

    10/21

    Scalar Quantization

    Quantization operation: Let M be the number of reconstruction levels

    where the decision boundaries are

    and the reconstruction levels are

    ii j b xbiff y xQ 1)(

    M ibi 0

    M ii y 1

  • 8/10/2019 Lossy Compression Iii_1

    11/21

    Scalar Quantization

    MSQE (mean squared quantization error)If the quantization operation is Q

    Suppose the input is modeled by a random variable Xwith pdf f X ( x). The MSQE is

    ii j b xbiff y xQ 1)(

    dx x f y xdx x f xQ x X

    M

    i

    b

    bi X q

    i

    i

    )()()())((1

    222

    1

  • 8/10/2019 Lossy Compression Iii_1

    12/21

    Scalar Quantization

    Rate of the quantizerThe average number of bits required to represent a

    single quantizer outputFor fixed-length coding, the rate R is:

    For variable-length coding, the rate will depend on the probability of occurrence of the outputs

    M

    i

    b

    b

    X i

    i

    i

    dx x f l R1 1

    )(

  • 8/10/2019 Lossy Compression Iii_1

    13/21

    Scalar Quantization

    Quantizer Design Problem :Given an input pdf f X (x) and the number of levels M in

    the quantizer, find the decision boundaries {b i} and thereconstruction levels {y i} so as to minimize the MSQE(Mean Square Quantization Error)

    dx x f y x

    dx x f xQ x

    X

    M

    i

    b

    bi

    X q

    i

    i

    )()(

    )())((

    1

    2

    22

    1

  • 8/10/2019 Lossy Compression Iii_1

    14/21

    Scalar Quantization

    Find the optimum partitions, codes and representationlevels

    Given a distortion constraint, find the decision boundaries,reconstruction levels, and binary codes that minimize therate, while satisfying the distortion constraint given above.

    Given a rate constraint find the decision boundaries,reconstruction levels, and binary codes that minimize thedistortion.

  • 8/10/2019 Lossy Compression Iii_1

    15/21

  • 8/10/2019 Lossy Compression Iii_1

    16/21

    Uniform Quantization of a UniformlyDistributed Source

  • 8/10/2019 Lossy Compression Iii_1

    17/21

    Uniform Quantization of a UniformlyDistributed Source

  • 8/10/2019 Lossy Compression Iii_1

    18/21

    Uniform Quantization of a UniformlyDistributed Source

    Summary:If the distortion constraint is given as D*, then step size can

    be calculated directly, since

    D* =

    M = (x max xmin)/

    If the rate constraint is given as R *, then M can be calculated,hence can be calculated.

    Then distortion is D =

    12

    2

    12

    2

  • 8/10/2019 Lossy Compression Iii_1

    19/21

    Example Image compression

    Assume Image pixels are uniformly distributed between 0& 255.

    1 bit/pixel [0,255] is divided into two intervals [0,127]and [128,255]

    Reconstruction levels midpoints of intervals {64, 196}.

    2 bits/pixel Four intervals [0,64,128,196,255] boundaries

    Reconstruction levels {32,96,160,224}

  • 8/10/2019 Lossy Compression Iii_1

    20/21

    UNIFORM QUANTIZATION EXAMPLE

  • 8/10/2019 Lossy Compression Iii_1

    21/21

    UNIFORM QUANTIZATION EXAMPLE