4. Source coding

4.1. Analog/digital conversion

  1. The position of the source code in the communication system model The position of the
    source code in the communication system model is shown in the figure below.
    Insert picture description here
    For analog sources, the process of source coding includes analog/digital conversion and compression coding.
  2. What is the process of analog-to-digital conversion?
    The process of converting analog signals into digital signals through sampling, quantization and coding is analog/digital conversion, as shown in the figure below.
    Insert picture description here

4.1.1, sampling

  1. Explanation of sampling principle
    Sampling is to use the impulse signal to sample the analog signal at a certain time interval from the time domain; from the frequency domain, the analog signal spectrum is periodically expanded with the sampling frequency as the interval, as shown in the figure below .
    Insert picture description here
    In the above figure, x(t) represents the analog signal, p(t) represents the impulse signal used for sampling, and y(t) is the analog signal after sampling x(t). X(f), P(f), and Y(f) are functions in the frequency domain corresponding to x(t), p(t), and y(t), respectively.
  2. An explanation on the reconstruction principle
    uses an ideal low-pass filter to reconstruct an analog signal from the input sampled signal: from the time domain, each impulse of the sampled signal generates a sinc pulse at the output of the filter, which is superimposed to obtain the original analog signal ; From the frequency domain, the frequency spectrum of the sampled signal is multiplied by the frequency response of the ideal low-pass filter to obtain the frequency spectrum of the original analog signal, as shown in the figure below.
    Insert picture description here
    As can be seen from the above figure, in the time domain, the convolution of any function and the impulse function is equivalent to the principle of function translation, and multiple impulse functions can be superimposed to restore the initial analog signal. In the frequency domain, passing the sampled signal through the low-pass filter is equivalent to retaining the part of the sampled signal within the cut-off frequency of the low-pass filter.
  3. Explanation of the Nyquist sampling theorem
    In order to ensure that the original analog signal can be recovered from the sampled signal, the sampling frequency must meet certain conditions: the sampling frequency must be greater than 2 times the highest frequency of the analog signal: fs>2fmax. This is the Nyquist sampling theorem.
    An example of the Nyquist sampling theorem: Take the voice signal transmitted on the telephone line as an example. The highest frequency is 3400Hz. To reconstruct the voice signal from the sampled signal, the sampling frequency must be greater than 3400×2=6800Hz. Generally, the sampling frequency of PCM coding is 8kHz, which is greater than 6800Hz, which satisfies the sampling theorem.
  4. Viewing the Nyquist sampling theorem from the time domain
    Let's use the time domain waveform to intuitively experience the sampling theorem. For simplicity, a cosine wave with a frequency of f=5Hz is selected as the signal to be sampled.
    If the sampling frequency of fs=8f=40Hz is used for sampling, the waveform connected to each sample point is closer to the cosine wave, and the cosine signal should be recovered based on the sampling data. As shown below.
    Insert picture description here
    If you use the sampling frequency of fs=4f=20Hz to sample, the waveform connected to each sample point is a triangle wave, which is still close to the cosine wave, and the cosine signal should be recovered based on the sampled data. As shown below.
    Insert picture description here
    If the sampling frequency of fs=2f=10Hz is used for sampling, the waveform connected to each sample point is a triangle wave, which is still close to the cosine wave. According to these sampling data, the cosine signal should be recovered. As shown below.
    Insert picture description here
    However, it should be noted that if the sampling frequency fs=2f is used for sampling, the sampling starting point happens to be at the zero-crossing point of the cosine signal, and it is impossible to recover the cosine signal based on these sample data. As shown below.
    Insert picture description here
    If you use a sampling frequency of fs=6Hz<2f to sample, the result is exactly the same as the result of sampling a cosine wave with a frequency of f=1Hz, as shown in the figure below.
    Insert picture description here
    In other words, when the signal is confirmed using the sampling frequency of fs=6Hz, we don't know whether the frequency of the signal being sampled is 5Hz or 1Hz according to the sampling data. If the signal is sampled at a sampling frequency that is less than 2 times the highest frequency of the signal, frequency aliasing will occur. This phenomenon is called frequency aliasing .
  5. Looking at the Nyquist sampling theorem from the frequency domain, sampling
    the signal in the time domain is equivalent to periodically expanding the spectrum in the frequency domain with the sampling frequency as the interval.
    Suppose the frequency spectrum of the signal x(t) is as shown in the figure below.
    Insert picture description here
    The signal bandwidth of X(f) in the above figure is B, that is, the highest frequency of the signal is equal to B.
    In order to avoid frequency aliasing, first sample the signal with a higher sampling frequency, and the resulting sampled signal spectrum is shown in the figure below.
    Insert picture description here
    Sampling according to the above sampling frequency, the interval between the expanded frequency spectrum is larger, and the sampling frequency is further reduced, and the interval between the frequency spectrums is reduced, and frequency aliasing will not occur, as shown in the following figure.
    Insert picture description here
    Further reduce the sampling frequency until the frequency spectrum of the period extension is just above, as shown in the figure below.
    Insert picture description here
    Obviously, if the sampling frequency is further reduced, frequency aliasing will occur. In order to avoid frequency aliasing, the sampling frequency must be greater than twice the signal bandwidth.
  6. What is frequency aliasing?
    When the sampling frequency is lower than 2 times the signal bandwidth, that is, lower than 2 times the highest frequency of the signal, the periodically expanded signal spectrum overlaps together, which is frequency aliasing. As shown below.
    Insert picture description here
    Examples of frequency aliasing phenomena: In fact, frequency aliasing is also very common in real life. For example, when we are watching TV or movies, we sometimes find this phenomenon: as the car continues to accelerate, the speed of the wheels of the car gradually increases, but when the speed is accelerated to a certain speed, the speed of the wheels will suddenly slow down or even appear. The phenomenon of reversal is related to frequency aliasing. The frame rate of a general movie is only 24FPS (frames per second), that is, the camera takes 24 shots per second, and the projector displays 24 frames per second. If we regard the filming of a film as a process of signal sampling, then the projection of a film is a process of reconstructing the signal. 24FPS actually corresponds to a sampling frequency of 24Hz.
  7. Using the rotation vector to simulate the rotation of the wheel to illustrate the frequency aliasing phenomenon.
    Next, we use the rotation of the rotation vector to simulate the rotation of the wheel and analyze the above phenomenon.
    Assuming that the rotation speed of the rotating vector is 3 turns/sec, that is, f=3Hz, the sampling frequency fs=8Hz, the vector rotates 3/8 times within the sampling interval, and the sampled rotation vector is shown in the figure below.
    Insert picture description here
    The rotation vector in the sampling interval in the above figure has rotated [f/fs] circle. Since fs>2f, no frequency aliasing occurs: the rotation speed of the rotating vector is 3 turns/sec, and the sampled vector rotation speed is also 3 turns/sec.
    With the gradual increase of the vector speed f, 2f will exceed fs at a certain time, that is, fs<2f, and frequency aliasing will occur at this time.
    For example: the rotation speed of the rotating vector is 5 turns/sec, that is, f=5Hz, the sampling frequency fs=8Hz, the vector rotates 5/8 times within the sampling interval, and the sampled rotation vector is shown in the figure below.
    Insert picture description here
    In the above figure, because the rotation vector rotates counterclockwise for more than half a circle during the sampling interval, the span is too large, and the human eye is more inclined to rotate with a small span, that is, the equivalent clockwise rotation is a small half circle, so the feeling is clockwise. Hour hand sampling. Since fs<2f, frequency aliasing occurs: the rotation speed of the rotating vector is 5 revolutions/sec (counterclockwise rotation), but the sampled vector rotation speed is 3 revolutions/sec (clockwise rotation).
    With the further increase of the vector speed f, the sampling frequency fs is still less than 2f, and frequency aliasing still occurs. For example: the rotation speed of the rotation vector is 10 revolutions per second, that is, f=10Hz, the sampling frequency fs=8Hz, the vector rotates 10/8 revolutions (equivalent to 2/8 revolutions) within the sampling interval, and the sampled rotation vector is as shown in the figure below Shown.
    Insert picture description here
    In the above figure, due to fs<2f, frequency aliasing occurs: the rotation speed of the rotating vector is 10 revolutions/sec (counterclockwise rotation), but the sampled vector rotation speed is 2 revolutions/sec (counterclockwise rotation).
  8. What is the difference between the ideal sampling process and the actual sampling process?
    All discussed above are ideal sampling. The sampling signal consists of a series of impulse signals, as shown in the figure below.
    Insert picture description here
    Sampling: Multiply the sampled pulse signal with the analog signal to obtain a series of impulse signals.
    Reconstruction: The input to the ideal low-pass filter is a series of impulse signals.
    Sampling in the actual system is different from ideal sampling. There is no need to generate a sampling pulse signal to multiply the analog signal during sampling. You only need to obtain the level value of the analog signal at the sampling moment, as shown in the figure below.
    Insert picture description here

4.1.2, quantification

  1. What is quantification?
    The so-called quantization is to normalize the level of the sampled signal to a finite number of quantized levels (similar to the small rectangle in the integration) to realize the discretization of the amplitude of the sampled signal, as shown in the figure below.
    Insert picture description here
    The following are several common concepts in
    quantization : Quantization level: The number of quantization levels is called quantization level.
    Quantization error: The difference between the quantized value of the signal level and the actual value is called quantization error, also known as quantization noise. The magnitude of the quantization noise is at most equal to 1/2 of the quantization interval.
    Quantization signal-to-noise ratio = signal power/quantization noise power.
  2. What is uniform quantization? What are the properties of uniform quantification?
    The so-called uniform quantization means that the quantization level takes equal intervals.
    Take a certain waveform signal as an example, the level after uniform quantization is shown in the figure below.
    Insert picture description here
    Insert picture description here
    The above two pictures are uniformly quantized. Obviously, the more quantization levels, the smaller the quantization interval, and the smaller the quantization noise. The quantization error of the first picture is higher than the quantization error of the second picture.
    The uniform quantization method is simple, but when the signal level is relatively low, the quantization signal-to-noise ratio is relatively low, as shown in the figure below.
    Insert picture description here
    It can be seen from the above figure that the signal level is low, the signal power is low, and the quantized signal-to-noise ratio is the ratio of signal power to noise power, so the quantized signal-to-noise ratio will be correspondingly low.
  3. What is non-uniform quantification? What are the properties of non-uniform quantification?
    Why introduce non-uniform quantification ?
    Telephone communication requires the signal-to-noise ratio of the line to be at least 28dB, and statistics have found that there is a high probability of small signals during the call. In the case that the number of quantization levels cannot be too high, if uniform quantization is used, it is difficult to meet the signal-to-noise ratio requirements, which leads to non-uniform quantization.
    The so-called non-uniform quantization refers to the unequal interval of the quantization level, and the quantization interval increases with the increase of the signal level: fine quantization of small signals, coarse quantization of large signals. As shown below.
    Insert picture description here
    This quantization method is relatively complicated, but it can ensure that the quantized signal-to-noise ratio in a scene where the signal level is relatively small and the signal level is relatively large is similar.
  4. How to achieve non-uniform quantization in practice?
    Generally, a compressor is connected in series with a uniform quantizer on the transmitting end to achieve non-uniform quantization. Correspondingly, there is an expander on the receiving end, as shown in the figure below.
    Insert picture description here
    The output-input relationship of the compressor and expander is shown in the figure below.
    Insert picture description here
    PS: Explanation of the principle of using compressors, uniform quantizers and expanders to achieve non-uniform quantization.
    The essence of compression is shown in the figure below.
    Insert picture description here
    From the above figure, it can be seen that after the large signal passes through the compressor, the amplitude is almost unchanged compared to the original one, while the amplitude of the small signal has been greatly amplified compared to before. This reduces the amplitude difference between large and small signals, which also weakens the problem of low quantized signal-to-noise ratio of uniformly quantized small signals, because small signals are amplified. The specific compression and enlargement process is shown in the figure below.
    Insert picture description here

4.1.3, coding

1. Definition of coding. How to encode the quantized signal?
The so-called encoding is to express the quantized signal level value with binary numbers.
When the number of quantization levels is N, the signal level value needs to be represented by log2N-bit binary numbers. Taking the number of quantization levels as 16 as an example, a 4-bit binary number is required, as shown in the figure below.
Insert picture description here

4.1.4. Realization

  1. Which instruments are used to complete the analog/digital conversion function and digital/analog conversion function in the communication system?
    The analog/digital conversion function in the communication system is generally completed by the ADC, and the digital/analog conversion is completed by the DAC.
  2. Description of the working principle of the analog-to-digital converter.
    ADC is analog/digital converter.
    The working principle block diagram of a 3-bit parallel comparison ADC is shown in the figure below.
    Insert picture description here
    The analog-to-digital converter in the above figure is mainly composed of a resistor divider, a voltage comparator, a register and an encoder. The 8 resistors in the figure divide the reference voltage VREF into 8 levels, and the 7 levels of voltage are used as the reference voltages of the 7 comparators C1~C7, and their values ​​are VREF/15, 3VREF/15, …, 11VREF/ 15, 13VREF/15.
    The input voltage is V1, and its size determines the output state of each comparator. For example:
    when 0≤V1<VREF/15, the output states of C1~C7 are all 0;
    when 3VREF/15≤V1<VREF/15, The output status of the comparators C6 and C7: C06=C07=1, the output status of the other comparators are all 0.
    The output state of the comparator is stored by the D flip-flop and encoded by the priority encoder to obtain a digital output.
    Suppose the range of V1 is 0~VREF, and the output 3-digit digital quantity is D2D1D0. The input and output relationship of the 3-digit parallel comparison A/D converter is shown in the figure below.
    Insert picture description here
    In order to better understand the principle of ADC, draw the input signal (V1), clock pulse (CP), sampling signal, and quantization level signal into a picture, as shown in the figure below.
    Insert picture description here
  3. The working principle of the digital-to-analog converter.
    DAC is a digital/analog converter.
    The working principle block diagram of a 3-bit R-2R network DAC is shown in the figure below.
    Insert picture description here
    The digital-to-analog converter in the above figure is mainly composed of a resistor network, three single-pole double-throw electronic switches, a reference voltage VREF and an operational amplifier.
    The resistors R and 2R form a T-shaped resistor network. S0~S2 are 3 electronic switches, which are respectively controlled by the input digital signal 3 binary numbers D0~D3:
    when Di=0, the electronic switch Si is turned to the left and grounded;
    when Di=1, the electronic switch Si Turn it to the right and connect with the inverting input terminal of the operational amplifier.
    The operational amplifier constitutes an inverting proportional amplifier, and its output Vo is an analog signal voltage.
    VREF is the reference voltage.
    Since the inverting input terminal of the operational amplifier is the "virtual ground", no matter whether the electronic switch Si is placed on the left or the right, the equivalent resistance from the T-shaped resistor network nodes A, B, C to the "ground" to the left is R, so the expression of the current in the circuit can be easily obtained as shown in the figure below:
    Insert picture description here
    and the total current I′ flowing through the feedback resistor R is related to the state of the electronic switch S0~S2, and only when Si is turned to the right, the corresponding Ii will flow to the feedback resistor R, so by the formula in the figure below.
    Insert picture description here
    Note: Due to the "virtual break" characteristic of the operational amplifier, the current flowing into the inverting input terminal is ignored.
    The calculation formula of the output voltage of the operational amplifier is shown in the figure below.
    Insert picture description here
    Assumption: VREF=-10V.
    The output analog voltage corresponding to the input digital signal is shown in the figure below.
    Insert picture description here
    Obviously, the output analog voltage Vo is proportional to the input digital quantity (as shown in the figure below), and the digital/analog conversion is completed.
    Insert picture description here

Guess you like

Origin blog.csdn.net/ISs_Cream/article/details/110733620