Skip to content

Adjust DELTA_MASKING_NOISE_Q15 threshold to maintain consistency with the FLOAT codec

This is a follow-up to issue #1996.

It has been observed that in the BASOP code the constant DELTA_MASKING_NOISE_Q15 may have an incorrect value, leading to discrepancies with the FLOAT implementation.

In the FLOAT code, the noise estimation module applies the following condition:

if (hFdCngCom->likelihood_noisy_speech > DELTA_MASKING_NOISE)
{
   ...
}

where DELTA_MASKING_NOISE is defined as 1e-20f.

In BASOP, the equivalent condition is:

IF( GT_16( hFdCngCom->likelihood_noisy_speech, DELTA_MASKING_NOISE_Q15 ) )
{
  ...
}

but DELTA_MASKING_NOISE_Q15 is currently set to 0. In both BASOP and FLOAT code, a value of zero has a special semantic meaning, as illustrated e.g. in fd_cng_dec_fx.c:

/* Skip noise generation if level is very low, to avoid problems with denormals */
IF( hFdCngCom->likelihood_noisy_speech > 0 )
{
   ...
}

To ensure consistent behavior between FLOAT and BASOP codecs, DELTA_MASKING_NOISE_Q15 should be set to its minimal value of 1 instead of 0. This preserves the intended logic.