[FFmpeg-devel] [PATCH v5 00/10] make QSV works with the Intel's oneVPL

2021-10-08 Thread Haihao Xiang
dk-to-onevpl.html Haihao Xiang (10): configure: ensure --enable-libmfx uses libmfx 1.x configure: fix the check for MFX_CODEC_VP9 qsv: remove mfx/ prefix from mfx headers qsv: load user plugin for MFX_VERSION < 2.0 qsv: build audio related code when MFX_VERSION < 2.0 qsvenc: support

[FFmpeg-devel] [PATCH v5 03/10] qsv: remove mfx/ prefix from mfx headers

2021-10-08 Thread Haihao Xiang
The following Cflags has been added to libmfx.pc, so mfx/ prefix is no longer needed when including mfx headers in FFmpeg. Cflags: -I${includedir} -I${includedir}/mfx Some old versions of libmfx have the following Cflags in libmfx.pc Cflags: -I${includedir} We may add -I${includedir}/mfx to

[FFmpeg-devel] [PATCH v5 04/10] qsv: load user plugin for MFX_VERSION < 2.0

2021-10-08 Thread Haihao Xiang
User plugin isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL Support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.c

[FFmpeg-devel] [PATCH v5 01/10] configure: ensure --enable-libmfx uses libmfx 1.x

2021-10-08 Thread Haihao Xiang
Intel's oneVPL is a successor to MediaSDK, but removed some obsolete features of MediaSDK[1]. Some early versions of oneVPL still uses libmfx as library name[2], however some of obsolete features, including OPAQUE memory, multi-frame encode, user plugins and LA_EXT rate control mode etc, have been

[FFmpeg-devel] [PATCH v5 05/10] qsv: build audio related code when MFX_VERSION < 2.0

2021-10-08 Thread Haihao Xiang
Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.c |

[FFmpeg-devel] [PATCH v5 08/10] qsv: support OPAQUE memory when MFX_VERSION < 2.0

2021-10-08 Thread Haihao Xiang
OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.

[FFmpeg-devel] [PATCH v5 02/10] configure: fix the check for MFX_CODEC_VP9

2021-10-08 Thread Haihao Xiang
The data structures for VP9 in mfxvp9.h is wrapped by MFX_VERSION_NEXT, which means those data structures have never been used in a public release. Actually MFX_CODEC_VP9 and other VP9 stuffs is added in mfxstructures.h. In addition, mfxdefs.h is included in mfxvp9.h, so we may use the check in thi

[FFmpeg-devel] [PATCH v5 06/10] qsvenc: support multi-frame encode when MFX_VERSION < 2.0

2021-10-08 Thread Haihao Xiang
Multi-frame encode isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec

[FFmpeg-devel] [PATCH v5 09/10] qsv: use a new method to create mfx session when using oneVPL

2021-10-08 Thread Haihao Xiang
In oneVPL, MFXLoad() and MFXCreateSession() are required to create a workable mfx session[1] Add AccelerationMode config filter for D3D9/D3D11 session (galinart) The default device is changed to d3d11va for oneVPL when both d3d11va and dxva2 are enabled on Microsoft Windows This is in preparatio

[FFmpeg-devel] [PATCH v5 10/10] configure: add --enable-libvpl option

2021-10-08 Thread Haihao Xiang
This allows user to build FFmpeg against Intel oneVPL. oneVPL 2.2 is the required minimum version when building Intel oneVPL code. It will fail to run configure script if both libmfx and libvpl are enabled. It is recommended to use oneVPL for new work, even for currently available hardwares [1]

[FFmpeg-devel] [PATCH v5 07/10] qsvenc: support MFX_RATECONTROL_LA_EXT when MFX_VERSION < 2.0

2021-10-08 Thread Haihao Xiang
MFX_RATECONTROL_LA_EXT isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavc

[FFmpeg-devel] [PATCH] qsvenc_hevc: Enable look ahead with ExtBRC

2021-10-08 Thread Haihao Xiang
From: Daniel Socek Signed-off-by: Daniel Socek Signed-off-by: Haihao Xiang --- libavcodec/qsvenc.c | 3 +++ libavcodec/qsvenc_hevc.c | 1 + 2 files changed, 4 insertions(+) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 06f55604b5..e21a9b1207 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH v6 00/10] make QSV works with the Intel's oneVPL

2021-10-15 Thread Haihao Xiang
.intel.com/content/www/us/en/develop/articles/upgrading-from-msdk-to-onevpl.html Haihao Xiang (10): configure: ensure --enable-libmfx uses libmfx 1.x configure: fix the check for MFX_CODEC_VP9 qsv: remove mfx/ prefix from mfx headers qsv: load user plugin for MFX_VERSION < 2.0 qsv: build

[FFmpeg-devel] [PATCH v6 01/10] configure: ensure --enable-libmfx uses libmfx 1.x

2021-10-15 Thread Haihao Xiang
Intel's oneVPL is a successor to MediaSDK, but removed some obsolete features of MediaSDK[1]. Some early versions of oneVPL still uses libmfx as library name[2], however some of obsolete features, including OPAQUE memory, multi-frame encode, user plugins and LA_EXT rate control mode etc, have been

[FFmpeg-devel] [PATCH v6 02/10] configure: fix the check for MFX_CODEC_VP9

2021-10-15 Thread Haihao Xiang
The data structures for VP9 in mfxvp9.h is wrapped by MFX_VERSION_NEXT, which means those data structures have never been used in a public release. Actually MFX_CODEC_VP9 and other VP9 stuffs is added in mfxstructures.h. In addition, mfxdefs.h is included in mfxvp9.h, so we may use the check in thi

[FFmpeg-devel] [PATCH v6 03/10] qsv: remove mfx/ prefix from mfx headers

2021-10-15 Thread Haihao Xiang
The following Cflags has been added to libmfx.pc, so mfx/ prefix is no longer needed when including mfx headers in FFmpeg. Cflags: -I${includedir} -I${includedir}/mfx Some old versions of libmfx have the following Cflags in libmfx.pc Cflags: -I${includedir} We may add -I${includedir}/mfx to

[FFmpeg-devel] [PATCH v6 04/10] qsv: load user plugin for MFX_VERSION < 2.0

2021-10-15 Thread Haihao Xiang
User plugin isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL Support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.c

[FFmpeg-devel] [PATCH v6 05/10] qsv: build audio related code when MFX_VERSION < 2.0

2021-10-15 Thread Haihao Xiang
Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.c |

[FFmpeg-devel] [PATCH v6 08/10] qsv: support OPAQUE memory when MFX_VERSION < 2.0

2021-10-15 Thread Haihao Xiang
OPAQUE memory isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec/qsv.

[FFmpeg-devel] [PATCH v6 09/10] qsv: use a new method to create mfx session when using oneVPL

2021-10-15 Thread Haihao Xiang
In oneVPL, MFXLoad() and MFXCreateSession() are required to create a workable mfx session[1] Add AccelerationMode config filter for D3D9/D3D11 session (galinart) The default device is changed to d3d11va for oneVPL when both d3d11va and dxva2 are enabled on Microsoft Windows This is in preparatio

[FFmpeg-devel] [PATCH v6 10/10] configure: add --enable-libvpl option

2021-10-15 Thread Haihao Xiang
This allows user to build FFmpeg against Intel oneVPL. oneVPL 2.2 is the required minimum version when building Intel oneVPL code. It will fail to run configure script if both libmfx and libvpl are enabled. It is recommended to use oneVPL for new work, even for currently available hardwares [1]

[FFmpeg-devel] [PATCH v6 06/10] qsvenc: support multi-frame encode when MFX_VERSION < 2.0

2021-10-15 Thread Haihao Xiang
Multi-frame encode isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavcodec

[FFmpeg-devel] [PATCH v6 07/10] qsvenc: support MFX_RATECONTROL_LA_EXT when MFX_VERSION < 2.0

2021-10-15 Thread Haihao Xiang
MFX_RATECONTROL_LA_EXT isn't supported for MFX_VERSION >= 2.0[1][2]. This is in preparation for oneVPL support [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/appendix/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2]: https://github.com/oneapi-src/oneVPL --- libavc

[FFmpeg-devel] [PATCH] Fix link errors when HAVE_X86ASM is not defined

2018-11-20 Thread Haihao Xiang
_g' failed make: *** [ffmpeg_g] Error 1 Signed-off-by: Haihao Xiang --- libavfilter/x86/scene_sad_init.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavfilter/x86/scene_sad_init.c b/libavfilter/x86/scene_sad_init.c index 461fa406d9..7e93ef44d3 100644 --- a/libavfilter/x86/sc

[FFmpeg-devel] [PATCH 1/2] lavc/qsv: allow to add more parameter buffers to QSV frame

2021-03-22 Thread Haihao Xiang
--- libavcodec/qsv.c | 27 +++ libavcodec/qsv_internal.h | 8 +++- libavcodec/qsvdec.c | 8 +--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 6e3154e1a3..879e109092 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 2/2] lavc/qsvdec: export AVFilmGrainParams side data

2021-03-22 Thread Haihao Xiang
When AV_CODEC_EXPORT_DATA_FILM_GRAIN is present, AV1 decoder should disable film grain application and export the corresponding side data --- libavcodec/qsv_internal.h | 3 ++ libavcodec/qsvdec.c | 88 +++ 2 files changed, 91 insertions(+) diff --git a/l

[FFmpeg-devel] [PATCH 1/3] lavc/qsv: apply AVCodecContext AVOption -threads to QSV

2021-04-08 Thread Haihao Xiang
By default the SDK creates a thread for each CPU when creating a mfx session for decoding / encoding, which results in CPU overhead on a multi CPU system. Actually creating 2 threads is a better choice for most cases in practice. This patch allows user to specify the number of threads created for

[FFmpeg-devel] [PATCH 2/3] lavu/hwcontext_qsv: limit the number of threads for QSV HW device to 2

2021-04-08 Thread Haihao Xiang
The session created for QSV HW device will be used as parent session only, so we needn't create more threads for this session --- libavutil/hwcontext_qsv.c | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_

[FFmpeg-devel] [PATCH 3/3] lavu/hwcontext_qsv: limit the number of threads used for hwupload & hwdownload to 2

2021-04-08 Thread Haihao Xiang
The session for hwupload & hwdownload is used to copy data between system and video memory, 2 threads are sufficient for the copy in the SDK. --- libavutil/hwcontext_qsv.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/

[FFmpeg-devel] [PATCH 1/2] hwcontext_vaapi: the first parameter is the AVHWFramesContext for dst

2020-06-18 Thread Haihao Xiang
vaapi_map_from_drm() is the implementation of map_to when src format is AV_PIX_FMT_DRM_PRIME, and the first parameter of map_to is the AVHWFramesContext for dst Signed-off-by: Haihao Xiang --- libavutil/hwcontext_vaapi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a

[FFmpeg-devel] [PATCH 2/2] hwcontext_vaapi: try VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 firstly when importing a DMABuf

2020-06-18 Thread Haihao Xiang
User should provide the modifier when importing a DMABuf if this DMABuf has modifier. Signed-off-by: Haihao Xiang --- libavutil/hwcontext_vaapi.c | 137 +--- 1 file changed, 126 insertions(+), 11 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil

[FFmpeg-devel] [PATCH 1/2] lavc/qsvenc_hevc: allow user set more coding options

2021-04-24 Thread Haihao Xiang
intSEI '-aud xxx' to turn on / off AUDelimiter Signed-off-by: Haihao Xiang --- libavcodec/qsvenc.c | 15 --- libavcodec/qsvenc_hevc.c | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 566a5

[FFmpeg-devel] [PATCH 2/2] lavf/qsvenc: '0' is not a valid value for GopOptFlag

2021-04-24 Thread Haihao Xiang
The accepted values for GopOptFlag are MFX_GOP_CLOSED (1) and MFX_GOP_STRICT (2). Signed-off-by: Haihao Xiang --- libavcodec/qsvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index aeb010e456..684c8089eb 100644 --- a

[FFmpeg-devel] [PATCH 00/22] clean-up QSV filters

2021-05-13 Thread Haihao Xiang
This patchset clean up scale_qsv and deinterlace_qsv filters, and take the two filters as the special cases of vpp_qsv, so vf_scale_qsv.c and vf_deinterlace_qsv.c can be deleted from FFmpeg. In addition, a few small features are added in this patchset. Haihao Xiang (22): lavf/qsv: use

[FFmpeg-devel] [PATCH 01/22] lavf/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv

2021-05-13 Thread Haihao Xiang
The same members between QSVVPPContext and VPPContext are removed from VPPContext, and async_depth is moved from QSVVPPParam to QSVVPPContext so that all QSV filters using QSVVPPContext may support async depth. In addition we may use QSVVPPContext as base context in other QSV filters in the future.

[FFmpeg-devel] [PATCH 02/22] lavf/scale_qsv: simplify scale_qsv filter

2021-05-13 Thread Haihao Xiang
Use QSVVPPContext as a base context of QSVScaleContext, hence we may re-use functions defined for QSVVPPContext to manage MFX session for scale_qsv filter too. Because system memory is taken into account in QSVVVPPContext, we may add support for non-QSV pixel formats in the future --- libavfilter/

[FFmpeg-devel] [PATCH 04/22] lavf/vpp_qsv: add "a", "dar" and "sar" variables

2021-05-13 Thread Haihao Xiang
Also fix the coding style for VAR index. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 72

[FFmpeg-devel] [PATCH 03/22] lavf/scale_qsv: don't need variables for constants in FFmpeg

2021-05-13 Thread Haihao Xiang
PI, PHI and E are defined in FFmpeg --- libavfilter/vf_scale_qsv.c | 9 - 1 file changed, 9 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 77a782aa58..f8e937e40e 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -44,9 +44,

[FFmpeg-devel] [PATCH 05/22] lavf/vpp_qsv: handle NULL pointer when evaluating an expression

2021-05-13 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index e7

[FFmpeg-devel] [PATCH 09/22] lavf/vpp_qsv: add vpp_preinit callback

2021-05-13 Thread Haihao Xiang
Set the expected default value for options in this callback, hence we have the right values even if these options are not included in the option arrray. This is in preparation for re-using VPPContext but with a different option array for other QSV filters --- libavfilter/vf_vpp_qsv.c | 14

[FFmpeg-devel] [PATCH 07/22] lavf/vpp_qsv: factorize extra MFX configuration

2021-05-13 Thread Haihao Xiang
This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 78 +--- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 7afbb3c983..c9a7b0ceb9 100644 --

[FFmpeg-devel] [PATCH 06/22] lavf/vpp_qsv: allow special values for the output dimensions

2021-05-13 Thread Haihao Xiang
Special values are: 0 = original width/height -1 = keep original aspect This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 47 ++-- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_vpp

[FFmpeg-devel] [PATCH 11/22] lavf/vpp_qsv: factor common QSV filter definition

2021-05-13 Thread Haihao Xiang
--- libavfilter/vf_vpp_qsv.c | 195 +-- 1 file changed, 86 insertions(+), 109 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index dd3afb5e10..03785e9398 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -105

[FFmpeg-devel] [PATCH 10/22] lavf/scale_qsv: re-use VPPContext for scale_qsv filter

2021-05-13 Thread Haihao Xiang
All features are implemented in vpp_qsv filter, scale_qsv can be taken as a special case of vpp_qsv filter now, we re-use VPPContext with a different option arrary and pixel formats --- libavfilter/Makefile | 2 +- libavfilter/vf_scale_qsv.c | 334 - lib

[FFmpeg-devel] [PATCH 08/22] lavf/vpp_qsv: pass scaling mode to the SDK

2021-05-13 Thread Haihao Xiang
After this patch, the scaling mode will be passed to the SDK when the scaling mode is not equal to the default mode. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --gi

[FFmpeg-devel] [PATCH 20/22] lavf/deinterlace_qsv: add async_depth option

2021-05-13 Thread Haihao Xiang
Allow user to set async depth for deinterlace_qsv --- libavfilter/vf_vpp_qsv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index c0afb001b9..bb3aebf047 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -711,6 +711,7

[FFmpeg-devel] [PATCH 22/22] lavf/vpp_qsv: allow user to set scaling mode for vpp_qsv filter

2021-05-13 Thread Haihao Xiang
option 'scaling' accepts one of low_power and hq $ ffmpeg -init_hw_device qsv -hwaccel qsv -c:v h264_qsv -i input.h264 -vf "vpp_qsv=scaling=hq" -f null - --- libavfilter/vf_vpp_qsv.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.

[FFmpeg-devel] [PATCH 21/22] lavf/deinterlace_qsv: add more input / output pixel formats

2021-05-13 Thread Haihao Xiang
NV12 is added in system memory and the command below may work now. $ ffmpeg -init_hw_device qsv -c:v h264_qsv -i input.h264 -vf deinterlace_qsv -f null - --- libavfilter/vf_vpp_qsv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_v

[FFmpeg-devel] [PATCH 13/22] lavf/scale_qsv: add more input / output pixel formats

2021-05-13 Thread Haihao Xiang
NV12 and P010 are added $ ffmpeg -init_hw_device qsv -c:v h264_qsv -i input.h264 -vf "scale_qsv=format=p010" -f null - --- libavfilter/vf_vpp_qsv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index bceee8c4df..29ba220

[FFmpeg-devel] [PATCH 15/22] lavf/qsvvpp: avoid overriding the returned value

2021-05-13 Thread Haihao Xiang
Currently the returned value from MFXVideoVPP_RunFrameVPPAsync() is overridden, so the check of 'ret == MFX_ERR_MORE_SURFACE' is always false when MFX_ERR_MORE_SURFACE is returned from MFXVideoVPP_RunFrameVPPAsync() --- libavfilter/qsvvpp.c | 11 --- 1 file changed, 8 insertions(+), 3 dele

[FFmpeg-devel] [PATCH 12/22] lavf/scale_qsv: add new options for scale_qsv filter

2021-05-13 Thread Haihao Xiang
Allow user to set crop area and async depth --- libavfilter/vf_vpp_qsv.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 03785e9398..bceee8c4df 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -675,6 +675,10

[FFmpeg-devel] [PATCH 14/22] lavf/vpp_qsv: double the framerate for deinterlacing

2021-05-13 Thread Haihao Xiang
--- libavfilter/vf_vpp_qsv.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 29ba220665..ec35f85b04 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -255,10 +255,14 @@ static int config_inp

[FFmpeg-devel] [PATCH 16/22] lavf/qsvvpp: set PTS for output frame

2021-05-13 Thread Haihao Xiang
When the SDK returns MFX_ERR_MORE_SURFACE, the PTS is not set for the output frame. We assign a PTS calculated from the input frame to the output frame. After applying this patch, we may avoid the error below: [null @ 0x56395cab4ae0] Application provided invalid, non monotonically increasing dts t

[FFmpeg-devel] [PATCH 17/22] lavf/vpp_qsv: check output format string against NULL pointer

2021-05-13 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for deinterlacing_qsv filter --- libavfilter/vf_vpp_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 018b0e8689..90b0b25210 100644 ---

[FFmpeg-devel] [PATCH 18/22] lavf/deinterlace_qsv: simplify deinterlace_qsv filter

2021-05-13 Thread Haihao Xiang
Like what we did for scale_qsv filter, we use QSVVPPContext as a base context to manage MFX session for deinterlace_qsv filter --- libavfilter/vf_deinterlace_qsv.c | 492 ++- 1 file changed, 30 insertions(+), 462 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv

[FFmpeg-devel] [PATCH 19/22] lavf/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter

2021-05-13 Thread Haihao Xiang
All features are implemented in vpp_qsv filter now, so deinterlace_qsv can be taken as a specical case of vpp_qsv filter, we re-use VPPContext with a different option array and pix formats for deinterlace_qsv filter --- libavfilter/Makefile | 2 +- libavfilter/vf_deinterlace_qsv.c |

[FFmpeg-devel] [PATCH v2 00/22] clean-up QSV filters

2021-05-16 Thread Haihao Xiang
This patchset clean up scale_qsv and deinterlace_qsv filters, and take the two filters as the special cases of vpp_qsv, so vf_scale_qsv.c and vf_deinterlace_qsv.c can be deleted from FFmpeg. In addition, a few small features are added in this patchset. --- Update the commit logs in v2 Haihao

[FFmpeg-devel] [PATCH v2 01/22] lavfi/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv

2021-05-16 Thread Haihao Xiang
The same members between QSVVPPContext and VPPContext are removed from VPPContext, and async_depth is moved from QSVVPPParam to QSVVPPContext so that all QSV filters using QSVVPPContext may support async depth. In addition we may use QSVVPPContext as base context in other QSV filters in the future.

[FFmpeg-devel] [PATCH v2 02/22] lavfi/scale_qsv: simplify scale_qsv filter

2021-05-16 Thread Haihao Xiang
Use QSVVPPContext as a base context of QSVScaleContext, hence we may re-use functions defined for QSVVPPContext to manage MFX session for scale_qsv filter too. Because system memory is taken into account in QSVVVPPContext, we may add support for non-QSV pixel formats in the future --- libavfilter/

[FFmpeg-devel] [PATCH v2 03/22] lavfi/scale_qsv: don't need variables for constants in FFmpeg

2021-05-16 Thread Haihao Xiang
PI, PHI and E are defined in FFmpeg --- libavfilter/vf_scale_qsv.c | 9 - 1 file changed, 9 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 77a782aa58..f8e937e40e 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -44,9 +44,

[FFmpeg-devel] [PATCH v2 04/22] lavfi/vpp_qsv: add "a", "dar" and "sar" variables

2021-05-16 Thread Haihao Xiang
Also fix the coding style for VAR index. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 72

[FFmpeg-devel] [PATCH v2 05/22] lavfi/vpp_qsv: handle NULL pointer when evaluating an expression

2021-05-16 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index e7

[FFmpeg-devel] [PATCH v2 08/22] lavfi/vpp_qsv: pass scaling mode to the SDK

2021-05-16 Thread Haihao Xiang
After this patch, the scaling mode will be passed to the SDK when the scaling mode is not equal to the default mode. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --gi

[FFmpeg-devel] [PATCH v2 09/22] lavfi/vpp_qsv: add vpp_preinit callback

2021-05-16 Thread Haihao Xiang
Set the expected default value for options in this callback, hence we have the right values even if these options are not included in the option arrray. This is in preparation for re-using VPPContext but with a different option array for other QSV filters --- libavfilter/vf_vpp_qsv.c | 14

[FFmpeg-devel] [PATCH v2 10/22] lavfi/scale_qsv: re-use VPPContext for scale_qsv filter

2021-05-16 Thread Haihao Xiang
All features are implemented in vpp_qsv filter, scale_qsv can be taken as a special case of vpp_qsv filter now, we re-use VPPContext with a different option arrary and pixel formats --- libavfilter/Makefile | 2 +- libavfilter/vf_scale_qsv.c | 334 - lib

[FFmpeg-devel] [PATCH v2 06/22] lavfi/vpp_qsv: allow special values for the output dimensions

2021-05-16 Thread Haihao Xiang
Special values are: 0 = original width/height -1 = keep original aspect This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 47 ++-- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_vpp

[FFmpeg-devel] [PATCH v2 07/22] lavfi/vpp_qsv: factorize extra MFX configuration

2021-05-16 Thread Haihao Xiang
This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 78 +--- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 7afbb3c983..c9a7b0ceb9 100644 --

[FFmpeg-devel] [PATCH v2 11/22] lavfi/vpp_qsv: factor common QSV filter definition

2021-05-16 Thread Haihao Xiang
--- libavfilter/vf_vpp_qsv.c | 195 +-- 1 file changed, 86 insertions(+), 109 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index dd3afb5e10..03785e9398 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -105

[FFmpeg-devel] [PATCH v2 12/22] lavfi/scale_qsv: add new options for scale_qsv filter

2021-05-16 Thread Haihao Xiang
Allow user to set crop area and async depth --- libavfilter/vf_vpp_qsv.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 03785e9398..bceee8c4df 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -675,6 +675,10

[FFmpeg-devel] [PATCH v2 13/22] lavfi/scale_qsv: add more input / output pixel formats

2021-05-16 Thread Haihao Xiang
NV12 and P010 are added $ ffmpeg -init_hw_device qsv -c:v h264_qsv -i input.h264 -vf "scale_qsv=format=p010" -f null - --- libavfilter/vf_vpp_qsv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index bceee8c4df..29ba220

[FFmpeg-devel] [PATCH v2 15/22] lavfi/qsvvpp: avoid overriding the returned value

2021-05-16 Thread Haihao Xiang
Currently the returned value from MFXVideoVPP_RunFrameVPPAsync() is overridden, so the check of 'ret == MFX_ERR_MORE_SURFACE' is always false when MFX_ERR_MORE_SURFACE is returned from MFXVideoVPP_RunFrameVPPAsync() --- libavfilter/qsvvpp.c | 11 --- 1 file changed, 8 insertions(+), 3 dele

[FFmpeg-devel] [PATCH v2 14/22] lavfi/vpp_qsv: double the framerate for deinterlacing

2021-05-16 Thread Haihao Xiang
--- libavfilter/vf_vpp_qsv.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 29ba220665..ec35f85b04 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -255,10 +255,14 @@ static int config_inp

[FFmpeg-devel] [PATCH v2 16/22] lavfi/qsvvpp: set PTS for output frame

2021-05-16 Thread Haihao Xiang
When the SDK returns MFX_ERR_MORE_SURFACE, the PTS is not set for the output frame. We assign a PTS calculated from the input frame to the output frame. After applying this patch, we may avoid the error below: [null @ 0x56395cab4ae0] Application provided invalid, non monotonically increasing dts t

[FFmpeg-devel] [PATCH v2 18/22] lavfi/deinterlace_qsv: simplify deinterlace_qsv filter

2021-05-16 Thread Haihao Xiang
Like what we did for scale_qsv filter, we use QSVVPPContext as a base context to manage MFX session for deinterlace_qsv filter --- libavfilter/vf_deinterlace_qsv.c | 492 ++- 1 file changed, 30 insertions(+), 462 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv

[FFmpeg-devel] [PATCH v2 17/22] lavfi/vpp_qsv: check output format string against NULL pointer

2021-05-16 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for deinterlacing_qsv filter --- libavfilter/vf_vpp_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 018b0e8689..90b0b25210 100644 ---

[FFmpeg-devel] [PATCH v2 19/22] lavfi/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter

2021-05-16 Thread Haihao Xiang
All features are implemented in vpp_qsv filter now, so deinterlace_qsv can be taken as a specical case of vpp_qsv filter, we re-use VPPContext with a different option array and pix formats for deinterlace_qsv filter --- libavfilter/Makefile | 2 +- libavfilter/vf_deinterlace_qsv.c |

[FFmpeg-devel] [PATCH v2 20/22] lavfi/deinterlace_qsv: add async_depth option

2021-05-16 Thread Haihao Xiang
Allow user to set async depth for deinterlace_qsv --- libavfilter/vf_vpp_qsv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index c0afb001b9..bb3aebf047 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -711,6 +711,7

[FFmpeg-devel] [PATCH v2 21/22] lavfi/deinterlace_qsv: add more input / output pixel formats

2021-05-16 Thread Haihao Xiang
NV12 is added in system memory and the command below may work now. $ ffmpeg -init_hw_device qsv -c:v h264_qsv -i input.h264 -vf deinterlace_qsv -f null - --- libavfilter/vf_vpp_qsv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_v

[FFmpeg-devel] [PATCH v2 22/22] lavfi/vpp_qsv: allow user to set scaling mode for vpp_qsv filter

2021-05-16 Thread Haihao Xiang
option 'scaling' accepts one of low_power and hq $ ffmpeg -init_hw_device qsv -hwaccel qsv -c:v h264_qsv -i input.h264 -vf "vpp_qsv=scaling=hq" -f null - --- libavfilter/vf_vpp_qsv.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.

[FFmpeg-devel] [PATCH 1/2] lavc/qsvdec: fix pts

2021-06-08 Thread Haihao Xiang
The time base used for compressed bitstream and video frame in the SDK is { 1, 9 }. [1][2] This can avoid the error message below from the muxer. $> ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -f null - ... [null @ 0x561c24f6f2f0] Application provided invalid, non monotonically increasing

[FFmpeg-devel] [PATCH 2/2] lavfi/vf_vpp_qsv: fix the time_base for outlink

2021-06-08 Thread Haihao Xiang
Since commit 89ffcd1, the pts on output pad is in the time base of the input link, not the time base of the output link when EOF is reached, so a filter after vpp_qsv might output some unexpected frames. In order to avoid this issue, use the same time base for input and ouput links The issue can b

[FFmpeg-devel] [PATCH] avfilter: add QSV variants of the stack filters

2021-06-09 Thread Haihao Xiang
Include hstack_qsv, vstack_qsv and xstack_qsv, some code is copy and pasted from other filters Example: $> ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -filter_complex "[0:v][0:v]hstack_qsv" -f null - --- configure | 6 + libavfilter/Makefile | 3 + libavfilter/allfi

[FFmpeg-devel] [PATCH v2 1/2] lavc/qsvdec: fix pts

2021-06-10 Thread Haihao Xiang
The time base used for compressed bitstream and video frame in the SDK is { 1, 9 }. [1][2] This can avoid the error message below from the muxer. $> ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -f null - ... [null @ 0x561c24f6f2f0] Application provided invalid, non monotonically increasing

[FFmpeg-devel] [PATCH v2 2/2] lavfi/vf_vpp_qsv: fix the time_base for outlink

2021-06-10 Thread Haihao Xiang
Since commit 89ffcd1, the status pts of the output link is set to a value in the input link time base, not in the output link time base when EOF is reached. Usually this pst value is larger than the required one because the output link time base is more greater than the input link time base. When "

[FFmpeg-devel] [PATCH v3 00/22] clean-up QSV filters

2021-06-14 Thread Haihao Xiang
Haihao Xiang (22): lavfi/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv lavfi/scale_qsv: simplify scale_qsv filter lavfi/scale_qsv: don't need variables for constants in FFmpeg lavfi/vpp_qsv: add "a", "dar" and "sar" variables

[FFmpeg-devel] [PATCH v3 01/22] lavfi/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv

2021-06-14 Thread Haihao Xiang
The same members between QSVVPPContext and VPPContext are removed from VPPContext, and async_depth is moved from QSVVPPParam to QSVVPPContext so that all QSV filters using QSVVPPContext may support async depth. In addition we may use QSVVPPContext as base context in other QSV filters in the future.

[FFmpeg-devel] [PATCH v3 02/22] lavfi/scale_qsv: simplify scale_qsv filter

2021-06-14 Thread Haihao Xiang
Use QSVVPPContext as a base context of QSVScaleContext, hence we may re-use functions defined for QSVVPPContext to manage MFX session for scale_qsv filter too. Because system memory is taken into account in QSVVVPPContext, we may add support for non-QSV pixel formats in the future --- libavfilter/

[FFmpeg-devel] [PATCH v3 03/22] lavfi/scale_qsv: don't need variables for constants in FFmpeg

2021-06-14 Thread Haihao Xiang
PI, PHI and E are defined in FFmpeg --- libavfilter/vf_scale_qsv.c | 9 - 1 file changed, 9 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 77a782aa58..f8e937e40e 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -44,9 +44,

[FFmpeg-devel] [PATCH v3 05/22] lavfi/vpp_qsv: handle NULL pointer when evaluating an expression

2021-06-14 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index e7

[FFmpeg-devel] [PATCH v3 06/22] lavfi/vpp_qsv: allow special values for the output dimensions

2021-06-14 Thread Haihao Xiang
Special values are: 0 = original width/height -1 = keep original aspect This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 47 ++-- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_vpp

[FFmpeg-devel] [PATCH v3 07/22] lavfi/vpp_qsv: factorize extra MFX configuration

2021-06-14 Thread Haihao Xiang
This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 78 +--- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 7afbb3c983..c9a7b0ceb9 100644 --

[FFmpeg-devel] [PATCH v3 04/22] lavfi/vpp_qsv: add "a", "dar" and "sar" variables

2021-06-14 Thread Haihao Xiang
Also fix the coding style for VAR index. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index 72

[FFmpeg-devel] [PATCH v3 08/22] lavfi/vpp_qsv: pass scaling mode to the SDK

2021-06-14 Thread Haihao Xiang
After this patch, the scaling mode will be passed to the SDK when the scaling mode is not equal to the default mode. This is in preparation for re-using VPPContext for scale_qsv filter --- libavfilter/vf_vpp_qsv.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --gi

[FFmpeg-devel] [PATCH v3 15/22] lavfi/qsvvpp: avoid overriding the returned value

2021-06-14 Thread Haihao Xiang
Currently the returned value from MFXVideoVPP_RunFrameVPPAsync() is overridden, so the check of 'ret == MFX_ERR_MORE_SURFACE' is always false when MFX_ERR_MORE_SURFACE is returned from MFXVideoVPP_RunFrameVPPAsync() --- libavfilter/qsvvpp.c | 11 --- 1 file changed, 8 insertions(+), 3 dele

[FFmpeg-devel] [PATCH v3 16/22] lavfi/qsvvpp: set PTS for output frame

2021-06-14 Thread Haihao Xiang
When the SDK returns MFX_ERR_MORE_SURFACE, the PTS is not set for the output frame. We assign a PTS calculated from the input frame to the output frame. After applying this patch, we may avoid the error below: [null @ 0x56395cab4ae0] Application provided invalid, non monotonically increasing dts t

[FFmpeg-devel] [PATCH v3 10/22] lavfi/scale_qsv: re-use VPPContext for scale_qsv filter

2021-06-14 Thread Haihao Xiang
All features are implemented in vpp_qsv filter, scale_qsv can be taken as a special case of vpp_qsv filter now, we re-use VPPContext with a different option arrary and pixel formats --- libavfilter/Makefile | 2 +- libavfilter/vf_scale_qsv.c | 334 - lib

[FFmpeg-devel] [PATCH v3 09/22] lavfi/vpp_qsv: add vpp_preinit callback

2021-06-14 Thread Haihao Xiang
Set the expected default value for options in this callback, hence we have the right values even if these options are not included in the option arrray. This is in preparation for re-using VPPContext but with a different option array for other QSV filters --- libavfilter/vf_vpp_qsv.c | 14

[FFmpeg-devel] [PATCH v3 11/22] lavfi/vpp_qsv: factor common QSV filter definition

2021-06-14 Thread Haihao Xiang
--- libavfilter/vf_vpp_qsv.c | 195 +-- 1 file changed, 86 insertions(+), 109 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index dd3afb5e10..03785e9398 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -105

[FFmpeg-devel] [PATCH v3 17/22] lavfi/vpp_qsv: check output format string against NULL pointer

2021-06-14 Thread Haihao Xiang
This is in preparation for re-using VPPContext but with a different option array for deinterlacing_qsv filter --- libavfilter/vf_vpp_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index cdf1f61b0f..45ac761d06 100644 ---

[FFmpeg-devel] [PATCH v3 18/22] lavfi/deinterlace_qsv: simplify deinterlace_qsv filter

2021-06-14 Thread Haihao Xiang
Like what we did for scale_qsv filter, we use QSVVPPContext as a base context to manage MFX session for deinterlace_qsv filter --- libavfilter/vf_deinterlace_qsv.c | 492 ++- 1 file changed, 30 insertions(+), 462 deletions(-) diff --git a/libavfilter/vf_deinterlace_qsv

  1   2   3   >