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

github.com/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>2013-07-12 09:22:09 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-07-12 09:22:09 +0400
commit260474fb81463420adf6acbcfdcac892a4b7c912 (patch)
tree0a22a67e7b1c85ddf307f25da75b420102e2f813
parent1af7f9562be00a5ca9a27859e5b66f0c2d056abc (diff)
Fixes a denorm problem when the input goes silent after active audio
-rw-r--r--celt/arch.h2
-rw-r--r--celt/celt_decoder.c2
-rw-r--r--src/opus_encoder.c4
3 files changed, 5 insertions, 3 deletions
diff --git a/celt/arch.h b/celt/arch.h
index feab0fac..e497a4d9 100644
--- a/celt/arch.h
+++ b/celt/arch.h
@@ -100,6 +100,7 @@ typedef opus_val32 celt_ener;
#define DB_SHIFT 10
#define EPSILON 1
+#define VERY_SMALL 0
#define VERY_LARGE16 ((opus_val16)32767)
#define Q15_ONE ((opus_val16)32767)
@@ -140,6 +141,7 @@ typedef float celt_ener;
#define NORM_SCALING 1.f
#define EPSILON 1e-15f
+#define VERY_SMALL 1e-30f
#define VERY_LARGE16 1e15f
#define Q15_ONE ((opus_val16)1.f)
diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c
index 01f2868d..4424b970 100644
--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -236,7 +236,7 @@ void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, c
/* Shortcut for the standard (non-custom modes) case */
for (j=0;j<N;j++)
{
- celt_sig tmp = x[j] + m;
+ celt_sig tmp = x[j] + m + VERY_SMALL;
m = MULT16_32_Q15(coef0, tmp);
y[j*C] = SCALEOUT(SIG2WORD16(tmp));
}
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index cb7159c8..5c74535e 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -429,10 +429,10 @@ static void dc_reject(const opus_val16 *in, opus_int32 cutoff_Hz, opus_val16 *ou
x = in[channels*i+c];
/* First stage */
tmp = x-hp_mem[2*c];
- hp_mem[2*c] = hp_mem[2*c] + coef*(x - hp_mem[2*c]);
+ hp_mem[2*c] = hp_mem[2*c] + coef*(x - hp_mem[2*c]) + VERY_SMALL;
/* Second stage */
y = tmp - hp_mem[2*c+1];
- hp_mem[2*c+1] = hp_mem[2*c+1] + coef*(tmp - hp_mem[2*c+1]);
+ hp_mem[2*c+1] = hp_mem[2*c+1] + coef*(tmp - hp_mem[2*c+1]) + VERY_SMALL;
out[channels*i+c] = y;
}
}