mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Minor optimization
This commit is contained in:
parent
e010f8fcc3
commit
50bb07a6f5
@ -425,53 +425,6 @@ void imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute MDCT of size N = 2^nbits
|
||||
* @param input N samples
|
||||
* @param out N/2 samples
|
||||
*/
|
||||
void mdct_calc(FFTContext *s, FFTSample *out, const FFTSample *input)
|
||||
{
|
||||
int i, j, n, n8, n4, n2, n3;
|
||||
FFTDouble re, im;
|
||||
const uint16_t *revtab = s->revtab;
|
||||
const FFTSample *tcos = s->tcos;
|
||||
const FFTSample *tsin = s->tsin;
|
||||
FFTComplex *x = (FFTComplex *)out;
|
||||
|
||||
n = 1 << s->mdct_bits;
|
||||
n2 = n >> 1;
|
||||
n4 = n >> 2;
|
||||
n8 = n >> 3;
|
||||
n3 = 3 * n4;
|
||||
|
||||
/* pre rotation */
|
||||
for (i = 0; i < n8; i++) {
|
||||
re = (-input[2 * i + n3] - input[n3 - 1 - 2 * i]);
|
||||
im = (-input[n4 + 2 * i] + input[n4 - 1 - 2 * i]);
|
||||
j = revtab[i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
|
||||
|
||||
re = (input[2 * i] - input[n2 - 1 - 2 * i]);
|
||||
im = (-input[n2 + 2 * i] - input[n - 1 - 2 * i]);
|
||||
j = revtab[n8 + i];
|
||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
|
||||
}
|
||||
|
||||
fft_calc(s, x);
|
||||
|
||||
/* post rotation */
|
||||
for (i = 0; i < n8; i++) {
|
||||
FFTSample r0, i0, r1, i1;
|
||||
CMUL(i1, r0, x[n8 - i - 1].re, x[n8 - i - 1].im, -tsin[n8 - i - 1], -tcos[n8 - i - 1]);
|
||||
CMUL(i0, r1, x[n8 + i].re, x[n8 + i].im, -tsin[n8 + i], -tcos[n8 + i]);
|
||||
x[n8 - i - 1].re = r0;
|
||||
x[n8 - i - 1].im = i0;
|
||||
x[n8 + i].re = r1;
|
||||
x[n8 + i].im = i1;
|
||||
}
|
||||
}
|
||||
|
||||
void ff_mdct_end(FFTContext *s)
|
||||
{
|
||||
av_freep(&s->tcos);
|
||||
|
@ -72,7 +72,6 @@ void fft_permute(struct FFTContext *s, FFTComplex *z);
|
||||
void fft_calc(struct FFTContext *s, FFTComplex *z);
|
||||
void imdct_calc(struct FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void imdct_half(struct FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void mdct_calc(struct FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
|
||||
#define COSTABLE(size) \
|
||||
DECLARE_ALIGNED(32, FFTSample, av_cos_##size)[size/2]
|
||||
|
Loading…
Reference in New Issue
Block a user