1
0
Fork 0
Commit Graph

75 Commits

Author SHA1 Message Date
Tong Wu 270cd14bbb avcodec/dxva2(h264|mpeg2|vc1): use av_assert0 instead of assert
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Wu Jianhua ffa158edbd avcodec: add D3D12VA hardware accelerated VC1 decoding
The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Wu Jianhua 349ce30e4e avcodec: add D3D12VA hardware accelerated H264 decoding
The implementation is based on:
https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-video-overview

With the Direct3D 12 video decoding support, we can render or process
the decoded images by the pixel shaders or compute shaders directly
without the extra copy overhead, which is beneficial especially if you
are trying to render or post-process a 4K or 8K video.

The command below is how to enable d3d12va:
ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2023-12-21 16:15:23 +08:00
Andreas Rheinhardt e35dfe864d avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccel
This commit is the AVHWAccel analogue of commit
20f972701806be20a77f808db332d9489343bb78: It moves the private fields
of AVHWAccel to a new struct FFHWAccel extending AVHWAccel
in an internal header (namely hwaccel_internal.h).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:50:29 +02:00
Andreas Rheinhardt 5bcae5251f avcodec/vc1_block: Remove dead calls to ff_mpeg_draw_horiz_band()
The VC-1 decoders don't support draw_horiz_band at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-10-20 06:57:30 +02:00
Martin Storsjö a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
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>
2022-03-16 14:12:49 +02:00
Andreas Rheinhardt 965cfc6684 avcodec/mpegvideo: Move decoder-only stuff to a new header
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-13 19:49:29 +01:00
James Almer b14761d1f8 Merge commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce'
* commit '8f144d9e3d5cb2ca92e5bdf7cc9f72effa1bd2ce':
  Drop Windows XP support remnants

Merged-by: James Almer <jamrial@gmail.com>
2018-04-13 20:59:12 -03:00
Diego Biurrun 8f144d9e3d Drop Windows XP support remnants 2018-04-09 21:58:39 +02:00
James Almer 59347c2474 avcodec/dxva2_vc1: add missing frame_params callback to vc1_d3d11va2 hwaccel
Fixes ticket #7096

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-22 11:46:32 -03:00
Mark Thompson 2117725dc5 lavc: Mark all AVHWAccel structures as const 2017-12-19 23:24:24 +00:00
Mark Thompson 3a71bcc213 lavc: Mark all AVHWAccel structures as const 2017-11-26 21:41:19 +00:00
James Almer 48e4eda11d Merge commit 'b46a77f19ddc4b2b5fa3187835ceb602a5244e24'
* commit 'b46a77f19ddc4b2b5fa3187835ceb602a5244e24':
  lavc: external hardware frame pool initialization

Includes the fix from e724bdfffb

Merged-by: James Almer <jamrial@gmail.com>
2017-11-11 20:33:26 -03:00
wm4 b46a77f19d lavc: external hardware frame pool initialization
This adds a new API, which allows the API user to query the required
AVHWFramesContext parameters. This also reduces code duplication across
the hwaccels by introducing ff_decode_get_hw_frames_ctx(), which uses
the new API function. It takes care of initializing the hw_frames_ctx
if needed, and does additional error handling and API usage checking.

Support for VDA and Cuvid missing.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2017-10-19 17:10:59 +02:00
wm4 70143a3954 dxva: add support for new dxva2 and d3d11 hwaccel APIs
This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Merges Libav commit f9e7a2f95a.
Also adds untested VP9 support.
The check for DXVA2 COBJs is removed. Just update your MinGW to
something newer than a 5 year old release.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
wm4 ab28108a36 dxva: preparations for new hwaccel API
The actual hwaccel code will need to access an internal context instead
of avctx->hwaccel_context, so add a new DXVA_CONTEXT() macro, that will
dispatch between the "old" external and the new internal context.

Also, the new API requires a new D3D11 pixfmt, so all places which check
for the pixfmt need to be adjusted. Introduce a ff_dxva2_is_d3d11()
function, which does the check.

Merges Libav commit 4dec101acc.
Adds changes to vp9 over the Libav patch.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
wm4 f9e7a2f95a dxva: add support for new dxva2 and d3d11 hwaccel APIs
This also adds support to avconv (which is trivial due to the new
hwaccel API being generic enough).

The new decoder setup code in dxva2.c is significantly based on work by
Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-08 21:20:18 +02:00
wm4 4dec101acc dxva: preparations for new hwaccel API
The actual hwaccel code will need to access an internal context instead
of avctx->hwaccel_context, so add a new DXVA_CONTEXT() macro, that will
dispatch between the "old" external and the new internal context.

Also, the new API requires a new D3D11 pixfmt, so all places which check
for the pixfmt need to be adjusted. Introduce a ff_dxva2_is_d3d11()
function, which does the check.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-08 20:55:52 +02:00
Steve Lhomme 77742c75c5 dxva2: use a single macro to test if the DXVA context is valid
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-16 02:54:04 +01:00
Steve Lhomme 0ac2d86c47 dxva2: Factorize DXVA context validity test into a single macro
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-01-08 16:41:24 +01:00
Hendrik Leppkes 99ee8ee093 dxva2_vc1: support multiple slices 2016-11-26 13:11:36 +01:00
Hendrik Leppkes b66a94ab53 Merge commit '08377f9c3bf6dbe216512a2e05c9fac837b13fc0'
* commit '08377f9c3bf6dbe216512a2e05c9fac837b13fc0':
  dxva: Include last the internal header

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-14 23:02:00 +02:00
Luca Barbato 08377f9c3b dxva: Include last the internal header
It redefines _WIN32_WINNT, possibly causing problems with the
w32pthreads.h header.
2015-10-14 14:35:34 +02:00
Michael Niedermayer 947b74ee7d Merge commit 'd8039ef8d221ea273aa4f1e62e5df21bf618c772'
* commit 'd8039ef8d221ea273aa4f1e62e5df21bf618c772':
  D3D11va: add a Direct3D11 video decoder similar to DXVA2

Conflicts:
	Changelog
	configure
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/dxva2_vc1.c
	libavcodec/version.h
	libavutil/pixdesc.c
	libavutil/pixfmt.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-25 22:24:34 +02:00
Steve Lhomme d8039ef8d2 D3D11va: add a Direct3D11 video decoder similar to DXVA2
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-25 11:47:08 +02:00
Michael Niedermayer 052cd1ce72 Merge commit '4600a85eaa6182e5a27464f6b9cae5a9ddbf3098'
* commit '4600a85eaa6182e5a27464f6b9cae5a9ddbf3098':
  dxva2: Pass variable of correct type to IDirectXVideoDecoder_GetBuffer()

Conflicts:
	libavcodec/dxva2_h264.c
	libavcodec/dxva2_mpeg2.c
	libavcodec/dxva2_vc1.c

See: 64c53fa16a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-01 20:31:13 +02:00
Diego Biurrun 4600a85eaa dxva2: Pass variable of correct type to IDirectXVideoDecoder_GetBuffer()
This avoids related incompatible pointer type warnings.
2014-09-01 12:23:58 +02:00
Michael Niedermayer fa0f7c024e Merge commit 'a871ef0cc936612bdb0e643196be72efcf0c8986'
* commit 'a871ef0cc936612bdb0e643196be72efcf0c8986':
  hwaccel: Rename priv_data_size to frame_priv_data_size

Conflicts:
	libavcodec/avcodec.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-11 23:49:13 +02:00
Anton Khirnov a871ef0cc9 hwaccel: Rename priv_data_size to frame_priv_data_size
This describes more accurately what this field is for.
2014-05-11 14:59:07 +02:00
Michael Niedermayer 59a53842d3 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegvideo: operate with pointers to AVFrames instead of whole structs

Conflicts:
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/intrax8.c
	libavcodec/mpeg12enc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo.h
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_motion.c
	libavcodec/mpegvideo_xvmc.c
	libavcodec/msmpeg4.c
	libavcodec/ratecontrol.c
	libavcodec/vaapi.c
	libavcodec/vc1dec.c
	libavcodec/vdpau_vc1.c

See: fc567ac49e
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-09 15:18:46 +02:00
wm4 f6774f905f mpegvideo: operate with pointers to AVFrames instead of whole structs
The most interesting parts are initialization in ff_MPV_common_init() and
uninitialization in ff_MPV_common_end().

ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL
checks for Picture.f, because these functions can be called on
uninitialized or partially initialized Pictures.

NULL pointer checks are added to ff_thread_release_buffer() stub function.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-04-09 02:12:19 +02:00
Michael Niedermayer 678e455f1d dxva2: Directly use AVFrames
The assumption of (MPEG) Picture and H264Picture layout matching might
not hold true in the future.

Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2014-04-01 00:10:15 +02:00
Michael Niedermayer 29be9b5301 avcodec/dxva2: fix pointers after H264Picture
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 13:22:40 +01:00
Michael Niedermayer 9517900bef Merge commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b'
* commit 'e0c16e4e3259cf50b5bac4c23bb6e517f397c74b':
  mpegvideo: move mpegvideo formats-related defines to mpegutils.h

Conflicts:
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_mvpred.h
	libavcodec/svq1enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 12:36:48 +01:00
Vittorio Giovara e0c16e4e32 mpegvideo: move mpegvideo formats-related defines to mpegutils.h 2014-03-16 23:04:41 +01:00
Hendrik Leppkes 61ff0431ba dxva2_vc1: include the start code in wMBbitOffset
This resolves a decoding failure on Intel GPUs.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-07 16:03:50 +01:00
Hendrik Leppkes 930f67b712 dxva2_vc1: fix intensity compensation condition with interlaced fields
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-07 16:03:03 +01:00
Hendrik Leppkes 3d8eeea620 dxva2_vc1: signal skipped p frames
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 02:57:56 +01:00
Hendrik Leppkes c5562890c7 dxva2_vc1: fix signaling of intensity compensation values
lumscale/lumshift don't get reset back to their default values if
intensity compensation is not active, and a wrong signaling here can
cause playback issues.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 02:57:51 +01:00
Hendrik Leppkes e1facd3f81 dxva2_vc1: set PQUANT as described by the 2010 spec update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 02:57:33 +01:00
Hendrik Leppkes 3021d1be9e dxva2_vc1: set bfraction in slice info according to spec
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 02:57:23 +01:00
Hendrik Leppkes 8abdf46b38 dxva2_vc1: set refdist value according to spec
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-01 02:57:16 +01:00
Michael Niedermayer 2d614e9be1 Merge commit 'c2f7417eeb9cc31f75e71f7be2780f90f1628d7e'
* commit 'c2f7417eeb9cc31f75e71f7be2780f90f1628d7e':
  vc1: move MpegEncContext.resync_marker into VC1Context.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-30 00:49:34 +01:00
Anton Khirnov c2f7417eeb vc1: move MpegEncContext.resync_marker into VC1Context.
The field still remains in MpegEncContext because it is used by the
mpeg4 decoder.
2013-11-29 14:19:47 +01:00
Michael Niedermayer fee484edaf Merge commit 'ad0c9f2d5d81e22207c6ccecc426bf7306acc327'
* commit 'ad0c9f2d5d81e22207c6ccecc426bf7306acc327':
  lavc: move AVFrame.hwaccel_picture_private to Picture.

Conflicts:
	libavcodec/avcodec.h
	libavcodec/mpegvideo.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:35:37 +01:00
Anton Khirnov ad0c9f2d5d lavc: move AVFrame.hwaccel_picture_private to Picture.
This field is private and should not be present in a public struct. It
is only used in DXVA with mpegvideo-based decoders currently.
2013-03-08 07:36:01 +01:00
Michael Niedermayer baf10ad186 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  hwaccel: consistent name prefixes for start_frame/end_frame/decode_slice

Conflicts:
	libavcodec/vda_h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-06 10:34:14 +01:00
Diego Biurrun c57a593670 hwaccel: consistent name prefixes for start_frame/end_frame/decode_slice
Some hwaccels use name prefixes, some do not, others only use them for
some codecs.  Add prefixes everywhere for consistency.
2013-03-05 11:22:45 +01:00
Michael Niedermayer b7fe35c9e5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: deMpegEncContextize

Conflicts:
	libavcodec/dxva2_h264.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_mb_template.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264_sei.c
	libavcodec/svq3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 23:30:09 +01:00
Anton Khirnov 2c54155407 h264: deMpegEncContextize
Most of the changes are just trivial are just trivial replacements of
fields from MpegEncContext with equivalent fields in H264Context.
Everything in h264* other than h264.c are those trivial changes.

The nontrivial parts are:
1) extracting a simplified version of the frame management code from
   mpegvideo.c. We don't need last/next_picture anymore, since h264 uses
   its own more complex system already and those were set only to appease
   the mpegvideo parts.
2) some tables that need to be allocated/freed in appropriate places.
3) hwaccels -- mostly trivial replacements.
   for dxva, the draw_horiz_band() call is moved from
   ff_dxva2_common_end_frame() to per-codec end_frame() callbacks,
   because it's now different for h264 and MpegEncContext-based
   decoders.
4) svq3 -- it does not use h264 complex reference system, so I just
   added some very simplistic frame management instead and dropped the
   use of ff_h264_frame_start(). Because of this I also had to move some
   initialization code to svq3.

Additional fixes for chroma format and bit depth changes by
Janne Grunau <janne-libav@jannau.net>

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-15 16:35:16 +01:00