1 /* 2 ** Copyright 2003-2010, VisualOn, Inc. 3 ** 4 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** you may not use this file except in compliance with the License. 6 ** You may obtain a copy of the License at 7 ** 8 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** 10 ** Unless required by applicable law or agreed to in writing, software 11 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** See the License for the specific language governing permissions and 14 ** limitations under the License. 15 */ 16 /******************************************************************************* 17 File: typedefs.h 18 19 Content: type defined or const defined 20 21 *******************************************************************************/ 22 23 #ifndef typedefs_h 24 #define typedefs_h "$Id $" 25 26 #ifndef CHAR_BIT 27 #define CHAR_BIT 8 /* number of bits in a char */ 28 #endif 29 30 #ifndef VOAAC_SHRT_MAX 31 #define VOAAC_SHRT_MAX (32767) /* maximum (signed) short value */ 32 #endif 33 34 #ifndef VOAAC_SHRT_MIN 35 #define VOAAC_SHRT_MIN (-32768) /* minimum (signed) short value */ 36 #endif 37 38 /* Define NULL pointer value */ 39 #ifndef NULL 40 #ifdef __cplusplus 41 #define NULL 0 42 #else 43 #define NULL ((void *)0) 44 #endif 45 #endif 46 47 #ifndef assert 48 #define assert(_Expression) ((void)0) 49 #endif 50 51 #define __inline static __inline 52 53 #define INT_BITS 32 54 /* 55 ******************************************************************************** 56 * DEFINITION OF CONSTANTS 57 ******************************************************************************** 58 */ 59 /* 60 ********* define char type 61 */ 62 typedef char Char; 63 64 /* 65 ********* define 8 bit signed/unsigned types & constants 66 */ 67 typedef signed char Word8; 68 typedef unsigned char UWord8; 69 /* 70 ********* define 16 bit signed/unsigned types & constants 71 */ 72 typedef short Word16; 73 typedef unsigned short UWord16; 74 75 /* 76 ********* define 32 bit signed/unsigned types & constants 77 */ 78 typedef int Word32; 79 typedef unsigned int UWord32; 80 81 82 83 #ifndef _MSC_VER 84 typedef long long Word64; 85 typedef unsigned long long UWord64; 86 #else 87 typedef __int64 Word64; 88 typedef unsigned __int64 UWord64; 89 #endif 90 91 #ifndef min 92 #define min(a,b) ( a < b ? a : b) 93 #endif 94 95 #ifndef max 96 #define max(a,b) ( a > b ? a : b) 97 #endif 98 99 #ifdef ARM_INASM 100 #ifdef ARMV5_INASM 101 #define ARMV5E_INASM 1 102 #endif 103 #define ARMV4_INASM 1 104 #endif 105 106 #if ARMV4_INASM 107 #define ARMV5TE_SAT 1 108 #define ARMV5TE_ADD 1 109 #define ARMV5TE_SUB 1 110 #define ARMV5TE_SHL 1 111 #define ARMV5TE_SHR 1 112 #define ARMV5TE_L_SHL 1 113 #define ARMV5TE_L_SHR 1 114 #endif//ARMV4 115 #if ARMV5E_INASM 116 #define ARMV5TE_L_ADD 1 117 #define ARMV5TE_L_SUB 1 118 #define ARMV5TE_L_MULT 1 119 #define ARMV5TE_L_MAC 1 120 #define ARMV5TE_L_MSU 1 121 122 123 #define ARMV5TE_DIV_S 1 124 #define ARMV5TE_ROUND 1 125 #define ARMV5TE_MULT 1 126 127 #define ARMV5TE_NORM_S 1 128 #define ARMV5TE_NORM_L 1 129 #define ARMV5TE_L_MPY_LS 1 130 #endif 131 #if ARMV6_INASM 132 #undef ARMV5TE_ADD 133 #define ARMV5TE_ADD 0 134 #undef ARMV5TE_SUB 135 #define ARMV5TE_SUB 0 136 #define ARMV6_SAT 1 137 #endif 138 139 //basic operation functions optimization flags 140 #define SATRUATE_IS_INLINE 1 //define saturate as inline function 141 #define SHL_IS_INLINE 1 //define shl as inline function 142 #define SHR_IS_INLINE 1 //define shr as inline function 143 #define L_MULT_IS_INLINE 1 //define L_mult as inline function 144 #define L_MSU_IS_INLINE 1 //define L_msu as inline function 145 #define L_SUB_IS_INLINE 1 //define L_sub as inline function 146 #define L_SHL_IS_INLINE 1 //define L_shl as inline function 147 #define L_SHR_IS_INLINE 1 //define L_shr as inline function 148 #define ADD_IS_INLINE 1 //define add as inline function //add, inline is the best 149 #define SUB_IS_INLINE 1 //define sub as inline function //sub, inline is the best 150 #define DIV_S_IS_INLINE 1 //define div_s as inline function 151 #define MULT_IS_INLINE 1 //define mult as inline function 152 #define NORM_S_IS_INLINE 1 //define norm_s as inline function 153 #define NORM_L_IS_INLINE 1 //define norm_l as inline function 154 #define ROUND_IS_INLINE 1 //define round as inline function 155 #define L_MAC_IS_INLINE 1 //define L_mac as inline function 156 #define L_ADD_IS_INLINE 1 //define L_add as inline function 157 #define EXTRACT_H_IS_INLINE 1 //define extract_h as inline function 158 #define EXTRACT_L_IS_INLINE 1 //define extract_l as inline function //??? 159 #define MULT_R_IS_INLINE 1 //define mult_r as inline function 160 #define SHR_R_IS_INLINE 1 //define shr_r as inline function 161 #define MAC_R_IS_INLINE 1 //define mac_r as inline function 162 #define MSU_R_IS_INLINE 1 //define msu_r as inline function 163 #define L_SHR_R_IS_INLINE 1 //define L_shr_r as inline function 164 165 #define PREFIX voAACEnc 166 #define LINK0(x, y, z) LINK1(x,y,z) 167 #define LINK1(x,y,z) x##y##z 168 #define ADD_PREFIX(func) LINK0(PREFIX, _, func) 169 170 #define L_Extract ADD_PREFIX(L_Extract) 171 #define L_Comp ADD_PREFIX(L_Comp) 172 #define Mpy_32 ADD_PREFIX(Mpy_32) 173 #define Mpy_32_16 ADD_PREFIX(Mpy_32_16) 174 #define Div_32 ADD_PREFIX(Div_32) 175 #define iLog4 ADD_PREFIX(iLog4) 176 #define rsqrt ADD_PREFIX(rsqrt) 177 #define pow2_xy ADD_PREFIX(pow2_xy) 178 #define L_mpy_ls ADD_PREFIX(L_mpy_ls) 179 #define L_mpy_wx ADD_PREFIX(L_mpy_wx) 180 181 #define mem_malloc ADD_PREFIX(mem_malloc) 182 #define mem_free ADD_PREFIX(mem_free) 183 184 #endif 185