1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-24 13:11:28 +02:00
Commit Graph

61 Commits

Author SHA1 Message Date
Philip Langdale
6e5e139fe3 avcodec/vdpau: Support for VDPAU accelerated HEVC decoding
This change introduces basic support for HEVC decoding through vdpau.
Right now, there are problems with the nvidia driver/library implementation
that mean that frames are incorrectly laid out in memory when they are
returned from the decoder, and it is normally impossible to recover the
complete decoded frame due to loss of data from alignment inconsistencies.

I obviously hope that nvidia will be fixing it in due course - I've verified
the problems exist with their example application.

As such, this support is not useful for any real world application, but I
believe that it is correct (with the caveat that the mangled frames may hide
problems) and will work properly once the nvidia problem is fixed.

Right now it appears that any file encoded by x265 or nvenc is decoded
correctly, but that's because these files don't use a bunch of HEVC
features.

Quick summary:

Features that seem to work:

1) Short Term References
2) Scaling Lists
3) Tiling

Features with known problems:

1) Long Term References

It's hard to tell what's going on here. After I read the nvidia example
app that does not set the IsLongTerm flag on LTRs, and changed my code,
a bunch of frames using LTR started to display correctly, but there
are still samples with glitches that are related to LTRs.

In terms of real world files, both x265 and nvenc only use short term
refs from this list. The divx encoder seems similar.

Signed-off-by: Philip Langdale <philipl@overt.org>
2015-06-25 20:06:47 -07:00
Philip Langdale
9ae766d1c6 avcodec/vdpau: Re-factor pre-hwaccel helper functions into separate header
h264.h and hevc.h are mutually exclusive due to defining some of the same
names. As such, we need to avoid forcing h264.h to be included if we want
hevc decode acceleration to be possible.

However, some of the pre-hwaccel helper functions need h264.h. To avoid
messy collisions, let's move the declaration of all those helpers to
a separate header which we will exclude for the hevc support (which will
be hwaccel-only).

Signed-off-by: Philip Langdale <philipl@overt.org>
2015-05-25 19:50:41 -07:00
Michael Niedermayer
e33b084ee9 Merge commit 'ecbcebde344c9eaeb8877ba2c5d32eb3af621e7f'
* commit 'ecbcebde344c9eaeb8877ba2c5d32eb3af621e7f':
  vdpau: Adjust necessary #includes for vdpau_internal.h

Conflicts:
	libavcodec/vdpau_internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 22:59:16 +01:00
Diego Biurrun
ecbcebde34 vdpau: Adjust necessary #includes for vdpau_internal.h 2015-02-14 10:56:01 -08:00
Michael Niedermayer
6f764d2911 Merge commit '737d35e33408263c04d7730f5487eed0d04938ba'
* commit '737d35e33408263c04d7730f5487eed0d04938ba':
  vdpau: add support for the H.264 High 4:4:4 Predictive profile

Conflicts:
	libavcodec/vdpau_internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-27 14:46:15 +01:00
Rémi Denis-Courmont
737d35e334 vdpau: add support for the H.264 High 4:4:4 Predictive profile
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-12-25 20:47:49 +01:00
Michael Niedermayer
51c810e62b Merge commit 'd565fef1b83b6c5f8afb32229260b79f67c68109'
* commit 'd565fef1b83b6c5f8afb32229260b79f67c68109':
  vdpau: add AV_HWACCEL_FLAG_IGNORE_LEVEL to skip the codec level check

Conflicts:
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-15 12:30:07 +02:00
Rémi Denis-Courmont
d565fef1b8 vdpau: add AV_HWACCEL_FLAG_IGNORE_LEVEL to skip the codec level check
Decoding acceleration may work even if the codec level is higher than
the stated limit of the VDPAU driver. Or the problem may be considered
acceptable by the user. This flag allows skipping the codec level
capability checks and proceed with decoding.

Applications should obviously not set this flag by default, but only if
the user explicitly requested this behavior (and presumably knows how
to turn it back off if it fails).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-15 06:21:56 +00:00
Michael Niedermayer
a61899a0f1 Merge commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0'
* commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0':
  vdpau: add av_vdpau_bind_context()

Conflicts:
	doc/APIchanges
	libavcodec/vdpau.h
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 15:04:03 +02:00
Michael Niedermayer
067d11bf71 Merge commit '502cde409ca5ee97ef70c2cdede88b9101746ff6'
* commit '502cde409ca5ee97ef70c2cdede88b9101746ff6':
  vdpau: force reinitialization when output resolution changes

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 14:17:40 +02:00
Michael Niedermayer
8df41976b7 avcodec/vdpau_internal: add comment to #endif
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 12:47:08 +02:00
Michael Niedermayer
10b6d7462c Merge commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd'
* commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd':
  vdpau: common support for managing the VdpDecoder in avcodec

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 12:38:26 +02:00
Michael Niedermayer
b64b719ad5 Merge commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7'
* commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7':
  vdpau: factor out common end-of-frame handling

Conflicts:
	libavcodec/vdpau.c
	libavcodec/vdpau_h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 12:09:17 +02:00
Rémi Denis-Courmont
e3e158e81f vdpau: add av_vdpau_bind_context()
This function provides an explicit VDPAU device and VDPAU driver to
libavcodec, so that the application is relieved from codec specifics
and VdpDevice life cycle management.

A stub flags parameter is added for future extension. For instance, it
could be used to ignore codec level capabilities (if someone feels
dangerous).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-06 06:20:40 +00:00
Rémi Denis-Courmont
502cde409c vdpau: force reinitialization when output resolution changes
This is necessary to recreate the decoder with the correct parameters,
as not all codecs invoke get_format() in this case.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-06 06:18:56 +00:00
Rémi Denis-Courmont
ce083282f0 vdpau: common support for managing the VdpDecoder in avcodec
Using the not so new init and uninit callbacks, avcodec can now take
care of creating and destroying the VDPAU decoder instance.

The application is still responsible for creating the VDPAU device
and allocating video surfaces - this is necessary to keep video
surfaces on the GPU all the way to the output. But the application
will no longer needs to care about any codec-specific aspects.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-05 10:17:02 +00:00
Rémi Denis-Courmont
fcc1022611 vdpau: factor out common end-of-frame handling
Also add error handling.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-10-05 10:13:44 +00:00
Michael Niedermayer
f932e5f716 avcodec/vdpau_internal: move "struct vdpau_picture_context" up to avoid "#else"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-22 01:53:54 +02:00
Dale Curtis
d5d6b8e259 Fix compilation error around struct visibility when VDPAU disabled.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-22 01:53:13 +02:00
Michael Niedermayer
1ec295a5c5 Merge commit '1b1094a19d9e41baf3253c83841f9e5343cecbd0'
* commit '1b1094a19d9e41baf3253c83841f9e5343cecbd0':
  vdpau: switch ff_vdpau_get_surface_id from Picture to AVFrame

Conflicts:
	libavcodec/vdpau_internal.h
	libavcodec/vdpau_vc1.c

See: 2a37e560dc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-20 22:48:58 +01:00
Michael Niedermayer
4d216420be Merge commit '7948a51b5c3d08e1a1173442a7ff72b220def303'
* commit '7948a51b5c3d08e1a1173442a7ff72b220def303':
  vdpau: don't assume Picture and H264Picture are the same

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-20 22:39:54 +01:00
wm4
1b1094a19d vdpau: switch ff_vdpau_get_surface_id from Picture to AVFrame
This gets rid of aliasing completely unrelated structs to Picture.

Fixes the remaining compilation warnings in the vdpau code.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-03-20 17:00:39 +01:00
wm4
7948a51b5c vdpau: don't assume Picture and H264Picture are the same
The code passed H264Picture* and Picture*, and assumed the
hwaccel_picture_private field was in the same place in both
structs. Somehow this happened to work in Libav, but broke in
FFmpeg (and probably subtly breaks in Libav too).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-03-20 16:59:46 +01:00
Michael Niedermayer
2a37e560dc avcodec/vdpau: fix ff_vdpau_get_surface_id() argument after H264Picture
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-17 13:05:13 +01:00
Michael Niedermayer
ee9d53e572 Merge commit '48e139409556861c9e561ce34133891d8eecc3cf'
* commit '48e139409556861c9e561ce34133891d8eecc3cf':
  mpeg4videodec: move MpegEncContext.resync_marker into Mpeg4DecContext.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-30 01:28:04 +01:00
Michael Niedermayer
e1459f4b0b Merge commit '70cbf33405f50dfaf77e85f382a188acf17dc71a'
* commit '70cbf33405f50dfaf77e85f382a188acf17dc71a':
  vdpau: Add missing #includes to fix standalone header compilation

Conflicts:
	libavcodec/vdpau_internal.h

Not completely merged as this would break use of vdpau.h from C++

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-05 11:14:29 +01:00
Diego Biurrun
70cbf33405 vdpau: Add missing #includes to fix standalone header compilation
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-04 22:54:55 +01:00
Carl Eugen Hoyos
e7da19e9fa Fix make checkheaders for vdpau_internal.h 2013-08-31 13:32:13 +02:00
Michael Niedermayer
6e4b9b8a2f avcodec: fix compilation without vdpau
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-17 22:18:55 +02:00
Michael Niedermayer
a0c6c8e53e Revert "Merge commit of 'vdpau: remove old-style decoders'"
This reverts commit bf36dc50ea, reversing
changes made to b7fc2693c7.

Conflicts:

	libavcodec/h264.c

Keeping support for the old VDPAU API has been requested by our VDPAU maintainer

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-17 22:17:49 +02:00
Reimar Döffinger
d87f9da53c vdpau_internal.h: Add missing include for FF_API_BUFS_VDPAU.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-08-11 19:30:51 +02:00
Michael Niedermayer
9547e3eef3 Merge commit 'f824535a4a79c260b59d3178b8d958217caffd78'
* commit 'f824535a4a79c260b59d3178b8d958217caffd78':
  vdpau: deprecate bitstream buffers within the hardware context

Conflicts:
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 14:30:49 +02:00
Michael Niedermayer
c3b2902320 Merge commit '2852740e23f91d6775714d7cc29b9a73e1111ce0'
* commit '2852740e23f91d6775714d7cc29b9a73e1111ce0':
  vdpau: store picture data in picture's rather than codec's context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 14:25:26 +02:00
Michael Niedermayer
bf36dc50ea Merge commit '578ea75a9e4ac56e0bbbbe668700be756aa699f8'
* commit '578ea75a9e4ac56e0bbbbe668700be756aa699f8':
  vdpau: remove old-style decoders

Conflicts:
	libavcodec/allcodecs.c
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/vc1dec.c
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 13:24:22 +02:00
Rémi Denis-Courmont
f824535a4a vdpau: deprecate bitstream buffers within the hardware context
The bitstream buffers are now private and freed by libavcodec. For
backward compatibility, the hold bitstream buffer pointer is left NULL
(applications were supposed to av_freep() it).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-05 11:21:36 +02:00
Rémi Denis-Courmont
2852740e23 vdpau: store picture data in picture's rather than codec's context
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-05 11:20:41 +02:00
Rémi Denis-Courmont
578ea75a9e vdpau: remove old-style decoders
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-05 11:15:49 +02: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
Michael Niedermayer
cfc40a6aff Merge commit 'd8c772de53d29afb1bada88afa859fce8489c668'
* commit 'd8c772de53d29afb1bada88afa859fce8489c668':
  nutdec: Always return a value from nut_read_timestamp()
  configure: Make warnings from -Wreturn-type fatal errors
  x86: ABS2: port to cpuflags
  vdpau: Remove av_unused attribute from function declaration
  h264: fix ff_generate_sliding_window_mmcos() prototype.

Conflicts:
	configure
	libavformat/nutdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 15:23:20 +01:00
Rémi Denis-Courmont
171f1446f0 vdpau: Remove av_unused attribute from function declaration
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-14 21:56:55 +01:00
Michael Niedermayer
8ee7b3881b Merge commit '44e065d56c87d6a9d0effccec5f31517f72924ec'
* commit '44e065d56c87d6a9d0effccec5f31517f72924ec':
  vdpau: Add context and common helpers for hwaccel support

Conflicts:
	Changelog
	doc/APIchanges
	libavcodec/vdpau.h
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 13:29:00 +01:00
Rémi Denis-Courmont
44e065d56c vdpau: Add context and common helpers for hwaccel support
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-13 14:41:27 +01:00
Michael Niedermayer
f0a7b67a35 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  adpcm: use sign_extend()
  mpeg12: fix mpeg_decode_slice context parameter type
  Revert "mpeg12: move full_pel from MpegEncContext to Mpeg1Context"

Conflicts:
	libavcodec/mpeg12.c
	libavcodec/mpeg12.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-24 23:45:44 +02:00
Michael Niedermayer
2b0cdb7364 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Move id3v2 tag writing to a separate file.
  swscale: add missing colons to x86 assembly yuv2planeX.
  g722: split decoder and encoder into separate files
  cosmetics: remove extra spaces before end-of-statement semi-colons
  vorbisdec: check output buffer size before writing output
  wavpack: calculate bpp using av_get_bytes_per_sample()
  ac3enc: Set max value for mode options correctly
  lavc: move get_b_cbp() from h263.h to mpeg4videoenc.c
  mpeg12: move closed_gop from MpegEncContext to Mpeg1Context
  mpeg12: move full_pel from MpegEncContext to Mpeg1Context
  mpeg12: move Mpeg1Context from mpeg12.c to mpeg12.h
  mpegvideo: remove some unused variables from MpegEncContext.

Conflicts:
	libavcodec/mpeg12.c
	libavformat/mp3enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-24 01:01:21 +02:00
Janne Grunau
cd8c64e197 Revert "mpeg12: move full_pel from MpegEncContext to Mpeg1Context"
This reverts commit da22ba7df4 since it
broke slice threading. Slice threading just duplicates MpegEncContext
so every value used during mpeg_decode_slice has to be in it.
A second patch will fix the illusion that Mpeg1Context is available
in mpeg_decode_slice.
2011-10-24 00:59:41 +02:00
Anton Khirnov
da22ba7df4 mpeg12: move full_pel from MpegEncContext to Mpeg1Context
It's MPEG-1 specific.
2011-10-23 14:14:39 +02:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Stephen Warren
3bccd93ac0 Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
start of decoding a picture instead of at the end.
Fixes mmco01.264

Patch by Stephen Warren

Originally committed as revision 22728 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-30 08:10:29 +00:00
NVIDIA Corporation
70e0c871eb Add VDPAU hardware accelerated decoding for MPEG-4 ASP which can be used
by video players.

Original patch by NVIDIA corporation.

Originally committed as revision 20502 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-11-10 18:52:39 +00:00