Commit Graph

44 Commits

Author SHA1 Message Date
Linjie Fu 5345965b3f lavc/qsvdec: Add GPU-accelerated memory copy support
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>
2019-10-09 11:27:34 +08:00
Zhong Li 00d0a4aa9e lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader()
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>
2019-08-20 13:34:03 +08:00
Zhong Li 978c935f2f lavc/qsv_hevc: correct QSV HEVC default plugin on Windows
1. Old logic meaned: everywhere, except Windows, ffmpeg has to use HW
acceleration, but on Windows ffmpeg has to use (unavailable) software
HEVC by default
2. Software HEVC is available only if you provide corresponding
software MediaSDK library, which isn't provided with ffmpeg. More
information could be found in
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-encode_linux.pdf
3. HW HEVC decoding/encoding are available on Windows in the driver by default

Note: Default case should be the most common case but this change still has potential risk
on windows if HW path is not supported(or doesn't work as expection).
(See the historical disscution: https://lists.libav.org/pipermail/libav-devel/2016-November/080419.html).
In such case, two options suggested:
1. Use the option "-load_plugin hevc_sw" to switch SW path manually.
2. Or report bug to Intel windows driver if your GPU can support HEVC HW codec.
  (HEVC decoding is supported since Braswell, and encoding supported since Skylake)

Patch started by Landgraph. Add similar change for hevc decoder and bump a new version.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
Signed-off-by: Landgraph <me@landgraph.ru>
Signed-off-by: Zhong Li <zhong.li@intel.com>
2018-12-18 15:15:18 +08:00
Linjie Fu 87368884a5 lavc/qsvdec: flush buffered data before reinit
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>
2018-11-06 17:42:29 +08:00
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
Mark Thompson 04e4ab44d7 Merge commit '559370f2c45110afd8308eec7194437736c323d4'
* commit '559370f2c45110afd8308eec7194437736c323d4':
  qsv: Skip the packet if decoding failure

Merged-by: Mark Thompson <sw@jkqxz.net>
2018-01-25 22:50:38 +00:00
Ruiling, Song 559370f2c4 qsv: Skip the packet if decoding failure
MediaSDK may fail to decode some frame, just skip it.
Otherwise, it will keep decoding the failure packet repeatedly
without processing any packet afterwards.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2018-01-25 11:13:34 +01:00
Mark Thompson 2a4d34d462 lavc: Delete all fake hwaccels
They are now unused.
2017-12-19 23:22:35 +00: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
wm4 b945fed629 avcodec: add metadata to identify wrappers and hardware decoders
Explicitly identify decoder/encoder wrappers with a common name. This
saves API users from guessing by the name suffix. For example, they
don't have to guess that "h264_qsv" is the h264 QSV implementation, and
instead they can just check the AVCodec .codec and .wrapper_name fields.

Explicitly mark AVCodec entries that are hardware decoders or most
likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing
API users listing hardware decoders in a more generic way. The proposed
AVCodecHWConfig does not provide this information fully, because it's
concerned with decoder configuration, not information about the fact
whether the hardware is used or not.

AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software
implementations in case the hardware is not capable.

Based on a patch by Philip Langdale <philipl@overt.org>.

Merges Libav commit 47687a2f8a.
2017-12-14 19:37:56 +01:00
wm4 47687a2f8a avcodec: add metadata to identify wrappers and hardware decoders
Explicitly identify decoder/encoder wrappers with a common name. This
saves API users from guessing by the name suffix. For example, they
don't have to guess that "h264_qsv" is the h264 QSV implementation, and
instead they can just check the AVCodec .codec and .wrapper_name fields.

Explicitly mark AVCodec entries that are hardware decoders or most
likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing
API users listing hardware decoders in a more generic way. The proposed
AVCodecHWConfig does not provide this information fully, because it's
concerned with decoder configuration, not information about the fact
whether the hardware is used or not.

AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software
implementations in case the hardware is not capable.

Based on a patch by Philip Langdale <philipl@overt.org>.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-12-14 16:58:45 +01:00
Mark Thompson da4e02b196 lavc: Delete all fake hwaccels
They are now unused.
2017-11-26 21:41:14 +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 b26dd5ae2f Merge commit '136e7cf64ce9e78de7158d6720539d51cb96b743'
* commit '136e7cf64ce9e78de7158d6720539d51cb96b743':
  qsv/hevcdec: Load hw plugin by default on non-windows os

Merged-by: Mark Thompson <sw@jkqxz.net>
2017-11-25 14:38:03 +00:00
Li, Zhong 136e7cf64c qsv/hevcdec: Load hw plugin by default on non-windows os
Software plugin is not available on Linux, Only works on Windows.
Similar changes have been applied to qsv hevc encoder by
b05128f3c9.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
2017-11-23 12:59:02 +01:00
James Almer 318778de9e Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'
* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3':
  Mark some arrays that never change as const.

Merged-by: James Almer <jamrial@gmail.com>
2017-09-26 16:02:40 -03:00
James Almer 58ed9deec8 Merge commit '8fb4210ad8785c01fccf2fc59af6a6fa2892b6b2'
* commit '8fb4210ad8785c01fccf2fc59af6a6fa2892b6b2':
  qsvdec_h2645: switch to the new generic filtering mechanism

Merged-by: James Almer <jamrial@gmail.com>
2017-04-22 23:02:02 -03:00
James Almer 7d3bb052c8 Merge commit '624aa8ab221cf34693f9a8c5ab67219cf560f2bb'
* commit '624aa8ab221cf34693f9a8c5ab67219cf560f2bb':
  build: Add missing Makefile entries and ifdefs for QSV hwaccels

Merged-by: James Almer <jamrial@gmail.com>
2017-04-13 17:27:43 -03:00
Anton Khirnov fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Anton Khirnov 8fb4210ad8 qsvdec_h2645: switch to the new generic filtering mechanism
Drop the internal manual conversion from the MP4 format to Annex B.
2016-12-14 09:06:45 +01:00
Diego Biurrun 624aa8ab22 build: Add missing Makefile entries and ifdefs for QSV hwaccels 2016-12-07 15:46:57 +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
Mark Thompson 4e7a7a96cf qsvdec: Avoid probing with qsv decoders
Set the AV_CODEC_CAP_AVOID_PROBING flag on all of the qsv decoders.
2016-10-31 19:23:40 +00: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
Moritz Barsnick 022260271b libavcodec/qsvdec_h2645.c: drop executable permission
Accidentally set in b93e223315.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
2016-09-15 15:52:39 +02:00
Ivan Uskov b93e223315 libavcodec/qsvdec_h2645.c: switch to the new BSF API
This patch applies same changes as commit e3dfef8e3c of libav:
instead of the obsolete AVBitStreamFilterContext now the new AVBSFContext filter is used to
restore annex-B prefixes.

Based-on: e3dfef8e3c by Anton Khirnov
Push requested by maintainer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-15 02:48:53 +02:00
Anton Khirnov 92736c74fb qsvdec: add support for P010 (10-bit 420) decoding 2016-07-03 09:13:29 +02:00
Anton Khirnov eccfb9778a qsvdec_hevc: add the UID of the HEVC HW decoder plugin 2016-06-28 08:33:27 +02:00
Anton Khirnov c67594a2c7 qsvdec_hevc: fix a variable name
hevcenc -> hevcdec, this is a _decoder_ plugin.
2016-06-28 08:33:13 +02:00
Anton Khirnov a0524d9b1e qsvdec: support getting the session from an AVHWFramesContext 2016-06-21 19:53:38 +02:00
Ivan Uskov b577a54a7c qsv: Fix wrong ticks_per_frame for H.264
For H.264 stream ticks_per_frame should be 2, as per the docs.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-27 15:33:53 +01:00
Anton Khirnov e3dfef8e3c qsvdec_h2645: switch to the new BSF API 2016-03-25 14:53:37 +01:00
Vittorio Giovara 2d59159508 lavc: AV-prefix a few left out capabilities 2015-10-15 15:47:16 +02:00
Hendrik Leppkes 4554178f07 Merge commit '741b352b16dad74b87c4a39bade8902633a2b0e6'
* commit '741b352b16dad74b87c4a39bade8902633a2b0e6':
  qsvdec: list supported pixel formats

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-29 13:53:42 +02:00
Anton Khirnov 741b352b16 qsvdec: list supported pixel formats
This is useful for detecting QSV-enabled decoders.
2015-09-28 15:42:46 +02:00
Ivan Uskov 3f8e2e9953 libavcodec/qsvdec.c: correct flush() handler has been implemented
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 22:04:02 +02:00
Michael Niedermayer 444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Vittorio Giovara def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Anton Khirnov f3bd3810d2 qsvdec_*: add missing CODEC_CAP_DR1 2015-07-27 07:44:34 +02:00
Michael Niedermayer d12be9ed70 Merge commit 'f3bd3810d274a7f51b5925fc3d2fc33e8043a5d4'
* commit 'f3bd3810d274a7f51b5925fc3d2fc33e8043a5d4':
  qsvdec_*: add missing CODEC_CAP_DR1

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 11:50:17 +02:00
Ivan Uskov 684b703843 libavcodec/qsvdec_h264.c: using "private_spspps_buf" argument for av_bitstream_filter_filter() to avoid failure after decoder re-initialization.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-26 02:04:41 +02:00
Michael Niedermayer 508b79e6c1 Merge commit '41d47ea85fb4ad9cfb5c2dc808a46bc1d57f3986'
* commit '41d47ea85fb4ad9cfb5c2dc808a46bc1d57f3986':
  lavc: add Intel libmfx-based HEVC decoder.

Conflicts:
	Changelog
	configure
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/qsvdec.c
	libavcodec/qsvdec_h2645.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-26 01:20:46 +02:00
Anton Khirnov 41d47ea85f lavc: add Intel libmfx-based HEVC decoder. 2015-07-25 17:37:01 +02:00