5.1 AAC error concealment
26.4023GPPAdditional decoder toolsEnhanced aacPlus general audio codecGeneral audio codec audio processing functionsTS
The AAC core decoder includes a concealment function that increases the delay of the decoder by one frame.
There are various tests inside the core decoder, starting with simple CRC tests and ending in a variety of plausibility checks. If such a check indicates an invalid bitstream, then concealment is applied. Concealment is also applied when the calling main program indicates a distorted or missing data frame using the frameOK flag. This is used for error detection on the transport layer.
Concealment works on the spectral data just before the final frequency to time conversion. In case a single frame is corrupted, concealment interpolates between the last good and the first good frame to create the spectral data for the missing frame. Always the previous frame will be processed by the frequency to time conversion, so here the missing frame to be replaced is the previous frame, the last good frame is the frame before the previous one and the first good frame is the actual frame. If multiple frames are corrupted, concealment implements first a fade out based on slightly modified spectral values from the last good frame. As soon as good frames are available, concealment fades in the new spectral data.
Interpolation of one corrupt frame:
In the following the actual frame is frame number n, the corrupt frame to be interpolated is the frame n-1 and the last but one frame has the number n-2.
The determination of window sequence and the window shape of the corrupt frame follows from the table below:
Table 1: Interpolated window sequences and window shapes
|
window sequence n-2 |
window sequence n |
window sequence n-1 |
window shape n-1 |
|
ONLY_LONG_SEQUENCE or LONG_START_SEQUENCE or LONG_STOP_SEQUENCE |
ONLY_LONG_SEQUENCE or LONG_START_SEQUENCE or LONG_STOP_SEQUENCE |
ONLY_LONG_SEQUENCE |
0 |
|
ONLY_LONG_SEQUENCE or LONG_START_SEQUENCE or LONG_STOP_SEQUENCE |
EIGHT_SHORT_SEQUENCE |
LONG_START_SEQUENCE |
1 |
|
EIGHT_SHORT_SEQUENCE |
EIGHT_SHORT_SEQUENCE |
EIGHT_SHORT_SEQUENCE |
1 |
|
EIGHT_SHORT SEQUENCE |
ONLY_LONG_SEQUENCE or LONG_START_SEQUENCE or LONG_STOP_SEQUENCE |
LONG_STOP_SEQUENCE |
0 |
The scalefactor band energies of frames n-2 and n are calculated. If the window sequence in one of these frames is an EIGHT_SHORT_SEQUENCE and the final window sequence for frame n-1 is one of the long transform windows, the scalefactor band energies are calculated for long block scalefactor bands by mapping the frequency line index of short block spectral coefficients to a long block representation. The new interpolated spectrum is built by reusing the spectrum of the older frame n-2 multiplying a factor to each spectral coefficient. An exception is made in the case of a short window sequence in frame n-2 and a long window sequence in frame n, here the spectrum of the actual frame n is modified by the interpolation factor. This factor is constant over the range of each scalefactor band and is derived from the scalefactor band energy differences of frames n-2 and n. Finally the sign of the interpolated spectral coefficients will be flipped randomly.
Fade out and in:
A complete fading out takes 5 frames. The spectral coefficients from the last good frame are copied and attenuated by a factor of:
with as frame counter since the last good frame.
After 5 frames of fading out the concealment switches to muting, that means the complete spectrum will be set to 0.
The decoder fades in when receiving good frames again. The fade in process takes 5 frames, too and the factor multiplied to the spectrum is:
where is the frame counter since the first good frame after concealing multiple frames.