1 //===----- opencl-c-base.h - OpenCL C language base definitions -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _OPENCL_BASE_H_
10 #define _OPENCL_BASE_H_
11 
12 // Define extension macros
13 
14 #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
15 // For SPIR all extensions are supported.
16 #if defined(__SPIR__)
17 #define cl_khr_subgroup_extended_types 1
18 #define cl_khr_subgroup_non_uniform_vote 1
19 #define cl_khr_subgroup_ballot 1
20 #define cl_khr_subgroup_non_uniform_arithmetic 1
21 #define cl_khr_subgroup_shuffle 1
22 #define cl_khr_subgroup_shuffle_relative 1
23 #define cl_khr_subgroup_clustered_reduce 1
24 #endif // defined(__SPIR__)
25 #endif // (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
26 
27 // built-in scalar data types:
28 
29 /**
30  * An unsigned 8-bit integer.
31  */
32 typedef unsigned char uchar;
33 
34 /**
35  * An unsigned 16-bit integer.
36  */
37 typedef unsigned short ushort;
38 
39 /**
40  * An unsigned 32-bit integer.
41  */
42 typedef unsigned int uint;
43 
44 /**
45  * An unsigned 64-bit integer.
46  */
47 typedef unsigned long ulong;
48 
49 /**
50  * The unsigned integer type of the result of the sizeof operator. This
51  * is a 32-bit unsigned integer if CL_DEVICE_ADDRESS_BITS
52  * defined in table 4.3 is 32-bits and is a 64-bit unsigned integer if
53  * CL_DEVICE_ADDRESS_BITS is 64-bits.
54  */
55 typedef __SIZE_TYPE__ size_t;
56 
57 /**
58  * A signed integer type that is the result of subtracting two pointers.
59  * This is a 32-bit signed integer if CL_DEVICE_ADDRESS_BITS
60  * defined in table 4.3 is 32-bits and is a 64-bit signed integer if
61  * CL_DEVICE_ADDRESS_BITS is 64-bits.
62  */
63 typedef __PTRDIFF_TYPE__ ptrdiff_t;
64 
65 /**
66  * A signed integer type with the property that any valid pointer to
67  * void can be converted to this type, then converted back to pointer
68  * to void, and the result will compare equal to the original pointer.
69  */
70 typedef __INTPTR_TYPE__ intptr_t;
71 
72 /**
73  * An unsigned integer type with the property that any valid pointer to
74  * void can be converted to this type, then converted back to pointer
75  * to void, and the result will compare equal to the original pointer.
76  */
77 typedef __UINTPTR_TYPE__ uintptr_t;
78 
79 // built-in vector data types:
80 typedef char char2 __attribute__((ext_vector_type(2)));
81 typedef char char3 __attribute__((ext_vector_type(3)));
82 typedef char char4 __attribute__((ext_vector_type(4)));
83 typedef char char8 __attribute__((ext_vector_type(8)));
84 typedef char char16 __attribute__((ext_vector_type(16)));
85 typedef uchar uchar2 __attribute__((ext_vector_type(2)));
86 typedef uchar uchar3 __attribute__((ext_vector_type(3)));
87 typedef uchar uchar4 __attribute__((ext_vector_type(4)));
88 typedef uchar uchar8 __attribute__((ext_vector_type(8)));
89 typedef uchar uchar16 __attribute__((ext_vector_type(16)));
90 typedef short short2 __attribute__((ext_vector_type(2)));
91 typedef short short3 __attribute__((ext_vector_type(3)));
92 typedef short short4 __attribute__((ext_vector_type(4)));
93 typedef short short8 __attribute__((ext_vector_type(8)));
94 typedef short short16 __attribute__((ext_vector_type(16)));
95 typedef ushort ushort2 __attribute__((ext_vector_type(2)));
96 typedef ushort ushort3 __attribute__((ext_vector_type(3)));
97 typedef ushort ushort4 __attribute__((ext_vector_type(4)));
98 typedef ushort ushort8 __attribute__((ext_vector_type(8)));
99 typedef ushort ushort16 __attribute__((ext_vector_type(16)));
100 typedef int int2 __attribute__((ext_vector_type(2)));
101 typedef int int3 __attribute__((ext_vector_type(3)));
102 typedef int int4 __attribute__((ext_vector_type(4)));
103 typedef int int8 __attribute__((ext_vector_type(8)));
104 typedef int int16 __attribute__((ext_vector_type(16)));
105 typedef uint uint2 __attribute__((ext_vector_type(2)));
106 typedef uint uint3 __attribute__((ext_vector_type(3)));
107 typedef uint uint4 __attribute__((ext_vector_type(4)));
108 typedef uint uint8 __attribute__((ext_vector_type(8)));
109 typedef uint uint16 __attribute__((ext_vector_type(16)));
110 typedef long long2 __attribute__((ext_vector_type(2)));
111 typedef long long3 __attribute__((ext_vector_type(3)));
112 typedef long long4 __attribute__((ext_vector_type(4)));
113 typedef long long8 __attribute__((ext_vector_type(8)));
114 typedef long long16 __attribute__((ext_vector_type(16)));
115 typedef ulong ulong2 __attribute__((ext_vector_type(2)));
116 typedef ulong ulong3 __attribute__((ext_vector_type(3)));
117 typedef ulong ulong4 __attribute__((ext_vector_type(4)));
118 typedef ulong ulong8 __attribute__((ext_vector_type(8)));
119 typedef ulong ulong16 __attribute__((ext_vector_type(16)));
120 typedef float float2 __attribute__((ext_vector_type(2)));
121 typedef float float3 __attribute__((ext_vector_type(3)));
122 typedef float float4 __attribute__((ext_vector_type(4)));
123 typedef float float8 __attribute__((ext_vector_type(8)));
124 typedef float float16 __attribute__((ext_vector_type(16)));
125 #ifdef cl_khr_fp16
126 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
127 typedef half half2 __attribute__((ext_vector_type(2)));
128 typedef half half3 __attribute__((ext_vector_type(3)));
129 typedef half half4 __attribute__((ext_vector_type(4)));
130 typedef half half8 __attribute__((ext_vector_type(8)));
131 typedef half half16 __attribute__((ext_vector_type(16)));
132 #endif
133 #ifdef cl_khr_fp64
134 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
135 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
136 #endif
137 typedef double double2 __attribute__((ext_vector_type(2)));
138 typedef double double3 __attribute__((ext_vector_type(3)));
139 typedef double double4 __attribute__((ext_vector_type(4)));
140 typedef double double8 __attribute__((ext_vector_type(8)));
141 typedef double double16 __attribute__((ext_vector_type(16)));
142 #endif
143 
144 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
145 #define NULL ((void*)0)
146 #endif
147 
148 /**
149  * Value of maximum non-infinite single-precision floating-point
150  * number.
151  */
152 #define MAXFLOAT 0x1.fffffep127f
153 
154 /**
155  * A positive float constant expression. HUGE_VALF evaluates
156  * to +infinity. Used as an error value returned by the built-in
157  * math functions.
158  */
159 #define HUGE_VALF (__builtin_huge_valf())
160 
161 /**
162  * A positive double constant expression. HUGE_VAL evaluates
163  * to +infinity. Used as an error value returned by the built-in
164  * math functions.
165  */
166 #define HUGE_VAL (__builtin_huge_val())
167 
168 /**
169  * A constant expression of type float representing positive or
170  * unsigned infinity.
171  */
172 #define INFINITY (__builtin_inff())
173 
174 /**
175  * A constant expression of type float representing a quiet NaN.
176  */
177 #define NAN as_float(INT_MAX)
178 
179 #define FP_ILOGB0    INT_MIN
180 #define FP_ILOGBNAN  INT_MAX
181 
182 #define FLT_DIG 6
183 #define FLT_MANT_DIG 24
184 #define FLT_MAX_10_EXP +38
185 #define FLT_MAX_EXP +128
186 #define FLT_MIN_10_EXP -37
187 #define FLT_MIN_EXP -125
188 #define FLT_RADIX 2
189 #define FLT_MAX 0x1.fffffep127f
190 #define FLT_MIN 0x1.0p-126f
191 #define FLT_EPSILON 0x1.0p-23f
192 
193 #define M_E_F         2.71828182845904523536028747135266250f
194 #define M_LOG2E_F     1.44269504088896340735992468100189214f
195 #define M_LOG10E_F    0.434294481903251827651128918916605082f
196 #define M_LN2_F       0.693147180559945309417232121458176568f
197 #define M_LN10_F      2.30258509299404568401799145468436421f
198 #define M_PI_F        3.14159265358979323846264338327950288f
199 #define M_PI_2_F      1.57079632679489661923132169163975144f
200 #define M_PI_4_F      0.785398163397448309615660845819875721f
201 #define M_1_PI_F      0.318309886183790671537767526745028724f
202 #define M_2_PI_F      0.636619772367581343075535053490057448f
203 #define M_2_SQRTPI_F  1.12837916709551257389615890312154517f
204 #define M_SQRT2_F     1.41421356237309504880168872420969808f
205 #define M_SQRT1_2_F   0.707106781186547524400844362104849039f
206 
207 #define DBL_DIG 15
208 #define DBL_MANT_DIG 53
209 #define DBL_MAX_10_EXP +308
210 #define DBL_MAX_EXP +1024
211 #define DBL_MIN_10_EXP -307
212 #define DBL_MIN_EXP -1021
213 #define DBL_RADIX 2
214 #define DBL_MAX 0x1.fffffffffffffp1023
215 #define DBL_MIN 0x1.0p-1022
216 #define DBL_EPSILON 0x1.0p-52
217 
218 #define M_E           0x1.5bf0a8b145769p+1
219 #define M_LOG2E       0x1.71547652b82fep+0
220 #define M_LOG10E      0x1.bcb7b1526e50ep-2
221 #define M_LN2         0x1.62e42fefa39efp-1
222 #define M_LN10        0x1.26bb1bbb55516p+1
223 #define M_PI          0x1.921fb54442d18p+1
224 #define M_PI_2        0x1.921fb54442d18p+0
225 #define M_PI_4        0x1.921fb54442d18p-1
226 #define M_1_PI        0x1.45f306dc9c883p-2
227 #define M_2_PI        0x1.45f306dc9c883p-1
228 #define M_2_SQRTPI    0x1.20dd750429b6dp+0
229 #define M_SQRT2       0x1.6a09e667f3bcdp+0
230 #define M_SQRT1_2     0x1.6a09e667f3bcdp-1
231 
232 #ifdef cl_khr_fp16
233 
234 #define HALF_DIG 3
235 #define HALF_MANT_DIG 11
236 #define HALF_MAX_10_EXP +4
237 #define HALF_MAX_EXP +16
238 #define HALF_MIN_10_EXP -4
239 #define HALF_MIN_EXP -13
240 #define HALF_RADIX 2
241 #define HALF_MAX ((0x1.ffcp15h))
242 #define HALF_MIN ((0x1.0p-14h))
243 #define HALF_EPSILON ((0x1.0p-10h))
244 
245 #define M_E_H         2.71828182845904523536028747135266250h
246 #define M_LOG2E_H     1.44269504088896340735992468100189214h
247 #define M_LOG10E_H    0.434294481903251827651128918916605082h
248 #define M_LN2_H       0.693147180559945309417232121458176568h
249 #define M_LN10_H      2.30258509299404568401799145468436421h
250 #define M_PI_H        3.14159265358979323846264338327950288h
251 #define M_PI_2_H      1.57079632679489661923132169163975144h
252 #define M_PI_4_H      0.785398163397448309615660845819875721h
253 #define M_1_PI_H      0.318309886183790671537767526745028724h
254 #define M_2_PI_H      0.636619772367581343075535053490057448h
255 #define M_2_SQRTPI_H  1.12837916709551257389615890312154517h
256 #define M_SQRT2_H     1.41421356237309504880168872420969808h
257 #define M_SQRT1_2_H   0.707106781186547524400844362104849039h
258 
259 #endif //cl_khr_fp16
260 
261 #define CHAR_BIT  8
262 #define SCHAR_MAX 127
263 #define SCHAR_MIN (-128)
264 #define UCHAR_MAX 255
265 #define CHAR_MAX  SCHAR_MAX
266 #define CHAR_MIN  SCHAR_MIN
267 #define USHRT_MAX 65535
268 #define SHRT_MAX  32767
269 #define SHRT_MIN  (-32768)
270 #define UINT_MAX  0xffffffff
271 #define INT_MAX   2147483647
272 #define INT_MIN   (-2147483647-1)
273 #define ULONG_MAX 0xffffffffffffffffUL
274 #define LONG_MAX  0x7fffffffffffffffL
275 #define LONG_MIN  (-0x7fffffffffffffffL-1)
276 
277 // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions
278 
279 // Flag type and values for barrier, mem_fence, read_mem_fence, write_mem_fence
280 typedef uint cl_mem_fence_flags;
281 
282 /**
283  * Queue a memory fence to ensure correct
284  * ordering of memory operations to local memory
285  */
286 #define CLK_LOCAL_MEM_FENCE    0x01
287 
288 /**
289  * Queue a memory fence to ensure correct
290  * ordering of memory operations to global memory
291  */
292 #define CLK_GLOBAL_MEM_FENCE   0x02
293 
294 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
295 
296 typedef enum memory_scope {
297   memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
298   memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
299   memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
300   memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
301 #if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
302   memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
303 #endif
304 } memory_scope;
305 
306 /**
307  * Queue a memory fence to ensure correct ordering of memory
308  * operations between work-items of a work-group to
309  * image memory.
310  */
311 #define CLK_IMAGE_MEM_FENCE  0x04
312 
313 #ifndef ATOMIC_VAR_INIT
314 #define ATOMIC_VAR_INIT(x) (x)
315 #endif //ATOMIC_VAR_INIT
316 #define ATOMIC_FLAG_INIT 0
317 
318 // enum values aligned with what clang uses in EmitAtomicExpr()
319 typedef enum memory_order
320 {
321   memory_order_relaxed = __ATOMIC_RELAXED,
322   memory_order_acquire = __ATOMIC_ACQUIRE,
323   memory_order_release = __ATOMIC_RELEASE,
324   memory_order_acq_rel = __ATOMIC_ACQ_REL,
325   memory_order_seq_cst = __ATOMIC_SEQ_CST
326 } memory_order;
327 
328 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
329 
330 // OpenCL v1.1 s6.11.3, v1.2 s6.12.14, v2.0 s6.13.14 - Image Read and Write Functions
331 
332 // These values need to match the runtime equivalent
333 //
334 // Addressing Mode.
335 //
336 #define CLK_ADDRESS_NONE                0
337 #define CLK_ADDRESS_CLAMP_TO_EDGE       2
338 #define CLK_ADDRESS_CLAMP               4
339 #define CLK_ADDRESS_REPEAT              6
340 #define CLK_ADDRESS_MIRRORED_REPEAT     8
341 
342 //
343 // Coordination Normalization
344 //
345 #define CLK_NORMALIZED_COORDS_FALSE     0
346 #define CLK_NORMALIZED_COORDS_TRUE      1
347 
348 //
349 // Filtering Mode.
350 //
351 #define CLK_FILTER_NEAREST              0x10
352 #define CLK_FILTER_LINEAR               0x20
353 
354 #ifdef cl_khr_gl_msaa_sharing
355 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
356 #endif //cl_khr_gl_msaa_sharing
357 
358 //
359 // Channel Datatype.
360 //
361 #define CLK_SNORM_INT8        0x10D0
362 #define CLK_SNORM_INT16       0x10D1
363 #define CLK_UNORM_INT8        0x10D2
364 #define CLK_UNORM_INT16       0x10D3
365 #define CLK_UNORM_SHORT_565   0x10D4
366 #define CLK_UNORM_SHORT_555   0x10D5
367 #define CLK_UNORM_INT_101010  0x10D6
368 #define CLK_SIGNED_INT8       0x10D7
369 #define CLK_SIGNED_INT16      0x10D8
370 #define CLK_SIGNED_INT32      0x10D9
371 #define CLK_UNSIGNED_INT8     0x10DA
372 #define CLK_UNSIGNED_INT16    0x10DB
373 #define CLK_UNSIGNED_INT32    0x10DC
374 #define CLK_HALF_FLOAT        0x10DD
375 #define CLK_FLOAT             0x10DE
376 #define CLK_UNORM_INT24       0x10DF
377 
378 // Channel order, numbering must be aligned with cl_channel_order in cl.h
379 //
380 #define CLK_R         0x10B0
381 #define CLK_A         0x10B1
382 #define CLK_RG        0x10B2
383 #define CLK_RA        0x10B3
384 #define CLK_RGB       0x10B4
385 #define CLK_RGBA      0x10B5
386 #define CLK_BGRA      0x10B6
387 #define CLK_ARGB      0x10B7
388 #define CLK_INTENSITY 0x10B8
389 #define CLK_LUMINANCE 0x10B9
390 #define CLK_Rx                0x10BA
391 #define CLK_RGx               0x10BB
392 #define CLK_RGBx              0x10BC
393 #define CLK_DEPTH             0x10BD
394 #define CLK_DEPTH_STENCIL     0x10BE
395 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
396 #define CLK_sRGB              0x10BF
397 #define CLK_sRGBx             0x10C0
398 #define CLK_sRGBA             0x10C1
399 #define CLK_sBGRA             0x10C2
400 #define CLK_ABGR              0x10C3
401 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
402 
403 // OpenCL v2.0 s6.13.16 - Pipe Functions
404 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
405 #define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), reserve_id_t))
406 
407 // OpenCL v2.0 s6.13.17 - Enqueue Kernels
408 #define CL_COMPLETE                                 0x0
409 #define CL_RUNNING                                  0x1
410 #define CL_SUBMITTED                                0x2
411 #define CL_QUEUED                                   0x3
412 
413 #define CLK_SUCCESS                                 0
414 #define CLK_ENQUEUE_FAILURE                         -101
415 #define CLK_INVALID_QUEUE                           -102
416 #define CLK_INVALID_NDRANGE                         -160
417 #define CLK_INVALID_EVENT_WAIT_LIST                 -57
418 #define CLK_DEVICE_QUEUE_FULL                       -161
419 #define CLK_INVALID_ARG_SIZE                        -51
420 #define CLK_EVENT_ALLOCATION_FAILURE                -100
421 #define CLK_OUT_OF_RESOURCES                        -5
422 
423 #define CLK_NULL_QUEUE                              0
424 #define CLK_NULL_EVENT (__builtin_astype(((__SIZE_MAX__)), clk_event_t))
425 
426 // execution model related definitions
427 #define CLK_ENQUEUE_FLAGS_NO_WAIT                   0x0
428 #define CLK_ENQUEUE_FLAGS_WAIT_KERNEL               0x1
429 #define CLK_ENQUEUE_FLAGS_WAIT_WORK_GROUP           0x2
430 
431 typedef int kernel_enqueue_flags_t;
432 typedef int clk_profiling_info;
433 
434 // Profiling info name (see capture_event_profiling_info)
435 #define CLK_PROFILING_COMMAND_EXEC_TIME 0x1
436 
437 #define MAX_WORK_DIM 3
438 
439 typedef struct {
440   unsigned int workDimension;
441   size_t globalWorkOffset[MAX_WORK_DIM];
442   size_t globalWorkSize[MAX_WORK_DIM];
443   size_t localWorkSize[MAX_WORK_DIM];
444 } ndrange_t;
445 
446 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
447 
448 #ifdef cl_intel_device_side_avc_motion_estimation
449 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : begin
450 
451 #define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0
452 #define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1
453 #define CLK_AVC_ME_MAJOR_8x16_INTEL 0x2
454 #define CLK_AVC_ME_MAJOR_8x8_INTEL 0x3
455 
456 #define CLK_AVC_ME_MINOR_8x8_INTEL 0x0
457 #define CLK_AVC_ME_MINOR_8x4_INTEL 0x1
458 #define CLK_AVC_ME_MINOR_4x8_INTEL 0x2
459 #define CLK_AVC_ME_MINOR_4x4_INTEL 0x3
460 
461 #define CLK_AVC_ME_MAJOR_FORWARD_INTEL 0x0
462 #define CLK_AVC_ME_MAJOR_BACKWARD_INTEL 0x1
463 #define CLK_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2
464 
465 #define CLK_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0
466 #define CLK_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E
467 #define CLK_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D
468 #define CLK_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B
469 #define CLK_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77
470 #define CLK_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F
471 #define CLK_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F
472 #define CLK_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F
473 
474 #define CLK_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0
475 #define CLK_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1
476 #define CLK_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2
477 
478 #define CLK_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0
479 #define CLK_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1
480 #define CLK_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2
481 #define CLK_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3
482 #define CLK_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4
483 #define CLK_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5
484 #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6
485 #define CLK_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7
486 #define CLK_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8
487 
488 #define CLK_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
489 #define CLK_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2
490 
491 #define CLK_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
492 #define CLK_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
493 #define CLK_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3
494 
495 #define CLK_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0
496 #define CLK_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1
497 #define CLK_AVC_ME_COST_PRECISION_PEL_INTEL 0x2
498 #define CLK_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3
499 
500 #define CLK_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10
501 #define CLK_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15
502 #define CLK_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20
503 #define CLK_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B
504 #define CLK_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30
505 
506 #define CLK_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0
507 #define CLK_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2
508 #define CLK_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4
509 #define CLK_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8
510 
511 #define CLK_AVC_ME_INTRA_16x16_INTEL 0x0
512 #define CLK_AVC_ME_INTRA_8x8_INTEL 0x1
513 #define CLK_AVC_ME_INTRA_4x4_INTEL 0x2
514 
515 #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0
516 #define CLK_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000
517 
518 #define CLK_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24)
519 #define CLK_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24)
520 #define CLK_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24)
521 #define CLK_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24)
522 #define CLK_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24)
523 #define CLK_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24)
524 #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24)
525 #define CLK_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24)
526 #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26)
527 #define CLK_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26)
528 #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28)
529 #define CLK_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28)
530 #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30)
531 #define CLK_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30)
532 
533 #define CLK_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00
534 #define CLK_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80
535 
536 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_ALL_INTEL 0x0
537 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6
538 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5
539 #define CLK_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3
540 
541 #define CLK_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60
542 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10
543 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8
544 #define CLK_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4
545 
546 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
547 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
548 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
549 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
550 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
551 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
552 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
553 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
554 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
555 #define CLK_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
556 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
557 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
558 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
559 #define CLK_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
560 
561 #define CLK_AVC_ME_FRAME_FORWARD_INTEL 0x1
562 #define CLK_AVC_ME_FRAME_BACKWARD_INTEL 0x2
563 #define CLK_AVC_ME_FRAME_DUAL_INTEL 0x3
564 
565 #define CLK_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0
566 #define CLK_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1
567 
568 #define CLK_AVC_ME_INITIALIZE_INTEL 0x0
569 
570 #define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL 0x0
571 #define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL 0x0
572 #define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL 0x0
573 
574 #define CLK_AVC_IME_RESULT_INITIALIZE_INTEL 0x0
575 #define CLK_AVC_REF_RESULT_INITIALIZE_INTEL 0x0
576 #define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL 0x0
577 
578 #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0
579 #define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0
580 #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0
581 #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0
582 
583 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end
584 #endif // cl_intel_device_side_avc_motion_estimation
585 
586 // Disable any extensions we may have enabled previously.
587 #pragma OPENCL EXTENSION all : disable
588 
589 #endif //_OPENCL_BASE_H_
590