Audio and video coding-Pulse Code Modulation (PCM)

Pulse Code Modulation (PCM) is a digital signal encoding technology used to convert analog signals into digital signals. It mainly includes three processes: sampling, quantization and encoding.

The so-called pulse code modulation (PCM) is not just a quantification method, but should be described as a digital modulation method, that is, a method that converts analog signals into digital signals through sampling, quantization and encoding so that they can be A means of propagation in digital channels. PCM is widely used in the audio and video fields and is one of the basic technologies commonly used in digital communications and storage.

 

Pulse code modulation: The process of converting the quantized pulse signal into a binary code group to establish a one-to-one correspondence between the quantization level and the binary code group.​ 

1. The principle of PCM is as follows:

1. Sampling:
PCM first samples the analog signal, that is, selects a series of sampling points evenly in time. The sampling frequency determines the number of samples per second and is important to retain the frequency range and detail of the original analog signal. Common audio sampling frequencies are 44.1 kHz (for CD quality sound) or 48 kHz (for digital audio workstations and video). A higher sampling frequency provides better audio quality, but also increases the amount of data.

During the PCM sampling process, the sampling frequency must satisfy the Nyquist Sampling Theorem. The theorem states that in order to accurately reconstruct the original analog signal, the sampling frequency must be at least twice the highest frequency of the signal. If the sampling frequency is lower than the Nyquist frequency, sampling distortion occurs, causing the reconstructed signal to be distorted.

2. Quantization:
Quantization is the process of mapping continuous analog signal values ​​into discrete digital values. In PCM, quantization maps the analog signal value at each sample point into discrete digital quantization levels. The number of quantization levels is determined by the number of quantization bits, for example, 16-bit PCM uses 65536 quantization levels.

The number of quantization bits determines the number of quantization levels, that is, the precision of digitization. Common quantization bits are 16 bits, 24 bits or 32 bits. Higher quantization bits provide higher dynamic range and lower quantization error, but also increase the amount of data.

The quantization process introduces quantization error, which is called quantization noise. Quantization noise results from the discretization of a continuous analog signal into a limited number of quantization levels, that is, the difference between the quantization levels and the original analog signal value. Quantization noise usually has the characteristics of uniform distribution or Gaussian distribution. Higher quantization bits can reduce quantization errors and improve signal accuracy. Signal-to-Noise Ratio (SNR) is used to measure the impact of quantization error on signal quality and represents the ratio of signal strength to quantization error. A higher signal-to-noise ratio means lower quantization error and better signal quality.

In PCM, a commonly used quantization method is linear quantization, which maps analog signal values ​​uniformly to quantization levels. Linear quantization can simplify the encoding and decoding process, but it may waste bits in low signal strength areas and may introduce large quantization errors in high signal strength areas. To solve this problem, nonlinear quantization methods such as μ-law and A-law can be used. These methods provide higher quantization accuracy in low signal intensity areas and lower quantization accuracy in high signal intensity areas.​ 

3. Encoding:
Encoding is the process of expressing quantized digital values ​​into binary codewords. In PCM, binary representation of quantization levels is used. For example, for 16-bit PCM, the quantization level of each sample point is represented by a 16-bit binary number.

PCM coding method selection principles: simple, easy to understand and implement; strong anti-interference ability.

Commonly used PCM encoding methods:

Natural binary code: simple, easy to understand and implement

Gray code: has strong anti-interference ability

Folding code: suitable for anti-interference of speech signals with high probability of small signal value

4. Channel transmission:
PCM-encoded digital signals can be transmitted through digital channels, such as digital audio interfaces (such as S/PDIF) or network transmission.

5. Decoding:
At the receiving end, the PCM signal converts the binary codeword into a quantization level through the decoding process. The decoding process is the reverse process of the encoding process.

The decoding process includes the following steps:

① Read each sample from the PCM encoded data.

②Convert each sample into the corresponding digital value based on the sampling rate and the number of quantization bits.

③For each digital value, apply the decoding algorithm to restore its original amplitude value.

 The decoding algorithm of PCM is usually used to convert the PCM-encoded digital signal back to an analog signal. The following are some common PCM decoding algorithms:

①. Direct decoding:
Direct decoding is one of the simplest PCM decoding algorithms. It involves converting PCM encoded data into corresponding digital values ​​and then using these digital values ​​as the amplitude value of the analog signal. This decoding method does not involve filtering or other signal processing steps and directly outputs digital values ​​as analog signals.

②. Interpolation decoding:
The interpolation decoding algorithm is used to interpolate between decoded discrete samples to restore the continuity of the analog signal. It can estimate values ​​between samples using linear interpolation, polynomial interpolation, or other interpolation methods. The interpolation decoding algorithm can improve the smoothness and continuity of the signal.

③. Predictive decoding:
The predictive decoding algorithm uses previous sample values ​​and prediction models to predict the value of the current sample. It does this by encoding and decoding prediction errors. Predictive decoding algorithms are often used in compression coding to reduce the difference between the decoded signal and the original signal.

④. ADPCM (Adaptive Differential Pulse Code Modulation) decoding:
The ADPCM decoding algorithm is an improved PCM decoding algorithm, is used Process signals with a large dynamic range. It is based on differential coding and adaptive adjustment of prediction errors to restore the amplitude value of the original signal.

PCM itself is not a compression coding technology, it is a lossless coding that can retain the integrity of the original signal. However, since PCM requires large data transmission bandwidth and storage space, in order to achieve a higher compression ratio, compression coding technology can be used in combination, such as lossless compression algorithm (such as FLAC) or lossy Compression algorithm (such as MP3, AAC). These algorithms can reduce the amount of data by removing redundant information from the signal or taking advantage of the characteristics of the human ear or eye, but they will introduce certain distortion.

6. Reconstruction:
Reconstruction is the process of converting quantization levels into analog signals, that is, the reconstruction process is used to convert decoded digital signals back to analog Signal. By using a reconstruction filter, the quantization levels are converted into a continuous analog signal for audio playback or video display.

The reconstruction process includes the following steps:

① Use the reconstruction filter to filter the decoded digital signal. The function of the reconstruction filter is to remove quantization noise and restore the smoothness of the signal.

② Amplify the filtered signal through a recovery amplifier so that it reaches the same amplitude range as the original signal.

③The final analog signal is the reconstruction of the PCM signal.

In the PCM reconstruction process, commonly used reconstruction filters include the following:

①. Low-pass Filter:
The low-pass filter is used to remove high frequencies from the decoded digital signal. components to restore signal smoothness and continuity. Itallows low-frequency components to pass while blocking high-frequency components.

②. Interpolation Filter:
The interpolation filter is used to interpolate between decoded discrete samples to Restore analog signal continuity. The interpolation filter can estimate the value of the intermediate point based on the difference between discrete samples, thereby achieving smooth signal reconstruction.

③. Reconstruction Filter Bank:
The reconstruction filter bank is a group of filters, is used to The decoded digital signal is decomposed into different frequency bands, and each band is filtered and reconstructed. This kind of filter bank is often used for multi-channel audio decoding and reconstruction, such as stereo audio decoding.

④. Post-filter:
Post-filter is used to reduce the quantization noise of the decoded digital signal. to improve the quality of the reconstructed signal. It can apply some noise reduction techniques, such as adaptive filtering or acoustic models, to improve the clarity and naturalness of the signal.

PCM bit speed and data rate:

Bit rate refers to the number of bits transmitted or processed per unit time. In PCM, the bit rate depends on the product of the sampling frequency and the number of quantization bits. For example, with 16-bit PCM and a sampling frequency of 44.1 kHz, the bit rate is 16 bits × 44,100 Hz = 705,600 bps. Data rate refers to the amount of data transmitted per unit time, usually in bytes or bits. The data rate is equal to the bit rate divided by 8 (if measured in bytes). Therefore, for the above example, the data rate is 705,600 bps / 8 = 88,200 bytes per second.

Dynamic range of PCM:
Dynamic range refers to the amplitude range between the maximum and minimum values ​​in the signal. In PCM, the dynamic range is limited by the number of quantization bits. Higher quantization bits provide greater dynamic range, allowing smaller signal details to be preserved.

Error propagation of PCM:
In PCM, quantization errors are propagated during the encoding and decoding processes. This means that the decoded signal may have some accumulated errors. To reduce the impact of error propagation, compensation techniques such as cyclic redundancy check (CRC) or forward error correction coding (FEC) can be used.

To summarize,The decoding and reconstruction process of PCM involves reading samples from PCM encoded data and converting them into corresponding digital values. Then, the original amplitude value of the sample is restored through the decoding algorithm. Next, the decoded digital signal is converted back to the original analog signal through reconstruction filter filtering and recovery amplifier amplification, thereby achieving decoding and reconstruction of the PCM signal.

It is stated again thatPCM is a modulation method that converts analog signals into digital signals through sampling, quantization, and encoding. It is not just a coding method. Binary encoding is used.  

2. Advantages and disadvantages of PCM:

Advantages: Lossless encoding, no additional distortion is introduced, and the integrity of the original signal can be retained. Simple, reliable, easy to implement and decode. Ideal for applications requiring high fidelity, such as audio recording and audio production.

Disadvantages: It requires large data transmission bandwidth and storage space, so it cannot achieve high compression ratio and relatively low data compression efficiency. In some applications, more advanced compression encoding technologies, such as MP3 or AAC, may be used to achieve higher compression ratios and more efficient data transmission.

3. Application of PCM:

PCM is widely used in audio and video fields. In terms of audio, PCM is used for audio recording, audio transmission (such as CD, digital audio interface) and audio storage (such as WAV file format). In terms of video, PCM is used for the audio part of video encoding, such as audio encoding in the AVI file format.

Guess you like

Origin blog.csdn.net/qq_42233059/article/details/134904772