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

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2008-01-07 05:36:01 +0300
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2008-01-07 05:36:01 +0300
commit0a3e79aa11e3d11f288fb996f9623ed07b63028d (patch)
treee1587fe65dd7f26b9e7bbb74cc7770c860ce0d0f /libcelt/psy.c
parent825ec60b53558174512329a2bca0f10668843553 (diff)
Pseudo-masking curve for the MDCT
Diffstat (limited to 'libcelt/psy.c')
-rw-r--r--libcelt/psy.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libcelt/psy.c b/libcelt/psy.c
index 3f5e6a8..0bc2f23 100644
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -61,6 +61,7 @@ static void spreading_func(float *psd, float *mask, int len, int Fs)
decayR[i] = pow(.1f, deriv);
/* decay corresponding to -25dB/Bark */
decayL[i] = pow(0.0031623f, deriv);
+ //printf ("%f %f\n", decayL[i], decayR[i]);
}
/* Compute right slope (-10 dB/Bark) */
mem=psd[0];
@@ -117,3 +118,20 @@ void compute_masking(float *X, float *mask, int len, int Fs)
}
+void compute_mdct_masking(float *X, float *mask, int len, int Fs)
+{
+ int i;
+ float psd[len];
+ float mem;
+ for (i=0;i<len;i++)
+ mask[i] = X[i]*X[i];
+ for (i=1;i<len-1;i++)
+ psd[i] = .5*mask[i] + .25*(mask[i-1]+mask[i+1]);
+ //psd[0] = .5*mask[0]+.25*(mask[1]+mask[2]);
+ psd[0] = .5*mask[0]+.5*mask[1];
+ psd[len-1] = .5*(mask[len-1]+mask[len-2]);
+ /* TODO: Do tone masking */
+ /* Noise masking */
+ spreading_func(psd, mask, len, Fs);
+
+}