2 * This file is part of FFmpeg.
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef AVUTIL_HWCONTEXT_OPENCL_H
20 #define AVUTIL_HWCONTEXT_OPENCL_H
23 #include <OpenCL/cl.h>
32 * API-specific header for AV_HWDEVICE_TYPE_OPENCL.
34 * Pools allocated internally are always dynamic, and are primarily intended
35 * to be used in OpenCL-only cases. If interoperation is required, it is
36 * typically required to allocate frames in the other API and then map the
37 * frames context to OpenCL with av_hwframe_ctx_create_derived().
41 * OpenCL frame descriptor for pool allocation.
43 * In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
44 * with the data pointer pointing at an object of this type describing the
45 * planes of the frame.
47 typedef struct AVOpenCLFrameDescriptor {
49 * Number of planes in the frame.
53 * OpenCL image2d objects for each plane of the frame.
55 cl_mem planes[AV_NUM_DATA_POINTERS];
56 } AVOpenCLFrameDescriptor;
59 * OpenCL device details.
61 * Allocated as AVHWDeviceContext.hwctx
63 typedef struct AVOpenCLDeviceContext {
65 * The primary device ID of the device. If multiple OpenCL devices
66 * are associated with the context then this is the one which will
67 * be used for all operations internal to FFmpeg.
69 cl_device_id device_id;
71 * The OpenCL context which will contain all operations and frames on
76 * The default command queue for this device, which will be used by all
77 * frames contexts which do not have their own command queue. If not
78 * intialised by the user, a default queue will be created on the
81 cl_command_queue command_queue;
82 } AVOpenCLDeviceContext;
85 * OpenCL-specific data associated with a frame pool.
87 * Allocated as AVHWFramesContext.hwctx.
89 typedef struct AVOpenCLFramesContext {
91 * The command queue used for internal asynchronous operations on this
92 * device (av_hwframe_transfer_data(), av_hwframe_map()).
94 * If this is not set, the command queue from the associated device is
97 cl_command_queue command_queue;
98 } AVOpenCLFramesContext;
100 #endif /* AVUTIL_HWCONTEXT_OPENCL_H */