ref: 234969c9034f8c90148266b2e08999828d8368e2
parent: 8b2ff0da5a768bde0f233ea5384aa9e4edcde9f6
author: Jean-Marc Valin <[email protected]>
date: Sat Oct 17 18:12:42 EDT 2009
Removed the _t from all the celt*_t types to avoid clashing with POSIX
--- a/libcelt/arch.h
+++ b/libcelt/arch.h
@@ -71,14 +71,13 @@
#ifdef FIXED_POINT
-typedef celt_int16 celt_word16_t;
-typedef celt_int32 celt_word32_t;
+typedef celt_int16 celt_word16;
+typedef celt_int32 celt_word32;
-typedef celt_word32_t celt_sig_t;
-typedef celt_word16_t celt_norm_t;
-typedef celt_word32_t celt_ener_t;
-typedef celt_word16_t celt_pgain_t;
-typedef celt_word32_t celt_mask_t;
+typedef celt_word32 celt_sig;
+typedef celt_word16 celt_norm;
+typedef celt_word32 celt_ener;
+typedef celt_word32 celt_mask;
#define Q15ONE 32767
#define Q30ONE 1073741823
@@ -102,9 +101,9 @@
#define EPSILON 1
#define VERY_SMALL 0
-#define VERY_LARGE32 ((celt_word32_t)2147483647)
-#define VERY_LARGE16 ((celt_word16_t)32767)
-#define Q15_ONE ((celt_word16_t)32767)
+#define VERY_LARGE32 ((celt_word32)2147483647)
+#define VERY_LARGE16 ((celt_word16)32767)
+#define Q15_ONE ((celt_word16)32767)
#define Q15_ONE_1 (1.f/32768.f)
#define SCALEIN(a) (a)
@@ -133,14 +132,14 @@
#else /* FIXED_POINT */
-typedef float celt_word16_t;
-typedef float celt_word32_t;
+typedef float celt_word16;
+typedef float celt_word32;
-typedef float celt_sig_t;
-typedef float celt_norm_t;
-typedef float celt_ener_t;
-typedef float celt_pgain_t;
-typedef float celt_mask_t;
+typedef float celt_sig;
+typedef float celt_norm;
+typedef float celt_ener;
+typedef float celt_pgain;
+typedef float celt_mask;
#define Q15ONE 1.0f
#define Q30ONE 1.0f
@@ -159,8 +158,8 @@
#define VERY_SMALL 1e-15f
#define VERY_LARGE32 1e15f
#define VERY_LARGE16 1e15f
-#define Q15_ONE ((celt_word16_t)1.f)
-#define Q15_ONE_1 ((celt_word16_t)1.f)
+#define Q15_ONE ((celt_word16)1.f)
+#define Q15_ONE_1 ((celt_word16)1.f)
#define QCONST16(x,bits) (x)
#define QCONST32(x,bits) (x)
@@ -192,8 +191,8 @@
#define ADD32(a,b) ((a)+(b))
#define SUB32(a,b) ((a)-(b))
#define MULT16_16_16(a,b) ((a)*(b))
-#define MULT16_16(a,b) ((celt_word32_t)(a)*(celt_word32_t)(b))
-#define MAC16_16(c,a,b) ((c)+(celt_word32_t)(a)*(celt_word32_t)(b))
+#define MULT16_16(a,b) ((celt_word32)(a)*(celt_word32)(b))
+#define MAC16_16(c,a,b) ((c)+(celt_word32)(a)*(celt_word32)(b))
#define MULT16_32_Q11(a,b) ((a)*(b))
#define MULT16_32_Q13(a,b) ((a)*(b))
@@ -218,10 +217,10 @@
#define MULT16_16_P13(a,b) ((a)*(b))
#define MULT16_16_P14(a,b) ((a)*(b))
-#define DIV32_16(a,b) (((celt_word32_t)(a))/(celt_word16_t)(b))
-#define PDIV32_16(a,b) (((celt_word32_t)(a))/(celt_word16_t)(b))
-#define DIV32(a,b) (((celt_word32_t)(a))/(celt_word32_t)(b))
-#define PDIV32(a,b) (((celt_word32_t)(a))/(celt_word32_t)(b))
+#define DIV32_16(a,b) (((celt_word32)(a))/(celt_word16)(b))
+#define PDIV32_16(a,b) (((celt_word32)(a))/(celt_word16)(b))
+#define DIV32(a,b) (((celt_word32)(a))/(celt_word32)(b))
+#define PDIV32(a,b) (((celt_word32)(a))/(celt_word32)(b))
#define SCALEIN(a) ((a)*CELT_SIG_SCALE)
#define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE))
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -48,7 +48,7 @@
#ifdef FIXED_POINT
/* Compute the amplitude (sqrt energy) in each of the bands */
-void compute_band_energies(const CELTMode *m, const celt_sig_t *X, celt_ener_t *bank, int _C)
+void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -59,8 +59,8 @@
for (i=0;i<m->nbEBands;i++)
{
int j;
- celt_word32_t maxval=0;
- celt_word32_t sum = 0;
+ celt_word32 maxval=0;
+ celt_word32 sum = 0;
j=eBands[i]; do {
maxval = MAX32(maxval, X[j+c*N]);
@@ -87,7 +87,7 @@
}
/* Normalise each band such that the energy is one. */
-void normalise_bands(const CELTMode *m, const celt_sig_t * restrict freq, celt_norm_t * restrict X, const celt_ener_t *bank, int _C)
+void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -96,9 +96,9 @@
for (c=0;c<C;c++)
{
i=0; do {
- celt_word16_t g;
+ celt_word16 g;
int j,shift;
- celt_word16_t E;
+ celt_word16 E;
shift = celt_zlog2(bank[i+c*m->nbEBands])-13;
E = VSHR32(bank[i+c*m->nbEBands], shift);
g = EXTRACT16(celt_rcp(SHL32(E,3)));
@@ -111,7 +111,7 @@
#else /* FIXED_POINT */
/* Compute the amplitude (sqrt energy) in each of the bands */
-void compute_band_energies(const CELTMode *m, const celt_sig_t *X, celt_ener_t *bank, int _C)
+void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -122,7 +122,7 @@
for (i=0;i<m->nbEBands;i++)
{
int j;
- celt_word32_t sum = 1e-10;
+ celt_word32 sum = 1e-10;
for (j=eBands[i];j<eBands[i+1];j++)
sum += X[j+c*N]*X[j+c*N];
bank[i+c*m->nbEBands] = sqrt(sum);
@@ -133,7 +133,7 @@
}
#ifdef EXP_PSY
-void compute_noise_energies(const CELTMode *m, const celt_sig_t *X, const celt_word16_t *tonality, celt_ener_t *bank, int _C)
+void compute_noise_energies(const CELTMode *m, const celt_sig *X, const celt_word16 *tonality, celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -144,7 +144,7 @@
for (i=0;i<m->nbEBands;i++)
{
int j;
- celt_word32_t sum = 1e-10;
+ celt_word32 sum = 1e-10;
for (j=eBands[i];j<eBands[i+1];j++)
sum += X[j*C+c]*X[j+c*N]*tonality[j];
bank[i+c*m->nbEBands] = sqrt(sum);
@@ -156,7 +156,7 @@
#endif
/* Normalise each band such that the energy is one. */
-void normalise_bands(const CELTMode *m, const celt_sig_t * restrict freq, celt_norm_t * restrict X, const celt_ener_t *bank, int _C)
+void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -167,7 +167,7 @@
for (i=0;i<m->nbEBands;i++)
{
int j;
- celt_word16_t g = 1.f/(1e-10+bank[i+c*m->nbEBands]);
+ celt_word16 g = 1.f/(1e-10+bank[i+c*m->nbEBands]);
for (j=eBands[i];j<eBands[i+1];j++)
X[j+c*N] = freq[j+c*N]*g;
}
@@ -176,7 +176,7 @@
#endif /* FIXED_POINT */
-void renormalise_bands(const CELTMode *m, celt_norm_t * restrict X, int _C)
+void renormalise_bands(const CELTMode *m, celt_norm * restrict X, int _C)
{
int i, c;
const celt_int16 *eBands = m->eBands;
@@ -190,7 +190,7 @@
}
/* De-normalise the energy to produce the synthesis from the unit-energy bands */
-void denormalise_bands(const CELTMode *m, const celt_norm_t * restrict X, celt_sig_t * restrict freq, const celt_ener_t *bank, int _C)
+void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig * restrict freq, const celt_ener *bank, int _C)
{
int i, c, N;
const celt_int16 *eBands = m->eBands;
@@ -203,7 +203,7 @@
for (i=0;i<m->nbEBands;i++)
{
int j;
- celt_word32_t g = SHR32(bank[i+c*m->nbEBands],1);
+ celt_word32 g = SHR32(bank[i+c*m->nbEBands],1);
j=eBands[i]; do {
freq[j+c*N] = SHL32(MULT16_32_Q15(X[j+c*N], g),2);
} while (++j<eBands[i+1]);
@@ -213,18 +213,18 @@
}
}
-int compute_pitch_gain(const CELTMode *m, const celt_sig_t *X, const celt_sig_t *P, int norm_rate, int *gain_id, int _C, celt_word16_t *gain_prod)
+int compute_pitch_gain(const CELTMode *m, const celt_sig *X, const celt_sig *P, int norm_rate, int *gain_id, int _C, celt_word16 *gain_prod)
{
int j, c;
- celt_word16_t g;
- celt_word16_t delta;
+ celt_word16 g;
+ celt_word16 delta;
const int C = CHANNELS(_C);
- celt_word32_t Sxy=0, Sxx=0, Syy=0;
+ celt_word32 Sxy=0, Sxx=0, Syy=0;
int len = m->pitchEnd;
const int N = FRAMESIZE(m);
#ifdef FIXED_POINT
int shift = 0;
- celt_word32_t maxabs=0;
+ celt_word32 maxabs=0;
for (c=0;c<C;c++)
{
@@ -241,10 +241,10 @@
delta = PDIV32_16(Q15ONE, len);
for (c=0;c<C;c++)
{
- celt_word16_t gg = Q15ONE;
+ celt_word16 gg = Q15ONE;
for (j=0;j<len;j++)
{
- celt_word16_t Xj, Pj;
+ celt_word16 Xj, Pj;
Xj = EXTRACT16(SHR32(X[j+c*N], shift));
Pj = MULT16_16_P15(gg,EXTRACT16(SHR32(P[j+c*N], shift)));
Sxy = MAC16_16(Sxy, Xj, Pj);
@@ -255,8 +255,8 @@
}
#ifdef FIXED_POINT
{
- celt_word32_t num, den;
- celt_word16_t fact;
+ celt_word32 num, den;
+ celt_word16 fact;
fact = MULT16_16(QCONST16(.04, 14), norm_rate);
if (fact < QCONST16(1., 14))
fact = QCONST16(1., 14);
@@ -304,11 +304,11 @@
}
}
-void apply_pitch(const CELTMode *m, celt_sig_t *X, const celt_sig_t *P, int gain_id, int pred, int _C)
+void apply_pitch(const CELTMode *m, celt_sig *X, const celt_sig *P, int gain_id, int pred, int _C)
{
int j, c, N;
- celt_word16_t gain;
- celt_word16_t delta;
+ celt_word16 gain;
+ celt_word16 delta;
const int C = CHANNELS(_C);
int len = m->pitchEnd;
@@ -321,7 +321,7 @@
delta = -delta;
for (c=0;c<C;c++)
{
- celt_word16_t gg = gain;
+ celt_word16 gg = gain;
for (j=0;j<len;j++)
{
X[j+c*N] += SHL32(MULT16_32_Q15(gg,P[j+c*N]),1);
@@ -332,12 +332,12 @@
#ifndef DISABLE_STEREO
-static void stereo_band_mix(const CELTMode *m, celt_norm_t *X, celt_norm_t *Y, const celt_ener_t *bank, int stereo_mode, int bandID, int dir)
+static void stereo_band_mix(const CELTMode *m, celt_norm *X, celt_norm *Y, const celt_ener *bank, int stereo_mode, int bandID, int dir)
{
int i = bandID;
const celt_int16 *eBands = m->eBands;
int j;
- celt_word16_t a1, a2;
+ celt_word16 a1, a2;
if (stereo_mode==0)
{
/* Do mid-side when not doing intensity stereo */
@@ -344,8 +344,8 @@
a1 = QCONST16(.70711f,14);
a2 = dir*QCONST16(.70711f,14);
} else {
- celt_word16_t left, right;
- celt_word16_t norm;
+ celt_word16 left, right;
+ celt_word16 norm;
#ifdef FIXED_POINT
int shift = celt_zlog2(MAX32(bank[i], bank[i+m->nbEBands]))-13;
#endif
@@ -357,7 +357,7 @@
}
for (j=0;j<eBands[i+1]-eBands[i];j++)
{
- celt_norm_t r, l;
+ celt_norm r, l;
l = X[j];
r = Y[j];
X[j] = MULT16_16_Q14(a1,l) + MULT16_16_Q14(a2,r);
@@ -368,11 +368,11 @@
#endif /* DISABLE_STEREO */
-int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average, int *last_decision, int _C)
+int folding_decision(const CELTMode *m, celt_norm *X, celt_word16 *average, int *last_decision, int _C)
{
int i, c, N0;
int NR=0;
- celt_word32_t ratio = EPSILON;
+ celt_word32 ratio = EPSILON;
const int C = CHANNELS(_C);
const celt_int16 * restrict eBands = m->eBands;
@@ -384,9 +384,9 @@
{
int j, N;
int max_i=0;
- celt_word16_t max_val=EPSILON;
- celt_word32_t floor_ener=EPSILON;
- celt_norm_t * restrict x = X+eBands[i]+c*N0;
+ celt_word16 max_val=EPSILON;
+ celt_word32 floor_ener=EPSILON;
+ celt_norm * restrict x = X+eBands[i]+c*N0;
N = eBands[i+1]-eBands[i];
for (j=0;j<N;j++)
{
@@ -416,8 +416,8 @@
#endif
if (N>7)
{
- celt_word16_t r;
- celt_word16_t den = celt_sqrt(floor_ener);
+ celt_word16 r;
+ celt_word16 den = celt_sqrt(floor_ener);
den = MAX32(QCONST16(.02, 15), den);
r = DIV32_16(SHL32(EXTEND32(max_val),8),den);
ratio = ADD32(ratio, EXTEND32(r));
@@ -439,17 +439,17 @@
}
/* Quantisation of the residual */
-void quant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, int encode, void *enc_dec)
+void quant_bands(const CELTMode *m, celt_norm * restrict X, const celt_ener *bandE, int *pulses, int shortBlocks, int fold, int total_bits, int encode, void *enc_dec)
{
int i, j, remaining_bits, balance;
const celt_int16 * restrict eBands = m->eBands;
- celt_norm_t * restrict norm;
- VARDECL(celt_norm_t, _norm);
+ celt_norm * restrict norm;
+ VARDECL(celt_norm, _norm);
int B;
SAVE_STACK;
B = shortBlocks ? m->nbShortMdcts : 1;
- ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
+ ALLOC(_norm, eBands[m->nbEBands+1], celt_norm);
norm = _norm;
balance = 0;
@@ -458,7 +458,7 @@
int tell;
int N;
int q;
- celt_word16_t n;
+ celt_word16 n;
const celt_int16 * const *BPbits;
int curr_balance, curr_bits;
@@ -509,18 +509,18 @@
#ifndef DISABLE_STEREO
-void quant_bands_stereo(const CELTMode *m, celt_norm_t *_X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
+void quant_bands_stereo(const CELTMode *m, celt_norm *_X, const celt_ener *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
{
int i, j, remaining_bits, balance;
const celt_int16 * restrict eBands = m->eBands;
- celt_norm_t * restrict norm;
- VARDECL(celt_norm_t, _norm);
+ celt_norm * restrict norm;
+ VARDECL(celt_norm, _norm);
int B;
- celt_word16_t mid, side;
+ celt_word16 mid, side;
SAVE_STACK;
B = shortBlocks ? m->nbShortMdcts : 1;
- ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
+ ALLOC(_norm, eBands[m->nbEBands+1], celt_norm);
norm = _norm;
balance = 0;
@@ -529,7 +529,7 @@
int c;
int tell;
int q1, q2;
- celt_word16_t n;
+ celt_word16 n;
const celt_int16 * const *BPbits;
int b, qb;
int N;
@@ -537,7 +537,7 @@
int imid, iside, itheta;
int mbits, sbits, delta;
int qalloc;
- celt_norm_t * restrict X, * restrict Y;
+ celt_norm * restrict X, * restrict Y;
X = _X+eBands[i];
Y = X+eBands[m->nbEBands+1];
@@ -605,8 +605,8 @@
{
int c2;
int sign=1;
- celt_norm_t v[2], w[2];
- celt_norm_t *x2, *y2;
+ celt_norm v[2], w[2];
+ celt_norm *x2, *y2;
mbits = b-qalloc;
sbits = 0;
if (itheta != 0 && itheta != 16384)
@@ -740,18 +740,18 @@
#ifndef DISABLE_STEREO
-void unquant_bands_stereo(const CELTMode *m, celt_norm_t *_X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
+void unquant_bands_stereo(const CELTMode *m, celt_norm *_X, const celt_ener *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
{
int i, j, remaining_bits, balance;
const celt_int16 * restrict eBands = m->eBands;
- celt_norm_t * restrict norm;
- VARDECL(celt_norm_t, _norm);
+ celt_norm * restrict norm;
+ VARDECL(celt_norm, _norm);
int B;
- celt_word16_t mid, side;
+ celt_word16 mid, side;
SAVE_STACK;
B = shortBlocks ? m->nbShortMdcts : 1;
- ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
+ ALLOC(_norm, eBands[m->nbEBands+1], celt_norm);
norm = _norm;
balance = 0;
@@ -760,7 +760,7 @@
int c;
int tell;
int q1, q2;
- celt_word16_t n;
+ celt_word16 n;
const celt_int16 * const *BPbits;
int b, qb;
int N;
@@ -768,7 +768,7 @@
int imid, iside, itheta;
int mbits, sbits, delta;
int qalloc;
- celt_norm_t * restrict X, * restrict Y;
+ celt_norm * restrict X, * restrict Y;
X = _X+eBands[i];
Y = X+eBands[m->nbEBands+1];
@@ -825,8 +825,8 @@
{
int c2;
int sign=1;
- celt_norm_t v[2], w[2];
- celt_norm_t *x2, *y2;
+ celt_norm v[2], w[2];
+ celt_norm *x2, *y2;
mbits = b-qalloc;
sbits = 0;
if (itheta != 0 && itheta != 16384)
--- a/libcelt/bands.h
+++ b/libcelt/bands.h
@@ -45,9 +45,9 @@
* @param X Spectrum
* @param bands Square root of the energy for each band (returned)
*/
-void compute_band_energies(const CELTMode *m, const celt_sig_t *X, celt_ener_t *bands, int _C);
+void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bands, int _C);
-/*void compute_noise_energies(const CELTMode *m, const celt_sig_t *X, const celt_word16_t *tonality, celt_ener_t *bank);*/
+/*void compute_noise_energies(const CELTMode *m, const celt_sig *X, const celt_word16 *tonality, celt_ener *bank);*/
/** Normalise each band of X such that the energy in each band is
equal to 1
@@ -55,9 +55,9 @@
* @param X Spectrum (returned normalised)
* @param bands Square root of the energy for each band
*/
-void normalise_bands(const CELTMode *m, const celt_sig_t * restrict freq, celt_norm_t * restrict X, const celt_ener_t *bands, int _C);
+void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bands, int _C);
-void renormalise_bands(const CELTMode *m, celt_norm_t * restrict X, int _C);
+void renormalise_bands(const CELTMode *m, celt_norm * restrict X, int _C);
/** Denormalise each band of X to restore full amplitude
* @param m Mode data
@@ -64,7 +64,7 @@
* @param X Spectrum (returned de-normalised)
* @param bands Square root of the energy for each band
*/
-void denormalise_bands(const CELTMode *m, const celt_norm_t * restrict X, celt_sig_t * restrict freq, const celt_ener_t *bands, int _C);
+void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig * restrict freq, const celt_ener *bands, int _C);
/** Compute the pitch predictor gain for each pitch band
* @param m Mode data
@@ -73,11 +73,11 @@
* @param gains Gain computed for each pitch band (returned)
* @param bank Square root of the energy for each band
*/
-int compute_pitch_gain(const CELTMode *m, const celt_sig_t *X, const celt_sig_t *P, int norm_rate, int *gain_id, int _C, celt_word16_t *gain_prod);
+int compute_pitch_gain(const CELTMode *m, const celt_sig *X, const celt_sig *P, int norm_rate, int *gain_id, int _C, celt_word16 *gain_prod);
-void apply_pitch(const CELTMode *m, celt_sig_t *X, const celt_sig_t *P, int gain_id, int pred, int _C);
+void apply_pitch(const CELTMode *m, celt_sig *X, const celt_sig *P, int gain_id, int pred, int _C);
-int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average, int *last_decision, int _C);
+int folding_decision(const CELTMode *m, celt_norm *X, celt_word16 *average, int *last_decision, int _C);
/** Quantisation/encoding of the residual spectrum
* @param m Mode data
@@ -85,9 +85,9 @@
* @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 * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, int encode, void *enc_dec);
+void quant_bands(const CELTMode *m, celt_norm * restrict X, const celt_ener *bandE, int *pulses, int time_domain, int fold, int total_bits, int encode, void *enc_dec);
-void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
+void quant_bands_stereo(const CELTMode *m, celt_norm * restrict X, const celt_ener *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
/** Decoding of the residual spectrum
* @param m Mode data
@@ -95,10 +95,10 @@
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param dec Entropy decoder
*/
-void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
+void unquant_bands(const CELTMode *m, celt_norm * restrict X, const celt_ener *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
-void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
+void unquant_bands_stereo(const CELTMode *m, celt_norm * restrict X, const celt_ener *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
-void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len);
+void stereo_decision(const CELTMode *m, celt_norm * restrict X, int *stereo_mode, int len);
#endif /* BANDS_H */
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -54,10 +54,10 @@
#include "float_cast.h"
#include <stdarg.h>
-static const celt_word16_t preemph = QCONST16(0.8f,15);
+static const celt_word16 preemph = QCONST16(0.8f,15);
#ifdef FIXED_POINT
-static const celt_word16_t transientWindow[16] = {
+static const celt_word16 transientWindow[16] = {
279, 1106, 2454, 4276, 6510, 9081, 11900, 14872,
17896, 20868, 23687, 26258, 28492, 30314, 31662, 32489};
#else
@@ -88,20 +88,20 @@
int pitch_available; /* Amount of pitch buffer available */
int force_intra;
int delayedIntra;
- celt_word16_t tonal_average;
+ celt_word16 tonal_average;
int fold_decision;
- celt_word16_t gain_prod;
+ celt_word16 gain_prod;
int VBR_rate; /* Target number of 16th bits per frame */
- celt_word16_t * restrict preemph_memE;
- celt_sig_t * restrict preemph_memD;
+ celt_word16 * restrict preemph_memE;
+ celt_sig * restrict preemph_memD;
- celt_sig_t *in_mem;
- celt_sig_t *out_mem;
+ celt_sig *in_mem;
+ celt_sig *out_mem;
- celt_word16_t *oldBandE;
+ celt_word16 *oldBandE;
#ifdef EXP_PSY
- celt_word16_t *psy_mem;
+ celt_word16 *psy_mem;
struct PsyDecay psy;
#endif
};
@@ -167,16 +167,16 @@
st->tonal_average = QCONST16(1.,8);
st->fold_decision = 1;
- st->in_mem = celt_alloc(st->overlap*C*sizeof(celt_sig_t));
- st->out_mem = celt_alloc((MAX_PERIOD+st->overlap)*C*sizeof(celt_sig_t));
+ st->in_mem = celt_alloc(st->overlap*C*sizeof(celt_sig));
+ st->out_mem = celt_alloc((MAX_PERIOD+st->overlap)*C*sizeof(celt_sig));
- st->oldBandE = (celt_word16_t*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16_t));
+ st->oldBandE = (celt_word16*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16));
- st->preemph_memE = (celt_word16_t*)celt_alloc(C*sizeof(celt_word16_t));
- st->preemph_memD = (celt_sig_t*)celt_alloc(C*sizeof(celt_sig_t));
+ st->preemph_memE = (celt_word16*)celt_alloc(C*sizeof(celt_word16));
+ st->preemph_memD = (celt_sig*)celt_alloc(C*sizeof(celt_sig));
#ifdef EXP_PSY
- st->psy_mem = celt_alloc(MAX_PERIOD*sizeof(celt_word16_t));
+ st->psy_mem = celt_alloc(MAX_PERIOD*sizeof(celt_word16));
psydecay_init(&st->psy, MAX_PERIOD/2, st->mode->Fs);
#endif
@@ -247,7 +247,7 @@
return (celt_int16)float2int(x);
}
-static inline celt_word16_t SIG2WORD16(celt_sig_t x)
+static inline celt_word16 SIG2WORD16(celt_sig x)
{
#ifdef FIXED_POINT
x = PSHR32(x, SIG_SHIFT);
@@ -255,17 +255,17 @@
x = MIN32(x, 32767);
return EXTRACT16(x);
#else
- return (celt_word16_t)x;
+ return (celt_word16)x;
#endif
}
-static int transient_analysis(celt_word32_t *in, int len, int C, int *transient_time, int *transient_shift)
+static int transient_analysis(celt_word32 *in, int len, int C, int *transient_time, int *transient_shift)
{
int c, i, n;
- celt_word32_t ratio;
- VARDECL(celt_word32_t, begin);
+ celt_word32 ratio;
+ VARDECL(celt_word32, begin);
SAVE_STACK;
- ALLOC(begin, len, celt_word32_t);
+ ALLOC(begin, len, celt_word32);
for (i=0;i<len;i++)
begin[i] = ABS32(SHR32(in[C*i],SIG_SHIFT));
for (c=1;c<C;c++)
@@ -307,7 +307,7 @@
/** Apply window and compute the MDCT for all sub-frames and
all channels in a frame */
-static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig_t * restrict in, celt_sig_t * restrict out, int _C)
+static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * restrict in, celt_sig * restrict out, int _C)
{
const int C = CHANNELS(_C);
if (C==1 && !shortBlocks)
@@ -321,8 +321,8 @@
int N = FRAMESIZE(mode);
int B = 1;
int b, c;
- VARDECL(celt_word32_t, x);
- VARDECL(celt_word32_t, tmp);
+ VARDECL(celt_word32, x);
+ VARDECL(celt_word32, tmp);
SAVE_STACK;
if (shortBlocks)
{
@@ -330,8 +330,8 @@
N = mode->shortMdctSize;
B = mode->nbShortMdcts;
}
- ALLOC(x, N+overlap, celt_word32_t);
- ALLOC(tmp, N, celt_word32_t);
+ ALLOC(x, N+overlap, celt_word32);
+ ALLOC(tmp, N, celt_word32);
for (c=0;c<C;c++)
{
for (b=0;b<B;b++)
@@ -351,7 +351,7 @@
/** Compute the IMDCT and apply window for all sub-frames and
all channels in a frame */
-static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig_t *X, int transient_time, int transient_shift, celt_sig_t * restrict out_mem, int _C)
+static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig *X, int transient_time, int transient_shift, celt_sig * restrict out_mem, int _C)
{
int c, N4;
const int C = CHANNELS(_C);
@@ -365,8 +365,8 @@
const mdct_lookup *lookup = MDCT(mode);
mdct_backward(lookup, X, out_mem+C*(MAX_PERIOD-N-N4), mode->window, overlap);
} else {
- VARDECL(celt_word32_t, x);
- VARDECL(celt_word32_t, tmp);
+ VARDECL(celt_word32, x);
+ VARDECL(celt_word32, tmp);
int b;
int N2 = N;
int B = 1;
@@ -374,8 +374,8 @@
const mdct_lookup *lookup = MDCT(mode);
SAVE_STACK;
- ALLOC(x, 2*N, celt_word32_t);
- ALLOC(tmp, N, celt_word32_t);
+ ALLOC(x, 2*N, celt_word32);
+ ALLOC(tmp, N, celt_word32);
if (shortBlocks)
{
@@ -484,7 +484,7 @@
/*printf ("dec %d: %d %d %d %d\n", flag_bits, *intra_ener, *has_pitch, *shortBlocks, *has_fold);*/
}
-static void deemphasis(celt_sig_t *in, celt_word16_t *pcm, int N, int _C, celt_word16_t coef, celt_sig_t *mem)
+static void deemphasis(celt_sig *in, celt_word16 *pcm, int N, int _C, celt_word16 coef, celt_sig *mem)
{
const int C = CHANNELS(_C);
int c;
@@ -493,7 +493,7 @@
int j;
for (j=0;j<N;j++)
{
- celt_sig_t tmp = MAC16_32_Q15(in[C*(MAX_PERIOD-N)+C*j+c],
+ celt_sig tmp = MAC16_32_Q15(in[C*(MAX_PERIOD-N)+C*j+c],
coef,mem[c]);
mem[c] = tmp;
pcm[C*j+c] = SCALEOUT(SIG2WORD16(tmp));
@@ -502,7 +502,7 @@
}
-static void mdct_shape(const CELTMode *mode, celt_norm_t *X, int start, int end, int N, int nbShortMdcts, int mdct_weight_shift, int _C)
+static void mdct_shape(const CELTMode *mode, celt_norm *X, int start, int end, int N, int nbShortMdcts, int mdct_weight_shift, int _C)
{
int m, i, c;
const int C = CHANNELS(_C);
@@ -522,7 +522,7 @@
int celt_encode(CELTEncoder * restrict st, const celt_int16 * pcm, celt_int16 * optional_synthesis, unsigned char *compressed, int nbCompressedBytes)
{
#else
-int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_sig_t * optional_synthesis, unsigned char *compressed, int nbCompressedBytes)
+int celt_encode_float(CELTEncoder * restrict st, const celt_sig * pcm, celt_sig * optional_synthesis, unsigned char *compressed, int nbCompressedBytes)
{
#endif
int i, c, N, NN, N4;
@@ -533,14 +533,14 @@
unsigned coarse_needed;
ec_byte_buffer buf;
ec_enc enc;
- VARDECL(celt_sig_t, in);
- VARDECL(celt_sig_t, freq);
- VARDECL(celt_sig_t, pitch_freq);
- VARDECL(celt_norm_t, X);
- VARDECL(celt_ener_t, bandE);
- VARDECL(celt_word16_t, bandLogE);
+ VARDECL(celt_sig, in);
+ VARDECL(celt_sig, freq);
+ VARDECL(celt_sig, pitch_freq);
+ VARDECL(celt_norm, X);
+ VARDECL(celt_ener, bandE);
+ VARDECL(celt_word16, bandLogE);
VARDECL(int, fine_quant);
- VARDECL(celt_word16_t, error);
+ VARDECL(celt_word16, error);
VARDECL(int, pulses);
VARDECL(int, offsets);
VARDECL(int, fine_priority);
@@ -572,17 +572,17 @@
N = st->block_size;
N4 = (N-st->overlap)>>1;
- ALLOC(in, 2*C*N-2*C*N4, celt_sig_t);
+ ALLOC(in, 2*C*N-2*C*N4, celt_sig);
CELT_COPY(in, st->in_mem, C*st->overlap);
for (c=0;c<C;c++)
{
- const celt_word16_t * restrict pcmp = pcm+c;
- celt_sig_t * restrict inp = in+C*st->overlap+c;
+ const celt_word16 * restrict pcmp = pcm+c;
+ celt_sig * restrict inp = in+C*st->overlap+c;
for (i=0;i<N;i++)
{
/* Apply pre-emphasis */
- celt_sig_t tmp = SCALEIN(SHL32(EXTEND32(*pcmp), SIG_SHIFT));
+ celt_sig tmp = SCALEIN(SHL32(EXTEND32(*pcmp), SIG_SHIFT));
*inp = SUB32(tmp, SHR32(MULT16_16(preemph,st->preemph_memE[c]),3));
st->preemph_memE[c] = SCALEIN(*pcmp);
inp += C;
@@ -625,9 +625,9 @@
has_fold = 1;
}
- ALLOC(freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
- ALLOC(bandE,st->mode->nbEBands*C, celt_ener_t);
- ALLOC(bandLogE,st->mode->nbEBands*C, celt_word16_t);
+ ALLOC(freq, C*N, celt_sig); /**< Interleaved signal MDCTs */
+ ALLOC(bandE,st->mode->nbEBands*C, celt_ener);
+ ALLOC(bandLogE,st->mode->nbEBands*C, celt_word16);
/* Compute MDCTs */
compute_mdcts(st->mode, shortBlocks, in, freq, C);
@@ -646,9 +646,9 @@
/* Deferred allocation after find_spectral_pitch() to reduce
the peak memory usage */
- ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
+ ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */
- ALLOC(pitch_freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
+ ALLOC(pitch_freq, C*N, celt_sig); /**< Interleaved signal MDCTs */
if (has_pitch)
{
@@ -678,13 +678,13 @@
NN = st->mode->eBands[st->mode->nbEBands];
if (shortBlocks && !transient_shift)
{
- celt_word32_t sum[8]={1,1,1,1,1,1,1,1};
+ celt_word32 sum[8]={1,1,1,1,1,1,1,1};
int m;
for (c=0;c<C;c++)
{
m=0;
do {
- celt_word32_t tmp=0;
+ celt_word32 tmp=0;
for (i=m+c*N;i<c*N+NN;i+=st->mode->nbShortMdcts)
tmp += ABS32(X[i]);
sum[m++] += tmp;
@@ -749,7 +749,7 @@
ALLOC(pulses, st->mode->nbEBands, int);
/* Bit allocation */
- ALLOC(error, C*st->mode->nbEBands, celt_word16_t);
+ ALLOC(error, C*st->mode->nbEBands, celt_word16);
coarse_needed = quant_coarse_energy(st->mode, bandLogE, st->oldBandE, nbCompressedBytes*8/3, intra_ener, st->mode->prob, error, &enc, C);
coarse_needed = ((coarse_needed*3-1)>>3)+1;
@@ -871,7 +871,7 @@
int celt_encode(CELTEncoder * restrict st, const celt_int16 * pcm, celt_int16 * optional_synthesis, unsigned char *compressed, int nbCompressedBytes)
{
int j, ret, C, N;
- VARDECL(celt_sig_t, in);
+ VARDECL(celt_sig, in);
SAVE_STACK;
if (check_encoder(st) != CELT_OK)
@@ -885,7 +885,7 @@
C=CHANNELS(st->channels);
N=st->block_size;
- ALLOC(in, C*N, celt_sig_t);
+ ALLOC(in, C*N, celt_sig);
for (j=0;j<C*N;j++) {
in[j] = SCALEOUT(pcm[j]);
}
@@ -1028,12 +1028,12 @@
ec_byte_buffer buf;
ec_enc enc;
- celt_sig_t * restrict preemph_memD;
+ celt_sig * restrict preemph_memD;
- celt_sig_t *out_mem;
- celt_sig_t *decode_mem;
+ celt_sig *out_mem;
+ celt_sig *decode_mem;
- celt_word16_t *oldBandE;
+ celt_word16 *oldBandE;
int last_pitch_index;
int loss_count;
@@ -1092,12 +1092,12 @@
st->overlap = mode->overlap;
st->channels = channels;
- st->decode_mem = celt_alloc((DECODE_BUFFER_SIZE+st->overlap)*C*sizeof(celt_sig_t));
+ st->decode_mem = celt_alloc((DECODE_BUFFER_SIZE+st->overlap)*C*sizeof(celt_sig));
st->out_mem = st->decode_mem+DECODE_BUFFER_SIZE-MAX_PERIOD;
- st->oldBandE = (celt_word16_t*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16_t));
+ st->oldBandE = (celt_word16*)celt_alloc(C*mode->nbEBands*sizeof(celt_word16));
- st->preemph_memD = (celt_sig_t*)celt_alloc(C*sizeof(celt_sig_t));
+ st->preemph_memD = (celt_sig*)celt_alloc(C*sizeof(celt_sig));
st->loss_count = 0;
@@ -1156,18 +1156,18 @@
#ifdef NEW_PLC
#include "plc.c"
#else
-static void celt_decode_lost(CELTDecoder * restrict st, celt_word16_t * restrict pcm)
+static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict pcm)
{
int c, N;
int pitch_index;
- celt_word16_t fade = Q15ONE;
+ celt_word16 fade = Q15ONE;
int i, len;
- VARDECL(celt_sig_t, freq);
+ VARDECL(celt_sig, freq);
const int C = CHANNELS(st->channels);
int offset;
SAVE_STACK;
N = st->block_size;
- ALLOC(freq,C*N, celt_sig_t); /**< Interleaved signal MDCTs */
+ ALLOC(freq,C*N, celt_sig); /**< Interleaved signal MDCTs */
len = N+st->mode->overlap;
@@ -1200,7 +1200,7 @@
int j;
for (j=0;j<N;j++)
{
- celt_sig_t tmp = MAC16_32_Q15(st->out_mem[C*(MAX_PERIOD-N)+C*j+c],
+ celt_sig tmp = MAC16_32_Q15(st->out_mem[C*(MAX_PERIOD-N)+C*j+c],
preemph,st->preemph_memD[c]);
st->preemph_memD[c] = tmp;
pcm[C*j+c] = SCALEOUT(SIG2WORD16(tmp));
@@ -1217,7 +1217,7 @@
int celt_decode(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm)
{
#else
-int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int len, celt_sig_t * restrict pcm)
+int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int len, celt_sig * restrict pcm)
{
#endif
int i, N, N4;
@@ -1226,10 +1226,10 @@
int bits;
ec_dec dec;
ec_byte_buffer buf;
- VARDECL(celt_sig_t, freq);
- VARDECL(celt_sig_t, pitch_freq);
- VARDECL(celt_norm_t, X);
- VARDECL(celt_ener_t, bandE);
+ VARDECL(celt_sig, freq);
+ VARDECL(celt_sig, pitch_freq);
+ VARDECL(celt_norm, X);
+ VARDECL(celt_ener, bandE);
VARDECL(int, fine_quant);
VARDECL(int, pulses);
VARDECL(int, offsets);
@@ -1257,9 +1257,9 @@
N = st->block_size;
N4 = (N-st->overlap)>>1;
- ALLOC(freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
- ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
- ALLOC(bandE, st->mode->nbEBands*C, celt_ener_t);
+ ALLOC(freq, C*N, celt_sig); /**< Interleaved signal MDCTs */
+ ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */
+ ALLOC(bandE, st->mode->nbEBands*C, celt_ener);
if (data == NULL)
{
@@ -1322,7 +1322,7 @@
unquant_fine_energy(st->mode, bandE, st->oldBandE, fine_quant, &dec, C);
- ALLOC(pitch_freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
+ ALLOC(pitch_freq, C*N, celt_sig); /**< Interleaved signal MDCTs */
if (has_pitch)
{
/* Pitch MDCT */
@@ -1394,7 +1394,7 @@
int celt_decode(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm)
{
int j, ret, C, N;
- VARDECL(celt_sig_t, out);
+ VARDECL(celt_sig, out);
SAVE_STACK;
if (check_decoder(st) != CELT_OK)
@@ -1408,7 +1408,7 @@
C = CHANNELS(st->channels);
N = st->block_size;
- ALLOC(out, C*N, celt_sig_t);
+ ALLOC(out, C*N, celt_sig);
ret=celt_decode_float(st, data, len, out);
--- a/libcelt/dump_modes.c
+++ b/libcelt/dump_modes.c
@@ -76,7 +76,7 @@
fprintf(file, "#ifndef DEF_WINDOW%d\n", mode->overlap);
fprintf(file, "#define DEF_WINDOW%d\n", mode->overlap);
- fprintf (file, "static const celt_word16_t window%d[%d] = {\n", mode->overlap, mode->overlap);
+ fprintf (file, "static const celt_word16 window%d[%d] = {\n", mode->overlap, mode->overlap);
for (j=0;j<mode->overlap;j++)
fprintf (file, WORD16 ", ", mode->window[j]);
fprintf (file, "};\n");
@@ -85,7 +85,7 @@
fprintf(file, "#ifndef DEF_PSY%d\n", mode->Fs);
fprintf(file, "#define DEF_PSY%d\n", mode->Fs);
- fprintf (file, "static const celt_word16_t psy_decayR_%d[%d] = {\n", mode->Fs, MAX_PERIOD/2);
+ fprintf (file, "static const celt_word16 psy_decayR_%d[%d] = {\n", mode->Fs, MAX_PERIOD/2);
for (j=0;j<MAX_PERIOD/2;j++)
fprintf (file, WORD16 ", ", mode->psy.decayR[j]);
fprintf (file, "};\n");
--- a/libcelt/fixed_c5x.h
+++ b/libcelt/fixed_c5x.h
@@ -82,7 +82,7 @@
#define OVERRIDE_CELT_MAXABS16
#define OVERRIDE_FIND_MAX16
-static inline int find_max16(celt_word16_t *x, int len)
+static inline int find_max16(celt_word16 *x, int len)
{
DATA max_corr16 = -VERY_LARGE16;
DATA pitch16 = 0;
--- a/libcelt/fixed_c6x.h
+++ b/libcelt/fixed_c6x.h
@@ -72,7 +72,7 @@
#define OVERRIDE_CELT_MAXABS16
#define OVERRIDE_FIND_MAX16
-static inline int find_max16(celt_word16_t *x, int len)
+static inline int find_max16(celt_word16 *x, int len)
{
DATA max_corr16 = -VERY_LARGE16;
DATA pitch16 = 0;
--- a/libcelt/fixed_debug.h
+++ b/libcelt/fixed_debug.h
@@ -46,14 +46,14 @@
#define MIPS_INC celt_mips++,
-#define MULT16_16SU(a,b) ((celt_word32_t)(celt_word16_t)(a)*(celt_word32_t)(celt_uint16)(b))
+#define MULT16_16SU(a,b) ((celt_word32)(celt_word16)(a)*(celt_word32)(celt_uint16)(b))
#define MULT32_32_Q31(a,b) ADD32(ADD32(SHL32(MULT16_16(SHR32((a),16),SHR((b),16)),1), SHR32(MULT16_16SU(SHR32((a),16),((b)&0x0000ffff)),15)), SHR32(MULT16_16SU(SHR32((b),16),((a)&0x0000ffff)),15))
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR32((b),16)), SHR32(MULT16_16SU((a),((b)&0x0000ffff)),16))
-#define QCONST16(x,bits) ((celt_word16_t)(.5+(x)*(((celt_word32_t)1)<<(bits))))
-#define QCONST32(x,bits) ((celt_word32_t)(.5+(x)*(((celt_word32_t)1)<<(bits))))
+#define QCONST16(x,bits) ((celt_word16)(.5+(x)*(((celt_word32)1)<<(bits))))
+#define QCONST32(x,bits) ((celt_word32)(.5+(x)*(((celt_word32)1)<<(bits))))
#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768)
@@ -177,7 +177,7 @@
}
#define PSHR16(a,shift) (celt_mips--,SHR16(ADD16((a),((1<<((shift))>>1))),shift))
-#define PSHR32(a,shift) (celt_mips--,SHR32(ADD32((a),(((celt_word32_t)(1)<<((shift))>>1))),shift))
+#define PSHR32(a,shift) (celt_mips--,SHR32(ADD32((a),(((celt_word32)(1)<<((shift))>>1))),shift))
#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
@@ -335,7 +335,7 @@
{
fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
}
- if (ABS32(b)>=((celt_word32_t)(1)<<(15+Q)))
+ if (ABS32(b)>=((celt_word32)(1)<<(15+Q)))
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
res = (((long long)a)*(long long)b) >> Q;
if (!VERIFY_INT(res))
@@ -354,9 +354,9 @@
{
fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
}
- if (ABS32(b)>=((celt_word32_t)(1)<<(15+Q)))
+ if (ABS32(b)>=((celt_word32)(1)<<(15+Q)))
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
- res = ((((long long)a)*(long long)b) + (((celt_word32_t)(1)<<Q)>>1))>> Q;
+ res = ((((long long)a)*(long long)b) + (((celt_word32)(1)<<Q)>>1))>> Q;
if (!VERIFY_INT(res))
fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
if (Q==15)
--- a/libcelt/fixed_generic.h
+++ b/libcelt/fixed_generic.h
@@ -38,7 +38,7 @@
#define FIXED_GENERIC_H
/** Multiply a 16-bit signed value by a 16-bit unsigned value. The result is a 32-bit signed value */
-#define MULT16_16SU(a,b) ((celt_word32_t)(celt_word16_t)(a)*(celt_word32_t)(celt_uint16)(b))
+#define MULT16_16SU(a,b) ((celt_word32)(celt_word16)(a)*(celt_word32)(celt_uint16)(b))
/** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a),((b)&0x0000ffff)),16))
@@ -53,9 +53,9 @@
#define MULT32_32_Q32(a,b) ADD32(ADD32(MULT16_16(SHR((a),16),SHR((b),16)), SHR(MULT16_16SU(SHR((a),16),((b)&0x0000ffff)),16)), SHR(MULT16_16SU(SHR((b),16),((a)&0x0000ffff)),16))
/** Compile-time conversion of float constant to 16-bit value */
-#define QCONST16(x,bits) ((celt_word16_t)(.5+(x)*(((celt_word32_t)1)<<(bits))))
+#define QCONST16(x,bits) ((celt_word16)(.5+(x)*(((celt_word32)1)<<(bits))))
/** Compile-time conversion of float constant to 32-bit value */
-#define QCONST32(x,bits) ((celt_word32_t)(.5+(x)*(((celt_word32_t)1)<<(bits))))
+#define QCONST32(x,bits) ((celt_word32)(.5+(x)*(((celt_word32)1)<<(bits))))
/** Negate a 16-bit value */
#define NEG16(x) (-(x))
@@ -63,9 +63,9 @@
#define NEG32(x) (-(x))
/** Change a 32-bit value into a 16-bit value. The value is assumed to fit in 16-bit, otherwise the result is undefined */
-#define EXTRACT16(x) ((celt_word16_t)(x))
+#define EXTRACT16(x) ((celt_word16)(x))
/** Change a 16-bit value into a 32-bit value */
-#define EXTEND32(x) ((celt_word32_t)(x))
+#define EXTEND32(x) ((celt_word32)(x))
/** Arithmetic shift-right of a 16-bit value */
#define SHR16(a,shift) ((a) >> (shift))
@@ -74,7 +74,7 @@
/** Arithmetic shift-right of a 32-bit value */
#define SHR32(a,shift) ((a) >> (shift))
/** Arithmetic shift-left of a 32-bit value */
-#define SHL32(a,shift) ((celt_word32_t)(a) << (shift))
+#define SHL32(a,shift) ((celt_word32)(a) << (shift))
/** 16-bit arithmetic shift right with rounding-to-nearest instead of rounding down */
#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
@@ -90,7 +90,7 @@
/** "RAW" macros, should not be used outside of this header file */
#define SHR(a,shift) ((a) >> (shift))
-#define SHL(a,shift) ((celt_word32_t)(a) << (shift))
+#define SHL(a,shift) ((celt_word32)(a) << (shift))
#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
@@ -100,21 +100,21 @@
#define HALF32(x) (SHR32(x,1))
/** Add two 16-bit values */
-#define ADD16(a,b) ((celt_word16_t)((celt_word16_t)(a)+(celt_word16_t)(b)))
+#define ADD16(a,b) ((celt_word16)((celt_word16)(a)+(celt_word16)(b)))
/** Subtract two 16-bit values */
-#define SUB16(a,b) ((celt_word16_t)(a)-(celt_word16_t)(b))
+#define SUB16(a,b) ((celt_word16)(a)-(celt_word16)(b))
/** Add two 32-bit values */
-#define ADD32(a,b) ((celt_word32_t)(a)+(celt_word32_t)(b))
+#define ADD32(a,b) ((celt_word32)(a)+(celt_word32)(b))
/** Subtract two 32-bit values */
-#define SUB32(a,b) ((celt_word32_t)(a)-(celt_word32_t)(b))
+#define SUB32(a,b) ((celt_word32)(a)-(celt_word32)(b))
/** 16x16 multiplication where the result fits in 16 bits */
-#define MULT16_16_16(a,b) ((((celt_word16_t)(a))*((celt_word16_t)(b))))
+#define MULT16_16_16(a,b) ((((celt_word16)(a))*((celt_word16)(b))))
-/* (celt_word32_t)(celt_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */
+/* (celt_word32)(celt_word16) gives TI compiler a hint that it's 16x16->32 multiply */
/** 16x16 multiplication where the result fits in 32 bits */
-#define MULT16_16(a,b) (((celt_word32_t)(celt_word16_t)(a))*((celt_word32_t)(celt_word16_t)(b)))
+#define MULT16_16(a,b) (((celt_word32)(celt_word16)(a))*((celt_word32)(celt_word16)(b)))
/** 16x16 multiply-add where the result fits in 32 bits */
#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
@@ -150,12 +150,12 @@
#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
/** Divide a 32-bit value by a 16-bit value. Result fits in 16 bits */
-#define DIV32_16(a,b) ((celt_word16_t)(((celt_word32_t)(a))/((celt_word16_t)(b))))
+#define DIV32_16(a,b) ((celt_word16)(((celt_word32)(a))/((celt_word16)(b))))
/** Divide a 32-bit value by a 16-bit value and round to nearest. Result fits in 16 bits */
-#define PDIV32_16(a,b) ((celt_word16_t)(((celt_word32_t)(a)+((celt_word16_t)(b)>>1))/((celt_word16_t)(b))))
+#define PDIV32_16(a,b) ((celt_word16)(((celt_word32)(a)+((celt_word16)(b)>>1))/((celt_word16)(b))))
/** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */
-#define DIV32(a,b) (((celt_word32_t)(a))/((celt_word32_t)(b)))
+#define DIV32(a,b) (((celt_word32)(a))/((celt_word32)(b)))
/** Divide a 32-bit value by a 32-bit value and round to nearest. Result fits in 32 bits */
-#define PDIV32(a,b) (((celt_word32_t)(a)+((celt_word16_t)(b)>>1))/((celt_word32_t)(b)))
+#define PDIV32(a,b) (((celt_word32)(a)+((celt_word16)(b)>>1))/((celt_word32)(b)))
#endif
--- a/libcelt/kiss_fft.c
+++ b/libcelt/kiss_fft.c
@@ -633,7 +633,7 @@
#endif
#if defined(FIXED_POINT) && (!defined(DOUBLE_PRECISION) || defined(MIXED_PRECISION))
for (i=0;i<nfft;++i) {
- celt_word32_t phase = -i;
+ celt_word32 phase = -i;
kf_cexp2(st->twiddles+i, DIV32(SHL32(phase,17),nfft));
}
#else
--- a/libcelt/kiss_fftr.c
+++ b/libcelt/kiss_fftr.c
@@ -63,7 +63,7 @@
#if defined (FIXED_POINT) && (!defined(DOUBLE_PRECISION) || defined(MIXED_PRECISION))
for (i=0;i<twiddle_size;++i) {
- celt_word32_t phase = i+(nfft>>1);
+ celt_word32 phase = i+(nfft>>1);
kf_cexp2(st->super_twiddles+i, DIV32(SHL32(phase,16),nfft));
}
#else
--- a/libcelt/mathops.h
+++ b/libcelt/mathops.h
@@ -44,7 +44,7 @@
#ifndef OVERRIDE_CELT_ILOG2
/** Integer log in base2. Undefined for zero and negative numbers */
-static inline celt_int16 celt_ilog2(celt_word32_t x)
+static inline celt_int16 celt_ilog2(celt_word32 x)
{
celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers");
return EC_ILOG(x)-1;
@@ -52,9 +52,9 @@
#endif
#ifndef OVERRIDE_FIND_MAX16
-static inline int find_max16(celt_word16_t *x, int len)
+static inline int find_max16(celt_word16 *x, int len)
{
- celt_word16_t max_corr=-VERY_LARGE16;
+ celt_word16 max_corr=-VERY_LARGE16;
int i, id = 0;
for (i=0;i<len;i++)
{
@@ -69,9 +69,9 @@
#endif
#ifndef OVERRIDE_FIND_MAX32
-static inline int find_max32(celt_word32_t *x, int len)
+static inline int find_max32(celt_word32 *x, int len)
{
- celt_word32_t max_corr=-VERY_LARGE32;
+ celt_word32 max_corr=-VERY_LARGE32;
int i, id = 0;
for (i=0;i<len;i++)
{
@@ -169,10 +169,10 @@
#include "os_support.h"
#ifndef OVERRIDE_CELT_MAXABS16
-static inline celt_word16_t celt_maxabs16(celt_word16_t *x, int len)
+static inline celt_word16 celt_maxabs16(celt_word16 *x, int len)
{
int i;
- celt_word16_t maxval = 0;
+ celt_word16 maxval = 0;
for (i=0;i<len;i++)
maxval = MAX16(maxval, ABS16(x[i]));
return maxval;
@@ -180,18 +180,18 @@
#endif
/** Integer log in base2. Defined for zero, but not for negative numbers */
-static inline celt_int16 celt_zlog2(celt_word32_t x)
+static inline celt_int16 celt_zlog2(celt_word32 x)
{
return x <= 0 ? 0 : celt_ilog2(x);
}
/** Reciprocal sqrt approximation (Q30 input, Q0 output or equivalent) */
-static inline celt_word32_t celt_rsqrt(celt_word32_t x)
+static inline celt_word32 celt_rsqrt(celt_word32 x)
{
int k;
- celt_word16_t n;
- celt_word32_t rt;
- const celt_word16_t C[5] = {23126, -11496, 9812, -9097, 4100};
+ celt_word16 n;
+ celt_word32 rt;
+ const celt_word16 C[5] = {23126, -11496, 9812, -9097, 4100};
k = celt_ilog2(x)>>1;
x = VSHR32(x, (k-7)<<1);
/* Range of n is [-16384,32767] */
@@ -203,12 +203,12 @@
}
/** Sqrt approximation (QX input, QX/2 output) */
-static inline celt_word32_t celt_sqrt(celt_word32_t x)
+static inline celt_word32 celt_sqrt(celt_word32 x)
{
int k;
- celt_word16_t n;
- celt_word32_t rt;
- const celt_word16_t C[5] = {23174, 11584, -3011, 1570, -557};
+ celt_word16 n;
+ celt_word32 rt;
+ const celt_word16 C[5] = {23174, 11584, -3011, 1570, -557};
if (x==0)
return 0;
k = (celt_ilog2(x)>>1)-7;
@@ -222,12 +222,12 @@
/** Sqrt approximation (QX input, QX/2 output) that assumes that the input is
strictly positive */
-static inline celt_word32_t celt_psqrt(celt_word32_t x)
+static inline celt_word32 celt_psqrt(celt_word32 x)
{
int k;
- celt_word16_t n;
- celt_word32_t rt;
- const celt_word16_t C[5] = {23174, 11584, -3011, 1570, -557};
+ celt_word16 n;
+ celt_word32 rt;
+ const celt_word16 C[5] = {23174, 11584, -3011, 1570, -557};
k = (celt_ilog2(x)>>1)-7;
x = VSHR32(x, (k<<1));
n = x-32768;
@@ -242,9 +242,9 @@
#define L3 8277
#define L4 -626
-static inline celt_word16_t _celt_cos_pi_2(celt_word16_t x)
+static inline celt_word16 _celt_cos_pi_2(celt_word16 x)
{
- celt_word16_t x2;
+ celt_word16 x2;
x2 = MULT16_16_P15(x,x);
return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2
@@ -256,7 +256,7 @@
#undef L3
#undef L4
-static inline celt_word16_t celt_cos_norm(celt_word32_t x)
+static inline celt_word16 celt_cos_norm(celt_word32 x)
{
x = x&0x0001ffff;
if (x>SHL32(EXTEND32(1), 16))
@@ -279,12 +279,12 @@
}
}
-static inline celt_word16_t celt_log2(celt_word32_t x)
+static inline celt_word16 celt_log2(celt_word32 x)
{
int i;
- celt_word16_t n, frac;
+ celt_word16 n, frac;
/*-0.41446 0.96093 -0.33981 0.15600 */
- const celt_word16_t C[4] = {-6791, 7872, -1392, 319};
+ const celt_word16 C[4] = {-6791, 7872, -1392, 319};
if (x==0)
return -32767;
i = celt_ilog2(x);
@@ -304,10 +304,10 @@
#define D2 3726
#define D3 1301
/** Base-2 exponential approximation (2^x). (Q11 input, Q16 output) */
-static inline celt_word32_t celt_exp2(celt_word16_t x)
+static inline celt_word32 celt_exp2(celt_word16 x)
{
int integer;
- celt_word16_t frac;
+ celt_word16 frac;
integer = SHR16(x,11);
if (integer>14)
return 0x7f000000;
@@ -319,11 +319,11 @@
}
/** Reciprocal approximation (Q15 input, Q16 output) */
-static inline celt_word32_t celt_rcp(celt_word32_t x)
+static inline celt_word32 celt_rcp(celt_word32 x)
{
int i;
- celt_word16_t n, frac;
- const celt_word16_t C[5] = {21848, -7251, 2403, -934, 327};
+ celt_word16 n, frac;
+ const celt_word16 C[5] = {21848, -7251, 2403, -934, 327};
celt_assert2(x>0, "celt_rcp() only defined for positive values");
i = celt_ilog2(x);
n = VSHR32(x,i-16)-SHL32(EXTEND32(3),15);
@@ -332,7 +332,7 @@
return VSHR32(EXTEND32(frac),i-16);
}
-#define celt_div(a,b) MULT32_32_Q31((celt_word32_t)(a),celt_rcp(b))
+#define celt_div(a,b) MULT32_32_Q31((celt_word32)(a),celt_rcp(b))
#define M1 32767
@@ -340,7 +340,7 @@
#define M3 -11943
#define M4 4936
-static inline celt_word16_t celt_atan01(celt_word16_t x)
+static inline celt_word16 celt_atan01(celt_word16 x)
{
return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
}
@@ -350,17 +350,17 @@
#undef M3
#undef M4
-static inline celt_word16_t celt_atan2p(celt_word16_t y, celt_word16_t x)
+static inline celt_word16 celt_atan2p(celt_word16 y, celt_word16 x)
{
if (y < x)
{
- celt_word32_t arg;
+ celt_word32 arg;
arg = celt_div(SHL32(EXTEND32(y),15),x);
if (arg >= 32767)
arg = 32767;
return SHR16(celt_atan01(EXTRACT16(arg)),1);
} else {
- celt_word32_t arg;
+ celt_word32 arg;
arg = celt_div(SHL32(EXTEND32(x),15),y);
if (arg >= 32767)
arg = 32767;
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -93,7 +93,7 @@
celt_free(l->trig);
}
-void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16_t *window, int overlap)
+void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 *window, int overlap)
{
int i;
int N, N2, N4;
@@ -111,8 +111,8 @@
const kiss_fft_scalar * restrict xp1 = in+(overlap>>1);
const kiss_fft_scalar * restrict xp2 = in+N2-1+(overlap>>1);
kiss_fft_scalar * restrict yp = out;
- const celt_word16_t * restrict wp1 = window+(overlap>>1);
- const celt_word16_t * restrict wp2 = window+(overlap>>1)-1;
+ const celt_word16 * restrict wp1 = window+(overlap>>1);
+ const celt_word16 * restrict wp2 = window+(overlap>>1)-1;
for(i=0;i<(overlap>>2);i++)
{
/* Real part arranged as -d-cR, Imag part arranged as -b+aR*/
@@ -184,7 +184,7 @@
}
-void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16_t * restrict window, int overlap)
+void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const celt_word16 * restrict window, int overlap)
{
int i;
int N, N2, N4;
@@ -252,8 +252,8 @@
kiss_fft_scalar * restrict fp1 = f2+N4-1;
kiss_fft_scalar * restrict xp1 = out+N2-1;
kiss_fft_scalar * restrict yp1 = out+N4-overlap/2;
- const celt_word16_t * restrict wp1 = window;
- const celt_word16_t * restrict wp2 = window+overlap-1;
+ const celt_word16 * restrict wp1 = window;
+ const celt_word16 * restrict wp2 = window+overlap-1;
for(i = 0; i< N4-overlap/2; i++)
{
*xp1 = *fp1;
@@ -274,8 +274,8 @@
kiss_fft_scalar * restrict fp2 = f2+N4;
kiss_fft_scalar * restrict xp2 = out+N2;
kiss_fft_scalar * restrict yp2 = out+N-1-(N4-overlap/2);
- const celt_word16_t * restrict wp1 = window;
- const celt_word16_t * restrict wp2 = window+overlap-1;
+ const celt_word16 * restrict wp1 = window;
+ const celt_word16 * restrict wp2 = window+overlap-1;
for(i = 0; i< N4-overlap/2; i++)
{
*xp2 = *fp2;
--- a/libcelt/mdct.h
+++ b/libcelt/mdct.h
@@ -59,10 +59,10 @@
void mdct_clear(mdct_lookup *l);
/** Compute a forward MDCT and scale by 4/N */
-void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16_t *window, int overlap);
+void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 *window, int overlap);
/** Compute a backward MDCT (no scaling) and performs weighted overlap-add
(scales implicitly by 1/2) */
-void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16_t * restrict window, int overlap);
+void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out, const celt_word16 * restrict window, int overlap);
#endif
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -272,7 +272,7 @@
#else
int res;
CELTMode *mode=NULL;
- celt_word16_t *window;
+ celt_word16 *window;
ALLOC_STACK;
#if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA)
if (global_stack==NULL)
@@ -350,7 +350,7 @@
if (mode->allocVectors==NULL)
goto failure;
- window = (celt_word16_t*)celt_alloc(mode->overlap*sizeof(celt_word16_t));
+ window = (celt_word16*)celt_alloc(mode->overlap*sizeof(celt_word16));
if (window==NULL)
goto failure;
@@ -450,7 +450,7 @@
celt_free((int*)mode->eBands);
celt_free((int*)mode->allocVectors);
- celt_free((celt_word16_t*)mode->window);
+ celt_free((celt_word16*)mode->window);
#ifndef SHORTCUTS
psydecay_clear(&mode->psy);
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -89,7 +89,7 @@
const celt_int16 *eBands; /**< Definition for each "pseudo-critical band" */
- celt_word16_t ePredCoef;/**< Prediction coefficient for the energy encoding */
+ celt_word16 ePredCoef;/**< Prediction coefficient for the energy encoding */
int nbAllocVectors; /**< Number of lines in the matrix below */
const celt_int16 *allocVectors; /**< Number of bits in each band for several rates */
@@ -100,12 +100,12 @@
mdct_lookup mdct;
kiss_fftr_cfg fft;
- const celt_word16_t *window;
+ const celt_word16 *window;
int nbShortMdcts;
int shortMdctSize;
mdct_lookup shortMdct;
- const celt_word16_t *shortWindow;
+ const celt_word16 *shortWindow;
struct PsyDecay psy;
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -62,10 +62,10 @@
}
#ifdef FIXED_POINT
-static void normalise16(celt_word16_t *x, int len, celt_word16_t val)
+static void normalise16(celt_word16 *x, int len, celt_word16 val)
{
int i;
- celt_word16_t maxabs;
+ celt_word16 maxabs;
maxabs = celt_maxabs16(x,len);
if (maxabs > val)
{
@@ -105,18 +105,18 @@
#define INPUT_SHIFT 15
-void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t * restrict x, const celt_sig_t * restrict y, const celt_word16_t * restrict window, celt_word16_t * restrict spectrum, int len, int max_pitch, int *pitch, int _C)
+void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig * restrict x, const celt_sig * restrict y, const celt_word16 * restrict window, celt_word16 * restrict spectrum, int len, int max_pitch, int *pitch, int _C)
{
int c, i;
- VARDECL(celt_word16_t, _X);
- VARDECL(celt_word16_t, _Y);
- const celt_word16_t * restrict wptr;
+ VARDECL(celt_word16, _X);
+ VARDECL(celt_word16, _Y);
+ const celt_word16 * restrict wptr;
#ifndef SHORTCUTS
- VARDECL(celt_mask_t, curve);
+ VARDECL(celt_mask, curve);
#endif
- celt_word16_t * restrict X, * restrict Y;
- celt_word16_t * restrict Xptr, * restrict Yptr;
- const celt_sig_t * restrict yptr;
+ celt_word16 * restrict X, * restrict Y;
+ celt_word16 * restrict Xptr, * restrict Yptr;
+ const celt_sig * restrict yptr;
int n2;
int L2;
const int C = CHANNELS(_C);
@@ -125,16 +125,16 @@
SAVE_STACK;
n2 = lag>>1;
L2 = len>>1;
- ALLOC(_X, lag, celt_word16_t);
+ ALLOC(_X, lag, celt_word16);
X = _X;
#ifndef SHORTCUTS
- ALLOC(curve, n2, celt_mask_t);
+ ALLOC(curve, n2, celt_mask);
#endif
CELT_MEMSET(X,0,lag);
/* Sum all channels of the current frame and copy into X in bit-reverse order */
for (c=0;c<C;c++)
{
- const celt_sig_t * restrict xptr = &x[c];
+ const celt_sig * restrict xptr = &x[c];
for (i=0;i<L2;i++)
{
X[2*BITREV(fft,i)] += SHR32(*xptr,INPUT_SHIFT);
@@ -172,7 +172,7 @@
#endif
/* Deferred allocation to reduce peak stack usage */
- ALLOC(_Y, lag, celt_word16_t);
+ ALLOC(_Y, lag, celt_word16);
Y = _Y;
yptr = &y[0];
/* Copy first channel of the past audio into Y in bit-reverse order */
@@ -204,7 +204,7 @@
Yptr = &Y[2];
for (i=1;i<n2;i++)
{
- celt_word16_t Xr, Xi, n;
+ celt_word16 Xr, Xi, n;
/* weight = 1/sqrt(curve) */
Xr = Xptr[0];
Xi = Xptr[1];
--- a/libcelt/pitch.h
+++ b/libcelt/pitch.h
@@ -49,6 +49,6 @@
/** Find the optimal delay for the pitch prediction. Computation is
done in the frequency domain, both to save time and to make it
easier to apply psychoacoustic weighting */
-void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t *x, const celt_sig_t *y, const celt_word16_t *window, celt_word16_t * restrict X, int len, int max_pitch, int *pitch, int _C);
+void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig *x, const celt_sig *y, const celt_word16 *window, celt_word16 * restrict X, int len, int max_pitch, int *pitch, int _C);
#endif
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -53,7 +53,7 @@
void psydecay_init(struct PsyDecay *decay, int len, celt_int32 Fs)
{
int i;
- celt_word16_t *decayR = (celt_word16_t*)celt_alloc(sizeof(celt_word16_t)*len);
+ celt_word16 *decayR = (celt_word16*)celt_alloc(sizeof(celt_word16)*len);
decay->decayR = decayR;
if (decayR==NULL)
return;
@@ -77,15 +77,15 @@
void psydecay_clear(struct PsyDecay *decay)
{
- celt_free((celt_word16_t *)decay->decayR);
+ celt_free((celt_word16 *)decay->decayR);
/*celt_free(decay->decayL);*/
}
#endif
-static void spreading_func(const struct PsyDecay *d, celt_word32_t * restrict psd, int len)
+static void spreading_func(const struct PsyDecay *d, celt_word32 * restrict psd, int len)
{
int i;
- celt_word32_t mem;
+ celt_word32 mem;
/* Compute right slope (-10 dB/Bark) */
mem=psd[0];
for (i=0;i<len;i++)
@@ -100,7 +100,7 @@
{
/* Left side has around twice the slope as the right side, so we just
square the coef instead of storing two sets of decay coefs */
- celt_word16_t decayL = MULT16_16_Q15(d->decayR[i], d->decayR[i]);
+ celt_word16 decayL = MULT16_16_Q15(d->decayR[i], d->decayR[i]);
/* psd = (1-decay)*psd + decay*mem */
psd[i] = EPSILON + psd[i] + MULT16_32_Q15(decayL,mem-psd[i]);
mem = psd[i];
@@ -110,7 +110,7 @@
{
int start,end;
int j;
- celt_word32_t Esig=0, Emask=0;
+ celt_word32 Esig=0, Emask=0;
start = (int)floor(fromBARK((float)i)*(2*len)/Fs);
if (start<0)
start = 0;
@@ -131,7 +131,7 @@
}
/* Compute a marking threshold from the spectrum X. */
-void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t * restrict mask, int len)
+void compute_masking(const struct PsyDecay *decay, celt_word16 *X, celt_mask * restrict mask, int len)
{
int i;
int N;
@@ -145,7 +145,7 @@
}
#ifdef EXP_PSY /* Not needed for now, but will be useful in the future */
-void compute_mdct_masking(const struct PsyDecay *decay, celt_word32_t *X, celt_word16_t *tonality, celt_word16_t *long_window, celt_mask_t *mask, int len)
+void compute_mdct_masking(const struct PsyDecay *decay, celt_word32 *X, celt_word16 *tonality, celt_word16 *long_window, celt_mask *mask, int len)
{
int i;
VARDECL(float, psd);
@@ -164,11 +164,11 @@
RESTORE_STACK;
}
-void compute_tonality(const CELTMode *m, celt_word16_t * restrict X, celt_word16_t * mem, int len, celt_word16_t *tonality, int mdct_size)
+void compute_tonality(const CELTMode *m, celt_word16 * restrict X, celt_word16 * mem, int len, celt_word16 *tonality, int mdct_size)
{
int i;
- celt_word16_t norm_1;
- celt_word16_t *mem2;
+ celt_word16 norm_1;
+ celt_word16 *mem2;
int N = len>>2;
mem2 = mem+2*N;
@@ -177,7 +177,7 @@
tonality[0] = 1;
for (i=1;i<N;i++)
{
- celt_word16_t re, im, re2, im2;
+ celt_word16 re, im, re2, im2;
re = X[2*i];
im = X[2*i+1];
/* Normalise spectrum */
--- a/libcelt/psy.h
+++ b/libcelt/psy.h
@@ -36,8 +36,8 @@
#include "celt.h"
struct PsyDecay {
- /*celt_word16_t *decayL;*/
- const celt_word16_t * restrict decayR;
+ /*celt_word16 *decayL;*/
+ const celt_word16 * restrict decayR;
};
/** Pre-compute the decay of the psycho-acoustic spreading function */
@@ -47,11 +47,11 @@
void psydecay_clear(struct PsyDecay *decay);
/** Compute the masking curve for an input (DFT) spectrum X */
-void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t *mask, int len);
+void compute_masking(const struct PsyDecay *decay, celt_word16 *X, celt_mask *mask, int len);
/** Compute the masking curve for an input (MDCT) spectrum X */
-void compute_mdct_masking(const struct PsyDecay *decay, celt_word32_t *X, celt_word16_t *tonality, celt_word16_t *long_window, celt_mask_t *mask, int len);
+void compute_mdct_masking(const struct PsyDecay *decay, celt_word32 *X, celt_word16 *tonality, celt_word16 *long_window, celt_mask *mask, int len);
-void compute_tonality(const CELTMode *m, celt_word16_t * restrict X, celt_word16_t * mem, int len, celt_word16_t *tonality, int mdct_size);
+void compute_tonality(const CELTMode *m, celt_word16 * restrict X, celt_word16 * mem, int len, celt_word16 *tonality, int mdct_size);
#endif /* PSY_H */
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -43,19 +43,19 @@
#include "stack_alloc.h"
#ifdef FIXED_POINT
-const celt_word16_t eMeans[24] = {1920, -341, -512, -107, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const celt_word16 eMeans[24] = {1920, -341, -512, -107, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#else
-const celt_word16_t eMeans[24] = {7.5f, -1.33f, -2.f, -0.42f, 0.17f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
+const celt_word16 eMeans[24] = {7.5f, -1.33f, -2.f, -0.42f, 0.17f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
#endif
/* FIXME: Implement for stereo */
-int intra_decision(celt_word16_t *eBands, celt_word16_t *oldEBands, int len)
+int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int len)
{
int i;
- celt_word32_t dist = 0;
+ celt_word32 dist = 0;
for (i=0;i<len;i++)
{
- celt_word16_t d = SUB16(eBands[i], oldEBands[i]);
+ celt_word16 d = SUB16(eBands[i], oldEBands[i]);
dist = MAC16_16(dist, d,d);
}
return SHR32(dist,16) > 2*len;
@@ -86,14 +86,14 @@
celt_free(freq);
}
-unsigned quant_coarse_energy(const CELTMode *m, celt_word16_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, celt_word16_t *error, ec_enc *enc, int _C)
+unsigned quant_coarse_energy(const CELTMode *m, celt_word16 *eBands, celt_word16 *oldEBands, int budget, int intra, int *prob, celt_word16 *error, ec_enc *enc, int _C)
{
int i, c;
unsigned bits;
unsigned bits_used = 0;
- celt_word16_t prev[2] = {0,0};
- celt_word16_t coef = m->ePredCoef;
- celt_word16_t beta;
+ celt_word16 prev[2] = {0,0};
+ celt_word16 coef = m->ePredCoef;
+ celt_word16 beta;
const int C = CHANNELS(_C);
if (intra)
@@ -111,10 +111,10 @@
c=0;
do {
int qi;
- celt_word16_t q; /* dB */
- celt_word16_t x; /* dB */
- celt_word16_t f; /* Q8 */
- celt_word16_t mean = MULT16_16_Q15(Q15ONE-coef,eMeans[i]);
+ celt_word16 q; /* dB */
+ celt_word16 x; /* dB */
+ celt_word16 f; /* Q8 */
+ celt_word16 mean = MULT16_16_Q15(Q15ONE-coef,eMeans[i]);
x = eBands[i+c*m->nbEBands];
#ifdef FIXED_POINT
f = x-mean -MULT16_16_Q15(coef,oldEBands[i+c*m->nbEBands])-prev[c];
@@ -145,7 +145,7 @@
return bits_used;
}
-void quant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, ec_enc *enc, int _C)
+void quant_fine_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C)
{
int i, c;
const int C = CHANNELS(_C);
@@ -159,7 +159,7 @@
c=0;
do {
int q2;
- celt_word16_t offset;
+ celt_word16 offset;
#ifdef FIXED_POINT
/* Has to be without rounding */
q2 = (error[i+c*m->nbEBands]+QCONST16(.5f,8))>>(8-fine_quant[i]);
@@ -184,7 +184,7 @@
eBands[i] = log2Amp(oldEBands[i]);
}
-void quant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C)
+void quant_energy_finalise(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C)
{
int i, prio, c;
const int C = CHANNELS(_C);
@@ -199,7 +199,7 @@
c=0;
do {
int q2;
- celt_word16_t offset;
+ celt_word16 offset;
q2 = error[i+c*m->nbEBands]<0 ? 0 : 1;
ec_enc_bits(enc, q2, 1);
#ifdef FIXED_POINT
@@ -220,13 +220,13 @@
}
}
-void unquant_coarse_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, ec_dec *dec, int _C)
+void unquant_coarse_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int budget, int intra, int *prob, ec_dec *dec, int _C)
{
int i, c;
unsigned bits;
- celt_word16_t prev[2] = {0, 0};
- celt_word16_t coef = m->ePredCoef;
- celt_word16_t beta;
+ celt_word16 prev[2] = {0, 0};
+ celt_word16 coef = m->ePredCoef;
+ celt_word16 beta;
const int C = CHANNELS(_C);
if (intra)
@@ -244,8 +244,8 @@
c=0;
do {
int qi;
- celt_word16_t q;
- celt_word16_t mean = MULT16_16_Q15(Q15ONE-coef,eMeans[i]);
+ celt_word16 q;
+ celt_word16 mean = MULT16_16_Q15(Q15ONE-coef,eMeans[i]);
/* If we didn't have enough bits to encode all the energy, just assume something safe.
We allow slightly busting the budget here */
if (ec_dec_tell(dec, 0) - bits > budget)
@@ -260,7 +260,7 @@
}
}
-void unquant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, ec_dec *dec, int _C)
+void unquant_fine_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C)
{
int i, c;
const int C = CHANNELS(_C);
@@ -272,7 +272,7 @@
c=0;
do {
int q2;
- celt_word16_t offset;
+ celt_word16 offset;
q2 = ec_dec_bits(dec, fine_quant[i]);
#ifdef FIXED_POINT
offset = SUB16(SHR16(SHL16(q2,8)+QCONST16(.5,8),fine_quant[i]),QCONST16(.5f,8));
@@ -286,7 +286,7 @@
eBands[i] = log2Amp(oldEBands[i]);
}
-void unquant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C)
+void unquant_energy_finalise(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C)
{
int i, prio, c;
const int C = CHANNELS(_C);
@@ -301,7 +301,7 @@
c=0;
do {
int q2;
- celt_word16_t offset;
+ celt_word16 offset;
q2 = ec_dec_bits(dec, 1);
#ifdef FIXED_POINT
offset = SHR16(SHL16(q2,8)-QCONST16(.5,8),fine_quant[i]+1);
--- a/libcelt/quant_bands.h
+++ b/libcelt/quant_bands.h
@@ -39,12 +39,12 @@
#include "entdec.h"
#include "mathops.h"
-static inline celt_word16_t amp2Log(celt_word32_t amp)
+static inline celt_word16 amp2Log(celt_word32 amp)
{
return celt_log2(MAX32(QCONST32(.001f,14),SHL32(amp,2)));
}
-static inline celt_word32_t log2Amp(celt_word16_t lg)
+static inline celt_word32 log2Amp(celt_word16 lg)
{
return PSHR32(celt_exp2(SHL16(lg,3)),4);
}
@@ -54,18 +54,18 @@
void compute_fine_allocation(const CELTMode *m, int *bits, int budget);
-int intra_decision(celt_word16_t *eBands, celt_word16_t *oldEBands, int len);
+int intra_decision(celt_word16 *eBands, celt_word16 *oldEBands, int len);
-unsigned quant_coarse_energy(const CELTMode *m, celt_word16_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, celt_word16_t *error, ec_enc *enc, int _C);
+unsigned quant_coarse_energy(const CELTMode *m, celt_word16 *eBands, celt_word16 *oldEBands, int budget, int intra, int *prob, celt_word16 *error, ec_enc *enc, int _C);
-void quant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, ec_enc *enc, int _C);
+void quant_fine_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C);
-void quant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, celt_word16_t *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C);
+void quant_energy_finalise(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C);
-void unquant_coarse_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int budget, int intra, int *prob, ec_dec *dec, int _C);
+void unquant_coarse_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int budget, int intra, int *prob, ec_dec *dec, int _C);
-void unquant_fine_energy(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, ec_dec *dec, int _C);
+void unquant_fine_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C);
-void unquant_energy_finalise(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C);
+void unquant_energy_finalise(const CELTMode *m, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C);
#endif /* QUANT_BANDS */
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -45,13 +45,13 @@
#define M_PI 3.141592653
#endif
-static void exp_rotation(celt_norm_t *X, int len, int dir, int stride, int K)
+static void exp_rotation(celt_norm *X, int len, int dir, int stride, int K)
{
int i, k, iter;
- celt_word16_t c, s;
- celt_word16_t gain, theta;
- celt_norm_t *Xptr;
- gain = celt_div((celt_word32_t)MULT16_16(Q15_ONE,len),(celt_word32_t)(3+len+6*K));
+ celt_word16 c, s;
+ celt_word16 gain, theta;
+ celt_norm *Xptr;
+ gain = celt_div((celt_word32)MULT16_16(Q15_ONE,len),(celt_word32)(3+len+6*K));
/* FIXME: Make that HALF16 instead of HALF32 */
theta = SUB16(Q15ONE, HALF32(MULT16_16_Q15(gain,gain)));
/*if (len==30)
@@ -72,7 +72,7 @@
Xptr = X;
for (i=0;i<len-stride;i++)
{
- celt_norm_t x1, x2;
+ celt_norm x1, x2;
x1 = Xptr[0];
x2 = Xptr[stride];
Xptr[stride] = MULT16_16_Q15(c,x2) + MULT16_16_Q15(s,x1);
@@ -81,7 +81,7 @@
Xptr = &X[len-2*stride-1];
for (i=len-2*stride-1;i>=0;i--)
{
- celt_norm_t x1, x2;
+ celt_norm x1, x2;
x1 = Xptr[0];
x2 = Xptr[stride];
Xptr[stride] = MULT16_16_Q15(c,x2) + MULT16_16_Q15(s,x1);
@@ -100,10 +100,10 @@
/** Takes the pitch vector and the decoded residual vector, computes the gain
that will give ||p+g*y||=1 and mixes the residual with the pitch. */
-static void normalise_residual(int * restrict iy, celt_norm_t * restrict X, int N, int K, celt_word32_t Ryy)
+static void normalise_residual(int * restrict iy, celt_norm * restrict X, int N, int K, celt_word32 Ryy)
{
int i;
- celt_word32_t g;
+ celt_word32 g;
g = celt_rsqrt(Ryy);
@@ -113,16 +113,16 @@
while (++i < N);
}
-void alg_quant(celt_norm_t *X, int N, int K, int spread, ec_enc *enc)
+void alg_quant(celt_norm *X, int N, int K, int spread, ec_enc *enc)
{
- VARDECL(celt_norm_t, y);
+ VARDECL(celt_norm, y);
VARDECL(int, iy);
- VARDECL(celt_word16_t, signx);
+ VARDECL(celt_word16, signx);
int j, is;
- celt_word16_t s;
+ celt_word16 s;
int pulsesLeft;
- celt_word32_t sum;
- celt_word32_t xy, yy;
+ celt_word32 sum;
+ celt_word32 xy, yy;
int N_1; /* Inverse of N, in Q14 format (even for float) */
#ifdef FIXED_POINT
int yshift;
@@ -134,9 +134,9 @@
yshift = 13-celt_ilog2(K);
#endif
- ALLOC(y, N, celt_norm_t);
+ ALLOC(y, N, celt_norm);
ALLOC(iy, N, int);
- ALLOC(signx, N, celt_word16_t);
+ ALLOC(signx, N, celt_word16);
N_1 = 512/N;
if (spread)
@@ -161,7 +161,7 @@
/* Do a pre-search by projecting on the pyramid */
if (K > (N>>1))
{
- celt_word16_t rcp;
+ celt_word16 rcp;
sum=0;
j=0; do {
sum += X[j];
@@ -201,9 +201,9 @@
{
int pulsesAtOnce=1;
int best_id;
- celt_word16_t magnitude;
- celt_word32_t best_num = -VERY_LARGE16;
- celt_word16_t best_den = 0;
+ celt_word16 magnitude;
+ celt_word32 best_num = -VERY_LARGE16;
+ celt_word16 best_den = 0;
#ifdef FIXED_POINT
int rshift;
#endif
@@ -224,7 +224,7 @@
/* This should ensure that anything we can process will have a better score */
j=0;
do {
- celt_word16_t Rxy, Ryy;
+ celt_word16 Rxy, Ryy;
/* Select sign based on X[j] alone */
s = magnitude;
/* Temporary sums of the new pulse(s) */
@@ -280,10 +280,10 @@
/** Decode pulse vector and combine the result with the pitch vector to produce
the final normalised signal in the current band. */
-void alg_unquant(celt_norm_t *X, int N, int K, int spread, ec_dec *dec)
+void alg_unquant(celt_norm *X, int N, int K, int spread, ec_dec *dec)
{
int i;
- celt_word32_t Ryy;
+ celt_word32 Ryy;
VARDECL(int, iy);
SAVE_STACK;
K = get_pulses(K);
@@ -300,13 +300,13 @@
RESTORE_STACK;
}
-celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride)
+celt_word16 renormalise_vector(celt_norm *X, celt_word16 value, int N, int stride)
{
int i;
- celt_word32_t E = EPSILON;
- celt_word16_t rE;
- celt_word16_t g;
- celt_norm_t *xptr = X;
+ celt_word32 E = EPSILON;
+ celt_word16 rE;
+ celt_word16 g;
+ celt_norm *xptr = X;
for (i=0;i<N;i++)
{
E = MAC16_16(E, *xptr, *xptr);
@@ -329,7 +329,7 @@
return rE;
}
-static void fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B)
+static void fold(const CELTMode *m, int N, const celt_norm * restrict Y, celt_norm * restrict P, int N0, int B)
{
int j;
int id = N0 % B;
@@ -354,7 +354,7 @@
P[j] = Y[id++];
}
-void intra_fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B)
+void intra_fold(const CELTMode *m, int N, const celt_norm * restrict Y, celt_norm * restrict P, int N0, int B)
{
fold(m, N, Y, P, N0, B);
renormalise_vector(P, Q15ONE, N, 1);
--- a/libcelt/vq.h
+++ b/libcelt/vq.h
@@ -51,7 +51,7 @@
* @param p Pitch vector (it is assumed that p+x is a unit vector)
* @param enc Entropy encoder state
*/
-void alg_quant(celt_norm_t *X, int N, int K, int spread, ec_enc *enc);
+void alg_quant(celt_norm *X, int N, int K, int spread, ec_enc *enc);
/** Algebraic pulse decoder
* @param x Decoded normalised spectrum (returned)
@@ -60,9 +60,9 @@
* @param p Pitch vector (automatically added to x)
* @param dec Entropy decoder state
*/
-void alg_unquant(celt_norm_t *X, int N, int K, int spread, ec_dec *dec);
+void alg_unquant(celt_norm *X, int N, int K, int spread, ec_dec *dec);
-celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int stride);
+celt_word16 renormalise_vector(celt_norm *X, celt_word16 value, int N, int stride);
/** Intra-frame predictor that matches a section of the current frame (at lower
* frequencies) to encode the current band.
@@ -75,6 +75,6 @@
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
* @param N0 Number of valid offsets
*/
-void intra_fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B);
+void intra_fold(const CELTMode *m, int N, const celt_norm * restrict Y, celt_norm * restrict P, int N0, int B);
#endif /* VQ_H */
--- a/tests/mathops-test.c
+++ b/tests/mathops-test.c
@@ -23,7 +23,7 @@
for (i=1;i<=327670;i++)
{
double prod;
- celt_word32_t val;
+ celt_word32 val;
val = celt_rcp(i);
#ifdef FIXED_POINT
prod = (1./32768./65526.)*val*i;
@@ -44,7 +44,7 @@
for (i=1;i<=1000000000;i++)
{
double ratio;
- celt_word16_t val;
+ celt_word16 val;
val = celt_sqrt(i);
ratio = val/sqrt(i);
if (fabs(ratio - 1) > .001 && fabs(val-sqrt(i)) > 2)
@@ -62,7 +62,7 @@
for (i=1;i<=2000000;i++)
{
double ratio;
- celt_word16_t val;
+ celt_word16 val;
val = celt_rsqrt(i);
ratio = val*sqrt(i)/Q15ONE;
if (fabs(ratio - 1) > .05)
@@ -119,10 +119,10 @@
#else
void testilog2(void)
{
- celt_word32_t x;
+ celt_word32 x;
for (x=1;x<=268435455;x+=127)
{
- celt_word32_t error = abs(celt_ilog2(x)-(int)floor(log2(x)));
+ celt_word32 error = abs(celt_ilog2(x)-(int)floor(log2(x)));
if (error!=0)
{
printf("celt_ilog2 failed: celt_ilog2(x)!=floor(log2(x)) (x = %d, error = %d)\n",x,error);
--- a/tests/mdct-test.c
+++ b/tests/mdct-test.c
@@ -86,7 +86,7 @@
kiss_fft_scalar * in = (kiss_fft_scalar*)malloc(buflen);
kiss_fft_scalar * out= (kiss_fft_scalar*)malloc(buflen);
- celt_word16_t * window= (celt_word16_t*)malloc(sizeof(celt_word16_t)*nfft/2);
+ celt_word16 * window= (celt_word16*)malloc(sizeof(celt_word16)*nfft/2);
int k;
mdct_init(&cfg, nfft);
--- a/tests/rotation-test.c
+++ b/tests/rotation-test.c
@@ -14,8 +14,8 @@
{
int i;
double err = 0, ener = 0, snr, snr0;
- celt_word16_t x0[MAX_SIZE];
- celt_word16_t x1[MAX_SIZE];
+ celt_word16 x0[MAX_SIZE];
+ celt_word16 x1[MAX_SIZE];
int nb_rotations = (N+4*K)/(8*K);
for (i=0;i<N;i++)
x1[i] = x0[i] = rand()%32767-16384;