Commit Graph

19 Commits

Author SHA1 Message Date
Fei Wang
8b83dad825 avfilter/vf_vpp_qsv: add scale mode option
The option allow user to set diffenent scaling mode from
auto/low-power/high-quality.

More details:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxExtVPPScaling

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-08-03 22:20:00 +08:00
Andreas Rheinhardt
2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +02:00
Haihao Xiang
efc22e63e5 lavfi/vf_vpp_qsv: fix the time_base for outlink
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 "-vf vpp_qsv,fps" is used, user has to wait a long time
for the ending of the pipeline because fps filter output a huge number
of frames until the wrong status pts is hit.

The issue can be triggered with the command below (use a clip with 1000
frames in this case):

$> time ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -vf
"vpp_qsv=w=1920:h=1080,fps=fps=30" -f null -
...
[out_0_0 @ 0x564ccd27e020] 10000000 buffers queued in out_0_0, something
may be wrong.
frame=40119596 fps=88080 q=-0.0 Lsize=N/A time=371:28:39.96 bitrate=N/A
speed=2.94e+03x
video:17238889kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown

real    9m7.451s
user    2m34.102s
sys     0m39.734s

In order to avoid the above issue, the same time base for input and
ouput links is used in this patch.

Fixes ticket #9286

Signed-off-by: Zhong Li <zhongli_dev@126.com>
2021-06-20 23:05:03 +08:00
Andreas Rheinhardt
a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Fei Wang
89ffcd1bbe 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>
2021-04-11 23:18:20 +08:00
Nicolas George
2f76476549 lavfi: regroup formats lists in a single structure.
It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
2020-09-08 14:02:40 +02:00
Andreas Rheinhardt
c4beb0783b avfilter/vf_vpp_qsv: Fix leak of AVFilterFormats on error
The vpp_qsv's query_formats function allocated two AVFilterFormats,
before storing them permanently. If storing the first of them fails,
the function simply returns and the second leaks. This has been fixed by
only allocating the second AVFilterFormats structure after the first one
has been successfully stored.

Fixes Coverity issue #1422231.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 23:09:32 +02:00
Paul B Mahol
d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Zhong Li
74e6800381 lavfi/qsvvpp: disable pass through mode if format changed
Partly fix tiket#8065

Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-08-20 14:11:26 +08:00
Linjie Fu
af3ddd581f lavf/vf_vpp_qsv: add support for QSV transpose filter
Add transpose support for qsv_vpp with rotate and hflip:
    - rotate: [0, 3] support clockwise rotation of 0, 90, 180, 270;
    - hflip:  [0, 1] support horizontal flip;

Configure with:
{"cclock_hflip","clock","cclock","clock_hflip","reversal","hflip","vflip"}

CMD:
ffmpeg -hwaccel qsv -c:v h264_qsv -i input.h264
    -vf 'format=qsv,vpp_qsv=transpose=clock' -c:v h264_qsv output.h264

ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -i input.h264
    -vf 'hwupload=extra_hw_frames=64,format=qsv,vpp_qsv=transpose=cclock_hflip'
                            -f rawvideo -pix_fmt nv12 ./transpose.yuv

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-08-07 20:58:49 +08:00
Zhong Li
4208b428c4 lavf/qsv_vpp: add frame format option
1. Currently output format is hard-coded as NV12, thus means
   CSC is always done for not NV12 input such as P010.
   Follow original input format as default output.
2. Add an option to specify output format.

Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-06-14 10:27:33 +08:00
Zhong Li
e62f625163 lavf/qsvvpp: add P010 output format support
Signed-off-by: Zhong Li <zhong.li@intel.com>
2019-06-10 13:48:41 +08:00
Ruiling Song
d865783b6c lavf/qsv: clone the frame which may be managed by framework
For filters based on framesync, the input frame was managed
by framesync, so we should not directly keep and destroy it,
instead we make a clone of it here, or else double-free will occur.
But for other filters not based on framesync, we still need to
free the input frame inside filter_frame.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-04-21 19:00:43 +01:00
James Almer
ae7e66fb4b Merge commit '29a8ed766354c45c9be4b8512c5b2eb25a450cdc'
* commit '29a8ed766354c45c9be4b8512c5b2eb25a450cdc':
  lavf/qsvvpp: bypass vpp if not needed.

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 19:58:47 -03:00
Zhong Li
29a8ed7663 lavf/qsvvpp: bypass vpp if not needed.
Currently vpp pipeline is always created, even for the unnecessary
cases such as setting the option "vpp_qsv=w=1280:h=720" for an input
with native resolution 1280x720. Thus introduces unnecessary performance
dropping, so bypass vpp if not needed.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2018-04-08 20:47:59 +02:00
Zhong Li
f7d77b4112 lavf/qsv_vpp: check the return value of ff_formats_ref()
Fixes the build warning of "ignoring return value of ‘ff_formats_ref’,
declared with attribute warn_unused_result"

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-11-20 15:47:05 +00:00
Michael Niedermayer
1828c549c3 avfilter/vf_*_qsv: Fix flags
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-13 03:58:34 +01:00
James Almer
4391d6cb81 Merge commit 'a5a6ac1a123a927e5bed984ed757a29b7ff87dab'
* commit 'a5a6ac1a123a927e5bed984ed757a29b7ff87dab':
  libavfilter/overlay_qsv: Add QSV overlay vpp filter
  libavfilter/vf_vpp: Add common filters of the qsv vpp

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 15:07:06 -03:00
Huang, Zhengxu
8d3666c425 libavfilter/vf_vpp: Add common filters of the qsv vpp
Add common filters of the qsv vpp features including scale,denosie,
deinterlace,frc,crop and procAmp.

Performance will be significantly reduced in the test if using cascade
mode just like qsv framerate + qsv scale + qsv deinterlace + qsv denoise in
separated way no matter in system or video memmory cases.
And the code is so redundant because so much the same just as session and
surface's creation and management.
So we add a common qsv filter.

Usage:
-hwaccel qsv -c:v h264_qsv -r 25 -i in -vf
vpp_qsv=w=iw/2:h=400:deinterlace=1:framerate=60:detail=50:denoise=50
-b 2M -maxrate 3M -c:v h264_qsv -y out.h264

Signed-off-by: ChaoX A Liu <chaox.a.liu@gmail.com>
Signed-off-by: Zhengxu Huang <zhengxu.maxwell@gmail.com>
Signed-off-by: Andrew Zhang <huazh407@gmail.com>
Change-Id: I130392ce722138c209ab658c5f03f0009b6e8024
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2017-09-17 19:57:13 +02:00