Theoretical introduction to A-law compression and μ-law compression and comparison with matlab simulation

Table of contents

1. ELM self-encoding technology

2. Principle of image deblurring algorithm based on ELM auto-encoding technology

3. MATLAB core program

4. Simulation results


        A-law is a form of logarithmic companding in PCM non-uniform quantization. Digital pulse code modulation (PCM) is the basic method of digitizing analog signals. PCM includes three steps: sampling, quantization, and encoding. Quantization is the process of sampling values. The value is discrete, and it is divided into uniform quantization and non-uniform quantization according to different selections of quantization intervals. Non-uniform quantization can effectively improve the quantization signal-to-noise ratio of the signal. The quantization of speech signals often uses two logarithmic forms of non-uniform quantization compression characteristics recommended by ITU: A-law and μ-law. A-law coding is mainly used in 30/32-channel primary group systems, and A-law PCM is used in Europe and China.

1. A-law compression technology

       A-law compression and μ-law compression are both one of the quantization steps in the digitization process of audio signals, used to convert continuous analog signals into discrete digital signals. Their principles and mathematical formulas will be introduced below.

       A-law compression is a common method of digitizing analog signals and is often used for the compression of telephone communications and digital audio signals. Its principle is to perform nonlinear transformation on the input signal to compress the dynamic range of the signal, thereby improving coding efficiency. Specifically, A-law compression increases the dynamic range of the signal when the input signal amplitude is small, making it easier to encode; and when the input signal amplitude is large, it compresses the dynamic range of the signal to avoid exceeding the representation of the digital signal. scope. The mathematical formula of A-law compression can be expressed as:

y = (1 + ln(x / A)) / (1 + ln(A)), x >= 0

Among them, y is the quantized digital signal, x is the original analog signal, and A is the threshold of the compressor, usually taken as 1/√1.5.

        The companding characteristics are realized by using polygonal lines, which are different from uniformly quantized straight lines and smooth curves of logarithmic companding characteristics. Although generally speaking, using polyline to compress expansion is non-uniform quantization, but it has both non-uniform quantization (different polylines have different slopes) and uniform quantization (within a small range of the same polyline). There are two commonly used digital companding technologies. One is 13-fold line A-law companding, whose characteristics are similar to the A-law companding characteristics of A=87.6. The other is the 15-fold line μ-law companding, whose characteristics are similar to the μ-law companding characteristics of μ=255.

        The advantage of A-law compression is that it can better retain the detailed information in the signal, while avoiding too many zeros and extreme values ​​in the digitized signal, thereby reducing errors in digital signal processing. However, A-law compression also has some disadvantages. For example, saturation may occur during the compression process, resulting in signal distortion. In practical applications, A-law compression is usually implemented through hardware circuits, which has the advantages of simple implementation and high reliability.

2. μ-law compression technology

        μ-law compression is another common analog signal digitization method. Its principle is similar to A-law compression. It also uses nonlinear quantization technology to compress the dynamic range of the analog signal into the limited number of bits of the digitized signal. μ-law compression is also a common method of digitizing analog signals. It also compresses the dynamic range of the signal through nonlinear quantization. The difference between μ-law compression and A-law compression lies in the different transformation functions used. μ-law compression uses arctangent function transformation, while A-law compression uses logarithmic transformation. In practical applications, μ-law compression is usually implemented with digital circuits, which has better flexibility and scalability. The mathematical formula of μ-law compression can be expressed as:

y = μx / (1 + μ|x|), x >= 0

Among them, y is the quantized digital signal, x is the original analog signal, and μ is the parameter of the compressor, usually 256 or 65536.

       The advantage of μ-law compression is that it can provide better accuracy and linearity when dealing with small signals, while avoiding too many zeros and extreme values ​​in the digitized signal. However, μ-law compression also has some disadvantages. For example, over-compression may occur when the signal is large, resulting in signal distortion.

       It should be noted that A-law compression and μ-law compression are both nonlinear quantization methods, and they can compress the dynamic range of the analog signal into the limited number of bits of the digitized signal. But there are some differences in their implementation. For example, A-law compression is usually implemented using discrete circuits, while μ-law compression is more suitable for digital circuit implementation. In addition, their applications in audio signal digitization are also slightly different, and it is usually necessary to select an appropriate compression method according to the specific application scenario.

       Generally speaking, A-law compression and μ-law compression are both effective audio signal digitization methods, with different application scenarios and advantages and disadvantages. For situations that require hardware implementation, A-law compression is simpler and more reliable; while for situations that require digital circuit implementation, μ-law compression is more flexible and scalable. In practical applications, appropriate quantification methods can be selected according to specific needs and scenarios.

3. MATLAB core program

......................................................................
A=87.6;% 定义 A 的值  
 
% u Law 计算公式,计算 yu  
yu=sign(x).*log(1+u*abs(x))/log(1+u);
% A Law 计算公式,循环计算 ya  
for i=1:length(x)
   if abs(x(i))<1/A
      ya(i)=A*x(i)/(1+log(A));
   else
      ya(i)=sign(x(i))*(1+log(A*abs(x(i))))/(1+log(A));
   end
end
 
figure(1)
plot(x,yu,'k.:');
title('u Law')
xlabel('x');
ylabel('y');
grid on
hold on
xx=[-1,-127/255,-63/255,-31/255,-15/255,-7/255,-3/255,-1/255,1/255,3/255,7/255,15/255,31/255,63/255,...
      127/255,1];
yy=[-1,-7/8,-6/8,-5/8,-4/8,-3/8,-2/8,-1/8,1/8,2/8,3/8,4/8,5/8,6/8,7/8,1];
plot(xx,yy,'r');
stem(xx,yy,'b-.');
legend('u律压缩特性','折线近似u律');
 
 
figure(2)
plot(x,ya,'k.:');
title('A Law')
xlabel('x');
ylabel('y');
grid on
hold on
xx=[-1,-1/2,-1/4,-1/8,-1/16,-1/32,-1/64,-1/128,1/128,1/64,1/32,1/16,1/8,1/4,1/2,1];
yy=[-1,-7/8,-6/8,-5/8,-4/8,-3/8,-2/8,-1/8,1/8,2/8,3/8,4/8,5/8,6/8,7/8,1];
plot(xx,yy,'r');
stem(xx,yy,'b-.');
legend('A律压缩特性','折线近似A律');
up2214

4. Simulation results

        In communications, the quality of communication is affected by the instability of the signal-to-noise ratio. In order to maintain a constant signal-to-noise ratio for different signal strengths, the compression characteristics are theoretically required to be logarithmic. In order to keep the signal volume-to-noise ratio constant, the A compression law and μ compression law and the corresponding approximation algorithms - the 13-fold line method and the 15-fold line method are introduced. The A-law 13-fold line method and the μ-law 15-fold line method will be theoretically studied, and then MATLAB will be used to implement simulation and perform performance analysis of the A-law 13-fold line method and the μ-law 15-fold line method. Finally, we get that generally speaking, the 15-fold line of U-law is 2 times different from the 13-fold line of A-law, and the slope of each section is 2 times different. Therefore, the signal-to-noise ratio of small signals is also twice as large as that of A-law, but for large signals, Law u is worse than law a.

Guess you like

Origin blog.csdn.net/ccsss22/article/details/133191687
Recommended