summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2022-08-04 18:59:37 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2022-08-04 19:02:02 -0400
commit997fdf54e781ae1c04dee42018f35388a04fe483 (patch)
treeb473686eb89edf1e09470af17c16b8e5b6604d1f
parentab04fbb1b7d0b727636d28fc2cadb5df9febe515 (diff)
downloadopus-997fdf54e781ae1c04dee42018f35388a04fe483.tar.gz
Change pitch scaling behavior wrt nFramesPerPacket
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.
-rw-r--r--silk/fixed/LTP_scale_ctrl_FIX.c2
-rw-r--r--silk/float/LTP_scale_ctrl_FLP.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/silk/fixed/LTP_scale_ctrl_FIX.c b/silk/fixed/LTP_scale_ctrl_FIX.c
index b3afb70b..db1016e0 100644
--- a/silk/fixed/LTP_scale_ctrl_FIX.c
+++ b/silk/fixed/LTP_scale_ctrl_FIX.c
@@ -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%. */
diff --git a/silk/float/LTP_scale_ctrl_FLP.c b/silk/float/LTP_scale_ctrl_FLP.c
index 1fed0993..6f30ff09 100644
--- a/silk/float/LTP_scale_ctrl_FLP.c
+++ b/silk/float/LTP_scale_ctrl_FLP.c
@@ -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%. */