X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Futils.c;h=ea4d5fa3129ee75da0e3c733ecc6dafc6c6613d6;hb=3df77b58e35a30ed550f99936a308f6bd2f47a20;hp=8a422d766922f308e6a5de41fb8b328aa61a511b;hpb=061a0c14bb5767bca72e3a7227ca400de439ba09;p=ffmpeg diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 8a422d76692..ea4d5fa3129 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -40,6 +40,7 @@ #include "libavutil/samplefmt.h" #include "libavutil/dict.h" #include "avcodec.h" +#include "decode.h" #include "libavutil/opt.h" #include "me_cmp.h" #include "mpegvideo.h" @@ -178,17 +179,10 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame, return 0; } -#if HAVE_SIMD_ALIGN_32 -# define STRIDE_ALIGN 32 -#elif HAVE_SIMD_ALIGN_16 -# define STRIDE_ALIGN 16 -#else -# define STRIDE_ALIGN 8 -#endif - void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]) { + size_t max_align = av_cpu_max_align(); int i; int w_align = 1; int h_align = 1; @@ -281,7 +275,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, *height += 2; for (i = 0; i < 4; i++) - linesize_align[i] = STRIDE_ALIGN; + linesize_align[i] = max_align; } void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height) @@ -789,6 +783,8 @@ av_cold int avcodec_close(AVCodecContext *avctx) avctx->hwaccel->uninit(avctx); av_freep(&avctx->internal->hwaccel_priv_data); + ff_decode_bsfs_uninit(avctx); + av_freep(&avctx->internal); } @@ -798,6 +794,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) avctx->nb_coded_side_data = 0; av_buffer_unref(&avctx->hw_frames_ctx); + av_buffer_unref(&avctx->hw_device_ctx); if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) av_opt_free(avctx->priv_data);