From d77d6a58fcfaeb480c705d2242a4f654cb3aa57f Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> Date: Fri, 29 Jul 2011 17:33:06 -0400 Subject: [PATCH] Renamed celt_[u]int* to opus_[u]int* --- libcelt/_kiss_fft_guts.h | 2 +- libcelt/arch.h | 10 +- libcelt/bands.c | 52 +++++----- libcelt/bands.h | 6 +- libcelt/c64_fft.c | 56 +++++------ libcelt/c64_fft.h | 12 +-- libcelt/celt.c | 126 +++++++++++------------ libcelt/celt.h | 10 +- libcelt/cwrs.c | 122 +++++++++++------------ libcelt/cwrs.h | 4 +- libcelt/dump_modes.c | 10 +- libcelt/ecintrin.h | 4 +- libcelt/entcode.c | 8 +- libcelt/entcode.h | 20 ++-- libcelt/entdec.c | 30 +++--- libcelt/entdec.h | 6 +- libcelt/entenc.c | 30 +++--- libcelt/entenc.h | 8 +- libcelt/fixed_debug.h | 2 +- libcelt/fixed_generic.h | 2 +- libcelt/kiss_fft.c | 18 ++-- libcelt/kiss_fft.h | 12 +-- libcelt/laplace.c | 6 +- libcelt/mathops.c | 6 +- libcelt/mathops.h | 12 +-- libcelt/mfrngcod.h | 6 +- libcelt/modes.c | 48 ++++----- libcelt/modes.h | 14 +-- libcelt/{celt_types.h => opus_types.h} | 132 ++++++++++++------------- libcelt/quant_bands.c | 18 ++-- libcelt/quant_bands.h | 4 +- libcelt/rate.c | 32 +++--- libcelt/rate.h | 4 +- libcelt/static_modes_fixed.c | 12 +-- libcelt/static_modes_float.c | 12 +-- libcelt/testcelt.c | 10 +- libcelt/tests/cwrs32-test.c | 14 +-- libcelt/tests/laplace-test.c | 2 +- libcelt/tests/mathops-test.c | 4 +- libcelt/tests/type-test.c | 4 +- src/opus_encoder.c | 8 +- src/test_opus.c | 10 +- src/test_opus_custom.c | 10 +- 43 files changed, 459 insertions(+), 459 deletions(-) rename libcelt/{celt_types.h => opus_types.h} (52%) diff --git a/libcelt/_kiss_fft_guts.h b/libcelt/_kiss_fft_guts.h index c469d35c7..97e8c07d9 100644 --- a/libcelt/_kiss_fft_guts.h +++ b/libcelt/_kiss_fft_guts.h @@ -50,7 +50,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #else /* DOUBLE_PRECISION */ # define FRACBITS 15 -# define SAMPPROD celt_int32 +# define SAMPPROD opus_int32 #define SAMP_MAX 32767 #define TRIG_UPSCALE 1 #define EXT32(a) EXTEND32(a) diff --git a/libcelt/arch.h b/libcelt/arch.h index 68da0debd..470b9fbdc 100644 --- a/libcelt/arch.h +++ b/libcelt/arch.h @@ -34,7 +34,7 @@ #ifndef ARCH_H #define ARCH_H -#include "celt_types.h" +#include "opus_types.h" # if !defined(__GNUC_PREREQ) # if defined(__GNUC__)&&defined(__GNUC_MINOR__) @@ -71,8 +71,8 @@ static inline void _celt_fatal(const char *str, const char *file, int line) #endif #define IMUL32(a,b) ((a)*(b)) -#define UMUL32(a,b) ((celt_int32)(a)*(celt_int32)(b)) -#define UMUL16_16(a,b) ((celt_int32)(a)*(celt_int32)(b)) +#define UMUL32(a,b) ((opus_int32)(a)*(opus_int32)(b)) +#define UMUL16_16(a,b) ((opus_int32)(a)*(opus_int32)(b)) #define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */ #define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */ @@ -90,8 +90,8 @@ static inline void _celt_fatal(const char *str, const char *file, int line) #ifdef FIXED_POINT -typedef celt_int16 celt_word16; -typedef celt_int32 celt_word32; +typedef opus_int16 celt_word16; +typedef opus_int32 celt_word32; typedef celt_word32 celt_sig; typedef celt_word16 celt_norm; diff --git a/libcelt/bands.c b/libcelt/bands.c index d51feee16..fe69265e5 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -41,18 +41,18 @@ #include "mathops.h" #include "rate.h" -celt_uint32 lcg_rand(celt_uint32 seed) +opus_uint32 lcg_rand(opus_uint32 seed) { return 1664525 * seed + 1013904223; } /* This is a cos() approximation designed to be bit-exact on any platform. Bit exactness with this approximation is important because it has an impact on the bit allocation */ -static celt_int16 bitexact_cos(celt_int16 x) +static opus_int16 bitexact_cos(opus_int16 x) { - celt_int32 tmp; - celt_int16 x2; - tmp = (4096+((celt_int32)(x)*(x)))>>13; + opus_int32 tmp; + opus_int16 x2; + tmp = (4096+((opus_int32)(x)*(x)))>>13; if (tmp > 32767) tmp = 32767; x2 = tmp; @@ -80,7 +80,7 @@ static int bitexact_log2tan(int isin,int icos) void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank, int end, int _C, int M) { int i, c, N; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = M*m->shortMdctSize; c=0; do { @@ -118,7 +118,7 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bank, int end, int _C, int M) { int i, c, N; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = M*m->shortMdctSize; c=0; do { @@ -141,7 +141,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank, int end, int _C, int M) { int i, c, N; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = M*m->shortMdctSize; c=0; do { @@ -162,7 +162,7 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_norm * restrict X, const celt_ener *bank, int end, int _C, int M) { int i, c, N; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = M*m->shortMdctSize; c=0; do { @@ -182,7 +182,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * restrict freq, celt_nor void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig * restrict freq, const celt_ener *bank, int end, int _C, int M) { int i, c, N; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; const int C = CHANNELS(_C); N = M*m->shortMdctSize; celt_assert2(C<=2, "denormalise_bands() not implemented for >2 channels"); @@ -210,7 +210,7 @@ void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig /* This prevents energy collapse for transients with multiple short MDCTs */ void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_masks, int LM, int C, int CC, int size, int start, int end, celt_word16 *logE, celt_word16 *prev1logE, - celt_word16 *prev2logE, int *pulses, celt_uint32 seed) + celt_word16 *prev2logE, int *pulses, opus_uint32 seed) { int c, i, j, k; for (i=start;i<end;i++) @@ -403,7 +403,7 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average, int i, c, N0; int sum = 0, nbBands=0; const int C = CHANNELS(_C); - const celt_int16 * restrict eBands = m->eBands; + const opus_int16 * restrict eBands = m->eBands; int decision; int hf_sum=0; @@ -604,7 +604,7 @@ void haar1(celt_norm *X, int N0, int stride) static int compute_qn(int N, int b, int offset, int pulse_cap, int stereo) { - static const celt_int16 exp2_table8[8] = + static const opus_int16 exp2_table8[8] = {16384, 17866, 19483, 21247, 23170, 25267, 27554, 30048}; int qn, qb; int N2 = 2*N-1; @@ -633,8 +633,8 @@ static int compute_qn(int N, int b, int offset, int pulse_cap, int stereo) can be called recursively so bands can end up being split in 8 parts. */ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_norm *Y, int N, int b, int spread, int B, int intensity, int tf_change, celt_norm *lowband, int resynth, ec_ctx *ec, - celt_int32 *remaining_bits, int LM, celt_norm *lowband_out, const celt_ener *bandE, int level, - celt_uint32 *seed, celt_word16 gain, celt_norm *lowband_scratch, int fill) + opus_int32 *remaining_bits, int LM, celt_norm *lowband_out, const celt_ener *bandE, int level, + opus_uint32 *seed, celt_word16 gain, celt_norm *lowband_scratch, int fill) { const unsigned char *cache; int q; @@ -767,7 +767,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c int pulse_cap; int offset; int orig_fill; - celt_int32 tell; + opus_int32 tell; /* Decide on the resolution to give to the split parameter theta */ pulse_cap = m->logN[i]+(LM<<BITRES); @@ -837,14 +837,14 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c if (fm < ((qn>>1)*((qn>>1) + 1)>>1)) { - itheta = (isqrt32(8*(celt_uint32)fm + 1) - 1)>>1; + itheta = (isqrt32(8*(opus_uint32)fm + 1) - 1)>>1; fs = itheta + 1; fl = itheta*(itheta + 1)>>1; } else { itheta = (2*(qn + 1) - - isqrt32(8*(celt_uint32)(ft - fm - 1) + 1))>>1; + - isqrt32(8*(opus_uint32)(ft - fm - 1) + 1))>>1; fs = qn + 1 - itheta; fl = ft - ((qn + 1 - itheta)*(qn + 2 - itheta)>>1); } @@ -852,7 +852,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c ec_dec_update(ec, fl, fl+fs, ft); } } - itheta = (celt_int32)itheta*16384/qn; + itheta = (opus_int32)itheta*16384/qn; if (encode && stereo) { if (itheta==0) @@ -973,7 +973,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c celt_norm *next_lowband2=NULL; celt_norm *next_lowband_out1=NULL; int next_level=0; - celt_int32 rebalance; + opus_int32 rebalance; /* Give more bits to low-energy MDCTs than they would otherwise deserve */ if (B0>1 && !stereo && (itheta&0x3fff)) @@ -1078,7 +1078,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c for (j=0;j<N;j++) { *seed = lcg_rand(*seed); - X[j] = (celt_int32)(*seed)>>20; + X[j] = (opus_int32)(*seed)>>20; } cm = cm_mask; } else { @@ -1161,11 +1161,11 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c void quant_all_bands(int encode, const CELTMode *m, int start, int end, celt_norm *_X, celt_norm *_Y, unsigned char *collapse_masks, const celt_ener *bandE, int *pulses, int shortBlocks, int spread, int dual_stereo, int intensity, int *tf_res, int resynth, - celt_int32 total_bits, celt_int32 balance, ec_ctx *ec, int LM, int codedBands, celt_uint32 *seed) + opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int LM, int codedBands, opus_uint32 *seed) { int i; - celt_int32 remaining_bits; - const celt_int16 * restrict eBands = m->eBands; + opus_int32 remaining_bits; + const opus_int16 * restrict eBands = m->eBands; celt_norm * restrict norm, * restrict norm2; VARDECL(celt_norm, _norm); VARDECL(celt_norm, lowband_scratch); @@ -1186,10 +1186,10 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end, lowband_offset = 0; for (i=start;i<end;i++) { - celt_int32 tell; + opus_int32 tell; int b; int N; - celt_int32 curr_balance; + opus_int32 curr_balance; int effective_lowband=-1; celt_norm * restrict X, * restrict Y; int tf_change=0; diff --git a/libcelt/bands.h b/libcelt/bands.h index d3d3dc8dc..cf5b1dbab 100644 --- a/libcelt/bands.h +++ b/libcelt/bands.h @@ -84,15 +84,15 @@ void haar1(celt_norm *X, int N0, int stride); void quant_all_bands(int encode, const CELTMode *m, int start, int end, celt_norm * X, celt_norm * Y, unsigned char *collapse_masks, const celt_ener *bandE, int *pulses, int time_domain, int fold, int dual_stereo, int intensity, int *tf_res, int resynth, - celt_int32 total_bits, celt_int32 balance, ec_ctx *ec, int M, int codedBands, celt_uint32 *seed); + opus_int32 total_bits, opus_int32 balance, ec_ctx *ec, int M, int codedBands, opus_uint32 *seed); void stereo_decision(const CELTMode *m, celt_norm * restrict X, int *stereo_mode, int len, int M); void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_masks, int LM, int C, int CC, int size, int start, int end, celt_word16 *logE, celt_word16 *prev1logE, - celt_word16 *prev2logE, int *pulses, celt_uint32 seed); + celt_word16 *prev2logE, int *pulses, opus_uint32 seed); -celt_uint32 lcg_rand(celt_uint32 seed); +opus_uint32 lcg_rand(opus_uint32 seed); #endif /* BANDS_H */ diff --git a/libcelt/c64_fft.c b/libcelt/c64_fft.c index b69a0b594..f000831a7 100644 --- a/libcelt/c64_fft.c +++ b/libcelt/c64_fft.c @@ -157,7 +157,7 @@ static c64_fft_t *cache32[NBCACHE] = {NULL,}; c64_fft_t *c64_fft16_alloc(int length, int x, int y) { c64_fft_t *state; - celt_int16 *w, *iw; + opus_int16 *w, *iw; int i, c; @@ -171,13 +171,13 @@ c64_fft_t *c64_fft16_alloc(int length, int x, int y) state = (c64_fft_t *)celt_alloc(sizeof(c64_fft_t)); state->shift = log(length)/log(2) - ceil(log(length)/log(4)-1); state->nfft = length; - state->twiddle = celt_alloc(length*2*sizeof(celt_int16)); - state->itwiddle = celt_alloc(length*2*sizeof(celt_int16)); + state->twiddle = celt_alloc(length*2*sizeof(opus_int16)); + state->itwiddle = celt_alloc(length*2*sizeof(opus_int16)); - gen_twiddle16((celt_int16 *)state->twiddle, length, 32767.0); + gen_twiddle16((opus_int16 *)state->twiddle, length, 32767.0); - w = (celt_int16 *)state->twiddle; - iw = (celt_int16 *)state->itwiddle; + w = (opus_int16 *)state->twiddle; + iw = (opus_int16 *)state->itwiddle; for (i = 0; i < length; i++) { iw[2*i+0] = w[2*i+0]; @@ -208,8 +208,8 @@ c64_fft_t *c64_fft32_alloc(int length, int x, int y) state = (c64_fft_t *)celt_alloc(sizeof(c64_fft_t)); state->shift = log(length)/log(2) - ceil(log(length)/log(4)-1); state->nfft = length; - state->twiddle = celt_alloc(length*2*sizeof(celt_int32)); - state->itwiddle = celt_alloc(length*2*sizeof(celt_int32)); + state->twiddle = celt_alloc(length*2*sizeof(opus_int32)); + state->itwiddle = celt_alloc(length*2*sizeof(opus_int32)); // Generate the inverse twiddle first because it does not need scaling gen_twiddle32(state->itwiddle, length, 2147483647.000000000); @@ -239,22 +239,22 @@ void c64_fft32_free(c64_fft_t *state) } -void c64_fft16_inplace(c64_fft_t * restrict state, celt_int16 *X) +void c64_fft16_inplace(c64_fft_t * restrict state, opus_int16 *X) { int i; - VARDECL(celt_int16, cin); - VARDECL(celt_int16, cout); + VARDECL(opus_int16, cin); + VARDECL(opus_int16, cout); SAVE_STACK; - ALLOC(cin, state->nfft*2, celt_int16); - ALLOC(cout, state->nfft*2, celt_int16); + ALLOC(cin, state->nfft*2, opus_int16); + ALLOC(cout, state->nfft*2, opus_int16); for (i = 0; i < state->nfft; i++) { cin[2*i+0] = X[2*i+0]; cin[2*i+1] = X[2*i+1]; } - DSP_fft16x16t((celt_int16 *)state->twiddle, state->nfft, cin, cout); + DSP_fft16x16t((opus_int16 *)state->twiddle, state->nfft, cin, cout); for (i = 0; i < state->nfft; i++) { X[2*i+0] = cout[2*i+0]; @@ -266,12 +266,12 @@ void c64_fft16_inplace(c64_fft_t * restrict state, celt_int16 *X) -void c64_fft32(c64_fft_t * restrict state, const celt_int32 *X, celt_int32 *Y) +void c64_fft32(c64_fft_t * restrict state, const opus_int32 *X, opus_int32 *Y) { int i; - VARDECL(celt_int32, cin); + VARDECL(opus_int32, cin); SAVE_STACK; - ALLOC(cin, state->nfft*2, celt_int32); + ALLOC(cin, state->nfft*2, opus_int32); for (i = 0; i < state->nfft; i++) { cin[2*i+0] = X[2*i+0] >> state->shift; @@ -284,16 +284,16 @@ void c64_fft32(c64_fft_t * restrict state, const celt_int32 *X, celt_int32 *Y) } -void c64_ifft16(c64_fft_t * restrict state, const celt_int16 *X, celt_int16 *Y) +void c64_ifft16(c64_fft_t * restrict state, const opus_int16 *X, opus_int16 *Y) { int i; - VARDECL(celt_int16, cin); - VARDECL(celt_int16, cout); + VARDECL(opus_int16, cin); + VARDECL(opus_int16, cout); SAVE_STACK; - ALLOC(cin, state->nfft*2, celt_int16); - if ((celt_int32)Y & 7) - ALLOC(cout, state->nfft*2, celt_int16); + ALLOC(cin, state->nfft*2, opus_int16); + if ((opus_int32)Y & 7) + ALLOC(cout, state->nfft*2, opus_int16); else cout = Y; @@ -304,9 +304,9 @@ void c64_ifft16(c64_fft_t * restrict state, const celt_int16 *X, celt_int16 *Y) cin[2*i+1] = X[2*i+1]; } - DSP_fft16x16t((celt_int16 *)state->itwiddle, state->nfft, cin, cout); + DSP_fft16x16t((opus_int16 *)state->itwiddle, state->nfft, cin, cout); - if ((celt_int32)Y & 7) + if ((opus_int32)Y & 7) for (i = 0; i < state->nfft; i++) { Y[2*i+0] = cout[2*i+0]; Y[2*i+1] = cout[2*i+1]; @@ -316,12 +316,12 @@ void c64_ifft16(c64_fft_t * restrict state, const celt_int16 *X, celt_int16 *Y) } -void c64_ifft32(c64_fft_t * restrict state, const celt_int32 *X, celt_int32 *Y) +void c64_ifft32(c64_fft_t * restrict state, const opus_int32 *X, opus_int32 *Y) { int i; - VARDECL(celt_int32, cin); + VARDECL(opus_int32, cin); SAVE_STACK; - ALLOC(cin, state->nfft*2, celt_int32); + ALLOC(cin, state->nfft*2, opus_int32); celt_assert(Y & 7 == 0); diff --git a/libcelt/c64_fft.h b/libcelt/c64_fft.h index 3a224e0f0..61592a8cc 100644 --- a/libcelt/c64_fft.h +++ b/libcelt/c64_fft.h @@ -37,18 +37,18 @@ typedef struct { int nfft; int shift; - celt_int32 *twiddle; - celt_int32 *itwiddle; + opus_int32 *twiddle; + opus_int32 *itwiddle; } c64_fft_t; extern c64_fft_t *c64_fft16_alloc(int length, int x, int y); extern void c64_fft16_free(c64_fft_t *state); -extern void c64_fft16_inplace(c64_fft_t *state, celt_int16 *X); -extern void c64_ifft16(c64_fft_t *state, const celt_int16 *X, celt_int16 *Y); +extern void c64_fft16_inplace(c64_fft_t *state, opus_int16 *X); +extern void c64_ifft16(c64_fft_t *state, const opus_int16 *X, opus_int16 *Y); extern c64_fft_t *c64_fft32_alloc(int length, int x, int y); extern void c64_fft32_free(c64_fft_t *state); -extern void c64_fft32(c64_fft_t *state, const celt_int32 *X, celt_int32 *Y); -extern void c64_ifft32(c64_fft_t *state, const celt_int32 *X, celt_int32 *Y); +extern void c64_fft32(c64_fft_t *state, const opus_int32 *X, opus_int32 *Y); +extern void c64_ifft32(c64_fft_t *state, const opus_int32 *X, opus_int32 *Y); #endif diff --git a/libcelt/celt.c b/libcelt/celt.c index 84f79c3a3..bb1c93e23 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -93,7 +93,7 @@ static inline int fromOpus(unsigned char c) #define COMBFILTER_MAXPERIOD 1024 #define COMBFILTER_MINPERIOD 15 -static int resampling_factor(celt_int32 rate) +static int resampling_factor(opus_int32 rate) { int ret; switch (rate) @@ -135,7 +135,7 @@ struct CELTEncoder { int upsample; int start, end; - celt_int32 bitrate; + opus_int32 bitrate; int vbr; int signalling; int constrained_vbr; /* If zero, VBR can do whatever it likes with the rate */ @@ -144,7 +144,7 @@ struct CELTEncoder { /* Everything beyond this point gets cleared on a reset */ #define ENCODER_RESET_START rng - celt_uint32 rng; + opus_uint32 rng; int spread_decision; celt_word32 delayedIntra; int tonal_average; @@ -163,10 +163,10 @@ struct CELTEncoder { int consec_transient; /* VBR-related parameters */ - celt_int32 vbr_reservoir; - celt_int32 vbr_drift; - celt_int32 vbr_offset; - celt_int32 vbr_count; + opus_int32 vbr_reservoir; + opus_int32 vbr_drift; + opus_int32 vbr_offset; + opus_int32 vbr_count; celt_word32 preemph_memE[2]; celt_word32 preemph_memD[2]; @@ -283,12 +283,12 @@ void celt_encoder_destroy(CELTEncoder *st) celt_free(st); } -static inline celt_int16 FLOAT2INT16(float x) +static inline opus_int16 FLOAT2INT16(float x) { x = x*CELT_SIG_SCALE; x = MAX32(x, -32768); x = MIN32(x, 32767); - return (celt_int16)float2int(x); + return (opus_int16)float2int(x); } static inline celt_word16 SIG2WORD16(celt_sig x) @@ -718,8 +718,8 @@ static void tf_encode(int start, int end, int isTransient, int *tf_res, int LM, int tf_select_rsv; int tf_changed; int logp; - celt_uint32 budget; - celt_uint32 tell; + opus_uint32 budget; + opus_uint32 tell; budget = enc->storage*8; tell = ec_tell(enc); logp = isTransient ? 2 : 4; @@ -758,8 +758,8 @@ static void tf_decode(int start, int end, int isTransient, int *tf_res, int LM, int tf_select_rsv; int tf_changed; int logp; - celt_uint32 budget; - celt_uint32 tell; + opus_uint32 budget; + opus_uint32 tell; budget = dec->storage*8; tell = ec_tell(dec); @@ -837,7 +837,7 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X, c=0; do { for (i=0;i<end-1;i++) { - diff += bandLogE[i+c*m->nbEBands]*(celt_int32)(2+2*i-m->nbEBands); + diff += bandLogE[i+c*m->nbEBands]*(opus_int32)(2+2*i-m->nbEBands); } } while (++c<0); diff /= C*(end-1); @@ -891,7 +891,7 @@ static int stereo_analysis(const CELTMode *m, const celt_norm *X, #ifdef FIXED_POINT CELT_STATIC -int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) +int celt_encode_with_ec(CELTEncoder * restrict st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) { #else CELT_STATIC @@ -899,7 +899,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i { #endif int i, c, N; - celt_int32 bits; + opus_int32 bits; ec_enc _enc; VARDECL(celt_sig, in); VARDECL(celt_sig, freq); @@ -935,11 +935,11 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i int effectiveBytes; celt_word16 pf_threshold; int dynalloc_logp; - celt_int32 vbr_rate; - celt_int32 total_bits; - celt_int32 total_boost; - celt_int32 balance; - celt_int32 tell; + opus_int32 vbr_rate; + opus_int32 total_bits; + opus_int32 total_boost; + opus_int32 balance; + opus_int32 tell; int prefilter_tapset=0; int pf_on; int anti_collapse_rsv; @@ -998,13 +998,13 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i if (st->vbr) { - celt_int32 den=st->mode->Fs>>BITRES; + opus_int32 den=st->mode->Fs>>BITRES; vbr_rate=(st->bitrate*frame_size+(den>>1))/den; if (st->signalling) vbr_rate -= 8<<BITRES; effectiveBytes = vbr_rate>>(3+BITRES); } else { - celt_int32 tmp; + opus_int32 tmp; vbr_rate = 0; tmp = st->bitrate*frame_size; if (tell>1) @@ -1028,8 +1028,8 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i correctly if we don't have enough bits. */ if (st->constrained_vbr) { - celt_int32 vbr_bound; - celt_int32 max_allowed; + opus_int32 vbr_bound; + opus_int32 max_allowed; /* We could use any multiple of vbr_rate as bound (depending on the delay). This is clamped to ensure we use at least two bytes if the encoder @@ -1384,10 +1384,10 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i if (vbr_rate>0) { celt_word16 alpha; - celt_int32 delta; + opus_int32 delta; /* The target rate in 8th bits per frame */ - celt_int32 target; - celt_int32 min_allowed; + opus_int32 target; + opus_int32 min_allowed; target = vbr_rate + st->vbr_offset - ((40*C+20)<<BITRES); @@ -1443,7 +1443,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i /*printf ("%d\n", st->vbr_reservoir);*/ /* Compute the offset we need to apply in order to reach the target */ - st->vbr_drift += (celt_int32)MULT16_32_Q15(alpha,delta-st->vbr_offset-st->vbr_drift); + st->vbr_drift += (opus_int32)MULT16_32_Q15(alpha,delta-st->vbr_offset-st->vbr_drift); st->vbr_offset = -st->vbr_drift; /*printf ("%d\n", st->vbr_drift);*/ @@ -1496,7 +1496,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i ALLOC(fine_priority, st->mode->nbEBands, int); /* bits = packet size - where we are - safety*/ - bits = ((celt_int32)nbCompressedBytes*8<<BITRES) - ec_tell_frac(enc) - 1; + bits = ((opus_int32)nbCompressedBytes*8<<BITRES) - ec_tell_frac(enc) - 1; anti_collapse_rsv = isTransient&&LM>=2&&bits>=(LM+2<<BITRES) ? (1<<BITRES) : 0; bits -= anti_collapse_rsv; codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap, @@ -1671,7 +1671,7 @@ CELT_STATIC int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) { int j, ret, C, N; - VARDECL(celt_int16, in); + VARDECL(opus_int16, in); ALLOC_STACK; if (pcm==NULL) @@ -1679,7 +1679,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int C = CHANNELS(st->channels); N = frame_size; - ALLOC(in, C*N, celt_int16); + ALLOC(in, C*N, opus_int16); for (j=0;j<C*N;j++) in[j] = FLOAT2INT16(pcm[j]); @@ -1696,7 +1696,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int #endif /*DISABLE_FLOAT_API*/ #else CELT_STATIC -int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) +int celt_encode_with_ec(CELTEncoder * restrict st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) { int j, ret, C, N; VARDECL(celt_sig, in); @@ -1715,14 +1715,14 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int f ret = celt_encode_with_ec_float(st,in,frame_size,compressed,nbCompressedBytes, enc); #ifdef RESYNTH for (j=0;j<C*N;j++) - ((celt_int16*)pcm)[j] = FLOAT2INT16(in[j]); + ((opus_int16*)pcm)[j] = FLOAT2INT16(in[j]); #endif RESTORE_STACK; return ret; } #endif -int celt_encode(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes) +int celt_encode(CELTEncoder * restrict st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes) { return celt_encode_with_ec(st, pcm, frame_size, compressed, nbCompressedBytes, NULL); } @@ -1743,7 +1743,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) { case CELT_SET_COMPLEXITY_REQUEST: { - int value = va_arg(ap, celt_int32); + int value = va_arg(ap, opus_int32); if (value<0 || value>10) goto bad_arg; st->complexity = value; @@ -1751,7 +1751,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_START_BAND_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<0 || value>=st->mode->nbEBands) goto bad_arg; st->start = value; @@ -1759,7 +1759,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_END_BAND_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<1 || value>st->mode->nbEBands) goto bad_arg; st->end = value; @@ -1767,7 +1767,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_PREDICTION_REQUEST: { - int value = va_arg(ap, celt_int32); + int value = va_arg(ap, opus_int32); if (value<0 || value>2) goto bad_arg; st->disable_pf = value<=1; @@ -1776,7 +1776,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_LOSS_PERC_REQUEST: { - int value = va_arg(ap, celt_int32); + int value = va_arg(ap, opus_int32); if (value<0 || value>100) goto bad_arg; st->loss_rate = value; @@ -1784,19 +1784,19 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_VBR_CONSTRAINT_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); st->constrained_vbr = value; } break; case CELT_SET_VBR_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); st->vbr = value; } break; case CELT_SET_BITRATE_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<=500) goto bad_arg; value = IMIN(value, 260000*st->channels); @@ -1805,7 +1805,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_CHANNELS_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<1 || value>2) goto bad_arg; st->stream_channels = value; @@ -1824,14 +1824,14 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...) break; case CELT_SET_INPUT_CLIPPING_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); st->clip = value; } break; #ifdef OPUS_BUILD case CELT_SET_SIGNALLING_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); st->signalling = value; } break; @@ -1880,7 +1880,7 @@ struct CELTDecoder { /* Everything beyond this point gets cleared on a reset */ #define DECODER_RESET_START rng - celt_uint32 rng; + opus_uint32 rng; int error; int last_pitch_index; int loss_count; @@ -2030,7 +2030,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p VARDECL(celt_sig, freq); VARDECL(celt_norm, X); VARDECL(celt_ener, bandE); - celt_uint32 seed; + opus_uint32 seed; int effEnd; effEnd = st->end; @@ -2058,7 +2058,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p for (j=0;j<blen;j++) { seed = lcg_rand(seed); - X[boffs+j] = (celt_int32)(seed)>>20; + X[boffs+j] = (opus_int32)(seed)>>20; } renormalise_vector(X+boffs, blen, Q15ONE); } @@ -2244,7 +2244,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p #ifdef FIXED_POINT CELT_STATIC -int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm, int frame_size, ec_dec *dec) +int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, opus_int16 * restrict pcm, int frame_size, ec_dec *dec) { #else CELT_STATIC @@ -2253,7 +2253,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da #endif int c, i, N; int spread_decision; - celt_int32 bits; + opus_int32 bits; ec_dec _dec; VARDECL(celt_sig, freq); VARDECL(celt_norm, X); @@ -2284,9 +2284,9 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da celt_word16 postfilter_gain; int intensity=0; int dual_stereo=0; - celt_int32 total_bits; - celt_int32 balance; - celt_int32 tell; + opus_int32 total_bits; + opus_int32 balance; + opus_int32 tell; int dynalloc_logp; int postfilter_tapset; int anti_collapse_rsv; @@ -2485,7 +2485,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da alloc_trim = tell+(6<<BITRES) <= total_bits ? ec_dec_icdf(dec, trim_icdf, 7) : 5; - bits = ((celt_int32)len*8<<BITRES) - ec_tell_frac(dec) - 1; + bits = ((opus_int32)len*8<<BITRES) - ec_tell_frac(dec) - 1; anti_collapse_rsv = isTransient&&LM>=2&&bits>=(LM+2<<BITRES) ? (1<<BITRES) : 0; bits -= anti_collapse_rsv; codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap, @@ -2627,7 +2627,7 @@ CELT_STATIC int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *data, int len, float * restrict pcm, int frame_size, ec_dec *dec) { int j, ret, C, N; - VARDECL(celt_int16, out); + VARDECL(opus_int16, out); ALLOC_STACK; if (pcm==NULL) @@ -2636,7 +2636,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da C = CHANNELS(st->channels); N = frame_size; - ALLOC(out, C*N, celt_int16); + ALLOC(out, C*N, opus_int16); ret=celt_decode_with_ec(st, data, len, out, frame_size, dec); if (ret>0) for (j=0;j<C*ret;j++) @@ -2648,7 +2648,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da #endif /*DISABLE_FLOAT_API*/ #else CELT_STATIC -int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm, int frame_size, ec_dec *dec) +int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, opus_int16 * restrict pcm, int frame_size, ec_dec *dec) { int j, ret, C, N; VARDECL(celt_sig, out); @@ -2672,7 +2672,7 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in } #endif -int celt_decode(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm, int frame_size) +int celt_decode(CELTDecoder * restrict st, const unsigned char *data, int len, opus_int16 * restrict pcm, int frame_size) { return celt_decode_with_ec(st, data, len, pcm, frame_size, NULL); } @@ -2693,7 +2693,7 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) { case CELT_SET_START_BAND_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<0 || value>=st->mode->nbEBands) goto bad_arg; st->start = value; @@ -2701,7 +2701,7 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) break; case CELT_SET_END_BAND_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<1 || value>st->mode->nbEBands) goto bad_arg; st->end = value; @@ -2709,7 +2709,7 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) break; case CELT_SET_CHANNELS_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); if (value<1 || value>2) goto bad_arg; st->stream_channels = value; @@ -2750,7 +2750,7 @@ int celt_decoder_ctl(CELTDecoder * restrict st, int request, ...) break; case CELT_SET_SIGNALLING_REQUEST: { - celt_int32 value = va_arg(ap, celt_int32); + opus_int32 value = va_arg(ap, opus_int32); st->signalling = value; } break; diff --git a/libcelt/celt.h b/libcelt/celt.h index 7bb9350c4..0ebf3de8d 100644 --- a/libcelt/celt.h +++ b/libcelt/celt.h @@ -35,7 +35,7 @@ #ifndef CELT_H #define CELT_H -#include "celt_types.h" +#include "opus_types.h" #ifdef __cplusplus extern "C" { @@ -49,7 +49,7 @@ extern "C" { #define CELT_EXPORT #endif -#define _celt_check_int(x) (((void)((x) == (celt_int32)0)), (celt_int32)(x)) +#define _celt_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) #define _celt_check_mode_ptr_ptr(ptr) ((ptr) + ((ptr) - (const CELTMode**)(ptr))) #define _celt_check_int_ptr(ptr) ((ptr) + ((ptr) - (int*)(ptr))) @@ -157,7 +157,7 @@ typedef struct CELTMode CELTMode; @param error Returned error code (if NULL, no error will be returned) @return A newly created mode */ -CELT_EXPORT CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error); +CELT_EXPORT CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error); /** Destroys a mode struct. Only call this after all encoders and decoders using this mode are destroyed as well. @@ -233,7 +233,7 @@ CELT_EXPORT int celt_encode_float(CELTEncoder *st, const float *pcm, int frame_s * the length returned be somehow transmitted to the decoder. Otherwise, no * decoding is possible. */ -CELT_EXPORT int celt_encode(CELTEncoder *st, const celt_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); +CELT_EXPORT int celt_encode(CELTEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); /** Query and set encoder parameters @param st Encoder state @@ -298,7 +298,7 @@ CELT_EXPORT int celt_decode_float(CELTDecoder *st, const unsigned char *data, in returned here in 16-bit PCM format (native endian). @return Error code. */ -CELT_EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, celt_int16 *pcm, int frame_size); +CELT_EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size); /** Query and set decoder parameters @param st Decoder state diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c index 21d278f07..eda8eef71 100644 --- a/libcelt/cwrs.c +++ b/libcelt/cwrs.c @@ -42,7 +42,7 @@ with frac bits of fractional precision. Tested for all possible 32-bit inputs with frac=4, where the maximum overestimation is 0.06254243 bits.*/ -int log2_frac(celt_uint32 val, int frac) +int log2_frac(opus_uint32 val, int frac) { int l; l=EC_ILOG(val); @@ -75,7 +75,7 @@ int log2_frac(celt_uint32 val, int frac) #define MASK32 (0xFFFFFFFF) /*INV_TABLE[i] holds the multiplicative inverse of (2*i+1) mod 2**32.*/ -static const celt_uint32 INV_TABLE[64]={ +static const opus_uint32 INV_TABLE[64]={ 0x00000001,0xAAAAAAAB,0xCCCCCCCD,0xB6DB6DB7, 0x38E38E39,0xBA2E8BA3,0xC4EC4EC5,0xEEEEEEEF, 0xF0F0F0F1,0x286BCA1B,0x3CF3CF3D,0xE9BD37A7, @@ -115,8 +115,8 @@ static const celt_uint32 INV_TABLE[64]={ _a, _b, _c, and _d may be arbitrary so long as the arbitrary precision result fits in 32 bits, but currently the table for multiplicative inverses is only valid for _d<128.*/ -static inline celt_uint32 imusdiv32odd(celt_uint32 _a,celt_uint32 _b, - celt_uint32 _c,int _d){ +static inline opus_uint32 imusdiv32odd(opus_uint32 _a,opus_uint32 _b, + opus_uint32 _c,int _d){ return (_a*_b-_c)*INV_TABLE[_d]&MASK32; } @@ -127,9 +127,9 @@ static inline celt_uint32 imusdiv32odd(celt_uint32 _a,celt_uint32 _b, table for multiplicative inverses is only valid for _d<=256). _b and _c may be arbitrary so long as the arbitrary precision reuslt fits in 32 bits.*/ -static inline celt_uint32 imusdiv32even(celt_uint32 _a,celt_uint32 _b, - celt_uint32 _c,int _d){ - celt_uint32 inv; +static inline opus_uint32 imusdiv32even(opus_uint32 _a,opus_uint32 _b, + opus_uint32 _c,int _d){ + opus_uint32 inv; int mask; int shift; int one; @@ -284,39 +284,39 @@ static inline unsigned ucwrs2(unsigned _k){ } /*Compute V(2,_k).*/ -static inline celt_uint32 ncwrs2(int _k){ - return _k?4*(celt_uint32)_k:1; +static inline opus_uint32 ncwrs2(int _k){ + return _k?4*(opus_uint32)_k:1; } /*Compute U(3,_k). Note that this may be called with _k=32768 (maxK[3]+1).*/ -static inline celt_uint32 ucwrs3(unsigned _k){ - return _k?(2*(celt_uint32)_k-2)*_k+1:0; +static inline opus_uint32 ucwrs3(unsigned _k){ + return _k?(2*(opus_uint32)_k-2)*_k+1:0; } /*Compute V(3,_k).*/ -static inline celt_uint32 ncwrs3(int _k){ - return _k?2*(2*(unsigned)_k*(celt_uint32)_k+1):1; +static inline opus_uint32 ncwrs3(int _k){ + return _k?2*(2*(unsigned)_k*(opus_uint32)_k+1):1; } /*Compute U(4,_k).*/ -static inline celt_uint32 ucwrs4(int _k){ - return _k?imusdiv32odd(2*_k,(2*_k-3)*(celt_uint32)_k+4,3,1):0; +static inline opus_uint32 ucwrs4(int _k){ + return _k?imusdiv32odd(2*_k,(2*_k-3)*(opus_uint32)_k+4,3,1):0; } /*Compute V(4,_k).*/ -static inline celt_uint32 ncwrs4(int _k){ - return _k?((_k*(celt_uint32)_k+2)*_k)/3<<3:1; +static inline opus_uint32 ncwrs4(int _k){ + return _k?((_k*(opus_uint32)_k+2)*_k)/3<<3:1; } /*Compute U(5,_k).*/ -static inline celt_uint32 ucwrs5(int _k){ - return _k?(((((_k-2)*(unsigned)_k+5)*(celt_uint32)_k-4)*_k)/3<<1)+1:0; +static inline opus_uint32 ucwrs5(int _k){ + return _k?(((((_k-2)*(unsigned)_k+5)*(opus_uint32)_k-4)*_k)/3<<1)+1:0; } /*Compute V(5,_k).*/ -static inline celt_uint32 ncwrs5(int _k){ - return _k?(((_k*(unsigned)_k+5)*(celt_uint32)_k*_k)/3<<2)+2:1; +static inline opus_uint32 ncwrs5(int _k){ + return _k?(((_k*(unsigned)_k+5)*(opus_uint32)_k*_k)/3<<2)+2:1; } #endif /* SMALL_FOOTPRINT */ @@ -324,8 +324,8 @@ static inline celt_uint32 ncwrs5(int _k){ /*Computes the next row/column of any recurrence that obeys the relation u[i][j]=u[i-1][j]+u[i][j-1]+u[i-1][j-1]. _ui0 is the base case for the new row/column.*/ -static inline void unext(celt_uint32 *_ui,unsigned _len,celt_uint32 _ui0){ - celt_uint32 ui1; +static inline void unext(opus_uint32 *_ui,unsigned _len,opus_uint32 _ui0){ + opus_uint32 ui1; unsigned j; /*This do-while will overrun the array if we don't have storage for at least 2 values.*/ @@ -340,8 +340,8 @@ static inline void unext(celt_uint32 *_ui,unsigned _len,celt_uint32 _ui0){ /*Computes the previous row/column of any recurrence that obeys the relation u[i-1][j]=u[i][j]-u[i][j-1]-u[i-1][j-1]. _ui0 is the base case for the new row/column.*/ -static inline void uprev(celt_uint32 *_ui,unsigned _n,celt_uint32 _ui0){ - celt_uint32 ui1; +static inline void uprev(opus_uint32 *_ui,unsigned _n,opus_uint32 _ui0){ + opus_uint32 ui1; unsigned j; /*This do-while will overrun the array if we don't have storage for at least 2 values.*/ @@ -355,8 +355,8 @@ static inline void uprev(celt_uint32 *_ui,unsigned _n,celt_uint32 _ui0){ /*Compute V(_n,_k), as well as U(_n,0..._k+1). _u: On exit, _u[i] contains U(_n,i) for i in [0..._k+1].*/ -static celt_uint32 ncwrs_urow(unsigned _n,unsigned _k,celt_uint32 *_u){ - celt_uint32 um2; +static opus_uint32 ncwrs_urow(unsigned _n,unsigned _k,opus_uint32 *_u){ + opus_uint32 um2; unsigned len; unsigned k; len=_k+2; @@ -380,8 +380,8 @@ static celt_uint32 ncwrs_urow(unsigned _n,unsigned _k,celt_uint32 *_u){ } #ifndef SMALL_FOOTPRINT else{ - celt_uint32 um1; - celt_uint32 n2m1; + opus_uint32 um1; + opus_uint32 n2m1; _u[2]=n2m1=um1=(_n<<1)-1; for(k=3;k<len;k++){ /*U(N,K) = ((2*N-1)*U(N,K-1)-U(N,K-2))/(K-1) + U(N,K-2)*/ @@ -397,7 +397,7 @@ static celt_uint32 ncwrs_urow(unsigned _n,unsigned _k,celt_uint32 *_u){ /*Returns the _i'th combination of _k elements (at most 32767) chosen from a set of size 1 with associated sign bits. _y: Returns the vector of pulses.*/ -static inline void cwrsi1(int _k,celt_uint32 _i,int *_y){ +static inline void cwrsi1(int _k,opus_uint32 _i,int *_y){ int s; s=-(int)_i; _y[0]=_k+s^s; @@ -408,8 +408,8 @@ static inline void cwrsi1(int _k,celt_uint32 _i,int *_y){ /*Returns the _i'th combination of _k elements (at most 32767) chosen from a set of size 2 with associated sign bits. _y: Returns the vector of pulses.*/ -static inline void cwrsi2(int _k,celt_uint32 _i,int *_y){ - celt_uint32 p; +static inline void cwrsi2(int _k,opus_uint32 _i,int *_y){ + opus_uint32 p; int s; int yj; p=ucwrs2(_k+1U); @@ -427,8 +427,8 @@ static inline void cwrsi2(int _k,celt_uint32 _i,int *_y){ /*Returns the _i'th combination of _k elements (at most 32767) chosen from a set of size 3 with associated sign bits. _y: Returns the vector of pulses.*/ -static void cwrsi3(int _k,celt_uint32 _i,int *_y){ - celt_uint32 p; +static void cwrsi3(int _k,opus_uint32 _i,int *_y){ + opus_uint32 p; int s; int yj; p=ucwrs3(_k+1U); @@ -448,8 +448,8 @@ static void cwrsi3(int _k,celt_uint32 _i,int *_y){ /*Returns the _i'th combination of _k elements (at most 1172) chosen from a set of size 4 with associated sign bits. _y: Returns the vector of pulses.*/ -static void cwrsi4(int _k,celt_uint32 _i,int *_y){ - celt_uint32 p; +static void cwrsi4(int _k,opus_uint32 _i,int *_y){ + opus_uint32 p; int s; int yj; int kl; @@ -482,8 +482,8 @@ static void cwrsi4(int _k,celt_uint32 _i,int *_y){ /*Returns the _i'th combination of _k elements (at most 238) chosen from a set of size 5 with associated sign bits. _y: Returns the vector of pulses.*/ -static void cwrsi5(int _k,celt_uint32 _i,int *_y){ - celt_uint32 p; +static void cwrsi5(int _k,opus_uint32 _i,int *_y){ + opus_uint32 p; int s; int yj; p=ucwrs5(_k+1); @@ -517,12 +517,12 @@ static void cwrsi5(int _k,celt_uint32 _i,int *_y){ _y: Returns the vector of pulses. _u: Must contain entries [0..._k+1] of row _n of U() on input. Its contents will be destructively modified.*/ -static void cwrsi(int _n,int _k,celt_uint32 _i,int *_y,celt_uint32 *_u){ +static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y,opus_uint32 *_u){ int j; celt_assert(_n>0); j=0; do{ - celt_uint32 p; + opus_uint32 p; int s; int yj; p=_u[_k+1]; @@ -544,7 +544,7 @@ static void cwrsi(int _n,int _k,celt_uint32 _i,int *_y,celt_uint32 *_u){ of size 1 with associated sign bits. _y: The vector of pulses, whose sum of absolute values is K. _k: Returns K.*/ -static inline celt_uint32 icwrs1(const int *_y,int *_k){ +static inline opus_uint32 icwrs1(const int *_y,int *_k){ *_k=abs(_y[0]); return _y[0]<0; } @@ -555,8 +555,8 @@ static inline celt_uint32 icwrs1(const int *_y,int *_k){ of size 2 with associated sign bits. _y: The vector of pulses, whose sum of absolute values is K. _k: Returns K.*/ -static inline celt_uint32 icwrs2(const int *_y,int *_k){ - celt_uint32 i; +static inline opus_uint32 icwrs2(const int *_y,int *_k){ + opus_uint32 i; int k; i=icwrs1(_y+1,&k); i+=ucwrs2(k); @@ -570,8 +570,8 @@ static inline celt_uint32 icwrs2(const int *_y,int *_k){ of size 3 with associated sign bits. _y: The vector of pulses, whose sum of absolute values is K. _k: Returns K.*/ -static inline celt_uint32 icwrs3(const int *_y,int *_k){ - celt_uint32 i; +static inline opus_uint32 icwrs3(const int *_y,int *_k){ + opus_uint32 i; int k; i=icwrs2(_y+1,&k); i+=ucwrs3(k); @@ -585,8 +585,8 @@ static inline celt_uint32 icwrs3(const int *_y,int *_k){ of size 4 with associated sign bits. _y: The vector of pulses, whose sum of absolute values is K. _k: Returns K.*/ -static inline celt_uint32 icwrs4(const int *_y,int *_k){ - celt_uint32 i; +static inline opus_uint32 icwrs4(const int *_y,int *_k){ + opus_uint32 i; int k; i=icwrs3(_y+1,&k); i+=ucwrs4(k); @@ -600,8 +600,8 @@ static inline celt_uint32 icwrs4(const int *_y,int *_k){ of size 5 with associated sign bits. _y: The vector of pulses, whose sum of absolute values is K. _k: Returns K.*/ -static inline celt_uint32 icwrs5(const int *_y,int *_k){ - celt_uint32 i; +static inline opus_uint32 icwrs5(const int *_y,int *_k){ + opus_uint32 i; int k; i=icwrs4(_y+1,&k); i+=ucwrs5(k); @@ -616,9 +616,9 @@ static inline celt_uint32 icwrs5(const int *_y,int *_k){ of size _n with associated sign bits. _y: The vector of pulses, whose sum of absolute values must be _k. _nc: Returns V(_n,_k).*/ -celt_uint32 icwrs(int _n,int _k,celt_uint32 *_nc,const int *_y, - celt_uint32 *_u){ - celt_uint32 i; +opus_uint32 icwrs(int _n,int _k,opus_uint32 *_nc,const int *_y, + opus_uint32 *_u){ + opus_uint32 i; int j; int k; /*We can't unroll the first two iterations of the loop unless _n>=2.*/ @@ -641,7 +641,7 @@ celt_uint32 icwrs(int _n,int _k,celt_uint32 *_nc,const int *_y, } #ifdef CUSTOM_MODES -void get_required_bits(celt_int16 *_bits,int _n,int _maxk,int _frac){ +void get_required_bits(opus_int16 *_bits,int _n,int _maxk,int _frac){ int k; /*_maxk==0 => there's nothing to do.*/ celt_assert(_maxk>0); @@ -652,9 +652,9 @@ void get_required_bits(celt_int16 *_bits,int _n,int _maxk,int _frac){ _bits[k] = 1<<_frac; } else { - VARDECL(celt_uint32,u); + VARDECL(opus_uint32,u); SAVE_STACK; - ALLOC(u,_maxk+2U,celt_uint32); + ALLOC(u,_maxk+2U,opus_uint32); ncwrs_urow(_n,_maxk,u); for(k=1;k<=_maxk;k++) _bits[k]=log2_frac(u[k]+u[k+1],_frac); @@ -664,7 +664,7 @@ void get_required_bits(celt_int16 *_bits,int _n,int _maxk,int _frac){ #endif /* CUSTOM_MODES */ void encode_pulses(const int *_y,int _n,int _k,ec_enc *_enc){ - celt_uint32 i; + opus_uint32 i; if (_k==0) return; switch(_n){ @@ -693,10 +693,10 @@ void encode_pulses(const int *_y,int _n,int _k,ec_enc *_enc){ #endif default: { - VARDECL(celt_uint32,u); - celt_uint32 nc; + VARDECL(opus_uint32,u); + opus_uint32 nc; SAVE_STACK; - ALLOC(u,_k+2U,celt_uint32); + ALLOC(u,_k+2U,opus_uint32); i=icwrs(_n,_k,&nc,_y,u); ec_enc_uint(_enc,i,nc); RESTORE_STACK; @@ -725,9 +725,9 @@ void decode_pulses(int *_y,int _n,int _k,ec_dec *_dec) #endif default: { - VARDECL(celt_uint32,u); + VARDECL(opus_uint32,u); SAVE_STACK; - ALLOC(u,_k+2U,celt_uint32); + ALLOC(u,_k+2U,opus_uint32); cwrsi(_n,_k,ec_dec_uint(_dec,ncwrs_urow(_n,_k,u)),_y,u); RESTORE_STACK; } diff --git a/libcelt/cwrs.h b/libcelt/cwrs.h index 443213f67..24e37580a 100644 --- a/libcelt/cwrs.h +++ b/libcelt/cwrs.h @@ -35,9 +35,9 @@ #include "entenc.h" #include "entdec.h" -int log2_frac(celt_uint32 val, int frac); +int log2_frac(opus_uint32 val, int frac); -void get_required_bits(celt_int16 *bits, int N, int K, int frac); +void get_required_bits(opus_int16 *bits, int N, int K, int frac); void encode_pulses(const int *_y, int N, int K, ec_enc *enc); diff --git a/libcelt/dump_modes.c b/libcelt/dump_modes.c index 486a10b8c..39b3b6898 100644 --- a/libcelt/dump_modes.c +++ b/libcelt/dump_modes.c @@ -66,14 +66,14 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) int standard, framerate; mdctSize = mode->shortMdctSize*mode->nbShortMdcts; - standard = (mode->Fs == 400*(celt_int32)mode->shortMdctSize); + standard = (mode->Fs == 400*(opus_int32)mode->shortMdctSize); framerate = mode->Fs/mode->shortMdctSize; if (!standard) { fprintf(file, "#ifndef DEF_EBANDS%d_%d\n", mode->Fs, mdctSize); fprintf(file, "#define DEF_EBANDS%d_%d\n", mode->Fs, mdctSize); - fprintf (file, "static const celt_int16 eBands%d_%d[%d] = {\n", mode->Fs, mdctSize, mode->nbEBands+2); + fprintf (file, "static const opus_int16 eBands%d_%d[%d] = {\n", mode->Fs, mdctSize, mode->nbEBands+2); for (j=0;j<mode->nbEBands+2;j++) fprintf (file, "%d, ", mode->eBands[j]); fprintf (file, "};\n"); @@ -108,7 +108,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) fprintf(file, "#ifndef DEF_LOGN%d\n", framerate); fprintf(file, "#define DEF_LOGN%d\n", framerate); - fprintf (file, "static const celt_int16 logN%d[%d] = {\n", framerate, mode->nbEBands); + fprintf (file, "static const opus_int16 logN%d[%d] = {\n", framerate, mode->nbEBands); for (j=0;j<mode->nbEBands;j++) fprintf (file, "%d, ", mode->logN[j]); fprintf (file, "};\n"); @@ -118,7 +118,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) /* Pulse cache */ fprintf(file, "#ifndef DEF_PULSE_CACHE%d\n", mode->Fs/mdctSize); fprintf(file, "#define DEF_PULSE_CACHE%d\n", mode->Fs/mdctSize); - fprintf (file, "static const celt_int16 cache_index%d[%d] = {\n", mode->Fs/mdctSize, (mode->maxLM+2)*mode->nbEBands); + fprintf (file, "static const opus_int16 cache_index%d[%d] = {\n", mode->Fs/mdctSize, (mode->maxLM+2)*mode->nbEBands); for (j=0;j<mode->nbEBands*(mode->maxLM+2);j++) fprintf (file, "%d, ", mode->cache.index[j]); fprintf (file, "};\n"); @@ -148,7 +148,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes) { fprintf(file, "#ifndef FFT_BITREV%d\n", mode->mdct.kfft[k]->nfft); fprintf(file, "#define FFT_BITREV%d\n", mode->mdct.kfft[k]->nfft); - fprintf (file, "static const celt_int16 fft_bitrev%d[%d] = {\n", + fprintf (file, "static const opus_int16 fft_bitrev%d[%d] = {\n", mode->mdct.kfft[k]->nfft, mode->mdct.kfft[k]->nfft); for (j=0;j<mode->mdct.kfft[k]->nfft;j++) fprintf (file, "%d, ", mode->mdct.kfft[k]->bitrev[j]); diff --git a/libcelt/ecintrin.h b/libcelt/ecintrin.h index 5012917c9..3a502c7c8 100644 --- a/libcelt/ecintrin.h +++ b/libcelt/ecintrin.h @@ -26,7 +26,7 @@ */ /*Some common macros for potential platform-specific optimization.*/ -#include "celt_types.h" +#include "opus_types.h" #include <math.h> #include <limits.h> #if !defined(_ecintrin_H) @@ -115,7 +115,7 @@ static __inline int ec_bsr(unsigned long _x){ When we need to, it can be special cased.*/ # define EC_ILOG(_x) (EC_CLZ0-EC_CLZ(_x)) #else -int ec_ilog(celt_uint32 _v); +int ec_ilog(opus_uint32 _v); # define EC_ILOG(_x) (ec_ilog(_x)) #endif diff --git a/libcelt/entcode.c b/libcelt/entcode.c index 27cac4bfe..e6a6a3ccc 100644 --- a/libcelt/entcode.c +++ b/libcelt/entcode.c @@ -35,7 +35,7 @@ #if !defined(EC_CLZ) -int ec_ilog(celt_uint32 _v){ +int ec_ilog(opus_uint32 _v){ /*On a Pentium M, this branchless version tested as the fastest on 1,000,000,000 random 32-bit integers, edging out a similar version with branches, and a 256-entry LUT version.*/ @@ -60,9 +60,9 @@ int ec_ilog(celt_uint32 _v){ #endif -celt_uint32 ec_tell_frac(ec_ctx *_this){ - celt_uint32 nbits; - celt_uint32 r; +opus_uint32 ec_tell_frac(ec_ctx *_this){ + opus_uint32 nbits; + opus_uint32 r; int l; int i; /*To handle the non-integral number of bits still left in the encoder/decoder diff --git a/libcelt/entcode.h b/libcelt/entcode.h index f24e1c4fa..0da95b7e7 100644 --- a/libcelt/entcode.h +++ b/libcelt/entcode.h @@ -25,7 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "celt_types.h" +#include "opus_types.h" #if !defined(_entcode_H) # define _entcode_H (1) @@ -37,7 +37,7 @@ /*OPT: ec_window must be at least 32 bits, but if you have fast arithmetic on a larger type, you can speed up the decoder by using it here.*/ -typedef celt_uint32 ec_window; +typedef opus_uint32 ec_window; typedef struct ec_ctx ec_ctx; typedef struct ec_ctx ec_enc; typedef struct ec_ctx ec_dec; @@ -62,9 +62,9 @@ struct ec_ctx{ /*Buffered input/output.*/ unsigned char *buf; /*The size of the buffer.*/ - celt_uint32 storage; + opus_uint32 storage; /*The offset at which the last byte containing raw bits was read/written.*/ - celt_uint32 end_offs; + opus_uint32 end_offs; /*Bits that will be read from/written at the end.*/ ec_window end_window; /*Number of valid bits in end_window.*/ @@ -73,16 +73,16 @@ struct ec_ctx{ This does not include partial bits currently in the range coder.*/ int nbits_total; /*The offset at which the next range coder byte will be read/written.*/ - celt_uint32 offs; + opus_uint32 offs; /*The number of values in the current range.*/ - celt_uint32 rng; + opus_uint32 rng; /*In the decoder: the difference between the top of the current range and the input value, minus one. In the encoder: the low end of the current range.*/ - celt_uint32 val; + opus_uint32 val; /*In the decoder: the saved normalization factor from ec_decode(). In the encoder: the number of oustanding carry propagating symbols.*/ - celt_uint32 ext; + opus_uint32 ext; /*A buffered input/output symbol, awaiting carry propagation.*/ int rem; /*Nonzero if an error occurred.*/ @@ -95,7 +95,7 @@ static inline void ec_reset(ec_ctx *_this){ _this->offs=_this->end_offs=0; } -static inline celt_uint32 ec_range_bytes(ec_ctx *_this){ +static inline opus_uint32 ec_range_bytes(ec_ctx *_this){ return _this->offs; } @@ -123,6 +123,6 @@ static inline int ec_tell(ec_ctx *_this){ Return: The number of bits scaled by 2**BITRES. This will always be slightly larger than the exact value (e.g., all rounding error is in the positive direction).*/ -celt_uint32 ec_tell_frac(ec_ctx *_this); +opus_uint32 ec_tell_frac(ec_ctx *_this); #endif diff --git a/libcelt/entdec.c b/libcelt/entdec.c index 8b4d2ee15..83203df80 100644 --- a/libcelt/entdec.c +++ b/libcelt/entdec.c @@ -125,7 +125,7 @@ static void ec_dec_normalize(ec_dec *_this){ } } -void ec_dec_init(ec_dec *_this,unsigned char *_buf,celt_uint32 _storage){ +void ec_dec_init(ec_dec *_this,unsigned char *_buf,opus_uint32 _storage){ _this->buf=_buf; _this->storage=_storage; _this->end_offs=0; @@ -160,7 +160,7 @@ unsigned ec_decode_bin(ec_dec *_this,unsigned _bits){ } void ec_dec_update(ec_dec *_this,unsigned _fl,unsigned _fh,unsigned _ft){ - celt_uint32 s; + opus_uint32 s; s=IMUL32(_this->ext,_ft-_fh); _this->val-=s; _this->rng=_fl>0?IMUL32(_this->ext,_fh-_fl):_this->rng-s; @@ -169,9 +169,9 @@ void ec_dec_update(ec_dec *_this,unsigned _fl,unsigned _fh,unsigned _ft){ /*The probability of having a "one" is 1/(1<<_logp).*/ int ec_dec_bit_logp(ec_dec *_this,unsigned _logp){ - celt_uint32 r; - celt_uint32 d; - celt_uint32 s; + opus_uint32 r; + opus_uint32 d; + opus_uint32 s; int ret; r=_this->rng; d=_this->val; @@ -184,10 +184,10 @@ int ec_dec_bit_logp(ec_dec *_this,unsigned _logp){ } int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb){ - celt_uint32 r; - celt_uint32 d; - celt_uint32 s; - celt_uint32 t; + opus_uint32 r; + opus_uint32 d; + opus_uint32 s; + opus_uint32 t; int ret; s=_this->rng; d=_this->val; @@ -204,7 +204,7 @@ int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb){ return ret; } -celt_uint32 ec_dec_uint(ec_dec *_this,celt_uint32 _ft){ +opus_uint32 ec_dec_uint(ec_dec *_this,opus_uint32 _ft){ unsigned ft; unsigned s; int ftb; @@ -213,12 +213,12 @@ celt_uint32 ec_dec_uint(ec_dec *_this,celt_uint32 _ft){ _ft--; ftb=EC_ILOG(_ft); if(ftb>EC_UINT_BITS){ - celt_uint32 t; + opus_uint32 t; ftb-=EC_UINT_BITS; ft=(unsigned)(_ft>>ftb)+1; s=ec_decode(_this,ft); ec_dec_update(_this,s,s+1,ft); - t=(celt_uint32)s<<ftb|ec_dec_bits(_this,ftb); + t=(opus_uint32)s<<ftb|ec_dec_bits(_this,ftb); if(t<=_ft)return t; _this->error=1; return _ft; @@ -231,10 +231,10 @@ celt_uint32 ec_dec_uint(ec_dec *_this,celt_uint32 _ft){ } } -celt_uint32 ec_dec_bits(ec_dec *_this,unsigned _bits){ +opus_uint32 ec_dec_bits(ec_dec *_this,unsigned _bits){ ec_window window; int available; - celt_uint32 ret; + opus_uint32 ret; window=_this->end_window; available=_this->nend_bits; if(available<_bits){ @@ -244,7 +244,7 @@ celt_uint32 ec_dec_bits(ec_dec *_this,unsigned _bits){ } while(available<=EC_WINDOW_SIZE-EC_SYM_BITS); } - ret=(celt_uint32)window&((celt_uint32)1<<_bits)-1; + ret=(opus_uint32)window&((opus_uint32)1<<_bits)-1; window>>=_bits; available-=_bits; _this->end_window=window; diff --git a/libcelt/entdec.h b/libcelt/entdec.h index 593979b17..dfe694d88 100644 --- a/libcelt/entdec.h +++ b/libcelt/entdec.h @@ -35,7 +35,7 @@ /*Initializes the decoder. _buf: The input buffer to use. Return: 0 on success, or a negative value on error.*/ -void ec_dec_init(ec_dec *_this,unsigned char *_buf,celt_uint32 _storage); +void ec_dec_init(ec_dec *_this,unsigned char *_buf,opus_uint32 _storage); /*Calculates the cumulative frequency for the next symbol. This can then be fed into the probability model to determine what that @@ -89,7 +89,7 @@ int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb); _ft: The number of integers that can be decoded (one more than the max). This must be at least one, and no more than 2**32-1. Return: The decoded bits.*/ -celt_uint32 ec_dec_uint(ec_dec *_this,celt_uint32 _ft); +opus_uint32 ec_dec_uint(ec_dec *_this,opus_uint32 _ft); /*Extracts a sequence of raw bits from the stream. The bits must have been encoded with ec_enc_bits(). @@ -97,6 +97,6 @@ celt_uint32 ec_dec_uint(ec_dec *_this,celt_uint32 _ft); _ftb: The number of bits to extract. This must be between 0 and 25, inclusive. Return: The decoded bits.*/ -celt_uint32 ec_dec_bits(ec_dec *_this,unsigned _ftb); +opus_uint32 ec_dec_bits(ec_dec *_this,unsigned _ftb); #endif diff --git a/libcelt/entenc.c b/libcelt/entenc.c index df649a6d5..cae1afa85 100644 --- a/libcelt/entenc.c +++ b/libcelt/entenc.c @@ -114,7 +114,7 @@ static void ec_enc_normalize(ec_enc *_this){ } } -void ec_enc_init(ec_enc *_this,unsigned char *_buf,celt_uint32 _size){ +void ec_enc_init(ec_enc *_this,unsigned char *_buf,opus_uint32 _size){ _this->buf=_buf; _this->end_offs=0; _this->end_window=0; @@ -131,7 +131,7 @@ void ec_enc_init(ec_enc *_this,unsigned char *_buf,celt_uint32 _size){ } void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft){ - celt_uint32 r; + opus_uint32 r; r=_this->rng/_ft; if(_fl>0){ _this->val+=_this->rng-IMUL32(r,(_ft-_fl)); @@ -142,7 +142,7 @@ void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft){ } void ec_encode_bin(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _bits){ - celt_uint32 r; + opus_uint32 r; r=_this->rng>>_bits; if(_fl>0){ _this->val+=_this->rng-IMUL32(r,((1<<_bits)-_fl)); @@ -154,9 +154,9 @@ void ec_encode_bin(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _bits){ /*The probability of having a "one" is 1/(1<<_logp).*/ void ec_enc_bit_logp(ec_enc *_this,int _val,unsigned _logp){ - celt_uint32 r; - celt_uint32 s; - celt_uint32 l; + opus_uint32 r; + opus_uint32 s; + opus_uint32 l; r=_this->rng; l=_this->val; s=r>>_logp; @@ -167,7 +167,7 @@ void ec_enc_bit_logp(ec_enc *_this,int _val,unsigned _logp){ } void ec_enc_icdf(ec_enc *_this,int _s,const unsigned char *_icdf,unsigned _ftb){ - celt_uint32 r; + opus_uint32 r; r=_this->rng>>_ftb; if(_s>0){ _this->val+=_this->rng-IMUL32(r,_icdf[_s-1]); @@ -177,7 +177,7 @@ void ec_enc_icdf(ec_enc *_this,int _s,const unsigned char *_icdf,unsigned _ftb){ ec_enc_normalize(_this); } -void ec_enc_uint(ec_enc *_this,celt_uint32 _fl,celt_uint32 _ft){ +void ec_enc_uint(ec_enc *_this,opus_uint32 _fl,opus_uint32 _ft){ unsigned ft; unsigned fl; int ftb; @@ -190,12 +190,12 @@ void ec_enc_uint(ec_enc *_this,celt_uint32 _fl,celt_uint32 _ft){ ft=(_ft>>ftb)+1; fl=(unsigned)(_fl>>ftb); ec_encode(_this,fl,fl+1,ft); - ec_enc_bits(_this,_fl&((celt_uint32)1<<ftb)-1,ftb); + ec_enc_bits(_this,_fl&((opus_uint32)1<<ftb)-1,ftb); } else ec_encode(_this,_fl,_fl+1,_ft+1); } -void ec_enc_bits(ec_enc *_this,celt_uint32 _fl,unsigned _bits){ +void ec_enc_bits(ec_enc *_this,opus_uint32 _fl,unsigned _bits){ ec_window window; int used; window=_this->end_window; @@ -231,14 +231,14 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits){ } else if(_this->rng<=EC_CODE_TOP>>shift){ /*The renormalization loop has never been run.*/ - _this->val=_this->val&~((celt_uint32)mask<<EC_CODE_SHIFT)| - (celt_uint32)_val<<EC_CODE_SHIFT+shift; + _this->val=_this->val&~((opus_uint32)mask<<EC_CODE_SHIFT)| + (opus_uint32)_val<<EC_CODE_SHIFT+shift; } /*The encoder hasn't even encoded _nbits of data yet.*/ else _this->error=-1; } -void ec_enc_shrink(ec_enc *_this,celt_uint32 _size){ +void ec_enc_shrink(ec_enc *_this,opus_uint32 _size){ celt_assert(_this->offs+_this->end_offs<=_size); CELT_MOVE(_this->buf+_size-_this->end_offs, _this->buf+_this->storage-_this->end_offs,_this->end_offs); @@ -248,8 +248,8 @@ void ec_enc_shrink(ec_enc *_this,celt_uint32 _size){ void ec_enc_done(ec_enc *_this){ ec_window window; int used; - celt_uint32 msk; - celt_uint32 end; + opus_uint32 msk; + opus_uint32 end; int l; /*We output the minimum number of bits that ensures that the symbols encoded thus far will be decoded correctly regardless of the bits that follow.*/ diff --git a/libcelt/entenc.h b/libcelt/entenc.h index 7e306171b..bc6088254 100644 --- a/libcelt/entenc.h +++ b/libcelt/entenc.h @@ -35,7 +35,7 @@ /*Initializes the encoder. _buf: The buffer to store output bytes in. _size: The size of the buffer, in chars.*/ -void ec_enc_init(ec_enc *_this,unsigned char *_buf,celt_uint32 _size); +void ec_enc_init(ec_enc *_this,unsigned char *_buf,opus_uint32 _size); /*Encodes a symbol given its frequency information. The frequency information must be discernable by the decoder, assuming it has read only the previous symbols from the stream. @@ -70,13 +70,13 @@ void ec_enc_icdf(ec_enc *_this,int _s,const unsigned char *_icdf,unsigned _ftb); _fl: The integer to encode. _ft: The number of integers that can be encoded (one more than the max). This must be at least one, and no more than 2**32-1.*/ -void ec_enc_uint(ec_enc *_this,celt_uint32 _fl,celt_uint32 _ft); +void ec_enc_uint(ec_enc *_this,opus_uint32 _fl,opus_uint32 _ft); /*Encodes a sequence of raw bits in the stream. _fl: The bits to encode. _ftb: The number of bits to encode. This must be between 0 and 25, inclusive.*/ -void ec_enc_bits(ec_enc *_this,celt_uint32 _fl,unsigned _ftb); +void ec_enc_bits(ec_enc *_this,opus_uint32 _fl,unsigned _ftb); /*Overwrites a few bits at the very start of an existing stream, after they have already been encoded. @@ -102,7 +102,7 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits); _size: The number of bytes in the new buffer. This must be large enough to contain the bits already written, and must be no larger than the existing size.*/ -void ec_enc_shrink(ec_enc *_this,celt_uint32 _size); +void ec_enc_shrink(ec_enc *_this,opus_uint32 _size); /*Indicates that there are no more symbols to encode. All reamining output bytes are flushed to the output buffer. diff --git a/libcelt/fixed_debug.h b/libcelt/fixed_debug.h index 7992fa217..f7131380c 100644 --- a/libcelt/fixed_debug.h +++ b/libcelt/fixed_debug.h @@ -42,7 +42,7 @@ extern long long celt_mips; #define MIPS_INC celt_mips++, -#define MULT16_16SU(a,b) ((celt_word32)(celt_word16)(a)*(celt_word32)(celt_uint16)(b)) +#define MULT16_16SU(a,b) ((celt_word32)(celt_word16)(a)*(celt_word32)(opus_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 */ diff --git a/libcelt/fixed_generic.h b/libcelt/fixed_generic.h index c39ada41f..007b968db 100644 --- a/libcelt/fixed_generic.h +++ b/libcelt/fixed_generic.h @@ -34,7 +34,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)(celt_word16)(a)*(celt_word32)(celt_uint16)(b)) +#define MULT16_16SU(a,b) ((celt_word32)(celt_word16)(a)*(celt_word32)(opus_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)) diff --git a/libcelt/kiss_fft.c b/libcelt/kiss_fft.c index 660b7c25d..3c246d031 100644 --- a/libcelt/kiss_fft.c +++ b/libcelt/kiss_fft.c @@ -437,7 +437,7 @@ static void kf_work( const kiss_fft_cpx * f, size_t fstride, int in_stride, - const celt_int16 * factors, + const opus_int16 * factors, const kiss_fft_state *st, int N, int m2 @@ -468,7 +468,7 @@ static void ki_work( const kiss_fft_cpx * f, size_t fstride, int in_stride, - const celt_int16 * factors, + const opus_int16 * factors, const kiss_fft_state *st, int N, int m2 @@ -499,10 +499,10 @@ static void ki_work( static void compute_bitrev_table( int Fout, - celt_int16 *f, + opus_int16 *f, const size_t fstride, int in_stride, - celt_int16 * factors, + opus_int16 * factors, const kiss_fft_state *st ) { @@ -535,7 +535,7 @@ void compute_bitrev_table( p[i] * m[i] = m[i-1] m0 = n */ static -int kf_factor(int n,celt_int16 * facbuf) +int kf_factor(int n,opus_int16 * facbuf) { int p=4; @@ -547,7 +547,7 @@ int kf_factor(int n,celt_int16 * facbuf) case 2: p = 3; break; default: p += 2; break; } - if (p>32000 || (celt_int32)p*(celt_int32)p > n) + if (p>32000 || (opus_int32)p*(opus_int32)p > n) p = n; /* no more factors, skip to end */ } n /= p; @@ -603,7 +603,7 @@ kiss_fft_state *kiss_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem, co *lenmem = memneeded; } if (st) { - celt_int16 *bitrev; + opus_int16 *bitrev; kiss_twiddle_cpx *twiddles; st->nfft=nfft; @@ -630,7 +630,7 @@ kiss_fft_state *kiss_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem, co } /* bitrev */ - st->bitrev = bitrev = (celt_int16*)KISS_FFT_MALLOC(sizeof(celt_int16)*nfft); + st->bitrev = bitrev = (opus_int16*)KISS_FFT_MALLOC(sizeof(opus_int16)*nfft); if (st->bitrev==NULL) goto fail; compute_bitrev_table(0, bitrev, 1,1, st->factors,st); @@ -650,7 +650,7 @@ void kiss_fft_free(const kiss_fft_state *cfg) { if (cfg) { - celt_free((celt_int16*)cfg->bitrev); + celt_free((opus_int16*)cfg->bitrev); if (cfg->shift < 0) celt_free((kiss_twiddle_cpx*)cfg->twiddles); celt_free((kiss_fft_state*)cfg); diff --git a/libcelt/kiss_fft.h b/libcelt/kiss_fft.h index d413daede..778d2f271 100644 --- a/libcelt/kiss_fft.h +++ b/libcelt/kiss_fft.h @@ -53,12 +53,12 @@ extern "C" { #define DOUBLE_PRECISION #ifdef DOUBLE_PRECISION -# define kiss_fft_scalar celt_int32 -# define kiss_twiddle_scalar celt_int16 +# define kiss_fft_scalar opus_int32 +# define kiss_twiddle_scalar opus_int16 # define KF_SUFFIX _celt_double #else -# define kiss_fft_scalar celt_int16 -# define kiss_twiddle_scalar celt_int16 +# define kiss_fft_scalar opus_int16 +# define kiss_twiddle_scalar opus_int16 # define KF_SUFFIX _celt_single #endif #else @@ -108,8 +108,8 @@ typedef struct kiss_fft_state{ kiss_fft_scalar scale; #endif int shift; - celt_int16 factors[2*MAXFACTORS]; - const celt_int16 *bitrev; + opus_int16 factors[2*MAXFACTORS]; + const opus_int16 *bitrev; const kiss_twiddle_cpx *twiddles; } kiss_fft_state; diff --git a/libcelt/laplace.c b/libcelt/laplace.c index b4e1f8784..70b94fcf2 100644 --- a/libcelt/laplace.c +++ b/libcelt/laplace.c @@ -42,7 +42,7 @@ static int ec_laplace_get_freq1(int fs0, int decay) { - celt_int32 ft; + opus_int32 ft; ft = 32768 - LAPLACE_MINP*(2*LAPLACE_NMIN) - fs0; return ft*(16384-decay)>>15; } @@ -65,7 +65,7 @@ void ec_laplace_encode(ec_enc *enc, int *value, int fs, int decay) { fs *= 2; fl += fs+2*LAPLACE_MINP; - fs = (fs*(celt_int32)decay)>>15; + fs = (fs*(opus_int32)decay)>>15; } /* Everything beyond that has probability LAPLACE_MINP. */ if (fs <= 0) @@ -108,7 +108,7 @@ int ec_laplace_decode(ec_dec *dec, int fs, int decay) { fs *= 2; fl += fs; - fs = ((fs-2*LAPLACE_MINP)*(celt_int32)decay)>>15; + fs = ((fs-2*LAPLACE_MINP)*(opus_int32)decay)>>15; fs += LAPLACE_MINP; val++; } diff --git a/libcelt/mathops.c b/libcelt/mathops.c index 7852e1eee..c0ee61ed7 100644 --- a/libcelt/mathops.c +++ b/libcelt/mathops.c @@ -39,7 +39,7 @@ /*Compute floor(sqrt(_val)) with exact arithmetic. This has been tested on all possible 32-bit inputs.*/ -unsigned isqrt32(celt_uint32 _val){ +unsigned isqrt32(opus_uint32 _val){ unsigned b; unsigned g; int bshift; @@ -51,8 +51,8 @@ unsigned isqrt32(celt_uint32 _val){ bshift=EC_ILOG(_val)-1>>1; b=1U<<bshift; do{ - celt_uint32 t; - t=((celt_uint32)g<<1)+b<<bshift; + opus_uint32 t; + t=((opus_uint32)g<<1)+b<<bshift; if(t<=_val){ g+=b; _val-=t; diff --git a/libcelt/mathops.h b/libcelt/mathops.h index e1a0e83ba..4daf917fb 100644 --- a/libcelt/mathops.h +++ b/libcelt/mathops.h @@ -39,9 +39,9 @@ #include "os_support.h" /* Multiplies two 16-bit fractional values. Bit-exactness of this macro is important */ -#define FRAC_MUL16(a,b) ((16384+((celt_int32)(celt_int16)(a)*(celt_int16)(b)))>>15) +#define FRAC_MUL16(a,b) ((16384+((opus_int32)(opus_int16)(a)*(opus_int16)(b)))>>15) -unsigned isqrt32(celt_uint32 _val); +unsigned isqrt32(opus_uint32 _val); #ifndef FIXED_POINT @@ -68,7 +68,7 @@ static inline float celt_log2(float x) float frac; union { float f; - celt_uint32 i; + opus_uint32 i; } in; in.f = x; integer = (in.i>>23)-127; @@ -86,7 +86,7 @@ static inline float celt_exp2(float x) float frac; union { float f; - celt_uint32 i; + opus_uint32 i; } res; integer = floor(x); if (integer < -50) @@ -114,7 +114,7 @@ static inline float celt_exp2(float x) #ifndef OVERRIDE_CELT_ILOG2 /** Integer log in base2. Undefined for zero and negative numbers */ -static inline celt_int16 celt_ilog2(celt_int32 x) +static inline opus_int16 celt_ilog2(opus_int32 x) { celt_assert2(x>0, "celt_ilog2() only defined for strictly positive numbers"); return EC_ILOG(x)-1; @@ -134,7 +134,7 @@ static inline celt_word16 celt_maxabs16(celt_word16 *x, int len) #endif /** Integer log in base2. Defined for zero, but not for negative numbers */ -static inline celt_int16 celt_zlog2(celt_word32 x) +static inline opus_int16 celt_zlog2(celt_word32 x) { return x <= 0 ? 0 : celt_ilog2(x); } diff --git a/libcelt/mfrngcod.h b/libcelt/mfrngcod.h index 5e7a5bb38..460acbe7f 100644 --- a/libcelt/mfrngcod.h +++ b/libcelt/mfrngcod.h @@ -40,17 +40,17 @@ /*Bits to shift by to move a symbol into the high-order position.*/ # define EC_CODE_SHIFT (EC_CODE_BITS-EC_SYM_BITS-1) /*Carry bit of the high-order range symbol.*/ -# define EC_CODE_TOP (((celt_uint32)1U)<<EC_CODE_BITS-1) +# define EC_CODE_TOP (((opus_uint32)1U)<<EC_CODE_BITS-1) /*Low-order bit of the high-order range symbol.*/ # define EC_CODE_BOT (EC_CODE_TOP>>EC_SYM_BITS) /*Code for which propagating carries are possible.*/ -# define EC_CODE_CARRY (((celt_uint32)EC_SYM_MAX)<<EC_CODE_SHIFT) +# define EC_CODE_CARRY (((opus_uint32)EC_SYM_MAX)<<EC_CODE_SHIFT) /*The number of bits available for the last, partial symbol in the code field.*/ # define EC_CODE_EXTRA ((EC_CODE_BITS-2)%EC_SYM_BITS+1) /*A mask for the bits available in the coding buffer. This allows different platforms to use a variable with more bits, if it is convenient. We will only use EC_CODE_BITS of it.*/ -# define EC_CODE_MASK ((((celt_uint32)1U)<<EC_CODE_BITS-1)-1<<1|1) +# define EC_CODE_MASK ((((opus_uint32)1U)<<EC_CODE_BITS-1)-1<<1|1) #endif diff --git a/libcelt/modes.c b/libcelt/modes.c index 0ba8d16c4..bbe592ce6 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -38,7 +38,7 @@ #include "stack_alloc.h" #include "quant_bands.h" -static const celt_int16 eband5ms[] = { +static const opus_int16 eband5ms[] = { /*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 78, 100 }; @@ -79,7 +79,7 @@ static const unsigned char band_allocation[] = { /* Defining 25 critical bands for the full 0-20 kHz audio bandwidth Taken from http://ccrma.stanford.edu/~jos/bbt/Bark_Frequency_Scale.html */ #define BARK_BANDS 25 -static const celt_int16 bark_freq[BARK_BANDS+1] = { +static const opus_int16 bark_freq[BARK_BANDS+1] = { 0, 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, 2000, 2320, @@ -87,16 +87,16 @@ static const celt_int16 bark_freq[BARK_BANDS+1] = { 6400, 7700, 9500, 12000, 15500, 20000}; -static celt_int16 *compute_ebands(celt_int32 Fs, int frame_size, int res, int *nbEBands) +static opus_int16 *compute_ebands(opus_int32 Fs, int frame_size, int res, int *nbEBands) { - celt_int16 *eBands; + opus_int16 *eBands; int i, j, lin, low, high, nBark, offset=0; /* All modes that have 2.5 ms short blocks use the same definition */ - if (Fs == 400*(celt_int32)frame_size) + if (Fs == 400*(opus_int32)frame_size) { *nbEBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1; - eBands = celt_alloc(sizeof(celt_int16)*(*nbEBands+1)); + eBands = celt_alloc(sizeof(opus_int16)*(*nbEBands+1)); for (i=0;i<*nbEBands+1;i++) eBands[i] = eband5ms[i]; return eBands; @@ -114,7 +114,7 @@ static celt_int16 *compute_ebands(celt_int32 Fs, int frame_size, int res, int *n low = (bark_freq[lin]+res/2)/res; high = nBark-lin; *nbEBands = low+high; - eBands = celt_alloc(sizeof(celt_int16)*(*nbEBands+2)); + eBands = celt_alloc(sizeof(opus_int16)*(*nbEBands+2)); if (eBands==NULL) return NULL; @@ -176,7 +176,7 @@ static void compute_allocation_table(CELTMode *mode) return; /* Check for standard mode */ - if (mode->Fs == 400*(celt_int32)mode->shortMdctSize) + if (mode->Fs == 400*(opus_int32)mode->shortMdctSize) { for (i=0;i<BITALLOC_SIZE*mode->nbEBands;i++) allocVectors[i] = band_allocation[i]; @@ -192,15 +192,15 @@ static void compute_allocation_table(CELTMode *mode) int k; for (k=0;k<maxBands;k++) { - if (400*(celt_int32)eband5ms[k] > mode->eBands[j]*(celt_int32)mode->Fs/mode->shortMdctSize) + if (400*(opus_int32)eband5ms[k] > mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize) break; } if (k>maxBands-1) allocVectors[i*mode->nbEBands+j] = band_allocation[i*maxBands + maxBands-1]; else { - celt_int32 a0, a1; - a1 = mode->eBands[j]*(celt_int32)mode->Fs/mode->shortMdctSize - 400*(celt_int32)eband5ms[k-1]; - a0 = 400*(celt_int32)eband5ms[k] - mode->eBands[j]*(celt_int32)mode->Fs/mode->shortMdctSize; + opus_int32 a0, a1; + a1 = mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize - 400*(opus_int32)eband5ms[k-1]; + a0 = 400*(opus_int32)eband5ms[k] - mode->eBands[j]*(opus_int32)mode->Fs/mode->shortMdctSize; allocVectors[i*mode->nbEBands+j] = (a0*band_allocation[i*maxBands+k-1] + a1*band_allocation[i*maxBands+k])/(a0+a1); } @@ -221,14 +221,14 @@ static void compute_allocation_table(CELTMode *mode) #endif /* CUSTOM_MODES */ -CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) +CELTMode *celt_mode_create(opus_int32 Fs, int frame_size, int *error) { int i; #ifdef CUSTOM_MODES CELTMode *mode=NULL; int res; celt_word16 *window; - celt_int16 *logN; + opus_int16 *logN; int LM; ALLOC_STACK; #if !defined(VAR_ARRAYS) && !defined(USE_ALLOCA) @@ -275,20 +275,20 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) return NULL; } /* Frames of less than 1ms are not supported. */ - if ((celt_int32)frame_size*1000 < Fs) + if ((opus_int32)frame_size*1000 < Fs) { if (error) *error = CELT_BAD_ARG; return NULL; } - if ((celt_int32)frame_size*75 >= Fs && (frame_size%16)==0) + if ((opus_int32)frame_size*75 >= Fs && (frame_size%16)==0) { LM = 3; - } else if ((celt_int32)frame_size*150 >= Fs && (frame_size%8)==0) + } else if ((opus_int32)frame_size*150 >= Fs && (frame_size%8)==0) { LM = 2; - } else if ((celt_int32)frame_size*300 >= Fs && (frame_size%4)==0) + } else if ((opus_int32)frame_size*300 >= Fs && (frame_size%4)==0) { LM = 1; } else @@ -297,7 +297,7 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) } /* Shorts longer than 3.3ms are not supported. */ - if ((celt_int32)(frame_size>>LM)*300 > Fs) + if ((opus_int32)(frame_size>>LM)*300 > Fs) { if (error) *error = CELT_BAD_ARG; @@ -371,7 +371,7 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) #endif mode->window = window; - logN = (celt_int16*)celt_alloc(mode->nbEBands*sizeof(celt_int16)); + logN = (opus_int16*)celt_alloc(mode->nbEBands*sizeof(opus_int16)); if (logN==NULL) goto failure; @@ -413,13 +413,13 @@ void celt_mode_destroy(CELTMode *mode) } } #endif /* CUSTOM_MODES_ONLY */ - celt_free((celt_int16*)mode->eBands); - celt_free((celt_int16*)mode->allocVectors); + celt_free((opus_int16*)mode->eBands); + celt_free((opus_int16*)mode->allocVectors); celt_free((celt_word16*)mode->window); - celt_free((celt_int16*)mode->logN); + celt_free((opus_int16*)mode->logN); - celt_free((celt_int16*)mode->cache.index); + celt_free((opus_int16*)mode->cache.index); celt_free((unsigned char*)mode->cache.bits); celt_free((unsigned char*)mode->cache.caps); clt_mdct_clear(&mode->mdct); diff --git a/libcelt/modes.h b/libcelt/modes.h index 9e0384e24..7e4f7c28a 100644 --- a/libcelt/modes.h +++ b/libcelt/modes.h @@ -30,7 +30,7 @@ #ifndef MODES_H #define MODES_H -#include "celt_types.h" +#include "opus_types.h" #include "celt.h" #include "arch.h" #include "mdct.h" @@ -59,7 +59,7 @@ typedef struct { int size; - const celt_int16 *index; + const opus_int16 *index; const unsigned char *bits; const unsigned char *caps; } PulseCache; @@ -68,13 +68,13 @@ typedef struct { @brief Mode definition */ struct CELTMode { - celt_int32 Fs; + opus_int32 Fs; int overlap; int nbEBands; int effEBands; celt_word16 preemph[4]; - const celt_int16 *eBands; /**< Definition for each "pseudo-critical band" */ + const opus_int16 *eBands; /**< Definition for each "pseudo-critical band" */ int nbAllocVectors; /**< Number of lines in the matrix below */ const unsigned char *allocVectors; /**< Number of bits in each band for several rates */ @@ -88,7 +88,7 @@ struct CELTMode { int nbShortMdcts; int shortMdctSize; - const celt_int16 *logN; + const opus_int16 *logN; PulseCache cache; }; @@ -108,9 +108,9 @@ struct CELTMode { #define CELT_GET_MODE(x) CELT_GET_MODE_REQUEST, _celt_check_mode_ptr_ptr(x) /* Prototypes for _ec versions of the encoder/decoder calls (not public) */ -int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc); +int celt_encode_with_ec(CELTEncoder * restrict st, const opus_int16 * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc); int celt_encode_with_ec_float(CELTEncoder * restrict st, const float * pcm, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc); -int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, celt_int16 * restrict pcm, int frame_size, ec_dec *dec); +int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, int len, opus_int16 * restrict pcm, int frame_size, ec_dec *dec); int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *data, int len, float * restrict pcm, int frame_size, ec_dec *dec); #endif /* OPUS_BUILD */ diff --git a/libcelt/celt_types.h b/libcelt/opus_types.h similarity index 52% rename from libcelt/celt_types.h rename to libcelt/opus_types.h index bfd498a9f..a676b6107 100644 --- a/libcelt/celt_types.h +++ b/libcelt/opus_types.h @@ -24,128 +24,128 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* celt_types.h taken from libogg */ +/* opus_types.h taken from libogg */ /** - @file celt_types.h - @brief CELT types + @file opus_types.h + @brief OPUS types */ -#ifndef _CELT_TYPES_H -#define _CELT_TYPES_H +#ifndef _OPUS_TYPES_H +#define _OPUS_TYPES_H /* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */ #if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HAVE_STDINT_H)) #include <stdint.h> - typedef int16_t celt_int16; - typedef uint16_t celt_uint16; - typedef int32_t celt_int32; - typedef uint32_t celt_uint32; + typedef int16_t opus_int16; + typedef uint16_t opus_uint16; + typedef int32_t opus_int32; + typedef uint32_t opus_uint32; #elif defined(_WIN32) # if defined(__CYGWIN__) # include <_G_config.h> - typedef _G_int32_t celt_int32; - typedef _G_uint32_t celt_uint32; - typedef _G_int16 celt_int16; - typedef _G_uint16 celt_uint16; + typedef _G_int32_t opus_int32; + typedef _G_uint32_t opus_uint32; + typedef _G_int16 opus_int16; + typedef _G_uint16 opus_uint16; # elif defined(__MINGW32__) - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef int celt_int32; - typedef unsigned int celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; # elif defined(__MWERKS__) - typedef int celt_int32; - typedef unsigned int celt_uint32; - typedef short celt_int16; - typedef unsigned short celt_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; # else /* MSVC/Borland */ - typedef __int32 celt_int32; - typedef unsigned __int32 celt_uint32; - typedef __int16 celt_int16; - typedef unsigned __int16 celt_uint16; + typedef __int32 opus_int32; + typedef unsigned __int32 opus_uint32; + typedef __int16 opus_int16; + typedef unsigned __int16 opus_uint16; # endif #elif defined(__MACOS__) # include <sys/types.h> - typedef SInt16 celt_int16; - typedef UInt16 celt_uint16; - typedef SInt32 celt_int32; - typedef UInt32 celt_uint32; + typedef SInt16 opus_int16; + typedef UInt16 opus_uint16; + typedef SInt32 opus_int32; + typedef UInt32 opus_uint32; #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ # include <sys/types.h> - typedef int16_t celt_int16; - typedef u_int16_t celt_uint16; - typedef int32_t celt_int32; - typedef u_int32_t celt_uint32; + typedef int16_t opus_int16; + typedef u_int16_t opus_uint16; + typedef int32_t opus_int32; + typedef u_int32_t opus_uint32; #elif defined(__BEOS__) /* Be */ # include <inttypes.h> - typedef int16 celt_int16; - typedef u_int16 celt_uint16; - typedef int32_t celt_int32; - typedef u_int32_t celt_uint32; + typedef int16 opus_int16; + typedef u_int16 opus_uint16; + typedef int32_t opus_int32; + typedef u_int32_t opus_uint32; #elif defined (__EMX__) /* OS/2 GCC */ - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef int celt_int32; - typedef unsigned int celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; #elif defined (DJGPP) /* DJGPP */ - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef int celt_int32; - typedef unsigned int celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; #elif defined(R5900) /* PS2 EE */ - typedef int celt_int32; - typedef unsigned celt_uint32; - typedef short celt_int16; - typedef unsigned short celt_uint16; + typedef int opus_int32; + typedef unsigned opus_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; #elif defined(__SYMBIAN32__) /* Symbian GCC */ - typedef signed short celt_int16; - typedef unsigned short celt_uint16; - typedef signed int celt_int32; - typedef unsigned int celt_uint32; + typedef signed short opus_int16; + typedef unsigned short opus_uint16; + typedef signed int opus_int32; + typedef unsigned int opus_uint32; #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef long celt_int32; - typedef unsigned long celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef long opus_int32; + typedef unsigned long opus_uint32; #elif defined(CONFIG_TI_C6X) - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef int celt_int32; - typedef unsigned int celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; #else /* Give up, take a reasonable guess */ - typedef short celt_int16; - typedef unsigned short celt_uint16; - typedef int celt_int32; - typedef unsigned int celt_uint32; + typedef short opus_int16; + typedef unsigned short opus_uint16; + typedef int opus_int32; + typedef unsigned int opus_uint32; #endif -#endif /* _CELT_TYPES_H */ +#endif /* _OPUS_TYPES_H */ diff --git a/libcelt/quant_bands.c b/libcelt/quant_bands.c index f33bf3f8f..42672f768 100644 --- a/libcelt/quant_bands.c +++ b/libcelt/quant_bands.c @@ -155,7 +155,7 @@ static celt_word32 loss_distortion(const celt_word16 *eBands, celt_word16 *oldEB static int quant_coarse_energy_impl(const CELTMode *m, int start, int end, const celt_word16 *eBands, celt_word16 *oldEBands, - celt_int32 budget, celt_int32 tell, + opus_int32 budget, opus_int32 tell, const unsigned char *prob_model, celt_word16 *error, ec_enc *enc, int _C, int LM, int intra, celt_word16 max_decay) { @@ -258,7 +258,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end, } void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, - const celt_word16 *eBands, celt_word16 *oldEBands, celt_uint32 budget, + const celt_word16 *eBands, celt_word16 *oldEBands, opus_uint32 budget, celt_word16 *error, ec_enc *enc, int _C, int LM, int nbAvailableBytes, int force_intra, celt_word32 *delayedIntra, int two_pass, int loss_rate) { @@ -268,9 +268,9 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, VARDECL(celt_word16, oldEBands_intra); VARDECL(celt_word16, error_intra); ec_enc enc_start_state; - celt_uint32 tell; + opus_uint32 tell; int badness1=0; - celt_int32 intra_bias; + opus_int32 intra_bias; celt_word32 new_distortion; SAVE_STACK; @@ -307,8 +307,8 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, { ec_enc enc_intra_state; int tell_intra; - celt_uint32 nstart_bytes; - celt_uint32 nintra_bytes; + opus_uint32 nstart_bytes; + opus_uint32 nintra_bytes; int badness2; VARDECL(unsigned char, intra_bits); @@ -361,7 +361,7 @@ void quant_fine_energy(const CELTMode *m, int start, int end, celt_word16 *oldEB /* Encode finer resolution */ for (i=start;i<end;i++) { - celt_int16 frac = 1<<fine_quant[i]; + opus_int16 frac = 1<<fine_quant[i]; if (fine_quant[i] <= 0) continue; c=0; @@ -429,8 +429,8 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_word16 *o celt_word16 coef; celt_word16 beta; const int C = CHANNELS(_C); - celt_int32 budget; - celt_int32 tell; + opus_int32 budget; + opus_int32 tell; if (intra) diff --git a/libcelt/quant_bands.h b/libcelt/quant_bands.h index c1749b278..74097cade 100644 --- a/libcelt/quant_bands.h +++ b/libcelt/quant_bands.h @@ -42,10 +42,10 @@ void log2Amp(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int _C); unsigned char *quant_prob_alloc(const CELTMode *m); -void quant_prob_free(const celt_int16 *freq); +void quant_prob_free(const opus_int16 *freq); void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, - const celt_word16 *eBands, celt_word16 *oldEBands, celt_uint32 budget, + const celt_word16 *eBands, celt_word16 *oldEBands, opus_uint32 budget, celt_word16 *error, ec_enc *enc, int _C, int LM, int nbAvailableBytes, int force_intra, celt_word32 *delayedIntra, int two_pass, int loss_rate); diff --git a/libcelt/rate.c b/libcelt/rate.c index 24037c01b..c3d86a56d 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -54,10 +54,10 @@ static const unsigned char LOG2_FRAC_TABLE[24]={ N and K are themselves limited to 15 bits.*/ static int fits_in32(int _n, int _k) { - static const celt_int16 maxN[15] = { + static const opus_int16 maxN[15] = { 32767, 32767, 32767, 1476, 283, 109, 60, 40, 29, 24, 20, 18, 16, 14, 13}; - static const celt_int16 maxK[15] = { + static const opus_int16 maxK[15] = { 32767, 32767, 32767, 32767, 1172, 238, 95, 53, 36, 27, 22, 18, 16, 15, 13}; if (_n>=14) @@ -79,9 +79,9 @@ void compute_pulse_cache(CELTMode *m, int LM) int curr=0; int nbEntries=0; int entryN[100], entryK[100], entryI[100]; - const celt_int16 *eBands = m->eBands; + const opus_int16 *eBands = m->eBands; PulseCache *cache = &m->cache; - celt_int16 *cindex; + opus_int16 *cindex; unsigned char *bits; unsigned char *cap; @@ -132,7 +132,7 @@ void compute_pulse_cache(CELTMode *m, int LM) for (i=0;i<nbEntries;i++) { unsigned char *ptr = bits+entryI[i]; - celt_int16 tmp[MAX_PULSES+1]; + opus_int16 tmp[MAX_PULSES+1]; get_required_bits(tmp, entryN[i], get_pulses(entryK[i]), BITRES); for (j=1;j<=entryK[i];j++) ptr[j] = tmp[get_pulses(j)]-1; @@ -157,8 +157,8 @@ void compute_pulse_cache(CELTMode *m, int LM) else { const unsigned char *pcache; - celt_int32 num; - celt_int32 den; + opus_int32 num; + opus_int32 den; int LM0; int N; int offset; @@ -195,8 +195,8 @@ void compute_pulse_cache(CELTMode *m, int LM) is to be max_bits. The average measured cost for theta is 0.89701 times qb, approximated here as 459/512. */ - num=459*(celt_int32)((2*N-1)*offset+max_bits); - den=((celt_int32)(2*N-1)<<9)-459; + num=459*(opus_int32)((2*N-1)*offset+max_bits); + den=((opus_int32)(2*N-1)<<9)-459; qb = IMIN((num+(den>>1))/den, 57); celt_assert(qb >= 0); max_bits += qb; @@ -210,8 +210,8 @@ void compute_pulse_cache(CELTMode *m, int LM) ndof = 2*N-1-(N==2); /* The average measured cost for theta with the step PDF is 0.95164 times qb, approximated here as 487/512. */ - num = (N==2?512:487)*(celt_int32)(max_bits+ndof*offset); - den = ((celt_int32)ndof<<9)-(N==2?512:487); + num = (N==2?512:487)*(opus_int32)(max_bits+ndof*offset); + den = ((opus_int32)ndof<<9)-(N==2?512:487); qb = IMIN((num+(den>>1))/den, (N==2?64:61)); celt_assert(qb >= 0); max_bits += qb; @@ -248,11 +248,11 @@ void compute_pulse_cache(CELTMode *m, int LM) #define ALLOC_STEPS 6 static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, - const int *bits1, const int *bits2, const int *thresh, const int *cap, celt_int32 total, celt_int32 *_balance, + const int *bits1, const int *bits2, const int *thresh, const int *cap, opus_int32 total, opus_int32 *_balance, int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits, int *ebits, int *fine_priority, int _C, int LM, ec_ctx *ec, int encode, int prev) { - celt_int32 psum; + opus_int32 psum; int lo, hi; int i, j; int logM; @@ -260,7 +260,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int int stereo; int codedBands=-1; int alloc_floor; - celt_int32 left, percoeff; + opus_int32 left, percoeff; int done; int balance; SAVE_STACK; @@ -278,7 +278,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int done = 0; for (j=end;j-->start;) { - int tmp = bits1[j] + (mid*(celt_int32)bits2[j]>>ALLOC_STEPS); + int tmp = bits1[j] + (mid*(opus_int32)bits2[j]>>ALLOC_STEPS); if (tmp >= thresh[j] || done) { done = 1; @@ -523,7 +523,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int } int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo, - celt_int32 total, celt_int32 *balance, int *pulses, int *ebits, int *fine_priority, int _C, int LM, ec_ctx *ec, int encode, int prev) + opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int _C, int LM, ec_ctx *ec, int encode, int prev) { int lo, hi, len, j; const int C = CHANNELS(_C); diff --git a/libcelt/rate.h b/libcelt/rate.h index 8feaa8694..f1cd433a2 100644 --- a/libcelt/rate.h +++ b/libcelt/rate.h @@ -89,7 +89,7 @@ static inline int pulses2bits(const CELTMode *m, int band, int LM, int pulses) } /** Computes a cache of the pulses->bits mapping in each band */ -celt_int16 **compute_alloc_cache(CELTMode *m, int M); +opus_int16 **compute_alloc_cache(CELTMode *m, int M); /** Compute the pulse allocation, i.e. how many pulses will go in each * band. @@ -101,7 +101,7 @@ celt_int16 **compute_alloc_cache(CELTMode *m, int M); @return Total number of bits allocated */ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stero, - celt_int32 total, celt_int32 *balance, int *pulses, int *ebits, int *fine_priority, int _C, int LM, ec_ctx *ec, int encode, int prev); + opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int _C, int LM, ec_ctx *ec, int encode, int prev); #endif diff --git a/libcelt/static_modes_fixed.c b/libcelt/static_modes_fixed.c index 0a1823765..5b12a2688 100644 --- a/libcelt/static_modes_fixed.c +++ b/libcelt/static_modes_fixed.c @@ -11,13 +11,13 @@ static const celt_word16 window120[120] = { #ifndef DEF_LOGN400 #define DEF_LOGN400 -static const celt_int16 logN400[21] = { +static const opus_int16 logN400[21] = { 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, }; #endif #ifndef DEF_PULSE_CACHE50 #define DEF_PULSE_CACHE50 -static const celt_int16 cache_index50[105] = { +static const opus_int16 cache_index50[105] = { -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 41, 41, 41, 82, 82, 123, 164, 200, 222, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 123, 123, 123, 164, 164, 240, 266, 283, 295, 41, 41, 41, 41, 41, 41, 41, 41, 123, 123, 123, 123, 240, 240, 240, 266, 266, 305, 318, 328, 336, 123, 123, 123, 123, 123, 123, 123, 123, 240, 240, 240, 240, 305, 305, 305, 318, 318, 343, 351, 358, 364, 240, 240, 240, 240, 240, 240, 240, 240, 305, 305, 305, 305, 343, 343, 343, 351, 351, 370, 376, 382, 387, }; static const unsigned char cache_bits50[392] = { 40, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 40, 15, 23, 28, 31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47, 47, 49, 50, 51, 52, 53, 54, 55, 55, 57, 58, 59, 60, 61, 62, 63, 63, 65, 66, 67, 68, 69, 70, 71, 71, 40, 20, 33, 41, 48, 53, 57, 61, 64, 66, 69, 71, 73, 75, 76, 78, 80, 82, 85, 87, 89, 91, 92, 94, 96, 98, 101, 103, 105, 107, 108, 110, 112, 114, 117, 119, 121, 123, 124, 126, 128, 40, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94, 97, 100, 102, 105, 107, 111, 115, 118, 121, 124, 126, 129, 131, 135, 139, 142, 145, 148, 150, 153, 155, 159, 163, 166, 169, 172, 174, 177, 179, 35, 28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149, 153, 159, 165, 171, 176, 180, 185, 189, 192, 199, 205, 211, 216, 220, 225, 229, 232, 239, 245, 251, 21, 33, 58, 79, 97, 112, 125, 137, 148, 157, 166, 174, 182, 189, 195, 201, 207, 217, 227, 235, 243, 251, 17, 35, 63, 86, 106, 123, 139, 152, 165, 177, 187, 197, 206, 214, 222, 230, 237, 250, 25, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180, 185, 190, 200, 208, 215, 222, 229, 235, 240, 245, 255, 16, 36, 65, 89, 110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242, 250, 11, 41, 74, 103, 128, 151, 172, 191, 209, 225, 241, 255, 9, 43, 79, 110, 138, 163, 186, 207, 227, 246, 12, 39, 71, 99, 123, 144, 164, 182, 198, 214, 228, 241, 253, 9, 44, 81, 113, 142, 168, 192, 214, 235, 255, 7, 49, 90, 127, 160, 191, 220, 247, 6, 51, 95, 134, 170, 203, 234, 7, 47, 87, 123, 155, 184, 212, 237, 6, 52, 97, 137, 174, 208, 240, 5, 57, 106, 151, 192, 231, 5, 59, 111, 158, 202, 243, 5, 55, 103, 147, 187, 224, 5, 60, 113, 161, 206, 248, 4, 65, 122, 175, 224, 4, 67, 127, 182, 234, }; @@ -31,25 +31,25 @@ static const kiss_twiddle_cpx fft_twiddles48000_960[480] = { {32767, 0}, {32766, -429}, {32757, -858}, {32743, -1287}, {32724, -1715}, {32698, -2143}, {32667, -2570}, {32631, -2998}, {32588, -3425}, {32541, -3851}, {32488, -4277}, {32429, -4701}, {32364, -5125}, {32295, -5548}, {32219, -5971}, {32138, -6393}, {32051, -6813}, {31960, -7231}, {31863, -7650}, {31760, -8067}, {31652, -8481}, {31539, -8895}, {31419, -9306}, {31294, -9716}, {31165, -10126}, {31030, -10532}, {30889, -10937}, {30743, -11340}, {30592, -11741}, {30436, -12141}, {30274, -12540}, {30107, -12935}, {29936, -13328}, {29758, -13718}, {29577, -14107}, {29390, -14493}, {29197, -14875}, {29000, -15257}, {28797, -15635}, {28590, -16010}, {28379, -16384}, {28162, -16753}, {27940, -17119}, {27714, -17484}, {27482, -17845}, {27246, -18205}, {27006, -18560}, {26760, -18911}, {26510, -19260}, {26257, -19606}, {25997, -19947}, {25734, -20286}, {25466, -20621}, {25194, -20952}, {24918, -21281}, {24637, -21605}, {24353, -21926}, {24063, -22242}, {23770, -22555}, {23473, -22865}, {23171, -23171}, {22866, -23472}, {22557, -23769}, {22244, -24063}, {21927, -24352}, {21606, -24636}, {21282, -24917}, {20954, -25194}, {20622, -25465}, {20288, -25733}, {19949, -25997}, {19607, -26255}, {19261, -26509}, {18914, -26760}, {18561, -27004}, {18205, -27246}, {17846, -27481}, {17485, -27713}, {17122, -27940}, {16755, -28162}, {16385, -28378}, {16012, -28590}, {15636, -28797}, {15258, -28999}, {14878, -29197}, {14494, -29389}, {14108, -29576}, {13720, -29757}, {13329, -29934}, {12937, -30107}, {12540, -30274}, {12142, -30435}, {11744, -30592}, {11342, -30743}, {10939, -30889}, {10534, -31030}, {10127, -31164}, {9718, -31294}, {9307, -31418}, {8895, -31537}, {8482, -31652}, {8067, -31759}, {7650, -31862}, {7233, -31960}, {6815, -32051}, {6393, -32138}, {5973, -32219}, {5549, -32294}, {5127, -32364}, {4703, -32429}, {4278, -32487}, {3852, -32541}, {3426, -32588}, {2999, -32630}, {2572, -32667}, {2144, -32698}, {1716, -32724}, {1287, -32742}, {860, -32757}, {430, -32766}, {0, -32767}, {-429, -32766}, {-858, -32757}, {-1287, -32743}, {-1715, -32724}, {-2143, -32698}, {-2570, -32667}, {-2998, -32631}, {-3425, -32588}, {-3851, -32541}, {-4277, -32488}, {-4701, -32429}, {-5125, -32364}, {-5548, -32295}, {-5971, -32219}, {-6393, -32138}, {-6813, -32051}, {-7231, -31960}, {-7650, -31863}, {-8067, -31760}, {-8481, -31652}, {-8895, -31539}, {-9306, -31419}, {-9716, -31294}, {-10126, -31165}, {-10532, -31030}, {-10937, -30889}, {-11340, -30743}, {-11741, -30592}, {-12141, -30436}, {-12540, -30274}, {-12935, -30107}, {-13328, -29936}, {-13718, -29758}, {-14107, -29577}, {-14493, -29390}, {-14875, -29197}, {-15257, -29000}, {-15635, -28797}, {-16010, -28590}, {-16384, -28379}, {-16753, -28162}, {-17119, -27940}, {-17484, -27714}, {-17845, -27482}, {-18205, -27246}, {-18560, -27006}, {-18911, -26760}, {-19260, -26510}, {-19606, -26257}, {-19947, -25997}, {-20286, -25734}, {-20621, -25466}, {-20952, -25194}, {-21281, -24918}, {-21605, -24637}, {-21926, -24353}, {-22242, -24063}, {-22555, -23770}, {-22865, -23473}, {-23171, -23171}, {-23472, -22866}, {-23769, -22557}, {-24063, -22244}, {-24352, -21927}, {-24636, -21606}, {-24917, -21282}, {-25194, -20954}, {-25465, -20622}, {-25733, -20288}, {-25997, -19949}, {-26255, -19607}, {-26509, -19261}, {-26760, -18914}, {-27004, -18561}, {-27246, -18205}, {-27481, -17846}, {-27713, -17485}, {-27940, -17122}, {-28162, -16755}, {-28378, -16385}, {-28590, -16012}, {-28797, -15636}, {-28999, -15258}, {-29197, -14878}, {-29389, -14494}, {-29576, -14108}, {-29757, -13720}, {-29934, -13329}, {-30107, -12937}, {-30274, -12540}, {-30435, -12142}, {-30592, -11744}, {-30743, -11342}, {-30889, -10939}, {-31030, -10534}, {-31164, -10127}, {-31294, -9718}, {-31418, -9307}, {-31537, -8895}, {-31652, -8482}, {-31759, -8067}, {-31862, -7650}, {-31960, -7233}, {-32051, -6815}, {-32138, -6393}, {-32219, -5973}, {-32294, -5549}, {-32364, -5127}, {-32429, -4703}, {-32487, -4278}, {-32541, -3852}, {-32588, -3426}, {-32630, -2999}, {-32667, -2572}, {-32698, -2144}, {-32724, -1716}, {-32742, -1287}, {-32757, -860}, {-32766, -430}, {-32767, 0}, {-32766, 429}, {-32757, 858}, {-32743, 1287}, {-32724, 1715}, {-32698, 2143}, {-32667, 2570}, {-32631, 2998}, {-32588, 3425}, {-32541, 3851}, {-32488, 4277}, {-32429, 4701}, {-32364, 5125}, {-32295, 5548}, {-32219, 5971}, {-32138, 6393}, {-32051, 6813}, {-31960, 7231}, {-31863, 7650}, {-31760, 8067}, {-31652, 8481}, {-31539, 8895}, {-31419, 9306}, {-31294, 9716}, {-31165, 10126}, {-31030, 10532}, {-30889, 10937}, {-30743, 11340}, {-30592, 11741}, {-30436, 12141}, {-30274, 12540}, {-30107, 12935}, {-29936, 13328}, {-29758, 13718}, {-29577, 14107}, {-29390, 14493}, {-29197, 14875}, {-29000, 15257}, {-28797, 15635}, {-28590, 16010}, {-28379, 16384}, {-28162, 16753}, {-27940, 17119}, {-27714, 17484}, {-27482, 17845}, {-27246, 18205}, {-27006, 18560}, {-26760, 18911}, {-26510, 19260}, {-26257, 19606}, {-25997, 19947}, {-25734, 20286}, {-25466, 20621}, {-25194, 20952}, {-24918, 21281}, {-24637, 21605}, {-24353, 21926}, {-24063, 22242}, {-23770, 22555}, {-23473, 22865}, {-23171, 23171}, {-22866, 23472}, {-22557, 23769}, {-22244, 24063}, {-21927, 24352}, {-21606, 24636}, {-21282, 24917}, {-20954, 25194}, {-20622, 25465}, {-20288, 25733}, {-19949, 25997}, {-19607, 26255}, {-19261, 26509}, {-18914, 26760}, {-18561, 27004}, {-18205, 27246}, {-17846, 27481}, {-17485, 27713}, {-17122, 27940}, {-16755, 28162}, {-16385, 28378}, {-16012, 28590}, {-15636, 28797}, {-15258, 28999}, {-14878, 29197}, {-14494, 29389}, {-14108, 29576}, {-13720, 29757}, {-13329, 29934}, {-12937, 30107}, {-12540, 30274}, {-12142, 30435}, {-11744, 30592}, {-11342, 30743}, {-10939, 30889}, {-10534, 31030}, {-10127, 31164}, {-9718, 31294}, {-9307, 31418}, {-8895, 31537}, {-8482, 31652}, {-8067, 31759}, {-7650, 31862}, {-7233, 31960}, {-6815, 32051}, {-6393, 32138}, {-5973, 32219}, {-5549, 32294}, {-5127, 32364}, {-4703, 32429}, {-4278, 32487}, {-3852, 32541}, {-3426, 32588}, {-2999, 32630}, {-2572, 32667}, {-2144, 32698}, {-1716, 32724}, {-1287, 32742}, {-860, 32757}, {-430, 32766}, {0, 32767}, {429, 32766}, {858, 32757}, {1287, 32743}, {1715, 32724}, {2143, 32698}, {2570, 32667}, {2998, 32631}, {3425, 32588}, {3851, 32541}, {4277, 32488}, {4701, 32429}, {5125, 32364}, {5548, 32295}, {5971, 32219}, {6393, 32138}, {6813, 32051}, {7231, 31960}, {7650, 31863}, {8067, 31760}, {8481, 31652}, {8895, 31539}, {9306, 31419}, {9716, 31294}, {10126, 31165}, {10532, 31030}, {10937, 30889}, {11340, 30743}, {11741, 30592}, {12141, 30436}, {12540, 30274}, {12935, 30107}, {13328, 29936}, {13718, 29758}, {14107, 29577}, {14493, 29390}, {14875, 29197}, {15257, 29000}, {15635, 28797}, {16010, 28590}, {16384, 28379}, {16753, 28162}, {17119, 27940}, {17484, 27714}, {17845, 27482}, {18205, 27246}, {18560, 27006}, {18911, 26760}, {19260, 26510}, {19606, 26257}, {19947, 25997}, {20286, 25734}, {20621, 25466}, {20952, 25194}, {21281, 24918}, {21605, 24637}, {21926, 24353}, {22242, 24063}, {22555, 23770}, {22865, 23473}, {23171, 23171}, {23472, 22866}, {23769, 22557}, {24063, 22244}, {24352, 21927}, {24636, 21606}, {24917, 21282}, {25194, 20954}, {25465, 20622}, {25733, 20288}, {25997, 19949}, {26255, 19607}, {26509, 19261}, {26760, 18914}, {27004, 18561}, {27246, 18205}, {27481, 17846}, {27713, 17485}, {27940, 17122}, {28162, 16755}, {28378, 16385}, {28590, 16012}, {28797, 15636}, {28999, 15258}, {29197, 14878}, {29389, 14494}, {29576, 14108}, {29757, 13720}, {29934, 13329}, {30107, 12937}, {30274, 12540}, {30435, 12142}, {30592, 11744}, {30743, 11342}, {30889, 10939}, {31030, 10534}, {31164, 10127}, {31294, 9718}, {31418, 9307}, {31537, 8895}, {31652, 8482}, {31759, 8067}, {31862, 7650}, {31960, 7233}, {32051, 6815}, {32138, 6393}, {32219, 5973}, {32294, 5549}, {32364, 5127}, {32429, 4703}, {32487, 4278}, {32541, 3852}, {32588, 3426}, {32630, 2999}, {32667, 2572}, {32698, 2144}, {32724, 1716}, {32742, 1287}, {32757, 860}, {32766, 430}, }; #ifndef FFT_BITREV480 #define FFT_BITREV480 -static const celt_int16 fft_bitrev480[480] = { +static const opus_int16 fft_bitrev480[480] = { 0, 120, 240, 360, 30, 150, 270, 390, 60, 180, 300, 420, 90, 210, 330, 450, 15, 135, 255, 375, 45, 165, 285, 405, 75, 195, 315, 435, 105, 225, 345, 465, 5, 125, 245, 365, 35, 155, 275, 395, 65, 185, 305, 425, 95, 215, 335, 455, 20, 140, 260, 380, 50, 170, 290, 410, 80, 200, 320, 440, 110, 230, 350, 470, 10, 130, 250, 370, 40, 160, 280, 400, 70, 190, 310, 430, 100, 220, 340, 460, 25, 145, 265, 385, 55, 175, 295, 415, 85, 205, 325, 445, 115, 235, 355, 475, 1, 121, 241, 361, 31, 151, 271, 391, 61, 181, 301, 421, 91, 211, 331, 451, 16, 136, 256, 376, 46, 166, 286, 406, 76, 196, 316, 436, 106, 226, 346, 466, 6, 126, 246, 366, 36, 156, 276, 396, 66, 186, 306, 426, 96, 216, 336, 456, 21, 141, 261, 381, 51, 171, 291, 411, 81, 201, 321, 441, 111, 231, 351, 471, 11, 131, 251, 371, 41, 161, 281, 401, 71, 191, 311, 431, 101, 221, 341, 461, 26, 146, 266, 386, 56, 176, 296, 416, 86, 206, 326, 446, 116, 236, 356, 476, 2, 122, 242, 362, 32, 152, 272, 392, 62, 182, 302, 422, 92, 212, 332, 452, 17, 137, 257, 377, 47, 167, 287, 407, 77, 197, 317, 437, 107, 227, 347, 467, 7, 127, 247, 367, 37, 157, 277, 397, 67, 187, 307, 427, 97, 217, 337, 457, 22, 142, 262, 382, 52, 172, 292, 412, 82, 202, 322, 442, 112, 232, 352, 472, 12, 132, 252, 372, 42, 162, 282, 402, 72, 192, 312, 432, 102, 222, 342, 462, 27, 147, 267, 387, 57, 177, 297, 417, 87, 207, 327, 447, 117, 237, 357, 477, 3, 123, 243, 363, 33, 153, 273, 393, 63, 183, 303, 423, 93, 213, 333, 453, 18, 138, 258, 378, 48, 168, 288, 408, 78, 198, 318, 438, 108, 228, 348, 468, 8, 128, 248, 368, 38, 158, 278, 398, 68, 188, 308, 428, 98, 218, 338, 458, 23, 143, 263, 383, 53, 173, 293, 413, 83, 203, 323, 443, 113, 233, 353, 473, 13, 133, 253, 373, 43, 163, 283, 403, 73, 193, 313, 433, 103, 223, 343, 463, 28, 148, 268, 388, 58, 178, 298, 418, 88, 208, 328, 448, 118, 238, 358, 478, 4, 124, 244, 364, 34, 154, 274, 394, 64, 184, 304, 424, 94, 214, 334, 454, 19, 139, 259, 379, 49, 169, 289, 409, 79, 199, 319, 439, 109, 229, 349, 469, 9, 129, 249, 369, 39, 159, 279, 399, 69, 189, 309, 429, 99, 219, 339, 459, 24, 144, 264, 384, 54, 174, 294, 414, 84, 204, 324, 444, 114, 234, 354, 474, 14, 134, 254, 374, 44, 164, 284, 404, 74, 194, 314, 434, 104, 224, 344, 464, 29, 149, 269, 389, 59, 179, 299, 419, 89, 209, 329, 449, 119, 239, 359, 479, }; #endif #ifndef FFT_BITREV240 #define FFT_BITREV240 -static const celt_int16 fft_bitrev240[240] = { +static const opus_int16 fft_bitrev240[240] = { 0, 60, 120, 180, 15, 75, 135, 195, 30, 90, 150, 210, 45, 105, 165, 225, 5, 65, 125, 185, 20, 80, 140, 200, 35, 95, 155, 215, 50, 110, 170, 230, 10, 70, 130, 190, 25, 85, 145, 205, 40, 100, 160, 220, 55, 115, 175, 235, 1, 61, 121, 181, 16, 76, 136, 196, 31, 91, 151, 211, 46, 106, 166, 226, 6, 66, 126, 186, 21, 81, 141, 201, 36, 96, 156, 216, 51, 111, 171, 231, 11, 71, 131, 191, 26, 86, 146, 206, 41, 101, 161, 221, 56, 116, 176, 236, 2, 62, 122, 182, 17, 77, 137, 197, 32, 92, 152, 212, 47, 107, 167, 227, 7, 67, 127, 187, 22, 82, 142, 202, 37, 97, 157, 217, 52, 112, 172, 232, 12, 72, 132, 192, 27, 87, 147, 207, 42, 102, 162, 222, 57, 117, 177, 237, 3, 63, 123, 183, 18, 78, 138, 198, 33, 93, 153, 213, 48, 108, 168, 228, 8, 68, 128, 188, 23, 83, 143, 203, 38, 98, 158, 218, 53, 113, 173, 233, 13, 73, 133, 193, 28, 88, 148, 208, 43, 103, 163, 223, 58, 118, 178, 238, 4, 64, 124, 184, 19, 79, 139, 199, 34, 94, 154, 214, 49, 109, 169, 229, 9, 69, 129, 189, 24, 84, 144, 204, 39, 99, 159, 219, 54, 114, 174, 234, 14, 74, 134, 194, 29, 89, 149, 209, 44, 104, 164, 224, 59, 119, 179, 239, }; #endif #ifndef FFT_BITREV120 #define FFT_BITREV120 -static const celt_int16 fft_bitrev120[120] = { +static const opus_int16 fft_bitrev120[120] = { 0, 30, 60, 90, 15, 45, 75, 105, 5, 35, 65, 95, 20, 50, 80, 110, 10, 40, 70, 100, 25, 55, 85, 115, 1, 31, 61, 91, 16, 46, 76, 106, 6, 36, 66, 96, 21, 51, 81, 111, 11, 41, 71, 101, 26, 56, 86, 116, 2, 32, 62, 92, 17, 47, 77, 107, 7, 37, 67, 97, 22, 52, 82, 112, 12, 42, 72, 102, 27, 57, 87, 117, 3, 33, 63, 93, 18, 48, 78, 108, 8, 38, 68, 98, 23, 53, 83, 113, 13, 43, 73, 103, 28, 58, 88, 118, 4, 34, 64, 94, 19, 49, 79, 109, 9, 39, 69, 99, 24, 54, 84, 114, 14, 44, 74, 104, 29, 59, 89, 119, }; #endif #ifndef FFT_BITREV60 #define FFT_BITREV60 -static const celt_int16 fft_bitrev60[60] = { +static const opus_int16 fft_bitrev60[60] = { 0, 15, 30, 45, 5, 20, 35, 50, 10, 25, 40, 55, 1, 16, 31, 46, 6, 21, 36, 51, 11, 26, 41, 56, 2, 17, 32, 47, 7, 22, 37, 52, 12, 27, 42, 57, 3, 18, 33, 48, 8, 23, 38, 53, 13, 28, 43, 58, 4, 19, 34, 49, 9, 24, 39, 54, 14, 29, 44, 59, }; #endif diff --git a/libcelt/static_modes_float.c b/libcelt/static_modes_float.c index d37345afe..01b34cee2 100644 --- a/libcelt/static_modes_float.c +++ b/libcelt/static_modes_float.c @@ -11,13 +11,13 @@ static const celt_word16 window120[120] = { #ifndef DEF_LOGN400 #define DEF_LOGN400 -static const celt_int16 logN400[21] = { +static const opus_int16 logN400[21] = { 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 16, 16, 16, 21, 21, 24, 29, 34, 36, }; #endif #ifndef DEF_PULSE_CACHE50 #define DEF_PULSE_CACHE50 -static const celt_int16 cache_index50[105] = { +static const opus_int16 cache_index50[105] = { -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 41, 41, 41, 82, 82, 123, 164, 200, 222, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 123, 123, 123, 164, 164, 240, 266, 283, 295, 41, 41, 41, 41, 41, 41, 41, 41, 123, 123, 123, 123, 240, 240, 240, 266, 266, 305, 318, 328, 336, 123, 123, 123, 123, 123, 123, 123, 123, 240, 240, 240, 240, 305, 305, 305, 318, 318, 343, 351, 358, 364, 240, 240, 240, 240, 240, 240, 240, 240, 305, 305, 305, 305, 343, 343, 343, 351, 351, 370, 376, 382, 387, }; static const unsigned char cache_bits50[392] = { 40, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 40, 15, 23, 28, 31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47, 47, 49, 50, 51, 52, 53, 54, 55, 55, 57, 58, 59, 60, 61, 62, 63, 63, 65, 66, 67, 68, 69, 70, 71, 71, 40, 20, 33, 41, 48, 53, 57, 61, 64, 66, 69, 71, 73, 75, 76, 78, 80, 82, 85, 87, 89, 91, 92, 94, 96, 98, 101, 103, 105, 107, 108, 110, 112, 114, 117, 119, 121, 123, 124, 126, 128, 40, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94, 97, 100, 102, 105, 107, 111, 115, 118, 121, 124, 126, 129, 131, 135, 139, 142, 145, 148, 150, 153, 155, 159, 163, 166, 169, 172, 174, 177, 179, 35, 28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149, 153, 159, 165, 171, 176, 180, 185, 189, 192, 199, 205, 211, 216, 220, 225, 229, 232, 239, 245, 251, 21, 33, 58, 79, 97, 112, 125, 137, 148, 157, 166, 174, 182, 189, 195, 201, 207, 217, 227, 235, 243, 251, 17, 35, 63, 86, 106, 123, 139, 152, 165, 177, 187, 197, 206, 214, 222, 230, 237, 250, 25, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180, 185, 190, 200, 208, 215, 222, 229, 235, 240, 245, 255, 16, 36, 65, 89, 110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242, 250, 11, 41, 74, 103, 128, 151, 172, 191, 209, 225, 241, 255, 9, 43, 79, 110, 138, 163, 186, 207, 227, 246, 12, 39, 71, 99, 123, 144, 164, 182, 198, 214, 228, 241, 253, 9, 44, 81, 113, 142, 168, 192, 214, 235, 255, 7, 49, 90, 127, 160, 191, 220, 247, 6, 51, 95, 134, 170, 203, 234, 7, 47, 87, 123, 155, 184, 212, 237, 6, 52, 97, 137, 174, 208, 240, 5, 57, 106, 151, 192, 231, 5, 59, 111, 158, 202, 243, 5, 55, 103, 147, 187, 224, 5, 60, 113, 161, 206, 248, 4, 65, 122, 175, 224, 4, 67, 127, 182, 234, }; @@ -31,25 +31,25 @@ static const kiss_twiddle_cpx fft_twiddles48000_960[480] = { {1.000000, -0.000000}, {0.999914, -0.013090}, {0.999657, -0.026177}, {0.999229, -0.039260}, {0.998630, -0.052336}, {0.997859, -0.065403}, {0.996917, -0.078459}, {0.995805, -0.091502}, {0.994522, -0.104528}, {0.993068, -0.117537}, {0.991445, -0.130526}, {0.989651, -0.143493}, {0.987688, -0.156434}, {0.985556, -0.169350}, {0.983255, -0.182236}, {0.980785, -0.195090}, {0.978148, -0.207912}, {0.975342, -0.220697}, {0.972370, -0.233445}, {0.969231, -0.246153}, {0.965926, -0.258819}, {0.962455, -0.271440}, {0.958820, -0.284015}, {0.955020, -0.296542}, {0.951057, -0.309017}, {0.946930, -0.321439}, {0.942641, -0.333807}, {0.938191, -0.346117}, {0.933580, -0.358368}, {0.928810, -0.370557}, {0.923880, -0.382683}, {0.918791, -0.394744}, {0.913545, -0.406737}, {0.908143, -0.418660}, {0.902585, -0.430511}, {0.896873, -0.442289}, {0.891007, -0.453990}, {0.884988, -0.465615}, {0.878817, -0.477159}, {0.872496, -0.488621}, {0.866025, -0.500000}, {0.859406, -0.511293}, {0.852640, -0.522499}, {0.845728, -0.533615}, {0.838671, -0.544639}, {0.831470, -0.555570}, {0.824126, -0.566406}, {0.816642, -0.577145}, {0.809017, -0.587785}, {0.801254, -0.598325}, {0.793353, -0.608761}, {0.785317, -0.619094}, {0.777146, -0.629320}, {0.768842, -0.639439}, {0.760406, -0.649448}, {0.751840, -0.659346}, {0.743145, -0.669131}, {0.734322, -0.678801}, {0.725374, -0.688355}, {0.716302, -0.697790}, {0.707107, -0.707107}, {0.697790, -0.716302}, {0.688355, -0.725374}, {0.678801, -0.734322}, {0.669131, -0.743145}, {0.659346, -0.751840}, {0.649448, -0.760406}, {0.639439, -0.768842}, {0.629320, -0.777146}, {0.619094, -0.785317}, {0.608761, -0.793353}, {0.598325, -0.801254}, {0.587785, -0.809017}, {0.577145, -0.816642}, {0.566406, -0.824126}, {0.555570, -0.831470}, {0.544639, -0.838671}, {0.533615, -0.845728}, {0.522499, -0.852640}, {0.511293, -0.859406}, {0.500000, -0.866025}, {0.488621, -0.872496}, {0.477159, -0.878817}, {0.465615, -0.884988}, {0.453990, -0.891007}, {0.442289, -0.896873}, {0.430511, -0.902585}, {0.418660, -0.908143}, {0.406737, -0.913545}, {0.394744, -0.918791}, {0.382683, -0.923880}, {0.370557, -0.928810}, {0.358368, -0.933580}, {0.346117, -0.938191}, {0.333807, -0.942641}, {0.321439, -0.946930}, {0.309017, -0.951057}, {0.296542, -0.955020}, {0.284015, -0.958820}, {0.271440, -0.962455}, {0.258819, -0.965926}, {0.246153, -0.969231}, {0.233445, -0.972370}, {0.220697, -0.975342}, {0.207912, -0.978148}, {0.195090, -0.980785}, {0.182236, -0.983255}, {0.169350, -0.985556}, {0.156434, -0.987688}, {0.143493, -0.989651}, {0.130526, -0.991445}, {0.117537, -0.993068}, {0.104528, -0.994522}, {0.091502, -0.995805}, {0.078459, -0.996917}, {0.065403, -0.997859}, {0.052336, -0.998630}, {0.039260, -0.999229}, {0.026177, -0.999657}, {0.013090, -0.999914}, {0.000000, -1.000000}, {-0.013090, -0.999914}, {-0.026177, -0.999657}, {-0.039260, -0.999229}, {-0.052336, -0.998630}, {-0.065403, -0.997859}, {-0.078459, -0.996917}, {-0.091502, -0.995805}, {-0.104528, -0.994522}, {-0.117537, -0.993068}, {-0.130526, -0.991445}, {-0.143493, -0.989651}, {-0.156434, -0.987688}, {-0.169350, -0.985556}, {-0.182236, -0.983255}, {-0.195090, -0.980785}, {-0.207912, -0.978148}, {-0.220697, -0.975342}, {-0.233445, -0.972370}, {-0.246153, -0.969231}, {-0.258819, -0.965926}, {-0.271440, -0.962455}, {-0.284015, -0.958820}, {-0.296542, -0.955020}, {-0.309017, -0.951057}, {-0.321439, -0.946930}, {-0.333807, -0.942641}, {-0.346117, -0.938191}, {-0.358368, -0.933580}, {-0.370557, -0.928810}, {-0.382683, -0.923880}, {-0.394744, -0.918791}, {-0.406737, -0.913545}, {-0.418660, -0.908143}, {-0.430511, -0.902585}, {-0.442289, -0.896873}, {-0.453990, -0.891007}, {-0.465615, -0.884988}, {-0.477159, -0.878817}, {-0.488621, -0.872496}, {-0.500000, -0.866025}, {-0.511293, -0.859406}, {-0.522499, -0.852640}, {-0.533615, -0.845728}, {-0.544639, -0.838671}, {-0.555570, -0.831470}, {-0.566406, -0.824126}, {-0.577145, -0.816642}, {-0.587785, -0.809017}, {-0.598325, -0.801254}, {-0.608761, -0.793353}, {-0.619094, -0.785317}, {-0.629320, -0.777146}, {-0.639439, -0.768842}, {-0.649448, -0.760406}, {-0.659346, -0.751840}, {-0.669131, -0.743145}, {-0.678801, -0.734322}, {-0.688355, -0.725374}, {-0.697790, -0.716302}, {-0.707107, -0.707107}, {-0.716302, -0.697790}, {-0.725374, -0.688355}, {-0.734322, -0.678801}, {-0.743145, -0.669131}, {-0.751840, -0.659346}, {-0.760406, -0.649448}, {-0.768842, -0.639439}, {-0.777146, -0.629320}, {-0.785317, -0.619094}, {-0.793353, -0.608761}, {-0.801254, -0.598325}, {-0.809017, -0.587785}, {-0.816642, -0.577145}, {-0.824126, -0.566406}, {-0.831470, -0.555570}, {-0.838671, -0.544639}, {-0.845728, -0.533615}, {-0.852640, -0.522499}, {-0.859406, -0.511293}, {-0.866025, -0.500000}, {-0.872496, -0.488621}, {-0.878817, -0.477159}, {-0.884988, -0.465615}, {-0.891007, -0.453990}, {-0.896873, -0.442289}, {-0.902585, -0.430511}, {-0.908143, -0.418660}, {-0.913545, -0.406737}, {-0.918791, -0.394744}, {-0.923880, -0.382683}, {-0.928810, -0.370557}, {-0.933580, -0.358368}, {-0.938191, -0.346117}, {-0.942641, -0.333807}, {-0.946930, -0.321439}, {-0.951057, -0.309017}, {-0.955020, -0.296542}, {-0.958820, -0.284015}, {-0.962455, -0.271440}, {-0.965926, -0.258819}, {-0.969231, -0.246153}, {-0.972370, -0.233445}, {-0.975342, -0.220697}, {-0.978148, -0.207912}, {-0.980785, -0.195090}, {-0.983255, -0.182236}, {-0.985556, -0.169350}, {-0.987688, -0.156434}, {-0.989651, -0.143493}, {-0.991445, -0.130526}, {-0.993068, -0.117537}, {-0.994522, -0.104528}, {-0.995805, -0.091502}, {-0.996917, -0.078459}, {-0.997859, -0.065403}, {-0.998630, -0.052336}, {-0.999229, -0.039260}, {-0.999657, -0.026177}, {-0.999914, -0.013090}, {-1.000000, -0.000000}, {-0.999914, 0.013090}, {-0.999657, 0.026177}, {-0.999229, 0.039260}, {-0.998630, 0.052336}, {-0.997859, 0.065403}, {-0.996917, 0.078459}, {-0.995805, 0.091502}, {-0.994522, 0.104528}, {-0.993068, 0.117537}, {-0.991445, 0.130526}, {-0.989651, 0.143493}, {-0.987688, 0.156434}, {-0.985556, 0.169350}, {-0.983255, 0.182236}, {-0.980785, 0.195090}, {-0.978148, 0.207912}, {-0.975342, 0.220697}, {-0.972370, 0.233445}, {-0.969231, 0.246153}, {-0.965926, 0.258819}, {-0.962455, 0.271440}, {-0.958820, 0.284015}, {-0.955020, 0.296542}, {-0.951057, 0.309017}, {-0.946930, 0.321439}, {-0.942641, 0.333807}, {-0.938191, 0.346117}, {-0.933580, 0.358368}, {-0.928810, 0.370557}, {-0.923880, 0.382683}, {-0.918791, 0.394744}, {-0.913545, 0.406737}, {-0.908143, 0.418660}, {-0.902585, 0.430511}, {-0.896873, 0.442289}, {-0.891007, 0.453990}, {-0.884988, 0.465615}, {-0.878817, 0.477159}, {-0.872496, 0.488621}, {-0.866025, 0.500000}, {-0.859406, 0.511293}, {-0.852640, 0.522499}, {-0.845728, 0.533615}, {-0.838671, 0.544639}, {-0.831470, 0.555570}, {-0.824126, 0.566406}, {-0.816642, 0.577145}, {-0.809017, 0.587785}, {-0.801254, 0.598325}, {-0.793353, 0.608761}, {-0.785317, 0.619094}, {-0.777146, 0.629320}, {-0.768842, 0.639439}, {-0.760406, 0.649448}, {-0.751840, 0.659346}, {-0.743145, 0.669131}, {-0.734322, 0.678801}, {-0.725374, 0.688355}, {-0.716302, 0.697790}, {-0.707107, 0.707107}, {-0.697790, 0.716302}, {-0.688355, 0.725374}, {-0.678801, 0.734322}, {-0.669131, 0.743145}, {-0.659346, 0.751840}, {-0.649448, 0.760406}, {-0.639439, 0.768842}, {-0.629320, 0.777146}, {-0.619094, 0.785317}, {-0.608761, 0.793353}, {-0.598325, 0.801254}, {-0.587785, 0.809017}, {-0.577145, 0.816642}, {-0.566406, 0.824126}, {-0.555570, 0.831470}, {-0.544639, 0.838671}, {-0.533615, 0.845728}, {-0.522499, 0.852640}, {-0.511293, 0.859406}, {-0.500000, 0.866025}, {-0.488621, 0.872496}, {-0.477159, 0.878817}, {-0.465615, 0.884988}, {-0.453990, 0.891007}, {-0.442289, 0.896873}, {-0.430511, 0.902585}, {-0.418660, 0.908143}, {-0.406737, 0.913545}, {-0.394744, 0.918791}, {-0.382683, 0.923880}, {-0.370557, 0.928810}, {-0.358368, 0.933580}, {-0.346117, 0.938191}, {-0.333807, 0.942641}, {-0.321439, 0.946930}, {-0.309017, 0.951057}, {-0.296542, 0.955020}, {-0.284015, 0.958820}, {-0.271440, 0.962455}, {-0.258819, 0.965926}, {-0.246153, 0.969231}, {-0.233445, 0.972370}, {-0.220697, 0.975342}, {-0.207912, 0.978148}, {-0.195090, 0.980785}, {-0.182236, 0.983255}, {-0.169350, 0.985556}, {-0.156434, 0.987688}, {-0.143493, 0.989651}, {-0.130526, 0.991445}, {-0.117537, 0.993068}, {-0.104528, 0.994522}, {-0.091502, 0.995805}, {-0.078459, 0.996917}, {-0.065403, 0.997859}, {-0.052336, 0.998630}, {-0.039260, 0.999229}, {-0.026177, 0.999657}, {-0.013090, 0.999914}, {-0.000000, 1.000000}, {0.013090, 0.999914}, {0.026177, 0.999657}, {0.039260, 0.999229}, {0.052336, 0.998630}, {0.065403, 0.997859}, {0.078459, 0.996917}, {0.091502, 0.995805}, {0.104528, 0.994522}, {0.117537, 0.993068}, {0.130526, 0.991445}, {0.143493, 0.989651}, {0.156434, 0.987688}, {0.169350, 0.985556}, {0.182236, 0.983255}, {0.195090, 0.980785}, {0.207912, 0.978148}, {0.220697, 0.975342}, {0.233445, 0.972370}, {0.246153, 0.969231}, {0.258819, 0.965926}, {0.271440, 0.962455}, {0.284015, 0.958820}, {0.296542, 0.955020}, {0.309017, 0.951057}, {0.321439, 0.946930}, {0.333807, 0.942641}, {0.346117, 0.938191}, {0.358368, 0.933580}, {0.370557, 0.928810}, {0.382683, 0.923880}, {0.394744, 0.918791}, {0.406737, 0.913545}, {0.418660, 0.908143}, {0.430511, 0.902585}, {0.442289, 0.896873}, {0.453990, 0.891007}, {0.465615, 0.884988}, {0.477159, 0.878817}, {0.488621, 0.872496}, {0.500000, 0.866025}, {0.511293, 0.859406}, {0.522499, 0.852640}, {0.533615, 0.845728}, {0.544639, 0.838671}, {0.555570, 0.831470}, {0.566406, 0.824126}, {0.577145, 0.816642}, {0.587785, 0.809017}, {0.598325, 0.801254}, {0.608761, 0.793353}, {0.619094, 0.785317}, {0.629320, 0.777146}, {0.639439, 0.768842}, {0.649448, 0.760406}, {0.659346, 0.751840}, {0.669131, 0.743145}, {0.678801, 0.734322}, {0.688355, 0.725374}, {0.697790, 0.716302}, {0.707107, 0.707107}, {0.716302, 0.697790}, {0.725374, 0.688355}, {0.734322, 0.678801}, {0.743145, 0.669131}, {0.751840, 0.659346}, {0.760406, 0.649448}, {0.768842, 0.639439}, {0.777146, 0.629320}, {0.785317, 0.619094}, {0.793353, 0.608761}, {0.801254, 0.598325}, {0.809017, 0.587785}, {0.816642, 0.577145}, {0.824126, 0.566406}, {0.831470, 0.555570}, {0.838671, 0.544639}, {0.845728, 0.533615}, {0.852640, 0.522499}, {0.859406, 0.511293}, {0.866025, 0.500000}, {0.872496, 0.488621}, {0.878817, 0.477159}, {0.884988, 0.465615}, {0.891007, 0.453990}, {0.896873, 0.442289}, {0.902585, 0.430511}, {0.908143, 0.418660}, {0.913545, 0.406737}, {0.918791, 0.394744}, {0.923880, 0.382683}, {0.928810, 0.370557}, {0.933580, 0.358368}, {0.938191, 0.346117}, {0.942641, 0.333807}, {0.946930, 0.321439}, {0.951057, 0.309017}, {0.955020, 0.296542}, {0.958820, 0.284015}, {0.962455, 0.271440}, {0.965926, 0.258819}, {0.969231, 0.246153}, {0.972370, 0.233445}, {0.975342, 0.220697}, {0.978148, 0.207912}, {0.980785, 0.195090}, {0.983255, 0.182236}, {0.985556, 0.169350}, {0.987688, 0.156434}, {0.989651, 0.143493}, {0.991445, 0.130526}, {0.993068, 0.117537}, {0.994522, 0.104528}, {0.995805, 0.091502}, {0.996917, 0.078459}, {0.997859, 0.065403}, {0.998630, 0.052336}, {0.999229, 0.039260}, {0.999657, 0.026177}, {0.999914, 0.013090}, }; #ifndef FFT_BITREV480 #define FFT_BITREV480 -static const celt_int16 fft_bitrev480[480] = { +static const opus_int16 fft_bitrev480[480] = { 0, 120, 240, 360, 30, 150, 270, 390, 60, 180, 300, 420, 90, 210, 330, 450, 15, 135, 255, 375, 45, 165, 285, 405, 75, 195, 315, 435, 105, 225, 345, 465, 5, 125, 245, 365, 35, 155, 275, 395, 65, 185, 305, 425, 95, 215, 335, 455, 20, 140, 260, 380, 50, 170, 290, 410, 80, 200, 320, 440, 110, 230, 350, 470, 10, 130, 250, 370, 40, 160, 280, 400, 70, 190, 310, 430, 100, 220, 340, 460, 25, 145, 265, 385, 55, 175, 295, 415, 85, 205, 325, 445, 115, 235, 355, 475, 1, 121, 241, 361, 31, 151, 271, 391, 61, 181, 301, 421, 91, 211, 331, 451, 16, 136, 256, 376, 46, 166, 286, 406, 76, 196, 316, 436, 106, 226, 346, 466, 6, 126, 246, 366, 36, 156, 276, 396, 66, 186, 306, 426, 96, 216, 336, 456, 21, 141, 261, 381, 51, 171, 291, 411, 81, 201, 321, 441, 111, 231, 351, 471, 11, 131, 251, 371, 41, 161, 281, 401, 71, 191, 311, 431, 101, 221, 341, 461, 26, 146, 266, 386, 56, 176, 296, 416, 86, 206, 326, 446, 116, 236, 356, 476, 2, 122, 242, 362, 32, 152, 272, 392, 62, 182, 302, 422, 92, 212, 332, 452, 17, 137, 257, 377, 47, 167, 287, 407, 77, 197, 317, 437, 107, 227, 347, 467, 7, 127, 247, 367, 37, 157, 277, 397, 67, 187, 307, 427, 97, 217, 337, 457, 22, 142, 262, 382, 52, 172, 292, 412, 82, 202, 322, 442, 112, 232, 352, 472, 12, 132, 252, 372, 42, 162, 282, 402, 72, 192, 312, 432, 102, 222, 342, 462, 27, 147, 267, 387, 57, 177, 297, 417, 87, 207, 327, 447, 117, 237, 357, 477, 3, 123, 243, 363, 33, 153, 273, 393, 63, 183, 303, 423, 93, 213, 333, 453, 18, 138, 258, 378, 48, 168, 288, 408, 78, 198, 318, 438, 108, 228, 348, 468, 8, 128, 248, 368, 38, 158, 278, 398, 68, 188, 308, 428, 98, 218, 338, 458, 23, 143, 263, 383, 53, 173, 293, 413, 83, 203, 323, 443, 113, 233, 353, 473, 13, 133, 253, 373, 43, 163, 283, 403, 73, 193, 313, 433, 103, 223, 343, 463, 28, 148, 268, 388, 58, 178, 298, 418, 88, 208, 328, 448, 118, 238, 358, 478, 4, 124, 244, 364, 34, 154, 274, 394, 64, 184, 304, 424, 94, 214, 334, 454, 19, 139, 259, 379, 49, 169, 289, 409, 79, 199, 319, 439, 109, 229, 349, 469, 9, 129, 249, 369, 39, 159, 279, 399, 69, 189, 309, 429, 99, 219, 339, 459, 24, 144, 264, 384, 54, 174, 294, 414, 84, 204, 324, 444, 114, 234, 354, 474, 14, 134, 254, 374, 44, 164, 284, 404, 74, 194, 314, 434, 104, 224, 344, 464, 29, 149, 269, 389, 59, 179, 299, 419, 89, 209, 329, 449, 119, 239, 359, 479, }; #endif #ifndef FFT_BITREV240 #define FFT_BITREV240 -static const celt_int16 fft_bitrev240[240] = { +static const opus_int16 fft_bitrev240[240] = { 0, 60, 120, 180, 15, 75, 135, 195, 30, 90, 150, 210, 45, 105, 165, 225, 5, 65, 125, 185, 20, 80, 140, 200, 35, 95, 155, 215, 50, 110, 170, 230, 10, 70, 130, 190, 25, 85, 145, 205, 40, 100, 160, 220, 55, 115, 175, 235, 1, 61, 121, 181, 16, 76, 136, 196, 31, 91, 151, 211, 46, 106, 166, 226, 6, 66, 126, 186, 21, 81, 141, 201, 36, 96, 156, 216, 51, 111, 171, 231, 11, 71, 131, 191, 26, 86, 146, 206, 41, 101, 161, 221, 56, 116, 176, 236, 2, 62, 122, 182, 17, 77, 137, 197, 32, 92, 152, 212, 47, 107, 167, 227, 7, 67, 127, 187, 22, 82, 142, 202, 37, 97, 157, 217, 52, 112, 172, 232, 12, 72, 132, 192, 27, 87, 147, 207, 42, 102, 162, 222, 57, 117, 177, 237, 3, 63, 123, 183, 18, 78, 138, 198, 33, 93, 153, 213, 48, 108, 168, 228, 8, 68, 128, 188, 23, 83, 143, 203, 38, 98, 158, 218, 53, 113, 173, 233, 13, 73, 133, 193, 28, 88, 148, 208, 43, 103, 163, 223, 58, 118, 178, 238, 4, 64, 124, 184, 19, 79, 139, 199, 34, 94, 154, 214, 49, 109, 169, 229, 9, 69, 129, 189, 24, 84, 144, 204, 39, 99, 159, 219, 54, 114, 174, 234, 14, 74, 134, 194, 29, 89, 149, 209, 44, 104, 164, 224, 59, 119, 179, 239, }; #endif #ifndef FFT_BITREV120 #define FFT_BITREV120 -static const celt_int16 fft_bitrev120[120] = { +static const opus_int16 fft_bitrev120[120] = { 0, 30, 60, 90, 15, 45, 75, 105, 5, 35, 65, 95, 20, 50, 80, 110, 10, 40, 70, 100, 25, 55, 85, 115, 1, 31, 61, 91, 16, 46, 76, 106, 6, 36, 66, 96, 21, 51, 81, 111, 11, 41, 71, 101, 26, 56, 86, 116, 2, 32, 62, 92, 17, 47, 77, 107, 7, 37, 67, 97, 22, 52, 82, 112, 12, 42, 72, 102, 27, 57, 87, 117, 3, 33, 63, 93, 18, 48, 78, 108, 8, 38, 68, 98, 23, 53, 83, 113, 13, 43, 73, 103, 28, 58, 88, 118, 4, 34, 64, 94, 19, 49, 79, 109, 9, 39, 69, 99, 24, 54, 84, 114, 14, 44, 74, 104, 29, 59, 89, 119, }; #endif #ifndef FFT_BITREV60 #define FFT_BITREV60 -static const celt_int16 fft_bitrev60[60] = { +static const opus_int16 fft_bitrev60[60] = { 0, 15, 30, 45, 5, 20, 35, 50, 10, 25, 40, 55, 1, 16, 31, 46, 6, 21, 36, 51, 11, 26, 41, 56, 2, 17, 32, 47, 7, 22, 37, 52, 12, 27, 42, 57, 3, 18, 33, 48, 8, 23, 38, 53, 13, 28, 43, 58, 4, 19, 34, 49, 9, 24, 39, 54, 14, 29, 44, 59, }; #endif diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c index d889a5b28..5f36c0e16 100644 --- a/libcelt/testcelt.c +++ b/libcelt/testcelt.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) CELTEncoder *enc; CELTDecoder *dec; int len; - celt_int32 frame_size, channels; + opus_int32 frame_size, channels; int bytes_per_packet; unsigned char data[MAX_PACKET]; int rate; @@ -58,8 +58,8 @@ int main(int argc, char *argv[]) double rmsd = 0; #endif int count = 0; - celt_int32 skip; - celt_int16 *in, *out; + opus_int32 skip; + opus_int16 *in, *out; if (argc != 9 && argc != 8 && argc != 7) { fprintf (stderr, "Usage: testcelt <rate> <channels> <frame size> " @@ -121,8 +121,8 @@ int main(int argc, char *argv[]) celt_encoder_ctl(enc,CELT_SET_COMPLEXITY(complexity)); } - in = (celt_int16*)malloc(frame_size*channels*sizeof(celt_int16)); - out = (celt_int16*)malloc(frame_size*channels*sizeof(celt_int16)); + in = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); + out = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); while (!feof(fin)) { diff --git a/libcelt/tests/cwrs32-test.c b/libcelt/tests/cwrs32-test.c index 71e01dba1..7cbbc077b 100644 --- a/libcelt/tests/cwrs32-test.c +++ b/libcelt/tests/cwrs32-test.c @@ -32,21 +32,21 @@ int main(int _argc,char **_argv){ dk=kmax[n]>7?kmax[n]/7:1; k=1-dk; do{ - celt_uint32 uu[KMAX+2U]; - celt_uint32 inc; - celt_uint32 nc; - celt_uint32 i; + opus_uint32 uu[KMAX+2U]; + opus_uint32 inc; + opus_uint32 nc; + opus_uint32 i; k=kmax[n]-dk<k?kmax[n]:k+dk; printf("Testing CWRS with N=%i, K=%i...\n",n,k); nc=ncwrs_urow(n,k,uu); inc=nc/10000; if(inc<1)inc=1; for(i=0;i<nc;i+=inc){ - celt_uint32 u[KMAX+2U]; + opus_uint32 u[KMAX+2U]; int y[NMAX]; int yy[5]; - celt_uint32 v; - celt_uint32 ii; + opus_uint32 v; + opus_uint32 ii; int kk; int j; memcpy(u,uu,(k+2U)*sizeof(*u)); diff --git a/libcelt/tests/laplace-test.c b/libcelt/tests/laplace-test.c index 8a90797ea..2066e03a8 100644 --- a/libcelt/tests/laplace-test.c +++ b/libcelt/tests/laplace-test.c @@ -17,7 +17,7 @@ int ec_laplace_get_start_freq(int decay) { - celt_uint32 ft = 32768 - LAPLACE_MINP*(2*LAPLACE_NMIN+1); + opus_uint32 ft = 32768 - LAPLACE_MINP*(2*LAPLACE_NMIN+1); int fs = (ft*(16384-decay))/(16384+decay); return fs+LAPLACE_MINP; } diff --git a/libcelt/tests/mathops-test.c b/libcelt/tests/mathops-test.c index 23a152c0d..a55e7dd89 100644 --- a/libcelt/tests/mathops-test.c +++ b/libcelt/tests/mathops-test.c @@ -20,7 +20,7 @@ int ret = 0; void testdiv(void) { - celt_int32 i; + opus_int32 i; for (i=1;i<=327670;i++) { double prod; @@ -41,7 +41,7 @@ void testdiv(void) void testsqrt(void) { - celt_int32 i; + opus_int32 i; for (i=1;i<=1000000000;i++) { double ratio; diff --git a/libcelt/tests/type-test.c b/libcelt/tests/type-test.c index e0b1e6237..02e57f7bf 100644 --- a/libcelt/tests/type-test.c +++ b/libcelt/tests/type-test.c @@ -7,14 +7,14 @@ int main(void) { - celt_int16 i = 1; + opus_int16 i = 1; i <<= 14; if (i>>14 != 1) { fprintf(stderr, "celt_int16 isn't 16 bits\n"); return 1; } - if (sizeof(celt_int16)*2 != sizeof(celt_int32)) + if (sizeof(opus_int16)*2 != sizeof(opus_int32)) { fprintf(stderr, "16*2 != 32\n"); return 1; diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 1e5c32105..abba975a3 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -184,7 +184,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size, short pcm_buf[60*48*2]; int nb_compr_bytes; int to_celt = 0; - celt_int32 mono_rate; + opus_int32 mono_rate; if (400*frame_size != st->Fs && 200*frame_size != st->Fs && 100*frame_size != st->Fs && 50*frame_size != st->Fs && 25*frame_size != st->Fs && 50*frame_size != 3*st->Fs) @@ -203,7 +203,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size, st->stream_channels = 1; } else if (st->mode == MODE_CELT_ONLY && st->channels == 2) { - celt_int32 decision_rate; + opus_int32 decision_rate; decision_rate = st->bitrate_bps + st->voice_ratio*st->voice_ratio; /* Add some hysteresis */ if (st->stream_channels == 2) @@ -228,7 +228,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size, /* Mode selection depending on application and signal type */ if (st->user_mode==OPUS_APPLICATION_VOIP) { - celt_int32 threshold = 20000; + opus_int32 threshold = 20000; /* Hysteresis */ if (st->prev_mode == MODE_CELT_ONLY) threshold -= 4000; @@ -241,7 +241,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size, else st->mode = MODE_SILK_ONLY; } else {/* OPUS_APPLICATION_AUDIO */ - celt_int32 threshold; + opus_int32 threshold; /* SILK/CELT threshold is higher for voice than for music */ threshold = 36000; if (st->signal_type == OPUS_SIGNAL_MUSIC) diff --git a/src/test_opus.c b/src/test_opus.c index a49a5ac18..55e1c9e96 100644 --- a/src/test_opus.c +++ b/src/test_opus.c @@ -36,7 +36,7 @@ #include <string.h> #include "opus.h" #include "silk_debug.h" -#include "celt_types.h" +#include "opus_types.h" #define MAX_PACKET 1500 @@ -66,7 +66,7 @@ void print_usage( char* argv[] ) # define STR_CASEINSENSITIVE_COMPARE(x, y) strcasecmp(x, y) #endif -static void int_to_char(celt_uint32 i, unsigned char ch[4]) +static void int_to_char(opus_uint32 i, unsigned char ch[4]) { ch[0] = i>>24; ch[1] = (i>>16)&0xFF; @@ -74,10 +74,10 @@ static void int_to_char(celt_uint32 i, unsigned char ch[4]) ch[3] = i&0xFF; } -static celt_uint32 char_to_int(unsigned char ch[4]) +static opus_uint32 char_to_int(unsigned char ch[4]) { - return ((celt_uint32)ch[0]<<24) | ((celt_uint32)ch[1]<<16) - | ((celt_uint32)ch[2]<< 8) | (celt_uint32)ch[3]; + return ((opus_uint32)ch[0]<<24) | ((opus_uint32)ch[1]<<16) + | ((opus_uint32)ch[2]<< 8) | (opus_uint32)ch[3]; } int main(int argc, char *argv[]) diff --git a/src/test_opus_custom.c b/src/test_opus_custom.c index 6e26f10ab..f5e61e8c2 100644 --- a/src/test_opus_custom.c +++ b/src/test_opus_custom.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) CELTEncoder *enc; CELTDecoder *dec; int len; - celt_int32 frame_size, channels; + opus_int32 frame_size, channels; int bytes_per_packet; unsigned char data[MAX_PACKET]; int rate; @@ -58,8 +58,8 @@ int main(int argc, char *argv[]) double rmsd = 0; #endif int count = 0; - celt_int32 skip; - celt_int16 *in, *out; + opus_int32 skip; + opus_int16 *in, *out; if (argc != 9 && argc != 8 && argc != 7) { fprintf (stderr, "Usage: testcelt <rate> <channels> <frame size> " @@ -121,8 +121,8 @@ int main(int argc, char *argv[]) opus_custom_encoder_ctl(enc,CELT_SET_COMPLEXITY(complexity)); } - in = (celt_int16*)malloc(frame_size*channels*sizeof(celt_int16)); - out = (celt_int16*)malloc(frame_size*channels*sizeof(celt_int16)); + in = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); + out = (opus_int16*)malloc(frame_size*channels*sizeof(opus_int16)); while (!feof(fin)) { -- GitLab