Skip to content

Commit e90d8b4

Browse files
committed
Fixed compatibility in C API: amf_bool type, linker issues with GCC for inline functions, added UNNKNOWN enum values in encoder APIs, exposed more profiles for H.264.
Signed-off-by: mmironov <[email protected]>
1 parent 6c268f4 commit e90d8b4

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

amf/public/include/components/VideoEncoderHEVC.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ enum AMF_VIDEO_ENCODER_LEVEL_ENUM
7070

7171
enum AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM
7272
{
73+
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_UNKNOWN = -1,
7374
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP = 0,
7475
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
7576
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
@@ -106,12 +107,6 @@ enum AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM
106107
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_IDR_ALIGNED
107108
};
108109

109-
enum AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_ENUM
110-
{
111-
AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_NONE = 0,
112-
AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_AUTO
113-
};
114-
115110

116111

117112
// Static properties - can be set before Init()
@@ -140,8 +135,11 @@ enum AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_ENUM
140135
#define AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE L"HevcVBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits
141136
#define AMF_VIDEO_ENCODER_HEVC_INITIAL_VBV_BUFFER_FULLNESS L"HevcInitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100%
142137
#define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_PREANALYSIS_ENABLE L"HevcRateControlPreAnalysisEnable" // bool; default = depends on USAGE; enable Pre-analysis assisted rate control
143-
#define AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ L"HevcEnableVBAQ" // amf_int64(AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_ENUM) default = AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_NONE; Enable VBAQ
138+
#define AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ L"HevcEnableVBAQ" // // bool; default = depends on USAGE; Enable auto VBAQ
144139

140+
// Motion estimation
141+
#define AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL L"HevcHalfPixel" // bool; default= true; Half Pixel
142+
#define AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL L"HevcQuarterPixel" // bool; default= true; Quarter Pixel
145143

146144
// Dynamic properties - can be set at any time
147145

@@ -164,9 +162,6 @@ enum AMF_VIDEO_ENCODER_HEVC_VBAQ_MODE_ENUM
164162
#define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_SKIP_FRAME_ENABLE L"HevcRateControlSkipFrameEnable" // bool; default = depends on USAGE; Rate Control Based Frame Skip
165163

166164

167-
// Motion estimation
168-
#define AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL L"HevcHalfPixel" // bool; default= true; Half Pixel
169-
#define AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL L"HevcQuarterPixel" // bool; default= true; Quarter Pixel
170165

171166
// Per-submittion properties - can be set on input surface interface
172167
#define AMF_VIDEO_ENCODER_HEVC_END_OF_SEQUENCE L"HevcEndOfSequence" // bool; default = false; generate end of sequence

amf/public/include/components/VideoEncoderVCE.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ enum AMF_VIDEO_ENCODER_USAGE_ENUM
5353

5454
enum AMF_VIDEO_ENCODER_PROFILE_ENUM
5555
{
56+
AMF_VIDEO_ENCODER_PROFILE_UNKNOWN = 0,
5657
AMF_VIDEO_ENCODER_PROFILE_BASELINE = 66,
5758
AMF_VIDEO_ENCODER_PROFILE_MAIN = 77,
58-
AMF_VIDEO_ENCODER_PROFILE_HIGH = 100
59+
AMF_VIDEO_ENCODER_PROFILE_HIGH = 100,
60+
AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE = 256,
61+
AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH = 257
5962
};
6063

6164
enum AMF_VIDEO_ENCODER_SCANTYPE_ENUM
@@ -66,6 +69,7 @@ enum AMF_VIDEO_ENCODER_SCANTYPE_ENUM
6669

6770
enum AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM
6871
{
72+
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN = -1,
6973
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP = 0,
7074
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR,
7175
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
@@ -154,7 +158,7 @@ enum AMF_VIDEO_ENCODER_CODING_ENUM
154158
#define AMF_VIDEO_ENCODER_VBV_BUFFER_SIZE L"VBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits
155159
#define AMF_VIDEO_ENCODER_INITIAL_VBV_BUFFER_FULLNESS L"InitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100%
156160

157-
#define AMF_VIDEO_ENCODER_MAX_AU_SIZE L"MaxAUSize" // amf_int64; default = 60; Max AU Size in bits
161+
#define AMF_VIDEO_ENCODER_MAX_AU_SIZE L"MaxAUSize" // amf_int64; default = 0; Max AU Size in bits
158162

159163
#define AMF_VIDEO_ENCODER_MIN_QP L"MinQP" // amf_int64; default = depends on USAGE; Min QP; range = 0-51
160164
#define AMF_VIDEO_ENCODER_MAX_QP L"MaxQP" // amf_int64; default = depends on USAGE; Max QP; range = 0-51

amf/public/include/core/Platform.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,13 @@
7878
#define AMF_STD_CALL __stdcall
7979
#define AMF_CDECL_CALL __cdecl
8080
#define AMF_FAST_CALL __fastcall
81+
#if defined(__GNUC__) || defined(__clang__)
82+
#define AMF_INLINE inline
83+
#define AMF_FORCEINLINE inline
84+
#else
8185
#define AMF_INLINE __inline
8286
#define AMF_FORCEINLINE __forceinline
87+
#endif
8388
#define AMF_NO_VTABLE __declspec(novtable)
8489

8590
#define AMFPRId64 "I64d"
@@ -96,8 +101,13 @@
96101
#define AMF_STD_CALL
97102
#define AMF_CDECL_CALL
98103
#define AMF_FAST_CALL
104+
#if defined(__GNUC__) || defined(__clang__)
105+
#define AMF_INLINE inline
106+
#define AMF_FORCEINLINE inline
107+
#else
99108
#define AMF_INLINE __inline__
100109
#define AMF_FORCEINLINE __inline__
110+
#endif
101111
#define AMF_NO_VTABLE
102112

103113
#if !defined(AMFPRId64)
@@ -145,7 +155,7 @@ typedef void amf_void;
145155
#if defined(__cplusplus)
146156
typedef bool amf_bool;
147157
#else
148-
typedef amf_uint16 amf_bool;
158+
typedef amf_uint8 amf_bool;
149159
#define true 1
150160
#define false 0
151161
#endif
@@ -187,7 +197,7 @@ typedef struct AMFRect
187197
#endif
188198
} AMFRect;
189199

190-
AMF_INLINE struct AMFRect AMFConstructRect(amf_int32 left, amf_int32 top, amf_int32 right, amf_int32 bottom)
200+
static AMF_INLINE struct AMFRect AMFConstructRect(amf_int32 left, amf_int32 top, amf_int32 right, amf_int32 bottom)
191201
{
192202
struct AMFRect object = {left, top, right, bottom};
193203
return object;
@@ -206,7 +216,7 @@ typedef struct AMFSize
206216
#endif
207217
} AMFSize;
208218

209-
AMF_INLINE struct AMFSize AMFConstructSize(amf_int32 width, amf_int32 height)
219+
static AMF_INLINE struct AMFSize AMFConstructSize(amf_int32 width, amf_int32 height)
210220
{
211221
struct AMFSize object = {width, height};
212222
return object;
@@ -225,7 +235,7 @@ typedef struct AMFPoint
225235
#endif
226236
} AMFPoint;
227237

228-
AMF_INLINE struct AMFPoint AMFConstructPoint(amf_int32 x, amf_int32 y)
238+
static AMF_INLINE struct AMFPoint AMFConstructPoint(amf_int32 x, amf_int32 y)
229239
{
230240
struct AMFPoint object = {x, y};
231241
return object;
@@ -244,7 +254,7 @@ typedef struct AMFRate
244254
#endif
245255
} AMFRate;
246256

247-
AMF_INLINE struct AMFRate AMFConstructRate(amf_uint32 num, amf_uint32 den)
257+
static AMF_INLINE struct AMFRate AMFConstructRate(amf_uint32 num, amf_uint32 den)
248258
{
249259
struct AMFRate object = {num, den};
250260
return object;
@@ -263,7 +273,7 @@ typedef struct AMFRatio
263273
#endif
264274
} AMFRatio;
265275

266-
AMF_INLINE struct AMFRatio AMFConstructRatio(amf_uint32 num, amf_uint32 den)
276+
static AMF_INLINE struct AMFRatio AMFConstructRatio(amf_uint32 num, amf_uint32 den)
267277
{
268278
struct AMFRatio object = {num, den};
269279
return object;
@@ -306,7 +316,7 @@ typedef struct AMFColor
306316
#pragma pack(pop)
307317

308318

309-
AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8 b, amf_uint8 a)
319+
static AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8 b, amf_uint8 a)
310320
{
311321
struct AMFColor object;
312322
object.r = r;
@@ -324,11 +334,11 @@ AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8
324334
{
325335
#endif
326336
// allocator
327-
AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
337+
static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
328338
{
329339
return CoTaskMemAlloc(count);
330340
}
331-
AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
341+
static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
332342
{
333343
CoTaskMemFree(ptr);
334344
}
@@ -343,11 +353,11 @@ AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8
343353
{
344354
#endif
345355
// allocator
346-
AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
356+
static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
347357
{
348358
return malloc(count);
349359
}
350-
AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
360+
static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
351361
{
352362
free(ptr);
353363
}

0 commit comments

Comments
 (0)