Commit 9901cb9e authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

fixed-point: defined celt_maxabs16() as basic operator

parent 948dabc7
......@@ -64,8 +64,10 @@
#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) MAX16(maxval((DATA *)x, len),-minval((DATA *)x, len))
#define OVERRIDE_CELT_MAXABS16
#endif /* FIXED_C5X_H */
......@@ -64,6 +64,16 @@ static inline celt_int16_t celt_ilog2(celt_word32_t x)
}
#endif
#ifndef OVERRIDE_CELT_MAXABS16
static inline celt_word16_t celt_maxabs16(celt_word16_t *x, int len)
{
int i;
celt_word16_t maxval = 0;
for (i=0;i<len;i++)
maxval = MAX16(maxval, ABS16(x[i]));
return maxval;
}
#endif
/** Integer log in base2. Defined for zero, but not for negative numbers */
static inline celt_int16_t celt_zlog2(celt_word32_t x)
......
......@@ -63,9 +63,8 @@ void pitch_state_free(kiss_fftr_cfg st)
static void normalise16(celt_word16_t *x, int len, celt_word16_t val)
{
int i;
celt_word16_t maxval = 0;
for (i=0;i<len;i++)
maxval = MAX16(maxval, ABS16(x[i]));
celt_word16_t maxval;
maxval = celt_maxabs16(x,len);
if (maxval > val)
{
int shift = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment