From f462ed1f82e4be18876786e86f472ddf7cd41fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Sat, 10 Apr 2010 16:27:53 +0000 Subject: [PATCH] Make synth_filter a function pointer Originally committed as revision 22827 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/dca.c | 4 +++- libavcodec/synth_filter.c | 9 ++++++++- libavcodec/synth_filter.h | 13 +++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 960228202e..dc164e4b97 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -253,6 +253,7 @@ typedef struct { int debug_flag; ///< used for suppressing repeated error messages output DSPContext dsp; FFTContext imdct; + SynthFilterContext synth; } DCAContext; static const uint16_t dca_vlc_offs[] = { @@ -775,7 +776,7 @@ static void qmf_32_subbands(DCAContext * s, int chans, for (; i < 32; i++) s->raXin[i] = 0.0; - ff_synth_filter_float(&s->imdct, + s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, samples_out, s->raXin, scale, bias); @@ -1298,6 +1299,7 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) dsputil_init(&s->dsp, avctx); ff_mdct_init(&s->imdct, 6, 1, 1.0); + ff_synth_filter_init(&s->synth); for(i = 0; i < 6; i++) s->samples_chanptr[i] = s->samples + i * 256; diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c index a252b5c2b0..a0ae364d79 100644 --- a/libavcodec/synth_filter.c +++ b/libavcodec/synth_filter.c @@ -21,7 +21,7 @@ #include "fft.h" #include "synth_filter.h" -void ff_synth_filter_float(FFTContext *imdct, +static void synth_filter_float(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], float scale, float bias) @@ -55,3 +55,10 @@ void ff_synth_filter_float(FFTContext *imdct, } *synth_buf_offset= (*synth_buf_offset - 32)&511; } + +av_cold void ff_synth_filter_init(SynthFilterContext *c) +{ + c->synth_filter_float = synth_filter_float; + + if (ARCH_ARM) ff_synth_filter_init_arm(c); +} diff --git a/libavcodec/synth_filter.h b/libavcodec/synth_filter.h index 701394ca0a..5b875fcad0 100644 --- a/libavcodec/synth_filter.h +++ b/libavcodec/synth_filter.h @@ -23,9 +23,14 @@ #include "fft.h" -void ff_synth_filter_float(FFTContext *imdct, - float *synth_buf_ptr, int *synth_buf_offset, - float synth_buf2[32], const float window[512], - float out[32], const float in[32], float scale, float bias); +typedef struct SynthFilterContext { + void (*synth_filter_float)(FFTContext *imdct, + float *synth_buf_ptr, int *synth_buf_offset, + float synth_buf2[32], const float window[512], + float out[32], const float in[32], + float scale, float bias); +} SynthFilterContext; + +void ff_synth_filter_init(SynthFilterContext *c); #endif /* AVCODEC_SYNTH_FILTER_H */