summaryrefslogtreecommitdiff
path: root/libavcodec/qsvdec.c
Commit message (Collapse)AuthorAge
* libavcodec/qsvdec: use the parameter from decodeHeader to configure surfaceWenbin Chen2022-02-22
| | | | | | | | | | | MSDK recognizes both yuv420p10 and yuv420p9 as MFX_FOURCC_P010, but parameters are different. When decode yuv420p9 video, ffmpeg-qsv will use yuv420p10le to configure surface which is different with param from DecoderHeader and this will lead to error. Now change it use param from decoderHeader to configure surface. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvdec: switch to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/qsvdec: export AVFilmGrainParams side dataHaihao Xiang2022-01-29
| | | | | | | When AV_CODEC_EXPORT_DATA_FILM_GRAIN is present, AV1 decoder should disable film grain application and export the corresponding side data Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvdec: track the runtime session versionHaihao Xiang2022-01-29
| | | | | | We may check the runtime version for the given features Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsv: allow to add more parameter buffers to QSV frameHaihao Xiang2022-01-29
| | | | Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvdec.c: using queue count to unref frameChen,Wenbin2022-01-12
| | | | | | | | | | MSDK vc1 and av1 sometimes output frame into the same suface, but ffmpeg-qsv assume the surface will be used only once, so it will unref the frame when it receives the output surface. Now change it to unref frame according to queue count. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc/qsvdec: needn't free the string for AV_OPT_TYPE_STRING AVOptionHaihao Xiang2022-01-05
| | | | | | | The string for AV_OPT_TYPE_STRING AVOption gets freed by av_opt_free() when closing the AVCodecContext Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* qsvdec: add support for HW_DEVICE_CTX methodHaihao Xiang2021-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows user set hw_device_ctx instead of hw_frames_ctx for QSV decoders, hence we may remove the ad-hoc libmfx setup code from FFmpeg. "-hwaccel_output_format format" is applied to QSV decoders after removing the ad-hoc libmfx code. In order to keep compatibility with old commandlines, the default format is set to AV_PIX_FMT_QSV, but this behavior will be removed in the future. Please set "-hwaccel_output_format qsv" explicitly if AV_PIX_FMT_QSV is expected. The normal device stuff works for QSV decoders now, user may use "-init_hw_device args" to initialise device and "-hwaccel_device devicename" to select a device for QSV decoders. "-qsv_device device" which was added for workarounding device selection in the ad-hoc libmfx code still works For example: $> ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=/dev/dri/card0 -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - /dev/dri/renderD128 is actually open for h264_qsv decoder in the above command without this patch. After applying this patch, /dev/dri/card0 is used. $> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device qsv=hw@va -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - device hw of type qsv is not usable in the above command without this patch. After applying this patch, this command works as expected. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/qsvdec: update color properties in codec contextHaihao Xiang2021-08-04
| | | | | | | | User may get color properties from the SDK via VIDEO_SIGNAL_INFO extbuf Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/qsvdec: fix ptsHaihao Xiang2021-06-20
| | | | | | | | | | | | | | | | | The time base used for compressed bitstream and video frame in the SDK is { 1, 90000 }. [1][2] This can avoid the error message below from the muxer. $> ffmpeg -hwaccel qsv -c:v hevc_qsv -i input.h265 -f null - ... [null @ 0x561c24f6f2f0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2 >= 2 [1]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxbitstream [2]https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxframedata Signed-off-by: Zhong Li <zhongli_dev@126.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/frame: Remove deprecated AVFrame.pkt_pts fieldAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 32c8359093d1ff4f45ed19518b449b3ac3769d27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/qsvdec: Make functions used only here static, remove headerAndreas Rheinhardt2021-03-09
| | | | | | | | | Forgotten after d78ecf10bd745cb69a71b32419e0661bfdcfb1fd. (Also mark some AVPackets as const.) Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/qsvdec: refact, remove duplicate code for plugin loadingXu Guangxin2021-01-23
| | | | | Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/qsvdec: refact, move qsvdec_other.c to qsvdec.cXu Guangxin2021-01-23
| | | | | Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/qsvdec: refact, move qsvdec_h2645.c to qsvdec.cXu Guangxin2021-01-23
| | | | | Signed-off-by: Xu Guangxin <guangxin.xu@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/qsvdec: disable gpu copy when not supportedZhong Li2019-12-29
| | | | Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvdec: fix the error retrun code in ff_qsv_get_continuous_buffer()Zhong Li2019-12-29
| | | | Signed-off-by: Zhong Li <zhongli_dev@126.com>
* lavc/qsvdec: remove unused check_dec_paramLinjie Fu2019-10-26
| | | | 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: add memory type messageZhong Li2019-09-26
| | | | 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/qsvdec: remove orignal parser code since not needed nowZhong Li2019-08-20
| | | | Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader()Zhong Li2019-08-20
| | | | | | | | | | | | | | | | | Using MSDK parser can improve qsv decoder pass rate in some cases (E.g: sps declares a wrong level_idc, smaller than it should be). And it is necessary for adding new qsv decoders such as MJPEG and VP9 since current parser can't provide enough information. Actually using MFXVideoDECODE_DecodeHeader() was disscussed at https://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/175734.html and merged as commit 1acb19d, but was overwritten when merged libav patches (commit: 1f26a23) without any explain. Split decode header from decode_init, and call it for everyframe to detect format/resoultion change. It can fix some regression issues such as hevc 10bits decoding. Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
* lavc/qsvdec: fix hevc level incorrectly mapZhong Li2019-05-07
| | | | | | libmfx hevc level defination is same as h264, not level_idc of SPEC. Signed-off-by: Zhong Li <zhong.li@intel.com>
* lavc/qsvdec: add query function and provide error messageZhong Li2019-05-07
| | | | | | | | It is helpful to know why some clips decoding failed. Ticket#7330 is a good example, with this patch it is easily to know bitstream codec level is out of support range. Signed-off-by: Zhong Li <zhong.li@intel.com>
* qsvdec: Fix running with assert_level > 0Mark Thompson2018-12-09
| | | | | | | Assertion avctx->codec_id != AV_CODEC_ID_NONE failed at src/libavcodec/parser.c:128 The setting on the internal AVCodecContext used for parsing only is otherwise irrelevant, so just set it to avoid the assert.
* lavc/qsvdec: flush buffered data before reinitLinjie Fu2018-11-06
| | | | | | | | | | | | | | | | | Flush the buffered data in libmfx before video param reinit in case the frames drop. Cache the first frame causing the reinit and decode zero-size pkt to flush the buffered pkt before reinit. After all the buffered pkts being flushed, resume to reinit and decode. Fix the issue in ticket #7399. [V2]: Move the definition of zero_pkt to where it is exactly used. Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.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 '54307b35311e9a871b3d8ecb2b2eecfc16de0163'James Almer2018-04-13
|\| | | | | | | | | | | | | * commit '54307b35311e9a871b3d8ecb2b2eecfc16de0163': lavc/qsvdec: set complete_frame flags for progressive picture Merged-by: James Almer <jamrial@gmail.com>
| * lavc/qsvdec: set complete_frame flags for progressive pictureZhong Li2018-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the flag MFX_BITSTREAM_COMPLETE_FRAME when it is a progressive picture. This can fix vc1 decoding segment fault issues because can't set the start code correctly. See: ./avconv -hwaccel qsv -c:v vc1_qsv -i /fate-suite/vc1/SA00040.vc1 -vf "hwdownload, format=nv12" -f rawvideo /dev/null v2: fix some h264 interlaced clips regression a. field_order of some h264 interlaced video (e.g: cama3_vtc_b.avc) is marked as AV_FIELD_UNKNOWN in h264_parser.c. This is not a completed frames. So only set the MFX_BITSTREAM_COMPLETE_FRAME when it is progressive. b. some clips have both progressive and interlaced frames (e.g.CAPAMA3_Sand_F.264), the parsed field_order maybe changed druing the decoding progress. This patch has been verified for other codecs(mpeg2/hevc/vp8). Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit '52ed83fa1a7f5170447eff6fad0b6c57119596e9'James Almer2018-04-13
|\| | | | | | | | | | | | | * commit '52ed83fa1a7f5170447eff6fad0b6c57119596e9': lavc/qsvdec: expose frame pic_type and key_frame Merged-by: James Almer <jamrial@gmail.com>
| * lavc/qsvdec: expose frame pic_type and key_frameZhong Li2018-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently pict_type and key_frame are unset. Add an extra param to fetch the picture type from qsv decoder The judgement “key frame is equal to IDR frame” only suitable for H264. For HEVC, all IRAP frames are key frames, and other codecs have no IDR frame. Signed-off-by: ChaoX A Liu <chaox.a.liu@intel.com> Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
* | Merge commit '6829a079444e10818a847e153121fb458cc5c0a8'James Almer2018-02-11
|\| | | | | | | | | | | | | * commit '6829a079444e10818a847e153121fb458cc5c0a8': qsvdec: Relax the surface vs coded dimension check Merged-by: James Almer <jamrial@gmail.com>
| * qsvdec: Relax the surface vs coded dimension checkZhong Li2018-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a common vp8 decoding failure. Many vp8 clips cannot decode if hw_frames_ctx is enabled, reporting "Error during QSV decoding.: incompatible video parameters (-14)". It is due to mfx.FrameInfo.Width/Height not matching coded_w/coded_h. See: avconv -hwaccel qsv -init_hw_device qsv -c:v vp8_qsv -i vp8-test-vectors-r1/vp80-00-comprehensive-001.ivf -vf "hwdownload,format=nv12" -pix_fmt yuv420p -f md5 - Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | Merge commit 'cbe28bc069dde1d53d937ee10700bb123279c7c8'Mark Thompson2018-01-16
|\| | | | | | | | | | | | | * commit 'cbe28bc069dde1d53d937ee10700bb123279c7c8': qsv: better to use alignment by 16 and HEVC 10b requires alignment by 32 Merged-by: Mark Thompson <sw@jkqxz.net>
| * qsv: better to use alignment by 16 and HEVC 10b requires alignment by 32Maxym Dmytrychenko2018-01-08
| |
| * lavc: Add hardware config metadata for decoders supporting hardware outputMark Thompson2017-12-19
| | | | | | | | | | | | | | | | | | This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time.
| * qsvdec: Allow use of hw_device_ctx to make the internal sessionMark Thompson2017-04-02
| |
| * qsv: Add ability to create a session from a deviceMark Thompson2017-04-02
| |
* | lavc: Add hardware config metadata for decoders supporting hardware outputMark Thompson2017-11-26
| | | | | | | | | | | | | | | | | | This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time.
* | qsvdec: Allow use of hw_device_ctx to make the internal sessionMark Thompson2017-06-14
| | | | | | | | (cherry picked from commit 8848ba0bd6b035af77d4f13aa0d8aaaad9806fe8)
* | qsv: Add ability to create a session from a deviceMark Thompson2017-06-14
| | | | | | | | (cherry picked from commit 4936a48b1e6fc2147599541f8b25f43a8a9d1f16)
* | Merge commit 'b68e353136db6f963212c457281d9716516cdc59'Clément Bœsch2017-05-05
|\| | | | | | | | | | | | | * commit 'b68e353136db6f963212c457281d9716516cdc59': qsvdec: do not sync PIX_FMT_QSV surfaces Merged-by: Clément Bœsch <cboesch@gopro.com>
| * qsvdec: do not sync PIX_FMT_QSV surfacesAnton Khirnov2017-01-12
| | | | | | | | | | | | | | | | | | | | Introducing enforced sync points in arbitrary places is bad for performance. Since the vast majority of receiving code (QSV VPP or encoders, retrieving frames through hwcontext) will do the syncing, this change should not be visible to most callers. But bumping micro just in case. This is also consistent with what VAAPI hwaccel does.
| * qsvdec: Fix memory leak on errorTimothy Gu2016-12-08
| | | | | | | | | | Bug-Id: CID 1396851 Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit '76167140a91c081a0cf9d0abcaa4da18d1bacadb'Clément Bœsch2017-04-01
|\| | | | | | | | | | | | | * commit '76167140a91c081a0cf9d0abcaa4da18d1bacadb': qsvdec: Drop stray extra braces around initializer Merged-by: Clément Bœsch <u@pkh.me>
| * qsvdec: Drop stray extra braces around initializerDiego Biurrun2016-11-17
| | | | | | | | libavcodec/qsvdec.c:93:5: warning: braces around scalar initializer