ref: 4e5b7bc5228c715351ad443edd6af1ad9e9ed7a2
parent: 9c710761f2f9c25d3c72882cce1e788604480d56
author: Jean-Marc Valin <[email protected]>
date: Fri Jul 3 11:09:07 EDT 2009
Tuning the folding gain to be higher when there's only one pulse and lower when there are many pulses.
--- a/doc/ietf/draft-valin-celt-codec.xml
+++ b/doc/ietf/draft-valin-celt-codec.xml
@@ -684,11 +684,7 @@
</t>
<t>
-g = N / (N + kf * K),
-</t>
-
-<t>
-where kf = 6.
+g = N / (N + 2*K*(K+1)),
</t>
<t>
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -360,6 +360,16 @@
/* Here, we assume that id will never be greater than N0, i.e. that
no band is wider than N0. In the unlikely case it happens, we set
everything to zero */
+ /*{
+ int offset = (N0*C - (id+C*N))/2;
+ if (offset > C*N0/16)
+ offset = C*N0/16;
+ offset -= offset % (C*B);
+ if (offset < 0)
+ offset = 0;
+ //printf ("%d\n", offset);
+ id += offset;
+ }*/
if (id+C*N>N0*C)
for (j=0;j<C*N;j++)
P[j] = 0;
@@ -368,8 +378,6 @@
P[j] = Y[id++];
}
-#define KGAIN 6
-
void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B)
{
celt_word16_t pred_gain;
@@ -378,7 +386,7 @@
if (K==0)
pred_gain = Q15ONE;
else
- pred_gain = celt_div((celt_word32_t)MULT16_16(Q15_ONE,N),(celt_word32_t)(N+KGAIN*K));
+ pred_gain = celt_div((celt_word32_t)MULT16_16(Q15_ONE,N),(celt_word32_t)(N+2*K*(K+1)));
fold(m, N, Y, P, N0, B);
renormalise_vector(P, pred_gain, C*N, 1);