summaryrefslogtreecommitdiff
path: root/libavfilter/vf_vpp_qsv.c
Commit message (Collapse)AuthorAge
* avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)softworkz2022-01-10
| | | | | | | | | | | | Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way that scaling via vpp_qsv doesn't work any longer for devices with an MSDK runtime version lower than 1.19. This is true for older CPUs which are stuck at 1.11. The commit added checks for the compile-sdk version but it didn't test for the runtime version. Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one looks at the many query_formats callbacks in existence, one will immediately recognize that there is one type of default callback for video and a slightly different default callback for audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);" for video with a filter-specific pix_fmts list. For audio, it is the same with a filter-specific sample_fmts list together with ff_set_common_all_samplerates() and ff_set_common_all_channel_counts(). This commit allows to remove the boilerplate query_formats callbacks by replacing said callback with a union consisting the old callback and pointers for pixel and sample format arrays. For the not uncommon case in which these lists only contain a single entry (besides the sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also added to the union to store them directly in the AVFilter, thereby avoiding a relocation. The state of said union will be contained in a new, dedicated AVFilter field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t in order to create a hole for this new field; this is no problem, as the maximum of all the nb_inputs is four; for nb_outputs it is only two). The state's default value coincides with the earlier default of query_formats being unset, namely that the filter accepts all formats (and also sample rates and channel counts/layouts for audio) provided that these properties agree coincide for all inputs and outputs. By using different union members for audio and video filters the type-unsafety of using the same functions for audio and video lists will furthermore be more confined to formats.c than before. When the new fields are used, they will also avoid allocations: Currently something nearly equivalent to ff_default_query_formats() is called after every successful call to a query_formats callback; yet in the common case that the newly allocated AVFilterFormats are not used at all (namely if there are no free links) these newly allocated AVFilterFormats are freed again without ever being used. Filters no longer using the callback will not exhibit this any more. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavfilter/vf_vpp_qsv: fix uninitialized variable problemWenbin Chen2021-09-15
| | | | | | | | | | This two variables may be used below with uninitialized value. Now fix them. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilterAndreas Rheinhardt2021-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, an AVFilter's lists of input and output AVFilterPads were terminated by a sentinel and the only way to get the length of these lists was by using avfilter_pad_count(). This has two drawbacks: first, sizeof(AVFilterPad) is not negligible (i.e. 64B on 64bit systems); second, getting the size involves a function call instead of just reading the data. This commit therefore changes this. The sentinels are removed and new private fields nb_inputs and nb_outputs are added to AVFilter that contain the number of elements of the respective AVFilterPad array. Given that AVFilter.(in|out)puts are the only arrays of zero-terminated AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads are not zero-terminated and they already have a size field) the argument to avfilter_pad_count() is always one of these lists, so it just has to find the filter the list belongs to and read said number. This is slower than before, but a replacement function that just reads the internal numbers that users are expected to switch to will be added soon; and furthermore, avfilter_pad_count() is probably never called in hot loops anyway. This saves about 49KiB from the binary; notice that these sentinels are not in .bss despite being zeroed: they are in .data.rel.ro due to the non-sentinels. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/internal: Don't include libavcodec/(avcodec|internal).hAndreas Rheinhardt2021-08-05
| | | | | | | | | The reasons for including them don't exist any longer: ff_tlog() has been moved to libavutil/internal.h and FF_QSCALE_TYPE_* has been moved to qp_table.h. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_vpp_qsv: Don't overrun stack arrayAndreas Rheinhardt2021-08-04
| | | | | | | | | | | | | 8b83dad82512a6948b63408f964463b063ad24c9 added another potentially used video enhancement filter without increasing a define for the number of such options which is used as the size of stack array. This can lead to a buffer overrun if all filters are used simultaneously. So increase said number. Fixes Coverity ticket #1489775. Reviewed-by: Linjie Fu <linjie.justin.fu@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_vpp_qsv: add scale mode optionFei Wang2021-08-03
| | | | | | | | | | | 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>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavfi/vf_vpp_qsv: fix the time_base for outlinkHaihao Xiang2021-06-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-27
| | | | | | | 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>
* lavfi/qsvvpp: support async depthFei Wang2021-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lavfi: regroup formats lists in a single structure.Nicolas George2020-09-08
| | | | | | | | | | | | | | | 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/*(.)
* avfilter/vf_vpp_qsv: Fix leak of AVFilterFormats on errorAndreas Rheinhardt2020-08-23
| | | | | | | | | | | | | 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>
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-17
| | | | It is not needed at all.
* lavfi/qsvvpp: disable pass through mode if format changedZhong Li2019-08-20
| | | | | | Partly fix tiket#8065 Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavf/vf_vpp_qsv: add support for QSV transpose filterLinjie Fu2019-08-07
| | | | | | | | | | | | | | | | | | | | 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>
* lavf/qsv_vpp: add frame format optionZhong Li2019-06-14
| | | | | | | | | 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>
* lavf/qsvvpp: add P010 output format supportZhong Li2019-06-10
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavf/qsv: clone the frame which may be managed by frameworkRuiling Song2018-04-21
| | | | | | | | | | 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>
* Merge commit '29a8ed766354c45c9be4b8512c5b2eb25a450cdc'James Almer2018-04-13
|\ | | | | | | | | | | | | * commit '29a8ed766354c45c9be4b8512c5b2eb25a450cdc': lavf/qsvvpp: bypass vpp if not needed. Merged-by: James Almer <jamrial@gmail.com>
| * lavf/qsvvpp: bypass vpp if not needed.Zhong Li2018-04-08
| | | | | | | | | | | | | | | | | | | | 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>
* | lavf/qsv_vpp: check the return value of ff_formats_ref()Zhong Li2017-11-20
| | | | | | | | | | | | | | | | | | 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>
* | avfilter/vf_*_qsv: Fix flagsMichael Niedermayer2017-11-13
| | | | | | | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'a5a6ac1a123a927e5bed984ed757a29b7ff87dab'James Almer2017-11-11
|/ | | | | | | | * 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>
* libavfilter/vf_vpp: Add common filters of the qsv vppHuang, Zhengxu2017-09-17
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>