Skip to content

Commit

Permalink
Change pitch scaling behavior wrt nFramesPerPacket
Browse files Browse the repository at this point in the history
Not sure if it was the original intent, but we now reduce the
loss percentage threshold for pitch scaling as 1/nFramesPerPacket
since only the first frame will have pitch scaling anyway.
As a side effect, this brings back the original behavior of
disabling pitch scaling for 0% loss.
  • Loading branch information
jmvalin committed Aug 4, 2022
1 parent ab04fbb commit 997fdf5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion silk/fixed/LTP_scale_ctrl_FIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void silk_LTP_scale_ctrl_FIX(

if( condCoding == CODE_INDEPENDENTLY ) {
/* Only scale if first frame in packet */
round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket;
round_loss = psEnc->sCmn.PacketLoss_perc * psEnc->sCmn.nFramesPerPacket;
if ( psEnc->sCmn.LBRR_flag ) {
/* LBRR reduces the effective loss. In practice, it does not square the loss because
losses aren't independent, but that still seems to work best. We also never go below 2%. */
Expand Down
2 changes: 1 addition & 1 deletion silk/float/LTP_scale_ctrl_FLP.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void silk_LTP_scale_ctrl_FLP(

if( condCoding == CODE_INDEPENDENTLY ) {
/* Only scale if first frame in packet */
round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket;
round_loss = psEnc->sCmn.PacketLoss_perc * psEnc->sCmn.nFramesPerPacket;
if ( psEnc->sCmn.LBRR_flag ) {
/* LBRR reduces the effective loss. In practice, it does not square the loss because
losses aren't independent, but that still seems to work best. We also never go below 2%. */
Expand Down

0 comments on commit 997fdf5

Please sign in to comment.