Tuesday, 7 February 2012

Companding - Compressing + Expanding


           Companding algorithms reduce the dynamic range of an audio signal. In analog systems, this can increase the signal-to-noise ratio (SNR) achieved during transmission, and in the digital domain, it can reduce the quantization error (hence increasing signal to quantization noise ratio). The µ-law algorithm (PCMU) is a companding algorithm, primarily used in the digital telecommunication systems of North America and Japan. And A-law algorithm (PCMA) is the standard companding algorithm, used in European digital communications systems to optimize, i.e., modify, the dynamic range of an analog signal for digitizing.

 PCMU for Digitized Signals

PCMU digital implementation takes a maximum sine wave amplitude of ±8159 equal to 3.17 dBm in power representation. The front-end analog circuit and ADCs (Analog-to-Digital Converters) are calibrated to take a (maximum of) 3.17 dBm sine wave and give ±8159 amplitude in digital number representation. The numbers 8159 and above are clipped to 8158 in the process of quantization. In the process of compression, the input range is broken into segments, and each segment will use different intervals. Most segments contain 16 intervals, and the interval size doubles from segment to segment as shown in Figure 1. Large signals use a big quantization step and small signals use a small quantization step. This type of non uniform quantization gives a signal-to-noise ratio (SNR) of 38 to 40 dB for most of the useful signal amplitude range. For full-scale amplitude of 3.17 dBm, signal to quantization is shown as 39.3 dB.
Figure 1

           A PCM 14–bit (±8159 amplitude) input is split into eight amplitude segments represented with 3 bits. Each segment is quantized uniformly into 16 levels using 4 bits. The polarity of the input is represented using 1 bit. A sign bit is represented as “1″ for positive numbers and as “0″ for negative numbers. In a two’s complement number format, sign bit-1 is used for negative numbers. After framing 8 bits, the last 7 bits except the sign bit are inverted in PCMU. This bit inversion increases the one’s bit density in transmission systems that help timing and clock recovery circuits in the receiver. Ideal channel noise makes bits, toggle between 01111111 (0x7F) and 11111111 (0xFF), which allows clock recovery to be better even under ideal channel conditions. Bit inversion is achieved by simple exclusive OR (XOR) operation of the encoded output with value 0x7F. This inversion is applied on both positive and negative values of input. At the decoder, the same operation of 7-bit inversion can retrieve the original decoded compressed byte.
 PCMU has eight segments (both on the positive side and negative side), numbered from 1 to 8. The intervals are 2,4,8,16,32,64,128 and 256. In PCMU, the maximum interval size is 256, and the corresponding segment number is 8. However, encoded output has only 3 bits for representing the segment number, which means only numbers from 0 to 7, can be used for segment coding. Therefore, in PCMU, maximum and minimum segment numbers are coded as 111(7) and 000(0), respectively.Table 1 lists PCMU encoded and decoded output values for positive numbers and Table 2 lists the output values for some of the negative numbers.
Table 1
Table 2
PCMA for Digitized Signals

          PCMA takes a maximum input of ±4096 equal to 3.14dBm in power representation. The front–end analog circuit and analog–to–digital converters (ADCs) are calibrated to take 3.14 dBm and to give ±4096 amplitude in digital number representation. The quantization procedure is the same as with PCMU with few deviations in quantization steps. The step values (intervals) are 128, 64, 32, 16, 8, 4, and 2 (for the last two 16 intervals), which means the last two segments use the same interval 2. Of the 16 total segments for positive and negative numbers, four segments from -63 to 63 use a step size of 2. Hence, PCMA is referred to as 13-segment quantization. PCMA encodes a 13-bit sample number to an 8-bit compressed sample. Unlike in PCMU, where the last 7 bits are inverted, PCMA encoder uses even bits inversion (EBI)., where in, the actual bits in the position 2,4,6 and 8 are inverted. In the A-law tables, (Table 3 and Table 4) bits before inversion and after EBI are also included in separate columns. EBI is performed in software by XOR operation of the encoded output with 0×55. EBI is applied on both positive and negative values of input. At the decoder, the same operation of even bit inversion can retrieve the original decoded compressed byte. EBI in PCMA once again helps clock recovery mechanisms during ideal channel or near zero amplitude signals. Table 3 shows the PCMA Quantization Example for Positive Inputs and  Table 4 shows the same output for a few Segments of Negative Inputs.




Table 3


Table 4
               Therefore, Companding is a process which helps to transmit and reproduce a high-fidelity voice information in an effective manner (in terms of bandwidth as well as cost).

No comments:

Post a Comment