Adding celt_sig_t where needed

This commit is contained in:
Jean-Marc Valin 2008-02-22 14:45:58 +11:00
parent 18ddc02afd
commit 37d13ceebe
6 changed files with 22 additions and 20 deletions

View file

@ -76,16 +76,16 @@ void mdct_clear(mdct_lookup *l)
celt_free(l->trig); celt_free(l->trig);
} }
void mdct_forward(mdct_lookup *l, float *in, float *out) void mdct_forward(mdct_lookup *l, celt_sig_t *in, celt_sig_t *out)
{ {
int i; int i;
int N, N2, N4, N8; int N, N2, N4, N8;
VARDECL(float *f); VARDECL(celt_sig_t *f);
N = l->n; N = l->n;
N2 = N/2; N2 = N/2;
N4 = N/4; N4 = N/4;
N8 = N/8; N8 = N/8;
ALLOC(f, N2, float); ALLOC(f, N2, celt_sig_t);
/* Consider the input to be compused of four blocks: [a, b, c, d] */ /* Consider the input to be compused of four blocks: [a, b, c, d] */
/* Shuffle, fold, pre-rotate (part 1) */ /* Shuffle, fold, pre-rotate (part 1) */
@ -120,16 +120,16 @@ void mdct_forward(mdct_lookup *l, float *in, float *out)
} }
void mdct_backward(mdct_lookup *l, float *in, float *out) void mdct_backward(mdct_lookup *l, celt_sig_t *in, celt_sig_t *out)
{ {
int i; int i;
int N, N2, N4, N8; int N, N2, N4, N8;
VARDECL(float *f); VARDECL(celt_sig_t *f);
N = l->n; N = l->n;
N2 = N/2; N2 = N/2;
N4 = N/4; N4 = N/4;
N8 = N/8; N8 = N/8;
ALLOC(f, N2, float); ALLOC(f, N2, celt_sig_t);
/* Pre-rotate */ /* Pre-rotate */
for(i=0;i<N4;i++) for(i=0;i<N4;i++)

View file

@ -55,8 +55,8 @@ void mdct_init(mdct_lookup *l,int N);
void mdct_clear(mdct_lookup *l); void mdct_clear(mdct_lookup *l);
/** Compute a forward MDCT and scale by 2/N */ /** Compute a forward MDCT and scale by 2/N */
void mdct_forward(mdct_lookup *l, float *in, float *out); void mdct_forward(mdct_lookup *l, celt_sig_t *in, celt_sig_t *out);
/** Compute a backward MDCT (no scaling) */ /** Compute a backward MDCT (no scaling) */
void mdct_backward(mdct_lookup *l, float *in, float *out); void mdct_backward(mdct_lookup *l, celt_sig_t *in, celt_sig_t *out);

View file

@ -44,20 +44,20 @@
#include "pitch.h" #include "pitch.h"
#include "psy.h" #include "psy.h"
void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, float *x, float *y, int lag, int len, int C, int *pitch) void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, int lag, int len, int C, int *pitch)
{ {
int c, i; int c, i;
float max_corr; float max_corr;
VARDECL(float *xx); VARDECL(celt_sig_t *xx);
VARDECL(float *yy); VARDECL(celt_sig_t *yy);
VARDECL(float *X); VARDECL(celt_sig_t *X);
VARDECL(float *Y); VARDECL(celt_sig_t *Y);
VARDECL(float *curve); VARDECL(float *curve);
int n2 = lag/2; int n2 = lag/2;
ALLOC(xx, lag*C, float); ALLOC(xx, lag*C, celt_sig_t);
ALLOC(yy, lag*C, float); ALLOC(yy, lag*C, celt_sig_t);
ALLOC(X, lag*C, float); ALLOC(X, lag*C, celt_sig_t);
ALLOC(Y, lag*C, float); ALLOC(Y, lag*C, celt_sig_t);
ALLOC(curve, n2*C, float); ALLOC(curve, n2*C, float);
for (i=0;i<C*lag;i++) for (i=0;i<C*lag;i++)

View file

@ -44,6 +44,6 @@
/** Find the optimal delay for the pitch prediction. Computation is /** Find the optimal delay for the pitch prediction. Computation is
done in the frequency domain, both to save time and to make it done in the frequency domain, both to save time and to make it
easier to apply psychoacoustic weighting */ easier to apply psychoacoustic weighting */
void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, float *x, float *y, int lag, int len, int C, int *pitch); void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, int lag, int len, int C, int *pitch);
#endif #endif

View file

@ -122,7 +122,7 @@ static void spreading_func(struct PsyDecay *d, float *psd, float *mask, int len,
} }
/* Compute a marking threshold from the spectrum X. */ /* Compute a marking threshold from the spectrum X. */
void compute_masking(struct PsyDecay *decay, float *X, float *mask, int len, int Fs) void compute_masking(struct PsyDecay *decay, celt_sig_t *X, float *mask, int len, int Fs)
{ {
int i; int i;
VARDECL(float *psd); VARDECL(float *psd);

View file

@ -31,6 +31,8 @@
#ifndef PSY_H #ifndef PSY_H
#define PSY_H #define PSY_H
#include "arch.h"
struct PsyDecay { struct PsyDecay {
float *decayL; float *decayL;
float *decayR; float *decayR;
@ -43,7 +45,7 @@ void psydecay_init(struct PsyDecay *decay, int len, int Fs);
void psydecay_clear(struct PsyDecay *decay); void psydecay_clear(struct PsyDecay *decay);
/** Compute the masking curve for an input (DFT) spectrum X */ /** Compute the masking curve for an input (DFT) spectrum X */
void compute_masking(struct PsyDecay *decay, float *X, float *mask, int len, int Fs); void compute_masking(struct PsyDecay *decay, celt_sig_t *X, float *mask, int len, int Fs);
/** Compute the masking curve for an input (MDCT) spectrum X */ /** Compute the masking curve for an input (MDCT) spectrum X */
void compute_mdct_masking(struct PsyDecay *decay, float *X, float *mask, int len, int Fs); void compute_mdct_masking(struct PsyDecay *decay, float *X, float *mask, int len, int Fs);