mirror of
https://github.com/xiph/opus.git
synced 2025-06-02 00:27:43 +00:00
Fix for flutter with FEC
The bug was caused by an improper feedback of the per-frame bitrate, causing the bitrate to jump up and down from frame to frame, within a packet. The patch avoids this, and also gives a slight improvement in general for multi-frame packets, even without FEC. Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
This commit is contained in:
parent
8adff0bb31
commit
3499e78bd5
5 changed files with 21 additions and 11 deletions
|
@ -397,9 +397,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 +414,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue