mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-10-13 12:07:49 +02:00
avcodec/libmp3lame: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
2fbb9e647c
commit
1aca990bd9
@ -52,7 +52,7 @@ typedef struct LAMEContext {
|
|||||||
int abr;
|
int abr;
|
||||||
float *samples_flt[2];
|
float *samples_flt[2];
|
||||||
AudioFrameQueue afq;
|
AudioFrameQueue afq;
|
||||||
AVFloatDSPContext fdsp;
|
AVFloatDSPContext *fdsp;
|
||||||
} LAMEContext;
|
} LAMEContext;
|
||||||
|
|
||||||
|
|
||||||
@ -79,6 +79,7 @@ static av_cold int mp3lame_encode_close(AVCodecContext *avctx)
|
|||||||
av_freep(&s->samples_flt[0]);
|
av_freep(&s->samples_flt[0]);
|
||||||
av_freep(&s->samples_flt[1]);
|
av_freep(&s->samples_flt[1]);
|
||||||
av_freep(&s->buffer);
|
av_freep(&s->buffer);
|
||||||
|
av_freep(&s->fdsp);
|
||||||
|
|
||||||
ff_af_queue_close(&s->afq);
|
ff_af_queue_close(&s->afq);
|
||||||
|
|
||||||
@ -158,7 +159,12 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
|
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);
|
||||||
|
if (!s->fdsp) {
|
||||||
|
ret = AVERROR(ENOMEM);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
@ -197,7 +203,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
for (ch = 0; ch < avctx->channels; ch++) {
|
for (ch = 0; ch < avctx->channels; ch++) {
|
||||||
s->fdsp.vector_fmul_scalar(s->samples_flt[ch],
|
s->fdsp->vector_fmul_scalar(s->samples_flt[ch],
|
||||||
(const float *)frame->data[ch],
|
(const float *)frame->data[ch],
|
||||||
32768.0f,
|
32768.0f,
|
||||||
FFALIGN(frame->nb_samples, 8));
|
FFALIGN(frame->nb_samples, 8));
|
||||||
|
Loading…
Reference in New Issue
Block a user