diff options
author | Mark Harris <mark.hsj@gmail.com> | 2016-11-16 20:03:25 -0800 |
---|---|---|
committer | Mark Harris <mark.hsj@gmail.com> | 2016-11-16 20:16:23 -0800 |
commit | bd54e279d524f21e69e26feb4f9f340a4430c2f6 (patch) | |
tree | 040474b3db746472ebad07c3552b83db67083a59 /silk | |
parent | ab148485dab4c8a66866d02852940bcdac19851d (diff) | |
download | opus-bd54e279d524f21e69e26feb4f9f340a4430c2f6.tar.gz |
Correct SILK encoder gain limit
Ensure that the SILK encoder's log gain is 63, not 64, when encoding
a maximum-value delta gain index of 40. This matches the decoder
and RFC 6716 4.2.7.4, and prevents an assertion failure in the rare
case that the gain is later independently coded.
Diffstat (limited to 'silk')
-rw-r--r-- | silk/gain_quant.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/silk/gain_quant.c b/silk/gain_quant.c index 64ccd061..ee65245a 100644 --- a/silk/gain_quant.c +++ b/silk/gain_quant.c @@ -76,6 +76,7 @@ void silk_gains_quant( /* Accumulate deltas */ if( ind[ k ] > double_step_size_threshold ) { *prev_ind += silk_LSHIFT( ind[ k ], 1 ) - double_step_size_threshold; + *prev_ind = silk_min_int( *prev_ind, N_LEVELS_QGAIN - 1 ); } else { *prev_ind += ind[ k ]; } |