Home | History | Annotate | Download | only in inc
      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 /*
     18 *
     19 *      File             : typedefs.h
     20 *      Description      : Definition of platform independent data
     21 *                         types and constants
     22 *
     23 *
     24 *      The following platform independent data types and corresponding
     25 *      preprocessor (#define) constants are defined:
     26 *
     27 *        defined type  meaning           corresponding constants
     28 *        ----------------------------------------------------------
     29 *        Char          character         (none)
     30 *        Bool          boolean           true, false
     31 *        Word8         8-bit signed      minWord8,   maxWord8
     32 *        UWord8        8-bit unsigned    minUWord8,  maxUWord8
     33 *        Word16        16-bit signed     minWord16,  maxWord16
     34 *        UWord16       16-bit unsigned   minUWord16, maxUWord16
     35 *        Word32        32-bit signed     minWord32,  maxWord32
     36 *        UWord32       32-bit unsigned   minUWord32, maxUWord32
     37 *        Float         floating point    minFloat,   maxFloat
     38 *
     39 *
     40 *      The following compile switches are #defined:
     41 *
     42 *        PLATFORM      string indicating platform progam is compiled on
     43 *                      possible values: "OSF", "PC", "SUN"
     44 *
     45 *        OSF           only defined if the current platform is an Alpha
     46 *        PC            only defined if the current platform is a PC
     47 *        SUN           only defined if the current platform is a Sun
     48 *
     49 *        LSBFIRST      is defined if the byte order on this platform is
     50 *                      "least significant byte first" -> defined on DEC Alpha
     51 *                      and PC, undefined on Sun
     52 *
     53 ********************************************************************************
     54 */
     55 
     56 #ifndef __TYPEDEFS_H__
     57 #define __TYPEDEFS_H__
     58 
     59 /*
     60 ********************************************************************************
     61 *                         INCLUDE FILES
     62 ********************************************************************************
     63 */
     64 #include <float.h>
     65 #include <limits.h>
     66 
     67 
     68 
     69 /*
     70 ********************************************************************************
     71 *                         DEFINITION OF CONSTANTS
     72 ********************************************************************************
     73 */
     74 /*
     75  ********* define char type
     76  */
     77 typedef char Char;
     78 
     79 /*
     80  ********* define 8 bit signed/unsigned types & constants
     81  */
     82 #if SCHAR_MAX == 127
     83 typedef signed char Word8;
     84 #define minWord8  SCHAR_MIN
     85 #define maxWord8  SCHAR_MAX
     86 
     87 typedef unsigned char UWord8;
     88 #define minUWord8 0
     89 #define maxUWord8 UCHAR_MAX
     90 #else
     91 #error cannot find 8-bit type
     92 #endif
     93 
     94 
     95 /*
     96  ********* define 16 bit signed/unsigned types & constants
     97  */
     98 #if INT_MAX == 32767
     99 typedef int Word16;
    100 #define minWord16     INT_MIN
    101 #define maxWord16     INT_MAX
    102 typedef unsigned int UWord16;
    103 #define minUWord16    0
    104 #define maxUWord16    UINT_MAX
    105 #elif SHRT_MAX == 32767
    106 typedef short Word16;
    107 #define minWord16     SHRT_MIN
    108 #define maxWord16     SHRT_MAX
    109 typedef unsigned short UWord16;
    110 #define minUWord16    0
    111 #define maxUWord16    USHRT_MAX
    112 #else
    113 #error cannot find 16-bit type
    114 #endif
    115 
    116 
    117 /*
    118  ********* define 32 bit signed/unsigned types & constants
    119  */
    120 #if INT_MAX == 2147483647
    121 typedef int Word32;
    122 #define minWord32     INT_MIN
    123 #define maxWord32     INT_MAX
    124 typedef unsigned int UWord32;
    125 #define minUWord32    0
    126 #define maxUWord32    UINT_MAX
    127 #elif LONG_MAX == 2147483647
    128 typedef long Word32;
    129 #define minWord32     LONG_MIN
    130 #define maxWord32     LONG_MAX
    131 typedef unsigned long UWord32;
    132 #define minUWord32    0
    133 #define maxUWord32    ULONG_MAX
    134 #else
    135 #error cannot find 32-bit type
    136 #endif
    137 
    138 /*
    139  ********* define floating point type & constants
    140  */
    141 /* use "#if 0" below if Float should be double;
    142    use "#if 1" below if Float should be float
    143  */
    144 #if 0
    145 typedef float Float;
    146 #define maxFloat      FLT_MAX
    147 #define minFloat      FLT_MIN
    148 #else
    149 typedef double Float;
    150 #define maxFloat      DBL_MAX
    151 #define minFloat      DBL_MIN
    152 #endif
    153 
    154 /*
    155  ********* define complex type
    156  */
    157 typedef struct {
    158   Float r;  /* real      part */
    159   Float i;  /* imaginary part */
    160 } CPX;
    161 
    162 /*
    163  ********* define boolean type
    164  */
    165 typedef int Bool;
    166 #define false 0
    167 #define true 1
    168 
    169 /* ******Avoid function multiple definition****** */
    170 #define     Autocorr         voAWB_Autocorr
    171 #define     Convolve         voAWB_Convolve
    172 #define     cor_h_x          voAWB_cor_h_x
    173 #define     dtx_enc_init     voAWB_dtx_enc_init
    174 #define     dtx_enc_reset    voAWB_dtx_enc_reset
    175 #define     dtx_enc_exit     voAWB_dtx_enc_exit
    176 #define     dtx_enc          voAWB_dtx_enc
    177 #define     dtx_buffer       voAWB_dtx_buffer
    178 #define     tx_dtx_handler   voAWB_tx_dtx_handler
    179 #define     G_pitch          voAWB_G_pitch
    180 #define     Isp_Az           voAWB_Isp_Az
    181 #define     Lag_window       voAWB_Lag_window
    182 #define     Log2_norm        voAWB_Log2_norm
    183 #define     Log2             voAWB_Log2
    184 #define     Pow2             voAWB_Pow2
    185 #define     L_Comp           voAWB_L_Comp
    186 #define     Mpy_32           voAWB_Mpy_32
    187 #define     Mpy_32_16        voAWB_Mpy_32_16
    188 #define     Div_32           voAWB_Div_32
    189 #define     Pit_shrp         voAWB_Pit_shrp
    190 #define     Qisf_ns          voAWB_Qisf_ns
    191 #define     Disf_ns          voAWB_Disf_ns
    192 #define     Residu           voAWB_Residu
    193 #define     Syn_filt         voAWB_Syn_filt
    194 #define     Set_zero         voAWB_Set_zero
    195 #define     Copy             voAWB_Copy
    196 #define     voice_factor     voAWB_voice_factor
    197 #define     Syn_filt_32      voAWB_Syn_filt_32
    198 #define     Isf_isp          voAWB_Isf_isp
    199 #define     Levinson         voAWB_Levinson
    200 #define     median5          voAWB_median5
    201 #define     Pred_lt4         voAWB_Pred_lt4
    202 #define     Reorder_isf      voAWB_Reorder_isf
    203 #define     Dpisf_2s_36b     voAWB_Dpisf_2s_36b
    204 #define     Dpisf_2s_46b     voAWB_Dpisf_2s_46b
    205 #define     Dot_product12    voAWB_Dot_product12
    206 #define     mem_malloc       voAWB_mem_malloc
    207 #define     mem_free         voAWB_mem_free
    208 /******************************************************/
    209 
    210 #endif  //#define __TYPEDEFS_H__
    211 
    212