Commit Graph

38 Commits

Author SHA1 Message Date
James Almer 4e9dc52a97 Merge commit '1bd986ed4b0e95ded368a8eeb5c044853c090f9b'
* commit '1bd986ed4b0e95ded368a8eeb5c044853c090f9b':
  hwcontext: Move NONE to the be the first member of AVHWDeviceType

Merged-by: James Almer <jamrial@gmail.com>
2017-10-24 19:14:22 -03:00
Mark Thompson 309d660775 hwcontext: Perform usual initialisation on derived device contexts
The initialisation should be common.  For libmfx, it was previously
happening in the derivation function and this moves it out.  For VAAPI,
it fixes some failures when deriving from a DRM device because this
initialisation did not run.
2017-10-09 00:11:53 +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
Mark Thompson 9cb23cd9fe lavu: Add DRM hwcontext 2017-09-13 22:03:27 +01:00
wm4 3303511f33 lavu: add new D3D11 pixfmt and hwcontext
To be used with the new d3d11 hwaccel decode API.

With the new hwaccel API, we don't want surfaces to depend on the
decoder (other than the required dimension and format). The old D3D11VA
pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the
decoder configuration, and thus is incompatible with the new hwaccel
API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D
and an index. It's simpler and compatible with the new hwaccel API.

The introduced hwcontext supports only the new pixfmt.

Frame upload code untested.

Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with
heavy changes/rewrites.

Merges Libav commit fff90422d1.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-06-27 18:05:02 +02:00
Mark Thompson d59c6a3aeb hwcontext: Improve allocation in derived contexts
Use the flags argument of av_hwframe_ctx_create_derived() to pass the
mapping flags which will be used on allocation.  Also, set the format
and hardware context on the allocated frame automatically - the user
should not be required to do this themselves.

(cherry picked from commit c5714b51aa)
2017-06-14 22:27:32 +01:00
Mark Thompson ec3dbeae81 hwcontext: Add frame context mapping for nontrivial contexts
Some frames contexts are not usable without additional format-specific
state in hwctx.  This change adds new functions frames_derive_from and
frames_derive_to to initialise this state appropriately when deriving
a frames context which will require it to be set.

(cherry picked from commit 27978155bc)
2017-06-14 22:27:07 +01:00
Mark Thompson 0b1794a43e hwcontext: Make it easier to work with device types
Adds functions to convert to/from strings and a function to iterate
over all supported device types.  Also adds a new invalid type
AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value.

(cherry picked from commit b7487f4f3c)
2017-06-14 22:26:29 +01:00
Mark Thompson b22172f6f3 hwcontext: Add device derivation
Creates a new device context from another of a different type which
refers to the same underlying hardware.

(cherry picked from commit b266ad56fe)
2017-06-14 22:25:57 +01:00
wm4 532b23f079 videotoolbox: add hwcontext support
This adds tons of code for no other benefit than making VideoToolbox
support conform with the new hwaccel API (using hw_device_ctx and
hw_frames_ctx).

Since VideoToolbox decoding does not actually require the user to
allocate frames, the new code does mostly nothing.

One benefit is that ffmpeg_videotoolbox.c can be dropped once generic
hwaccel support for ffmpeg.c is merged from Libav.

Does not consider VDA or VideoToolbox encoding.

Fun fact: the frame transfer functions are copied from vaapi, as the
mapping makes copying generic boilerplate. Mapping itself is not
exported by the VT code, because I don't know how to test.
2017-05-15 11:30:36 +02:00
Clément Bœsch 4cda23f1f1 Merge commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0'
* commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0':
  hwcontext: Hardware frame mapping

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:36:37 +02:00
Mark Thompson 1bd986ed4b hwcontext: Move NONE to the be the first member of AVHWDeviceType
Also use that to fix a warning in av_hwdevice_get_type_name().
2017-03-27 21:54:06 +01:00
Mark Thompson b7487f4f3c hwcontext: Make it easier to work with device types
Adds functions to convert to/from strings and a function to iterate
over all supported device types.  Also adds a new invalid type
AV_HWDEVICE_TYPE_NONE, which acts as a sentinel value.
2017-03-20 23:15:43 +00:00
Mark Thompson b266ad56fe hwcontext: Add device derivation
Creates a new device context from another of a different type which
refers to the same underlying hardware.
2017-03-20 23:15:43 +00:00
Anton Khirnov fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Hendrik Leppkes 7071924cf2 Merge commit 'fdfe01365d579189d9a55b3741dba2ac46eb1df8'
* commit 'fdfe01365d579189d9a55b3741dba2ac46eb1df8':
  hwcontext: allocate the destination frame for the pool size

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-13 22:35:49 +01:00
Mark Thompson d06aa24ba5 hwcontext: Hardware frame mapping
Adds the new av_hwframe_map() function, which allows mapping between
hardware frames and normal memory, along with internal support for
implementing it.

Also adds av_hwframe_ctx_create_derived(), for creating a hardware
frames context associated with one device using frames mapped from
another by some hardware-specific means.
2016-11-03 23:49:01 +00:00
James Almer 13dd5edb88 avutil/hwcontext: use CONFIG_QSV instead of CONFIG_LIBMFX for qsv
See "[FFmpeg-devel] [PATCH] hwcontext: add a QSV implementation"

Suggested-by: nablet developer <sdk@nablet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-28 15:13:10 -03:00
James Almer eba0414768 Merge commit '59e7361cc791e5103be1712dc59a2055f118d0da'
* commit '59e7361cc791e5103be1712dc59a2055f118d0da':
  hwcontext: add a QSV implementation

Conflicts:
    doc/APIchanges
    libavutil/version.h

Merged-by: James Almer <jamrial@gmail.com>
2016-09-28 13:30:27 -03:00
Anton Khirnov fdfe01365d hwcontext: allocate the destination frame for the pool size
The source frame may be cropped, so that its dimensions are smaller than
the pool dimensions. The transfer_data API requires the allocated size
of the destination frame to be the same as the pool size.
2016-06-28 08:31:28 +02:00
Hendrik Leppkes 481f320aa3 Merge commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d'
* commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d':
  hwcontext: add a function for opening devices

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:23:24 +02:00
Hendrik Leppkes 3689efea3d Merge commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8'
* commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8':
  hwcontext: add a dxva2 implementation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-22 22:38:49 +02:00
Anton Khirnov 59e7361cc7 hwcontext: add a QSV implementation 2016-06-21 19:53:37 +02:00
Anton Khirnov 1c9e8616c5 hwcontext: add a function for opening devices 2016-05-26 15:40:32 +02:00
Anton Khirnov c46db38cde hwcontext: add a dxva2 implementation 2016-05-17 09:11:25 +02:00
Derek Buitenhuis c71c3b9ff4 Merge commit 'a0f469da744db83db32f3fe13186ee4aa2bc7dc5'
* commit 'a0f469da744db83db32f3fe13186ee4aa2bc7dc5':
  hwcontext: initialize sw_format in av_hwframe_ctx_alloc()

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:46:17 +01:00
Anton Khirnov a0f469da74 hwcontext: initialize sw_format in av_hwframe_ctx_alloc() 2016-04-15 10:15:54 +02:00
Derek Buitenhuis 28abb216cb Merge commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4'
* commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4':
  lavu: VAAPI hwcontext implementation

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-14 13:49:55 +01:00
Derek Buitenhuis afccfaf26a Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'
* commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09':
  lavu: add a way to query hwcontext frame constraints

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-14 13:33:37 +01:00
Mark Thompson 551c6775ab lavu: VAAPI hwcontext implementation
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-03-19 15:40:22 +01:00
Mark Thompson b1f01e85a9 lavu: add a way to query hwcontext frame constraints
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-03-19 15:38:00 +01:00
Derek Buitenhuis 6992276aca Merge commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073'
* commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073':
  hwcontext: add a CUDA implementation

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-24 15:23:16 +00:00
Michael Niedermayer c4ac30909e avutil/hwcontext: Remove duplicate ;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-17 21:16:14 +01:00
Derek Buitenhuis d779d8d771 Merge commit 'a001ce31bc2bcf875a39b5fb22dae49120293b42'
* commit 'a001ce31bc2bcf875a39b5fb22dae49120293b42':
  hwcontext: add a VDPAU implementation

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-17 16:16:34 +00:00
Derek Buitenhuis 1a708780f3 Merge commit '89923e418b494e337683442ab896d754bc07341a'
* commit '89923e418b494e337683442ab896d754bc07341a':
  lavu: add a framework for handling hwaccel frames

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-17 16:12:25 +00:00
Anton Khirnov ad884d1002 hwcontext: add a CUDA implementation 2016-02-14 22:08:33 +01:00
Anton Khirnov a001ce31bc hwcontext: add a VDPAU implementation 2016-02-14 22:06:04 +01:00
Anton Khirnov 89923e418b lavu: add a framework for handling hwaccel frames 2016-02-14 21:36:59 +01:00