GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI. Differential coding operates by making numbers...

27
CISY 426 GROUP PRESENTATION GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI

Transcript of GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI. Differential coding operates by making numbers...

Page 1: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

CISY 426GROUP

PRESENTATIONGODIAN MABINDAH RUTHERFORD UNUSI

RICHARD MWANGI

Page 2: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Differential coding operates by making numbers small. This is a major goal in compression technology: Making numbers small.

Smaller numbers require less information to code than larger numbers.

it would be more accurate to claim that similar numbers require less information to code.

DIFFERENTIAL CODING

Page 3: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

However, sticking to that approach requires the video codec to figure out information about what the set of similar numbers is.

Instead, it is more efficient to build a video codec around the assumption that the set of similar numbers will consist of small numbers.

Suppose you are working with a string of bytes. Bytes range from 0..255. Here is a string:

Page 4: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

150 152 149 150 151 156 153 151 152

On the scale of 0..255, those are reasonably large. However, they are quite similar to each other.

Instead of coding each number separately, code the differences.

The sequence has to start somewhere, so the first number is coded as-is, and the subsequent numbers are coded as differences from the previous number:

Page 5: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

150 +2 -3 +1 +1 +5 -3 -2 +1 When decoding this string of numbers, start

with the first number and start adding the deltas to get the remaining numbers:

150150 + 2 = 152152 + -3 = 149149 + 1 = 150150 + 1 = 151151 + 5 = 156156 + -3 = 153153 + -2 = 151151 + 1 = 152

Page 6: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Differential pulse code modulation (DPCM) is a procedure of converting an analog into a digital signal in which an analog signal is sampled and then the difference between the actual sample value and its predicted value (predicted value is based on previous sample or samples) is quantized and then encoded forming a digital value.

DPCM code words represent differences between samples unlike PCM where code words represented a sample value.

DPCM

Page 7: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

DPCM conducted on signals with correlation between successive samples leads to good compression ratios.

Images and video signals are examples of signal correlation.

In images this means that there is a correlation between the neighboring pixels, in video signals correlation is between the same pixels in consecutive frames and inside frames (which is same as correlation inside image).

DPCM compression of images and video signals

Page 8: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

It is important to point out that in forming a prediction receiver i.e. decoder has access only to reconstructed pixel values, since the process of quantization of differential image introduces error, reconstructed values, as expected diverges from the original values.

Identical predictions of both receiver and transmitter are assured by transmitter configuration in which transmitter bases its prediction on the same values as receiver i.e predicted values.

The facts that were mentioned in this paragraph are applicable to signals in general not just image and video signals.

Page 9: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Formally written, DPCM compression method can be conducted for intra-frame coding and inter-frame coding.

Intra-frame coding exploits spatial redundancy and inter-frame coding exploits temporal redundancy.

In the intra-frame coding the difference is formed between the neighboring pixels of the same frame, while in the inter-frame coding it is formed between the values of the same value in two consecutive frames.

In both coding intra- and inter- frame the value of target pixel is predicted using the previously-coded neighboring pixels.

Page 10: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

The disadvantage of PCM is it requires large bandwidth to transmit because of coding each sample. To overcome this problem, Delta modulation is used.

Delta Modulation

Page 11: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Delta modulation transmits only one bit per sample. That is the present sample value is compared with the

previous sample value and the indication, whether the amplitude is increased or decreased is sent. The input signal is approximated to step signal by the delta modulator.

This step size is fixed. The difference between the input signal x(t) and the staircase approximated signal confined to two levels, i.e. +δ, -δ.

If the difference is positive then the approximated signal is increased by +δ, if the difference is decreased then the approximated signal is decreased by -δ. A zero is transmitted for –δ and a one is transmitted for +δ.

Operating principle of DM

Page 12: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Delta modulation Transmitter

Page 13: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

 The figure shows the modulator diagram. The summer in the accumulator adds

quantizer output (±δ) with the previous sample approximation.

The previous sample approximation u[(n-1)Ts] is restored by delaying one sample period Ts.

The sampled input signal x(nTs) and staircase approximated signal is subtracted to get the error signal e(nTs).

Delta modulation Transmitter

Page 14: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Depending on the sign of e(nTs) one bit quantizer produces an output step of + δ or – δ. If the step size is +δ, then binary '1' is transmitted. If the step size is -δ, then binary '0' is transmitted.

Page 15: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

At the receiver, an accumulator and a low pass filter are used.

The accumulator generates the staircase approximated signal output and is delayed by one sampling period Ts.

It is then added up to the input signal. If the input is '1', then +δ is added to the previous output(which is delayed).

If the input is binary '0'. Then one step is subtracted from the delayed signal.

Delta modulation Receiver

Page 16: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:
Page 17: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Adaptive Differential Pulse Code Modulation (ADPCM) is a lossy compression format that is implemented for XAudio2 to provide additional features for specifying the size of the compression sample block. With a lossy compression format some data is altered and lost during compression. ADPCM can achieve compression ratios of up to 4:1.

The implementation of ADPCM for XAudio2 provides additional features to specify the size of the compression sample block. ADPCM enables the audio designer to choose a setting that is an appropriate compromise among size, quality, and resolution (for placing loop points).

ADPCM

Page 18: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

XAudio2 uses a modified version of the Microsoft ADPCM codec that supports the extended data formatting required to provide custom sample block sizes. For this reason, XAudio2 audio data cannot be played by audio engines that do not support this version of the ADPCM codec.

Note  Currently, ADPCM compression is only available for Windows, including XNA Game Studio Express for Windows deployments.

Page 19: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Audio data is encoded to ADPCM using the AdpcmEncode command-line tool.

AdpcmEncode In order to encode audio files as ADPCM for

use with XAudio2, use the AdpcmEncode command-line tool.

ADPCM Encoding

Page 20: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Software decoding of ADPCM is supported in XAudio2.

XAudio2 In order to use ADPCM encoded data in

XAudio2, you need to initialize a ADPCMWAVEFORMAT structure with ADPCM specific values, and pass it as an argument to IXAudio2::CreateSourceVoice when you create a source voice. For an example of loading and playing a sound in XAudio2.

ADPCM Decoding

Page 21: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

ADPCM compression works by separating the waveform into blocks, and predicting the variation of the waveform samples within each block. The size of the blocks is measured in samples. The smallest block size is 32 samples, and the highest is 512 samples.

Larger blocks allow better compression, which results in smaller file sizes, but at the expense of sound quality and resolution for aligning loop points.

In general, modifying the SamplesPerBlock value results in these tradeoffs:

Samples Per Block

Page 22: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:
Page 23: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

Because ADPCM uses sample blocks that are aligned one after the other, a wave compressed with ADPCM may have an unfinished, partial block at its end. The ADPCM decoder generates silence for the remainder of this partial block, which keeps the wave from looping seamlessly.

The value of the SamplesPerBlock parameter affects the resolution with which you can align wave data and loop points.

Restrictions

Page 24: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

If you try to apply compression to a non-aligned wave, you will get an error or a warning depending on whether the wave is used in any looping play events. You cannot compress a wave used in any looping play events. Remove it from the looping play events, and re-apply compression.

If you use the wave exclusively in non-looping mode, the sample block alignment restriction does not apply.

Page 25: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

ADPCM File StructureAn ADPCM file is a standard RIFF file with the following chunk types.

Page 26: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

The delta modulation has the following advantages over PCM:

Delta modulation transmits only one bit. The transmitter and receiver is very simple

to implement.

Advantages of Delta Modulation

Page 27: GODIAN MABINDAH RUTHERFORD UNUSI RICHARD MWANGI.  Differential coding operates by making numbers small. This is a major goal in compression technology:

The following are the disadvantages of delta modulation:

Granular Noise. Over-slope noise distortion.

Disadvantages of Delta Modulation