main datacompression

48
  Data Compression Topic : Source Coding

Upload: mad-hu

Post on 05-Oct-2015

213 views

Category:

Documents


0 download

DESCRIPTION

data compression presentation

TRANSCRIPT

  • Data Compression

    Topic : Source Coding

  • Data Compression Why ?Storing or transmitting multimedia data requires large space or bandwidthThe size of one hour 44K sample/sec 16-bit stereo (two channels) audio is 3600x44000x2x2= 633.6MB, which can be recorded on one CD (650 MB). MP3 compression can reduce this number by factor of 10The size of a 500x500 color image is 750KB without compression (JPEG can reduced this by a factor of 10 to 20)The size of one minute real-time, full size, color video clip is 60x30x640x480x3= 1.659GB. A two-hour movie requires 200GB. MPEG2 compression can bring this number down to 4.7 GB (DVD)

  • the need for compressionImage: 6.0 million pixel camera, 3000x2000 18 MB per image 56 pictures / 1GB

    Video: DVD Disc 4.7 GBvideo 720x480, RGB, 30 f/s 31.1MB/secaudio 16bits x 44.1KHz stereo 176.4KB/s 1.5 min per DVD disc

    Send video from cellphone: 352*240, RGB, 15 frames / second3.8 MB/sec $38.00/sec levied by AT&T

  • what can we compress?Goals of compressionRemove redundancyReduce irrelevance

    irrelevance or perceptual redundancynot all visual information is perceived by eye/brain, so throw away those that are not.

  • what can we compress?Goals of compressionRemove redundancyReduce irrelevance

    redundant : exceeding what is necessary or normal symbol redundancythe common and uncommon values cost the same to storespatial and temporal redundancyadjacent pixels are highly correlated.

  • IntroductionCompression is a way to reduce the number of bits in a frame but retaining its meaning.Decreases space, time to transmit, and costTechnique is to identify redundancy and to eliminate itIf a file contains only capital letters, we may encode all the 26 alphabets using 5-bit numbers instead of 8-bit ASCII code

  • IntroductionIf the file had n-characters, then the savings = (8n-5n)/8n => 37.5%

  • Compression can be categorised in two broad ways: Lossless Compression where data is compressed and can be reconstituted (uncompressed) without loss of detail or information. These are referred to as bit-preserving or reversible compression systems also. Lossy Compression where the aim is to obtain the best possible fidelity for a given bit-rate or minimizing the bit-rate to achieve a given fidelity measure. Video and audio compression techniques are most suited to this form of compression.

  • Broad ClassificationEntropy Coding (statistical)lossless; independent of data characteristicse.g. RLE, Huffman, LZW, Arithmetic codingSource Codinglossy; may consider semantics of the datadepends on characteristics of the datae.g. DCT, DPCM, ADPCM, color model transformHybrid Coding (used by most mm systems)combine entropy with source encodinge.g., JPEG, H.263, MPEG-1, MPEG-2, MPEG-4

  • Compression methods

    Entropy CodingRun-length CodingHuffman CodingArithmetic CodingPredictionDPCMDMTransformationFFTSource CodingDCTLayered CodingBit PositionSub-samplingSub-band CodingVector QuantizationHybrid CodingJPEGMPEGH.261DV1 RTV, DV1 PLV

  • Source Coding vs. Channel CodingSource CodingChannel CodingDecoding

  • Source Encoding TechniquesTransformation encodingTransform the bit-stream into another domainData in the new domain more amenable to compressionType of transformation depends on dataImage/video transformed from time domain into frequency domain (DCT)

  • Source Coding (Data Compression)Exploit the redundancy in the source to reduce the data required for storage or for transmissionHighly complex encoders are required for compression (MPEG, H.264 )However, Simple decoders !The Highly complex encoders requireBulky handsets Power consumptionBattery Life

  • How Source Coding WorksTypes of redundancySpatial redundancy - Transform or predictive codingTemporal redundancy - Predictive codingIn predictive coding, the next value in the sequence is predicted from the past values and the predicted value is subtracted from the actual valueThe difference is only sent to the decoderLet the Past values are in C, the predicted value is y = f(C). If the actual value is x, then (x y) sent to the decoder.

  • How Source Coding WorksDecoder, knowing the past values C, can also predict the value of y. With the knowledge of (x y), the decoder finds the value of x, which is the desired value

  • xPast Values (C)Predictiony-+x - yEncoder Decoder

  • Differential/Predictive EncodingEncoding the difference between actual value and a prediction of that valueHow they work?When consecutive change littleSuited for audio and videoPredictive coding simply means transmitting differencesPredict the next sample as being equal to the current sampleMore complex prediction schemes can be usedInstead of sending the current sample, send the error involved in the previous assumption

  • Predictive CodingNumber of TechniquesDifferential Pulse Code Modulation (DPCM)Delta Modulation (DM)Adaptive Pulse Code Modulation (APCM)

  • Lossless Predictive CodingFormally, define the integer signal as the set of values fn. Then, we predict values f^n and compute the error en as follows:

    when t = 1, we get ...Usually, t is between 2 and 4 (in this case it is called a linear predictorWe might need to have a truncating or rounding operation following the prediction computation

  • Lossless Predictive Coding

  • Lossless Predictive Coding: ExampleConsider the following predictor:

    Show how to code the following sequence

  • Differential Encoding for AudioDifferential Pulse Code Modulation(DPCM)When we use PCM, we get a sequence of PCM coded samples.Represent first PCM sample as a whole and all the following samples as differences from the previous one.PreviousSampleDifferenceSample++PreviousSampleSampledifference+-DPCMEncoderDPCMDecoder

  • Lossy Predictive Coding: DPCMDPCM = Differential Pulse Code ModulationForm the prediction f ^nForm an error enQuantize the error

  • Lossy Predictive Coding: DPCM

  • Lossy Predictive Coding: DPCMExample

  • Differential Pulse Code Modulation (DPCM)Encode the changes between consecutive samplesExample

    The value of the differences between samples are much smaller than those of the original samples. Less bits are used to encode the signal (e.g. 7 bits instead of 8 bits)

  • DPCM decodingThe difference is added to the previous sample to obtain the value of the current sample.

  • Delta ModulationModification of DPCMUses only 1 bit to encode difference.Sets 1 if the difference increasesSets 0 if the difference decreasesLeads to inaccurate coding

  • Delta ModulationDM (Delta Modulation) is a simplified version of DPCM that is used as a quick analog-to-digital converter.

    Note that the prediction simply involves a delay

  • Adaptive DPCM (ADPCM)One observation is that small difference between samples happens more often than large changesEntropy coding method such the Huffman coding scheme can be used to encode the difference for additional efficiency

  • JPEG Encoding- DCTDCT: Discrete Concise TransformDCT transforms the 64 values in 8x8 pixel block in a way that the relative relationships between pixels are kept but the redundancies are revealed.Example: A gradient grayscale

  • Discrete Cosine Transform (DCT)DCT is the real part of the 2D Fourier transform

    The inverse DCT is

  • DCT Transform of 2D Images DCT Example

    DCT of images can also be considered as the projection of the original image into the DCT basis functions. Each basis function is in the form of

  • JPEG Discrete Cosine TransformDCT transforms the data from a spatial domain to a frequency domain. It removes redundancy in the data.It is proven to be the optimal transform for large classes of images.The DCT algorithm is symmetrical, and an inverse DCT algorithm can be used to decompress an image.The DCT coefficients of each 8x8 blocks are calculated using the formula below.

  • JPEG Discrete Cosine TransformHere is an example. On the left is the 8 x 8 block of pixels, and on the right is the DCT coefficients.

  • JPEG - Quantization

    The DCT output matrix is quantized to reduce the precision of the coefficients. This increases the compression DCT(0, 0) is known as the DC coefficient which represents the basic colour, i.e., wave-length, of the image blockThe other DCT coefficients are known as AC coefficients which represent the frequency components of the data block. AC coefficients further away from the DC coefficient can be dropped to reduce the data sizeJPEG baseline algorithm defines a set of quantization tablesEach element q in the table, known as quantum is used in the following formula to calculate the quantized coefficients Q:

  • Vector QuantizationDivide the data stream into blocks or vectorsOne or two dimensional blocksUse codebooksFind the closest symbol in codebook for a given sampleTransmit the reference to that symbolCodebook present at sender/receiverWhen no exact match, could send the errorLossy or losslessUseful with known signal characteristicsConstruct codebooks that can match a wide range of symbols

  • Codewords in 2-dimensional space. Input vectors are marked with an x, codewords are marked with red circles, and the Voronoi regions are separated with boundary lines. Vector Quantization Two Dimensional Voronoi Diagram

  • Vector QuantizationSource ImageTraining Vector

    123..

    ..

  • Vector QuantizationCodebook DesignTraining VectorCodebook Table

  • Vector QuantizationNew Image (Index Table)Codebook Table

  • The Schematic of a Vector QuantizerBlock diagram of Vector Quantization Intro.(1)

  • The Schematic of a Vector Quantizer

  • Compression FormulaAmount of compression:Codebook size is K, input vector of dimension LIn order to inform the decoder of which code vector is selected, we need to use bits.

    E.g. need 8 bits to represent 256 code vectors.Rate: each code vector contains the reconstruction value of L source output samples, the number of bits per sample would be: .

    Sample: a scalar value in vector.K: level of vector quantizer.

  • SummaryFor Audio and Vedio compression , we use the technique of Differential /Predictive Coding with quantization.For an Image compression, we can use DCT methode with quantization.

  • Thanks For Your Attention!

  • Question..?

    Submitted by, Nikheesh Fifth Semester MCA CCSIT,CU Campus

    ORCHID Research GroupDepartment of Computer Science, University of Illinois at Urbana-Champaign*Image Compression using Vector Quantization,an input image is divided into small blocks. We called Training Vectors (xj(k)).From Training vector,We find the new codebook by codebook design algorithm such as Splitting or Random algorithm.New image is the index table that contains the index (i) of the codebook.When we reconstruct the image, we pick the vector in codebook into image block.And we can see all process in this slide.