mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/atrac1: Avoid indirection when calling float dsp function
Do this by only keeping the only function pointer from the AVFloatDSPContext that is needed lateron. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
ce482266a6
commit
04101222f2
@ -80,7 +80,8 @@ typedef struct AT1Ctx {
|
|||||||
DECLARE_ALIGNED(32, float, high)[512];
|
DECLARE_ALIGNED(32, float, high)[512];
|
||||||
float* bands[3];
|
float* bands[3];
|
||||||
FFTContext mdct_ctx[3];
|
FFTContext mdct_ctx[3];
|
||||||
AVFloatDSPContext *fdsp;
|
void (*vector_fmul_window)(float *dst, const float *src0,
|
||||||
|
const float *src1, const float *win, int len);
|
||||||
} AT1Ctx;
|
} AT1Ctx;
|
||||||
|
|
||||||
/** size of the transform in samples in the long mode for each QMF band */
|
/** size of the transform in samples in the long mode for each QMF band */
|
||||||
@ -140,8 +141,8 @@ static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
|
|||||||
at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], nbits, band_num);
|
at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], nbits, band_num);
|
||||||
|
|
||||||
/* overlap and window */
|
/* overlap and window */
|
||||||
q->fdsp->vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
|
q->vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
|
||||||
&su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16);
|
&su->spectrum[0][ref_pos + start_pos], ff_sine_32, 16);
|
||||||
|
|
||||||
prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
|
prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
|
||||||
start_pos += block_size;
|
start_pos += block_size;
|
||||||
@ -324,8 +325,6 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
|
|||||||
ff_mdct_end(&q->mdct_ctx[1]);
|
ff_mdct_end(&q->mdct_ctx[1]);
|
||||||
ff_mdct_end(&q->mdct_ctx[2]);
|
ff_mdct_end(&q->mdct_ctx[2]);
|
||||||
|
|
||||||
av_freep(&q->fdsp);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +332,7 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
|
|||||||
static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
AT1Ctx *q = avctx->priv_data;
|
AT1Ctx *q = avctx->priv_data;
|
||||||
|
AVFloatDSPContext *fdsp;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||||
@ -360,10 +360,11 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
ff_atrac_generate_tables();
|
ff_atrac_generate_tables();
|
||||||
|
|
||||||
q->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||||
if (!q->fdsp) {
|
if (!fdsp)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
q->vector_fmul_window = fdsp->vector_fmul_window;
|
||||||
|
av_free(fdsp);
|
||||||
|
|
||||||
q->bands[0] = q->low;
|
q->bands[0] = q->low;
|
||||||
q->bands[1] = q->mid;
|
q->bands[1] = q->mid;
|
||||||
|
Loading…
Reference in New Issue
Block a user