From d76bc917e5ccd281e1fdc893a765bc44944fbcf5 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Wed, 7 Sep 2011 01:37:58 -0400 Subject: [PATCH] Prevents the SILK encoder from failing below 600 kb/s stereo. Not that it actually reaches the target, but it should no longer cause a range coder mismatch --- silk/silk_stereo_LR_to_MS.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/silk/silk_stereo_LR_to_MS.c b/silk/silk_stereo_LR_to_MS.c index 6145b331..f9f59eb4 100644 --- a/silk/silk_stereo_LR_to_MS.c +++ b/silk/silk_stereo_LR_to_MS.c @@ -96,6 +96,8 @@ void silk_stereo_LR_to_MS( /* Determine bitrate distribution between mid and side, and possibly reduce stereo width */ total_rate_bps -= is10msFrame ? 1200 : 600; /* Subtract approximate bitrate for coding stereo parameters */ + if (total_rate_bps < 1) + total_rate_bps = 1; min_mid_rate_bps = SKP_SMLABB( 2000, fs_kHz, 900 ); SKP_assert( min_mid_rate_bps < 32767 ); /* Default bitrate distribution: 8 parts for Mid and (5+3*frac) parts for Side. so: mid_rate = ( 8 / ( 13 + 3 * frac ) ) * total_ rate */