Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2023-12-02 09:48:10 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2023-12-05 11:19:13 +0300
commitd059f178d7f6f78d8b20ef5509ec88a6f547f989 (patch)
treeed207fae5757325aca9cd2d1ac2ddbaedc52d64e
parentc7bfc72d072dda08adb4f233a0cf84ee83b3a1a5 (diff)
Tuning SILK lambda as a function of bitrate
-rw-r--r--silk/fixed/process_gains_FIX.c2
-rw-r--r--silk/float/process_gains_FLP.c3
-rw-r--r--silk/tuning_parameters.h2
3 files changed, 5 insertions, 2 deletions
diff --git a/silk/fixed/process_gains_FIX.c b/silk/fixed/process_gains_FIX.c
index 05aba317..914f3678 100644
--- a/silk/fixed/process_gains_FIX.c
+++ b/silk/fixed/process_gains_FIX.c
@@ -110,6 +110,8 @@ void silk_process_gains_FIX(
+ silk_SMULWB( SILK_FIX_CONST( LAMBDA_SPEECH_ACT, 18 ), psEnc->sCmn.speech_activity_Q8 )
+ silk_SMULWB( SILK_FIX_CONST( LAMBDA_INPUT_QUALITY, 12 ), psEncCtrl->input_quality_Q14 )
+ silk_SMULWB( SILK_FIX_CONST( LAMBDA_CODING_QUALITY, 12 ), psEncCtrl->coding_quality_Q14 )
+ + silk_max_32( 0, SILK_FIX_CONST( .7f, 10 )
+ - silk_RSHIFT32( SILK_FIX_CONST( 3.2e-4, 16 ) * psEnc->sCmn.SNR_dB_Q7, 6) ) /* Low-bitrate term */
+ silk_SMULWB( SILK_FIX_CONST( LAMBDA_QUANT_OFFSET, 16 ), quant_offset_Q10 );
silk_assert( psEncCtrl->Lambda_Q10 > 0 );
diff --git a/silk/float/process_gains_FLP.c b/silk/float/process_gains_FLP.c
index c0da0dae..940451e5 100644
--- a/silk/float/process_gains_FLP.c
+++ b/silk/float/process_gains_FLP.c
@@ -95,7 +95,8 @@ void silk_process_gains_FLP(
+ LAMBDA_DELAYED_DECISIONS * psEnc->sCmn.nStatesDelayedDecision
+ LAMBDA_SPEECH_ACT * psEnc->sCmn.speech_activity_Q8 * ( 1.0f / 256.0f )
+ LAMBDA_INPUT_QUALITY * psEncCtrl->input_quality
- + LAMBDA_CODING_QUALITY * psEncCtrl->coding_quality
+ + LAMBDA_CODING_QUALITY * psEncCtrl->coding_quality /* High-bitrate term */
+ + silk_max_float(0.f, .7f - 3.2e-4f * psEnc->sCmn.SNR_dB_Q7) /* Low-bitrate term */
+ LAMBDA_QUANT_OFFSET * quant_offset;
silk_assert( psEncCtrl->Lambda > 0.0f );
diff --git a/silk/tuning_parameters.h b/silk/tuning_parameters.h
index d70275fd..18848990 100644
--- a/silk/tuning_parameters.h
+++ b/silk/tuning_parameters.h
@@ -139,7 +139,7 @@ extern "C"
#define LAMBDA_SPEECH_ACT -0.2f
#define LAMBDA_DELAYED_DECISIONS -0.05f
#define LAMBDA_INPUT_QUALITY -0.1f
-#define LAMBDA_CODING_QUALITY -0.2f
+#define LAMBDA_CODING_QUALITY -0.1f
#define LAMBDA_QUANT_OFFSET 0.8f
/* Compensation in bitrate calculations for 10 ms modes */