diff options
author | Tyler Jones <tdjones879@gmail.com> | 2017-05-30 09:14:17 -0600 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-06-05 16:35:01 +0100 |
commit | 610864dc36e2c485b4508b774b0199e67e9e8999 (patch) | |
tree | 6c9dbd72485112036490f3bab26bcb618aafb7f9 /libavcodec/vorbisenc.c | |
parent | 189ff4219644532bdfa7bab28dfedaee4d6d4021 (diff) | |
download | ffmpeg-610864dc36e2c485b4508b774b0199e67e9e8999.tar.gz |
avcodec/vorbisenc: Include fdsp
Signed-off-by: Tyler Jones <tdjones879@gmail.com>
Diffstat (limited to 'libavcodec/vorbisenc.c')
-rw-r--r-- | libavcodec/vorbisenc.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c index 2974ca2cf9..7c3cd51b53 100644 --- a/libavcodec/vorbisenc.c +++ b/libavcodec/vorbisenc.c @@ -25,6 +25,7 @@ */ #include <float.h> +#include "libavutil/float_dsp.h" #include "avcodec.h" #include "internal.h" @@ -126,6 +127,8 @@ typedef struct vorbis_enc_context { vorbis_enc_mode *modes; int64_t next_pts; + + AVFloatDSPContext *fdsp; } vorbis_enc_context; #define MAX_CHANNELS 2 @@ -236,6 +239,26 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc) return 0; } +static av_cold int dsp_init(AVCodecContext *avctx, vorbis_enc_context *venc) +{ + int ret = 0; + + venc->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); + if (!venc->fdsp) + return AVERROR(ENOMEM); + + // init windows + venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6]; + venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6]; + + if ((ret = ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0, 1.0)) < 0) + return ret; + if ((ret = ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0, 1.0)) < 0) + return ret; + + return 0; +} + static int create_vorbis_context(vorbis_enc_context *venc, AVCodecContext *avctx) { @@ -426,12 +449,7 @@ static int create_vorbis_context(vorbis_enc_context *venc, if (!venc->saved || !venc->samples || !venc->floor || !venc->coeffs) return AVERROR(ENOMEM); - venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6]; - venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6]; - - if ((ret = ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0, 1.0)) < 0) - return ret; - if ((ret = ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0, 1.0)) < 0) + if ((ret = dsp_init(avctx, venc)) < 0) return ret; return 0; @@ -1155,6 +1173,7 @@ static av_cold int vorbis_encode_close(AVCodecContext *avctx) av_freep(&venc->samples); av_freep(&venc->floor); av_freep(&venc->coeffs); + av_freep(&venc->fdsp); ff_mdct_end(&venc->mdct[0]); ff_mdct_end(&venc->mdct[1]); |