2
$\begingroup$

I read on Wikipedia MP3 that the MP3 standard uses a modified discrete cosine transform.

Why does it use a modified transform and not the original DCT like the JPEG standard? Are there reasons specific to sound signals compared to images?

Reading the MDCT article:

This overlapping, in addition to the energy-compaction qualities of the DCT, makes the MDCT especially attractive for signal compression applications, since it helps to avoid artifacts stemming from the block boundaries.

This doesn't explain why it helps to avoid artifacts. I would like to have explanations on that.

$\endgroup$
2
  • 2
    $\begingroup$ Explained in the first paragraph of the MDCT article linked from the MP3 article; assuming you clicked that same link, could you maybe explain what is unclear? $\endgroup$ Jan 25, 2023 at 16:48
  • $\begingroup$ "This overlapping, in addition to the energy-compaction qualities of the DCT, makes the MDCT especially attractive for signal compression applications, since it helps to avoid artifacts stemming from the block boundaries." This doesn't explain why it helps avoid artifacts. I would like to have explainations on that. $\endgroup$
    – Weier
    Jan 25, 2023 at 21:29

4 Answers 4

2
$\begingroup$

the modified discrete cosine transform (MDCT) is a lapped transform, which means it is applied to consecutive blocks of audio data in linear time. your analogy to jpg is exactly why it is used, because audio signals progress in time, unlike a jpg which is static in time. reconstruction and time-domain aliasing cancellation (TDAC) are also features which make the MDCT an attractive transform

$\endgroup$
8
  • 2
    $\begingroup$ A digital image progresses along two axes, a piece of audio along the time axes – where's the actual difference in this progression? Why does "in time" make a difference compared to "along the X-axis"? $\endgroup$ Jan 25, 2023 at 16:49
  • $\begingroup$ i suppose the analogy would go, in successive 'frames' akin to a moving image. audio can definitely be visualized all at once in x and y axes (think FFT / spectrogram) as well but in the example above it is easier to 'frame' the answer using the time analogy $\endgroup$
    – zhiguang
    Jan 25, 2023 at 16:53
  • 3
    $\begingroup$ yeah, but it really turns out that the DCT nor the MDCT are typically used to encode temporal changes in an image. The point might well be that the MDCT prevents edge effects, which are less severe in visual perception than in acoustic perception, but the argument "images don't move" just doesn't make sense – the DCT in an image is done in a spatial dimension, and not the MDCT, even if there's an evolution in that direction :) $\endgroup$ Jan 25, 2023 at 16:57
  • 1
    $\begingroup$ yes. the 'edge effects' you mention and also aliasing artifacts are prevented in the MDCT as a lapped transform, which is why it is widely employed $\endgroup$
    – zhiguang
    Jan 25, 2023 at 17:02
  • 1
    $\begingroup$ same length as you'd do for the 8×8 blocks of DCTs, the discrete quantization tables,… I'd say. $\endgroup$ Jan 25, 2023 at 17:19
0
$\begingroup$

The MDCT uses a windowing function to taper the original signal to zero at beginning and end of a block to avoid artifacts from the discontinuities.

But as the MDCT advances only by half a block at a time, the sum of window functions when the the same half-block is processed twice will add up to unity, so no data is lost.

$\endgroup$
0
$\begingroup$

The utility of the MDCT is that it is 50% overlapped while still being critically sampled (ie not increasing the number og samples needed to represent a signal). The built in anti aliasing / windowing features removes blocking artifacts. While retaining the DCT properties.

I think the question to ask here is why JPEG does not employ some MDCT like transform. Perhaps because:

  • JPEG was finalized around the time of the first MDCT papers.
  • Doing a 2-d 50% overlap transform might in some sense mean 4x more data to process and more cumbersome memory access
  • Image transforms tends to be quite small and our vision may be more foregiving of DCT artifacts than our hearing
$\endgroup$
0
$\begingroup$

MP3 audio standard uses "subband coding technique".

The processing at encoder end of an MP3 involves passing the input signal through a subband filterbank containing $32$ filters. Each of the filtered outputs are downsampled by a factor of $32$ (we will keep down-sampling part for later). The passband bandwidth of each of these filters is same and it is non-overlapping. Say $Fs$ represents operating sampling frequency then each of the 32 filter banks have a bandwidth of $\frac{(\frac{Fs}{2})}{32} = \frac{Fs}{64}$.

The impulse response of each of the filters in the filterbank is obtained by using "cosine modulation technique" as described below.

The baseband filter with bandwidth $\frac{Fs}{64}$ has passband in the range $[-\frac{Fs}{128}, \frac{Fs}{128}]$. The frequency of cosine signal used by modulation to get impulse response of $k^{th}$ filter will be $(k.\frac{Fs}{64} + \frac{Fs}{128})$

Say $h[n]$ represents the impulse response of the base band signal. Then let $h_k[n]$ represent the impulse response of $k^{th}$ filter in the filterbank. The bandwidth of the base-band signal. Then, $$h_k[n] = h[n].cos(\frac{(2 . \pi . (k.\frac{Fs}{64} + \frac{Fs}{128}) . (n + D))}{Fs})$$

On simplification

$$h_k[n] = h[n].cos(\frac{(2 . \pi . (k + 1/2) . (n + D)}{64}))$$

The additional $D$ term is needed for perfect reconstruction scenario. In this case the value of $D$ is $-16$

Let $y[k][n]$ represent the output from $k-th$ filter of the filter bank for input signal $x[n]$. Then, $$y[k][n] = \sum_{i=0}^{L-1}h_k[i] . x[n-i]$$

The output from each filter will be downsampled and used for further processing. The downsampling factor being $32$ in this case. So the above equation becomes

$$y[k][32n] = \sum_{i=0}^{L-1}h_k[i] . x[32n-i]$$ $$y[k][32n] = \sum_{i=0}^{L-1}h[i].cos(\frac{(2 . \pi . (k + 1/2) . (n + D)}{64})) . x[32n-i]$$

Replacing $D$ with $-16$

$$y[k][32n] = \sum_{i=0}^{L-1}h[i].cos(\frac{(2 . \pi . (k + 1/2) . (n - 16)}{64})) . x[32n-i]$$

From the above equation it can also be observed that the cosine term in the summation is in modified form of the cosine term in DCT equation. With some rearrangement (skipping this part) of the above equation, it can be shown that the filterbank can be realized using MDCT. Thus MP3 uses MDCT to conveniently carry out filterbank processing.

Some of the reading materials online on MP3 directly keep the MDCT block in the processing steps skipping this derivation. This creates confusion for the readers about MDCT in MP3.

In summary MP3 uses MDCT only to realize the filter bank in an easier way.

AAC is another MPEG standard where MDCT is actually applied on the input signal for processing.

Hope this answer helps!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.