Originally committed as revision 2882 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
@@ -508,17 +508,17 @@ typedef struct FFTContext { | |||||
void (*fft_calc)(struct FFTContext *s, FFTComplex *z); | void (*fft_calc)(struct FFTContext *s, FFTComplex *z); | ||||
} FFTContext; | } FFTContext; | ||||
int fft_init(FFTContext *s, int nbits, int inverse); | |||||
void fft_permute(FFTContext *s, FFTComplex *z); | |||||
void fft_calc_c(FFTContext *s, FFTComplex *z); | |||||
void fft_calc_sse(FFTContext *s, FFTComplex *z); | |||||
void fft_calc_altivec(FFTContext *s, FFTComplex *z); | |||||
int ff_fft_init(FFTContext *s, int nbits, int inverse); | |||||
void ff_fft_permute(FFTContext *s, FFTComplex *z); | |||||
void ff_fft_calc_c(FFTContext *s, FFTComplex *z); | |||||
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z); | |||||
void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z); | |||||
static inline void fft_calc(FFTContext *s, FFTComplex *z) | |||||
static inline void ff_fft_calc(FFTContext *s, FFTComplex *z) | |||||
{ | { | ||||
s->fft_calc(s, z); | s->fft_calc(s, z); | ||||
} | } | ||||
void fft_end(FFTContext *s); | |||||
void ff_fft_end(FFTContext *s); | |||||
/* MDCT computation */ | /* MDCT computation */ | ||||
@@ -198,7 +198,7 @@ int main(int argc, char **argv) | |||||
printf("IFFT"); | printf("IFFT"); | ||||
else | else | ||||
printf("FFT"); | printf("FFT"); | ||||
fft_init(s, fft_nbits, do_inverse); | |||||
ff_fft_init(s, fft_nbits, do_inverse); | |||||
fft_ref_init(fft_nbits, do_inverse); | fft_ref_init(fft_nbits, do_inverse); | ||||
} | } | ||||
printf(" %d test\n", fft_size); | printf(" %d test\n", fft_size); | ||||
@@ -227,8 +227,8 @@ int main(int argc, char **argv) | |||||
} | } | ||||
} else { | } else { | ||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex)); | memcpy(tab, tab1, fft_size * sizeof(FFTComplex)); | ||||
fft_permute(s, tab); | |||||
fft_calc(s, tab); | |||||
ff_fft_permute(s, tab); | |||||
ff_fft_calc(s, tab); | |||||
fft_ref(tab_ref, tab1, fft_nbits); | fft_ref(tab_ref, tab1, fft_nbits); | ||||
check_diff((float *)tab_ref, (float *)tab, fft_size * 2); | check_diff((float *)tab_ref, (float *)tab, fft_size * 2); | ||||
@@ -254,7 +254,7 @@ int main(int argc, char **argv) | |||||
} | } | ||||
} else { | } else { | ||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex)); | memcpy(tab, tab1, fft_size * sizeof(FFTComplex)); | ||||
fft_calc(s, tab); | |||||
ff_fft_calc(s, tab); | |||||
} | } | ||||
} | } | ||||
duration = gettime() - time_start; | duration = gettime() - time_start; | ||||
@@ -271,7 +271,7 @@ int main(int argc, char **argv) | |||||
if (do_mdct) { | if (do_mdct) { | ||||
ff_mdct_end(m); | ff_mdct_end(m); | ||||
} else { | } else { | ||||
fft_end(s); | |||||
ff_fft_end(s); | |||||
} | } | ||||
return 0; | return 0; | ||||
} | } |
@@ -28,7 +28,7 @@ | |||||
* The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is | * The size of the FFT is 2^nbits. If inverse is TRUE, inverse FFT is | ||||
* done | * done | ||||
*/ | */ | ||||
int fft_init(FFTContext *s, int nbits, int inverse) | |||||
int ff_fft_init(FFTContext *s, int nbits, int inverse) | |||||
{ | { | ||||
int i, j, m, n; | int i, j, m, n; | ||||
float alpha, c1, s1, s2; | float alpha, c1, s1, s2; | ||||
@@ -53,7 +53,7 @@ int fft_init(FFTContext *s, int nbits, int inverse) | |||||
s->exptab[i].re = c1; | s->exptab[i].re = c1; | ||||
s->exptab[i].im = s1; | s->exptab[i].im = s1; | ||||
} | } | ||||
s->fft_calc = fft_calc_c; | |||||
s->fft_calc = ff_fft_calc_c; | |||||
s->exptab1 = NULL; | s->exptab1 = NULL; | ||||
/* compute constant table for HAVE_SSE version */ | /* compute constant table for HAVE_SSE version */ | ||||
@@ -94,9 +94,9 @@ int fft_init(FFTContext *s, int nbits, int inverse) | |||||
} while (nblocks != 0); | } while (nblocks != 0); | ||||
av_freep(&s->exptab); | av_freep(&s->exptab); | ||||
#if defined(HAVE_MMX) | #if defined(HAVE_MMX) | ||||
s->fft_calc = fft_calc_sse; | |||||
s->fft_calc = ff_fft_calc_sse; | |||||
#else | #else | ||||
s->fft_calc = fft_calc_altivec; | |||||
s->fft_calc = ff_fft_calc_altivec; | |||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
@@ -142,11 +142,11 @@ int fft_init(FFTContext *s, int nbits, int inverse) | |||||
} | } | ||||
/** | /** | ||||
* Do a complex FFT with the parameters defined in fft_init(). The | |||||
* Do a complex FFT with the parameters defined in ff_fft_init(). The | |||||
* input data must be permuted before with s->revtab table. No | * input data must be permuted before with s->revtab table. No | ||||
* 1.0/sqrt(n) normalization is done. | * 1.0/sqrt(n) normalization is done. | ||||
*/ | */ | ||||
void fft_calc_c(FFTContext *s, FFTComplex *z) | |||||
void ff_fft_calc_c(FFTContext *s, FFTComplex *z) | |||||
{ | { | ||||
int ln = s->nbits; | int ln = s->nbits; | ||||
int j, np, np2; | int j, np, np2; | ||||
@@ -221,9 +221,9 @@ void fft_calc_c(FFTContext *s, FFTComplex *z) | |||||
} | } | ||||
/** | /** | ||||
* Do the permutation needed BEFORE calling fft_calc() | |||||
* Do the permutation needed BEFORE calling ff_fft_calc() | |||||
*/ | */ | ||||
void fft_permute(FFTContext *s, FFTComplex *z) | |||||
void ff_fft_permute(FFTContext *s, FFTComplex *z) | |||||
{ | { | ||||
int j, k, np; | int j, k, np; | ||||
FFTComplex tmp; | FFTComplex tmp; | ||||
@@ -241,7 +241,7 @@ void fft_permute(FFTContext *s, FFTComplex *z) | |||||
} | } | ||||
} | } | ||||
void fft_end(FFTContext *s) | |||||
void ff_fft_end(FFTContext *s) | |||||
{ | { | ||||
av_freep(&s->revtab); | av_freep(&s->revtab); | ||||
av_freep(&s->exptab); | av_freep(&s->exptab); | ||||
@@ -42,7 +42,7 @@ static void print_v4sf(const char *str, __m128 a) | |||||
#endif | #endif | ||||
/* XXX: handle reverse case */ | /* XXX: handle reverse case */ | ||||
void fft_calc_sse(FFTContext *s, FFTComplex *z) | |||||
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) | |||||
{ | { | ||||
int ln = s->nbits; | int ln = s->nbits; | ||||
int j, np, np2; | int j, np, np2; | ||||
@@ -48,7 +48,7 @@ int ff_mdct_init(MDCTContext *s, int nbits, int inverse) | |||||
s->tcos[i] = -cos(alpha); | s->tcos[i] = -cos(alpha); | ||||
s->tsin[i] = -sin(alpha); | s->tsin[i] = -sin(alpha); | ||||
} | } | ||||
if (fft_init(&s->fft, s->nbits - 2, inverse) < 0) | |||||
if (ff_fft_init(&s->fft, s->nbits - 2, inverse) < 0) | |||||
goto fail; | goto fail; | ||||
return 0; | return 0; | ||||
fail: | fail: | ||||
@@ -98,7 +98,7 @@ void ff_imdct_calc(MDCTContext *s, FFTSample *output, | |||||
in1 += 2; | in1 += 2; | ||||
in2 -= 2; | in2 -= 2; | ||||
} | } | ||||
fft_calc(&s->fft, z); | |||||
ff_fft_calc(&s->fft, z); | |||||
/* post rotation + reordering */ | /* post rotation + reordering */ | ||||
/* XXX: optimize */ | /* XXX: optimize */ | ||||
@@ -155,7 +155,7 @@ void ff_mdct_calc(MDCTContext *s, FFTSample *out, | |||||
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); | CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); | ||||
} | } | ||||
fft_calc(&s->fft, x); | |||||
ff_fft_calc(&s->fft, x); | |||||
/* post rotation */ | /* post rotation */ | ||||
for(i=0;i<n4;i++) { | for(i=0;i<n4;i++) { | ||||
@@ -171,5 +171,5 @@ void ff_mdct_end(MDCTContext *s) | |||||
{ | { | ||||
av_freep(&s->tcos); | av_freep(&s->tcos); | ||||
av_freep(&s->tsin); | av_freep(&s->tsin); | ||||
fft_end(&s->fft); | |||||
ff_fft_end(&s->fft); | |||||
} | } |
@@ -46,7 +46,7 @@ int mm_support(void) | |||||
unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; | unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; | ||||
/* list below must match enum in dsputil_ppc.h */ | /* list below must match enum in dsputil_ppc.h */ | ||||
static unsigned char* perfname[] = { | static unsigned char* perfname[] = { | ||||
"fft_calc_altivec", | |||||
"ff_fft_calc_altivec", | |||||
"gmc1_altivec", | "gmc1_altivec", | ||||
"dct_unquantize_h263_altivec", | "dct_unquantize_h263_altivec", | ||||
"fdct_altivec", | "fdct_altivec", | ||||
@@ -50,7 +50,7 @@ | |||||
/** | /** | ||||
* Do a complex FFT with the parameters defined in fft_init(). The | |||||
* Do a complex FFT with the parameters defined in ff_fft_init(). The | |||||
* input data must be permuted before with s->revtab table. No | * input data must be permuted before with s->revtab table. No | ||||
* 1.0/sqrt(n) normalization is done. | * 1.0/sqrt(n) normalization is done. | ||||
* AltiVec-enabled | * AltiVec-enabled | ||||
@@ -60,7 +60,7 @@ | |||||
* that successive MUL + ADD/SUB have been merged into | * that successive MUL + ADD/SUB have been merged into | ||||
* fused multiply-add ('vec_madd' in altivec) | * fused multiply-add ('vec_madd' in altivec) | ||||
*/ | */ | ||||
void fft_calc_altivec(FFTContext *s, FFTComplex *z) | |||||
void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z) | |||||
{ | { | ||||
POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); | POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); | ||||
#ifdef ALTIVEC_USE_REFERENCE_C_CODE | #ifdef ALTIVEC_USE_REFERENCE_C_CODE | ||||