From 5345965b3f088ad5acd5151bec421c97470675a4 Mon Sep 17 00:00:00 2001 From: Linjie Fu Date: Tue, 8 Oct 2019 21:41:02 +0800 Subject: lavc/qsvdec: Add GPU-accelerated memory copy support GPU copy enables or disables GPU accelerated copying between video and system memory. This may lead to a notable performance improvement. Memory must be sequent and aligned with 128x64. CMD: ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -gpu_copy on -i input.h264 -f null - or: ffmpeg -c:v h264_qsv -gpu_copy on -i input.h264 -f null - Signed-off-by: Linjie Fu Signed-off-by: ChaoX A Liu Signed-off-by: Zhong Li --- libavcodec/qsvenc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libavcodec/qsvenc.c') diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 207cdc1d61..ba85d645ca 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -956,7 +956,8 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q) ret = ff_qsv_init_session_frames(avctx, &q->internal_qs.session, &q->frames_ctx, q->load_plugins, - q->param.IOPattern == MFX_IOPATTERN_IN_OPAQUE_MEMORY); + q->param.IOPattern == MFX_IOPATTERN_IN_OPAQUE_MEMORY, + MFX_GPUCOPY_OFF); if (ret < 0) { av_buffer_unref(&q->frames_ctx.hw_frames_ctx); return ret; @@ -965,14 +966,15 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q) q->session = q->internal_qs.session; } else if (avctx->hw_device_ctx) { ret = ff_qsv_init_session_device(avctx, &q->internal_qs.session, - avctx->hw_device_ctx, q->load_plugins); + avctx->hw_device_ctx, q->load_plugins, + MFX_GPUCOPY_OFF); if (ret < 0) return ret; q->session = q->internal_qs.session; } else { ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, - q->load_plugins); + q->load_plugins, MFX_GPUCOPY_OFF); if (ret < 0) return ret; -- cgit v1.2.3