Merge "Correct bit allocation when the alternative reference frame"
[profile/ivi/libvpx.git] / vpx_ports / vpxtypes.h
1 /*
2  *  Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license and patent
5  *  grant that can be found in the LICENSE file in the root of the source
6  *  tree. All contributing project authors may be found in the AUTHORS
7  *  file in the root of the source tree.
8  */
9
10
11 #ifndef __VPXTYPES_H__
12 #define __VPXTYPES_H__
13
14 #include "vpx_ports/config.h"
15
16 //#include <sys/types.h>
17 #ifdef _MSC_VER
18 # include <basetsd.h>
19 typedef SSIZE_T ssize_t;
20 #endif
21
22 #if defined(HAVE_STDINT_H) && HAVE_STDINT_H
23 /* C99 types are preferred to vpx integer types */
24 # include <stdint.h>
25 #endif
26
27 /*!\defgroup basetypes Base Types
28   @{*/
29 #if !defined(HAVE_STDINT_H) && !defined(INT_T_DEFINED)
30 # ifdef STRICTTYPES
31 typedef signed char  int8_t;
32 typedef signed short int16_t;
33 typedef signed int   int32_t;
34 # else
35 typedef char         int8_t;
36 typedef short        int16_t;
37 typedef int          int32_t;
38 # endif
39 typedef unsigned char  uint8_t;
40 typedef unsigned short uint16_t;
41 typedef unsigned int   uint32_t;
42 #endif
43
44 typedef int8_t     vpxs8;
45 typedef uint8_t    vpxu8;
46 typedef int16_t    vpxs16;
47 typedef uint16_t   vpxu16;
48 typedef int32_t    vpxs32;
49 typedef uint32_t   vpxu32;
50 typedef int32_t    vpxbool;
51
52 enum {vpxfalse, vpxtrue};
53
54 /*!\def OTC
55    \brief a macro suitable for declaring a constant #vpxtc*/
56 /*!\def VPXTC
57    \brief printf format string suitable for printing an #vpxtc*/
58 #ifdef UNICODE
59 # ifdef NO_WCHAR
60 #  error "no non-wchar support added yet"
61 # else
62 #  include <wchar.h>
63 typedef wchar_t vpxtc;
64 #  define OTC(str) L ## str
65 #  define VPXTC "ls"
66 # endif /*NO_WCHAR*/
67 #else
68 typedef char vpxtc;
69 # define OTC(str) (vpxtc*)str
70 # define VPXTC "s"
71 #endif /*UNICODE*/
72 /*@} end - base types*/
73
74 /*!\addtogroup basetypes
75   @{*/
76 /*!\def VPX64
77    \brief printf format string suitable for printing an #vpxs64*/
78 #if defined(HAVE_STDINT_H)
79 # define VPX64 PRId64
80 typedef int64_t vpxs64;
81 #elif defined(HASLONGLONG)
82 # undef  PRId64
83 # define PRId64 "lld"
84 # define VPX64 PRId64
85 typedef long long vpxs64;
86 #elif defined(WIN32) || defined(_WIN32_WCE)
87 # undef  PRId64
88 # define PRId64 "I64d"
89 # define VPX64 PRId64
90 typedef __int64 vpxs64;
91 typedef unsigned __int64 vpxu64;
92 #elif defined(__uClinux__) && defined(CHIP_DM642)
93 # include <lddk.h>
94 # undef  PRId64
95 # define PRId64 "lld"
96 # define VPX64 PRId64
97 typedef long vpxs64;
98 #elif defined(__SYMBIAN32__)
99 # undef  PRId64
100 # define PRId64 "u"
101 # define VPX64 PRId64
102 typedef unsigned int vpxs64;
103 #else
104 # error "64 bit integer type undefined for this platform!"
105 #endif
106 #if !defined(HAVE_STDINT_H) && !defined(INT_T_DEFINED)
107 typedef vpxs64 int64_t;
108 typedef vpxu64 uint64_t;
109 #endif
110 /*!@} end - base types*/
111
112 /*!\ingroup basetypes
113    \brief Common return type*/
114 typedef enum
115 {
116     VPX_NOT_FOUND        = -404,
117     VPX_BUFFER_EMPTY     = -202,
118     VPX_BUFFER_FULL      = -201,
119
120     VPX_CONNREFUSED      = -102,
121     VPX_TIMEDOUT         = -101,
122     VPX_WOULDBLOCK       = -100,
123
124     VPX_NET_ERROR        = -9,
125     VPX_INVALID_VERSION  = -8,
126     VPX_INPROGRESS       = -7,
127     VPX_NOT_SUPP         = -6,
128     VPX_NO_MEM           = -3,
129     VPX_INVALID_PARAMS   = -2,
130     VPX_ERROR            = -1,
131     VPX_OK               = 0,
132     VPX_DONE             = 1
133 } vpxsc;
134
135 #if defined(WIN32) || defined(_WIN32_WCE)
136 # define DLLIMPORT __declspec(dllimport)
137 # define DLLEXPORT __declspec(dllexport)
138 # define DLLLOCAL
139 #elif defined(LINUX)
140 # define DLLIMPORT
141 /*visibility attribute support is available in 3.4 and later.
142   see: http://gcc.gnu.org/wiki/Visibility for more info*/
143 # if defined(__GNUC__) && ((__GNUC__<<16|(__GNUC_MINOR__&0xff)) >= (3<<16|4))
144 #  define GCC_HASCLASSVISIBILITY
145 # endif /*defined(__GNUC__) && __GNUC_PREREQ(3,4)*/
146 # ifdef GCC_HASCLASSVISIBILITY
147 #  define DLLEXPORT   __attribute__ ((visibility("default")))
148 #  define DLLLOCAL __attribute__ ((visibility("hidden")))
149 # else
150 #  define DLLEXPORT
151 #  define DLLLOCAL
152 # endif /*GCC_HASCLASSVISIBILITY*/
153 #endif /*platform ifdefs*/
154
155 #endif /*__VPXTYPES_H__*/
156
157 #undef VPXAPI
158 /*!\def VPXAPI
159    \brief library calling convention/storage class attributes.
160
161    Specifies whether the function is imported through a dll
162    or is from a static library.*/
163 #ifdef VPXDLL
164 # ifdef VPXDLLEXPORT
165 #  define VPXAPI DLLEXPORT
166 # else
167 #  define VPXAPI DLLIMPORT
168 # endif /*VPXDLLEXPORT*/
169 #else
170 # define VPXAPI
171 #endif /*VPXDLL*/