summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
Commit message (Collapse)AuthorAge
* avcodec/qsvenc: Reindent after the previous commitAndreas Rheinhardt2022-02-07
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/qsvenc: switch to new FIFO APIAnton Khirnov2022-02-07
|
* lavc/qsvenc: add tile encoding support for VP9Haihao Xiang2022-01-29
| | | | | | | Add -tile_rows and -tile_cols options to specify the number of tile rows and columns Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh ↵Wenbin Chen2022-01-27
| | | | | | | | | | | | parameter Add intra refresh support to hevc_qsv as well. Add an new intra refresh type: "horizontal", and an new param ref_cycle_dist. This param specify the distance between the beginnings of the intra-refresh cycles in frames. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add b_strategy option to hevc_qsvWenbin Chen2022-01-27
| | | | | | | | Add b_strategy option to hevc_qsv. By enabling this option, encoder can use b frames as reference. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add max slice size support to hevc_qsvWenbin Chen2022-01-27
| | | | | | | Add max_slice_size option to hevc_qsv as well. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: fix a memory leak problemWenbin Chen2022-01-24
| | | | | | | | | | "qf->frame" ref to input frame but it isn't released. av_frame_unref() is added before refering qf->frame to new frame to make sure the previous reference is released. Reported-by: Mark Samuelson <Mark.Samuelson@sonicfoundry.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add transform skip to hevc_qsvWenbin Chen2022-01-21
| | | | | | | | | Add transform_skip option to hevc_qsv. By enabling this option, the transform_skip_enabled_flag in PPS will be set to 1. This option is supported on the platform equal or newer than ICL. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add low latency P-pyramid support to qsvWenbin Chen2022-01-21
| | | | | | | | | | | Add low latency P-pyramid support to qsv. This feature relates to command line option "-p_strategy". To enable this flag, user also need to set "-bf" to 0. P-strategy has two modes "1-simple" and "2-pyramid". The details of the two models refer to https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#preftype Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add DisableDeblockingIdc support to qsvWenbin Chen2022-01-21
| | | | | | | | Add dblk_idc option to 264_qsv and hevc_qsv. Turining on this opion can disable deblocking. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add max_frame_size support to hevc_qsvWenbin Chen2022-01-21
| | | | | | | Add max_frame_size support to hevc_qsv as well. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: add encode support for screen content coding extensionHaihao Xiang2022-01-18
| | | | | | Enables HEVC Screen Content Coding extension support on ICL+ platform Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: add return check for ff_qsv_map_pixfmtLinjie Fu2022-01-10
| | | | | | | | Return an error directly if pixfmt is not supported for encoding, otherwise it may be hidden until query/check in MSDK. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: set base address for V planeHaihao Xiang2022-01-05
| | | | | | | | | | | | | The SDK checks Data.V when using system memory for VP9 encoding. This fixed the error below: $ ffmpeg -qsv_device /dev/dri/renderD129 -f lavfi -i yuvtestsrc -c:v vp9_qsv -f null - [vp9_qsv @ 0x55b8387cbe90] Error during encoding: NULL pointer (-2) Video encoding failed Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: enable lookahead for hevc encodingZhong Li2021-12-23
| | | | | | | | | Update version based on the patch: https://patchwork.ffmpeg.org/project/ffmpeg/patch/20211009015949.1510-1-haihao.xiang@intel.com/ Signed-off-by: Daniel Socek <daniel.socek@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: specify codec name when print profileZhong Li2021-12-23
| | | | | | | | It is more clear and easily to detect the issues similar to commit 3857ecbe70e81cb6ad7a7f155c311e8522b93b3e Signed-off-by: Zhong Li <zhongli_dev@126.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: dump parameters for mjpeg encoding in verbose modeHaihao Xiang2021-12-19
| | | | Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: dump parameters for VP9 encoding in verbose modeHaihao Xiang2021-12-19
| | | | Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: add VP9 profilesHaihao Xiang2021-12-19
| | | | Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: define profile array per codecHaihao Xiang2021-12-19
| | | | | | | | | | | | | The SDK defines HEVC, VP9 and AV1 profiles in the same values e.g. MFX_PROFILE_HEVC_MAIN =1, MFX_PROFILE_VP9_0 =1, MFX_PROFILE_AV1_MAIN =1, To avoid potential errors when adding VP9, AV1 profiles later, this patch defines profile array per codec. Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvenc: remove VC1 profilesHaihao Xiang2021-12-19
| | | | | | | | | | | | | | The SDK doesn't support VC1 encoding. In addition, both MFX_PROFILE_VC1_SIMPLE and MFX_PROFILE_HEVC_MAIN are 1 in the SDK, HEVC main profile is recognized as simple profile in the verbose output if don't remove VC1 profiles. $ ffmpeg -v verbose -qsv_device /dev/dri/renderD129 -f lavfi -i yuvtestsrc -c:v hevc_qsv -f null - [hevc_qsv @ 0x55bdf7eb4eb0] profile: simple; level: 21 Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec/qsvenc: Properly flush the FIFO on closeAndreas Rheinhardt2021-11-30
| | | | | | | | Freeing the new H.264 specific fields has been forgotten. (This leak only appears in case the encoder has not been completely drained.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Fix leak of A53 dataAndreas Rheinhardt2021-11-30
| | | | | | | Up until now, it has only been freed when the QSVFrame is reused, so that the last one contained in it leaked at the end. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CCAndreas Rheinhardt2021-11-30
| | | | | | | | | | | | | | | | | | | | | Since commit 3bbe0c210b05fc6fbd7b1d4bbd8479db7f2cf957, the Payloads array of every QSVFrame leaks as soon as the frame is reused; the leak is small and not very noticeable, but if there is an attempt to use said array the ensuing crash is much more noticeable. This happens when encoding H.264 with A53 CC side data. Furthermore, if said array can not be allocated at all, an AVFrame leaks. Fix all of this by not allocating the array separately at all; put it in QSVFrame instead and restore the Payloads array upon reusing the frame. Finally, use av_freep() instead of av_free() to free the payload entries. Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Remove dead code for user-provided buffersAndreas Rheinhardt2021-09-25
| | | | | | | Dead since commit 93016f5d1d280f9cb7856883af287fa66affc04c which ensured that the packets received by encoders are always blank. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Fix memleaks upon allocation errorsAndreas Rheinhardt2021-09-25
| | | | | | | Fixes leaks in case the allocation of the H.264-specific stuff fails. Fixes Coverity issues #1442911 and #1442914. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsv_enc: do not reuse enc_ctrl from previous framesXu Guangxin2021-09-09
| | | | | | | | | fixes #8857 If we do not clear the enc_ctrl, we will reuse previous frames' data like FrameType. Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/qsvenc: allows the SDK runtime to choose LowPower/non-LowPower modesHaihao Xiang2021-08-12
| | | | | | | | | | | | | The SDK supports LowPower and non-LowPower modes, but some features are available only under one of the two modes. Currently non-LowPower mode is always chosen in FFmpeg if the mode is not set to LowPower explicitly. User will experience some SDK errors if a LowPower related feature is specified but the mode is not set to LowPower. With this patch, the mode is set to unknown by default in FFmpeg, the SDK is able to choose a workable mode for the specified features. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/qsvenc: pass the color properties to the SDKHaihao Xiang2021-08-04
| | | | | | | | | Otherwise the color properties won't be encoded into the bitstream header Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* qsvenc: Value '0' is not a valid value for parameter GopOptFlagHaihao Xiang2021-07-27
| | | | | | | | The accepted values for GopOptFlag are MFX_GOP_CLOSED (1) and MFX_GOP_STRICT (2). Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec/qsvenc: clip global_quality for ICQ modes.Gyan Doshi2021-07-12
| | | | | | Allowed range is 1 to 51. Ref: https://software.intel.com/content/www/us/en/develop/articles/advanced-bitrate-control-methods-in-intel-media-sdk.html
* qsvenc_hevc: allow user set more coding optionsHaihao Xiang2021-07-02
| | | | | | | | | The SDK supports NalHrdConformance, RecoveryPointSEI and AUDelimiter for hevc encoder, so we may allow user to set these coding options like as what we did for h264_qsv encoder. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec: Remove deprecated AVCodecContext.coded_frameAndreas Rheinhardt2021-04-27
| | | | | | | | | | Deprecated in 40cf1bbacc6220a0aa6bed5c331871d43f9ce370. (The currently disabled filter vf_mcdeint and vf_uspp were users of this field; they have not been changed, so that whoever wants to fix them can see the state of these filters when they were disabled.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove private options from AVCodecContextAndreas Rheinhardt2021-04-27
| | | | | | | | | Several options that were too codec-specific were deprecated between 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 and 0e9c4fe254073b209970df3e3cb84531bc388e99. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated coder type optionsAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in be00ec832c519427cd92218abac77dafdc1d5487. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* 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>