4 #define FFMPEG_VERSION_INT 0x000406
5 #define FFMPEG_VERSION "0.4.6"
7 #if defined(WIN32) && !defined(__MINGW32__)
11 #ifdef HAVE_AV_CONFIG_H
12 /* only include the following when compiling package */
13 #include "../config.h"
30 typedef unsigned short UINT16;
31 typedef signed short INT16;
32 typedef unsigned char UINT8;
33 typedef unsigned int UINT32;
34 typedef unsigned __int64 UINT64;
35 typedef signed char INT8;
36 typedef signed int INT32;
37 typedef signed __int64 INT64;
39 typedef UINT8 uint8_t;
41 typedef UINT16 uint16_t;
42 typedef INT16 int16_t;
43 typedef UINT32 uint32_t;
44 typedef INT32 int32_t;
47 #define INT64_C(c) (c ## i64)
48 #define UINT64_C(c) (c ## i64)
50 #define inline __inline
53 Disable warning messages:
54 warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
55 warning C4305: 'argument' : truncation from 'const double' to 'float'
57 #pragma warning( disable : 4244 )
58 #pragma warning( disable : 4305 )
61 #define INT64_C(c) (c ## LL)
62 #define UINT64_C(c) (c ## ULL)
63 #endif /* __MINGW32__ */
65 #define M_PI 3.14159265358979323846
66 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
72 // code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc.
74 ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
75 (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
76 #define be2me_32(x) bswap_32(x)
78 #define snprintf _snprintf
81 /* no config.h with VC */
82 #define CONFIG_ENCODERS 1
83 #define CONFIG_DECODERS 1
93 #ifndef __WINE_WINDEF16_H
94 /* workaround for typedef conflict in MPlayer (wine typedefs) */
95 typedef unsigned short UINT16;
96 typedef signed short INT16;
99 typedef unsigned char UINT8;
100 typedef unsigned int UINT32;
101 typedef unsigned long long UINT64;
102 typedef signed char INT8;
103 typedef signed int INT32;
104 typedef signed long long INT64;
106 #ifdef HAVE_AV_CONFIG_H
109 #include <sys/param.h>
113 #define INT64_C(c) (c ## LL)
114 #define UINT64_C(c) (c ## ULL)
117 #include "../bswap.h"
119 #ifdef USE_FASTMEMCPY
120 #include "fastmemcpy.h"
123 #endif /* HAVE_AV_CONFIG_H */
125 #endif /* !CONFIG_WIN32 */
128 #ifdef HAVE_AV_CONFIG_H
136 #if defined(CONFIG_WIN32) && !defined(__MINGW32__)
138 inline void dprintf(const char* fmt,...) {}
143 #define dprintf(fmt,args...) printf(fmt, ## args)
145 #define dprintf(fmt,args...)
148 #endif /* !CONFIG_WIN32 */
150 #endif /* HAVE_AV_CONFIG_H */
154 struct PutBitContext;
156 typedef void (*WriteDataFunc)(void *, UINT8 *, int);
158 typedef struct PutBitContext {
161 UINT8 *buf, *buf_ptr, *buf_end;
162 INT64 data_out_size; /* in bytes */
164 WriteDataFunc write_data;
167 void init_put_bits(PutBitContext *s,
168 UINT8 *buffer, int buffer_size,
170 void (*write_data)(void *, UINT8 *, int));
171 void put_bits(PutBitContext *s, int n, unsigned int value);
172 INT64 get_bit_count(PutBitContext *s); /* XXX: change function name */
173 void align_put_bits(PutBitContext *s);
174 void flush_put_bits(PutBitContext *s);
176 /* jpeg specific put_bits */
177 void jput_bits(PutBitContext *s, int n, unsigned int value);
178 void jflush_put_bits(PutBitContext *s);
182 typedef struct GetBitContext {
185 UINT8 *buf, *buf_ptr, *buf_end;
192 int table_size, table_allocated;
195 void init_get_bits(GetBitContext *s,
196 UINT8 *buffer, int buffer_size);
198 unsigned int get_bits_long(GetBitContext *s, int n);
199 unsigned int show_bits_long(GetBitContext *s, int n);
201 static inline unsigned int get_bits(GetBitContext *s, int n){
203 /* most common case here */
204 unsigned int val = s->bit_buf >> (32 - n);
208 st_bit_counts[st_current_index] += n;
212 return get_bits_long(s,n);
215 static inline unsigned int get_bits1(GetBitContext *s){
217 /* most common case here */
218 unsigned int val = s->bit_buf >> 31;
222 st_bit_counts[st_current_index]++;
226 return get_bits_long(s,1);
229 /* This function is identical to get_bits(), the only */
230 /* diference is that it doesn't touch the buffer */
231 /* it is usefull to see the buffer. */
232 static inline unsigned int show_bits(GetBitContext *s, int n)
235 /* most common case here */
236 unsigned int val = s->bit_buf >> (32 - n);
239 return show_bits_long(s,n);
242 static inline void skip_bits(GetBitContext *s, int n){
244 /* most common case here */
248 st_bit_counts[st_current_index] += n;
255 static inline void skip_bits1(GetBitContext *s){
257 /* most common case here */
261 st_bit_counts[st_current_index]++;
268 static inline int get_bits_count(GetBitContext *s)
270 return (s->buf_ptr - s->buf) * 8 - s->bit_cnt;
273 void align_get_bits(GetBitContext *s);
274 int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
275 const void *bits, int bits_wrap, int bits_size,
276 const void *codes, int codes_wrap, int codes_size);
277 void free_vlc(VLC *vlc);
278 int get_vlc(GetBitContext *s, VLC *vlc);
280 /* macro to go faster */
281 /* n must be <= 24 */
282 /* XXX: optimize buffer end test */
283 #define SHOW_BITS(s, val, n)\
285 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
286 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
288 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
289 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
291 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
292 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
297 val = bit_buf >> (32 - n);\
300 /* SHOW_BITS with n1 >= n must be been done before */
301 #define FLUSH_BITS(n)\
307 #define SAVE_BITS(s) \
309 bit_cnt = (s)->bit_cnt;\
310 bit_buf = (s)->bit_buf;\
311 buf_ptr = (s)->buf_ptr;\
314 #define RESTORE_BITS(s) \
316 (s)->buf_ptr = buf_ptr;\
317 (s)->bit_buf = bit_buf;\
318 (s)->bit_cnt = bit_cnt;\
321 /* define it to include statistics code (useful only for optimizing
338 extern int st_current_index;
339 extern unsigned int st_bit_counts[ST_NB];
340 extern unsigned int st_out_bit_counts[ST_NB];
342 void print_stats(void);
345 /* misc math functions */
347 extern inline int av_log2(unsigned int v)
352 if (v & 0xffff0000) {
375 void *av_mallocz(int size);