[Non BE] Added NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO to address potential division by zero in HQ classifier
- Related issues: #1233 (closed)
- Requested reviewers: @kinuthia
Reason why this change is needed
Possible division by zero in
https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/blob/main/lib_enc/hq_classifier_enc.c#L615
Observed in BASOP when forcing HQ and the target MDCT spectrum is zero. Could potentially be solved by adding a small number to avoid the zero denominator. The BASOP seems to use Q9 for the inv_rms_fx
variable, so adding 2^-9 before division?
Description of the change
The all-zero input is detected by checking if the maximum absolute value Amax
is zero. In this case the crest = 1.0
and crest_mod = 1.0
and the calculation is skipped. None of the coefficients would be below the threshold, so low_count = 0
. Note that the number of affected lines is larger since the existing code went into the else branch and was indented one step.
Affected operating points
- Will affect HQ_HVQ/HQ_HARMONIC selection in HQ Core, when high band is all zero. This is a corner case which may not be triggered during normal operation. Was found when forcing the encoder to HQ, and the input segment was all zero.
Related to #1233 (closed)