applying the pitch windowing directly in find_spectral_pitch()
This commit is contained in:
parent
05080b4b9b
commit
137ec8e9b8
3 changed files with 17 additions and 7 deletions
|
@ -291,15 +291,15 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i
|
|||
mask[i] = 1/(.1+mask[i]);
|
||||
#endif
|
||||
/* Pitch analysis */
|
||||
for (c=0;c<C;c++)
|
||||
/*for (c=0;c<C;c++)
|
||||
{
|
||||
for (i=0;i<st->overlap;i++)
|
||||
{
|
||||
in[C*i+c] = MULT16_32_Q15(st->mode->window[i], in[C*i+c]);
|
||||
in[C*(B*N+N-i-2*N4-1)+c] = MULT16_32_Q15(st->mode->window[i], in[C*(B*N+N-i-2*N4-1)+c]);
|
||||
}
|
||||
}
|
||||
find_spectral_pitch(st->fft, &st->psy, in, st->out_mem, MAX_PERIOD, (B+1)*N-2*N4, C, &pitch_index);
|
||||
}*/
|
||||
find_spectral_pitch(st->fft, &st->psy, in, st->out_mem, st->mode->window, st->overlap, MAX_PERIOD, (B+1)*N-2*N4, C, &pitch_index);
|
||||
|
||||
/* Deferred allocation after find_spectral_pitch() to reduce the peak memory usage */
|
||||
ALLOC(X, B*C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "_kiss_fft_guts.h"
|
||||
#include "kiss_fftr.h"
|
||||
|
||||
void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, int lag, int len, int C, int *pitch)
|
||||
void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, celt_word16_t *window, int overlap, int lag, int len, int C, int *pitch)
|
||||
{
|
||||
int c, i;
|
||||
float max_corr;
|
||||
|
@ -54,8 +54,10 @@ void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *
|
|||
VARDECL(celt_word32_t *Y);
|
||||
VARDECL(celt_mask_t *curve);
|
||||
int n2;
|
||||
int L2;
|
||||
SAVE_STACK;
|
||||
n2 = lag/2;
|
||||
L2 = len/2;
|
||||
ALLOC(X, lag, celt_word32_t);
|
||||
ALLOC(curve, n2, celt_mask_t);
|
||||
|
||||
|
@ -63,12 +65,20 @@ void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *
|
|||
X[i] = 0;
|
||||
for (c=0;c<C;c++)
|
||||
{
|
||||
for (i=0;i<len/2;i++)
|
||||
for (i=0;i<L2;i++)
|
||||
{
|
||||
X[2*fft->substate->bitrev[i]] += SHR32(x[C*(2*i)+c],1);
|
||||
X[2*fft->substate->bitrev[i]+1] += SHR32(x[C*(2*i+1)+c],1);
|
||||
}
|
||||
}
|
||||
for (i=0;i<overlap/2;i++)
|
||||
{
|
||||
X[2*fft->substate->bitrev[i]] = MULT16_32_Q15(window[2*i], X[2*fft->substate->bitrev[i]]);
|
||||
X[2*fft->substate->bitrev[i]+1] = MULT16_32_Q15(window[2*i+1], X[2*fft->substate->bitrev[i]+1]);
|
||||
X[2*fft->substate->bitrev[len-i-1]] = MULT16_32_Q15(window[2*i], X[2*fft->substate->bitrev[len-i-1]]);
|
||||
X[2*fft->substate->bitrev[len-i-1]+1] = MULT16_32_Q15(window[2*i+1], X[2*fft->substate->bitrev[len-i-1]+1]);
|
||||
}
|
||||
|
||||
kf_work((kiss_fft_cpx*)X, NULL, 1,1, fft->substate->factors,fft->substate, 1, 1, 1);
|
||||
kiss_fftr_twiddles(fft,X);
|
||||
|
||||
|
@ -80,7 +90,7 @@ void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *
|
|||
Y[i] = 0;
|
||||
for (c=0;c<C;c++)
|
||||
{
|
||||
for (i=0;i<lag/2;i++)
|
||||
for (i=0;i<n2;i++)
|
||||
{
|
||||
Y[2*fft->substate->bitrev[i]] += SHR32(y[C*(2*i)+c],1);
|
||||
Y[2*fft->substate->bitrev[i]+1] += SHR32(y[C*(2*i+1)+c],1);
|
||||
|
|
|
@ -44,6 +44,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, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, int lag, int len, int C, int *pitch);
|
||||
void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *x, celt_sig_t *y, celt_word16_t *window, int overlap, int lag, int len, int C, int *pitch);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue