分享

Dither examples

 黄浦江中的一条鱼 2008-12-10

Dither examples

There are three typical dither PDF's used in PCM digital audio, RPDF, TPDF (triangular PDF) and Gaussian PDF. We'll look at the first two.

For this section, I used MATLAB to make a sine wave with a sampling rate of 32.768 kHz. I realize that this is a strange sampling rate, but it made the graphs cleaner for the FFT analyses. The total length of the sine wave was 32768 samples (therefore 1 second of audio.) MATLAB typically calculates in 64-bit floating point, so we have lots of resolution for analyzing an 8-bit signal, as I'm doing here.

To make the dither, I used the MATLAB function for generating random numbers called RAND. The result of this is a number between 0 and 1 inclusive. The PDF of the function is rectangular as we'll see below.

RPDF dither should have a rectangular probability density function with extremes of -0.5 and 0.5 LSB's. Therefore, a value of more than half of an LSB is not possible in either the positive or negative directions. To make RPDF dither, I made a vector of 32768 numbers using the command RAND(1, n) - 0.5 where $n$ is the length of the dither signal, in samples. The result is equivalent to white noise.

Figure 8.19: Histogram of RPDF dither for 32k block. The MATLAB equation is RAND(1, 32768) - 0.5
\includegraphics[width=2.75in]{08digital/graphics/rpdf_hist_32k}

Figure 8.20: Probability distribution function of RPDF dither for 32k block.
\includegraphics[width=2.75in]{08digital/graphics/rpdf_pdf_32k}

TPDF dither has the highest probability of being 0, and a 0 probability of being either less than -1 LSB or more than 1 LSB. This can be made by adding two random numbers, each with an RPDF together. Using MATLAB, this is most easily done using the the command RAND(1, n) - RAND(1, n) where $n$ is the length of the dither signal, in samples. The reason they're subtracted here is to produce a TPDF that ranges from -1 to 1 LSB.

Figure 8.21: Histogram of TPDF dither for 32k block. The MATLAB equation is RAND(1, 32768) - RAND(1, 32768)
\includegraphics[width=2.75in]{08digital/graphics/tpdf_hist_32k}

Figure 8.22: Probability distribution function of TPDF dither for 32k block.
\includegraphics[width=2.75in]{08digital/graphics/tpdf_pdf_32k}

Let's look at the results of three options: no dither, RPDF dither and TPDF dither. Figure 8.23 shows a frequency analysis of 4 signals (from top to bottom): (1) a 64-bit 1 kHz sine wave, (2) an 8-bit quantized version of the sine wave without dither added, (3) an 8-bit quantized version with RPDF added and (4) an 8-bit quantized version with TPDF added.

Figure 8.23:From top to bottom, a 64-bit sine 1 kHz wave in MATLAB, 8-bit no dither, 8-bit RPDF dither, 8-bit TPDF dither. Fs = 32768 Hz, FFT window is rectangular, FFT length is 32768 point.
\includegraphics[width=2.75in]{08digital/graphics/1k_dither_fft}

One of the important things to notice here is that, although the dithers raised the overall noise floor of the signal, the resulting artifacts are wide-band noise, rather than spikes showing up at harmonic intervals as can be seen in the no-dither plot. If we were to look at the artifacts without the original 1 kHz sine wave, we get a plot as shown in Figure 8.24.

Figure 8.24: Artifacts omitting the 1 kHz sine wave. From top to bottom, 8-bit no dither, 8-bit RPDF dither, 8-bit TPDF dither. Fs = 32768 Hz, FFT window is rectangular, FFT length is 32768 point.
\includegraphics[width=2.75in]{08digital/graphics/artifacts_fft}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多