shithub: opus

Download patch

ref: 8835a4df2526f832b6f4b474c250bce529f7dc0e
parent: 017d4455da669a536ca2390567b2477dededf5b5
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 26 11:35:19 EST 2008

Removed useless masking curve for current frame and ignored Fs argument to
masking computation functions.

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -229,7 +229,6 @@
    VARDECL(celt_sig_t *freq);
    VARDECL(celt_norm_t *X);
    VARDECL(celt_norm_t *P);
-   VARDECL(float *mask);
    VARDECL(celt_ener_t *bandE);
    VARDECL(celt_pgain_t *gains);
 
@@ -243,7 +242,6 @@
    ALLOC(freq, B*C*N, celt_sig_t); /**< Interleaved signal MDCTs */
    ALLOC(X, B*C*N, celt_norm_t);         /**< Interleaved normalised MDCTs */
    ALLOC(P, B*C*N, celt_norm_t);         /**< Interleaved normalised pitch MDCTs*/
-   ALLOC(mask, B*C*N, float);      /**< Masking curve */
    ALLOC(bandE,st->mode->nbEBands*C, celt_ener_t);
    ALLOC(gains,st->mode->nbPBands, celt_pgain_t);
    
@@ -278,9 +276,6 @@
       although there's no valid reason to. Must investigate further */
    for (i=0;i<B*C*N;i++)
       mask[i] = 1/(.1+mask[i]);
-#else
-   for (i=0;i<B*C*N;i++)
-      mask[i] = 1;
 #endif
    /* Pitch analysis */
    for (c=0;c<C;c++)
@@ -360,7 +355,7 @@
       sum += X[i]*X[i];
    printf ("%f\n", sum);*/
    /* Residual quantisation */
-   quant_bands(st->mode, X, P, mask, nbCompressedBytes*8, &st->enc);
+   quant_bands(st->mode, X, P, NULL, nbCompressedBytes*8, &st->enc);
    
    if (C==2)
    {
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -74,7 +74,7 @@
    kiss_fftr(fft, xx, X);
    kiss_fftr(fft, yy, Y);
    
-   compute_masking(decay, X, curve, lag*C, 44100);
+   compute_masking(decay, X, curve, lag*C);
    
    for (i=1;i<C*n2;i++)
    {
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -76,7 +76,7 @@
    celt_free(decay->decayL);
 }
 
-static void spreading_func(struct PsyDecay *d, float *psd, float *mask, int len, celt_int32_t Fs)
+static void spreading_func(struct PsyDecay *d, float *psd, float *mask, int len)
 {
    int i;
    float mem;
@@ -122,7 +122,7 @@
 }
 
 /* Compute a marking threshold from the spectrum X. */
-void compute_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len, celt_int32_t Fs)
+void compute_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len)
 {
    int i;
    VARDECL(float *psd);
@@ -133,11 +133,11 @@
       psd[i] = X[i*2]*1.f*X[i*2] + X[i*2+1]*1.f*X[i*2+1];
    /* TODO: Do tone masking */
    /* Noise masking */
-   spreading_func(decay, psd, mask, N, Fs);
+   spreading_func(decay, psd, mask, N);
    
 }
 
-void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len, celt_int32_t Fs)
+void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len)
 {
    int i;
    VARDECL(float *psd);
@@ -151,6 +151,6 @@
    psd[len-1] = .5*(mask[len-1]+mask[len-2]);
    /* TODO: Do tone masking */
    /* Noise masking */
-   spreading_func(decay, psd, mask, len, Fs);
+   spreading_func(decay, psd, mask, len);
    
 }
--- a/libcelt/psy.h
+++ b/libcelt/psy.h
@@ -45,9 +45,9 @@
 void psydecay_clear(struct PsyDecay *decay);
 
 /** Compute the masking curve for an input (DFT) spectrum X */
-void compute_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len, celt_int32_t Fs);
+void compute_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len);
 
 /** Compute the masking curve for an input (MDCT) spectrum X */
-void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len, celt_int32_t Fs);
+void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len);
 
 #endif /* PSY_H */