diff options
author | nyanmisaka <nst799610810@gmail.com> | 2022-01-11 14:55:38 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2022-01-29 12:02:52 +0800 |
commit | 4cc7239d8bf812387200dd54c0d1120ff68c2bce (patch) | |
tree | 3354d04c8c60632a787663ace64dd2dcf755c413 /libavutil/hwcontext_opencl.c | |
parent | a5b1e632c96727e485419748b4bd2241b5b22fe3 (diff) | |
download | ffmpeg-4cc7239d8bf812387200dd54c0d1120ff68c2bce.tar.gz |
libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
mfxHDLPair was added to qsv, so modify qsv->opencl map function as well.
Now the following commandline works:
ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 \
-init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device ocl \
-hwaccel qsv -hwaccel_output_format qsv -hwaccel_device qs -c:v h264_qsv \
-i input.264 -vf "hwmap=derive_device=opencl,format=opencl,avgblur_opencl, \
hwmap=derive_device=qsv:reverse=1:extra_hw_frames=32,format=qsv" \
-c:v h264_qsv output.264
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Diffstat (limited to 'libavutil/hwcontext_opencl.c')
-rw-r--r-- | libavutil/hwcontext_opencl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index 26a3a24593..4e2ab18ede 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -72,6 +72,12 @@ #include "hwcontext_drm.h" #endif +#if HAVE_OPENCL_VAAPI_INTEL_MEDIA && CONFIG_LIBMFX +extern int ff_qsv_get_surface_base_handle(mfxFrameSurface1 *surf, + enum AVHWDeviceType base_dev_typ, + void **base_handle); +#endif + typedef struct OpenCLDeviceContext { // Default command queue to use for transfer/mapping operations on @@ -2248,8 +2254,14 @@ static int opencl_map_from_qsv(AVHWFramesContext *dst_fc, AVFrame *dst, #if CONFIG_LIBMFX if (src->format == AV_PIX_FMT_QSV) { + void *base_handle; mfxFrameSurface1 *mfx_surface = (mfxFrameSurface1*)src->data[3]; - va_surface = *(VASurfaceID*)mfx_surface->Data.MemId; + err = ff_qsv_get_surface_base_handle(mfx_surface, + AV_HWDEVICE_TYPE_VAAPI, + &base_handle); + if (err < 0) + return err; + va_surface = *(VASurfaceID *)base_handle; } else #endif if (src->format == AV_PIX_FMT_VAAPI) { |