Commit 2881c831 authored by Måns Rullgård's avatar Måns Rullgård

Call rdft by function pointer

Call the RDFT by a function pointer like other FFT related transforms.
This makes instruction set optimized versions possible.

Based on patch by Alex Converse.

Originally committed as revision 22609 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b297129b
...@@ -196,6 +196,7 @@ struct RDFTContext { ...@@ -196,6 +196,7 @@ struct RDFTContext {
const FFTSample *tcos; const FFTSample *tcos;
SINTABLE_CONST FFTSample *tsin; SINTABLE_CONST FFTSample *tsin;
FFTContext fft; FFTContext fft;
void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
}; };
/** /**
...@@ -204,9 +205,13 @@ struct RDFTContext { ...@@ -204,9 +205,13 @@ struct RDFTContext {
* @param trans the type of transform * @param trans the type of transform
*/ */
int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans); int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
void ff_rdft_calc(RDFTContext *s, FFTSample *data);
void ff_rdft_end(RDFTContext *s); void ff_rdft_end(RDFTContext *s);
static av_always_inline void ff_rdft_calc(RDFTContext *s, FFTSample *data)
{
s->rdft_calc(s, data);
}
/* Discrete Cosine Transform */ /* Discrete Cosine Transform */
struct DCTContext { struct DCTContext {
......
...@@ -50,6 +50,8 @@ SINTABLE_CONST FFTSample * const ff_sin_tabs[] = { ...@@ -50,6 +50,8 @@ SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
}; };
static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data);
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
{ {
int n = 1 << nbits; int n = 1 << nbits;
...@@ -74,6 +76,7 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) ...@@ -74,6 +76,7 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
s->tsin[i] = sin(i*theta); s->tsin[i] = sin(i*theta);
} }
#endif #endif
s->rdft_calc = ff_rdft_calc_c;
return 0; return 0;
} }
...@@ -123,11 +126,6 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data) ...@@ -123,11 +126,6 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
} }
} }
void ff_rdft_calc(RDFTContext *s, FFTSample *data)
{
ff_rdft_calc_c(s, data);
}
av_cold void ff_rdft_end(RDFTContext *s) av_cold void ff_rdft_end(RDFTContext *s)
{ {
ff_fft_end(&s->fft); ff_fft_end(&s->fft);
......
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