Commit Graph

92 Commits

Author SHA1 Message Date
James Almer
7167ac33a8 Merge commit 'c1bcd321ea2c2ae1765a1e64f03278712221d726'
* commit 'c1bcd321ea2c2ae1765a1e64f03278712221d726':
  avcodec/qsv: fix async support

Merged-by: James Almer <jamrial@gmail.com>
2018-09-02 19:23:26 -03:00
Dmitry Rogozhkin
c1bcd321ea avcodec/qsv: fix async support
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>
2018-07-26 09:57:54 +02:00
James Almer
bbe95ebdad Merge commit '54307b35311e9a871b3d8ecb2b2eecfc16de0163'
* commit '54307b35311e9a871b3d8ecb2b2eecfc16de0163':
  lavc/qsvdec: set complete_frame flags for progressive picture

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 20:38:46 -03:00
James Almer
6f277e1f76 Merge commit '52ed83fa1a7f5170447eff6fad0b6c57119596e9'
* commit '52ed83fa1a7f5170447eff6fad0b6c57119596e9':
  lavc/qsvdec: expose frame pic_type and key_frame

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 19:58:05 -03:00
Zhong Li
54307b3531 lavc/qsvdec: set complete_frame flags for progressive picture
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>
2018-04-08 20:47:59 +02:00
Zhong Li
52ed83fa1a lavc/qsvdec: expose frame pic_type and key_frame
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>
2018-04-08 20:47:59 +02:00
James Almer
87faeb1e68 Merge commit '6829a079444e10818a847e153121fb458cc5c0a8'
* commit '6829a079444e10818a847e153121fb458cc5c0a8':
  qsvdec: Relax the surface vs coded dimension check

Merged-by: James Almer <jamrial@gmail.com>
2018-02-11 22:44:12 -03:00
Zhong Li
6829a07944 qsvdec: Relax the surface vs coded dimension check
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>
2018-01-26 10:00:17 +01:00
Mark Thompson
96cf0d8a9c Merge commit 'cbe28bc069dde1d53d937ee10700bb123279c7c8'
* commit 'cbe28bc069dde1d53d937ee10700bb123279c7c8':
  qsv: better to use alignment by 16 and HEVC 10b requires alignment by 32

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-16 23:29:36 +00:00
Maxym Dmytrychenko
cbe28bc069 qsv: better to use alignment by 16 and HEVC 10b requires alignment by 32 2018-01-08 21:30:38 +01:00
Mark Thompson
2fcb009011 lavc: Add hardware config metadata for decoders supporting hardware output
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.
2017-12-19 23:21:59 +00:00
Mark Thompson
758fbc54fe lavc: Add hardware config metadata for decoders supporting hardware output
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.
2017-11-26 21:35:53 +00:00
Mark Thompson
8aa3c2df1a qsvdec: Allow use of hw_device_ctx to make the internal session
(cherry picked from commit 8848ba0bd6)
2017-06-14 22:26:32 +01:00
Mark Thompson
91c3b50d74 qsv: Add ability to create a session from a device
(cherry picked from commit 4936a48b1e)
2017-06-14 22:26:32 +01:00
Clément Bœsch
3c085c1ba5 Merge commit 'b68e353136db6f963212c457281d9716516cdc59'
* commit 'b68e353136db6f963212c457281d9716516cdc59':
  qsvdec: do not sync PIX_FMT_QSV surfaces

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-05-05 14:11:51 +02:00
Mark Thompson
8848ba0bd6 qsvdec: Allow use of hw_device_ctx to make the internal session 2017-04-02 19:06:33 +01:00
Mark Thompson
4936a48b1e qsv: Add ability to create a session from a device 2017-04-02 19:06:33 +01:00
Clément Bœsch
c7173e5098 Merge commit '76167140a91c081a0cf9d0abcaa4da18d1bacadb'
* commit '76167140a91c081a0cf9d0abcaa4da18d1bacadb':
  qsvdec: Drop stray extra braces around initializer

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-01 15:15:19 +02:00
James Almer
4fe9d69648 Merge commit '0940b748bdba36c4894fc8ea6be631d821fdf578'
* commit '0940b748bdba36c4894fc8ea6be631d821fdf578':
  qsvdec: Only warn about unconsumed data if it happens more than once

Merged-by: James Almer <jamrial@gmail.com>
2017-03-31 17:16:39 -03:00
Mark Thompson
ff821fdfce Merge commit '4ab61cd983b539749bd621ea271624ddb5196a8e'
* commit '4ab61cd983b539749bd621ea271624ddb5196a8e':
  qsv{enc,dec}: extend the internal frame allocator

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 22:07:57 +01:00
Mark Thompson
c0f2a8eac1 Merge commit '00aeedd84105a17f414185bd33ecadebeddb3a27'
* commit '00aeedd84105a17f414185bd33ecadebeddb3a27':
  qsv{dec,enc}: use a struct as a memory id with internal memory allocator

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 22:06:03 +01:00
Mark Thompson
2f18e452f8 Merge commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c'
* commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c':
  qsv{dec,enc}: always use an internal mfxFrameSurface1

Minor fixups for differences in the QSV encoder because of a53cc.

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-30 22:00:03 +01:00
Clément Bœsch
e59a4d1df7 Merge commit '801ac7156d3efb8e088fb6024f568eb36a293887'
* commit '801ac7156d3efb8e088fb6024f568eb36a293887':
  qsv: Be informative when reporting that no data has been consumed

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-27 22:19:09 +02:00
Clément Bœsch
aabe525734 Merge commit 'e328178da90f44690e0076f4dbfd16da9175f441'
* commit 'e328178da90f44690e0076f4dbfd16da9175f441':
  qsvdec: only access hwaccel_context is the pixel format is QSV

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-15 23:22:50 +01:00
Mark Thompson
15887a410c Merge commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49'
* commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49':
  qsv: print more complete error messages

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-03-12 15:19:05 +00:00
Anton Khirnov
b68e353136 qsvdec: do not sync PIX_FMT_QSV surfaces
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.
2017-01-12 16:21:39 +01:00
Timothy Gu
d32bdadda8 qsvdec: Fix memory leak on error
Bug-Id: CID 1396851
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-12-08 15:53:58 -05:00
Timothy Gu
b6f80b16d1 qsvdec: Fix memory leak
Fixes CID1396851.
2016-12-06 13:21:08 -08:00
Diego Biurrun
76167140a9 qsvdec: Drop stray extra braces around initializer
libavcodec/qsvdec.c:93:5: warning: braces around scalar initializer
2016-11-17 16:53:48 +01:00
Mark Thompson
0940b748bd qsvdec: Only warn about unconsumed data if it happens more than once 2016-11-14 19:38:19 +00:00
Mark Thompson
030d84fa2e qsvdec: Pass field order information to libmfx
The VC-1 decoder fails to initialise if this is not set.
2016-11-14 19:38:19 +00:00
Mark Thompson
cd1047f391 qsvdec: Pass the correct profile to libmfx
This was correct for H.26[45], because libmfx uses the same values
derived from profile_idc and the constraint_set flags, but it is
wrong for other codecs.

Also avoid passing FF_LEVEL_UNKNOWN (-99) as the level, as this is
certainly invalid.
2016-11-14 19:38:19 +00:00
Hendrik Leppkes
68b0d7e0be Merge commit '924e2ecd2b7d51cca60c79351ef16b04dd4245c3'
* commit '924e2ecd2b7d51cca60c79351ef16b04dd4245c3':
  qsvdec: when a frames ctx is supplied, use its frame dimensions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 15:20:09 +01:00
Hendrik Leppkes
3c81fa9a9c Merge commit '92736c74fb1633e36f7134a880422a9b7db14d3f'
* commit '92736c74fb1633e36f7134a880422a9b7db14d3f':
  qsvdec: add support for P010 (10-bit 420) decoding

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 15:20:00 +01:00
Hendrik Leppkes
220e773915 Merge commit 'ce320cf1c4daab3e2e3726ed7d2e879d10f7b991'
* commit 'ce320cf1c4daab3e2e3726ed7d2e879d10f7b991':
  qsvdec: use the same mfxFrameInfo for allocating frames that was passed to DECODE_Init

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 15:19:51 +01:00
Hendrik Leppkes
1bc6cdf2fc Merge commit '536bb17e9659c5ed7576a218d4085cdd6d5742fa'
* commit '536bb17e9659c5ed7576a218d4085cdd6d5742fa':
  qsvdec: make ff_qsv_map_pixfmt() return a MFX fourcc as well

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-14 15:19:43 +01:00
Anton Khirnov
4ab61cd983 qsv{enc,dec}: extend the internal frame allocator
Handle the internal frame requests, which is required by the HEVC
encoding plugin.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
2016-11-07 12:48:00 +01:00
Anton Khirnov
00aeedd841 qsv{dec,enc}: use a struct as a memory id with internal memory allocator
This will allow implementing the allocator more fully, which is needed
by the HEVC encoder plugin with video memory input.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
2016-11-07 12:47:54 +01:00
Anton Khirnov
404e51478e qsv{dec,enc}: always use an internal mfxFrameSurface1
For encoding, this avoids modifying the input surface, which we are not
allowed to do.
This will also be useful in the following commits.

Signed-off-by: Maxym Dmytrychenko <maxym.dmytrychenko@intel.com>
2016-11-07 12:47:46 +01:00
Mark Thompson
1f26a231bb qsv: Merge libav implementation
Merged as-at libav 398f015, and therefore includes outstanding
skipped merges 04b17ff and 130e1f1.

All features not in libav are preserved, and no options change.
2016-10-31 19:23:40 +00:00
Luca Barbato
801ac7156d qsv: Be informative when reporting that no data has been consumed 2016-10-30 21:55:03 +01:00
Hendrik Leppkes
3f9137c57d Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'
* commit '32c8359093d1ff4f45ed19518b449b3ac3769d27':
  lavc: export the timestamps when decoding in AVFrame.pts

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-10-07 13:03:36 +02:00
James Almer
e9a5fc9678 Merge commit '6f19bbcf8532d018d8d6d82e000738d0ac2385c9'
* commit '6f19bbcf8532d018d8d6d82e000738d0ac2385c9':
  qsvdec: move reading the user-provided session to qsv_decode_init()

Conflicts:
    libavcodec/qsvdec.c

Merged-by: James Almer <jamrial@gmail.com>
2016-09-28 13:26:12 -03:00
Yuli Khodorkovskiy
f0adb99d06 avcodec/qsvdec: Fix null dereferences in the qsv decoder
This patch fixes the h264_qsv decoder issues mentioned
in https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2962.

The patch may be tested by specifying h264_qsv as the decoder to ffplay
for an h264 encoded file.

	ffplay -vcodec h264_qsv foo.mts

Signed-off-by: Yuli Khodorkovskiy <ykhodo@gmail.com>
Push requested-by: Ivan Uskov
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-07 19:16:24 +02:00
Anton Khirnov
e328178da9 qsvdec: only access hwaccel_context is the pixel format is QSV
We do not strictly specify that hwaccel_context must be cleared if no
hwaccel is used.

Reported-By: wm4 <nfxjfg@googlemail.com>
2016-07-31 08:19:45 +02:00
Ivan Uskov
b4054100f6 Revert "Merge commit '3c53627ac17fc6bdea5029be57da1e03b32d265d'"
This reverts commit d30cf57a7b, reversing changes made to
acc155ac55. The commit d30cf57a7b
provided irrelevant code complexity and decoding slowdown. But the main disadvantage of this
commit is a decoder crash. So it should be reverted.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-24 18:36:26 +02:00
Anton Khirnov
95414eb2dc qsv: print more complete error messages
Include the libmfx error code and its description
2016-07-22 19:08:13 +02:00
Anton Khirnov
924e2ecd2b qsvdec: when a frames ctx is supplied, use its frame dimensions
The allocated frame size may be larger than the coded dimensions.
2016-07-03 09:13:29 +02:00
Anton Khirnov
92736c74fb qsvdec: add support for P010 (10-bit 420) decoding 2016-07-03 09:13:29 +02:00
Anton Khirnov
ce320cf1c4 qsvdec: use the same mfxFrameInfo for allocating frames that was passed to DECODE_Init
Stop duplicating this information.
2016-07-03 09:13:29 +02:00