Fix log(0) on silence for fixed-point

This commit is contained in:
Jean-Marc Valin 2024-02-02 15:07:01 -05:00
parent 0e2d56d675
commit e12c7f584a
No known key found for this signature in database
GPG key ID: 5E5DD9A36F9189C8

View file

@ -956,7 +956,7 @@ static opus_val32 compute_frame_energy(const opus_val16 *pcm, int frame_size, in
/* Compute the right shift required in the MAC to avoid an overflow */
max_shift = celt_ilog2(len);
shift = IMAX(0, (celt_ilog2(sample_max) << 1) + max_shift - 28);
shift = IMAX(0, (celt_ilog2(1+sample_max) << 1) + max_shift - 28);
/* Compute the energy */
for (i=0; i<len; i++)