ref: f11d6f49f951a4eda8915f3918a96701cee1dc93
parent: d583b2463cf323f97a12094ba20363c55e7bf0b9
author: Jean-Marc Valin <[email protected]>
date: Fri Apr 18 19:13:14 EDT 2008
optimisation: giving more hints to the compiler about the sizes in find_spectral_pitch()
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -259,7 +259,7 @@
st->in_mem[C*i+c] = in[C*(2*N-2*N4-st->overlap+i)+c];
}
/* Pitch analysis: we do it early to save on the peak stack space */
- find_spectral_pitch(st->fft, &st->mode->psy, in, st->out_mem, st->mode->window, st->overlap, MAX_PERIOD, 2*N-2*N4, C, &pitch_index);
+ find_spectral_pitch(st->mode, st->fft, &st->mode->psy, in, st->out_mem, st->mode->window, 2*N-2*N4, &pitch_index);
ALLOC(freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
--- a/libcelt/pitch.c
+++ b/libcelt/pitch.c
@@ -47,6 +47,7 @@
#include "psy.h"
#include "os_support.h"
#include "mathops.h"
+#include "modes.h"
#include "stack_alloc.h"
kiss_fftr_cfg pitch_state_alloc(int max_lag)
@@ -103,7 +104,7 @@
#define INPUT_SHIFT 15
-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)
+void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t * restrict x, const celt_sig_t * restrict y, const celt_word16_t * restrict window, int len, int *pitch)
{
int c, i;
VARDECL(celt_word16_t, _X);
@@ -112,6 +113,9 @@
celt_word16_t * restrict X, * restrict Y;
int n2;
int L2;
+ const int C = CHANNELS(m);
+ const int overlap = OVERLAP(m);
+ const int lag = MAX_PERIOD;
SAVE_STACK;
n2 = lag>>1;
L2 = len>>1;
--- a/libcelt/pitch.h
+++ b/libcelt/pitch.h
@@ -40,6 +40,7 @@
#include "kiss_fftr.h"
#include "psy.h"
+#include "modes.h"
kiss_fftr_cfg pitch_state_alloc(int max_lag);
void pitch_state_free(kiss_fftr_cfg st);
@@ -47,6 +48,6 @@
/** Find the optimal delay for the pitch prediction. Computation is
done in the frequency domain, both to save time and to make it
easier to apply psychoacoustic weighting */
-void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t *x, const celt_sig_t *y, const celt_word16_t *window, int overlap, int lag, int len, int C, int *pitch);
+void find_spectral_pitch(const CELTMode *m, kiss_fftr_cfg fft, const struct PsyDecay *decay, const celt_sig_t *x, const celt_sig_t *y, const celt_word16_t *window, int len, int *pitch);
#endif