torchcodec 0.7.0__cp313-cp313-win_amd64.whl → 0.8.1__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of torchcodec might be problematic. Click here for more details.
- torchcodec/_core/AVIOTensorContext.cpp +23 -16
- torchcodec/_core/AVIOTensorContext.h +2 -1
- torchcodec/_core/BetaCudaDeviceInterface.cpp +718 -0
- torchcodec/_core/BetaCudaDeviceInterface.h +193 -0
- torchcodec/_core/CMakeLists.txt +18 -3
- torchcodec/_core/CUDACommon.cpp +330 -0
- torchcodec/_core/CUDACommon.h +51 -0
- torchcodec/_core/Cache.h +6 -20
- torchcodec/_core/CpuDeviceInterface.cpp +195 -108
- torchcodec/_core/CpuDeviceInterface.h +84 -19
- torchcodec/_core/CudaDeviceInterface.cpp +227 -376
- torchcodec/_core/CudaDeviceInterface.h +38 -6
- torchcodec/_core/DeviceInterface.cpp +57 -19
- torchcodec/_core/DeviceInterface.h +97 -16
- torchcodec/_core/Encoder.cpp +346 -9
- torchcodec/_core/Encoder.h +62 -1
- torchcodec/_core/FFMPEGCommon.cpp +190 -3
- torchcodec/_core/FFMPEGCommon.h +27 -1
- torchcodec/_core/FilterGraph.cpp +30 -22
- torchcodec/_core/FilterGraph.h +15 -1
- torchcodec/_core/Frame.cpp +22 -7
- torchcodec/_core/Frame.h +15 -61
- torchcodec/_core/Metadata.h +2 -2
- torchcodec/_core/NVCUVIDRuntimeLoader.cpp +320 -0
- torchcodec/_core/NVCUVIDRuntimeLoader.h +14 -0
- torchcodec/_core/NVDECCache.cpp +60 -0
- torchcodec/_core/NVDECCache.h +102 -0
- torchcodec/_core/SingleStreamDecoder.cpp +196 -201
- torchcodec/_core/SingleStreamDecoder.h +42 -15
- torchcodec/_core/StreamOptions.h +16 -6
- torchcodec/_core/Transform.cpp +87 -0
- torchcodec/_core/Transform.h +84 -0
- torchcodec/_core/__init__.py +4 -0
- torchcodec/_core/custom_ops.cpp +257 -32
- torchcodec/_core/fetch_and_expose_non_gpl_ffmpeg_libs.cmake +61 -1
- torchcodec/_core/nvcuvid_include/cuviddec.h +1374 -0
- torchcodec/_core/nvcuvid_include/nvcuvid.h +610 -0
- torchcodec/_core/ops.py +147 -44
- torchcodec/_core/pybind_ops.cpp +22 -59
- torchcodec/_samplers/video_clip_sampler.py +7 -19
- torchcodec/decoders/__init__.py +1 -0
- torchcodec/decoders/_decoder_utils.py +61 -1
- torchcodec/decoders/_video_decoder.py +46 -20
- torchcodec/libtorchcodec_core4.dll +0 -0
- torchcodec/libtorchcodec_core5.dll +0 -0
- torchcodec/libtorchcodec_core6.dll +0 -0
- torchcodec/libtorchcodec_core7.dll +0 -0
- torchcodec/libtorchcodec_core8.dll +0 -0
- torchcodec/libtorchcodec_custom_ops4.dll +0 -0
- torchcodec/libtorchcodec_custom_ops5.dll +0 -0
- torchcodec/libtorchcodec_custom_ops6.dll +0 -0
- torchcodec/libtorchcodec_custom_ops7.dll +0 -0
- torchcodec/libtorchcodec_custom_ops8.dll +0 -0
- torchcodec/libtorchcodec_pybind_ops4.pyd +0 -0
- torchcodec/libtorchcodec_pybind_ops5.pyd +0 -0
- torchcodec/libtorchcodec_pybind_ops6.pyd +0 -0
- torchcodec/libtorchcodec_pybind_ops7.pyd +0 -0
- torchcodec/libtorchcodec_pybind_ops8.pyd +0 -0
- torchcodec/samplers/_time_based.py +8 -0
- torchcodec/version.py +1 -1
- {torchcodec-0.7.0.dist-info → torchcodec-0.8.1.dist-info}/METADATA +29 -16
- torchcodec-0.8.1.dist-info/RECORD +82 -0
- {torchcodec-0.7.0.dist-info → torchcodec-0.8.1.dist-info}/WHEEL +1 -1
- torchcodec-0.7.0.dist-info/RECORD +0 -67
- {torchcodec-0.7.0.dist-info → torchcodec-0.8.1.dist-info}/licenses/LICENSE +0 -0
- {torchcodec-0.7.0.dist-info → torchcodec-0.8.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1374 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This copyright notice applies to this header file only:
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2010-2024 NVIDIA Corporation
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person
|
|
7
|
+
* obtaining a copy of this software and associated documentation
|
|
8
|
+
* files (the "Software"), to deal in the Software without
|
|
9
|
+
* restriction, including without limitation the rights to use,
|
|
10
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the software, and to permit persons to whom the
|
|
12
|
+
* software is furnished to do so, subject to the following
|
|
13
|
+
* conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/*****************************************************************************************************/
|
|
29
|
+
//! \file cuviddec.h
|
|
30
|
+
//! NVDECODE API provides video decoding interface to NVIDIA GPU devices.
|
|
31
|
+
//! This file contains constants, structure definitions and function prototypes
|
|
32
|
+
//! used for decoding.
|
|
33
|
+
/*****************************************************************************************************/
|
|
34
|
+
|
|
35
|
+
#if !defined(__CUDA_VIDEO_H__)
|
|
36
|
+
#define __CUDA_VIDEO_H__
|
|
37
|
+
|
|
38
|
+
#ifndef __cuda_cuda_h__
|
|
39
|
+
#include <cuda.h>
|
|
40
|
+
#endif // __cuda_cuda_h__
|
|
41
|
+
|
|
42
|
+
#if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || \
|
|
43
|
+
defined(AMD64) || defined(_M_AMD64)
|
|
44
|
+
#if (CUDA_VERSION >= 3020) && \
|
|
45
|
+
(!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020))
|
|
46
|
+
#define __CUVID_DEVPTR64
|
|
47
|
+
#endif
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#if defined(__cplusplus)
|
|
51
|
+
extern "C" {
|
|
52
|
+
#endif /* __cplusplus */
|
|
53
|
+
|
|
54
|
+
typedef void* CUvideodecoder;
|
|
55
|
+
typedef struct _CUcontextlock_st* CUvideoctxlock;
|
|
56
|
+
|
|
57
|
+
/*********************************************************************************/
|
|
58
|
+
//! \enum cudaVideoCodec
|
|
59
|
+
//! Video codec enums
|
|
60
|
+
//! These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures
|
|
61
|
+
/*********************************************************************************/
|
|
62
|
+
typedef enum cudaVideoCodec_enum {
|
|
63
|
+
cudaVideoCodec_MPEG1 = 0, /**< MPEG1 */
|
|
64
|
+
cudaVideoCodec_MPEG2, /**< MPEG2 */
|
|
65
|
+
cudaVideoCodec_MPEG4, /**< MPEG4 */
|
|
66
|
+
cudaVideoCodec_VC1, /**< VC1 */
|
|
67
|
+
cudaVideoCodec_H264, /**< H264 */
|
|
68
|
+
cudaVideoCodec_JPEG, /**< JPEG */
|
|
69
|
+
cudaVideoCodec_H264_SVC, /**< H264-SVC */
|
|
70
|
+
cudaVideoCodec_H264_MVC, /**< H264-MVC */
|
|
71
|
+
cudaVideoCodec_HEVC, /**< HEVC */
|
|
72
|
+
cudaVideoCodec_VP8, /**< VP8 */
|
|
73
|
+
cudaVideoCodec_VP9, /**< VP9 */
|
|
74
|
+
cudaVideoCodec_AV1, /**< AV1 */
|
|
75
|
+
cudaVideoCodec_NumCodecs, /**< Max codecs */
|
|
76
|
+
// Uncompressed YUV
|
|
77
|
+
cudaVideoCodec_YUV420 =
|
|
78
|
+
(('I' << 24) | ('Y' << 16) | ('U' << 8) | ('V')), /**< Y,U,V (4:2:0) */
|
|
79
|
+
cudaVideoCodec_YV12 =
|
|
80
|
+
(('Y' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,V,U (4:2:0) */
|
|
81
|
+
cudaVideoCodec_NV12 =
|
|
82
|
+
(('N' << 24) | ('V' << 16) | ('1' << 8) | ('2')), /**< Y,UV (4:2:0) */
|
|
83
|
+
cudaVideoCodec_YUYV =
|
|
84
|
+
(('Y' << 24) | ('U' << 16) | ('Y' << 8) |
|
|
85
|
+
('V')), /**< YUYV/YUY2 (4:2:2) */
|
|
86
|
+
cudaVideoCodec_UYVY =
|
|
87
|
+
(('U' << 24) | ('Y' << 16) | ('V' << 8) | ('Y')) /**< UYVY (4:2:2) */
|
|
88
|
+
} cudaVideoCodec;
|
|
89
|
+
|
|
90
|
+
/*********************************************************************************/
|
|
91
|
+
//! \enum cudaVideoSurfaceFormat
|
|
92
|
+
//! Video surface format enums used for output format of decoded output
|
|
93
|
+
//! These enums are used in CUVIDDECODECREATEINFO structure
|
|
94
|
+
/*********************************************************************************/
|
|
95
|
+
typedef enum cudaVideoSurfaceFormat_enum {
|
|
96
|
+
cudaVideoSurfaceFormat_NV12 =
|
|
97
|
+
0, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
|
|
98
|
+
cudaVideoSurfaceFormat_P016 =
|
|
99
|
+
1, /**< 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane].
|
|
100
|
+
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
|
|
101
|
+
cudaVideoSurfaceFormat_YUV444 =
|
|
102
|
+
2, /**< Planar YUV [Y plane followed by U and V planes] */
|
|
103
|
+
cudaVideoSurfaceFormat_YUV444_16Bit =
|
|
104
|
+
3, /**< 16 bit Planar YUV [Y plane followed by U and V planes].
|
|
105
|
+
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
|
|
106
|
+
} cudaVideoSurfaceFormat;
|
|
107
|
+
|
|
108
|
+
/******************************************************************************************************************/
|
|
109
|
+
//! \enum cudaVideoDeinterlaceMode
|
|
110
|
+
//! Deinterlacing mode enums
|
|
111
|
+
//! These enums are used in CUVIDDECODECREATEINFO structure
|
|
112
|
+
//! Use cudaVideoDeinterlaceMode_Weave for progressive content and for content
|
|
113
|
+
//! that doesn't need deinterlacing cudaVideoDeinterlaceMode_Adaptive needs more
|
|
114
|
+
//! video memory than other DImodes
|
|
115
|
+
/******************************************************************************************************************/
|
|
116
|
+
typedef enum cudaVideoDeinterlaceMode_enum {
|
|
117
|
+
cudaVideoDeinterlaceMode_Weave =
|
|
118
|
+
0, /**< Weave both fields (no deinterlacing) */
|
|
119
|
+
cudaVideoDeinterlaceMode_Bob, /**< Drop one field */
|
|
120
|
+
cudaVideoDeinterlaceMode_Adaptive /**< Adaptive deinterlacing */
|
|
121
|
+
} cudaVideoDeinterlaceMode;
|
|
122
|
+
|
|
123
|
+
/**************************************************************************************************************/
|
|
124
|
+
//! \enum cudaVideoChromaFormat
|
|
125
|
+
//! Chroma format enums
|
|
126
|
+
//! These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures
|
|
127
|
+
/**************************************************************************************************************/
|
|
128
|
+
typedef enum cudaVideoChromaFormat_enum {
|
|
129
|
+
cudaVideoChromaFormat_Monochrome = 0, /**< MonoChrome */
|
|
130
|
+
cudaVideoChromaFormat_420, /**< YUV 4:2:0 */
|
|
131
|
+
cudaVideoChromaFormat_422, /**< YUV 4:2:2 */
|
|
132
|
+
cudaVideoChromaFormat_444 /**< YUV 4:4:4 */
|
|
133
|
+
} cudaVideoChromaFormat;
|
|
134
|
+
|
|
135
|
+
/*************************************************************************************************************/
|
|
136
|
+
//! \enum cudaVideoCreateFlags
|
|
137
|
+
//! Decoder flag enums to select preferred decode path
|
|
138
|
+
//! cudaVideoCreate_Default and cudaVideoCreate_PreferCUVID are most optimized,
|
|
139
|
+
//! use these whenever possible
|
|
140
|
+
/*************************************************************************************************************/
|
|
141
|
+
typedef enum cudaVideoCreateFlags_enum {
|
|
142
|
+
cudaVideoCreate_Default =
|
|
143
|
+
0x00, /**< Default operation mode: use dedicated video engines */
|
|
144
|
+
cudaVideoCreate_PreferCUDA = 0x01, /**< Use CUDA-based decoder (requires valid
|
|
145
|
+
vidLock object for multi-threading) */
|
|
146
|
+
cudaVideoCreate_PreferDXVA = 0x02, /**< Go through DXVA internally if possible
|
|
147
|
+
(requires D3D9 interop) */
|
|
148
|
+
cudaVideoCreate_PreferCUVID =
|
|
149
|
+
0x04 /**< Use dedicated video engines directly */
|
|
150
|
+
} cudaVideoCreateFlags;
|
|
151
|
+
|
|
152
|
+
/*************************************************************************/
|
|
153
|
+
//! \enum cuvidDecodeStatus
|
|
154
|
+
//! Decode status enums
|
|
155
|
+
//! These enums are used in CUVIDGETDECODESTATUS structure
|
|
156
|
+
/*************************************************************************/
|
|
157
|
+
typedef enum cuvidDecodeStatus_enum {
|
|
158
|
+
cuvidDecodeStatus_Invalid = 0, // Decode status is not valid
|
|
159
|
+
cuvidDecodeStatus_InProgress = 1, // Decode is in progress
|
|
160
|
+
cuvidDecodeStatus_Success = 2, // Decode is completed without any errors
|
|
161
|
+
// 3 to 7 enums are reserved for future use
|
|
162
|
+
cuvidDecodeStatus_Error =
|
|
163
|
+
8, // Decode is completed with an error (error is not concealed)
|
|
164
|
+
cuvidDecodeStatus_Error_Concealed =
|
|
165
|
+
9, // Decode is completed with an error and error is concealed
|
|
166
|
+
} cuvidDecodeStatus;
|
|
167
|
+
|
|
168
|
+
/**************************************************************************************************************/
|
|
169
|
+
//! \struct CUVIDDECODECAPS;
|
|
170
|
+
//! This structure is used in cuvidGetDecoderCaps API
|
|
171
|
+
/**************************************************************************************************************/
|
|
172
|
+
typedef struct _CUVIDDECODECAPS {
|
|
173
|
+
cudaVideoCodec eCodecType; /**< IN: cudaVideoCodec_XXX */
|
|
174
|
+
cudaVideoChromaFormat eChromaFormat; /**< IN: cudaVideoChromaFormat_XXX */
|
|
175
|
+
unsigned int nBitDepthMinus8; /**< IN: The Value "BitDepth minus 8" */
|
|
176
|
+
unsigned int reserved1[3]; /**< Reserved for future use - set to zero */
|
|
177
|
+
|
|
178
|
+
unsigned char
|
|
179
|
+
bIsSupported; /**< OUT: 1 if codec supported, 0 if not supported */
|
|
180
|
+
unsigned char
|
|
181
|
+
nNumNVDECs; /**< OUT: Number of NVDECs that can support IN params */
|
|
182
|
+
unsigned short nOutputFormatMask; /**< OUT: each bit represents corresponding
|
|
183
|
+
cudaVideoSurfaceFormat enum */
|
|
184
|
+
unsigned int nMaxWidth; /**< OUT: Max supported coded width in pixels */
|
|
185
|
+
unsigned int nMaxHeight; /**< OUT: Max supported coded height in pixels */
|
|
186
|
+
unsigned int nMaxMBCount; /**< OUT: Max supported macroblock count
|
|
187
|
+
CodedWidth*CodedHeight/256 must be <=
|
|
188
|
+
nMaxMBCount */
|
|
189
|
+
unsigned short nMinWidth; /**< OUT: Min supported coded width in pixels */
|
|
190
|
+
unsigned short nMinHeight; /**< OUT: Min supported coded height in pixels */
|
|
191
|
+
unsigned char
|
|
192
|
+
bIsHistogramSupported; /**< OUT: 1 if Y component histogram output is
|
|
193
|
+
supported, 0 if not Note: histogram is computed
|
|
194
|
+
on original picture data before any
|
|
195
|
+
post-processing like scaling, cropping, etc. is
|
|
196
|
+
applied */
|
|
197
|
+
unsigned char nCounterBitDepth; /**< OUT: histogram counter bit depth */
|
|
198
|
+
unsigned short nMaxHistogramBins; /**< OUT: Max number of histogram bins */
|
|
199
|
+
unsigned int reserved3[10]; /**< Reserved for future use - set to zero */
|
|
200
|
+
} CUVIDDECODECAPS;
|
|
201
|
+
|
|
202
|
+
/**************************************************************************************************************/
|
|
203
|
+
//! \struct CUVIDDECODECREATEINFO
|
|
204
|
+
//! This structure is used in cuvidCreateDecoder API
|
|
205
|
+
/**************************************************************************************************************/
|
|
206
|
+
typedef struct _CUVIDDECODECREATEINFO {
|
|
207
|
+
unsigned long ulWidth; /**< IN: Coded sequence width in pixels */
|
|
208
|
+
unsigned long ulHeight; /**< IN: Coded sequence height in pixels */
|
|
209
|
+
unsigned long ulNumDecodeSurfaces; /**< IN: Maximum number of internal decode
|
|
210
|
+
surfaces */
|
|
211
|
+
cudaVideoCodec CodecType; /**< IN: cudaVideoCodec_XXX */
|
|
212
|
+
cudaVideoChromaFormat ChromaFormat; /**< IN: cudaVideoChromaFormat_XXX */
|
|
213
|
+
unsigned long ulCreationFlags; /**< IN: Decoder creation flags
|
|
214
|
+
(cudaVideoCreateFlags_XXX) */
|
|
215
|
+
unsigned long bitDepthMinus8; /**< IN: The value "BitDepth minus 8" */
|
|
216
|
+
unsigned long
|
|
217
|
+
ulIntraDecodeOnly; /**< IN: Set 1 only if video has all intra frames
|
|
218
|
+
(default value is 0). This will optimize video
|
|
219
|
+
memory for Intra frames only decoding. The support
|
|
220
|
+
is limited to specific codecs - H264, HEVC, VP9, the
|
|
221
|
+
flag will be ignored for codecs which are not
|
|
222
|
+
supported. However decoding might fail if the flag
|
|
223
|
+
is enabled in case of supported codecs for regular
|
|
224
|
+
bit streams having P and/or B frames. */
|
|
225
|
+
unsigned long ulMaxWidth; /**< IN: Coded sequence max width in pixels used
|
|
226
|
+
with reconfigure Decoder */
|
|
227
|
+
unsigned long ulMaxHeight; /**< IN: Coded sequence max height in pixels used
|
|
228
|
+
with reconfigure Decoder */
|
|
229
|
+
unsigned long Reserved1; /**< Reserved for future use - set to zero */
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* IN: area of the frame that should be displayed
|
|
233
|
+
*/
|
|
234
|
+
struct {
|
|
235
|
+
short left;
|
|
236
|
+
short top;
|
|
237
|
+
short right;
|
|
238
|
+
short bottom;
|
|
239
|
+
} display_area;
|
|
240
|
+
|
|
241
|
+
cudaVideoSurfaceFormat OutputFormat; /**< IN: cudaVideoSurfaceFormat_XXX */
|
|
242
|
+
cudaVideoDeinterlaceMode
|
|
243
|
+
DeinterlaceMode; /**< IN: cudaVideoDeinterlaceMode_XXX */
|
|
244
|
+
unsigned long ulTargetWidth; /**< IN: Post-processed output width (Should be
|
|
245
|
+
aligned to 2) */
|
|
246
|
+
unsigned long ulTargetHeight; /**< IN: Post-processed output height (Should be
|
|
247
|
+
aligned to 2) */
|
|
248
|
+
unsigned long ulNumOutputSurfaces; /**< IN: Maximum number of output surfaces
|
|
249
|
+
simultaneously mapped */
|
|
250
|
+
CUvideoctxlock vidLock; /**< IN: If non-NULL, context lock used for
|
|
251
|
+
synchronizing ownership of the cuda context. Needed
|
|
252
|
+
for cudaVideoCreate_PreferCUDA decode */
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* IN: target rectangle in the output frame (for aspect ratio conversion)
|
|
256
|
+
* if a null rectangle is specified, {0,0,ulTargetWidth,ulTargetHeight} will
|
|
257
|
+
* be used
|
|
258
|
+
*/
|
|
259
|
+
struct {
|
|
260
|
+
short left;
|
|
261
|
+
short top;
|
|
262
|
+
short right;
|
|
263
|
+
short bottom;
|
|
264
|
+
} target_rect;
|
|
265
|
+
|
|
266
|
+
unsigned long
|
|
267
|
+
enableHistogram; /**< IN: enable histogram output, if supported */
|
|
268
|
+
unsigned long Reserved2[4]; /**< Reserved for future use - set to zero */
|
|
269
|
+
} CUVIDDECODECREATEINFO;
|
|
270
|
+
|
|
271
|
+
/*********************************************************/
|
|
272
|
+
//! \struct CUVIDH264DPBENTRY
|
|
273
|
+
//! H.264 DPB entry
|
|
274
|
+
//! This structure is used in CUVIDH264PICPARAMS structure
|
|
275
|
+
/*********************************************************/
|
|
276
|
+
typedef struct _CUVIDH264DPBENTRY {
|
|
277
|
+
int PicIdx; /**< picture index of reference frame */
|
|
278
|
+
int FrameIdx; /**< frame_num(short-term) or LongTermFrameIdx(long-term) */
|
|
279
|
+
int is_long_term; /**< 0=short term reference, 1=long term reference */
|
|
280
|
+
int not_existing; /**< non-existing reference frame (corresponding PicIdx
|
|
281
|
+
should be set to -1) */
|
|
282
|
+
int used_for_reference; /**< 0=unused, 1=top_field, 2=bottom_field,
|
|
283
|
+
3=both_fields */
|
|
284
|
+
int FieldOrderCnt[2]; /**< field order count of top and bottom fields */
|
|
285
|
+
} CUVIDH264DPBENTRY;
|
|
286
|
+
|
|
287
|
+
/************************************************************/
|
|
288
|
+
//! \struct CUVIDH264MVCEXT
|
|
289
|
+
//! H.264 MVC picture parameters ext
|
|
290
|
+
//! This structure is used in CUVIDH264PICPARAMS structure
|
|
291
|
+
/************************************************************/
|
|
292
|
+
typedef struct _CUVIDH264MVCEXT {
|
|
293
|
+
int num_views_minus1; /**< Max number of coded views minus 1 in video : Range
|
|
294
|
+
- 0 to 1023 */
|
|
295
|
+
int view_id; /**< view identifier */
|
|
296
|
+
unsigned char
|
|
297
|
+
inter_view_flag; /**< 1 if used for inter-view prediction, 0 if not */
|
|
298
|
+
unsigned char num_inter_view_refs_l0; /**< number of inter-view ref pics in
|
|
299
|
+
RefPicList0 */
|
|
300
|
+
unsigned char num_inter_view_refs_l1; /**< number of inter-view ref pics in
|
|
301
|
+
RefPicList1 */
|
|
302
|
+
unsigned char MVCReserved8Bits; /**< Reserved bits */
|
|
303
|
+
int InterViewRefsL0[16]; /**< view id of the i-th view component for
|
|
304
|
+
inter-view prediction in RefPicList0 */
|
|
305
|
+
int InterViewRefsL1[16]; /**< view id of the i-th view component for
|
|
306
|
+
inter-view prediction in RefPicList1 */
|
|
307
|
+
} CUVIDH264MVCEXT;
|
|
308
|
+
|
|
309
|
+
/*********************************************************/
|
|
310
|
+
//! \struct CUVIDH264SVCEXT
|
|
311
|
+
//! H.264 SVC picture parameters ext
|
|
312
|
+
//! This structure is used in CUVIDH264PICPARAMS structure
|
|
313
|
+
/*********************************************************/
|
|
314
|
+
typedef struct _CUVIDH264SVCEXT {
|
|
315
|
+
unsigned char profile_idc;
|
|
316
|
+
unsigned char level_idc;
|
|
317
|
+
unsigned char DQId;
|
|
318
|
+
unsigned char DQIdMax;
|
|
319
|
+
unsigned char disable_inter_layer_deblocking_filter_idc;
|
|
320
|
+
unsigned char ref_layer_chroma_phase_y_plus1;
|
|
321
|
+
signed char inter_layer_slice_alpha_c0_offset_div2;
|
|
322
|
+
signed char inter_layer_slice_beta_offset_div2;
|
|
323
|
+
|
|
324
|
+
unsigned short DPBEntryValidFlag;
|
|
325
|
+
unsigned char inter_layer_deblocking_filter_control_present_flag;
|
|
326
|
+
unsigned char extended_spatial_scalability_idc;
|
|
327
|
+
unsigned char adaptive_tcoeff_level_prediction_flag;
|
|
328
|
+
unsigned char slice_header_restriction_flag;
|
|
329
|
+
unsigned char chroma_phase_x_plus1_flag;
|
|
330
|
+
unsigned char chroma_phase_y_plus1;
|
|
331
|
+
|
|
332
|
+
unsigned char tcoeff_level_prediction_flag;
|
|
333
|
+
unsigned char constrained_intra_resampling_flag;
|
|
334
|
+
unsigned char ref_layer_chroma_phase_x_plus1_flag;
|
|
335
|
+
unsigned char store_ref_base_pic_flag;
|
|
336
|
+
unsigned char Reserved8BitsA;
|
|
337
|
+
unsigned char Reserved8BitsB;
|
|
338
|
+
|
|
339
|
+
short scaled_ref_layer_left_offset;
|
|
340
|
+
short scaled_ref_layer_top_offset;
|
|
341
|
+
short scaled_ref_layer_right_offset;
|
|
342
|
+
short scaled_ref_layer_bottom_offset;
|
|
343
|
+
unsigned short Reserved16Bits;
|
|
344
|
+
struct _CUVIDPICPARAMS*
|
|
345
|
+
pNextLayer; /**< Points to the picparams for the next layer to be decoded.
|
|
346
|
+
Linked list ends at the target layer. */
|
|
347
|
+
int bRefBaseLayer; /**< whether to store ref base pic */
|
|
348
|
+
} CUVIDH264SVCEXT;
|
|
349
|
+
|
|
350
|
+
/******************************************************/
|
|
351
|
+
//! \struct CUVIDH264PICPARAMS
|
|
352
|
+
//! H.264 picture parameters
|
|
353
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
354
|
+
/******************************************************/
|
|
355
|
+
typedef struct _CUVIDH264PICPARAMS {
|
|
356
|
+
// SPS
|
|
357
|
+
int log2_max_frame_num_minus4;
|
|
358
|
+
int pic_order_cnt_type;
|
|
359
|
+
int log2_max_pic_order_cnt_lsb_minus4;
|
|
360
|
+
int delta_pic_order_always_zero_flag;
|
|
361
|
+
int frame_mbs_only_flag;
|
|
362
|
+
int direct_8x8_inference_flag;
|
|
363
|
+
int num_ref_frames; // NOTE: shall meet level 4.1 restrictions
|
|
364
|
+
unsigned char residual_colour_transform_flag;
|
|
365
|
+
unsigned char bit_depth_luma_minus8; // Must be 0 (only 8-bit supported)
|
|
366
|
+
unsigned char bit_depth_chroma_minus8; // Must be 0 (only 8-bit supported)
|
|
367
|
+
unsigned char qpprime_y_zero_transform_bypass_flag;
|
|
368
|
+
// PPS
|
|
369
|
+
int entropy_coding_mode_flag;
|
|
370
|
+
int pic_order_present_flag;
|
|
371
|
+
int num_ref_idx_l0_active_minus1;
|
|
372
|
+
int num_ref_idx_l1_active_minus1;
|
|
373
|
+
int weighted_pred_flag;
|
|
374
|
+
int weighted_bipred_idc;
|
|
375
|
+
int pic_init_qp_minus26;
|
|
376
|
+
int deblocking_filter_control_present_flag;
|
|
377
|
+
int redundant_pic_cnt_present_flag;
|
|
378
|
+
int transform_8x8_mode_flag;
|
|
379
|
+
int MbaffFrameFlag;
|
|
380
|
+
int constrained_intra_pred_flag;
|
|
381
|
+
int chroma_qp_index_offset;
|
|
382
|
+
int second_chroma_qp_index_offset;
|
|
383
|
+
int ref_pic_flag;
|
|
384
|
+
int frame_num;
|
|
385
|
+
int CurrFieldOrderCnt[2];
|
|
386
|
+
// DPB
|
|
387
|
+
CUVIDH264DPBENTRY dpb[16]; // List of reference frames within the DPB
|
|
388
|
+
// Quantization Matrices (raster-order)
|
|
389
|
+
unsigned char WeightScale4x4[6][16];
|
|
390
|
+
unsigned char WeightScale8x8[2][64];
|
|
391
|
+
// FMO/ASO
|
|
392
|
+
unsigned char fmo_aso_enable;
|
|
393
|
+
unsigned char num_slice_groups_minus1;
|
|
394
|
+
unsigned char slice_group_map_type;
|
|
395
|
+
signed char pic_init_qs_minus26;
|
|
396
|
+
unsigned int slice_group_change_rate_minus1;
|
|
397
|
+
|
|
398
|
+
union {
|
|
399
|
+
unsigned long long slice_group_map_addr;
|
|
400
|
+
const unsigned char* pMb2SliceGroupMap;
|
|
401
|
+
} fmo;
|
|
402
|
+
|
|
403
|
+
unsigned int Reserved[12];
|
|
404
|
+
|
|
405
|
+
// SVC/MVC
|
|
406
|
+
union {
|
|
407
|
+
CUVIDH264MVCEXT mvcext;
|
|
408
|
+
CUVIDH264SVCEXT svcext;
|
|
409
|
+
};
|
|
410
|
+
} CUVIDH264PICPARAMS;
|
|
411
|
+
|
|
412
|
+
/********************************************************/
|
|
413
|
+
//! \struct CUVIDMPEG2PICPARAMS
|
|
414
|
+
//! MPEG-2 picture parameters
|
|
415
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
416
|
+
/********************************************************/
|
|
417
|
+
typedef struct _CUVIDMPEG2PICPARAMS {
|
|
418
|
+
int ForwardRefIdx; // Picture index of forward reference (P/B-frames)
|
|
419
|
+
int BackwardRefIdx; // Picture index of backward reference (B-frames)
|
|
420
|
+
int picture_coding_type;
|
|
421
|
+
int full_pel_forward_vector;
|
|
422
|
+
int full_pel_backward_vector;
|
|
423
|
+
int f_code[2][2];
|
|
424
|
+
int intra_dc_precision;
|
|
425
|
+
int frame_pred_frame_dct;
|
|
426
|
+
int concealment_motion_vectors;
|
|
427
|
+
int q_scale_type;
|
|
428
|
+
int intra_vlc_format;
|
|
429
|
+
int alternate_scan;
|
|
430
|
+
int top_field_first;
|
|
431
|
+
// Quantization matrices (raster order)
|
|
432
|
+
unsigned char QuantMatrixIntra[64];
|
|
433
|
+
unsigned char QuantMatrixInter[64];
|
|
434
|
+
} CUVIDMPEG2PICPARAMS;
|
|
435
|
+
|
|
436
|
+
// MPEG-4 has VOP types instead of Picture types
|
|
437
|
+
#define I_VOP 0
|
|
438
|
+
#define P_VOP 1
|
|
439
|
+
#define B_VOP 2
|
|
440
|
+
#define S_VOP 3
|
|
441
|
+
|
|
442
|
+
/*******************************************************/
|
|
443
|
+
//! \struct CUVIDMPEG4PICPARAMS
|
|
444
|
+
//! MPEG-4 picture parameters
|
|
445
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
446
|
+
/*******************************************************/
|
|
447
|
+
typedef struct _CUVIDMPEG4PICPARAMS {
|
|
448
|
+
int ForwardRefIdx; // Picture index of forward reference (P/B-frames)
|
|
449
|
+
int BackwardRefIdx; // Picture index of backward reference (B-frames)
|
|
450
|
+
// VOL
|
|
451
|
+
int video_object_layer_width;
|
|
452
|
+
int video_object_layer_height;
|
|
453
|
+
int vop_time_increment_bitcount;
|
|
454
|
+
int top_field_first;
|
|
455
|
+
int resync_marker_disable;
|
|
456
|
+
int quant_type;
|
|
457
|
+
int quarter_sample;
|
|
458
|
+
int short_video_header;
|
|
459
|
+
int divx_flags;
|
|
460
|
+
// VOP
|
|
461
|
+
int vop_coding_type;
|
|
462
|
+
int vop_coded;
|
|
463
|
+
int vop_rounding_type;
|
|
464
|
+
int alternate_vertical_scan_flag;
|
|
465
|
+
int interlaced;
|
|
466
|
+
int vop_fcode_forward;
|
|
467
|
+
int vop_fcode_backward;
|
|
468
|
+
int trd[2];
|
|
469
|
+
int trb[2];
|
|
470
|
+
// Quantization matrices (raster order)
|
|
471
|
+
unsigned char QuantMatrixIntra[64];
|
|
472
|
+
unsigned char QuantMatrixInter[64];
|
|
473
|
+
int gmc_enabled;
|
|
474
|
+
} CUVIDMPEG4PICPARAMS;
|
|
475
|
+
|
|
476
|
+
/********************************************************/
|
|
477
|
+
//! \struct CUVIDVC1PICPARAMS
|
|
478
|
+
//! VC1 picture parameters
|
|
479
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
480
|
+
/********************************************************/
|
|
481
|
+
typedef struct _CUVIDVC1PICPARAMS {
|
|
482
|
+
int ForwardRefIdx; /**< Picture index of forward reference (P/B-frames) */
|
|
483
|
+
int BackwardRefIdx; /**< Picture index of backward reference (B-frames) */
|
|
484
|
+
int FrameWidth; /**< Actual frame width */
|
|
485
|
+
int FrameHeight; /**< Actual frame height */
|
|
486
|
+
// PICTURE
|
|
487
|
+
int intra_pic_flag; /**< Set to 1 for I,BI frames */
|
|
488
|
+
int ref_pic_flag; /**< Set to 1 for I,P frames */
|
|
489
|
+
int progressive_fcm; /**< Progressive frame */
|
|
490
|
+
// SEQUENCE
|
|
491
|
+
int profile;
|
|
492
|
+
int postprocflag;
|
|
493
|
+
int pulldown;
|
|
494
|
+
int interlace;
|
|
495
|
+
int tfcntrflag;
|
|
496
|
+
int finterpflag;
|
|
497
|
+
int psf;
|
|
498
|
+
int multires;
|
|
499
|
+
int syncmarker;
|
|
500
|
+
int rangered;
|
|
501
|
+
int maxbframes;
|
|
502
|
+
// ENTRYPOINT
|
|
503
|
+
int panscan_flag;
|
|
504
|
+
int refdist_flag;
|
|
505
|
+
int extended_mv;
|
|
506
|
+
int dquant;
|
|
507
|
+
int vstransform;
|
|
508
|
+
int loopfilter;
|
|
509
|
+
int fastuvmc;
|
|
510
|
+
int overlap;
|
|
511
|
+
int quantizer;
|
|
512
|
+
int extended_dmv;
|
|
513
|
+
int range_mapy_flag;
|
|
514
|
+
int range_mapy;
|
|
515
|
+
int range_mapuv_flag;
|
|
516
|
+
int range_mapuv;
|
|
517
|
+
int rangeredfrm; // range reduction state
|
|
518
|
+
} CUVIDVC1PICPARAMS;
|
|
519
|
+
|
|
520
|
+
/***********************************************************/
|
|
521
|
+
//! \struct CUVIDJPEGPICPARAMS
|
|
522
|
+
//! JPEG picture parameters
|
|
523
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
524
|
+
/***********************************************************/
|
|
525
|
+
typedef struct _CUVIDJPEGPICPARAMS {
|
|
526
|
+
int Reserved;
|
|
527
|
+
} CUVIDJPEGPICPARAMS;
|
|
528
|
+
|
|
529
|
+
/*******************************************************/
|
|
530
|
+
//! \struct CUVIDHEVCPICPARAMS
|
|
531
|
+
//! HEVC picture parameters
|
|
532
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
533
|
+
/*******************************************************/
|
|
534
|
+
typedef struct _CUVIDHEVCPICPARAMS {
|
|
535
|
+
// sps
|
|
536
|
+
int pic_width_in_luma_samples;
|
|
537
|
+
int pic_height_in_luma_samples;
|
|
538
|
+
unsigned char log2_min_luma_coding_block_size_minus3;
|
|
539
|
+
unsigned char log2_diff_max_min_luma_coding_block_size;
|
|
540
|
+
unsigned char log2_min_transform_block_size_minus2;
|
|
541
|
+
unsigned char log2_diff_max_min_transform_block_size;
|
|
542
|
+
unsigned char pcm_enabled_flag;
|
|
543
|
+
unsigned char log2_min_pcm_luma_coding_block_size_minus3;
|
|
544
|
+
unsigned char log2_diff_max_min_pcm_luma_coding_block_size;
|
|
545
|
+
unsigned char pcm_sample_bit_depth_luma_minus1;
|
|
546
|
+
|
|
547
|
+
unsigned char pcm_sample_bit_depth_chroma_minus1;
|
|
548
|
+
unsigned char pcm_loop_filter_disabled_flag;
|
|
549
|
+
unsigned char strong_intra_smoothing_enabled_flag;
|
|
550
|
+
unsigned char max_transform_hierarchy_depth_intra;
|
|
551
|
+
unsigned char max_transform_hierarchy_depth_inter;
|
|
552
|
+
unsigned char amp_enabled_flag;
|
|
553
|
+
unsigned char separate_colour_plane_flag;
|
|
554
|
+
unsigned char log2_max_pic_order_cnt_lsb_minus4;
|
|
555
|
+
|
|
556
|
+
unsigned char num_short_term_ref_pic_sets;
|
|
557
|
+
unsigned char long_term_ref_pics_present_flag;
|
|
558
|
+
unsigned char num_long_term_ref_pics_sps;
|
|
559
|
+
unsigned char sps_temporal_mvp_enabled_flag;
|
|
560
|
+
unsigned char sample_adaptive_offset_enabled_flag;
|
|
561
|
+
unsigned char scaling_list_enable_flag;
|
|
562
|
+
unsigned char IrapPicFlag;
|
|
563
|
+
unsigned char IdrPicFlag;
|
|
564
|
+
|
|
565
|
+
unsigned char bit_depth_luma_minus8;
|
|
566
|
+
unsigned char bit_depth_chroma_minus8;
|
|
567
|
+
// sps/pps extension fields
|
|
568
|
+
unsigned char log2_max_transform_skip_block_size_minus2;
|
|
569
|
+
unsigned char log2_sao_offset_scale_luma;
|
|
570
|
+
unsigned char log2_sao_offset_scale_chroma;
|
|
571
|
+
unsigned char high_precision_offsets_enabled_flag;
|
|
572
|
+
unsigned char reserved1[10];
|
|
573
|
+
|
|
574
|
+
// pps
|
|
575
|
+
unsigned char dependent_slice_segments_enabled_flag;
|
|
576
|
+
unsigned char slice_segment_header_extension_present_flag;
|
|
577
|
+
unsigned char sign_data_hiding_enabled_flag;
|
|
578
|
+
unsigned char cu_qp_delta_enabled_flag;
|
|
579
|
+
unsigned char diff_cu_qp_delta_depth;
|
|
580
|
+
signed char init_qp_minus26;
|
|
581
|
+
signed char pps_cb_qp_offset;
|
|
582
|
+
signed char pps_cr_qp_offset;
|
|
583
|
+
|
|
584
|
+
unsigned char constrained_intra_pred_flag;
|
|
585
|
+
unsigned char weighted_pred_flag;
|
|
586
|
+
unsigned char weighted_bipred_flag;
|
|
587
|
+
unsigned char transform_skip_enabled_flag;
|
|
588
|
+
unsigned char transquant_bypass_enabled_flag;
|
|
589
|
+
unsigned char entropy_coding_sync_enabled_flag;
|
|
590
|
+
unsigned char log2_parallel_merge_level_minus2;
|
|
591
|
+
unsigned char num_extra_slice_header_bits;
|
|
592
|
+
|
|
593
|
+
unsigned char loop_filter_across_tiles_enabled_flag;
|
|
594
|
+
unsigned char loop_filter_across_slices_enabled_flag;
|
|
595
|
+
unsigned char output_flag_present_flag;
|
|
596
|
+
unsigned char num_ref_idx_l0_default_active_minus1;
|
|
597
|
+
unsigned char num_ref_idx_l1_default_active_minus1;
|
|
598
|
+
unsigned char lists_modification_present_flag;
|
|
599
|
+
unsigned char cabac_init_present_flag;
|
|
600
|
+
unsigned char pps_slice_chroma_qp_offsets_present_flag;
|
|
601
|
+
|
|
602
|
+
unsigned char deblocking_filter_override_enabled_flag;
|
|
603
|
+
unsigned char pps_deblocking_filter_disabled_flag;
|
|
604
|
+
signed char pps_beta_offset_div2;
|
|
605
|
+
signed char pps_tc_offset_div2;
|
|
606
|
+
unsigned char tiles_enabled_flag;
|
|
607
|
+
unsigned char uniform_spacing_flag;
|
|
608
|
+
unsigned char num_tile_columns_minus1;
|
|
609
|
+
unsigned char num_tile_rows_minus1;
|
|
610
|
+
|
|
611
|
+
unsigned short column_width_minus1[21];
|
|
612
|
+
unsigned short row_height_minus1[21];
|
|
613
|
+
|
|
614
|
+
// sps and pps extension HEVC-main 444
|
|
615
|
+
unsigned char sps_range_extension_flag;
|
|
616
|
+
unsigned char transform_skip_rotation_enabled_flag;
|
|
617
|
+
unsigned char transform_skip_context_enabled_flag;
|
|
618
|
+
unsigned char implicit_rdpcm_enabled_flag;
|
|
619
|
+
|
|
620
|
+
unsigned char explicit_rdpcm_enabled_flag;
|
|
621
|
+
unsigned char extended_precision_processing_flag;
|
|
622
|
+
unsigned char intra_smoothing_disabled_flag;
|
|
623
|
+
unsigned char persistent_rice_adaptation_enabled_flag;
|
|
624
|
+
|
|
625
|
+
unsigned char cabac_bypass_alignment_enabled_flag;
|
|
626
|
+
unsigned char pps_range_extension_flag;
|
|
627
|
+
unsigned char cross_component_prediction_enabled_flag;
|
|
628
|
+
unsigned char chroma_qp_offset_list_enabled_flag;
|
|
629
|
+
|
|
630
|
+
unsigned char diff_cu_chroma_qp_offset_depth;
|
|
631
|
+
unsigned char chroma_qp_offset_list_len_minus1;
|
|
632
|
+
signed char cb_qp_offset_list[6];
|
|
633
|
+
|
|
634
|
+
signed char cr_qp_offset_list[6];
|
|
635
|
+
unsigned char reserved2[2];
|
|
636
|
+
|
|
637
|
+
unsigned int reserved3[8];
|
|
638
|
+
|
|
639
|
+
// RefPicSets
|
|
640
|
+
int NumBitsForShortTermRPSInSlice;
|
|
641
|
+
int NumDeltaPocsOfRefRpsIdx;
|
|
642
|
+
int NumPocTotalCurr;
|
|
643
|
+
int NumPocStCurrBefore;
|
|
644
|
+
int NumPocStCurrAfter;
|
|
645
|
+
int NumPocLtCurr;
|
|
646
|
+
int CurrPicOrderCntVal;
|
|
647
|
+
int RefPicIdx[16]; // [refpic] Indices of valid reference pictures (-1 if
|
|
648
|
+
// unused for reference)
|
|
649
|
+
int PicOrderCntVal[16]; // [refpic]
|
|
650
|
+
unsigned char IsLongTerm[16]; // [refpic] 0=not a long-term reference,
|
|
651
|
+
// 1=long-term reference
|
|
652
|
+
unsigned char
|
|
653
|
+
RefPicSetStCurrBefore[8]; // [0..NumPocStCurrBefore-1] -> refpic (0..15)
|
|
654
|
+
unsigned char
|
|
655
|
+
RefPicSetStCurrAfter[8]; // [0..NumPocStCurrAfter-1] -> refpic (0..15)
|
|
656
|
+
unsigned char RefPicSetLtCurr[8]; // [0..NumPocLtCurr-1] -> refpic (0..15)
|
|
657
|
+
unsigned char RefPicSetInterLayer0[8];
|
|
658
|
+
unsigned char RefPicSetInterLayer1[8];
|
|
659
|
+
unsigned int reserved4[12];
|
|
660
|
+
|
|
661
|
+
// scaling lists (diag order)
|
|
662
|
+
unsigned char ScalingList4x4[6][16]; // [matrixId][i]
|
|
663
|
+
unsigned char ScalingList8x8[6][64]; // [matrixId][i]
|
|
664
|
+
unsigned char ScalingList16x16[6][64]; // [matrixId][i]
|
|
665
|
+
unsigned char ScalingList32x32[2][64]; // [matrixId][i]
|
|
666
|
+
unsigned char ScalingListDCCoeff16x16[6]; // [matrixId]
|
|
667
|
+
unsigned char ScalingListDCCoeff32x32[2]; // [matrixId]
|
|
668
|
+
} CUVIDHEVCPICPARAMS;
|
|
669
|
+
|
|
670
|
+
/***********************************************************/
|
|
671
|
+
//! \struct CUVIDVP8PICPARAMS
|
|
672
|
+
//! VP8 picture parameters
|
|
673
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
674
|
+
/***********************************************************/
|
|
675
|
+
typedef struct _CUVIDVP8PICPARAMS {
|
|
676
|
+
int width;
|
|
677
|
+
int height;
|
|
678
|
+
unsigned int first_partition_size;
|
|
679
|
+
// Frame Indexes
|
|
680
|
+
unsigned char LastRefIdx;
|
|
681
|
+
unsigned char GoldenRefIdx;
|
|
682
|
+
unsigned char AltRefIdx;
|
|
683
|
+
|
|
684
|
+
union {
|
|
685
|
+
struct {
|
|
686
|
+
unsigned char frame_type : 1; /**< 0 = KEYFRAME, 1 = INTERFRAME */
|
|
687
|
+
unsigned char version : 3;
|
|
688
|
+
unsigned char show_frame : 1;
|
|
689
|
+
unsigned char
|
|
690
|
+
update_mb_segmentation_data : 1; /**< Must be 0 if segmentation is not
|
|
691
|
+
enabled */
|
|
692
|
+
unsigned char Reserved2Bits : 2;
|
|
693
|
+
} vp8_frame_tag;
|
|
694
|
+
|
|
695
|
+
unsigned char wFrameTagFlags;
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
unsigned char Reserved1[4];
|
|
699
|
+
unsigned int Reserved2[3];
|
|
700
|
+
} CUVIDVP8PICPARAMS;
|
|
701
|
+
|
|
702
|
+
/***********************************************************/
|
|
703
|
+
//! \struct CUVIDVP9PICPARAMS
|
|
704
|
+
//! VP9 picture parameters
|
|
705
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
706
|
+
/***********************************************************/
|
|
707
|
+
typedef struct _CUVIDVP9PICPARAMS {
|
|
708
|
+
unsigned int width;
|
|
709
|
+
unsigned int height;
|
|
710
|
+
|
|
711
|
+
// Frame Indices
|
|
712
|
+
unsigned char LastRefIdx;
|
|
713
|
+
unsigned char GoldenRefIdx;
|
|
714
|
+
unsigned char AltRefIdx;
|
|
715
|
+
unsigned char colorSpace;
|
|
716
|
+
|
|
717
|
+
unsigned short profile : 3;
|
|
718
|
+
unsigned short frameContextIdx : 2;
|
|
719
|
+
unsigned short frameType : 1;
|
|
720
|
+
unsigned short showFrame : 1;
|
|
721
|
+
unsigned short errorResilient : 1;
|
|
722
|
+
unsigned short frameParallelDecoding : 1;
|
|
723
|
+
unsigned short subSamplingX : 1;
|
|
724
|
+
unsigned short subSamplingY : 1;
|
|
725
|
+
unsigned short intraOnly : 1;
|
|
726
|
+
unsigned short allow_high_precision_mv : 1;
|
|
727
|
+
unsigned short refreshEntropyProbs : 1;
|
|
728
|
+
unsigned short reserved2Bits : 2;
|
|
729
|
+
|
|
730
|
+
unsigned short reserved16Bits;
|
|
731
|
+
|
|
732
|
+
unsigned char refFrameSignBias[4];
|
|
733
|
+
|
|
734
|
+
unsigned char bitDepthMinus8Luma;
|
|
735
|
+
unsigned char bitDepthMinus8Chroma;
|
|
736
|
+
unsigned char loopFilterLevel;
|
|
737
|
+
unsigned char loopFilterSharpness;
|
|
738
|
+
|
|
739
|
+
unsigned char modeRefLfEnabled;
|
|
740
|
+
unsigned char log2_tile_columns;
|
|
741
|
+
unsigned char log2_tile_rows;
|
|
742
|
+
|
|
743
|
+
unsigned char segmentEnabled : 1;
|
|
744
|
+
unsigned char segmentMapUpdate : 1;
|
|
745
|
+
unsigned char segmentMapTemporalUpdate : 1;
|
|
746
|
+
unsigned char segmentFeatureMode : 1;
|
|
747
|
+
unsigned char reserved4Bits : 4;
|
|
748
|
+
|
|
749
|
+
unsigned char segmentFeatureEnable[8][4];
|
|
750
|
+
short segmentFeatureData[8][4];
|
|
751
|
+
unsigned char mb_segment_tree_probs[7];
|
|
752
|
+
unsigned char segment_pred_probs[3];
|
|
753
|
+
unsigned char reservedSegment16Bits[2];
|
|
754
|
+
|
|
755
|
+
int qpYAc;
|
|
756
|
+
int qpYDc;
|
|
757
|
+
int qpChDc;
|
|
758
|
+
int qpChAc;
|
|
759
|
+
|
|
760
|
+
unsigned int activeRefIdx[3];
|
|
761
|
+
unsigned int resetFrameContext;
|
|
762
|
+
unsigned int mcomp_filter_type;
|
|
763
|
+
unsigned int mbRefLfDelta[4];
|
|
764
|
+
unsigned int mbModeLfDelta[2];
|
|
765
|
+
unsigned int frameTagSize;
|
|
766
|
+
unsigned int offsetToDctParts;
|
|
767
|
+
unsigned int reserved128Bits[4];
|
|
768
|
+
|
|
769
|
+
} CUVIDVP9PICPARAMS;
|
|
770
|
+
|
|
771
|
+
/***********************************************************/
|
|
772
|
+
//! \struct CUVIDAV1PICPARAMS
|
|
773
|
+
//! AV1 picture parameters
|
|
774
|
+
//! This structure is used in CUVIDPICPARAMS structure
|
|
775
|
+
/***********************************************************/
|
|
776
|
+
typedef struct _CUVIDAV1PICPARAMS {
|
|
777
|
+
unsigned int
|
|
778
|
+
width; // coded width, if superres enabled then it is upscaled width
|
|
779
|
+
unsigned int height; // coded height
|
|
780
|
+
unsigned int frame_offset; // defined as order_hint in AV1 specification
|
|
781
|
+
int decodePicIdx; // decoded output pic index, if film grain enabled, it will
|
|
782
|
+
// keep decoded (without film grain) output It can be used
|
|
783
|
+
// as reference frame for future frames
|
|
784
|
+
|
|
785
|
+
// sequence header
|
|
786
|
+
unsigned int profile : 3; // 0 = profile0, 1 = profile1, 2 = profile2
|
|
787
|
+
unsigned int
|
|
788
|
+
use_128x128_superblock : 1; // superblock size 0:64x64, 1: 128x128
|
|
789
|
+
unsigned int
|
|
790
|
+
subsampling_x : 1; // (subsampling_x, _y) 1,1 = 420, 1,0 = 422, 0,0 = 444
|
|
791
|
+
unsigned int subsampling_y : 1;
|
|
792
|
+
unsigned int mono_chrome : 1; // for monochrome content, mono_chrome = 1 and
|
|
793
|
+
// (subsampling_x, _y) should be 1,1
|
|
794
|
+
unsigned int bit_depth_minus8 : 4; // bit depth minus 8
|
|
795
|
+
unsigned int enable_filter_intra : 1; // tool enable in seq level, 0 : disable
|
|
796
|
+
// 1: frame header control
|
|
797
|
+
unsigned int enable_intra_edge_filter : 1; // intra edge filtering process, 0
|
|
798
|
+
// : disable 1: enabled
|
|
799
|
+
unsigned int
|
|
800
|
+
enable_interintra_compound : 1; // interintra, 0 : not present 1: present
|
|
801
|
+
unsigned int
|
|
802
|
+
enable_masked_compound : 1; // 1: mode info for inter blocks may contain
|
|
803
|
+
// the syntax element compound_type. 0: syntax
|
|
804
|
+
// element compound_type will not be present
|
|
805
|
+
unsigned int enable_dual_filter : 1; // vertical and horiz filter selection,
|
|
806
|
+
// 1: enable and 0: disable
|
|
807
|
+
unsigned int enable_order_hint : 1; // order hint, and related tools, 1:
|
|
808
|
+
// enable and 0: disable
|
|
809
|
+
unsigned int order_hint_bits_minus1 : 3; // is used to compute OrderHintBits
|
|
810
|
+
unsigned int
|
|
811
|
+
enable_jnt_comp : 1; // joint compound modes, 1: enable and 0: disable
|
|
812
|
+
unsigned int enable_superres : 1; // superres in seq level, 0 : disable 1:
|
|
813
|
+
// frame level control
|
|
814
|
+
unsigned int enable_cdef : 1; // cdef filtering in seq level, 0 : disable 1:
|
|
815
|
+
// frame level control
|
|
816
|
+
unsigned int
|
|
817
|
+
enable_restoration : 1; // loop restoration filtering in seq level, 0 :
|
|
818
|
+
// disable 1: frame level control
|
|
819
|
+
unsigned int enable_fgs : 1; // defined as film_grain_params_present in AV1
|
|
820
|
+
// specification
|
|
821
|
+
unsigned int reserved0_7bits : 7; // reserved bits; must be set to 0
|
|
822
|
+
|
|
823
|
+
// frame header
|
|
824
|
+
unsigned int
|
|
825
|
+
frame_type : 2; // 0:Key frame, 1:Inter frame, 2:intra only, 3:s-frame
|
|
826
|
+
unsigned int show_frame : 1; // show_frame = 1 implies that frame should be
|
|
827
|
+
// immediately output once decoded
|
|
828
|
+
unsigned int disable_cdf_update : 1; // CDF update during symbol decoding, 1:
|
|
829
|
+
// disabled, 0: enabled
|
|
830
|
+
unsigned int allow_screen_content_tools : 1; // 1: intra blocks may use
|
|
831
|
+
// palette encoding, 0: palette
|
|
832
|
+
// encoding is never used
|
|
833
|
+
unsigned int force_integer_mv : 1; // 1: motion vectors will always be
|
|
834
|
+
// integers, 0: can contain fractional bits
|
|
835
|
+
unsigned int coded_denom : 3; // coded_denom of the superres scale as
|
|
836
|
+
// specified in AV1 specification
|
|
837
|
+
unsigned int allow_intrabc : 1; // 1: intra block copy may be used, 0: intra
|
|
838
|
+
// block copy is not allowed
|
|
839
|
+
unsigned int allow_high_precision_mv : 1; // 1/8 precision mv enable
|
|
840
|
+
unsigned int
|
|
841
|
+
interp_filter : 3; // interpolation filter. Refer to section 6.8.9 of the
|
|
842
|
+
// AV1 specification Version 1.0.0 with Errata 1
|
|
843
|
+
unsigned int
|
|
844
|
+
switchable_motion_mode : 1; // defined as is_motion_mode_switchable in AV1
|
|
845
|
+
// specification
|
|
846
|
+
unsigned int use_ref_frame_mvs : 1; // 1: current frame can use the previous
|
|
847
|
+
// frame mv information, 0: will not use.
|
|
848
|
+
unsigned int disable_frame_end_update_cdf : 1; // 1: indicates that the end of
|
|
849
|
+
// frame CDF update is disabled
|
|
850
|
+
unsigned int delta_q_present : 1; // quantizer index delta values are present
|
|
851
|
+
// in the block level
|
|
852
|
+
unsigned int delta_q_res : 2; // left shift which should be applied to decoded
|
|
853
|
+
// quantizer index delta values
|
|
854
|
+
unsigned int using_qmatrix : 1; // 1: quantizer matrix will be used to compute
|
|
855
|
+
// quantizers
|
|
856
|
+
unsigned int coded_lossless : 1; // 1: all segments use lossless coding
|
|
857
|
+
unsigned int use_superres : 1; // 1: superres enabled for frame
|
|
858
|
+
unsigned int tx_mode : 2; // 0: ONLY4x4,1:LARGEST,2:SELECT
|
|
859
|
+
unsigned int reference_mode : 1; // 0: SINGLE, 1: SELECT
|
|
860
|
+
unsigned int
|
|
861
|
+
allow_warped_motion : 1; // 1: allow_warped_motion may be present, 0:
|
|
862
|
+
// allow_warped_motion will not be present
|
|
863
|
+
unsigned int
|
|
864
|
+
reduced_tx_set : 1; // 1: frame is restricted to subset of the full set of
|
|
865
|
+
// transform types, 0: no such restriction
|
|
866
|
+
unsigned int skip_mode : 1; // 1: most of the mode info is skipped, 0: mode
|
|
867
|
+
// info is not skipped
|
|
868
|
+
unsigned int reserved1_3bits : 3; // reserved bits; must be set to 0
|
|
869
|
+
|
|
870
|
+
// tiling info
|
|
871
|
+
unsigned int
|
|
872
|
+
num_tile_cols : 8; // number of tiles across the frame., max is 64
|
|
873
|
+
unsigned int num_tile_rows : 8; // number of tiles down the frame., max is 64
|
|
874
|
+
unsigned int context_update_tile_id : 16; // specifies which tile to use for
|
|
875
|
+
// the CDF update
|
|
876
|
+
unsigned short tile_widths[64]; // Width of each column in superblocks
|
|
877
|
+
unsigned short tile_heights[64]; // height of each row in superblocks
|
|
878
|
+
|
|
879
|
+
// CDEF - refer to section 6.10.14 of the AV1 specification Version 1.0.0 with
|
|
880
|
+
// Errata 1
|
|
881
|
+
unsigned char cdef_damping_minus_3 : 2; // controls the amount of damping in
|
|
882
|
+
// the deringing filter
|
|
883
|
+
unsigned char cdef_bits : 2; // the number of bits needed to specify which
|
|
884
|
+
// CDEF filter to apply
|
|
885
|
+
unsigned char reserved2_4bits : 4; // reserved bits; must be set to 0
|
|
886
|
+
unsigned char
|
|
887
|
+
cdef_y_strength[8]; // 0-3 bits: y_pri_strength, 4-7 bits y_sec_strength
|
|
888
|
+
unsigned char cdef_uv_strength[8]; // 0-3 bits: uv_pri_strength, 4-7 bits
|
|
889
|
+
// uv_sec_strength
|
|
890
|
+
|
|
891
|
+
// SkipModeFrames
|
|
892
|
+
unsigned char SkipModeFrame0 : 4; // specifies the frames to use for compound
|
|
893
|
+
// prediction when skip_mode is equal to 1.
|
|
894
|
+
unsigned char SkipModeFrame1 : 4;
|
|
895
|
+
|
|
896
|
+
// qp information - refer to section 6.8.11 of the AV1 specification
|
|
897
|
+
// Version 1.0.0 with Errata 1
|
|
898
|
+
unsigned char base_qindex; // indicates the base frame qindex. Defined as
|
|
899
|
+
// base_q_idx in AV1 specification
|
|
900
|
+
char qp_y_dc_delta_q; // indicates the Y DC quantizer relative to base_q_idx.
|
|
901
|
+
// Defined as DeltaQYDc in AV1 specification
|
|
902
|
+
char qp_u_dc_delta_q; // indicates the U DC quantizer relative to base_q_idx.
|
|
903
|
+
// Defined as DeltaQUDc in AV1 specification
|
|
904
|
+
char qp_v_dc_delta_q; // indicates the V DC quantizer relative to base_q_idx.
|
|
905
|
+
// Defined as DeltaQVDc in AV1 specification
|
|
906
|
+
char qp_u_ac_delta_q; // indicates the U AC quantizer relative to base_q_idx.
|
|
907
|
+
// Defined as DeltaQUAc in AV1 specification
|
|
908
|
+
char qp_v_ac_delta_q; // indicates the V AC quantizer relative to base_q_idx.
|
|
909
|
+
// Defined as DeltaQVAc in AV1 specification
|
|
910
|
+
unsigned char qm_y; // specifies the level in the quantizer matrix that should
|
|
911
|
+
// be used for luma plane decoding
|
|
912
|
+
unsigned char qm_u; // specifies the level in the quantizer matrix that should
|
|
913
|
+
// be used for chroma U plane decoding
|
|
914
|
+
unsigned char qm_v; // specifies the level in the quantizer matrix that should
|
|
915
|
+
// be used for chroma V plane decoding
|
|
916
|
+
|
|
917
|
+
// segmentation - refer to section 6.8.13 of the AV1 specification
|
|
918
|
+
// Version 1.0.0 with Errata 1
|
|
919
|
+
unsigned char segmentation_enabled : 1; // 1 indicates that this frame makes
|
|
920
|
+
// use of the segmentation tool
|
|
921
|
+
unsigned char
|
|
922
|
+
segmentation_update_map : 1; // 1 indicates that the segmentation map are
|
|
923
|
+
// updated during the decoding of this frame
|
|
924
|
+
unsigned char
|
|
925
|
+
segmentation_update_data : 1; // 1 indicates that new parameters are about
|
|
926
|
+
// to be specified for each segment
|
|
927
|
+
unsigned char
|
|
928
|
+
segmentation_temporal_update : 1; // 1 indicates that the updates to the
|
|
929
|
+
// segmentation map are coded relative
|
|
930
|
+
// to the existing segmentation map
|
|
931
|
+
unsigned char reserved3_4bits : 4; // reserved bits; must be set to 0
|
|
932
|
+
short segmentation_feature_data[8][8]; // specifies the feature data for a
|
|
933
|
+
// segment feature
|
|
934
|
+
unsigned char
|
|
935
|
+
segmentation_feature_mask[8]; // indicates that the corresponding feature
|
|
936
|
+
// is unused or feature value is coded
|
|
937
|
+
|
|
938
|
+
// loopfilter - refer to section 6.8.10 of the AV1 specification Version 1.0.0
|
|
939
|
+
// with Errata 1
|
|
940
|
+
unsigned char loop_filter_level[2]; // contains loop filter strength values
|
|
941
|
+
unsigned char loop_filter_level_u; // loop filter strength value of U plane
|
|
942
|
+
unsigned char loop_filter_level_v; // loop filter strength value of V plane
|
|
943
|
+
unsigned char loop_filter_sharpness; // indicates the sharpness level
|
|
944
|
+
char loop_filter_ref_deltas[8]; // contains the adjustment needed for the
|
|
945
|
+
// filter level based on the chosen reference
|
|
946
|
+
// frame
|
|
947
|
+
char loop_filter_mode_deltas[2]; // contains the adjustment needed for the
|
|
948
|
+
// filter level based on the chosen mode
|
|
949
|
+
unsigned char
|
|
950
|
+
loop_filter_delta_enabled : 1; // indicates that the filter level depends
|
|
951
|
+
// on the mode and reference frame used to
|
|
952
|
+
// predict a block
|
|
953
|
+
unsigned char
|
|
954
|
+
loop_filter_delta_update : 1; // indicates that additional syntax elements
|
|
955
|
+
// are present that specify which mode and
|
|
956
|
+
// reference frame deltas are to be updated
|
|
957
|
+
unsigned char delta_lf_present : 1; // specifies whether loop filter delta
|
|
958
|
+
// values are present in the block level
|
|
959
|
+
unsigned char delta_lf_res : 2; // specifies the left shift to apply to the
|
|
960
|
+
// decoded loop filter values
|
|
961
|
+
unsigned char
|
|
962
|
+
delta_lf_multi : 1; // separate loop filter deltas for Hy,Vy,U,V edges
|
|
963
|
+
unsigned char reserved4_2bits : 2; // reserved bits; must be set to 0
|
|
964
|
+
|
|
965
|
+
// restoration - refer to section 6.10.15 of the AV1 specification
|
|
966
|
+
// Version 1.0.0 with Errata 1
|
|
967
|
+
unsigned char lr_unit_size[3]; // specifies the size of loop restoration
|
|
968
|
+
// units: 0: 32, 1: 64, 2: 128, 3: 256
|
|
969
|
+
unsigned char lr_type[3]; // used to compute FrameRestorationType
|
|
970
|
+
|
|
971
|
+
// reference frames
|
|
972
|
+
unsigned char primary_ref_frame; // specifies which reference frame contains
|
|
973
|
+
// the CDF values and other state that should
|
|
974
|
+
// be loaded at the start of the frame
|
|
975
|
+
unsigned char ref_frame_map[8]; // frames in dpb that can be used as reference
|
|
976
|
+
// for current or future frames
|
|
977
|
+
|
|
978
|
+
unsigned char temporal_layer_id : 4; // temporal layer id
|
|
979
|
+
unsigned char spatial_layer_id : 4; // spatial layer id
|
|
980
|
+
|
|
981
|
+
unsigned char reserved5_32bits[4]; // reserved bits; must be set to 0
|
|
982
|
+
|
|
983
|
+
// ref frame list
|
|
984
|
+
struct {
|
|
985
|
+
unsigned int width;
|
|
986
|
+
unsigned int height;
|
|
987
|
+
unsigned char index;
|
|
988
|
+
unsigned char reserved24Bits[3]; // reserved bits; must be set to 0
|
|
989
|
+
} ref_frame[7]; // frames used as reference frame for current frame.
|
|
990
|
+
|
|
991
|
+
// global motion
|
|
992
|
+
struct {
|
|
993
|
+
unsigned char invalid : 1;
|
|
994
|
+
unsigned char wmtype : 2; // defined as GmType in AV1 specification
|
|
995
|
+
unsigned char reserved5Bits : 5; // reserved bits; must be set to 0
|
|
996
|
+
char reserved24Bits[3]; // reserved bits; must be set to 0
|
|
997
|
+
int wmmat[6]; // defined as gm_params[] in AV1 specification
|
|
998
|
+
} global_motion[7]; // global motion params for reference frames
|
|
999
|
+
|
|
1000
|
+
// film grain params - refer to section 6.8.20 of the AV1 specification
|
|
1001
|
+
// Version 1.0.0 with Errata 1
|
|
1002
|
+
unsigned short apply_grain : 1;
|
|
1003
|
+
unsigned short overlap_flag : 1;
|
|
1004
|
+
unsigned short scaling_shift_minus8 : 2;
|
|
1005
|
+
unsigned short chroma_scaling_from_luma : 1;
|
|
1006
|
+
unsigned short ar_coeff_lag : 2;
|
|
1007
|
+
unsigned short ar_coeff_shift_minus6 : 2;
|
|
1008
|
+
unsigned short grain_scale_shift : 2;
|
|
1009
|
+
unsigned short clip_to_restricted_range : 1;
|
|
1010
|
+
unsigned short reserved6_4bits : 4; // reserved bits; must be set to 0
|
|
1011
|
+
unsigned char num_y_points;
|
|
1012
|
+
unsigned char scaling_points_y[14][2];
|
|
1013
|
+
unsigned char num_cb_points;
|
|
1014
|
+
unsigned char scaling_points_cb[10][2];
|
|
1015
|
+
unsigned char num_cr_points;
|
|
1016
|
+
unsigned char scaling_points_cr[10][2];
|
|
1017
|
+
unsigned char reserved7_8bits; // reserved bits; must be set to 0
|
|
1018
|
+
unsigned short random_seed;
|
|
1019
|
+
short ar_coeffs_y[24];
|
|
1020
|
+
short ar_coeffs_cb[25];
|
|
1021
|
+
short ar_coeffs_cr[25];
|
|
1022
|
+
unsigned char cb_mult;
|
|
1023
|
+
unsigned char cb_luma_mult;
|
|
1024
|
+
short cb_offset;
|
|
1025
|
+
unsigned char cr_mult;
|
|
1026
|
+
unsigned char cr_luma_mult;
|
|
1027
|
+
short cr_offset;
|
|
1028
|
+
|
|
1029
|
+
int reserved[7]; // reserved bits; must be set to 0
|
|
1030
|
+
} CUVIDAV1PICPARAMS;
|
|
1031
|
+
|
|
1032
|
+
/******************************************************************************************/
|
|
1033
|
+
//! \struct CUVIDPICPARAMS
|
|
1034
|
+
//! Picture parameters for decoding
|
|
1035
|
+
//! This structure is used in cuvidDecodePicture API
|
|
1036
|
+
//! IN for cuvidDecodePicture
|
|
1037
|
+
/******************************************************************************************/
|
|
1038
|
+
typedef struct _CUVIDPICPARAMS {
|
|
1039
|
+
int PicWidthInMbs; /**< IN: Coded frame size in macroblocks */
|
|
1040
|
+
int FrameHeightInMbs; /**< IN: Coded frame height in macroblocks */
|
|
1041
|
+
int CurrPicIdx; /**< IN: Output index of the current picture */
|
|
1042
|
+
int field_pic_flag; /**< IN: 0=frame picture, 1=field picture */
|
|
1043
|
+
int bottom_field_flag; /**< IN: 0=top field, 1=bottom field (ignored if
|
|
1044
|
+
field_pic_flag=0) */
|
|
1045
|
+
int second_field; /**< IN: Second field of a complementary field pair */
|
|
1046
|
+
// Bitstream data
|
|
1047
|
+
unsigned int
|
|
1048
|
+
nBitstreamDataLen; /**< IN: Number of bytes in bitstream data buffer */
|
|
1049
|
+
const unsigned char* pBitstreamData; /**< IN: Ptr to bitstream data for this
|
|
1050
|
+
picture (slice-layer) */
|
|
1051
|
+
unsigned int nNumSlices; /**< IN: Number of slices in this picture */
|
|
1052
|
+
const unsigned int*
|
|
1053
|
+
pSliceDataOffsets; /**< IN: nNumSlices entries, contains offset of each
|
|
1054
|
+
slice within the bitstream data buffer */
|
|
1055
|
+
int ref_pic_flag; /**< IN: This picture is a reference picture */
|
|
1056
|
+
int intra_pic_flag; /**< IN: This picture is entirely intra coded */
|
|
1057
|
+
unsigned int Reserved[30]; /**< Reserved for future use */
|
|
1058
|
+
|
|
1059
|
+
// IN: Codec-specific data
|
|
1060
|
+
union {
|
|
1061
|
+
CUVIDMPEG2PICPARAMS mpeg2; /**< Also used for MPEG-1 */
|
|
1062
|
+
CUVIDH264PICPARAMS h264;
|
|
1063
|
+
CUVIDVC1PICPARAMS vc1;
|
|
1064
|
+
CUVIDMPEG4PICPARAMS mpeg4;
|
|
1065
|
+
CUVIDJPEGPICPARAMS jpeg;
|
|
1066
|
+
CUVIDHEVCPICPARAMS hevc;
|
|
1067
|
+
CUVIDVP8PICPARAMS vp8;
|
|
1068
|
+
CUVIDVP9PICPARAMS vp9;
|
|
1069
|
+
CUVIDAV1PICPARAMS av1;
|
|
1070
|
+
unsigned int CodecReserved[1024];
|
|
1071
|
+
} CodecSpecific;
|
|
1072
|
+
} CUVIDPICPARAMS;
|
|
1073
|
+
|
|
1074
|
+
/******************************************************/
|
|
1075
|
+
//! \struct CUVIDPROCPARAMS
|
|
1076
|
+
//! Picture parameters for postprocessing
|
|
1077
|
+
//! This structure is used in cuvidMapVideoFrame API
|
|
1078
|
+
/******************************************************/
|
|
1079
|
+
typedef struct _CUVIDPROCPARAMS {
|
|
1080
|
+
int progressive_frame; /**< IN: Input is progressive (deinterlace_mode will be
|
|
1081
|
+
ignored) */
|
|
1082
|
+
int second_field; /**< IN: Output the second field (ignored if deinterlace
|
|
1083
|
+
mode is Weave) */
|
|
1084
|
+
int top_field_first; /**< IN: Input frame is top field first (1st field is
|
|
1085
|
+
top, 2nd field is bottom) */
|
|
1086
|
+
int unpaired_field; /**< IN: Input only contains one field (2nd field is
|
|
1087
|
+
invalid) */
|
|
1088
|
+
// The fields below are used for raw YUV input
|
|
1089
|
+
unsigned int reserved_flags; /**< Reserved for future use (set to zero) */
|
|
1090
|
+
unsigned int reserved_zero; /**< Reserved (set to zero) */
|
|
1091
|
+
unsigned long long
|
|
1092
|
+
raw_input_dptr; /**< IN: Input CUdeviceptr for raw YUV extensions */
|
|
1093
|
+
unsigned int raw_input_pitch; /**< IN: pitch in bytes of raw YUV input (should
|
|
1094
|
+
be aligned appropriately) */
|
|
1095
|
+
unsigned int
|
|
1096
|
+
raw_input_format; /**< IN: Input YUV format (cudaVideoCodec_enum) */
|
|
1097
|
+
unsigned long long
|
|
1098
|
+
raw_output_dptr; /**< IN: Output CUdeviceptr for raw YUV extensions */
|
|
1099
|
+
unsigned int raw_output_pitch; /**< IN: pitch in bytes of raw YUV output
|
|
1100
|
+
(should be aligned appropriately) */
|
|
1101
|
+
unsigned int Reserved1; /**< Reserved for future use (set to zero) */
|
|
1102
|
+
CUstream output_stream; /**< IN: stream object used by cuvidMapVideoFrame */
|
|
1103
|
+
unsigned int Reserved[46]; /**< Reserved for future use (set to zero) */
|
|
1104
|
+
unsigned long long*
|
|
1105
|
+
histogram_dptr; /**< OUT: Output CUdeviceptr for histogram extensions */
|
|
1106
|
+
void* Reserved2[1]; /**< Reserved for future use (set to zero) */
|
|
1107
|
+
} CUVIDPROCPARAMS;
|
|
1108
|
+
|
|
1109
|
+
/*********************************************************************************************************/
|
|
1110
|
+
//! \struct CUVIDGETDECODESTATUS
|
|
1111
|
+
//! Struct for reporting decode status.
|
|
1112
|
+
//! This structure is used in cuvidGetDecodeStatus API.
|
|
1113
|
+
/*********************************************************************************************************/
|
|
1114
|
+
typedef struct _CUVIDGETDECODESTATUS {
|
|
1115
|
+
cuvidDecodeStatus decodeStatus;
|
|
1116
|
+
unsigned int reserved[31];
|
|
1117
|
+
void* pReserved[8];
|
|
1118
|
+
} CUVIDGETDECODESTATUS;
|
|
1119
|
+
|
|
1120
|
+
/****************************************************/
|
|
1121
|
+
//! \struct CUVIDRECONFIGUREDECODERINFO
|
|
1122
|
+
//! Struct for decoder reset
|
|
1123
|
+
//! This structure is used in cuvidReconfigureDecoder() API
|
|
1124
|
+
/****************************************************/
|
|
1125
|
+
typedef struct _CUVIDRECONFIGUREDECODERINFO {
|
|
1126
|
+
unsigned int ulWidth; /**< IN: Coded sequence width in pixels, MUST be < =
|
|
1127
|
+
ulMaxWidth defined at CUVIDDECODECREATEINFO */
|
|
1128
|
+
unsigned int ulHeight; /**< IN: Coded sequence height in pixels, MUST be < =
|
|
1129
|
+
ulMaxHeight defined at CUVIDDECODECREATEINFO */
|
|
1130
|
+
unsigned int ulTargetWidth; /**< IN: Post processed output width */
|
|
1131
|
+
unsigned int ulTargetHeight; /**< IN: Post Processed output height */
|
|
1132
|
+
unsigned int ulNumDecodeSurfaces; /**< IN: Maximum number of internal decode
|
|
1133
|
+
surfaces */
|
|
1134
|
+
unsigned int reserved1[12]; /**< Reserved for future use. Set to Zero */
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* IN: Area of frame to be displayed. Use-case : Source Cropping
|
|
1138
|
+
*/
|
|
1139
|
+
struct {
|
|
1140
|
+
short left;
|
|
1141
|
+
short top;
|
|
1142
|
+
short right;
|
|
1143
|
+
short bottom;
|
|
1144
|
+
} display_area;
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* IN: Target Rectangle in the OutputFrame. Use-case : Aspect ratio Conversion
|
|
1148
|
+
*/
|
|
1149
|
+
struct {
|
|
1150
|
+
short left;
|
|
1151
|
+
short top;
|
|
1152
|
+
short right;
|
|
1153
|
+
short bottom;
|
|
1154
|
+
} target_rect;
|
|
1155
|
+
|
|
1156
|
+
unsigned int reserved2[11]; /**< Reserved for future use. Set to Zero */
|
|
1157
|
+
} CUVIDRECONFIGUREDECODERINFO;
|
|
1158
|
+
|
|
1159
|
+
/***********************************************************************************************************/
|
|
1160
|
+
//! VIDEO_DECODER
|
|
1161
|
+
//!
|
|
1162
|
+
//! In order to minimize decode latencies, there should be always at least 2
|
|
1163
|
+
//! pictures in the decode queue at any time, in order to make sure that all
|
|
1164
|
+
//! decode engines are always busy.
|
|
1165
|
+
//!
|
|
1166
|
+
//! Overall data flow:
|
|
1167
|
+
//! - cuvidGetDecoderCaps(...)
|
|
1168
|
+
//! - cuvidCreateDecoder(...)
|
|
1169
|
+
//! - For each picture:
|
|
1170
|
+
//! + cuvidDecodePicture(N)
|
|
1171
|
+
//! + cuvidMapVideoFrame(N-4)
|
|
1172
|
+
//! + do some processing in cuda
|
|
1173
|
+
//! + cuvidUnmapVideoFrame(N-4)
|
|
1174
|
+
//! + cuvidDecodePicture(N+1)
|
|
1175
|
+
//! + cuvidMapVideoFrame(N-3)
|
|
1176
|
+
//! + ...
|
|
1177
|
+
//! - cuvidDestroyDecoder(...)
|
|
1178
|
+
//!
|
|
1179
|
+
//! NOTE:
|
|
1180
|
+
//! - When the cuda context is created from a D3D device, the D3D device must
|
|
1181
|
+
//! also be created
|
|
1182
|
+
//! with the D3DCREATE_MULTITHREADED flag.
|
|
1183
|
+
//! - There is a limit to how many pictures can be mapped simultaneously
|
|
1184
|
+
//! (ulNumOutputSurfaces)
|
|
1185
|
+
//! - cuvidDecodePicture may block the calling thread if there are too many
|
|
1186
|
+
//! pictures pending
|
|
1187
|
+
//! in the decode queue
|
|
1188
|
+
/***********************************************************************************************************/
|
|
1189
|
+
|
|
1190
|
+
/**********************************************************************************************************************/
|
|
1191
|
+
//! \fn CUresult CUDAAPI cuvidGetDecoderCaps(CUVIDDECODECAPS *pdc)
|
|
1192
|
+
//! Queries decode capabilities of NVDEC-HW based on CodecType, ChromaFormat and
|
|
1193
|
+
//! BitDepthMinus8 parameters.
|
|
1194
|
+
//! 1. Application fills IN parameters CodecType, ChromaFormat and
|
|
1195
|
+
//! BitDepthMinus8 of CUVIDDECODECAPS structure
|
|
1196
|
+
//! 2. On calling cuvidGetDecoderCaps, driver fills OUT parameters if the IN
|
|
1197
|
+
//! parameters are supported
|
|
1198
|
+
//! If IN parameters passed to the driver are not supported by NVDEC-HW, then
|
|
1199
|
+
//! all OUT params are set to 0.
|
|
1200
|
+
//! E.g. on Geforce GTX 960:
|
|
1201
|
+
//! App fills - eCodecType = cudaVideoCodec_H264; eChromaFormat =
|
|
1202
|
+
//! cudaVideoChromaFormat_420; nBitDepthMinus8 = 0; Given IN parameters are
|
|
1203
|
+
//! supported, hence driver fills: bIsSupported = 1; nMinWidth = 48;
|
|
1204
|
+
//! nMinHeight = 16; nMaxWidth = 4096; nMaxHeight = 4096; nMaxMBCount =
|
|
1205
|
+
//! 65536;
|
|
1206
|
+
//! CodedWidth*CodedHeight/256 must be less than or equal to nMaxMBCount
|
|
1207
|
+
/**********************************************************************************************************************/
|
|
1208
|
+
extern CUresult CUDAAPI cuvidGetDecoderCaps(CUVIDDECODECAPS* pdc);
|
|
1209
|
+
|
|
1210
|
+
/*****************************************************************************************************/
|
|
1211
|
+
//! \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder,
|
|
1212
|
+
//! CUVIDDECODECREATEINFO *pdci) Create the decoder object based on pdci. A
|
|
1213
|
+
//! handle to the created decoder is returned
|
|
1214
|
+
/*****************************************************************************************************/
|
|
1215
|
+
extern CUresult CUDAAPI
|
|
1216
|
+
cuvidCreateDecoder(CUvideodecoder* phDecoder, CUVIDDECODECREATEINFO* pdci);
|
|
1217
|
+
|
|
1218
|
+
/*****************************************************************************************************/
|
|
1219
|
+
//! \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder)
|
|
1220
|
+
//! Destroy the decoder object
|
|
1221
|
+
/*****************************************************************************************************/
|
|
1222
|
+
extern CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder);
|
|
1223
|
+
|
|
1224
|
+
/*****************************************************************************************************/
|
|
1225
|
+
//! \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder,
|
|
1226
|
+
//! CUVIDPICPARAMS *pPicParams) Decode a single picture (field or frame) Kicks
|
|
1227
|
+
//! off HW decoding
|
|
1228
|
+
/*****************************************************************************************************/
|
|
1229
|
+
extern CUresult CUDAAPI
|
|
1230
|
+
cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS* pPicParams);
|
|
1231
|
+
|
|
1232
|
+
/************************************************************************************************************/
|
|
1233
|
+
//! \fn CUresult CUDAAPI cuvidGetDecodeStatus(CUvideodecoder hDecoder, int
|
|
1234
|
+
//! nPicIdx); Get the decode status for frame corresponding to nPicIdx API is
|
|
1235
|
+
//! supported for Maxwell and above generation GPUs. API is currently supported
|
|
1236
|
+
//! for HEVC, H264 and JPEG codecs. API returns CUDA_ERROR_NOT_SUPPORTED error
|
|
1237
|
+
//! code for unsupported GPU or codec.
|
|
1238
|
+
/************************************************************************************************************/
|
|
1239
|
+
extern CUresult CUDAAPI cuvidGetDecodeStatus(
|
|
1240
|
+
CUvideodecoder hDecoder,
|
|
1241
|
+
int nPicIdx,
|
|
1242
|
+
CUVIDGETDECODESTATUS* pDecodeStatus);
|
|
1243
|
+
|
|
1244
|
+
/*********************************************************************************************************/
|
|
1245
|
+
//! \fn CUresult CUDAAPI cuvidReconfigureDecoder(CUvideodecoder hDecoder,
|
|
1246
|
+
//! CUVIDRECONFIGUREDECODERINFO *pDecReconfigParams) Used to reuse single
|
|
1247
|
+
//! decoder for multiple clips. Currently supports resolution change, resize
|
|
1248
|
+
//! params, display area params, target area params change for same codec. Must
|
|
1249
|
+
//! be called during CUVIDPARSERPARAMS::pfnSequenceCallback
|
|
1250
|
+
/*********************************************************************************************************/
|
|
1251
|
+
extern CUresult CUDAAPI cuvidReconfigureDecoder(
|
|
1252
|
+
CUvideodecoder hDecoder,
|
|
1253
|
+
CUVIDRECONFIGUREDECODERINFO* pDecReconfigParams);
|
|
1254
|
+
|
|
1255
|
+
#if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)
|
|
1256
|
+
/************************************************************************************************************************/
|
|
1257
|
+
//! \fn CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int
|
|
1258
|
+
//! nPicIdx, unsigned int *pDevPtr,
|
|
1259
|
+
//! unsigned int *pPitch,
|
|
1260
|
+
//! CUVIDPROCPARAMS *pVPP);
|
|
1261
|
+
//! Post-process and map video frame corresponding to nPicIdx for use in cuda.
|
|
1262
|
+
//! Returns cuda device pointer and associated pitch of the video frame
|
|
1263
|
+
/************************************************************************************************************************/
|
|
1264
|
+
extern CUresult CUDAAPI cuvidMapVideoFrame(
|
|
1265
|
+
CUvideodecoder hDecoder,
|
|
1266
|
+
int nPicIdx,
|
|
1267
|
+
unsigned int* pDevPtr,
|
|
1268
|
+
unsigned int* pPitch,
|
|
1269
|
+
CUVIDPROCPARAMS* pVPP);
|
|
1270
|
+
|
|
1271
|
+
/*****************************************************************************************************/
|
|
1272
|
+
//! \fn CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned
|
|
1273
|
+
//! int DevPtr) Unmap a previously mapped video frame
|
|
1274
|
+
/*****************************************************************************************************/
|
|
1275
|
+
extern CUresult CUDAAPI
|
|
1276
|
+
cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr);
|
|
1277
|
+
#endif
|
|
1278
|
+
|
|
1279
|
+
/****************************************************************************************************************************/
|
|
1280
|
+
//! \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int
|
|
1281
|
+
//! nPicIdx, unsigned long long *pDevPtr,
|
|
1282
|
+
//! unsigned int * pPitch,
|
|
1283
|
+
//! CUVIDPROCPARAMS *pVPP);
|
|
1284
|
+
//! Post-process and map video frame corresponding to nPicIdx for use in cuda.
|
|
1285
|
+
//! Returns cuda device pointer and associated pitch of the video frame
|
|
1286
|
+
/****************************************************************************************************************************/
|
|
1287
|
+
extern CUresult CUDAAPI cuvidMapVideoFrame64(
|
|
1288
|
+
CUvideodecoder hDecoder,
|
|
1289
|
+
int nPicIdx,
|
|
1290
|
+
unsigned long long* pDevPtr,
|
|
1291
|
+
unsigned int* pPitch,
|
|
1292
|
+
CUVIDPROCPARAMS* pVPP);
|
|
1293
|
+
|
|
1294
|
+
/**************************************************************************************************/
|
|
1295
|
+
//! \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder,
|
|
1296
|
+
//! unsigned long long DevPtr); Unmap a previously mapped video frame
|
|
1297
|
+
/**************************************************************************************************/
|
|
1298
|
+
extern CUresult CUDAAPI
|
|
1299
|
+
cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
|
|
1300
|
+
|
|
1301
|
+
#if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)
|
|
1302
|
+
#define cuvidMapVideoFrame cuvidMapVideoFrame64
|
|
1303
|
+
#define cuvidUnmapVideoFrame cuvidUnmapVideoFrame64
|
|
1304
|
+
#endif
|
|
1305
|
+
|
|
1306
|
+
/********************************************************************************************************************/
|
|
1307
|
+
//!
|
|
1308
|
+
//! Context-locking: to facilitate multi-threaded implementations, the following
|
|
1309
|
+
//! 4 functions provide a simple mutex-style host synchronization. If a non-NULL
|
|
1310
|
+
//! context is specified in CUVIDDECODECREATEINFO, the codec library will
|
|
1311
|
+
//! acquire the mutex associated with the given context before making any cuda
|
|
1312
|
+
//! calls. A multi-threaded application could create a lock associated with a
|
|
1313
|
+
//! context handle so that multiple threads can safely share the same cuda
|
|
1314
|
+
//! context:
|
|
1315
|
+
//! - use cuCtxPopCurrent immediately after context creation in order to create
|
|
1316
|
+
//! a 'floating' context
|
|
1317
|
+
//! that can be passed to cuvidCtxLockCreate.
|
|
1318
|
+
//! - When using a floating context, all cuda calls should only be made within
|
|
1319
|
+
//! a cuvidCtxLock/cuvidCtxUnlock section.
|
|
1320
|
+
//!
|
|
1321
|
+
//! NOTE: This is a safer alternative to cuCtxPushCurrent and cuCtxPopCurrent,
|
|
1322
|
+
//! and is not related to video decoder in any way (implemented as a critical
|
|
1323
|
+
//! section associated with cuCtx{Push|Pop}Current calls).
|
|
1324
|
+
/********************************************************************************************************************/
|
|
1325
|
+
|
|
1326
|
+
/********************************************************************************************************************/
|
|
1327
|
+
//! \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext
|
|
1328
|
+
//! ctx) This API is used to create CtxLock object
|
|
1329
|
+
/********************************************************************************************************************/
|
|
1330
|
+
extern CUresult CUDAAPI
|
|
1331
|
+
cuvidCtxLockCreate(CUvideoctxlock* pLock, CUcontext ctx);
|
|
1332
|
+
|
|
1333
|
+
/********************************************************************************************************************/
|
|
1334
|
+
//! \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck)
|
|
1335
|
+
//! This API is used to free CtxLock object
|
|
1336
|
+
/********************************************************************************************************************/
|
|
1337
|
+
extern CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck);
|
|
1338
|
+
|
|
1339
|
+
/********************************************************************************************************************/
|
|
1340
|
+
//! \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int
|
|
1341
|
+
//! reserved_flags) This API is used to acquire ctxlock
|
|
1342
|
+
/********************************************************************************************************************/
|
|
1343
|
+
extern CUresult CUDAAPI
|
|
1344
|
+
cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags);
|
|
1345
|
+
|
|
1346
|
+
/********************************************************************************************************************/
|
|
1347
|
+
//! \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int
|
|
1348
|
+
//! reserved_flags) This API is used to release ctxlock
|
|
1349
|
+
/********************************************************************************************************************/
|
|
1350
|
+
extern CUresult CUDAAPI
|
|
1351
|
+
cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags);
|
|
1352
|
+
|
|
1353
|
+
/**********************************************************************************************/
|
|
1354
|
+
|
|
1355
|
+
#if defined(__cplusplus)
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// Auto-lock helper for C++ applications
|
|
1359
|
+
class CCtxAutoLock {
|
|
1360
|
+
private:
|
|
1361
|
+
CUvideoctxlock m_ctx;
|
|
1362
|
+
|
|
1363
|
+
public:
|
|
1364
|
+
CCtxAutoLock(CUvideoctxlock ctx) : m_ctx(ctx) {
|
|
1365
|
+
cuvidCtxLock(m_ctx, 0);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
~CCtxAutoLock() {
|
|
1369
|
+
cuvidCtxUnlock(m_ctx, 0);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
#endif /* __cplusplus */
|
|
1373
|
+
|
|
1374
|
+
#endif // __CUDA_VIDEO_H__
|