ref: 5f09ea5659cfed80efc1ea22ced84c0b278a6f35
parent: 8835a4df2526f832b6f4b474c250bce529f7dc0e
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 26 11:43:04 EST 2008
celt_mask_t for masking curves
--- a/libcelt/arch.h
+++ b/libcelt/arch.h
@@ -54,7 +54,8 @@
typedef celt_word32_t celt_sig_t;
typedef celt_word16_t celt_norm_t;
typedef celt_word32_t celt_ener_t;
-typedef double celt_pgain_t;
+typedef float celt_pgain_t;
+typedef float celt_mask_t;
#define Q15ONE 32767
@@ -99,6 +100,7 @@
typedef float celt_norm_t;
typedef float celt_ener_t;
typedef float celt_pgain_t;
+typedef float celt_mask_t;
#define Q15ONE 1.0f
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -210,7 +210,7 @@
/* Quantisation of the residual */
-void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *W, int total_bits, ec_enc *enc)
+void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_mask_t *W, int total_bits, ec_enc *enc)
{
int i, j, B, bits;
const int *eBands = m->eBands;
--- a/libcelt/bands.h
+++ b/libcelt/bands.h
@@ -81,7 +81,7 @@
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param enc Entropy encoder
*/
-void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, float *W, int total_bits, ec_enc *enc);
+void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_mask_t *W, int total_bits, ec_enc *enc);
/** Decoding of the residual spectrum
* @param m Mode data
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -52,13 +52,13 @@
VARDECL(celt_word32_t *yy);
VARDECL(celt_word32_t *X);
VARDECL(celt_word32_t *Y);
- VARDECL(float *curve);
+ VARDECL(celt_mask_t *curve);
int n2 = lag/2;
ALLOC(xx, lag*C, celt_word32_t);
ALLOC(yy, lag*C, celt_word32_t);
ALLOC(X, lag*C, celt_word32_t);
ALLOC(Y, lag*C, celt_word32_t);
- ALLOC(curve, n2*C, float);
+ ALLOC(curve, n2*C, celt_mask_t);
for (i=0;i<C*lag;i++)
xx[i] = 0;
--- 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)
+static void spreading_func(struct PsyDecay *d, float *psd, celt_mask_t *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)
+void compute_masking(struct PsyDecay *decay, celt_word32_t *X, celt_mask_t *mask, int len)
{
int i;
VARDECL(float *psd);
@@ -137,7 +137,7 @@
}
-void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, float *mask, int len)
+void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, celt_mask_t *mask, int len)
{
int i;
VARDECL(float *psd);
--- 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);
+void compute_masking(struct PsyDecay *decay, celt_word32_t *X, celt_mask_t *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);
+void compute_mdct_masking(struct PsyDecay *decay, celt_word32_t *X, celt_mask_t *mask, int len);
#endif /* PSY_H */
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -71,7 +71,7 @@
float yp;
};
-void alg_quant(celt_norm_t *X, float *W, int N, int K, celt_norm_t *P, float alpha, ec_enc *enc)
+void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, float alpha, ec_enc *enc)
{
int L = 3;
VARDECL(float *x);
@@ -383,7 +383,7 @@
static const float pg[11] = {1.f, .75f, .65f, 0.6f, 0.6f, .6f, .55f, .55f, .5f, .5f, .5f};
-void intra_prediction(celt_norm_t *x, float *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc)
+void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc)
{
int i,j;
int best=0;
--- a/libcelt/vq.h
+++ b/libcelt/vq.h
@@ -51,7 +51,7 @@
* @param alpha compression factor to apply in the pitch direction (magic!)
* @param enc Entropy encoder state
*/
-void alg_quant(celt_norm_t *X, float *W, int N, int K, celt_norm_t *P, float alpha, ec_enc *enc);
+void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, float alpha, ec_enc *enc);
/** Algebraic pulse decoder
* @param x Decoded normalised spectrum (returned)
@@ -75,7 +75,7 @@
* @param N0 Number of valid offsets
* @param enc Entropy encoder state
*/
-void intra_prediction(celt_norm_t *x, float *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc);
+void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc);
void intra_unquant(celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_dec *dec);