Mercurial > libavcodec.hg
comparison common.h @ 1064:b32afefe7d33 libavcodec
* UINTX -> uintx_t INTX -> intx_t
author | kabi |
---|---|
date | Tue, 11 Feb 2003 16:35:48 +0000 |
parents | 890b9fb44e84 |
children | 89e233c2ef45 |
comparison
equal
deleted
inserted
replaced
1063:fdeac9642346 | 1064:b32afefe7d33 |
---|---|
70 | 70 |
71 #ifdef CONFIG_WIN32 | 71 #ifdef CONFIG_WIN32 |
72 | 72 |
73 /* windows */ | 73 /* windows */ |
74 | 74 |
75 typedef unsigned short UINT16; | 75 typedef unsigned short uint16_t; |
76 typedef signed short INT16; | 76 typedef signed short int16_t; |
77 typedef unsigned char UINT8; | 77 typedef unsigned char uint8_t; |
78 typedef unsigned int UINT32; | 78 typedef unsigned int uint32_t; |
79 typedef unsigned __int64 UINT64; | 79 typedef unsigned __int64 uint64_t; |
80 typedef signed char INT8; | 80 typedef signed char int8_t; |
81 typedef signed int INT32; | 81 typedef signed int int32_t; |
82 typedef signed __int64 INT64; | 82 typedef signed __int64 int64_t; |
83 | |
84 typedef UINT8 uint8_t; | |
85 typedef INT8 int8_t; | |
86 typedef UINT16 uint16_t; | |
87 typedef INT16 int16_t; | |
88 typedef UINT32 uint32_t; | |
89 typedef INT32 int32_t; | |
90 typedef UINT64 uint64_t; | |
91 typedef INT64 int64_t; | |
92 | 83 |
93 # ifndef __MINGW32__ | 84 # ifndef __MINGW32__ |
94 # define INT64_C(c) (c ## i64) | 85 # define int64_t_C(c) (c ## i64) |
95 # define UINT64_C(c) (c ## i64) | 86 # define uint64_t_C(c) (c ## i64) |
96 | 87 |
97 # define inline __inline | 88 # define inline __inline |
98 | 89 |
99 # else | 90 # else |
100 # define INT64_C(c) (c ## LL) | 91 # define int64_t_C(c) (c ## LL) |
101 # define UINT64_C(c) (c ## ULL) | 92 # define uint64_t_C(c) (c ## ULL) |
102 # endif /* __MINGW32__ */ | 93 # endif /* __MINGW32__ */ |
103 | 94 |
104 # ifdef _DEBUG | 95 # ifdef _DEBUG |
105 # define DEBUG | 96 # define DEBUG |
106 # endif | 97 # endif |
112 #elif defined (CONFIG_OS2) | 103 #elif defined (CONFIG_OS2) |
113 /* OS/2 EMX */ | 104 /* OS/2 EMX */ |
114 | 105 |
115 #include <inttypes.h> | 106 #include <inttypes.h> |
116 | 107 |
117 typedef unsigned char UINT8; | |
118 typedef unsigned short UINT16; | |
119 typedef unsigned int UINT32; | |
120 typedef unsigned long long UINT64; | |
121 typedef signed char INT8; | |
122 typedef signed short INT16; | |
123 typedef signed int INT32; | |
124 typedef signed long long INT64; | |
125 | |
126 #ifdef HAVE_AV_CONFIG_H | 108 #ifdef HAVE_AV_CONFIG_H |
127 | 109 |
128 #ifndef INT64_C | 110 #ifndef int64_t_C |
129 #define INT64_C(c) (c ## LL) | 111 #define int64_t_C(c) (c ## LL) |
130 #define UINT64_C(c) (c ## ULL) | 112 #define uint64_t_C(c) (c ## ULL) |
131 #endif | 113 #endif |
132 | 114 |
133 #ifdef USE_FASTMEMCPY | 115 #ifdef USE_FASTMEMCPY |
134 #include "fastmemcpy.h" | 116 #include "fastmemcpy.h" |
135 #endif | 117 #endif |
143 | 125 |
144 /* unix */ | 126 /* unix */ |
145 | 127 |
146 # include <inttypes.h> | 128 # include <inttypes.h> |
147 | 129 |
148 # ifndef __WINE_WINDEF16_H | |
149 /* workaround for typedef conflict in MPlayer (wine typedefs) */ | |
150 typedef unsigned short UINT16; | |
151 typedef signed short INT16; | |
152 # endif | |
153 | |
154 typedef unsigned char UINT8; | |
155 typedef unsigned int UINT32; | |
156 typedef unsigned long long UINT64; | |
157 typedef signed char INT8; | |
158 typedef signed int INT32; | |
159 typedef signed long long INT64; | |
160 | |
161 # ifdef HAVE_AV_CONFIG_H | 130 # ifdef HAVE_AV_CONFIG_H |
162 # ifndef INT64_C | 131 # ifndef int64_t_C |
163 # define INT64_C(c) (c ## LL) | 132 # define int64_t_C(c) (c ## LL) |
164 # define UINT64_C(c) (c ## ULL) | 133 # define uint64_t_C(c) (c ## ULL) |
165 # endif | 134 # endif |
166 | 135 |
167 # ifdef USE_FASTMEMCPY | 136 # ifdef USE_FASTMEMCPY |
168 # include "fastmemcpy.h" | 137 # include "fastmemcpy.h" |
169 # endif | 138 # endif |
238 | 207 |
239 /* bit output */ | 208 /* bit output */ |
240 | 209 |
241 struct PutBitContext; | 210 struct PutBitContext; |
242 | 211 |
243 typedef void (*WriteDataFunc)(void *, UINT8 *, int); | 212 typedef void (*WriteDataFunc)(void *, uint8_t *, int); |
244 | 213 |
245 typedef struct PutBitContext { | 214 typedef struct PutBitContext { |
246 #ifdef ALT_BITSTREAM_WRITER | 215 #ifdef ALT_BITSTREAM_WRITER |
247 UINT8 *buf, *buf_end; | 216 uint8_t *buf, *buf_end; |
248 int index; | 217 int index; |
249 #else | 218 #else |
250 UINT32 bit_buf; | 219 uint32_t bit_buf; |
251 int bit_left; | 220 int bit_left; |
252 UINT8 *buf, *buf_ptr, *buf_end; | 221 uint8_t *buf, *buf_ptr, *buf_end; |
253 #endif | 222 #endif |
254 INT64 data_out_size; /* in bytes */ | 223 int64_t data_out_size; /* in bytes */ |
255 } PutBitContext; | 224 } PutBitContext; |
256 | 225 |
257 void init_put_bits(PutBitContext *s, | 226 void init_put_bits(PutBitContext *s, |
258 UINT8 *buffer, int buffer_size, | 227 uint8_t *buffer, int buffer_size, |
259 void *opaque, | 228 void *opaque, |
260 void (*write_data)(void *, UINT8 *, int)); | 229 void (*write_data)(void *, uint8_t *, int)); |
261 | 230 |
262 INT64 get_bit_count(PutBitContext *s); /* XXX: change function name */ | 231 int64_t get_bit_count(PutBitContext *s); /* XXX: change function name */ |
263 void align_put_bits(PutBitContext *s); | 232 void align_put_bits(PutBitContext *s); |
264 void flush_put_bits(PutBitContext *s); | 233 void flush_put_bits(PutBitContext *s); |
265 void put_string(PutBitContext * pbc, char *s); | 234 void put_string(PutBitContext * pbc, char *s); |
266 | 235 |
267 /* bit input */ | 236 /* bit input */ |
268 | 237 |
269 typedef struct GetBitContext { | 238 typedef struct GetBitContext { |
270 UINT8 *buffer, *buffer_end; | 239 uint8_t *buffer, *buffer_end; |
271 #ifdef ALT_BITSTREAM_READER | 240 #ifdef ALT_BITSTREAM_READER |
272 int index; | 241 int index; |
273 #elif defined LIBMPEG2_BITSTREAM_READER | 242 #elif defined LIBMPEG2_BITSTREAM_READER |
274 UINT8 *buffer_ptr; | 243 uint8_t *buffer_ptr; |
275 UINT32 cache; | 244 uint32_t cache; |
276 int bit_count; | 245 int bit_count; |
277 #elif defined A32_BITSTREAM_READER | 246 #elif defined A32_BITSTREAM_READER |
278 UINT32 *buffer_ptr; | 247 uint32_t *buffer_ptr; |
279 UINT32 cache0; | 248 uint32_t cache0; |
280 UINT32 cache1; | 249 uint32_t cache1; |
281 int bit_count; | 250 int bit_count; |
282 #endif | 251 #endif |
283 int size_in_bits; | 252 int size_in_bits; |
284 } GetBitContext; | 253 } GetBitContext; |
285 | 254 |
286 static inline int get_bits_count(GetBitContext *s); | 255 static inline int get_bits_count(GetBitContext *s); |
287 | 256 |
288 #define VLC_TYPE INT16 | 257 #define VLC_TYPE int16_t |
289 | 258 |
290 typedef struct VLC { | 259 typedef struct VLC { |
291 int bits; | 260 int bits; |
292 VLC_TYPE (*table)[2]; // code, bits | 261 VLC_TYPE (*table)[2]; // code, bits |
293 int table_size, table_allocated; | 262 int table_size, table_allocated; |
303 #define UNALIGNED_STORES_ARE_BAD | 272 #define UNALIGNED_STORES_ARE_BAD |
304 #endif | 273 #endif |
305 | 274 |
306 /* used to avoid missaligned exceptions on some archs (alpha, ...) */ | 275 /* used to avoid missaligned exceptions on some archs (alpha, ...) */ |
307 #ifdef ARCH_X86 | 276 #ifdef ARCH_X86 |
308 # define unaligned32(a) (*(UINT32*)(a)) | 277 # define unaligned32(a) (*(uint32_t*)(a)) |
309 #else | 278 #else |
310 # ifdef __GNUC__ | 279 # ifdef __GNUC__ |
311 static inline uint32_t unaligned32(const void *v) { | 280 static inline uint32_t unaligned32(const void *v) { |
312 struct Unaligned { | 281 struct Unaligned { |
313 uint32_t i; | 282 uint32_t i; |
355 s->buf_ptr[1] = bit_buf >> 16; | 324 s->buf_ptr[1] = bit_buf >> 16; |
356 s->buf_ptr[2] = bit_buf >> 8; | 325 s->buf_ptr[2] = bit_buf >> 8; |
357 s->buf_ptr[3] = bit_buf ; | 326 s->buf_ptr[3] = bit_buf ; |
358 } else | 327 } else |
359 #endif | 328 #endif |
360 *(UINT32 *)s->buf_ptr = be2me_32(bit_buf); | 329 *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); |
361 //printf("bitbuf = %08x\n", bit_buf); | 330 //printf("bitbuf = %08x\n", bit_buf); |
362 s->buf_ptr+=4; | 331 s->buf_ptr+=4; |
363 bit_left+=32 - n; | 332 bit_left+=32 - n; |
364 bit_buf = value; | 333 bit_buf = value; |
365 } | 334 } |
698 static inline void skip_bits1(GetBitContext *s){ | 667 static inline void skip_bits1(GetBitContext *s){ |
699 skip_bits(s, 1); | 668 skip_bits(s, 1); |
700 } | 669 } |
701 | 670 |
702 void init_get_bits(GetBitContext *s, | 671 void init_get_bits(GetBitContext *s, |
703 UINT8 *buffer, int buffer_size); | 672 uint8_t *buffer, int buffer_size); |
704 | 673 |
705 int check_marker(GetBitContext *s, const char *msg); | 674 int check_marker(GetBitContext *s, const char *msg); |
706 void align_get_bits(GetBitContext *s); | 675 void align_get_bits(GetBitContext *s); |
707 int init_vlc(VLC *vlc, int nb_bits, int nb_codes, | 676 int init_vlc(VLC *vlc, int nb_bits, int nb_codes, |
708 const void *bits, int bits_wrap, int bits_size, | 677 const void *bits, int bits_wrap, int bits_size, |