Precision issue for msNoiseEst in minimum_statistics
There is a precision loss observed for msNoiseEst (member of HANDLE_FD_CNG_DEC) from minimum_statistics_fx function.
The issue is observed for LTV-stereo bitrate switching from 13.2 kbps to 128 kbps, 32kHz in, 32kHz out case:
Encoding command: ./IVAS_cod -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/ltv32_STEREO.wav ltv32_stereo.192 Decoding command: ./IVAS_dec STEREO 32 ltv32_stereo.192 testv/ltv32_STEREO.wav_stereo_sw_32-32.tst
In this case, when the encoded stream from the floating-point encoder is decoded using fixed-point decoder and floating-point decoder, the values for msNoiseEst is not getting updated correctly after some frames are processed in fixed-point workspace when compared to floating-point workspace. This is happening because the fixed-point function of minimum_statistics_fx is not able to match the precision upto 7-8 decimal places as all the input parameters getting into it are in Q-format of 9.
About minimum_statistics_fx: this is a copy of minimum_statistics from EVS, Ittiam created a copy of this function and implementation the snippets to fixed-point which were disabled or not present in EVS function.
Snippet in minimum_statistics which updates msLogNoiseEst (which is expanded and assigned to msNoiseEst after the minimum_statistics):
Fixed point implementation:
/* Smooth noise estimate during CNG phases */
FOR( j = 0; j < len; j++ )
{
msNoiseEst[j] = round_fx( L_mac( L_mult( 31130 /*0.95 Q15*/, msNoiseEst[j] ), 1638 /*0.05 Q15*/, msNoiseFloor[j] ) );
move16();
}
Floating point implementation:
/* Smooth noise estimate during CNG phases */ /*msNoiseEst,msNoiseFloor*/
for ( j = 0; j < len; j++ )
{
msNoiseEst[j] = 0.95f * msNoiseEst[j] + 0.05f * msNoiseFloor[j];
}
Call flow for the observed issue:
Excel sheet capturing the dumps of msNoiseEst for some frames ranging from 2000 till 6650: msNoiseEst_precision_issue.xlsx
Please let us know if there are any inputs to handle these deviations.