typedefs.h revision 813eebeb773b1e4c42c2063a7fe37a94514e596a
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#if ARMV6_INASM
134    #undef  ARMV5TE_ADD
135    #define ARMV5TE_ADD           0
136    #undef  ARMV5TE_SUB
137    #define ARMV5TE_SUB           0
138    #define ARMV6_SAT             1
139#endif
140
141//basic operation functions optimization flags
142#define SATRUATE_IS_INLINE              1   //define saturate as inline function
143#define SHL_IS_INLINE                   1  //define shl as inline function
144#define SHR_IS_INLINE                   1   //define shr as inline function
145#define L_MULT_IS_INLINE                1   //define L_mult as inline function
146#define L_MSU_IS_INLINE                 1   //define L_msu as inline function
147#define L_SUB_IS_INLINE                 1   //define L_sub as inline function
148#define L_SHL_IS_INLINE                 1   //define L_shl as inline function
149#define L_SHR_IS_INLINE                 1   //define L_shr as inline function
150#define ADD_IS_INLINE                   1   //define add as inline function //add, inline is the best
151#define SUB_IS_INLINE                   1   //define sub as inline function //sub, inline is the best
152#define DIV_S_IS_INLINE                 1   //define div_s as inline function
153#define MULT_IS_INLINE                  1   //define mult as inline function
154#define NORM_S_IS_INLINE                1   //define norm_s as inline function
155#define NORM_L_IS_INLINE                1   //define norm_l as inline function
156#define ROUND_IS_INLINE                 1   //define round as inline function
157#define L_MAC_IS_INLINE                 1   //define L_mac as inline function
158#define L_ADD_IS_INLINE                 1   //define L_add as inline function
159#define EXTRACT_H_IS_INLINE             1   //define extract_h as inline function
160#define EXTRACT_L_IS_INLINE             1   //define extract_l as inline function        //???
161#define MULT_R_IS_INLINE                1   //define mult_r as inline function
162#define SHR_R_IS_INLINE                 1   //define shr_r as inline function
163#define MAC_R_IS_INLINE                 1   //define mac_r as inline function
164#define MSU_R_IS_INLINE                 1   //define msu_r as inline function
165#define L_SHR_R_IS_INLINE               1   //define L_shr_r as inline function
166
167#define PREFIX				voAACEnc
168#define LINK0(x, y, z)		LINK1(x,y,z)
169#define LINK1(x,y,z)		x##y##z
170#define ADD_PREFIX(func)	LINK0(PREFIX, _, func)
171
172#define  L_Extract		ADD_PREFIX(L_Extract)
173#define  L_Comp			ADD_PREFIX(L_Comp)
174#define  Mpy_32			ADD_PREFIX(Mpy_32)
175#define  Mpy_32_16		ADD_PREFIX(Mpy_32_16)
176#define  Div_32			ADD_PREFIX(Div_32)
177#define  iLog4			ADD_PREFIX(iLog4)
178#define  rsqrt			ADD_PREFIX(rsqrt)
179#define  pow2_xy		ADD_PREFIX(pow2_xy)
180#define  L_mpy_ls		ADD_PREFIX(L_mpy_ls)
181#define  L_mpy_wx		ADD_PREFIX(L_mpy_wx)
182
183#define mem_malloc		ADD_PREFIX(mem_malloc)
184#define mem_free		ADD_PREFIX(mem_free)
185
186#endif
187