/src/libmpeg2/common/x86/icv_platform_macros.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Copyright (C) 2015 The Android Open Source Project |
4 | | * |
5 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | * you may not use this file except in compliance with the License. |
7 | | * You may obtain a copy of the License at: |
8 | | * |
9 | | * http://www.apache.org/licenses/LICENSE-2.0 |
10 | | * |
11 | | * Unless required by applicable law or agreed to in writing, software |
12 | | * distributed under the License is distributed on an "AS IS" BASIS, |
13 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | * See the License for the specific language governing permissions and |
15 | | * limitations under the License. |
16 | | * |
17 | | ***************************************************************************** |
18 | | * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore |
19 | | */ |
20 | | /** |
21 | | ******************************************************************************* |
22 | | * @file |
23 | | * icv_platform_macros.h |
24 | | * |
25 | | * @brief |
26 | | * This header files contains all the platform/toolchain specific macros |
27 | | * |
28 | | * @author |
29 | | * Ittiam |
30 | | * |
31 | | * @par List of Functions: |
32 | | * |
33 | | * @remarks |
34 | | * None |
35 | | * |
36 | | ******************************************************************************* |
37 | | */ |
38 | | #ifndef _ICV_PLATFORM_MACROS_H_ |
39 | | #define _ICV_PLATFORM_MACROS_H_ |
40 | | |
41 | | static __inline UWORD32 CLZ(UWORD32 u4_word) |
42 | 0 | { |
43 | 0 | if(u4_word) |
44 | 0 | return(__builtin_clz(u4_word)); |
45 | 0 | else |
46 | 0 | return 32; |
47 | 0 | } Unexecuted instantiation: ideint.c:CLZ Unexecuted instantiation: ideint_utils.c:CLZ Unexecuted instantiation: ideint_function_selector.c:CLZ Unexecuted instantiation: ideint_function_selector_sse42.c:CLZ Unexecuted instantiation: ideint_function_selector_ssse3.c:CLZ Unexecuted instantiation: ideint_spatial_filter_ssse3.c:CLZ Unexecuted instantiation: ideint_function_selector_generic.c:CLZ Unexecuted instantiation: icv_sad_ssse3.c:CLZ Unexecuted instantiation: icv_variance_ssse3.c:CLZ Unexecuted instantiation: icv_sad.c:CLZ Unexecuted instantiation: icv_variance.c:CLZ |
48 | | |
49 | | static __inline UWORD32 CLZNZ(UWORD32 u4_word) |
50 | 0 | { |
51 | 0 | ASSERT(u4_word); |
52 | 0 | return(__builtin_clz(u4_word)); |
53 | 0 | } Unexecuted instantiation: ideint.c:CLZNZ Unexecuted instantiation: ideint_utils.c:CLZNZ Unexecuted instantiation: ideint_function_selector.c:CLZNZ Unexecuted instantiation: ideint_function_selector_sse42.c:CLZNZ Unexecuted instantiation: ideint_function_selector_ssse3.c:CLZNZ Unexecuted instantiation: ideint_spatial_filter_ssse3.c:CLZNZ Unexecuted instantiation: ideint_function_selector_generic.c:CLZNZ Unexecuted instantiation: icv_sad_ssse3.c:CLZNZ Unexecuted instantiation: icv_variance_ssse3.c:CLZNZ Unexecuted instantiation: icv_sad.c:CLZNZ Unexecuted instantiation: icv_variance.c:CLZNZ |
54 | | |
55 | | static __inline UWORD32 CTZ(UWORD32 u4_word) |
56 | 0 | { |
57 | 0 | if(0 == u4_word) |
58 | 0 | return 31; |
59 | 0 | else |
60 | 0 | { |
61 | 0 | unsigned int index; |
62 | 0 | index = __builtin_ctz(u4_word); |
63 | 0 | return (UWORD32)index; |
64 | 0 | } |
65 | 0 | } Unexecuted instantiation: ideint.c:CTZ Unexecuted instantiation: ideint_utils.c:CTZ Unexecuted instantiation: ideint_function_selector.c:CTZ Unexecuted instantiation: ideint_function_selector_sse42.c:CTZ Unexecuted instantiation: ideint_function_selector_ssse3.c:CTZ Unexecuted instantiation: ideint_spatial_filter_ssse3.c:CTZ Unexecuted instantiation: ideint_function_selector_generic.c:CTZ Unexecuted instantiation: icv_sad_ssse3.c:CTZ Unexecuted instantiation: icv_variance_ssse3.c:CTZ Unexecuted instantiation: icv_sad.c:CTZ Unexecuted instantiation: icv_variance.c:CTZ |
66 | | |
67 | | #define CLIP_U8(x) CLIP3(0, 255, (x)) |
68 | | #define CLIP_S8(x) CLIP3(-128, 127, (x)) |
69 | | |
70 | | #define CLIP_U10(x) CLIP3(0, 1023, (x)) |
71 | | #define CLIP_S10(x) CLIP3(-512, 511, (x)) |
72 | | |
73 | | #define CLIP_U12(x) CLIP3(0, 4095, (x)) |
74 | | #define CLIP_S12(x) CLIP3(-2048, 2047, (x)) |
75 | | |
76 | | #define CLIP_U16(x) CLIP3(0, 65535, (x)) |
77 | | #define CLIP_S16(x) CLIP3(-32768, 32767, (x)) |
78 | | |
79 | | #define ITT_BIG_ENDIAN(x) __builtin_bswap32(x); |
80 | | |
81 | | #define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");} |
82 | | #define PREFETCH(x) __builtin_prefetch(x); |
83 | | |
84 | | #define DATA_SYNC() __sync_synchronize() |
85 | | |
86 | | #define SHL(x,y) (((y) < 32) ? ((x) << (y)) : 0) |
87 | | #define SHR(x,y) (((y) < 32) ? ((x) >> (y)) : 0) |
88 | | |
89 | | #define SHR_NEG(val,shift) (((shift) > 0) ? ( (val) >> (shift)) : ((val) << (-(shift)))) |
90 | | #define SHL_NEG(val,shift) (((shift) > 0) ? ( (val) >> (-(shift))) : ((val) << (shift))) |
91 | | |
92 | | #define MEM_ALIGN8 __attribute__ ((aligned (8))) |
93 | | #define MEM_ALIGN16 __attribute__ ((aligned (16))) |
94 | | #define MEM_ALIGN32 __attribute__ ((aligned (32))) |
95 | | |
96 | | |
97 | | #endif /* _ICV_PLATFORM_MACROS_H_ */ |