From e12c7f584a542ec6f2b00be67bf33165e182b24b Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 2 Feb 2024 15:07:01 -0500 Subject: [PATCH] Fix log(0) on silence for fixed-point --- src/opus_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 6112c853..70f470b7 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -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