summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
Commit message (Collapse)AuthorAge
* qsv: dump more info in error, debug and verbose modeHaihao Xiang2021-01-23
| | | | | | | | Dump iopattern mode and the SDK error/warning desciptions for qsv based filters and iopattern mode for qsvenc Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com
* lavc: Mark hw_config pointer arrays as constMark Thompson2020-11-08
| | | | They are read-only just like the HWConfig structures they point to.
* lavc/qsvenc_hevc: add qmax/qmin support for HEVC encodingLinjie Fu2020-07-05
| | | | | | | | | | | | Add qmax/qmin support for HEVC software bitrate control(SWBRC). Limitations: - RateControlMethod != MFX_RATECONTROL_CQP - with EXTBRC ON Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec/internal: move packet related functions to their own headerJames Almer2020-06-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/qsvenc: add encode support for HEVC 4:2:2 8-bit and 10-bitLinjie Fu2020-05-18
| | | | | | | | | Enables HEVC Range Extension encoding support (Linux) for 4:2:2 8/10 bit on ICL+ (gen11 +) platform. Restricted to linux only for now. Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/qsvenc: Add hardware config metadataMark Thompson2020-04-26
| | | | | | All of these encoders can accept libmfx surfaces directly in a hardware frames context, or they can accept software frames if a suitable device is supplied to use.
* lavc/qsvenc: Fix format specifiers for two variables of type int.Carl Eugen Hoyos2020-04-04
|
* lavc/qsvenc: add support for external bitrate control for HEVCLinjie Fu2020-02-18
| | | | | | | | | | Enables option for hevc_qsv encoder: -extbrc Improvements in BD-Rate could be observed with extbrc on. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* libavcodec/qsvenc.c: Set mjpeg height and width alignmentJonCookCubic2020-02-18
| | | | | | | | | | Currently width_align and height_align are zero when encoding with mjpeg_qsv, which causes "Error submitting the frame for encoding". This patch sets the alignments. There is a little bit more about the problem here http://ffmpeg.org/pipermail/ffmpeg-user/2019-November/046143.html Signed-off-by: JonCookCubic <jon.cook@cubicmotion.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: add Tiles encode support for HEVCLinjie Fu2019-12-12
| | | | | | | | | | | | | | | | | | | | | | Add -tile_rows and -tile_cols option to specify the number of tile rows and columns for ICL+ (gen 11) platform. A tile must wholly contain all the slices within it. Slices cannot cross tile boundaries. So the slice number would be implicitly resized to the max(nSlice, nTile). Example: ffmpeg -v verbose -hwaccel qsv -init_hw_device qsv=hw -filter_hw_device hw -f rawvideo -s:v 1920x1080 -i ./input.nv12 -vf format=nv12,hwupload=extra_hw_frames=64 -c:v hevc_qsv -tile_rows 2 -tile_cols 2 -slices 4 -y output.h265 Also dump the actual quantity of encoded tiled rows and columns in run time. Fix the enhancement #8400. Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/qsvenc: Fix some code indentationsLinjie Fu2019-11-28
| | | | Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/qsvenc: Fix compilation for some build environments.Carl Eugen Hoyos2019-11-27
| | | | Reported and tested by Sean Darcy.
* lavc/qsvenc: enable vp9 encoderZhong Li2019-11-03
| | | | | | | | | | 1. must enable low_power mode since just VDENC can be supported by iHD driver right now 2. Coding option1 and extra_data are not supported by MSDK 3. IVF header will be inserted in MSDK by default, but it is not needed for FFmpeg, so disable it. Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: Fix bitrate_limit to allow AVC encode in limited bitrateLinjie Fu2019-11-03
| | | | | | | | | | | | | | | | MFXVideoENCODE_Query calls CheckVideoParamQueryLike in MSDK and will determine whether to set param.mfx.TargetKbps to the allowed minTargetKbps according to the bitrate_limit in extco2 buffer. Thus q->param.ExtParam must be set before MFXVideoENCODE_Query in case minTargetKbps is written to TargetKbps by default. 1080P AVC encoding with option "-bitrate_limit 0 -b:v 100k": Before patch: 902 kbps After patch: 156 kbps Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* lavc/qsvdec: Add GPU-accelerated memory copy supportLinjie Fu2019-10-09
| | | | | | | | | | | | | | | | GPU copy enables or disables GPU accelerated copying between video and system memory. This may lead to a notable performance improvement. Memory must be sequent and aligned with 128x64. CMD: ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -gpu_copy on -i input.h264 -f null - or: ffmpeg -c:v h264_qsv -gpu_copy on -i input.h264 -f null - Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: ChaoX A Liu <chaox.a.liu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsv: Fix MSDK initialization failure in system memory modeZhong Li2019-09-26
| | | | | | | | | | | | MSDK does not create internal acceleration device on Linux, So MFXVideoCORE_SetHandle() is necessary. It has been added for ff_qsv_init_session_device(). But missed for ff_qsv_init_internal_session() due to commit 1f26a23 overwrited commit db89f45 Fix #7030 Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: fix the incorrent map from bits to bytesZhong Li2019-07-01
| | | | | Reported-by:Maggie Sun <maggie.sun@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: Fix the memory leak for enc_ctrl.PayloadLinjie Fu2019-05-22
| | | | | | | | | | | | | frame->enc_ctrl.Payload is malloced in get_free_frame, directly memset the whole structure of enc_ctrl to zero will cause the memory leak for enc_ctrl.Payload. frame->enc_ctrl as a structure will be malloc and init to zero by calling frame = av_mallocz(sizeof(*frame)), so the memset is redundant and can be removed. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: enable hevc gpb optionZhong Li2019-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | GPB is the default type, just contains forward references but the slice_type is B slice with higher encoding efficiency than regular P slice, but lower performance. Add an option to allow user to set regular P slice. Fix ticket#6870 Test data on Intel Kabylake (i7-7567U CPU @ 3.50GHz): 1. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough -vframes 1000 -c:v hevc_qsv -gpb 0 -bf 0 -q 25 test_gpb_off_bf0_kbl.mp4 transcoding fps: 85 encoded file size of test_gpb_off_bf0_kbl.mp4: 21960100 (bytes) 2. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough -vframes 1000 -c:v hevc_qsv -gpb 1 -bf 0 -q 25 test_gpb_on_bf0_kbl.mp4 transcoding fps: 79 encoded file size oftest_gpb_on_bf0_kbl.mp4: 21211449 (bytes) In this case, enable gpb can bring about 7% performance drop but 3.4% encoding efficiency improvment. Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: enable hevc coding options configurationZhong Li2019-04-03
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: get vps extradata from MSDKZhong Li2019-04-01
| | | | | Signed-off-by: Zhong Li <zhong.li@intel.com> Reviewed-by: Mark Thompson <sw@jkqxz.net>
* lavc/qsvenc: expose low_power as a common option for QSV encoderLinjie Fu2019-04-01
| | | | | | | | Always exposes low_power option for all qsv encoder, and reports a warning if VDENC is not supported in current version of MSDK. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: use the common option "trellis" of AVCodecContextZhong Li2019-03-28
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: make the queried libmfx version easily reusedZhong Li2019-03-28
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: enable QVBR modeZhong Li2019-01-25
| | | | | | | | | | | | | | | | | QVBR mode is to use the variable bitrate control algorithm with constant quality. mfxExtCodingOption3 should be supported to enable QVBR mode. It is neccesary to specify a max_rate for QVBR, else it may be ICQ mode. Example usage: ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -c:v h264_qsv -global_quality 25 -maxrate 2M test_qvbr.mp4 -v verbose Clip QVBR quality range to be [0, 51] as Mark's commments. It is similar to qp range of CQP but possibly should be updated when VP8/VP9 encoding can be supported. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: set BRCParamMultiplier to aviod BRC overflowZhong Li2019-01-22
| | | | | | | | Fix ticket #7663 Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: set pict_type to be I for IDR frames.Zhong Li2019-01-10
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: add VDENC support for H264Linjie Fu2019-01-10
| | | | | | | | | | | | | | | Add VDENC(lowpower mode) support for QSV H264 It's an experimental function(like lowpower in vaapi) with some limitations: - CBR/VBR require HuC which should be explicitly loaded via i915 module parameter(i915.enable_guc=2 for linux kernel version >= 4.16) Use option "-low_power 1" to enable VDENC. Add in dump_video_param() to show the status of VDENC in runtime log. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* avcodec/qsvenc: Fix Unkown typoMichael Niedermayer2018-12-31
| | | | | Reviewed-by: Lou Logan <lou@lrcd.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/qsvenc: replace assert with error returnLinjie Fu2018-12-10
| | | | | | | | | | | | | Fix the (m)jpeg encoding regression issue as decription in tikect #7593, due to bs->FrameType is not set in such case in MSDK (https://github.com/Intel-Media-SDK/MediaSDK/issues/970). (And assert on a value coming from an external library is not proper.) Add default type check for bs->FrameType, and return invalid data error in function ff_qsv_encode to avoid using uninitialized value. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: add an option to set h264 pps for every frameZhong Li2018-12-07
| | | | | | | | | RepeatPPS is enabled by default in mfx. It is not necessary mostly and wasting encoding bits. Add an option to control it and disable it by default. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: dump log for frame rateZhong Li2018-12-07
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: make hevc alignment same as h264 for 1.19+ versionZhong Li2018-12-07
| | | | | | It is to clean up to the code and To-Do list. Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: remove redundant codeZhong Li2018-12-07
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: assert uninitialized pict_typeLinjie Fu2018-11-30
| | | | | | | | | | | Assert in function ff_qsv_encode to avoid using uninitialized value: FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->pict_type = pict_type; FF_ENABLE_DEPRECATION_WARNINGS Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvenc: add forced_idr optionZhong Li2018-11-30
| | | | | | | This option can be used to repect original input I/IDR frame type. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Zhong Li <zhong.li@intel.com>
* Merge commit 'a2041a6522642859ce64af1c618d6fb90a50d4af'James Almer2018-09-18
|\ | | | | | | | | | | | | * commit 'a2041a6522642859ce64af1c618d6fb90a50d4af': qsvenc: AV_PIX_FMT_QSV path should release frame Merged-by: James Almer <jamrial@gmail.com>
| * qsvenc: AV_PIX_FMT_QSV path should release frameMaxym Dmytrychenko2018-09-18
| | | | | | | | | | | | | | | | | | Fixes high memory usage and prevents over allocation of the frames via proper unref. Can be checked as: -hwaccel qsv -c:v h264_qsv -i ../h264-conformance/CANL2_Sony_E.jsv -c:v h264_qsv -b:v 2000k -y qsv.mp4
* | Merge commit 'c8bca9fe466f810fd484e2c6db7ef7bc83b5a943'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit 'c8bca9fe466f810fd484e2c6db7ef7bc83b5a943': lavc/qsvenc: dump BufferSizeInKB message Merged-by: James Almer <jamrial@gmail.com>
| * lavc/qsvenc: dump BufferSizeInKB messageZhong Li2018-09-02
| | | | | | | | | | Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit 'e16b20782a597e36a9c7488487c3179375a25b97'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit 'e16b20782a597e36a9c7488487c3179375a25b97': lavc/qsvenc: allow to set qp range for h264 BRC Merged-by: James Almer <jamrial@gmail.com>
| * lavc/qsvenc: allow to set qp range for h264 BRCZhong Li2018-09-02
| | | | | | | | | | Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit '76eef04f30a768fa80366d679f3de7e9447b67d5'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit '76eef04f30a768fa80366d679f3de7e9447b67d5': qsvenc: Fix a misleading log message Merged-by: James Almer <jamrial@gmail.com>
| * qsvenc: Fix a misleading log messageZhong Li2018-08-23
| | | | | | | | | | Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit '325aa63dd1a3abc2453914d0bc111d297833d725'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit '325aa63dd1a3abc2453914d0bc111d297833d725': qsv: enforcing continuous memory layout Merged-by: James Almer <jamrial@gmail.com>
| * qsv: enforcing continuous memory layoutMaxym Dmytrychenko2018-08-06
| | | | | | | | | | | | | | we need to make sure that memory allocation for Y/UV planes is continuous and re-used from a pool Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit 'c1bcd321ea2c2ae1765a1e64f03278712221d726'James Almer2018-09-02
|\| | | | | | | | | | | | | * commit 'c1bcd321ea2c2ae1765a1e64f03278712221d726': avcodec/qsv: fix async support Merged-by: James Almer <jamrial@gmail.com>
| * avcodec/qsv: fix async supportDmitry Rogozhkin2018-07-26
| | | | | | | | | | | | | | | | | | | | | | Current implementations of qsv components incorrectly work with async level, they actually try to work in async+1 level stepping into MFX_WRN_DEVICE_BUSY and polling loop. This change address this misbehaviour. Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Cc: Maxym Dmytrychenko <maxim.d33@gmail.com> Cc: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit 'f8060865f3e1a16c62e0d337ef0979b6ee4ba457'James Almer2018-09-02
|\| | | | | | | | | | | | | * commit 'f8060865f3e1a16c62e0d337ef0979b6ee4ba457': qsvenc: use the compression_level to replace private option Merged-by: James Almer <jamrial@gmail.com>
| * qsvenc: use the compression_level to replace private optionZhong Li2018-06-11
| | | | | | | | | | | | | | | | Use a common way to control target_usage, keeping consistent with vaapi encoders. The private option preset is kept only for compatibility. Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>