Montag, 21. März 2011

EE4209/EE5809 Digital Audio Processing : Assignment

EE4209/EE5809 Digital Audio Processing : Assignment

好多香港人, 到左今時今日仍然堅持繼續用 BN(O) 護照,

某程度上都反映左好多香港人對「中國化」o既極度恐懼, 驚死自己有朝一日會同垃圾國家變得無分別 . . .

BN(O) 護照是1997年 之前在香港出生或歸化的「 真正香港人」才可以申請的 .

1997年之後, 那些從中國落來香港, 破壞香港既有生活方式的中國殖民者同蝗蟲, 永世都無得攞 ! !

BN(O)護照的確係其中一個用來分辨「 真正香港人」同中國殖民者/蝗蟲的指標

Implementation of an ADPCM audio coder with arithmetic post-coding


This assignment was designed with an aim for students to gain practical experience in audio compression technology by integrating both the lossy and lossless compression technologies to build a practical audio codec.


This assignment is to implement an adaptive differential pulse code modulation ( ADPCM) coder with entropy post-coding in C language.

ADPCM is a comparative simple waveform coding technique that gives good performance at a compression ratio of less than 4.

In this assignment, arithmetic coding technique will be applied on the ADPCM encoded data to further increase the compression ratio. Students will need to write C programs for the encoder and decoder.

The encoder should accept as input an audio file stored in Microsoft’s WAV file format, and produce as output a compressed file (you can define your own compressed format with a suitable header).

The decoder should accept as input the compressed file and produce as output a WAV file containing the decoded signal. The WAV file should have the following setting: 16 bits PCM, MONO or STEREO channel with 44.1 KHz sampling frequency.

Structure of the ADPCM coder with entropy post-coding A block diagram of the encoder to be implemented is shown in Fig. 1.

The difference d n ˆ between the input sample xn and a predicted sample xn is adaptively scaled and then quantized.

The index to the quantized value of the difference sample is sent to an arithmetic coder for further compression. The scale factor ∆ n is adapted according to the scaled inverse-quantized ˆ ˆoutput g .

After inverse quantization, the quantized difference sample d will be added to the
n n ˆpredicted sample xn to produce the synthesis sample sn .

The predictor will use the synthesis ˆ sample sn as input to generate the next predicted sample xn +1 .

This process will repeat for the next input sample.

A block diagram of the decoder to be implemented is shown in Fig. 2. Actually, if you compare the structure of the ADPCM encoder and decoder, you will find that the encoder also contains the same decoding structure as in the decoder.

Lossless Entropy Coding

It is recommended to use Arithmetic coding to further reduce the bit rate of the ADPCM encoded bit stream. There are three possible ways to apply Arithmetic coding:

1. Static method

In this method, the probability distribution of ADPCM codewords (a total of 16 codewords) is obtained from the statistics of a large collection of training data. These probability values are assumed static and remain unchanged for the later coding of the ADPCM data even though they are not in the training set.

This static method has the advantage that it is not necessary to send the probabilities to the decoder as they were embedded to the encoder and decoder while it was built.

However, the performance of this static coder is generally poorer because using a fixed set of probabilities may not be able to cover the true statistics of all signals to be encoded.

2. Block adaptive method

In this method, the input signal is chopped into blocks. The probabilities of the ADPCM codewords within a block are calculated. These probabilities need to be sent to the decoder.

The encoder and decoder will use these probabilities for encoding and decoding this block of signal, respectively. If the block size is large enough, the overhead of this side information is small.

3. Sample-by-sample adaptive method

Adaptive arithmetic coding can be applied on the ADPCM codewords on a sample-by-sample basis. In this method, whenever a new sample of ADPCM codeword is obtained, the probability values in both the encoder and decoder are updated accordingly.

This method will have the best performance because the probabilities obtained will closely follow the statistics of input signal. However, the complexity of this adaptive arithmetic coder is higher.

You can use any one of these methods. I would recommend you to try the static arithmetic coding first and evaluate its performance to see whether it is up to your expectation and then later migrate to sample-by-sample adaptive method.

Conversion of the Decoded Samples to PCM format.

The decoded signal should have an amplitude range of ± 1.0 . The signal will be mapped to 16-bit PCM format (actually, this is 16-bit 2’s complement format) for saving to Microsoft’s WAV file and then outputting to the sound device. The mapping is easily done and self-expressed in a C code as shown:

pcm_data = (short int)(float_data * 0x7fff+0.5)

Submission of Your Assignment

It is recommended that TWO students should work together as a group with balanced loading. Each group needs to submit only one assignment report at the end of week 12 of the current semester.

The submission should include a written report together with a disk containing the listing of your C source code and the executable programs for the encoder and decoder.

In the report, you should clearly describe the method of implementation, the testing results. You should also state the average number of bits per sample that is achieved after entropy coding and the average signal to coding noise ratio ( SNR) of your coder.

Comment also on the quality of the audio signals that are coded by this ADPCM coder. A sampled audio source file is available in the course web page for you to check and compare the performance of your codec.

Keine Kommentare: