Clang error "left shift of negative value" in transient detector
==================================================================================================
IVAS Codec Baseline
Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,
Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
==================================================================================================
lib_enc/transient_detection.c:244:71: runtime error: left shift of negative value -4775
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib_enc/transient_detection.c:244:71 in
The ramp_up_flag in the transient detector gets shifted by 1 with every call of RunTransientDetection() by the line
pSubblockEnergies->ramp_up_flag = pSubblockEnergies->ramp_up_flag << 1;
At some point this exceeds the maximum value of int16_t and causes a wrap around to negative values. This in turn leads to the Clang error above.