The calculation of the psychoacoustic model has to be adapted to the corresponding layer. The example presented here is valid for Layers I and II. The model can be adapted to Layer III.
There is no principal difference in the application of psychoacoustic model 1 to Layer I or II.
Layer I: | A new bit allocation is calculated for each block of 12 subband or 384 input PCM samples. |
Layer II: | A new bit allocation is calculated for three blocks totalling 36 subband samples corresponding to 3*384 (1 152) input PCM samples. |
The bit allocation of the 32 subbands is calculated on the basis of the signal-to-mask ratios of all the subbands. Therefore, it is necessary to determine for each subband, the maximum signal level and the minimum masking threshold. The minimum masking threshold is derived from an FFT of the input PCM signal, followed by a psychoacoustic model calculation.
The FFT performed in parallel with the subband filter operation compensates for the lack of spectral selectivity obtained at low frequencies by the subband filterbank. This technique provides both a sufficient time resolution for the coded audio signal (Polyphase filter with optimised window for minimal pre-echoes) and a sufficient spectral resolution for the calculation of the masking thresholds. The frequencies and levels of aliasing distortions can be calculated. This is necessary for calculating a minimum bitrate for those subbands which need some bits to cancel the aliasing components in the decoder. The additional complexity to calculate the better frequency resolution is necessary only in the encoder, and introduces no additional delay or complexity in the decoder.
The calculation of the signal-to-mask-ratio is based on the following steps:
Step 1
- Calculation of the FFT for time to frequency conversion.
Step 2
- Determination of the sound pressure level in each subband.
Step 3
- Determination of the threshold in quiet (absolute threshold).
Step 4
- Finding of the tonal (more sinusoid-like) and non-tonal (more noise-like) components of the audio signal.
Step 5
- Decimation of the maskers, to obtain only the relevant maskers.
Step 6
- Calculation of the individual masking thresholds.
Step 7
- Determination of the global masking threshold.
Step 8
- Determination of the minimum masking threshold in each subband.
Step 9
- Calculation of the signal-to-mask ratio in each subband.
These steps will be further discussed. A sampling frequency of 24 kHz is assumed, unless stated otherwise. For the other two sampling frequencies all frequencies mentioned should be scaled accordingly.
Technical data of the FFT:
Layer I | Layer II | |
---|---|---|
- transform length N samples Window size if Fs = 24 kHz Window size if Fs = 22,05 kHz Window size if Fs = 16 kHz |
512 samples 21,33 ms 23,22 ms 32 ms |
1024 samples 42,67 ms 46,44 ms 64 ms |
- Frequency resolution | Fs / 512 | Fs / 1024 |
- Hann window, |
- power density spectrum X(k):
where s(l) is the input signal.
A normalisation to the reference level of 96 dB SPL (Sound Pressure Level) has to be done in such a way that the maximum value corresponds to 96 dB.
X(k) in subband n
where X(k) is the sound pressure level of the spectral line with index k of the FFT with the maximum amplitude in the frequency range corresponding to subband n. The expression is in Layer I the scalefactor, and in Layer II the maximum of the three scalefactors of subband n within a frame. The "10 dB" term corrects for the difference between peak and RMS level. The sound pressure level
(n) is computed for every subband n.
The following alternative method of calculating (n) offers a potential for better encoder performance, but this technique has not been subjected to a formal audio quality test.
The alternative sound pressure level in subband n is computed by:
with
where (n) is the alternative sound pressure level corresponding to subband n.
This step starts with the determination of local maxima, then extracts tonal components (sinusoids) and calculates the intensity of the non-tonal components within a bandwidth of a critical band. The boundaries of the critical bands are given in the tables "Critical band boundaries" (tables D.2a, D.2b, D.2c for Layer I; tables D.2d, D.2e, D.2f for Layer II).
The bandwidth of the critical bands varies with the center frequency with a bandwidth of about only 0,1 kHz at low frequencies and with a bandwidth of about 4 kHz at high frequencies. It is known from psychoacoustic experiments that the ear has a better frequency resolution in the lower than in the higher frequency region. To determine if a local maximum may be a tonal component, a frequency range df around the local maximum is examined. The frequency range df is given by:
Sampling rate: 16 kHz
df = 62,5 Hz | 0 kHz | < f <= | 3,0 kHz |
df = 93,75 Hz | 3,0 kHz | < f <= | 6,0 kHz |
df = 187,5 Hz | 6,0 kHz | < f <= | 7,5 kHz |
Sampling rate: 22,05 kHz
df = 86,133 Hz | 0 kHz | < f <= | 2,756 kHz |
df = 129,199 Hz | 2,756 kHz | < f <= | 5,512 kHz |
df = 258,398 Hz | 5,512 kHz | <f <= | 10,336 kHz |
Sampling rate: 24 kHz
df = 93,750 Hz | 0 kHz | < f <= | 3,0 kHz |
df = 140,63 Hz | 3,0 kHz | < f <= | 6,0 kHz |
df = 281,25 Hz | 6,0 kHz | < f <= | 11,250 kHz |
To make lists of the spectral lines X(k) that are tonal or non-tonal, the following three operations are performed:
a) Labelling of local maxima
A spectral line X(k) is labelled as a local maximum if
b) Listing of tonal components and calculation of the sound pressure level
A local maximum is put in the list of tonal components if
where j is chosen according to
Layer I, Fs=16 kHz:
j = 2, +2 | for | 2 < k < 96 |
j = 3,2, +2,+3 | for | 96 <= k < 192 |
j = 6,...,2,+2,...,+6 | for | 192<= k < 250 |
Layer II, Fs=16 kHz:
j = 4, +4 | for | 4 < k < 192 |
j = 6,...,2, +2,...,+6 | for | 192 <= k < 384 |
j = 12,...,2, +2,..., +12 | for | 384 <= k < 500 |
Layer I, Fs=22,05, 24 kHz:
j = 2, +2 | for | 2 < k < 64 |
j = 3,2, +2,+3 | for | 64 <= k < 128 |
j = 6,...,2,+2,...,+6 | for | 128<= k < 250 |
Layer II, Fs=22,05, 24 kHz:
j = 4, +4 | for | 4 < k < 128 |
j = 6,...,2, +2,...,+6 | for | 128 <= k < 256 |
j = 12,...,2, +2,..., +12 | for | 256 <= k < 500 |
If X(k) is found to be a tonal component, then the following parameters are listed:
Next, all spectral lines within the examined frequency range are set to dB.
c) Listing of non-tonal components and calculation of the power
The non-tonal (noise) components are calculated from the remaining spectral lines. To calculate the non-tonal components from these spectral lines X(k), the critical bands z(k) are determined using the tables, "Critical band boundaries" (tables D.2a, D.2b, D.2c for Layer I; tables D.2d, D.2e, D.2f for Layer II). 21 critical bands are used for the sampling rate of 16 kHz, 23 critical bands are used for 22,05 kHz and 24 kHz. Within each critical band, the power of the spectral lines (remaining after the tonal components have been zeroed) are summed to form the sound pressure level of the new non-tonal component (k) corresponding to that critical band.
The following parameters are listed:
In this expression, (k) is the absolute threshold (or threshold in quiet) at the frequency of index k. These values are given in tables D.1a, D.1b, D.1c for Layer I; tables D.1d, D.1e, D.1f for Layer II.
Layer I:
For the frequency lines corresponding to the frequency region which is covered by the first six subbands no subsampling is used. For the frequency region corresponding to the next six subbands every second spectral line is considered. Finally, every fourth spectral line is considered for the next 18 subbands (see also tables D.1a, D.1b, D.1c for Layer I).
Layer II:
For the frequency lines corresponding to the frequency region which is covered by the first three subbands no subsampling is used. For the frequency region which is covered by next three subbands every second spectral line is considered. For the frequency region corresponding to the next six subbands every fourth spectral line is considered. Finally, every eighth spectral line is considered for the next 18 subbands (See also tables D.1d, D.1e, D.1f for Layer II).
The number of samples, n, in the subsampled frequency domain depends on the layer. For Layer I, n equals 108, for Layer II, n equals 132.
Every tonal and non-tonal component is assigned the value of the index i that most closely corresponds to the frequency of the original spectral line X(k). This index i is given in tables D.1a, D.1b, D.1c for Layer I; tables D.1d, D.1e, D.1f for Layer II.
The individual masking thresholds of both tonal and non-tonal components are given by the following expression:
In this formula, and
are the individual masking thresholds at critical band rate z in Bark of the masking component at the critical band rate of the masker
in Bark. The values in dB can be either positive or negative. The term
[z(j)] is the sound pressure level of the masking component with the index number j at the corresponding critical band rate z(j). The term av is called the masking index and vf the masking function of the masking component
[z(j)]. The masking index av is different for tonal and non-tonal maskers (
and
).
For tonal maskers, it is given by
and for non-tonal maskers
The masking function vf of a masker is characterised by different lower and upper slopes, which depend on the distance in Bark dz = z(i) z(j) to the masker. In this expression i is the index of the spectral line at which the masking function is calculated and j that of the masker. The critical band rates z(j) and z(i) can be found in tables D.1a, D.1b, D.1c for Layer I; tables D.1d, D.1e, D.1f for Layer II. The masking function, which is the same for tonal and non-tonal maskers, is given by:
for 3 <= dz < 1 Bark |
for 1 <= dz < 0 Bark |
for 0 <= dz < 1 Bark |
for 1 <= dz < 8 Bark |
The total number of tonal maskers is given by m, and the total number of non-tonal maskers is given by n. For a given i, the range of j can be reduced to just encompass those masking components that are within 8 to +3 Bark from i. Outside of this range and
are -
dB.
where f(i) is the frequency of the frequency sample. The f(i) are tabulated in tables D.1a, D.1b, D.1c for Layer I; tables D.1d, D.1e, D.1f for Layer II. A minimum masking level
(n) is computed for every subband.
is computed for every subband n.
[ Index]