5.6.4 Inverse filtering estimation
26.4043GPPEnhanced aacPlus encoder Spectral Band Replication (SBR) partEnhanced aacPlus general audio codecGeneral audio codec audio processing functionsRelease 17TS
The inverse filtering detection is done on the frequency bands indicated by fTableNoise . For every band a tonality value is calculated from the original input signal and the "patched" SBR signal. The values are mapped to a specific regions given the "Region borders" in the detectorParamsAAC struct, and the appropriate inverse filtering value is given from the "Region space" also in detectorParamsAAC.
typedef enum
{
INVF_OFF = 0,
INVF_LOW_LEVEL,
INVF_MID_LEVEL,
INVF_HIGH_LEVEL
}
INVF_MODE;
static const DETECTOR_PARAMETERS detectorParamsAAC = {
{ 1.0f, 10.0f, 14.0f, 19.0f}, /* Region borders SBR. */
{ 0.0f, 3.0f, 7.0f, 10.0f}, /* Region borders Orig. */
{25.0f, 30.0f, 35.0f, 40.0f}, /* Region borders Nrg. */
4, /* Number of borders SBR. */
4, /* Number of borders orig. */
4, /* Number of borders Nrg. */
1.0f, /* Delta value for hysteresis. */
{ /* Region space. */
{INVF_MID_LEVEL, INVF_LOW_LEVEL, INVF_OFF, INVF_OFF, INVF_OFF}, /* | */
{INVF_MID_LEVEL, INVF_LOW_LEVEL, INVF_OFF, INVF_OFF, INVF_OFF}, /* | */
{INVF_HIGH_LEVEL, INVF_MID_LEVEL, INVF_LOW_LEVEL, INVF_OFF, INVF_OFF}, /*regionSbr*/
{INVF_HIGH_LEVEL, INVF_HIGH_LEVEL,INVF_MID_LEVEL, INVF_OFF, INVF_OFF}, /* | */
{INVF_HIGH_LEVEL, INVF_HIGH_LEVEL,INVF_MID_LEVEL, INVF_OFF, INVF_OFF}, /* | */
},/*———————— regionOrig ———————————*/
{ /* Region space transient. */
{INVF_LOW_LEVEL, INVF_LOW_LEVEL, INVF_LOW_LEVEL, INVF_OFF, INVF_OFF}, /* | */
{INVF_LOW_LEVEL, INVF_LOW_LEVEL, INVF_LOW_LEVEL, INVF_OFF, INVF_OFF}, /* | */
{INVF_HIGH_LEVEL,INVF_MID_LEVEL, INVF_MID_LEVEL, INVF_OFF, INVF_OFF}, /*regionSbr*/
{INVF_HIGH_LEVEL,INVF_HIGH_LEVEL, INVF_MID_LEVEL, INVF_OFF, INVF_OFF}, /* | */
{INVF_HIGH_LEVEL,INVF_HIGH_LEVEL, INVF_MID_LEVEL, INVF_OFF, INVF_OFF}, /* | */
},/*———————— regionOrig ———————————*/
{-4, -3, -2, -1, 0} /*Reduction factor of the inverse filtering for low energies.*/
};
static const float hysteresis = 1.0f; /* Delta value for hysteresis. */
The parameters Tavg and TavgSbr are calculated for every inverse filtering band by averaging the tonality values in the T and Tsbr matrices over the frequency regions indicated by fTableNoise according to (outlined for band invBand):
The values are subsequently filtered by a two tap FIR filter according to:
where the and
are the Tavg and TavgSbr from the previous frame.
The avgNrg parameter is similarly calculated:
The region borders for the SBR tonality and the original tonality is modified given previous values. The modification is done by adding the "hysteresis" value to the upper border of the previous region, and subtracting the hysteresis value from the lower border of the previous region. This gives the region-borders used for the detection of the present band in the present frame. The following pseudo-code outlines how the hysteresis is applied, where the quantSteps are the region border given in detectorParamsAAC.
if(prevRegion < numRegions)
quantStepsTmp[prevRegion] = quantSteps[prevRegion] + hysteresis;
if(prevRegion > 0)
quantStepsTmp[prevRegion – 1] = quantSteps[prevRegion – 1] – hysteresis;
The region corresponding to the filtered tonality values for the original and the SBR signal is obtained by finding the region that has an upper border higher than the present value, and a lower border lower or equal to the present value. This means that if the present value is smaller than the first value in the border vector, the region returned will be zero, and so on.
The regions for the original and the SBR signal are used to index the region space as indicated by the detectorParamsAAC, and the inverse filtering level value corresponding to the element pointed out by the region indexes is returned. Different region spaces are used for frames where a transient is detected.
Subsequently an energy compensation is applied. The energy-value calculated from the auto correlation is mapped to a region defined in detectorParamsAAC. The index value is subtracted from the inverse filtering level obtained from the region space, and this gives the final inverse filtering level stored in the bs_inv_filt vector.