In this posting from some time ago, I wrote down certain details I had learned about MP3 sound compression. I suppose that while I did write, that the Discreet Cosine Transform coefficients get scaled, I may have missed to mention in that same posting, that they also get quantized. But I did imply it, and I also made up for the omission in this posting.
But one subject which I did mention over several postings, was my own disagreement with the practice, of culling frequency-coefficients which are deemed inaudible, thus setting those to zero, just to reduce the bit-rate in one step, hoping to get better results, ‘because a lower initial bit-rate also means that the user can select a higher final bit-rate…’
In fact, I think that some technical observers have confused two separate processes that take place in MP3:
- An audibility threshold is determined, so that coefficients which are lower than that are set to zero.
- The non-zero coefficients are quantized, in such a way that the highest of them fits inside a fixed maximum, quantized value. Since a scale-factor is computed for one frequency sub-band, this also implies that close to strong frequency coefficients, weaker ones are just quantized more.
In principle, concept (1) above disagrees with me, while concept (2) seems perfectly fine.
And so based on that I also need to emphasize, that with MP3, first a Fast-Fourier Transform is computed, the exact implementation of which is not critical for the correct playback of the stream, but the only purpose of which is to determine audibility thresholds for the DCT transform coefficients, the frequency-sub-bands of which must fit the standard exactly, since the DCT is actually used to compress the sound, and then to play it back.
This FFT can serve a second purpose in Stereo. Since this transform is assumed to produce complex numbers – unlike the DCT – it is possible to determine whether the Left-Minus-Right channel correlates positively or negatively with the Left-Plus-Right channel, regarding their phase. The way to do this effectively, is to compute the dot-product between two complex numbers, and to see whether this dot-product is positive or negative. The imaginary component of one of the sources needs to be inverted for that to work.
But then negative or positive correlation can be recorded once for each sub-band of the DCT as one bit. This will tell, whether a positive difference-signal, is positive when the left channel is more so, or positive if the right channel is more so.
You see, in addition to the need to store this information, potentially with each coefficient, there is the need to measure this information somehow first.
But an alternative approach is possible, in which no initial FFT is computed, but in which only the DCT is computed, once for each Stereo channel. This might even have been done, to reduce the required coding effort. And in that case, the DCT would need to be computed for each channel separately, before a later encoding stage decides to store the sum and the difference for each coefficient. In that case, it is not possible first to determine, whether the time-domain streams correlate positively or negatively.
This would also imply, that close to strong frequency-components, the weaker ones are only quantized more, not culled.
So, partially because of what I read, and partially because of my own idea of how I might do things, I am hoping that OGG sound compression takes this latter approach.
(Note : ) Just to emphasize how implementation-specific the computation of the FFT might be, this transform can indeed be computed in such a way, that it only yields one coefficient per octave. This would mean that the FFT used would have fewer coefficients, than the DCT has sub-bands.
This would not prevent a working Codec from being designed, because the FFT coefficients can be treated as though connected by straight lines. And then, for each DCT sub-band, one interpolated value can be taken from the FFT, as though the sub-band corresponded to one point on this connected graph.
Any presumed dot-products could be interpolated likewise.
(Edit 11/16/2016 : )
But OTOH, a specific programmer might be working within the constraints of MP3 compression, yet attempting to design a superior Codec, that yields better sound, by using an FFT which might have
(1 * 8) + (6 * 4) = 32 Coefficients .
The result might be, that his DCT coefficients are culled more selectively, and that he achieves better sound.
In such a case, the actual, constant frequency of each DCT coefficient can be treated as a floating-point number, for the purpose of interpolating a value from the FFT, which now has more coefficients than the DCT has sub-bands.
I read notes somewhere on the Web once, written by a programmer, who was claiming to compute 32 FFT sub-bands, which was a claim that made no sense. If it had 32 sub-bands, then it would more probably have been one of the Discreet Transforms.
Yet, because such a number of sub-bands is unreasonable, I will assume that this other writer made a mistake in English, and that he was after all, computing the 32 FFT coefficients I deduced above.