# Connexions

You are here: Home » Content » Linear and Logarithmic Quantization

### Recently Viewed

This feature requires Javascript to be enabled.

# Linear and Logarithmic Quantization

Module by: Lee Potter. E-mail the author

Summary: In this module, we will use the 56002 to measure noise introduced by quantization and compare the performance of linear and logarithmic quantization. First, we will write a program to perform N-bit (N less than or equal to 16) linear quantization and logarithmic (mu-law) quantization. Then will use that program to compare the techniques for simple signals and audio signals.

## Introduction

In this module, we will use the 56002 to measure noise introduced by quantization and compare the performance of linear quantization and logarithmic quantization. First, we will write a program to perform N N-bit ( N16 N 16 ) linear quantization and logarithmic (μ-law) quantization. Then will use that program to compare the techniques for simple signals and audio signals.

## Quantizer Implementation

The codec within the 56002EVM performs 16-bit 2's complement linear quantization. N N-bit ( N16 N 16 ) linear quantization can be achieved by masking to the desired number of bits. The μ-law encoding/decoding of the 16-bit linear samples can be performed using two subroutines, mutolin and lintomu, obtained through a TA. Use these subroutines to write a program that takes an input sample, encodes it, decodes it, and sends the result to the left channel. Calculate the quantization error by subtracting the encoded/decoded value from the original value. Send this difference to the right channel, scaled by 2m 2 m where m m is a positive integer, so that the signal may be measured on the oscilloscope. Your program should set bits in the OMR register so that the μ-law table in the X memory ROM is enabled. To facilitate a time efficient comparison of the two quantization techniques, write a single program that can perform both linear and μ-law encoding. Write the program so that the type of encoding used, and the bit size for linear encoding, can be selected by changing registers or memory locations from the EVM56KW program.

## Measurement of Quantization Noise

Generate a sine wave (or triangle wave) as input to the 56002EVM using the signal generator. With full 16 bit linear quantization, adjust the input amplitude as high as possible without saturation at the output. Also, adjust the signal for no DC offset. Measure and record the power of the signal on the oscilloscope. For this input signal, measure the quantization noise power from the right channel on the oscilloscope for μ-law quantization and linear quantization with N in the range of 6 to 14 bits. Calculate the corresponding SNR values. Don't forget the output scaling factor m m in your computations. This scaling factor should be set so that the observed noise signal is greater than the noise floor of the DAC and does not saturate at its maximum value. Note that you may have to set the scaling factor differently for different values of N N.

Reduce the input signal power by 16 and by 256 (or as low as possible) and repeat the above measurements.

How do the results compare to theoretical predictions? Plot linear quantizer SNR verses N N for the different signal powers. On each plot, indicate the SNR performance level for μ-law at the same signal power.

## Perceptual Comparison of Quantization Techniques

Replace the signal generator output with an audio signal from the tape player. Set the volume so that the audio signal does not saturate at its maximum deviation. Estimate the power of the signal during the voiced portions. Compare perceptually the sound quality of the quantized signal for μ-law and linear coding over a range of N N. At what N N is distortion first audible? At what N N is μ-law equivalent to linear quantization for the audio signal? Reduce the amplitude of the input audio signal, turn up the volume on the speaker, and compare again. Is there any difference? How do these observations compare to the observations you made for the sine wave?

## Content actions

### Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks