diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-05-03 19:14:24 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-05-03 19:14:24 +0200 |
commit | c90bc695447b5d74227ed7c0d0bc19b7141dc835 (patch) | |
tree | 808af09d82e51698b9b7ba18795ba3a210a1d8f0 /drivers/opus/silk/control_codec.c | |
parent | 4e23ba5f37e21021c47e3aecf544afc9485e311b (diff) | |
parent | 7c59d819a7ebb936d51ca032e66a2489e4080d08 (diff) |
Merge pull request #4532 from vnen/pr-update-opus-1.1.2
Update Opus driver to 1.1.2
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 beb6dfe6cd..03caab36a9 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 ); } } |