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#ifdef LINUX 52#define __inline static __inline__ 53#endif 54 55#define INT_BITS 32 56/* 57******************************************************************************** 58* DEFINITION OF CONSTANTS 59******************************************************************************** 60*/ 61/* 62 ********* define char type 63 */ 64typedef char Char; 65 66/* 67 ********* define 8 bit signed/unsigned types & constants 68 */ 69typedef signed char Word8; 70typedef unsigned char UWord8; 71/* 72 ********* define 16 bit signed/unsigned types & constants 73 */ 74typedef short Word16; 75typedef unsigned short UWord16; 76 77/* 78 ********* define 32 bit signed/unsigned types & constants 79 */ 80typedef long Word32; 81typedef unsigned long UWord32; 82 83 84 85#ifdef LINUX 86typedef long long Word64; 87typedef unsigned long long UWord64; 88#else 89typedef __int64 Word64; 90typedef unsigned __int64 UWord64; 91#endif 92 93#ifndef min 94#define min(a,b) ( a < b ? a : b) 95#endif 96 97#ifndef max 98#define max(a,b) ( a > b ? a : b) 99#endif 100 101#ifdef ARM_INASM 102#ifdef ARMV5_INASM 103#define ARMV5E_INASM 1 104#endif 105#define ARMV4_INASM 1 106#endif 107 108#if ARMV4_INASM 109 #define ARMV5TE_SAT 1 110 #define ARMV5TE_ADD 1 111 #define ARMV5TE_SUB 1 112 #define ARMV5TE_SHL 1 113 #define ARMV5TE_SHR 1 114 #define ARMV5TE_L_SHL 1 115 #define ARMV5TE_L_SHR 1 116#endif//ARMV4 117#if ARMV5E_INASM 118 #define ARMV5TE_L_ADD 1 119 #define ARMV5TE_L_SUB 1 120 #define ARMV5TE_L_MULT 1 121 #define ARMV5TE_L_MAC 1 122 #define ARMV5TE_L_MSU 1 123 124 125 #define ARMV5TE_DIV_S 1 126 #define ARMV5TE_ROUND 1 127 #define ARMV5TE_MULT 1 128 129 #define ARMV5TE_NORM_S 1 130 #define ARMV5TE_NORM_L 1 131 #define ARMV5TE_L_MPY_LS 1 132#endif 133 134//basic operation functions optimization flags 135#define SATRUATE_IS_INLINE 1 //define saturate as inline function 136#define SHL_IS_INLINE 1 //define shl as inline function 137#define SHR_IS_INLINE 1 //define shr as inline function 138#define L_MULT_IS_INLINE 1 //define L_mult as inline function 139#define L_MSU_IS_INLINE 1 //define L_msu as inline function 140#define L_SUB_IS_INLINE 1 //define L_sub as inline function 141#define L_SHL_IS_INLINE 1 //define L_shl as inline function 142#define L_SHR_IS_INLINE 1 //define L_shr as inline function 143#define ADD_IS_INLINE 1 //define add as inline function //add, inline is the best 144#define SUB_IS_INLINE 1 //define sub as inline function //sub, inline is the best 145#define DIV_S_IS_INLINE 1 //define div_s as inline function 146#define MULT_IS_INLINE 1 //define mult as inline function 147#define NORM_S_IS_INLINE 1 //define norm_s as inline function 148#define NORM_L_IS_INLINE 1 //define norm_l as inline function 149#define ROUND_IS_INLINE 1 //define round as inline function 150#define L_MAC_IS_INLINE 1 //define L_mac as inline function 151#define L_ADD_IS_INLINE 1 //define L_add as inline function 152#define EXTRACT_H_IS_INLINE 1 //define extract_h as inline function 153#define EXTRACT_L_IS_INLINE 1 //define extract_l as inline function //??? 154#define MULT_R_IS_INLINE 1 //define mult_r as inline function 155#define SHR_R_IS_INLINE 1 //define shr_r as inline function 156#define MAC_R_IS_INLINE 1 //define mac_r as inline function 157#define MSU_R_IS_INLINE 1 //define msu_r as inline function 158#define L_SHR_R_IS_INLINE 1 //define L_shr_r as inline function 159 160#define PREFIX voAACEnc 161#define LINK0(x, y, z) LINK1(x,y,z) 162#define LINK1(x,y,z) x##y##z 163#define ADD_PREFIX(func) LINK0(PREFIX, _, func) 164 165#define L_Extract ADD_PREFIX(L_Extract) 166#define L_Comp ADD_PREFIX(L_Comp) 167#define Mpy_32 ADD_PREFIX(Mpy_32) 168#define Mpy_32_16 ADD_PREFIX(Mpy_32_16) 169#define Div_32 ADD_PREFIX(Div_32) 170#define iLog4 ADD_PREFIX(iLog4) 171#define rsqrt ADD_PREFIX(rsqrt) 172#define pow2_xy ADD_PREFIX(pow2_xy) 173#define L_mpy_ls ADD_PREFIX(L_mpy_ls) 174#define L_mpy_wx ADD_PREFIX(L_mpy_wx) 175 176#define mem_malloc ADD_PREFIX(mem_malloc) 177#define mem_free ADD_PREFIX(mem_free) 178 179#endif 180