FFmpeg
9.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libavutil
hwcontext_cuda.h
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
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.
8
*
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.
13
*
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
17
*/
18
19
20
#ifndef AVUTIL_HWCONTEXT_CUDA_H
21
#define AVUTIL_HWCONTEXT_CUDA_H
22
23
#ifndef CUDA_VERSION
24
#include <cuda.h>
25
#endif
26
27
#include <stdint.h>
28
29
#include "
pixfmt.h
"
30
31
/**
32
* @file
33
* An API-specific header for AV_HWDEVICE_TYPE_CUDA.
34
*
35
* This API supports dynamic frame pools. AVHWFramesContext.pool must return
36
* AVBufferRefs whose data pointer is a CUdeviceptr.
37
*/
38
39
typedef
struct
AVCUDADeviceContextInternal
AVCUDADeviceContextInternal
;
40
41
/**
42
* This struct is allocated as AVHWDeviceContext.hwctx
43
*/
44
typedef
struct
AVCUDADeviceContext
{
45
CUcontext
cuda_ctx
;
46
CUstream
stream
;
47
AVCUDADeviceContextInternal
*
internal
;
48
}
AVCUDADeviceContext
;
49
50
/**
51
* CUDA frame descriptor for pool allocation of AV_PIX_FMT_CUARRAY frames.
52
*
53
* In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs
54
* with the data pointer pointing at an object of this type describing the
55
* planes of the frame.
56
*
57
* This has no use outside of custom allocation, and AVFrame AVBufferRef do not
58
* necessarily point to an instance of this struct.
59
*/
60
typedef
struct
AVCUDAArrayFrameDescriptor
{
61
/**
62
* The CUarray containing the frame data.
63
*
64
* Normally stored in AVFrame.data[0].
65
*/
66
CUarray
array
;
67
68
/**
69
* The index into AVCUDAFramesContext.cuarray_surfaces, or 0 if not applicable.
70
*
71
* Normally stored in AVFrame.data[1] (cast from intptr_t).
72
*/
73
intptr_t
index
;
74
}
AVCUDAArrayFrameDescriptor
;
75
76
/**
77
* This struct is allocated as AVHWFramesContext.hwctx
78
*/
79
typedef
struct
AVCUDAFramesContext
{
80
/**
81
* CUDA_ARRAY3D_DESCRIPTOR CUarrays will be initialized with.
82
* Mostly used to provide external Flags.
83
*
84
* Width, Height and Format only honored if != 0.
85
* Filled with default parameters from the FramesContext otherwise.
86
*
87
* Only applicable for AV_PIX_FMT_CUARRAY.
88
*/
89
CUDA_ARRAY3D_DESCRIPTOR
cuarray_desc
;
90
91
/**
92
* If >0, pre-allocate a fixed pool of surfaces.
93
* The surfaces will be available via cuarray_surfaces after init.
94
* Size of the pool cannot be changed afterwards.
95
*
96
* Only applicable for AV_PIX_FMT_CUARRAY.
97
*/
98
int
cuarray_num_surfaces
;
99
100
/**
101
* If cuarray_num_surfaces is >0, this contains the array of pre-allocated surfaces.
102
*
103
* Only applicable for AV_PIX_FMT_CUARRAY.
104
*/
105
CUarray *
cuarray_surfaces
;
106
}
AVCUDAFramesContext
;
107
108
/**
109
* CUDA hardware pipeline configuration details.
110
*
111
* Passed to av_hwdevice_get_hwframe_constraints() to query
112
* per-hw-format constraints. When provided, valid_sw_formats
113
* will be filtered to only those compatible with the specified
114
* hw_format.
115
*/
116
typedef
struct
AVCUDAHWConfig
{
117
/**
118
* The hardware pixel format to query constraints for.
119
* Must be AV_PIX_FMT_CUDA or AV_PIX_FMT_CUARRAY.
120
*/
121
enum
AVPixelFormat
hw_format
;
122
}
AVCUDAHWConfig
;
123
124
/**
125
* @defgroup hwcontext_cuda Device context creation flags
126
*
127
* Flags for av_hwdevice_ctx_create.
128
*
129
* @{
130
*/
131
132
/**
133
* Use primary device context instead of creating a new one.
134
*/
135
#define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0)
136
137
/**
138
* Use current device context instead of creating a new one.
139
*/
140
#define AV_CUDA_USE_CURRENT_CONTEXT (1 << 1)
141
142
/**
143
* @}
144
*/
145
146
#endif
/* AVUTIL_HWCONTEXT_CUDA_H */
AVCUDADeviceContextInternal
struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal
Definition
hwcontext_cuda.h:39
pixfmt.h
pixel format definitions
AVPixelFormat
AVPixelFormat
Pixel format.
Definition
pixfmt.h:71
AVCUDAArrayFrameDescriptor
CUDA frame descriptor for pool allocation of AV_PIX_FMT_CUARRAY frames.
Definition
hwcontext_cuda.h:60
AVCUDAArrayFrameDescriptor::index
intptr_t index
The index into AVCUDAFramesContext.cuarray_surfaces, or 0 if not applicable.
Definition
hwcontext_cuda.h:73
AVCUDAArrayFrameDescriptor::array
CUarray array
The CUarray containing the frame data.
Definition
hwcontext_cuda.h:66
AVCUDADeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition
hwcontext_cuda.h:44
AVCUDADeviceContext::cuda_ctx
CUcontext cuda_ctx
Definition
hwcontext_cuda.h:45
AVCUDADeviceContext::internal
AVCUDADeviceContextInternal * internal
Definition
hwcontext_cuda.h:47
AVCUDADeviceContext::stream
CUstream stream
Definition
hwcontext_cuda.h:46
AVCUDAFramesContext
This struct is allocated as AVHWFramesContext.hwctx.
Definition
hwcontext_cuda.h:79
AVCUDAFramesContext::cuarray_surfaces
CUarray * cuarray_surfaces
If cuarray_num_surfaces is >0, this contains the array of pre-allocated surfaces.
Definition
hwcontext_cuda.h:105
AVCUDAFramesContext::cuarray_desc
CUDA_ARRAY3D_DESCRIPTOR cuarray_desc
CUDA_ARRAY3D_DESCRIPTOR CUarrays will be initialized with.
Definition
hwcontext_cuda.h:89
AVCUDAFramesContext::cuarray_num_surfaces
int cuarray_num_surfaces
If >0, pre-allocate a fixed pool of surfaces.
Definition
hwcontext_cuda.h:98
AVCUDAHWConfig
CUDA hardware pipeline configuration details.
Definition
hwcontext_cuda.h:116
AVCUDAHWConfig::hw_format
enum AVPixelFormat hw_format
The hardware pixel format to query constraints for.
Definition
hwcontext_cuda.h:121
Generated by
1.17.0