Audio Compression M.K.H.Gunasekara – AS2010377 J.A.S. Fernando – AS2010362 CSC 362 1.5 Seminar I Department of Statistics and Computer Science
Audio Compression
M.K.H.Gunasekara – AS2010377J.A.S. Fernando – AS2010362
CSC 362 1.5 Seminar IDepartment of Statistics and Computer Science
Overview
• Introduction• Pulse Code Modulation• µ - law• A - law• Differential Pulse Code Modulation• Adaptive Differential Pulse Code Modulation• Application• MPEG Audio Compression• MPEG Encoder Architecture• MPEG Audio Compression Algorithm• MPEG Layers• MPEG Layers Applications• Comparison of MPEG audio compression standards• Summary• References
Audio Compression - AS2010377 2
Introduction
• A process that is useful for conserving both transmission bandwidth and storage space.
• The various audio compression techniques offer different levels of complexity, compressed audio quality, and amount
of data compression.
Audio Compression - AS2010377
3
Audio Compression
Audio Compression - AS2010377 4
Lossy Audio Compression• AAC• ADPCM• ATRAC• Dolby AC-3• MP2• MP3
Lossless Audio Compression• Apple Lossless • apt-X Lossless• Audio Lossless Coding • Direct Stream Transfer (DST)• Dolby TrueHD• DTS-HD Master Audio• Free Lossless Audio Codec
4
What is PCM ?
• PCM is a method used to digitally represent sampled analog signals.
• It is the standard form of digital audio in computers, Compact Discs, digital telephony and other digital audio applications.
Audio Compression - AS2010377 5
5
How PCM works ?
• Sampling
• Quantizing
• Encoding
Audio Compression - AS2010377 6
Figure 01 : Block Diagram of Pulse Code Modulation
6
Sampling
• Sampling theory (Nyquist)– If input signal has maximum frequency (bandwidth) f,
sampling frequency must be at least 2f
– With a low-pass filter to interpolate between samples, the input signal can be fully reconstructed
Example : highest frequency of telephone voice channel is 3.4 kHz
Sampling rate ≥ 2 x 3.4
≥ 6.8 kHz
Hence sample rate is 8 kHz
Audio Compression - AS2010377 7
7
Sampling
• Ideal - an impulse at each sampling instant• Natural - a pulse of short width with varying amplitude• Flattop - sample and hold, like natural but with single
amplitude value
Audio Compression - AS2010377 8
Figure 02 : Sampling Methods
8
Quantization
• The samples are divided into many discrete levels. Then each sample is numbered according to their corresponding level.
• Quantization error - the coded signal is an approximation of the actual amplitude value.
Figure 03 : Linear Quantization Figure 04 : Non Linear QuantizationAudio Compression - AS2010377 9
9
Encoding
• After quantizing the corresponding level it is to be represented in some manner.
• We represent levels in binary format.
• Representation of level 50 = 110010
Figure 05 : Representation of sample signal
Audio Compression - AS2010377 10
10
Figure 07- Circuit diagram of pulse code modulation
Figure 06- Block diagram of pulse code modulation
Audio Compression - AS2010377 11
11
What is µ law ?
• µ -law encoding is a form of logarithmic quantization or companding.
• It's based on the observation that many signals are statistically more likely to be near a low signal level than a high signal level.
• Most quality codecs (including the Sparcstation's audio codec) use µ -law encoded samples.
Audio Compression - AS2010377 12
12
What is A law ?
• A-Law compression is extremely similar to Mu-Law compression
• If the absolute value of the source sample is less than 256, the 16-bit sample is simply shifted down 4 bits and converted to an 8-bit value, thus losing the top 4 bits in the process.
Audio Compression - AS2010377 13
13
A law and µ law
Both methods compress 2:1 ratio.
• µ -Law has a larger dynamic range compared to A-law
• µ -Law has worse distortion with small signals compared to A-law
• µ -Law is used in North-America and Japan while A-law is commonly used in Europe• A-law takes precedence over µ -law with international calls
Audio Compression - AS2010377 14
14
Differential PCM
• Differential pulse-code modulation is a signal encoder that uses the baseline of pulse-code modulation but adds some functionalities based on the prediction of the samples of the signal.
Audio Compression - AS2010377 15
15
Adaptive Differential PCM
• ADPCM, commonly termed as a form of compression, is a more efficient way of storing waveforms than 16-bit or 8-bit PCM.
• ADPCM stores the value differences between two adjacent PCM samples and makes some assumptions that allow data reduction.
• Because of these assumptions low frequencies are properly reproduced
Audio Compression - AS2010377 16
16
Adaptive Differential PCM
Audio Compression - AS2010377 17
• An ADPCM algorithm is used to map a series of 8 bit µ-law (or a-law) PCM samples into a series of 4 bit ADPCM samples. In this way, the capacity of the line is doubled.
• Some ADPCM techniques are used in Voice over IP communications.
• ADPCM was also used by Interactive Multimedia Association for development of legacy audio codec known as ADPCM DVI, IMA ADPCM or DVI4
17
Applications
Audio Compression
Format
Algorithm Bit Rate Bits per sample Implementations
G.711 Companding A-law ; µ-law ; PCM
64 kbit/s 8 bit FFmpeg, Ekiga, Asterisk (PBX)
G.711.1 A-law ; µ-law 64, 80, 96 kbit/s 16 bit VoIP
G.721 ADPCM 32 kbit/s 13 bit
G.722 ADPCM 64 kbit/s 14 bit QuickTime, RealPlayer
Audio Compression - AS2010377 18
18
Wrap - up
• Techniques to compress general digital audio signals include µ -law and adaptive differential pulse code modulation.
• These approaches apply low-complexity, low-compression, and medium audio quality algorithms to audio signals.
Audio Compression - AS2010377 19
19
MPEG Audio Compression
• Motion Picture Experts Group
• An ISO standard for high-fidelity audio compression.
• A lossy compression.
• But can achieve transparent, perceptually lossless compression.
• Compresses without regard to the source of the audio data.
• Removes distortion and other features that are imperceptible to the human ear.
• 6-to-1 compression ratio.
20Audio Compression - AS2010362
20
MPEG Audio Compression
• Four channel modes
- Monophonic
- Dual monophonic
- Stereo
- Joint- stereo
• Has 3 distinct layers for compression
21Audio Compression - AS2010362
21
MPEG Encoder Architecture
Audio
Input Encoded
Bit Stream
Time to Frequency Mapping
Filter bank
Bit Allocation, Quantize and
coding
PsychoacousticModel
Bit stream formatting
22Audio Compression - AS2010362
22
MPEG Audio Compression Algorithm
• The input audio stream passes through a filter bank.
Filter Bank
- Divides the input into multiple subbands.
- Relatively simple and provide good time
resolution
23Audio Compression - AS2010362
23
MPEG Audio Compression Algorithm …
• The input audio stream simultaneously passes
through a psychoacoustic model.
The Psychoacoustic Model
- The key component of the MPEG encoder
that enables its high performance.
- Analyzes the audio signal and computes the
amount of noise masking that is available as a
function of frequency.
24Audio Compression - AS2010362
24
MPEG Audio Compression Algorithm...
• The bit or noise allocation block uses the signal-to-mask ratios to decide how to apportion the total number of code bits available for the quantization of the subband signals to minimize the audibility of the quantization noise.
• Finally, the last block takes the representation of the quantized audio samples and formats the data into a decodable bit stream.
25Audio Compression - AS2010362
25
MPEG Layers
• Offers three compatible layers.
- Layer I
- Layer II
- Layer III
• Each succeeding layer able to understand the lower layers.
• Each succeeding layer offers more complexity
and better compression for a given level of audio quality.
26Audio Compression - AS2010362
26
MPEG Audio Layer I
27
• Uses the basic filter bank found in all layers.
• This filter bank divides the audio signal into 32
constant-width frequency bands.
• Bit rates greater than 128 kbits/s per channel.
Audio Compression - AS2010362
27
MPEG Audio Layer II
28
• A simple enhancement of Layer I.
• It improves compression performance by
coding data in larger groups.
• Bit rates of 128 kbits/s per channel.
• Improves performance by representing the bit
allocation, the scale factor values, and the
quantized samples.
Audio Compression - AS2010362
28
MPEG Audio Layer III
– Widely popular under the name Mp3
– The most complex with the best audio quality
– Used for bit rates of 64 kbits/s per channel.
• Compensates for some filter bank deficiencies
by
processing the filter outputs with a modified
discrete cosine transform (MDCT).
29Audio Compression - AS201036229
MPEG Audio Layer III Filter Bank Processing
30Audio Compression - AS2010362
30
MPEG Audio Layer III enhancements
31
• Alias reduction
• Nonuniform quantization
• Entropy coding of data values
• Use of a bit reservoir
• Noise allocation instead of bit allocation
Audio Compression - AS2010362
31
MPEG Layers Applications
32
Layer Application
I Digital audio cassette
II Digital audio broadcast
III CD quality
Audio Compression - AS2010362
32
Comparison of MPEG audio compression standards
33
Standard Audio Sampling rate(kHz)
Compressed bit rate (kbits/sec)
Channels
MPEG - 1 Layer I 32, 44.1, 48 32- 448 1- 2 channels
MPEG - 1 Layer I 32, 44.1, 48 32 – 384 1-2 channels
MPEG - 1 Layer III 32, 44.1, 48 32 – 320 1-2 channels
MPEG - 2 Layer I 32, 44.1, 48 32 - 448 1 – 5.1 channels
16, 22.05, 24 32 - 256
MPEG - 2 Layer II 32, 44.1, 48 32 - 384 1 – 5.1 channels
16, 22.05, 24 8 - 160
MPEG - 2 Layer III 32, 44.1, 48 32 - 384 1 – 5.1 channels
16, 22.05, 24 8 - 160
Audio Compression - AS2010362
33
Comparison of MPEG audio compression standards
34
• MPEG 2 AAC
- more efficient than the previous MPEG audio standards
- supports from 1 to 48 channels at sampling rates of 8 to 96 kHz
• MPEG 4 AAC
- similar to the MPEG-2 AAC standard, with some minor changes
- supports the compression of natural audio at bit rates ranging from 2 up to 64 kb/s.
Audio Compression - AS2010362
34
Summary
35
• The MPEG audio standard has three layers of successive complexity for improve compression performance.
• MPEG audio has been extended in following ways
- Multichannel audio support
- Lower, compressed audio rates
- Lower audio sampling rates
Audio Compression - AS2010362
35
References
36
• Introduction To Data Compression ,Third Edition ,Khalid Sayood
• B. Cavagndo , J. Bier, Introduction to Digital Audio Compression,Available: http://rizal.blog.undip.ac.id/files/2009/07/introductiontodigitalaudiocompression.pdf
• Davis Yen Pen, Digital Audio Compression, Available: www.ece.jcu.edu.au/subjects/ee3700/resources/Digital_Audio_Compression.pdf
Audio Compression - AS2010362
36
37
THANK YOU
Audio Compression - AS2010377 & AS2010362
37