forked from intel/libvpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mfxdefs.h
313 lines (269 loc) · 13.4 KB
/
mfxdefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*############################################################################
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXDEFS_H__
#define __MFXDEFS_H__
#define MFX_VERSION_MAJOR 2
#define MFX_VERSION_MINOR 2
// MFX_VERSION - version of API that 'assumed' by build may be provided externally
// if it omitted then latest stable API derived from Major.Minor is assumed
#if !defined(MFX_VERSION)
#define MFX_VERSION (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR)
#else
#undef MFX_VERSION_MAJOR
#define MFX_VERSION_MAJOR ((MFX_VERSION) / 1000)
#undef MFX_VERSION_MINOR
#define MFX_VERSION_MINOR ((MFX_VERSION) % 1000)
#endif
/*! The corresponding version of the Intel(r) Media SDK legacy API that is used as a basis
for the current API. */
#define MFX_LEGACY_VERSION 1034
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* In preprocessor syntax # symbol has stringize meaning,
so to expand some macro to preprocessor pragma we need to use
special compiler dependent construction */
#if defined(_MSC_VER)
#define MFX_PRAGMA_IMPL(x) __pragma(x)
#else
#define MFX_PRAGMA_IMPL(x) _Pragma(#x)
#endif
#define MFX_PACK_BEGIN_X(x) MFX_PRAGMA_IMPL(pack(push, x))
#define MFX_PACK_END() MFX_PRAGMA_IMPL(pack(pop))
/* The general rule for alignment is following:
- structures with pointers have 4/8 bytes alignment on 32/64 bit systems
- structures with fields of type mfxU64/mfxF64 (unsigned long long / double)
have alignment 8 bytes on 64 bit and 32 bit Windows, on Linux alignment is 4 bytes
- all the rest structures are 4 bytes aligned
- there are several exceptions: some structs which had 4-byte alignment were extended
with pointer / long type fields; such structs have 4-byte alignment to keep binary
compatibility with previously release API */
#define MFX_PACK_BEGIN_USUAL_STRUCT() MFX_PACK_BEGIN_X(4)
/* 64-bit LP64 data model */
#if defined(_WIN64) || defined(__LP64__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(8)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
/* 32-bit ILP32 data model Windows* (Intel(r) architecture) */
#elif defined(_WIN32) || defined(_M_IX86) && !defined(__linux__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
/* 32-bit ILP32 data model Linux* */
#elif defined(__ILP32__)
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(4)
#else
#error Unknown packing
#endif
#ifdef _WIN32
#define MFX_CDECL __cdecl
#define MFX_STDCALL __stdcall
#else
#define MFX_CDECL
#define MFX_STDCALL
#endif /* _WIN32 */
#define MFX_INFINITE 0xFFFFFFFF
#if !defined(MFX_DEPRECATED_OFF) && (MFX_VERSION < MFX_VERSION_NEXT)
#define MFX_DEPRECATED_OFF
#endif
#ifndef MFX_DEPRECATED_OFF
#if defined(__cplusplus) && __cplusplus >= 201402L
#define MFX_DEPRECATED [[deprecated]]
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]]
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#elif defined(__clang__)
#define MFX_DEPRECATED __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#elif defined(__INTEL_COMPILER)
#if (defined(_WIN32) || defined(_WIN64))
#define MFX_DEPRECATED __declspec(deprecated)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
#elif defined(__linux__)
#define MFX_DEPRECATED __attribute__((deprecated))
#if defined(__cplusplus)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#else
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#endif
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
#elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation
#define MFX_DEPRECATED __declspec(deprecated)
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
#elif defined(__GNUC__)
#define MFX_DEPRECATED __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#else
#define MFX_DEPRECATED
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
#else
#define MFX_DEPRECATED
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
#endif
typedef unsigned char mfxU8; /*!< Unsigned integer, 8 bit type. */
typedef char mfxI8; /*!< Signed integer, 8 bit type. */
typedef short mfxI16; /*!< Signed integer, 16 bit type. */
typedef unsigned short mfxU16; /*!< Unsigned integer, 16 bit type. */
typedef unsigned int mfxU32; /*!< Unsigned integer, 32 bit type. */
typedef int mfxI32; /*!< Signed integer, 32 bit type. */
#if defined( _WIN32 ) || defined ( _WIN64 )
typedef unsigned long mfxUL32; /*!< Unsigned integer, 32 bit type. */
typedef long mfxL32; /*!< Signed integer, 32 bit type. */
#else
typedef unsigned int mfxUL32; /*!< Unsigned integer, 32 bit type. */
typedef int mfxL32; /*!< Signed integer, 32 bit type. */
#endif
typedef float mfxF32; /*!< Single-precision floating point, 32 bit type. */
typedef double mfxF64; /*!< Double-precision floating point, 64 bit type. */
typedef unsigned long long mfxU64; /*!< Unsigned integer, 64 bit type. */
typedef long long mfxI64; /*!< Signed integer, 64 bit type. */
typedef void* mfxHDL; /*!< Handle type. */
typedef mfxHDL mfxMemId; /*!< Memory ID type. */
typedef void* mfxThreadTask; /*!< Thread task type. */
typedef char mfxChar; /*!< UTF-8 byte. */
/* MFX structures version info */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Introduce the field Version for any structure.
Assumed that any structure changes are backward binary compatible.
mfxStructVersion starts from {1,0} for any new API structures. If mfxStructVersion is
added to the existent legacy structure (replacing reserved fields) it starts from {1, 1}.
*/
typedef union {
/*! Structure with Major and Minor fields. */
/*! @struct Anonymous */
struct {
/*! @{
@name Major and Minor fields
Anonymous structure with Major and Minor fields. Minor number is incremented when reserved fields are used. Major number is incremented when the size of structure is increased. */
mfxU8 Minor; /*!< Minor number of the correspondent structure. */
mfxU8 Major; /*!< Major number of the correspondent structure. */
/*! @} */
};
mfxU16 Version; /*!< Structure version number. */
} mfxStructVersion;
MFX_PACK_END()
#define MFX_STRUCT_VERSION(MAJOR, MINOR) (256*(MAJOR) + (MINOR))
#define MFX_VARIANT_VERSION MFX_STRUCT_VERSION(1, 0)
/*! The mfxVariantType enumerator data types for mfxVarianf type. */
typedef enum {
MFX_VARIANT_TYPE_UNSET = 0, /*!< Undefined type. */
MFX_VARIANT_TYPE_U8 = 1, /*!< 8-bit unsigned integer. */
MFX_VARIANT_TYPE_I8, /*!< 8-bit signed integer. */
MFX_VARIANT_TYPE_U16, /*!< 16-bit unsigned integer. */
MFX_VARIANT_TYPE_I16, /*!< 16-bit signed integer. */
MFX_VARIANT_TYPE_U32, /*!< 32-bit unsigned integer. */
MFX_VARIANT_TYPE_I32, /*!< 32-bit signed integer. */
MFX_VARIANT_TYPE_U64, /*!< 64-bit unsigned integer. */
MFX_VARIANT_TYPE_I64, /*!< 64-bit signed integer. */
MFX_VARIANT_TYPE_F32, /*!< 32-bit single precision floating point. */
MFX_VARIANT_TYPE_F64, /*!< 64-bit double precision floating point. */
MFX_VARIANT_TYPE_PTR, /*!< Generic type pointer. */
} mfxVariantType;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The mfxVariantType enumerator data types for mfxVarianf type. */
typedef struct {
mfxStructVersion Version; /*!< Version of the structure. */
mfxVariantType Type; /*!< Value type. */
/*! Value data holder. */
union data {
mfxU8 U8; /*!< mfxU8 data. */
mfxI8 I8; /*!< mfxI8 data. */
mfxU16 U16; /*!< mfxU16 data. */
mfxI16 I16; /*!< mfxI16 data. */
mfxU32 U32; /*!< mfxU32 data. */
mfxI32 I32; /*!< mfxI32 data. */
mfxU64 U64; /*!< mfxU64 data. */
mfxI64 I64; /*!< mfxI64 data. */
mfxF32 F32; /*!< mfxF32 data. */
mfxF64 F64; /*!< mfxF64 data. */
mfxHDL Ptr; /*!< Pointer. */
} Data; /*!< Value data member. */
} mfxVariant;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Represents a range of unsigned values. */
typedef struct {
mfxU32 Min; /*!< Minimal value of the range. */
mfxU32 Max; /*!< Maximal value of the range. */
mfxU32 Step; /*!< Value increment. */
} mfxRange32U;
MFX_PACK_END()
/*! Represents a pair of numbers of type mfxI16. */
typedef struct {
mfxI16 x; /*!< First number. */
mfxI16 y; /*!< Second number. */
} mfxI16Pair;
/*! Represents pair of handles of type mfxHDL. */
typedef struct {
mfxHDL first; /*!< First handle. */
mfxHDL second; /*!< Second handle. */
} mfxHDLPair;
/*********************************************************************************\
Error message
\*********************************************************************************/
/*! @enum mfxStatus Itemizes status codes returned by API functions. */
typedef enum
{
/* no error */
MFX_ERR_NONE = 0, /*!< No error. */
/* reserved for unexpected errors */
MFX_ERR_UNKNOWN = -1, /*!< Unknown error. */
/* error codes <0 */
MFX_ERR_NULL_PTR = -2, /*!< Null pointer. */
MFX_ERR_UNSUPPORTED = -3, /*!< Unsupported feature. */
MFX_ERR_MEMORY_ALLOC = -4, /*!< Failed to allocate memory. */
MFX_ERR_NOT_ENOUGH_BUFFER = -5, /*!< Insufficient buffer at input/output. */
MFX_ERR_INVALID_HANDLE = -6, /*!< Invalid handle. */
MFX_ERR_LOCK_MEMORY = -7, /*!< Failed to lock the memory block. */
MFX_ERR_NOT_INITIALIZED = -8, /*!< Member function called before initialization. */
MFX_ERR_NOT_FOUND = -9, /*!< The specified object is not found. */
MFX_ERR_MORE_DATA = -10, /*!< Expect more data at input. */
MFX_ERR_MORE_SURFACE = -11, /*!< Expect more surface at output. */
MFX_ERR_ABORTED = -12, /*!< Operation aborted. */
MFX_ERR_DEVICE_LOST = -13, /*!< Lose the hardware acceleration device. */
MFX_ERR_INCOMPATIBLE_VIDEO_PARAM = -14, /*!< Incompatible video parameters. */
MFX_ERR_INVALID_VIDEO_PARAM = -15, /*!< Invalid video parameters. */
MFX_ERR_UNDEFINED_BEHAVIOR = -16, /*!< Undefined behavior. */
MFX_ERR_DEVICE_FAILED = -17, /*!< Device operation failure. */
MFX_ERR_MORE_BITSTREAM = -18, /*!< Expect more bitstream buffers at output. */
MFX_ERR_GPU_HANG = -21, /*!< Device operation failure caused by GPU hang. */
MFX_ERR_REALLOC_SURFACE = -22, /*!< Bigger output surface required. */
MFX_ERR_RESOURCE_MAPPED = -23, /*!< Write access is already acquired and user requested
another write access, or read access with MFX_MEMORY_NO_WAIT flag. */
MFX_ERR_NOT_IMPLEMENTED = -24, /*!< Feature or function not implemented. */
/* warnings >0 */
MFX_WRN_IN_EXECUTION = 1, /*!< The previous asynchronous operation is in execution. */
MFX_WRN_DEVICE_BUSY = 2, /*!< The hardware acceleration device is busy. */
MFX_WRN_VIDEO_PARAM_CHANGED = 3, /*!< The video parameters are changed during decoding. */
MFX_WRN_PARTIAL_ACCELERATION = 4, /*!< Software acceleration is used. */
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM = 5, /*!< Incompatible video parameters. */
MFX_WRN_VALUE_NOT_CHANGED = 6, /*!< The value is saturated based on its valid range. */
MFX_WRN_OUT_OF_RANGE = 7, /*!< The value is out of valid range. */
MFX_WRN_FILTER_SKIPPED = 10, /*!< One of requested filters has been skipped. */
/* low-delay partial output */
MFX_ERR_NONE_PARTIAL_OUTPUT = 12, /*!< Frame is not ready, but bitstream contains partial output. */
/* threading statuses */
MFX_TASK_DONE = MFX_ERR_NONE, /*!< Task has been completed. */
MFX_TASK_WORKING = 8, /*!< There is some more work to do. */
MFX_TASK_BUSY = 9, /*!< Task is waiting for resources. */
/* plug-in statuses */
MFX_ERR_MORE_DATA_SUBMIT_TASK = -10000, /*!< Return MFX_ERR_MORE_DATA but submit internal asynchronous task. */
} mfxStatus;
// Application
#if defined(MFX_DISPATCHER_EXPOSED_PREFIX)
#include "mfxdispatcherprefixedfunctions.h"
#endif // MFX_DISPATCHER_EXPOSED_PREFIX
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MFXDEFS_H__ */