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:
authorGregory Maxwell <greg@xiph.org>2011-08-26 23:01:10 +0400
committerGregory Maxwell <greg@xiph.org>2011-08-26 23:01:10 +0400
commit6db1d526b4d2eca5f4f5ad2897c5d001b577d149 (patch)
treee43872e49466336875d47bc4abb65747ccd09e80
parent073c4e14727fffdff30fccbd1753aca1d14861ba (diff)
Disable the LPC mode highpass filter when set to APPLICATION_AUDIO.
-rw-r--r--silk/silk_enc_API.c8
-rw-r--r--src/opus_encoder.c7
2 files changed, 11 insertions, 4 deletions
diff --git a/silk/silk_enc_API.c b/silk/silk_enc_API.c
index 383ea7f5..8e0315b8 100644
--- a/silk/silk_enc_API.c
+++ b/silk/silk_enc_API.c
@@ -302,9 +302,11 @@ opus_int silk_Encode(
}
}
- /* High-pass filter */
- psEnc->state_Fxx[ 0 ].sCmn.HP_cutoff_Hz = encControl->HP_cutoff_Hz;
- silk_HP_variable_cutoff( psEnc->state_Fxx, psEnc->nChannelsInternal );
+ /* High-pass filter, deactivated if less than zero */
+ if(encControl->HP_cutoff_Hz>=0) {
+ psEnc->state_Fxx[ 0 ].sCmn.HP_cutoff_Hz = encControl->HP_cutoff_Hz;
+ silk_HP_variable_cutoff( psEnc->state_Fxx, psEnc->nChannelsInternal );
+ }
/* Total target bits for packet */
nBits = SKP_DIV32_16( SKP_MUL( encControl->bitRate, encControl->payloadSize_ms ), 1000 );
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 4186e32b..7f980a15 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -326,7 +326,10 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
/* Mode selection depending on application and signal type */
if (st->application==OPUS_APPLICATION_VOIP)
{
- opus_int32 threshold = 20000;
+ opus_int32 threshold;
+ threshold = 20000;
+ /* OPUS_APPLICATION_VOIP default to auto high-pass */
+ st->silk_mode.HP_cutoff_Hz=0;
/* Hysteresis */
if (st->prev_mode == MODE_CELT_ONLY)
threshold -= 4000;
@@ -342,6 +345,8 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
opus_int32 threshold;
/* SILK/CELT threshold is higher for voice than for music */
threshold = 36000;
+ /* OPUS_APPLICATION_AUDIO disables the high-pass */
+ st->silk_mode.HP_cutoff_Hz=-1;
if (st->signal_type == OPUS_SIGNAL_MUSIC)
threshold -= 20000;
else if (st->signal_type == OPUS_SIGNAL_VOICE)