shithub: opus

Download patch

ref: 03c1d66bab516edb80deb4ef0bf266ae4ee376ff
parent: 9078176ff56a47079bd05d8cd07e2e184da01faa
author: Koen Vos <[email protected]>
date: Thu Feb 17 11:54:44 EST 2011

SILK can't use more than 80% of the bits in hybrid mode

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -128,6 +128,10 @@
                     st->silk_mode.bitRate = ( st->silk_mode.bitRate + 9000 + st->use_vbr * 1000 ) / 2;
                 }
             }
+            /* don't let SILK use more than 80% */
+            if( st->silk_mode.bitRate > ( st->bitrate_bps - 8*st->Fs/frame_size ) * 4/5 ) {
+                st->silk_mode.bitRate = ( st->bitrate_bps - 8*st->Fs/frame_size ) * 4/5;
+            }
         }
 
         st->silk_mode.payloadSize_ms = 1000 * frame_size / st->Fs;
@@ -162,6 +166,8 @@
             } else if( st->silk_mode.internalSampleRate == 16000 ) {
                 silk_internal_bandwidth = BANDWIDTH_WIDEBAND;
             }
+        } else {
+            SKP_assert( st->silk_mode.internalSampleRate == 16000 );
         }
     }