diff options
| author | George Marques | 2016-05-01 12:48:46 -0300 |
|---|---|---|
| committer | George Marques | 2016-05-02 13:18:34 -0300 |
| commit | 7c59d819a7ebb936d51ca032e66a2489e4080d08 (patch) | |
| tree | df6747620113a36812194db3456729aac2fa1b08 /drivers/opus/silk/control_codec.c | |
| parent | a3d81cab8a97eeece54ebadb82c40532188b4d57 (diff) | |
| download | godot-7c59d819a7ebb936d51ca032e66a2489e4080d08.tar.gz godot-7c59d819a7ebb936d51ca032e66a2489e4080d08.tar.zst godot-7c59d819a7ebb936d51ca032e66a2489e4080d08.zip | |
Diffstat (limited to 'drivers/opus/silk/control_codec.c')
| -rw-r--r-- | drivers/opus/silk/control_codec.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/opus/silk/control_codec.c b/drivers/opus/silk/control_codec.c index beb6dfe6c..03caab36a 100644 --- a/drivers/opus/silk/control_codec.c +++ b/drivers/opus/silk/control_codec.c @@ -24,10 +24,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ - -#ifdef OPUS_ENABLED #include "opus/opus_config.h" -#endif #ifdef OPUS_FIXED_POINT #include "opus/silk/fixed/main_FIX.h" #define silk_encoder_state_Fxx silk_encoder_state_FIX @@ -397,9 +394,10 @@ static OPUS_INLINE opus_int silk_setup_LBRR( const opus_int32 TargetRate_bps /* I */ ) { - opus_int ret = SILK_NO_ERROR; + opus_int LBRR_in_previous_packet, ret = SILK_NO_ERROR; opus_int32 LBRR_rate_thres_bps; + LBRR_in_previous_packet = psEncC->LBRR_enabled; psEncC->LBRR_enabled = 0; if( psEncC->useInBandFEC && psEncC->PacketLoss_perc > 0 ) { if( psEncC->fs_kHz == 8 ) { @@ -413,8 +411,13 @@ static OPUS_INLINE opus_int silk_setup_LBRR( if( TargetRate_bps > LBRR_rate_thres_bps ) { /* Set gain increase for coding LBRR excitation */ + if( LBRR_in_previous_packet == 0 ) { + /* Previous packet did not have LBRR, and was therefore coded at a higher bitrate */ + psEncC->LBRR_GainIncreases = 7; + } else { + psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_int32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); + } psEncC->LBRR_enabled = 1; - psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_int32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); } } |
