]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/utils.c
nvenc: Allow different const qps for I, P and B frames
[ffmpeg] / libavcodec / utils.c
index 8a422d766922f308e6a5de41fb8b328aa61a511b..ea4d5fa3129ee75da0e3c733ecc6dafc6c6613d6 100644 (file)
@@ -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);