Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b25d8ef0
Commit
b25d8ef0
authored
Mar 04, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavu: OpenCL hwcontext implementation
parent
a050f56c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1414 additions
and
3 deletions
+1414
-3
configure
configure
+2
-2
APIchanges
doc/APIchanges
+4
-0
Makefile
libavutil/Makefile
+2
-0
hwcontext.c
libavutil/hwcontext.c
+4
-0
hwcontext.h
libavutil/hwcontext.h
+1
-0
hwcontext_internal.h
libavutil/hwcontext_internal.h
+1
-0
hwcontext_opencl.c
libavutil/hwcontext_opencl.c
+1303
-0
hwcontext_opencl.h
libavutil/hwcontext_opencl.h
+96
-0
version.h
libavutil/version.h
+1
-1
No files found.
configure
View file @
b25d8ef0
...
...
@@ -289,7 +289,7 @@ External library support:
--enable-mediacodec enable Android MediaCodec support [no]
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
--enable-openal enable OpenAL 1.1 capture support [no]
--enable-opencl enable OpenCL
code
--enable-opencl enable OpenCL
processing [no]
--enable-opengl enable OpenGL rendering [no]
--enable-openssl enable openssl, needed for https support
if gnutls is not used [no]
...
...
@@ -1633,7 +1633,6 @@ EXTERNAL_LIBRARY_LIST="
libzvbi
mediacodec
openal
opencl
opengl
"
...
...
@@ -1669,6 +1668,7 @@ HWACCEL_LIBRARY_LIST="
libmfx
mmal
omx
opencl
"
DOCUMENT_LIST
=
"
...
...
doc/APIchanges
View file @
b25d8ef0
...
...
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
API changes, most recent first:
2017-11-xx - xxxxxxx - lavu 55.2.0 - hwcontext.h hwcontext_opencl.h
Add AV_HWDEVICE_TYPE_OPENCL and a new installed header with
OpenCL-specific hwcontext definitions.
2017-11-xx - xxxxxxx - lavu 55.1.0 - pixfmt.h
Add AV_PIX_FMT_OPENCL.
...
...
libavutil/Makefile
View file @
b25d8ef0
...
...
@@ -165,6 +165,7 @@ OBJS-$(CONFIG_QSV) += hwcontext_qsv.o
OBJS-$(CONFIG_LIBDRM)
+=
hwcontext_drm.o
OBJS-$(CONFIG_LZO)
+=
lzo.o
OBJS-$(CONFIG_OPENCL)
+=
opencl.o
opencl_internal.o
OBJS-$(CONFIG_OPENCL)
+=
hwcontext_opencl.o
OBJS-$(CONFIG_VAAPI)
+=
hwcontext_vaapi.o
OBJS-$(CONFIG_VIDEOTOOLBOX)
+=
hwcontext_videotoolbox.o
OBJS-$(CONFIG_VDPAU)
+=
hwcontext_vdpau.o
...
...
@@ -179,6 +180,7 @@ SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h
SKIPHEADERS-$(CONFIG_D3D11VA)
+=
hwcontext_d3d11va.h
SKIPHEADERS-$(CONFIG_DXVA2)
+=
hwcontext_dxva2.h
SKIPHEADERS-$(CONFIG_QSV)
+=
hwcontext_qsv.h
SKIPHEADERS-$(CONFIG_OPENCL)
+=
hwcontext_opencl.h
SKIPHEADERS-$(CONFIG_VAAPI)
+=
hwcontext_vaapi.h
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX)
+=
hwcontext_videotoolbox.h
SKIPHEADERS-$(CONFIG_VDPAU)
+=
hwcontext_vdpau.h
...
...
libavutil/hwcontext.c
View file @
b25d8ef0
...
...
@@ -41,6 +41,9 @@ static const HWContextType * const hw_table[] = {
#if CONFIG_DXVA2
&
ff_hwcontext_type_dxva2
,
#endif
#if CONFIG_OPENCL
&
ff_hwcontext_type_opencl
,
#endif
#if CONFIG_QSV
&
ff_hwcontext_type_qsv
,
#endif
...
...
@@ -61,6 +64,7 @@ static const char *const hw_type_names[] = {
[
AV_HWDEVICE_TYPE_DRM
]
=
"drm"
,
[
AV_HWDEVICE_TYPE_DXVA2
]
=
"dxva2"
,
[
AV_HWDEVICE_TYPE_D3D11VA
]
=
"d3d11va"
,
[
AV_HWDEVICE_TYPE_OPENCL
]
=
"opencl"
,
[
AV_HWDEVICE_TYPE_QSV
]
=
"qsv"
,
[
AV_HWDEVICE_TYPE_VAAPI
]
=
"vaapi"
,
[
AV_HWDEVICE_TYPE_VDPAU
]
=
"vdpau"
,
...
...
libavutil/hwcontext.h
View file @
b25d8ef0
...
...
@@ -34,6 +34,7 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_VIDEOTOOLBOX
,
AV_HWDEVICE_TYPE_D3D11VA
,
AV_HWDEVICE_TYPE_DRM
,
AV_HWDEVICE_TYPE_OPENCL
,
};
typedef
struct
AVHWDeviceInternal
AVHWDeviceInternal
;
...
...
libavutil/hwcontext_internal.h
View file @
b25d8ef0
...
...
@@ -161,6 +161,7 @@ extern const HWContextType ff_hwcontext_type_cuda;
extern
const
HWContextType
ff_hwcontext_type_d3d11va
;
extern
const
HWContextType
ff_hwcontext_type_drm
;
extern
const
HWContextType
ff_hwcontext_type_dxva2
;
extern
const
HWContextType
ff_hwcontext_type_opencl
;
extern
const
HWContextType
ff_hwcontext_type_qsv
;
extern
const
HWContextType
ff_hwcontext_type_vaapi
;
extern
const
HWContextType
ff_hwcontext_type_vdpau
;
...
...
libavutil/hwcontext_opencl.c
0 → 100644
View file @
b25d8ef0
This diff is collapsed.
Click to expand it.
libavutil/hwcontext_opencl.h
0 → 100644
View file @
b25d8ef0
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_OPENCL_H
#define AVUTIL_HWCONTEXT_OPENCL_H
#include <CL/cl.h>
#include "frame.h"
/**
* @file
* API-specific header for AV_HWDEVICE_TYPE_OPENCL.
*
* Pools allocated internally are always dynamic, and are primarily intended
* to be used in OpenCL-only cases. If interoperation is required, it is
* typically required to allocate frames in the other API and then map the
* frames context to OpenCL with av_hwframe_ctx_create_derived().
*/
/**
* OpenCL frame descriptor for pool allocation.
*
* In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
* with the data pointer pointing at an object of this type describing the
* planes of the frame.
*/
typedef
struct
AVOpenCLFrameDescriptor
{
/**
* Number of planes in the frame.
*/
int
nb_planes
;
/**
* OpenCL image2d objects for each plane of the frame.
*/
cl_mem
planes
[
AV_NUM_DATA_POINTERS
];
}
AVOpenCLFrameDescriptor
;
/**
* OpenCL device details.
*
* Allocated as AVHWDeviceContext.hwctx
*/
typedef
struct
AVOpenCLDeviceContext
{
/**
* The primary device ID of the device. If multiple OpenCL devices
* are associated with the context then this is the one which will
* be used for all operations internal to FFmpeg.
*/
cl_device_id
device_id
;
/**
* The OpenCL context which will contain all operations and frames on
* this device.
*/
cl_context
context
;
/**
* The default command queue for this device, which will be used by all
* frames contexts which do not have their own command queue. If not
* intialised by the user, a default queue will be created on the
* primary device.
*/
cl_command_queue
command_queue
;
}
AVOpenCLDeviceContext
;
/**
* OpenCL-specific data associated with a frame pool.
*
* Allocated as AVHWFramesContext.hwctx.
*/
typedef
struct
AVOpenCLFramesContext
{
/**
* The command queue used for internal asynchronous operations on this
* device (av_hwframe_transfer_data(), av_hwframe_map()).
*
* If this is not set, the command queue from the associated device is
* used instead.
*/
cl_command_queue
command_queue
;
}
AVOpenCLFramesContext
;
#endif
/* AVUTIL_HWCONTEXT_OPENCL_H */
libavutil/version.h
View file @
b25d8ef0
...
...
@@ -80,7 +80,7 @@
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MINOR
1
#define LIBAVUTIL_VERSION_MINOR
2
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment