2
$\begingroup$

I have read that non-uniform quantization boosts the smaller amplitude signals by a large amount. However the larger amplitude signals receive a small gain. As shown in the below diagram (Compressor Input and Output).

compressor input

The Input - Output Characteristic diagram of compressor is given as below.

compressor output

My query is as seen from the Input - Characteristic diagram, the step size is very less for smaller amplitude signal and hence the gain has to be less. On the other hand the step size is more for the large amplitude signal. Hence the gain has to be more. But the compressor input and output are in reverse way. Can you please help where I was going wrong?

$\endgroup$
  • 1
    $\begingroup$ you're confusing a compressor (which has the in/out relationship on the left) with the quantizer (which still has the uniform step size). The non-uniform quantization of the input signal is the effect of combining a uniform quantizer with a nonlinear input characteristic – and if you look at the left diagram, you'll quickly notice that a greater range of high input values correspond to a smaller output value range. $\endgroup$ – Marcus Müller Apr 11 '17 at 11:08
  • $\begingroup$ @MarcusMüller Yeah I got you. The input signal is first subjected to the in/out relationship on the left. And then it is passed through uniform quantizer to get the compressor output diagram on the right - Its the combined diagram of I/O on the left and uniform Quantizer. If we see the step size (Diagram on right), low amplitude signals are amplified to low output and high amplitude signals are high output. I am facing difficulty in understanding here. $\endgroup$ – METALHEAD Apr 11 '17 at 12:36
2
$\begingroup$

To make it more clear, I suppose your question is

Why it is said that the compressor gain at low input amplitudes is higher, while the step size of a nonuniform quantizer is small in that region. Similarly, Why it is said that the gain of the compressor is higher for high input amplitudes, while the step size is larger for those inputs.

First, notice that nonuniform quantization is used to improve the average SNR by adapting the quantizer to the source probability density function. Of course, when the source pdf is not uniform (e.g. when it is Gaussian), then uniform quantization is not a good choice. To better understand it, assume that you want to quantize a Gaussian source into $K$ levels. Let's first assume we have a uniform quantizer. One way to reduce the distortion caused by qunantization is to increase the number of steps ($K$). Increasing $K$ means the step size is reduced which eventually leads to a higher SNR (finer quantization). Increasing the number of levels means that the total number of bits to represent each sample is increased. For instance if we have 256 levels we need 8 bits to represent each level. But for 1024 levels we will require 10 bits.

Now in the above example assume that we want to work with a fixed $K$ (e.g. 256) and improve the SNR. To do this, notice that a Gaussian source is more likely to produce samples around the mean. So for example, a zero-mean Gaussian source is very likely to generate values close to zero. So we allocate smaller step size in the area around zero, and instead make the step size larger at the tail of the pdf (where it is less likely to happen). So technically, we quantize with a smaller step size on average (but without increasing the number of levels).

enter image description here

Any scalar nonuniform quantizer can be implemented by using a chain of

1- A compressor: a memoryless monotonic nonlinearity $G$

2- A uniform quantizer

3- An expander: inverse of nonlinearity $G$

In your example, the nonlinearity has a large gain at the origin (the characteristic function is steep) while it causes some sort of saturation effect at large amplitudes. But this gain is applied on the input signal not on the quantizer. Still the result should be quantized by a uniform quantizer afterwards. Although it is a uniform quantizer, but the preliminary change caused by the nonlinearity $G$ and then $G^{-1}$ makes it seem as if different step sizes are used: The low amplitude bins are magnified first, then there is a uniform grid, then they are compressed. They seem as they are quantized by a small step size. Something similar also applies to the high amplitude bins, except they are compressed first, then they are expanded. So the overall result is equivalent to the effect of a large step size.

$\endgroup$
  • $\begingroup$ Awesum explanation it is. Thank you so much. $\endgroup$ – METALHEAD Apr 12 '17 at 16:26
  • $\begingroup$ Sir, By Gaussian source you mean, the lower amplitudes have higher probability of occurrence and higher amplitudes have lower probability of occurrence right. So we decreased step size for the lower amplitude signal portion to improve SNR. Please correct me if I am wrong. So how can we guarantee that all sources are Gaussian..?? $\endgroup$ – METALHEAD Apr 12 '17 at 16:40
  • $\begingroup$ Your understanding is correct. Not all sources are Gaussian but a similar approach is used in other cases. The optimal nonuniform quantizer that is tailored to the source pdf can be designed using the Lloyd-Max algorithm. $\endgroup$ – msm Apr 12 '17 at 21:34
1
$\begingroup$

[EDIT: improved the graphics and code] If you call $S$ the sigmoid function (left), and $Q_{\text{u}}$ the uniform quantization operator, the right plot is obtained by:

$$Q_{\text{nu}} =S^{-1}(Q_{\text{u}}(S(\cdot)))$$

as illustrated in

Companding, uniform quantization, expanding toward non-uniform quantization

from this basic Matlab code:

time = linspace(-1,1,1000);
Q=4; % Number of bits (almost)
Qu = round(time*2^Q)/2^Q; % Uniform quantization
%%% Choice of companding/expanding
%% Square-root
S =  @(x) sign(x).*sqrt(abs(x));
Sinv =  @(x) sign(x).*(x.^2);
%% Mu-law
mu = 2^5-1;
S =  @(x) sign(x).*log(1+mu*abs(x))/log(1+mu);
Sinv =  @(x) sign(x).*((1+mu).^abs(x)-1)/mu;

Qnu = sign(time).*Sinv(round(S(abs(time))*2^Q)/2^Q);  % Non-uniform quantization
subplot(2,2,1)
plot(time,S(time)); 
xlabel('Sigmoid function')
subplot(2,2,2)
plot(time,Qu);
xlabel('Uniform quantization')
subplot(2,2,3)
plot(time,Sinv(time));
xlabel('Inverse sigmoid function')
subplot(2,2,4)
plot(time,Qnu);
xlabel('Non-uniform quantization')

The main idea is to keep a quantization step "almost proportional" to the input. So that the relative quantization error $(x-x_Q)/x$ does not vary too much across the signal. You can plot the relative error diagram too. So your options are:

  • use a non-uniform quantizer (right plot): more precise, less easy to implement
  • use a shaping function (left plot), that acts like a variance-stabilizing transform (short discussion) like Anscombe or Box-Cox: a sigmoid, a square toot, a logarithm (like the A-law and $\mu$-law), and then apply a uniform quantizer, and when needed, apply the inverse of the shaping function

The latter is sometimes called companding (or compansion), a merger of compressing and expanding It is also related to dynamic range compression. While such designs have been largely heuristic, I would like to mention the recent paper Scalar Quantization for Relative Error, Data compression conference, 2011:

Quantizers for probabilistic sources are usually optimized for mean-squared error. In many applications, maintaining low relative error is a more suitable objective. This measure has previously been heuristically connected with the use of logarithmic companding in perceptual coding. We derive optimal companding quantizers for fixed rate and variable rate under high-resolution assumptions. The analysis shows logarithmic companding is optimal for variable-rate quantization but generally not for fixed-rate quantization. Naturally, the improvement in relative error from using a correctly optimized quantizer can be arbitrarily large. We extend this framework for a large class of nondifference distortions.

$\endgroup$
  • $\begingroup$ Thank you for your answer. My query is :: Are left and right plots different? I was in assumption that the wave shaping plot (left) when subjected to uniform quantizer derives the right plot. $\endgroup$ – METALHEAD Apr 12 '17 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.