summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: use the new AVFrame interlace flags in all decoders and encodersJames Almer2023-05-041-3/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* libavcodec/qsvenc: Add dynamic setting support of low_delay_brc to av1_qsvWenbin Chen2023-03-171-1/+4
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Enable 444 encoding for RGB inputWenbin Chen2023-02-271-0/+4
| | | | | | | | MSDK/VPL uses 420 chroma format as default to encode RGB, and this is not a proper usage. Now enable 444 encoding for RGB input by default. When main profile is used, RGB input is still encoded in 420 format. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Flush cached frames before reset encoderWenbin Chen2023-02-161-56/+66
| | | | | | | | | | | According to https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#configuration-change. Before calling MFXVideoENCODE_Reset, The application needs to retrieve any cached frames in the SDK encoder. A loop is added before MFXVideoENCODE_Reset to retrieve cached frames and add them to async_fifo, so that dynamic configuration works when async_depth > 1. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Do not pass RGB solorspace to VPL/MSDKWenbin Chen2023-02-161-1/+6
| | | | | | | When encode RGB frame, Intel driver convert RGB to YUV, so we cannot set RGB colorspace to VPL/MSDK. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: enable Hyper Encodegalinart2023-01-301-2/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hyper Encode uses Intel integrated and discrete graphics on one system to accelerate encoding of a single video stream. Depending on the selected parameters and codecs, performance gain on AlderLake iGPU + ARC Gfx up to 1.6x. More information: https://www.intel.co.uk/content/www/uk/en/architecture-and-technology/adaptix/deep-link.html Developer guide: https://github.com/oneapi-src/oneVPL-intel-gpu/blob/main/doc/HyperEncode_FeatureDeveloperGuide.md Hyper Encode is supported only on Windows and requires D3D11 and oneVPL. To enable Hyper Encode need to specify: -Hyper Encode mode (-dual_gfx on or dual_gfx adaptive) -Encoder: h264_qsv or hevc_qsv -BRC: VBR, CQP or ICQ -Lowpower mode (-low_power 1) -Closed GOP for AVC or strict GOP for HEVC -idr_interval = 0 used by default Depending on the encoding parameters, the following parameters may need to be adjusted: -g recommended >= 30 for better performance -async_depth recommended >= 30 for better performance -extra_hw_frames recommended equal to async_depth value -bf recommended = 0 for better performance In the cases with fast encoding (-preset veryfast) there may be no performance gain due to the fact that the decode is slower than the encode. Command line examples: ffmpeg.exe -init_hw_device qsv:hw,child_device_type=d3d11va,child_device=0 -v verbose -y -hwaccel qsv -extra_hw_frames 60 -async_depth 60 -c:v h264_qsv -i bbb_sunflower_2160p_60fps_normal.mp4 -async_depth 60 -c:v h264_qsv -preset medium -g 60 -low_power 1 -bf 0 -dual_gfx on output.h265 Signed-off-by: galinart <artem.galin@intel.com>
* libavcodec/qsvenc_av1: Add max_frame_size support to av1_qsv encoderWenbin Chen2023-01-091-0/+3
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc_av1: Add low_delay_brc support to av1_qsv encoderWenbin Chen2023-01-091-0/+4
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc.c: Enable MFX_GOP_STRICT when adpative gop is disabledWenbin Chen2022-12-011-1/+8
| | | | | | | adaptive_i and adaptive_b cannot work with MFX_GOP_STRICT, so only enable MFX_GOP_STRICT when these features are disabled. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add skip_frame support to qsvencWenbin Chen2022-11-071-0/+36
| | | | | | | | | | | | | | | | | Add skip_frame support to qsvenc. Use per-frame metadata "qsv_skip_frame" to control it. skip_frame option defines the behavior of qsv_skip_frame. no_skip: Frame skipping is disabled. insert_dummy: Encoder inserts into bitstream frame where all macroblocks are encoded as skipped. insert_nothing: Similar to insert_dummy, but encoder inserts nothing. The skipped frames are still used in brc. For example, gop still include skipped frames, and the frames after skipped frames will be larger in size. brc_only: skip_frame metadata indicates the number of missed frames before the current frame. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc_hevc: add tier optionnyanmisaka2022-11-071-1/+4
| | | | | | | Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the -level is specified. Also, according to the HEVC specs, only level >= 4 can support High Tier. Signed-off-by: nyanmisaka <nst799610810@gmail.com>
* lavc/qsvenc: enlarge the maximum number of ExtParam buffers on mfxEncodeCtrlHaihao Xiang2022-10-251-19/+8
| | | | | | | | | The next commit and other commits in future will use more ExtParam buffers. And combine 2 free functions into single one Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: fix check to avoid segfaultHaihao Xiang2022-10-251-2/+2
| | | | Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc_av1: add av1_qsv encoderWenbin Chen2022-10-241-4/+192
| | | | | | | | | | | | It is available only when libvpl is enabled. MSDK doesn't support av1 encoding. sample command: ffmpeg -f rawvideo -pix_fmt nv12 -s 1920x1080 -i input.yuv \ -c:v av1_qsv output.ivf Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: fill the padding areaHaihao Xiang2022-10-181-2/+67
| | | | | | | qsvenc makes a copy when the input in system memory is not padded as the SDK requires, however the padding area is not filled with right data Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsv: specify Shift for each format tooHaihao Xiang2022-10-101-4/+2
| | | | Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add pic_timing_sei reset support to qsvWenbin Chen2022-09-301-0/+21
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add bitrate reset support to qsvencWenbin Chen2022-09-301-0/+38
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add framerate reset support to qsvWenbin Chen2022-09-301-0/+26
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: fixy typo for min/max qp resetDmitry Rogozhkin2022-09-261-2/+2
| | | | | | | Fixes: 005c7a4 ("libavcodec/qsvenc: Add max/min qp reset support in qsvenc") Reviewed-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
* libavcodec/qsvenc: Add low_delay_brc reset support to qsvencWenbin Chen2022-09-091-1/+22
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add max/min qp reset support in qsvencWenbin Chen2022-09-091-0/+78
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add intra refresh reset support to qsvencWenbin Chen2022-09-091-0/+33
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add gop_size reset support to qsvencWenbin Chen2022-09-091-0/+16
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: Add max_frame_size reset support to qsvWenbin Chen2022-09-091-0/+20
| | | | Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: skip parameter resetting on mjpeg_qsvWenbin Chen2022-09-091-1/+1
| | | | | | mjpeg_qsv don't support dynamic resetting, so skip it. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* lavc/qsvenc: use VBR if maxrate is not specified on WindowsHaihao Xiang2022-09-071-1/+4
| | | | | | | | | | | | | | Currently AVBR is disabled and VBR is the default method if maxrate is not specified on Linux, but AVBR is the default one if maxrate is not specified on Windows. In order to make user experience better accross Linux and Windows, use VBR by default on Windows if maxrate is not specified. User need to set both avbr_accuracy and avbr_convergence to non-zero explicitly and not to specify maxrate if AVBR is expected. In addition, AVBR works for H264 and HEVC only in the SDK. $ ffmpeg.exe -v verbose -f lavfi -i yuvtestsrc -vf "format=nv12" -c:v vp9_qsv -f null -
* lavc/qsvenc: enlarge the SPS buffer to retrieve larger headergavin zhang2022-08-291-1/+1
| | | | | | | Increase SPS header buffer to support larger header Signed-off-by: gavin zhang <gavin.zhang@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvenc: ignore video signal info buffer for VP9Haihao Xiang2022-08-291-1/+1
| | | | | | The SDK doesn't support this type of buffer for vp9 encoding Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* qsvenc_{hevc,h264}: add scenario optionHaihao Xiang2022-08-231-0/+3
| | | | | | | | User may get better experience after providing corresponding senario hint to encoder for the encoding session. See [1] for scenario support in the SDK [1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#scenarioinfo
* libavcodec/qsvenc: Add adaptive_i/b to hevc_qsvWenbin Chen2022-08-231-5/+4
| | | | | | | | | Add adaptive_i/b feature to hevc_qsv. Adaptive_i allows changing of frame type from P and B to I. Adaptive_b allows changing of frame type frome B to P. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* qsv: restrict OPAQUE memory to MFX_VERSION < 2.0Haihao Xiang2022-08-121-0/+21
| | | | | | | | 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/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsvenc: restrict MFX_RATECONTROL_LA_EXT to MFX_VERSION < 2.0Haihao Xiang2022-08-121-0/+2
| | | | | | | | 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/VPL_intel_media_sdk.html#msdk-full-name-feature-removals [2] https://github.com/oneapi-src/oneVPL
* qsv: remove mfx/ prefix from mfx headersHaihao Xiang2022-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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 CFLAGS when running 'configure --enable-libmfx' for old versions of libmfx, if so, mfx headers without mfx/ prefix can be included too. If libmfx comes without pkg-config support, we may do a small change to the settings of the environment(e.g. set -I/opt/intel/mediasdk/include/mfx instead of -I/opt/intel/mediasdk/include to CFLAGS), then the build can find the mfx headers without mfx/ prefix After applying this change, we won't need to change #include for mfx headers when mfx headers are installed under a new directory. This is in preparation for oneVPL support (mfx headers in oneVPL are installed under vpl directory)
* libavcodec/qsvenc: Use parameter from AVCodecContext to reset qsv codecWenbin Chen2022-07-201-26/+24
| | | | | | | | | | | | | | | Using parameter from AVCodecContext to reset qsv codec is more suitable for MFXVideoENCODE_Reset()'s usage. Per-frame metadata is more suitable for the usage of mfxEncodeCtrl being passed to MFXVideoENCODE_EncodeFrameAsync(). Now change it to use the value from AVCodecContext. Because q->param is passed to both "in" and "out" parameters when call MFXVideoENCODE_Query(), the value in q->param may be changed. New variables are added to store old configuration, so that we can detect real parameter change. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Change the parameter log to be thread safeWenbin Chen2022-07-201-45/+42
| | | | | | | | Dividing one line log into several av_log() call is not thread safe. Now merge these strings into one av_log() call. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Enable fixed QP configure in qsv CQP runtimeYue Heng2022-06-271-0/+89
| | | | | | | | | | Enable dynamic QP configuration in runtime on qsv encoder. Through AVFrame->metadata, we can set key "qsv_config_qp" to change QP configuration when we encode video in CQP mode. Signed-off-by: Yue Heng <yue.heng@intel.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: add ROI support to qsv encoderWenbin Chen2022-06-171-0/+85
| | | | | | | | | Use The mfxEncoderCtrl parameter to enable ROI. Get side data "AVRegionOfInterest" and use it to configure "mfxExtEncoderROI" which is the MediaSDK's ROI configuration. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add min/max QP control options for I/P/B frameYue Heng2022-06-061-2/+19
| | | | | | | | | To do more accurate QP control, add min/max QP control on I/P/B frame separately to qsv encoder. qmax and qmin still work but newly-added options have higher priority. Signed-off-by: Yue Heng <yue.heng@intel.com> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* qsv: add requirement for the mininal version of libmfxHaihao Xiang2022-05-251-308/+168
| | | | | | | | | | libmfx 1.28 was released 3 years ago, it is easy to get a greater version than 1.28. We may remove lots of compile-time checks if adding the requirement for the minimal version in the configure script. Reviewed-by: softworkz <softworkz@hotmail.com> Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* qsvenc: fix typoHaihao Xiang2022-04-081-1/+1
| | | | | Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Add more pixel format support to qsvencWenbin Chen2022-04-061-26/+4
| | | | | | | | | Qsv encoder only support input P010 and nv12 format directly from system memory. For other format, we need to upload frame to device memory and input qsv format to encoder. Now add other system memory format support to qsv encoder. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: enable LowDelayBRC and MaxFrameSizeI/MaxFrameSizeP for ↵He, Fan F2022-04-061-0/+17
| | | | | | | | | | more accurate bitrate control Feature introduction of LowDelayBRC, MaxFrameSizeI and MaxFrameSizeP could be found here: https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md Signed-off-by: Dmitry Ermilov <dmitry.ermilov@intel.com> Signed-off-by: Fan F He <fan.f.he@intel.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* qsvenc: avoid dereferencing the null pointerTong Wu2022-02-281-1/+1
| | | | | | | The variable AVFrame *frame could be a null pointer, now add a null pointer check to avoid dereferencing the null pointer. Signed-off-by: Tong Wu <tong1.wu@intel.com>
* libavcodec/qsvenc: add mbbrc to hevc_qsvWenbin Chen2022-02-281-2/+3
| | | | | | | | Add mbbrc to hevc_qsv For detailed description, please see "mbbrc" part in: https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption2 Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc: add more ChromaFormat support to mjpeg_qsvWenbin Chen2022-02-281-1/+2
| | | | | | | | ChromaForamt for mjpeg-qsv is always set to yuv420, and this will be wrong when encode other pixel format (for example yuyv422). ChromaFormat is changed to be adaptive to pix_fmt. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
* libavcodec/qsvenc_hevc: encode RGB format rawvideoWenbin Chen2022-02-221-0/+8
| | | | | | | | | | | Add support for hevc_qsv to input RGB format frame. It will transform frame to yuv inside MediaSDK instead of using auto scale. Now hevc_qsv supports directly encoding BGRA and X2RGB10 format. The X2RGB10 correspond to the A2RGB20 format and BGRA correspond to RGB4 format in MediaSDK. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/qsvenc: Reindent after the previous commitAndreas Rheinhardt2022-02-071-10/+10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/qsvenc: switch to new FIFO APIAnton Khirnov2022-02-071-72/+54
|