Remove many unused defines and convert some double constants to float.

This commit is contained in:
Gregory Maxwell 2011-08-01 20:41:54 -04:00
parent d9636c5d19
commit 662587d9c5
41 changed files with 22 additions and 320 deletions

View file

@ -23,7 +23,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
#include "kiss_fft.h"
/*
Explanation of macros dealing with complex math:
@ -40,20 +39,16 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#ifdef DOUBLE_PRECISION
# define FRACBITS 31
# define SAMPPROD long long
#define SAMP_MAX 2147483647
#define TWID_MAX 32767
#define TRIG_UPSCALE 1
#define EXT32(a) (a)
#else /* DOUBLE_PRECISION */
# define FRACBITS 15
# define SAMPPROD opus_int32
#define SAMP_MAX 32767
#define TRIG_UPSCALE 1
#define EXT32(a) EXTEND32(a)
#endif /* !DOUBLE_PRECISION */
@ -65,10 +60,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); }
#endif
# define smul(a,b) ( (SAMPPROD)(a)*(b) )
# define sround( x ) (kiss_fft_scalar)( ( (x) + ((SAMPPROD)1<<(FRACBITS-1)) ) >> FRACBITS )
# define S_MUL(a,b) MULT16_32_Q15(b, a)
# define C_MUL(m,a,b) \
@ -108,13 +99,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \
}while(0)
#else /* not FIXED_POINT*/
#define EXT32(a) (a)
# define S_MUL(a,b) ( (a)*(b) )
#define C_MUL(m,a,b) \
do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
@ -131,8 +117,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
(c).i *= (s); }while(0)
#endif
#ifndef CHECK_OVERFLOW_OP
# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
#endif
@ -193,5 +177,4 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
(x)->i = TRIG_UPSCALE*celt_cos_norm((phase)-32768);\
}while(0)
#endif /* KISS_FFT_GUTS_H */

View file

@ -71,8 +71,6 @@ static inline void _celt_fatal(const char *str, const char *file, int line)
#endif
#define IMUL32(a,b) ((a)*(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. */
@ -99,30 +97,16 @@ typedef opus_val32 celt_ener;
typedef opus_val32 celt_mask;
#define Q15ONE 32767
#define Q30ONE 1073741823
#define SIG_SHIFT 12
#define NORM_SCALING 16384
#define NORM_SCALING_1 (1.f/16384.f)
#define NORM_SHIFT 14
#define ENER_SCALING 16384.f
#define ENER_SCALING_1 (1.f/16384.f)
#define ENER_SHIFT 14
#define PGAIN_SCALING 32768.f
#define PGAIN_SCALING_1 (1.f/32768.f)
#define PGAIN_SHIFT 15
#define DB_SHIFT 10
#define EPSILON 1
#define VERY_SMALL 0
#define VERY_LARGE32 ((opus_val32)2147483647)
#define VERY_LARGE16 ((opus_val16)32767)
#define Q15_ONE ((opus_val16)32767)
#define Q15_ONE_1 (1.f/32768.f)
#define SCALEIN(a) (a)
#define SCALEOUT(a) (a)
@ -147,7 +131,6 @@ typedef opus_val32 celt_mask;
#endif
#else /* FIXED_POINT */
typedef float opus_val16;
@ -160,21 +143,12 @@ typedef float celt_pgain;
typedef float celt_mask;
#define Q15ONE 1.0f
#define Q30ONE 1.0f
#define NORM_SCALING 1.f
#define NORM_SCALING_1 1.f
#define ENER_SCALING 1.f
#define ENER_SCALING_1 1.f
#define PGAIN_SCALING 1.f
#define PGAIN_SCALING_1 1.f
#define EPSILON 1e-15f
#define VERY_SMALL 1e-15f
#define VERY_LARGE32 1e15f
#define VERY_LARGE16 1e15f
#define Q15_ONE ((opus_val16)1.f)
#define Q15_ONE_1 ((opus_val16)1.f)
#define QCONST16(x,bits) (x)
#define QCONST32(x,bits) (x)
@ -187,11 +161,8 @@ typedef float celt_mask;
#define SHL16(a,shift) (a)
#define SHR32(a,shift) (a)
#define SHL32(a,shift) (a)
#define PSHR16(a,shift) (a)
#define PSHR32(a,shift) (a)
#define VSHR32(a,shift) (a)
#define SATURATE16(x,a) (x)
#define SATURATE32(x,a) (x)
#define PSHR(a,shift) (a)
#define SHR(a,shift) (a)
@ -210,21 +181,13 @@ typedef float celt_mask;
#define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b))
#define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b))
#define MULT16_32_Q11(a,b) ((a)*(b))
#define MULT16_32_Q13(a,b) ((a)*(b))
#define MULT16_32_Q14(a,b) ((a)*(b))
#define MULT16_32_Q15(a,b) ((a)*(b))
#define MULT16_32_Q16(a,b) ((a)*(b))
#define MULT16_32_P15(a,b) ((a)*(b))
#define MULT32_32_Q31(a,b) ((a)*(b))
#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
#define MULT16_16_Q11_32(a,b) ((a)*(b))
#define MULT16_16_Q13(a,b) ((a)*(b))
#define MULT16_16_Q14(a,b) ((a)*(b))
@ -234,31 +197,13 @@ typedef float celt_mask;
#define MULT16_16_P14(a,b) ((a)*(b))
#define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b))
#define PDIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b))
#define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b))
#define PDIV32(a,b) (((opus_val32)(a))/(opus_val32)(b))
#define SCALEIN(a) ((a)*CELT_SIG_SCALE)
#define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE))
#endif /* !FIXED_POINT */
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
/* 2 on TI C5x DSP */
#define BYTES_PER_CHAR 2
#define BITS_PER_CHAR 16
#define LOG2_BITS_PER_CHAR 4
#else /* CONFIG_TI_C54X */
#define BYTES_PER_CHAR 1
#define BITS_PER_CHAR 8
#define LOG2_BITS_PER_CHAR 3
#endif /* !CONFIG_TI_C54X */
#ifndef GLOBAL_STACK_SIZE
#ifdef FIXED_POINT
#define GLOBAL_STACK_SIZE 100000

View file

@ -296,10 +296,8 @@ void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_mas
renormalise_vector(X, N0<<LM, Q15ONE);
} while (++c<C);
}
}
static void intensity_stereo(const CELTMode *m, celt_norm *X, celt_norm *Y, const celt_ener *bank, int bandID, int N)
{
int i = bandID;

View file

@ -86,7 +86,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
int time_domain, int fold, int dual_stereo, int intensity, int *tf_res, int resynth,
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,

View file

@ -1180,7 +1180,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i
#ifdef FIXED_POINT
qg = ((gain1+1536)>>10)/3-1;
#else
qg = floor(.5+gain1*32/3)-1;
qg = (int)floor(.5f+gain1*32/3)-1;
#endif
qg = IMAX(0, IMIN(7, qg));
ec_enc_bit_logp(enc, 1, 1);

View file

@ -71,7 +71,6 @@ extern "C" {
/** Memory allocation has failed */
#define CELT_ALLOC_FAIL -7
/* Encoder/decoder Requests */
#define CELT_SET_COMPLEXITY_REQUEST 2
@ -122,8 +121,6 @@ extern "C" {
#define CELT_SET_END_BAND_REQUEST 10001
#define CELT_SET_END_BAND(x) CELT_SET_END_BAND_REQUEST, _celt_check_int(x)
/** Contains the state of an encoder. One encoder state is needed
for each stream. It is initialised once at the beginning of the
stream. Do *not* re-initialise the state for every frame.
@ -142,7 +139,6 @@ typedef struct CELTDecoder CELTDecoder;
bad */
typedef struct CELTMode CELTMode;
/** \defgroup codec Encoding and decoding */
/* @{ */
@ -308,7 +304,6 @@ CELT_EXPORT int celt_decode(CELTDecoder *st, const unsigned char *data, int len,
*/
CELT_EXPORT int celt_decoder_ctl(CELTDecoder * st, int request, ...);
/** Returns the English string that corresponds to an error code
* @param error Error code (negative for an error, 0 for success
* @return Constant string (must NOT be freed)
@ -317,7 +312,6 @@ CELT_EXPORT const char *celt_strerror(int error);
/* @} */
#ifdef __cplusplus
}
#endif

View file

@ -71,7 +71,6 @@ int log2_frac(opus_uint32 val, int frac)
#ifndef SMALL_FOOTPRINT
#define MASK32 (0xFFFFFFFF)
/*INV_TABLE[i] holds the multiplicative inverse of (2*i+1) mod 2**32.*/
@ -267,11 +266,6 @@ static inline opus_uint32 imusdiv32even(opus_uint32 _a,opus_uint32 _b,
#ifndef SMALL_FOOTPRINT
/*Compute U(1,_k).*/
static inline unsigned ucwrs1(int _k){
return _k?1:0;
}
/*Compute V(1,_k).*/
static inline unsigned ncwrs1(int _k){
return _k?2:1;
@ -539,7 +533,6 @@ static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y,opus_uint32 *_u){
while(++j<_n);
}
/*Returns the index of the given combination of K elements chosen from a set
of size 1 with associated sign bits.
_y: The vector of pulses, whose sum of absolute values is K.

View file

@ -38,7 +38,7 @@
#define INT16 "%d"
#define INT32 "%d"
#define FLOAT "%f"
#define FLOAT "%0.9ff"
#ifdef FIXED_POINT
#define WORD16 INT16
@ -48,7 +48,6 @@
#define WORD32 FLOAT
#endif
void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
{
int i, j, k;
@ -167,7 +166,7 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
mode->Fs, mdctSize, k);
fprintf (file, "%d,\t/* nfft */\n", mode->mdct.kfft[k]->nfft);
#ifndef FIXED_POINT
fprintf (file, "%f,\t/* scale */\n", mode->mdct.kfft[k]->scale);
fprintf (file, "%0.9ff,\t/* scale */\n", mode->mdct.kfft[k]->scale);
#endif
fprintf (file, "%d,\t/* shift */\n", mode->mdct.kfft[k]->shift);
fprintf (file, "{");

View file

@ -57,25 +57,7 @@
are just as fast, and do not require any special target architecture.
Earlier gcc versions (3.x) compiled both code to the same assembly
instructions, because of the way they represented ((_b)>(_a)) internally.*/
#define EC_MAXI(_a,_b) ((_a)-((_a)-(_b)&-((_b)>(_a))))
# define EC_MINI(_a,_b) ((_a)+((_b)-(_a)&-((_b)<(_a))))
/*This has a chance of compiling branchless, and is just as fast as the
bit-twiddling method, which is slightly less portable, since it relies on a
sign-extended rightshift, which is not guaranteed by ANSI (but present on
every relevant platform).*/
#define EC_SIGNI(_a) (((_a)>0)-((_a)<0))
/*Slightly more portable than relying on a sign-extended right-shift (which is
not guaranteed by ANSI), and just as fast, since gcc (3.x and 4.x both)
compile it into the right-shift anyway.*/
#define EC_SIGNMASK(_a) (-((_a)<0))
/*Clamps an integer into the given range.
If _a>_c, then the lower bound _a is respected over the upper bound _c (this
behavior is required to meet our documented API behavior).
_a: The lower bound.
_b: The value to clamp.
_c: The upper boud.*/
#define EC_CLAMPI(_a,_b,_c) (EC_MAXI(_a,EC_MINI(_b,_c)))
/*Count leading zeros.
This macro should only be used for implementing ec_ilog(), if it is defined.
@ -116,8 +98,6 @@ static __inline int ec_bsr(unsigned long _x){
# define EC_ILOG(_x) (EC_CLZ0-EC_CLZ(_x))
#else
int ec_ilog(opus_uint32 _v);
# define EC_ILOG(_x) (ec_ilog(_x))
#endif
#endif

View file

@ -32,8 +32,6 @@
#include "entcode.h"
#include "arch.h"
#if !defined(EC_CLZ)
int ec_ilog(opus_uint32 _v){
/*On a Pentium M, this branchless version tested as the fastest on
@ -59,7 +57,6 @@ int ec_ilog(opus_uint32 _v){
}
#endif
opus_uint32 ec_tell_frac(ec_ctx *_this){
opus_uint32 nbits;
opus_uint32 r;

View file

@ -33,8 +33,6 @@
# include <stddef.h>
# include "ecintrin.h"
/*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 opus_uint32 ec_window;
@ -42,8 +40,6 @@ typedef struct ec_ctx ec_ctx;
typedef struct ec_ctx ec_enc;
typedef struct ec_ctx ec_dec;
# define EC_WINDOW_SIZE ((int)sizeof(ec_window)*CHAR_BIT)
/*The number of bits to use for the range-coded part of unsigned integers.*/
@ -53,8 +49,6 @@ typedef struct ec_ctx ec_dec;
3 => 1/8th bits.*/
# define BITRES 3
/*The entropy encoder/decoder context.
We use the same structure for both, so that common functions like ec_tell()
can be used on either one.*/
@ -89,12 +83,6 @@ struct ec_ctx{
int error;
};
/*Shared functions.*/
static inline void ec_reset(ec_ctx *_this){
_this->offs=_this->end_offs=0;
}
static inline opus_uint32 ec_range_bytes(ec_ctx *_this){
return _this->offs;
}

View file

@ -35,8 +35,6 @@
#include "entdec.h"
#include "mfrngcod.h"
/*A range decoder.
This is an entropy decoder based upon \cite{Mar79}, which is itself a
rediscovery of the FIFO arithmetic code introduced by \cite{Pas76}.
@ -94,8 +92,6 @@
URL="http://www.stanford.edu/class/ee398/handouts/papers/Moffat98ArithmCoding.pdf"
}*/
static int ec_read_byte(ec_dec *_this){
return _this->offs<_this->storage?_this->buf[_this->offs++]:0;
}
@ -105,7 +101,6 @@ static int ec_read_byte_from_end(ec_dec *_this){
_this->buf[_this->storage-++(_this->end_offs)]:0;
}
/*Normalizes the contents of val and rng so that rng lies entirely in the
high-order symbol.*/
static void ec_dec_normalize(ec_dec *_this){
@ -144,7 +139,6 @@ void ec_dec_init(ec_dec *_this,unsigned char *_buf,opus_uint32 _storage){
_this->nbits_total=EC_CODE_BITS+1;
}
unsigned ec_decode(ec_dec *_this,unsigned _ft){
unsigned s;
_this->ext=_this->rng/_ft;

View file

@ -30,8 +30,6 @@
# include <limits.h>
# include "entcode.h"
/*Initializes the decoder.
_buf: The input buffer to use.
Return: 0 on success, or a negative value on error.*/

View file

@ -33,8 +33,6 @@
#include "entenc.h"
#include "mfrngcod.h"
/*A range encoder.
See entdec.c and the references for implementation details \cite{Mar79,MNW98}.
@ -59,8 +57,6 @@
URL="http://www.stanford.edu/class/ee398/handouts/papers/Moffat98ArithmCoding.pdf"
}*/
static int ec_write_byte(ec_enc *_this,unsigned _value){
if(_this->offs+_this->end_offs>=_this->storage)return -1;
_this->buf[_this->offs++]=(unsigned char)_value;
@ -73,7 +69,6 @@ static int ec_write_byte_at_end(ec_enc *_this,unsigned _value){
return 0;
}
/*Outputs a symbol, with a carry bit.
If there is a potential to propagate a carry over several symbols, they are
buffered until it can be determined whether or not an actual carry will

View file

@ -30,8 +30,6 @@
# include <stddef.h>
# include "entcode.h"
/*Initializes the encoder.
_buf: The buffer to store output bytes in.
_size: The size of the buffer, in chars.*/

View file

@ -70,20 +70,10 @@ static inline long IMUL32(long i, long j)
#undef MULT16_32_Q15
#define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),(b)),15))
#define celt_ilog2(x) (30 - _lnorm(x))
#define OVERRIDE_CELT_ILOG2
#define celt_maxabs16(x, len) MAX16(maxval((DATA *)x, len),-minval((DATA *)x, len))
#define OVERRIDE_CELT_MAXABS16
#define OVERRIDE_FIND_MAX16
static inline int find_max16(opus_val16 *x, int len)
{
DATA max_corr16 = -VERY_LARGE16;
DATA pitch16 = 0;
maxvec((DATA *)x, len, &max_corr16, &pitch16);
return pitch16;
}
#endif /* FIXED_C5X_H */

View file

@ -67,14 +67,4 @@
#define celt_maxabs16(x, len) MAX16(maxval((DATA *)x, len),-minval((DATA *)x, len))
#define OVERRIDE_CELT_MAXABS16
#define OVERRIDE_FIND_MAX16
static inline int find_max16(opus_val16 *x, int len)
{
DATA max_corr16 = -VERY_LARGE16;
DATA pitch16 = 0;
maxvec((DATA *)x, len, &max_corr16, &pitch16);
return pitch16;
}
#endif
#endif /* FIXED_C6X_H */

View file

@ -40,8 +40,6 @@ long long celt_mips=0;
extern long long celt_mips;
#endif
#define MIPS_INC celt_mips++,
#define MULT16_16SU(a,b) ((opus_val32)(opus_val16)(a)*(opus_val32)(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))
@ -51,7 +49,6 @@ extern long long celt_mips;
#define QCONST16(x,bits) ((opus_val16)(.5+(x)*(((opus_val32)1)<<(bits))))
#define QCONST32(x,bits) ((opus_val32)(.5+(x)*(((opus_val32)1)<<(bits))))
#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768)
#define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL)
#define VERIFY_UINT(x) ((x)<=(2147483647LLU<<1))
@ -172,13 +169,9 @@ static inline int SHL32(long long a, int shift)
return res;
}
#define PSHR16(a,shift) (celt_mips--,SHR16(ADD16((a),((1<<((shift))>>1))),shift))
#define PSHR32(a,shift) (celt_mips--,SHR32(ADD32((a),(((opus_val32)(1)<<((shift))>>1))),shift))
#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define ROUND16(x,a) (celt_mips--,EXTRACT16(PSHR32((x),(a))))
#define HALF16(x) (SHR16(x,1))
#define HALF32(x) (SHR32(x,1))
@ -286,8 +279,6 @@ static inline unsigned int _USUB32(unsigned long long a, unsigned long long b, c
return res;
}
/* result fits in 16 bits */
static inline short MULT16_16_16(int a, int b)
{
@ -319,10 +310,6 @@ static inline int _MULT16_16(int a, int b, char *file, int line)
}
#define MAC16_16(c,a,b) (celt_mips-=2,ADD32((c),MULT16_16((a),(b))))
#define MAC16_16_Q11(c,a,b) (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11))))
#define MAC16_16_Q13(c,a,b) (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13))))
#define MAC16_16_P13(c,a,b) (ADD16((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13)))
#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__)
static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
@ -344,33 +331,7 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
return res;
}
static inline int MULT16_32_PX(int a, long long b, int Q)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
{
fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
}
if (ABS32(b)>=((opus_val32)(1)<<(15+Q)))
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
res = ((((long long)a)*(long long)b) + (((opus_val32)(1)<<Q)>>1))>> Q;
if (!VERIFY_INT(res))
fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
if (Q==15)
celt_mips+=4;
else
celt_mips+=5;
return res;
}
#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11)
#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b)))
#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12)
#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13)
#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14)
#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15)
#define MAC16_32_Q15(c,a,b) (celt_mips-=2,ADD32((c),MULT16_32_Q15((a),(b))))
static inline int SATURATE(int a, int b)
@ -543,8 +504,6 @@ static inline int _DIV32(long long a, long long b, char *file, int line)
celt_mips+=70;
return res;
}
#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b)
#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b)
#undef PRINT_MIPS
#define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", celt_mips);} while (0);

View file

@ -45,11 +45,9 @@
/** 32x32 multiplication, followed by a 31-bit shift right. Results fits in 32 bits */
#define MULT32_32_Q31(a,b) ADD32(ADD32(SHL(MULT16_16(SHR((a),16),SHR((b),16)),1), SHR(MULT16_16SU(SHR((a),16),((b)&0x0000ffff)),15)), SHR(MULT16_16SU(SHR((b),16),((a)&0x0000ffff)),15))
/** 32x32 multiplication, followed by a 32-bit shift right. Results fits in 32 bits */
#define MULT32_32_Q32(a,b) ADD32(ADD32(MULT16_16(SHR((a),16),SHR((b),16)), SHR(MULT16_16SU(SHR((a),16),((b)&0x0000ffff)),16)), SHR(MULT16_16SU(SHR((b),16),((a)&0x0000ffff)),16))
/** Compile-time conversion of float constant to 16-bit value */
#define QCONST16(x,bits) ((opus_val16)(.5+(x)*(((opus_val32)1)<<(bits))))
/** Compile-time conversion of float constant to 32-bit value */
#define QCONST32(x,bits) ((opus_val32)(.5+(x)*(((opus_val32)1)<<(bits))))
@ -72,18 +70,11 @@
/** Arithmetic shift-left of a 32-bit value */
#define SHL32(a,shift) ((opus_val32)(a) << (shift))
/** 16-bit arithmetic shift right with rounding-to-nearest instead of rounding down */
#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
/** 32-bit arithmetic shift right with rounding-to-nearest instead of rounding down */
#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
/** 32-bit arithmetic shift right where the argument can be negative */
#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
/** Saturates 16-bit value to +/- a */
#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
/** Saturates 32-bit value to +/- a */
#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
/** "RAW" macros, should not be used outside of this header file */
#define SHR(a,shift) ((a) >> (shift))
#define SHL(a,shift) ((opus_val32)(a) << (shift))
@ -105,7 +96,6 @@
/** Subtract two 32-bit values */
#define SUB32(a,b) ((opus_val32)(a)-(opus_val32)(b))
/** 16x16 multiplication where the result fits in 16 bits */
#define MULT16_16_16(a,b) ((((opus_val16)(a))*((opus_val16)(b))))
@ -115,28 +105,9 @@
/** 16x16 multiply-add where the result fits in 32 bits */
#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
/** 16x32 multiplication, followed by a 12-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
/** 16x32 multiplication, followed by a 13-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
/** 16x32 multiplication, followed by a 14-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
/** 16x32 multiplication, followed by an 11-bit shift right. Results fits in 32 bits */
#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
/** 16x32 multiply-add, followed by an 11-bit shift right. Results fits in 32 bits */
#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
/** 16x32 multiplication, followed by a 15-bit shift right (round-to-nearest). Results fits in 32 bits */
#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
/** 16x32 multiply-add, followed by a 15-bit shift right. Results fits in 32 bits */
#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
@ -148,11 +119,8 @@
/** Divide a 32-bit value by a 16-bit value. Result fits in 16 bits */
#define DIV32_16(a,b) ((opus_val16)(((opus_val32)(a))/((opus_val16)(b))))
/** Divide a 32-bit value by a 16-bit value and round to nearest. Result fits in 16 bits */
#define PDIV32_16(a,b) ((opus_val16)(((opus_val32)(a)+((opus_val16)(b)>>1))/((opus_val16)(b))))
/** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */
#define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b)))
/** Divide a 32-bit value by a 32-bit value and round to nearest. Result fits in 32 bits */
#define PDIV32(a,b) (((opus_val32)(a)+((opus_val16)(b)>>1))/((opus_val32)(b)))
#endif

View file

@ -95,7 +95,6 @@
return _mm_cvtss_si32(_mm_load_ss(&value));
}
#elif (defined (WIN32) || defined (_WIN32))
#include <math.h>
/* Win32 doesn't seem to have these functions.
@ -120,12 +119,8 @@
#warning "Don't have the functions lrint() and lrintf ()."
#warning "Replacing these functions with a standard C cast."
#endif /* __GNUC__ */
#include <math.h>
#define float2int(flt) ((int)(floor(.5+flt)))
#endif
#endif /* FLOAT_CAST_H */

View file

@ -292,7 +292,6 @@ static void ki_bfly3(
}
}
static void kf_bfly5(
kiss_fft_cpx * Fout,
const size_t fstride,
@ -462,7 +461,6 @@ static void kf_work(
}
}
static void ki_work(
kiss_fft_cpx * Fout,
const kiss_fft_cpx * f,
@ -493,7 +491,6 @@ static void ki_work(
}
}
#ifdef CUSTOM_MODES
static
@ -529,7 +526,6 @@ void compute_bitrev_table(
}
}
/* facbuf is populated by p1,m1,p2,m2, ...
where
p[i] * m[i] = m[i-1]
@ -582,7 +578,6 @@ static void compute_twiddles(kiss_twiddle_cpx *twiddles, int nfft)
#endif
}
/*
*
* User-callable function to allocate all necessary storage space for the fft.

View file

@ -14,7 +14,6 @@ Redistribution and use in source and binary forms, with or without modification,
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KISS_FFT_H
#define KISS_FFT_H
@ -47,7 +46,6 @@ extern "C" {
#define KISS_FFT_MALLOC celt_alloc
#endif
#ifdef FIXED_POINT
#include "arch.h"
#define DOUBLE_PRECISION
@ -157,7 +155,6 @@ void kiss_ifft(const kiss_fft_state *cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *f
void kiss_fft_free(const kiss_fft_state *cfg);
#ifdef __cplusplus
}
#endif

View file

@ -90,7 +90,6 @@ void ec_laplace_encode(ec_enc *enc, int *value, int fs, int decay)
ec_encode_bin(enc, fl, fl+fs, 15);
}
int ec_laplace_decode(ec_dec *dec, int fs, int decay)
{
int val=0;

View file

@ -48,7 +48,6 @@ unsigned isqrt32(opus_uint32 _val);
#define celt_sqrt(x) ((float)sqrt(x))
#define celt_rsqrt(x) (1.f/celt_sqrt(x))
#define celt_rsqrt_norm(x) (celt_rsqrt(x))
#define celt_acos acos
#define celt_exp exp
#define celt_cos_norm(x) ((float)cos((.5f*M_PI)*(x)))
#define celt_atan atan
@ -106,8 +105,6 @@ static inline float celt_exp2(float x)
#endif
#ifdef FIXED_POINT
#include "os_support.h"
@ -121,7 +118,6 @@ static inline opus_int16 celt_ilog2(opus_int32 x)
}
#endif
#ifndef OVERRIDE_CELT_MAXABS16
static inline opus_val16 celt_maxabs16(opus_val16 *x, int len)
{
@ -145,7 +141,6 @@ opus_val32 celt_sqrt(opus_val32 x);
opus_val16 celt_cos_norm(opus_val32 x);
static inline opus_val16 celt_log2(opus_val32 x)
{
int i;
@ -229,6 +224,4 @@ static inline opus_val16 celt_atan2p(opus_val16 y, opus_val16 x)
}
#endif /* FIXED_POINT */
#endif /* MATHOPS_H */

View file

@ -53,9 +53,7 @@
#include "mathops.h"
#include "stack_alloc.h"
#ifndef M_PI
#define M_PI 3.141592653
#endif
#define PI 3.141592653f
#ifdef CUSTOM_MODES
@ -119,7 +117,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar
#ifdef FIXED_POINT
sine = TRIG_UPSCALE*(QCONST16(0.7853981f, 15)+N2)/N;
#else
sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N;
sine = (kiss_twiddle_scalar)2*PI*(.125f)/N;
#endif
/* Consider the input to be composed of four blocks: [a, b, c, d] */
@ -206,7 +204,6 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar
RESTORE_STACK;
}
void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out, const opus_val16 * restrict window, int overlap, int shift)
{
int i;
@ -225,7 +222,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
#ifdef FIXED_POINT
sine = TRIG_UPSCALE*(QCONST16(0.7853981f, 15)+N2)/N;
#else
sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N;
sine = (kiss_twiddle_scalar)2*PI*(.125f)/N;
#endif
/* Pre-rotate */
@ -330,5 +327,3 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
}
RESTORE_STACK;
}

View file

@ -43,14 +43,6 @@
# 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 (((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 ((((opus_uint32)1U)<<EC_CODE_BITS-1)-1<<1|1)
#endif

View file

@ -73,7 +73,6 @@ static const unsigned char band_allocation[] = {
#define M_PI 3.141592653
#endif
#ifdef CUSTOM_MODES
/* Defining 25 critical bands for the full 0-20 kHz audio bandwidth

View file

@ -37,8 +37,6 @@
#include "entenc.h"
#include "entdec.h"
#define CELT_BITSTREAM_VERSION 0x80000010
#define MAX_PERIOD 1024
#ifndef CHANNELS

View file

@ -156,5 +156,4 @@
#define opus_uint64 unsigned long long
#define opus_uint8 unsigned char
#endif /* _OPUS_TYPES_H */

View file

@ -42,7 +42,7 @@
/** CELT wrapper for calloc(). To do your own dynamic allocation, all you need to do is replace this function, celt_realloc and celt_free
NOTE: celt_alloc needs to CLEAR THE MEMORY */
#ifndef OVERRIDE_CELT_ALLOC
static inline void *celt_alloc (int size)
static inline void *celt_alloc (size_t size)
{
/* WARNING: this is not equivalent to malloc(). If you want to use malloc()
or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
@ -53,7 +53,7 @@ static inline void *celt_alloc (int size)
/** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */
#ifndef OVERRIDE_CELT_ALLOC_SCRATCH
static inline void *celt_alloc_scratch (int size)
static inline void *celt_alloc_scratch (size_t size)
{
/* Scratch space doesn't need to be cleared */
return calloc(size,1);
@ -68,14 +68,6 @@ static inline void celt_free (void *ptr)
}
#endif
/** Same as celt_free(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */
#ifndef OVERRIDE_CELT_FREE_SCRATCH
static inline void celt_free_scratch (void *ptr)
{
free(ptr);
}
#endif
/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking */
#ifndef OVERRIDE_CELT_COPY
#define CELT_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))

View file

@ -31,7 +31,6 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -279,7 +278,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
g = g0 = VSHR32(MULT16_32_Q15(celt_rsqrt_norm(t), xy),sh+1);
}
#else
g = g0 = xy/sqrt(1+xx*yy);
g = g0 = xy/celt_sqrt(1+xx*yy);
#endif
/* Look for any pitch at T/k */
for (k=2;k<=15;k++)
@ -320,7 +319,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
g1 = VSHR32(MULT16_32_Q15(celt_rsqrt_norm(t), xy),sh+1);
}
#else
g1 = xy/sqrt(1+2.f*xx*1.f*yy);
g1 = xy/celt_sqrt(1+2.f*xx*1.f*yy);
#endif
if (abs(T1-prev_period)<=1)
cont = prev_gain;

View file

@ -31,7 +31,6 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PITCH_H
#define _PITCH_H

View file

@ -33,9 +33,6 @@
#include "stack_alloc.h"
#include "mathops.h"
void _celt_lpc(
opus_val16 *_lpc, /* out: [0...p-1] LPC coefficients */
const opus_val32 *ac, /* in: [0...p] autocorrelation values */

View file

@ -48,8 +48,6 @@ void iir(const opus_val32 *x,
int ord,
opus_val16 *mem);
void _celt_autocorr(const opus_val16 *x, opus_val32 *ac, const opus_val16 *window, int overlap, int lag, int n);
#endif /* PLC_H */

View file

@ -432,7 +432,6 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol
opus_int32 budget;
opus_int32 tell;
if (intra)
{
coef = 0;

View file

@ -39,7 +39,6 @@
#include "entcode.h"
#include "rate.h"
static const unsigned char LOG2_FRAC_TABLE[24]={
0,
8,13,
@ -244,7 +243,6 @@ void compute_pulse_cache(CELTMode *m, int LM)
#endif /* CUSTOM_MODES */
#define ALLOC_STEPS 6
static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start,

View file

@ -40,8 +40,6 @@
#define QTHETA_OFFSET 4
#define QTHETA_OFFSET_TWOPHASE 16
#define BITOVERFLOW 30000
#include "cwrs.h"
#include "modes.h"
@ -103,5 +101,4 @@ opus_int16 **compute_alloc_cache(CELTMode *m, int M);
int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stero,
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

View file

@ -81,7 +81,6 @@
* @param type Type of element
*/
#if defined(VAR_ARRAYS)
#define VARDECL(type, var)
@ -143,5 +142,4 @@ extern char *global_stack_top;
#endif /*VAR_ARRAYS*/
#endif /*STACK_ALLOC_H*/

File diff suppressed because one or more lines are too long

View file

@ -38,10 +38,6 @@
#include "bands.h"
#include "rate.h"
#ifndef M_PI
#define M_PI 3.141592653
#endif
static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s)
{
int i;
@ -333,7 +329,6 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
return collapse_mask;
}
/** Decode pulse vector and combine the result with the pitch vector to produce
the final normalised signal in the current band. */
unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B,

View file

@ -36,7 +36,7 @@ void silk_LTP_scale_ctrl_FLP(
/* 1st order high-pass filter */
//g_HP(n) = g(n) - 0.5 * g(n-1) + 0.5 * g_HP(n-1);
psEnc->HPLTPredCodGain = SKP_max_float( psEncCtrl->LTPredCodGain - 0.5 * psEnc->prevLTPredCodGain, 0.0f )
psEnc->HPLTPredCodGain = SKP_max_float( psEncCtrl->LTPredCodGain - 0.5f * psEnc->prevLTPredCodGain, 0.0f )
+ 0.5f * psEnc->HPLTPredCodGain;
psEnc->prevLTPredCodGain = psEncCtrl->LTPredCodGain;