MPEG Layer I: use of scalefactor and quantizers

I'm studying MPEG compression on the book "Introduction to Data Compression" by Khalid Sayood. In the figure there is a paragraph piece about the subject.

I didn't understand a few things:

• use and how the scalefactor works
• use and how the 14 different quantizers work.

That are the parts highlighted in orange.

The scalefactor is a value that is used to decrease (or increase) the range of values, right?

I try to repeat what I understand:

1. Input signal is PCM samples over time
2. These samples are transformed into the frequency domain (I suppose with an FFT)
3. Samples are subdivided into frames of 384 samples each
4. Each frame is processed individually and subdivided into 32 equal frequency bands using a filter bank. Each subfield therefore contains 12 samples
5. encoder processes each sub-band individually and through a psychoacoustic analysis determine the number of bits to allocate for each quantized sample and possible quantization levels (linear quantization)
6. encode the samples and form the package
7. etc.

I know that point 5 is very superficial because I didn't understand the parts related to the scalefactor and the 14 different quantizers. Can anyone help me?

Somewhere I've read the quantization steps are the same for each sub-band and they are 2 dB each (linear quantization), so what's the scalefactor meaning? I think the scalefactor is a kind of exponent in the case of non linear and floating point quantization. So MPEG layer I use a linear or not lineare quantization?

That's what I understand. Why does the book mention 14 quantizers?

I read (quickly) the book you've been advising me (Introduction to Digital Audio Coding and Standards from Bosi). This is a piece that treats the part I didn't understand.

For each sub-band, the scalefactor (stored on 6 bits) is calculated from the 63 available and a quantizer (on 4 bits) of the 14 available.

The scalefactor is the largest sample of a sub-band. Once I've calculated it I use to divide each sample, obtaining 12 samples whose value is in the range [0, 1].

The quantizer has a numeric value that expresses the number of bits I use to encode each sample.

This is my usual scheming:

Why do I need to normalized the samples?

• as pointed out in your previous question, it's really not the fft. I promise! – Marcus Müller Sep 9 '17 at 8:25
• @MarcusMüller Ok, I believe you, but how then converted the audio signal into the domain of time in the frequency domain? Anyway, my doubts now concern other issues :) – beth Sep 9 '17 at 8:28
• Hm, my problem is that I really don't see things being converted to the frequency domain first, because that makes the rest of your algorithm very hard to argue for – I think you're still misunderstanding, or your book does. The input is not in frequency domain, as far as I can tell – Marcus Müller Sep 9 '17 at 8:35
• @MarcusMüller Thanks! Ok, so I can say that: 1. Input signal is PCM samples in frequency domain 2. Samples are subdivided into frames of 384 samples each 3. etc Right? Could you also help me with the meaning of scalefactor and quantizers? – beth Sep 9 '17 at 8:38
• @MarcusMüller you are right about Valerie :-) He's reading the wrong book for the purpose. And I'm also surprised that MPEG-1 Layer-I,II,III explicitly uses FFT for psychoacoustic model analysis... Anyway, I just wanted to mention the second book which is superior when it comes to practical implementation of the audio standard, after having learned the applied general theory (from the first book) behind lossless / lossy source coding techniques. – Fat32 Sep 9 '17 at 12:44

Let's get back to the official MPEG standard document and avoid your confusing literature for a moment!

So, you get audio as time samples. You use a very specifically crafted 32-band filterbank, which takes these input sample stream and generates 32 sample streams of each 1/32 of the original rate (that's the "time/frequency mapping" in that diagram you show, and the QMF in this diagram). All these streams are time-domain!¹

Now, you take a frame – that is, 12 "parallel" samples from each of these 32 streams. The codec's job is to figure out how "important" they are, and only use as much bits as needed to represent these.

The "importance" step is done by the psychoacoustic model (which might do arbitrary complex things, but that's not the point of discussion here), which will give us some info of the type "use $n_0$ bits for the first subband, $n_1$ for the second,…".

The Quantizer's job is now to take the 12 bits of "its" subband and save them with the $n$ bits depth it got. That's pretty straightforward. You just take the highest value in your 12 samples, scale it so that it is $2^n$, scale the other 11 samples as well, round them to integers, and save the scalefactor for later reconstruction.

You do that to all 32 subbands, and send the resulting streams of bits together with the scalefactors as the data part of an MPEG 1 Layer I frame.

At the decoder, you multiply with 1/scalefactor, then you transform the 32 subbands back into a single time signal.

Your confusion stems from the fact that you took the intro to that chapter as a kind of "step before" encoding happens, whereas it just was a slightly misleading (and claiming the samples were transformed to frequency domain) overview.

Also, the author of your book is wrong about the usage of the FFT in MPEG 1.

Be very precise about what you're exactly considering. We're here talking about MPEG 1 Layer I, not Layer III. In layer III ("MP3"), there's a kind-of-a-frequency-domain-transform happening on the subband samples (a modified Discrete Cosine Transform). That might have contributed to confusion.

¹ the "frequency mapping" is actually the mapping of signals to the frequency-disjunkt subbands. There's a bit of a mathematical caveat to that – the QMF filterbank is pretty close to being a wavelet transform, but I really wouldn't call it a time-frequency transformation. The original standard wouldn't want to do that, either, so they intentionally used the word "mapping". By the way, you'll find more info in the standard, which you can find by following the picture source that the author of your list (presumably) has in its table of figures.

• Thanks a lot, really. I changed my main message. Why does the book mention 14 quantizers? – beth Sep 9 '17 at 9:50
• That's the amount of possible values for $n\in\{2,3,4,5,6,7,8,9,10,11,12,13,14,15\}$; there's also the option of $n=0$, but that isn't really a quantizer, so it doesn't count as the "15. quantizer". – Marcus Müller Sep 9 '17 at 9:53
• for the rest of your edit: I think I explained the working of the quantizer fairly well, so if you could explain what you don't understand about my answer? (not about the book, I don't have that book, and at this point, I'd rather ignore it) – Marcus Müller Sep 9 '17 at 9:55
• What you say is clear to me, but it doesn't coincide with the one written in the book I'm studying. Anyway I thank you. – beth Sep 9 '17 at 10:07
• @Fat32 I'd like to add that there's multiple Open Source MPEG 1 Layer I encoders out there. FFMPEG, for example. Also note that MPEG 1 Layer I is really considered obsolete. In fact, can't think of a single use case. Layer II already works significantly better at no (modern technology-relative) significant increase in complexity, and layer III really has been the standard for permanent storage audio compression for the last 20 years. Modern Audio standards use MPEG 4. – Marcus Müller Sep 9 '17 at 12:48