4 #define FFMPEG_VERSION_INT 0x000405
5 #define FFMPEG_VERSION "0.4.5"
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
85 #define CONFIG_MPGLIB 1
94 #ifndef __WINE_WINDEF16_H
95 /* workaround for typedef conflict in MPlayer (wine typedefs) */
96 typedef unsigned short UINT16;
97 typedef signed short INT16;
100 typedef unsigned char UINT8;
101 typedef unsigned int UINT32;
102 typedef unsigned long long UINT64;
103 typedef signed char INT8;
104 typedef signed int INT32;
105 typedef signed long long INT64;
107 #ifdef HAVE_AV_CONFIG_H
110 #include <sys/param.h>
114 #define INT64_C(c) (c ## LL)
115 #define UINT64_C(c) (c ## ULL)
118 #include "../bswap.h"
120 #ifdef USE_FASTMEMCPY
121 #include "fastmemcpy.h"
124 #endif /* HAVE_AV_CONFIG_H */
126 #endif /* !CONFIG_WIN32 */
129 #ifdef HAVE_AV_CONFIG_H
137 #if defined(CONFIG_WIN32) && !defined(__MINGW32__)
139 inline void dprintf(const char* fmt,...) {}
144 #define dprintf(fmt,args...) printf(fmt, ## args)
146 #define dprintf(fmt,args...)
149 #endif /* !CONFIG_WIN32 */
151 #endif /* HAVE_AV_CONFIG_H */
155 struct PutBitContext;
157 typedef void (*WriteDataFunc)(void *, UINT8 *, int);
159 typedef struct PutBitContext {
162 UINT8 *buf, *buf_ptr, *buf_end;
163 INT64 data_out_size; /* in bytes */
165 WriteDataFunc write_data;
168 void init_put_bits(PutBitContext *s,
169 UINT8 *buffer, int buffer_size,
171 void (*write_data)(void *, UINT8 *, int));
172 void put_bits(PutBitContext *s, int n, unsigned int value);
173 INT64 get_bit_count(PutBitContext *s); /* XXX: change function name */
174 void align_put_bits(PutBitContext *s);
175 void flush_put_bits(PutBitContext *s);
177 /* jpeg specific put_bits */
178 void jput_bits(PutBitContext *s, int n, unsigned int value);
179 void jflush_put_bits(PutBitContext *s);
183 typedef struct GetBitContext {
186 UINT8 *buf, *buf_ptr, *buf_end;
193 int table_size, table_allocated;
196 void init_get_bits(GetBitContext *s,
197 UINT8 *buffer, int buffer_size);
199 unsigned int get_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 static inline void skip_bits(GetBitContext *s, int n){
231 /* most common case here */
235 st_bit_counts[st_current_index] += n;
242 static inline void skip_bits1(GetBitContext *s){
244 /* most common case here */
248 st_bit_counts[st_current_index]++;
255 static inline int get_bits_count(GetBitContext *s)
257 return (s->buf_ptr - s->buf) * 8 - s->bit_cnt;
260 void align_get_bits(GetBitContext *s);
261 int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
262 const void *bits, int bits_wrap, int bits_size,
263 const void *codes, int codes_wrap, int codes_size);
264 void free_vlc(VLC *vlc);
265 int get_vlc(GetBitContext *s, VLC *vlc);
267 /* macro to go faster */
268 /* n must be <= 24 */
269 /* XXX: optimize buffer end test */
270 #define SHOW_BITS(s, val, n)\
272 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
273 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
275 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
276 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
278 if (bit_cnt < n && buf_ptr < (s)->buf_end) {\
279 bit_buf |= *buf_ptr++ << (24 - bit_cnt);\
284 val = bit_buf >> (32 - n);\
287 /* SHOW_BITS with n1 >= n must be been done before */
288 #define FLUSH_BITS(n)\
294 #define SAVE_BITS(s) \
296 bit_cnt = (s)->bit_cnt;\
297 bit_buf = (s)->bit_buf;\
298 buf_ptr = (s)->buf_ptr;\
301 #define RESTORE_BITS(s) \
303 (s)->buf_ptr = buf_ptr;\
304 (s)->bit_buf = bit_buf;\
305 (s)->bit_cnt = bit_cnt;\
308 /* define it to include statistics code (useful only for optimizing
325 extern int st_current_index;
326 extern unsigned int st_bit_counts[ST_NB];
327 extern unsigned int st_out_bit_counts[ST_NB];
329 void print_stats(void);
332 /* misc math functions */
334 extern inline int av_log2(unsigned int v)
339 if (v & 0xffff0000) {
362 void *av_mallocz(int size);