1e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/* 2e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Copyright 2003-2010, VisualOn, Inc. 3e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 4e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Licensed under the Apache License, Version 2.0 (the "License"); 5e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** you may not use this file except in compliance with the License. 6e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** You may obtain a copy of the License at 7e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 8e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** http://www.apache.org/licenses/LICENSE-2.0 9e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** 10e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** Unless required by applicable law or agreed to in writing, software 11e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** distributed under the License is distributed on an "AS IS" BASIS, 12e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** See the License for the specific language governing permissions and 14e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard ** limitations under the License. 15e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard */ 16e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/******************************************************************************* 17e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard File: typedefs.h 18e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 19e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard Content: type defined or const defined 20e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 21956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong*******************************************************************************/ 22956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 23956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#ifndef typedefs_h 24956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#define typedefs_h "$Id $" 25956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 26e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef CHAR_BIT 27e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define CHAR_BIT 8 /* number of bits in a char */ 28e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 29e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 30e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef VOAAC_SHRT_MAX 31e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define VOAAC_SHRT_MAX (32767) /* maximum (signed) short value */ 32e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 33e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 34e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef VOAAC_SHRT_MIN 35e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define VOAAC_SHRT_MIN (-32768) /* minimum (signed) short value */ 36e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 37e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 38e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard/* Define NULL pointer value */ 39e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef NULL 40e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifdef __cplusplus 41e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define NULL 0 42e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#else 43e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define NULL ((void *)0) 44e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 45956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#endif 46956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 47956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#ifndef assert 48956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#define assert(_Expression) ((void)0) 49956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#endif 50e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 5132bc0329ac94b181f1457c182c5bb2903f29832dMartin Storsjo#define __inline static __inline 52956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 53956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#define INT_BITS 32 54956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong/* 55956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong******************************************************************************** 56b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard* DEFINITION OF CONSTANTS 57956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong******************************************************************************** 58956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong*/ 59956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong/* 60956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong ********* define char type 61956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong */ 62956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef char Char; 63956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 64956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong/* 65956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong ********* define 8 bit signed/unsigned types & constants 66956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong */ 67956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef signed char Word8; 68956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef unsigned char UWord8; 69956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong/* 70956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong ********* define 16 bit signed/unsigned types & constants 71956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong */ 72956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef short Word16; 73956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef unsigned short UWord16; 74956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 75956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong/* 76956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong ********* define 32 bit signed/unsigned types & constants 77956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong */ 782db3b238966f5f326010321b698fa938d65b8e8aMartin Storsjotypedef int Word32; 792db3b238966f5f326010321b698fa938d65b8e8aMartin Storsjotypedef unsigned int UWord32; 80956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 81e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 82e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 832db3b238966f5f326010321b698fa938d65b8e8aMartin Storsjo#ifndef _MSC_VER 84956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef long long Word64; 85956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef unsigned long long UWord64; 86956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#else 87e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgardtypedef __int64 Word64; 88956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dongtypedef unsigned __int64 UWord64; 89956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#endif 90956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong 91e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef min 92e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define min(a,b) ( a < b ? a : b) 93e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 94e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 95e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifndef max 96e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define max(a,b) ( a > b ? a : b) 97e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 98e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 99e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifdef ARM_INASM 100e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#ifdef ARMV5_INASM 101e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define ARMV5E_INASM 1 102e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 103e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define ARMV4_INASM 1 104e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif 105e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 106e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#if ARMV4_INASM 107e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_SAT 1 108e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_ADD 1 109e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_SUB 1 110e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_SHL 1 111e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_SHR 1 112e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_SHL 1 113e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_SHR 1 114e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#endif//ARMV4 115e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#if ARMV5E_INASM 116e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_ADD 1 117e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_SUB 1 118e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_MULT 1 119e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_MAC 1 120e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_MSU 1 121b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard 122b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard 123e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_DIV_S 1 124e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_ROUND 1 125e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_MULT 1 126b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard 127e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_NORM_S 1 128e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_NORM_L 1 129e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard #define ARMV5TE_L_MPY_LS 1 130956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#endif 131813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard#if ARMV6_INASM 132813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard #undef ARMV5TE_ADD 133813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard #define ARMV5TE_ADD 0 134813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard #undef ARMV5TE_SUB 135813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard #define ARMV5TE_SUB 0 136813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard #define ARMV6_SAT 1 137813eebeb773b1e4c42c2063a7fe37a94514e596aMans Rullgard#endif 138e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 139e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard//basic operation functions optimization flags 140e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define SATRUATE_IS_INLINE 1 //define saturate as inline function 141e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define SHL_IS_INLINE 1 //define shl as inline function 142e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define SHR_IS_INLINE 1 //define shr as inline function 143e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_MULT_IS_INLINE 1 //define L_mult as inline function 144e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_MSU_IS_INLINE 1 //define L_msu as inline function 145e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_SUB_IS_INLINE 1 //define L_sub as inline function 146e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_SHL_IS_INLINE 1 //define L_shl as inline function 147e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_SHR_IS_INLINE 1 //define L_shr as inline function 148e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define ADD_IS_INLINE 1 //define add as inline function //add, inline is the best 149e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define SUB_IS_INLINE 1 //define sub as inline function //sub, inline is the best 150e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define DIV_S_IS_INLINE 1 //define div_s as inline function 151e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define MULT_IS_INLINE 1 //define mult as inline function 152e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define NORM_S_IS_INLINE 1 //define norm_s as inline function 153e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define NORM_L_IS_INLINE 1 //define norm_l as inline function 154e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define ROUND_IS_INLINE 1 //define round as inline function 155e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_MAC_IS_INLINE 1 //define L_mac as inline function 156e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_ADD_IS_INLINE 1 //define L_add as inline function 157b676a05348e4c516fa8b57e33b10548e6142c3f8Mans Rullgard#define EXTRACT_H_IS_INLINE 1 //define extract_h as inline function 158e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define EXTRACT_L_IS_INLINE 1 //define extract_l as inline function //??? 159e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define MULT_R_IS_INLINE 1 //define mult_r as inline function 160e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define SHR_R_IS_INLINE 1 //define shr_r as inline function 161e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define MAC_R_IS_INLINE 1 //define mac_r as inline function 162e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define MSU_R_IS_INLINE 1 //define msu_r as inline function 163e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_SHR_R_IS_INLINE 1 //define L_shr_r as inline function 164e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 165e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define PREFIX voAACEnc 166e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define LINK0(x, y, z) LINK1(x,y,z) 167e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define LINK1(x,y,z) x##y##z 168e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define ADD_PREFIX(func) LINK0(PREFIX, _, func) 169e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 170e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_Extract ADD_PREFIX(L_Extract) 171e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_Comp ADD_PREFIX(L_Comp) 172e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define Mpy_32 ADD_PREFIX(Mpy_32) 173e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define Mpy_32_16 ADD_PREFIX(Mpy_32_16) 174e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define Div_32 ADD_PREFIX(Div_32) 175e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define iLog4 ADD_PREFIX(iLog4) 176e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define rsqrt ADD_PREFIX(rsqrt) 177e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define pow2_xy ADD_PREFIX(pow2_xy) 178e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_mpy_ls ADD_PREFIX(L_mpy_ls) 179e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define L_mpy_wx ADD_PREFIX(L_mpy_wx) 180e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 181e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define mem_malloc ADD_PREFIX(mem_malloc) 182e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard#define mem_free ADD_PREFIX(mem_free) 183e2e838afcf03e603a41a0455846eaf9614537c16Mans Rullgard 184956c553ab0ce72f8074ad0fda2ffd66a0305700cJames Dong#endif 185