Commit 17ad401c authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

defined find_max16 and overrode it for C55x

parent c2decd39
......@@ -70,4 +70,13 @@
#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(celt_word16_t *x, int len)
{
DATA max_corr16 = -VERY_LARGE16;
DATA pitch16 = 0;
maxvec((DATA *)x, len, &max_corr16, &pitch16);
return pitch16;
}
#endif /* FIXED_C5X_H */
......@@ -37,6 +37,24 @@
#include "arch.h"
#ifndef OVERRIDE_FIND_MAX16
static inline int find_max16(celt_word16_t *x, int len)
{
celt_word16_t max_corr=-VERY_LARGE16;
int i, id = 0;
for (i=0;i<len;i++)
{
if (x[i] > max_corr)
{
id = i;
max_corr = x[i];
}
}
return id;
}
#endif
#ifndef FIXED_POINT
#define celt_sqrt sqrt
......
......@@ -102,7 +102,6 @@ static void normalise16(celt_word16_t *x, int len, celt_word16_t val)
void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t * restrict x, const celt_sig_t * restrict y, const celt_word16_t * restrict window, int overlap, int lag, int len, int C, int *pitch)
{
int c, i;
celt_word32_t max_corr;
VARDECL(celt_word16_t, X);
VARDECL(celt_word16_t, Y);
VARDECL(celt_mask_t, curve);
......@@ -179,16 +178,6 @@ void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const
real16_ifft(fft, X, Y, lag);
/* The peak in the correlation gives us the pitch */
max_corr=-VERY_LARGE32;
*pitch = 0;
for (i=0;i<lag-len;i++)
{
/*printf ("%f ", xx[i]);*/
if (Y[i] > max_corr)
{
*pitch = i;
max_corr = Y[i];
}
}
*pitch = find_max16(Y, lag-len);
RESTORE_STACK;
}
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