summaryrefslogtreecommitdiff
path: root/libavfilter/qsvvpp.h
diff options
context:
space:
mode:
authorFei Wang <fei.w.wang@intel.com>2021-03-31 10:07:44 +0800
committerZhong Li <zhongli_dev@126.com>2021-04-11 23:18:20 +0800
commit89ffcd1bbe1150aa07ae52a4e1545668a4e83a3e (patch)
treeeee074d12f0ce73aca687a5f38c65060b88452eb /libavfilter/qsvvpp.h
parent309e3cc15c87234861fe127614e09023f3867523 (diff)
downloadffmpeg-89ffcd1bbe1150aa07ae52a4e1545668a4e83a3e.tar.gz
lavfi/qsvvpp: support async depth
Async depth will allow qsv filter cache few frames, and avoid force switch and end filter task frame by frame. This change will improve performance for some multi-task case, for example 1:N transcode( decode + vpp + encode) with all QSV plugins. Performance data test on my Coffee Lake Desktop(i7-8700K) by using the following 1:8 transcode test case improvement: 1. Fps improved from 55 to 130. 2. Render/Video usage improved from ~61%/~38% to ~100%/~70%.(Data get from intel_gpu_top) test CMD: ffmpeg -v verbose -init_hw_device qsv=hw:/dev/dri/renderD128 -filter_hw_device \ hw -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i 1920x1080.264 \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - \ -vf 'vpp_qsv=w=1280:h=720:async_depth=4' -c:v h264_qsv -r:v 30 -preset 7 -g 33 -refs 2 -bf 3 -q 24 -f null - Signed-off-by: Fei Wang <fei.w.wang@intel.com> Reviewed-by: Linjie Fu <linjie.justin.fu@gmail.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
Diffstat (limited to 'libavfilter/qsvvpp.h')
-rw-r--r--libavfilter/qsvvpp.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index b4baeedf9e..e0f4c8f5bb 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -27,6 +27,7 @@
#include <mfx/mfxvideo.h>
#include "avfilter.h"
+#include "libavutil/fifo.h"
#define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
#define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
@@ -39,7 +40,41 @@
((MFX_VERSION.Major > (MAJOR)) || \
(MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
-typedef struct QSVVPPContext QSVVPPContext;
+typedef struct QSVFrame {
+ AVFrame *frame;
+ mfxFrameSurface1 surface;
+ struct QSVFrame *next;
+ int queued;
+} QSVFrame;
+
+typedef struct QSVVPPContext {
+ mfxSession session;
+ int (*filter_frame) (AVFilterLink *outlink, AVFrame *frame); /**< callback */
+ enum AVPixelFormat out_sw_format; /**< Real output format */
+ mfxVideoParam vpp_param;
+ mfxFrameInfo *frame_infos; /**< frame info for each input */
+
+ /** members related to the input/output surface */
+ int in_mem_mode;
+ int out_mem_mode;
+ QSVFrame *in_frame_list;
+ QSVFrame *out_frame_list;
+ int nb_surface_ptrs_in;
+ int nb_surface_ptrs_out;
+ mfxFrameSurface1 **surface_ptrs_in;
+ mfxFrameSurface1 **surface_ptrs_out;
+
+ /** MFXVPP extern parameters */
+ mfxExtOpaqueSurfaceAlloc opaque_alloc;
+ mfxExtBuffer **ext_buffers;
+ int nb_ext_buffers;
+
+ int got_frame;
+ int async_depth;
+ int eof;
+ /** order with frame_out, sync */
+ AVFifoBuffer *async_fifo;
+} QSVVPPContext;
typedef struct QSVVPPCrop {
int in_idx; ///< Input index
@@ -60,6 +95,8 @@ typedef struct QSVVPPParam {
/* Crop information for each input, if needed */
int num_crop;
QSVVPPCrop *crop;
+
+ int async_depth;
} QSVVPPParam;
/* create and initialize the QSV session */