ref: 260474fb81463420adf6acbcfdcac892a4b7c912
parent: 1af7f9562be00a5ca9a27859e5b66f0c2d056abc
author: Jean-Marc Valin <[email protected]>
date: Thu Jul 11 21:22:09 EDT 2013
Fixes a denorm problem when the input goes silent after active audio
--- a/celt/arch.h
+++ b/celt/arch.h
@@ -100,6 +100,7 @@
#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 @@
#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)
--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -236,7 +236,7 @@
/* 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));
}
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -429,10 +429,10 @@
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;
}
}