46 |
#define DPRINTF_DEBUG 0x80000000 |
#define DPRINTF_DEBUG 0x80000000 |
47 |
|
|
48 |
/* debug level for this library */ |
/* debug level for this library */ |
49 |
|
#ifdef _DEBUG |
50 |
|
#ifndef DPRINTF_LEVEL |
51 |
|
#define DPRINTF_LEVEL 0x8000000f |
52 |
|
#endif |
53 |
|
#else |
54 |
#define DPRINTF_LEVEL 0 |
#define DPRINTF_LEVEL 0 |
55 |
|
#endif |
56 |
|
|
57 |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
58 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
91 |
****************************************************************************/ |
****************************************************************************/ |
92 |
|
|
93 |
#if defined(ARCH_IS_32BIT) |
#if defined(ARCH_IS_32BIT) |
94 |
# define CACHE_LINE 16 |
# define CACHE_LINE 64 |
95 |
# define ptr_t uint32_t |
# define ptr_t uint32_t |
96 |
|
# define intptr_t int32_t |
97 |
|
# if _MSC_VER < 1300 |
98 |
|
# define uintptr_t uint32_t |
99 |
|
# else |
100 |
|
# include <stdarg.h> |
101 |
|
# endif |
102 |
#elif defined(ARCH_IS_64BIT) |
#elif defined(ARCH_IS_64BIT) |
103 |
# define CACHE_LINE 32 |
# define CACHE_LINE 64 |
104 |
# define ptr_t uint64_t |
# define ptr_t uint64_t |
105 |
|
# define intptr_t int64_t |
106 |
|
# if _MSC_VER < 1300 |
107 |
|
# define uintptr_t uint64_t |
108 |
|
# else |
109 |
|
# include <stdarg.h> |
110 |
|
# endif |
111 |
#else |
#else |
112 |
# error You are trying to compile XviD without defining address bus size. |
# error You are trying to compile XviD without defining address bus size. |
113 |
#endif |
#endif |
129 |
#include <windows.h> |
#include <windows.h> |
130 |
#include <stdio.h> |
#include <stdio.h> |
131 |
|
|
132 |
|
/* Non ANSI mapping */ |
133 |
|
# define snprintf _snprintf |
134 |
|
# define vsnprintf _vsnprintf |
135 |
|
|
136 |
/* |
/* |
137 |
* This function must be declared/defined all the time because MSVC does |
* This function must be declared/defined all the time because MSVC does |
138 |
* not support C99 variable arguments macros. |
* not support C99 variable arguments macros. |
153 |
} |
} |
154 |
} |
} |
155 |
# else |
# else |
156 |
static __inline void DPRINTF(int level, char *fmt, ...) |
static __inline void DPRINTF(int level, char *fmt, ...) {} |
|
{ |
|
|
} |
|
157 |
# endif |
# endif |
158 |
|
|
159 |
# if _MSC_VER <= 1200 |
# if _MSC_VER <= 1200 |
171 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
172 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
173 |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
|
# define EMMS() __asm {emms} |
|
174 |
|
|
|
# ifdef _PROFILING_ |
|
175 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
176 |
{ |
{ |
177 |
int64_t ts; |
int64_t ts; |
184 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
185 |
return ts; |
return ts; |
186 |
} |
} |
|
# endif |
|
187 |
|
|
188 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
189 |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
192 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
193 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
194 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
|
# define EMMS() |
|
195 |
|
|
|
# ifdef _PROFILING_ |
|
196 |
# include <time.h> |
# include <time.h> |
197 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
198 |
{ |
{ |
199 |
return (int64_t)clock(); |
return (int64_t)clock(); |
200 |
} |
} |
|
# endif |
|
201 |
|
|
202 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
203 |
| msvc Not given architecture - This is probably an user who tries to build |
| msvc Not given architecture - This is probably an user who tries to build |
254 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
255 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
256 |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
|
# define EMMS() __asm__ ("emms\n\t"); |
|
257 |
|
|
|
# ifdef _PROFILING_ |
|
258 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
259 |
{ |
{ |
260 |
int64_t ts; |
int64_t ts; |
263 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
264 |
return ts; |
return ts; |
265 |
} |
} |
|
# endif |
|
266 |
|
|
267 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
268 |
| gcc PPC and PPC Altivec specific macros/functions |
| gcc PPC and PPC Altivec specific macros/functions |
270 |
# elif defined(ARCH_IS_PPC) |
# elif defined(ARCH_IS_PPC) |
271 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
272 |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
|
# define EMMS() |
|
273 |
|
|
|
# ifdef _PROFILING_ |
|
274 |
static __inline unsigned long get_tbl(void) |
static __inline unsigned long get_tbl(void) |
275 |
{ |
{ |
276 |
unsigned long tbl; |
unsigned long tbl; |
294 |
}while (tb != get_tbl()); |
}while (tb != get_tbl()); |
295 |
return (((int64_t) tu) << 32) | (int64_t) tb; |
return (((int64_t) tu) << 32) | (int64_t) tb; |
296 |
} |
} |
|
# endif |
|
297 |
|
|
298 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
299 |
| gcc IA64 specific macros/functions |
| gcc IA64 specific macros/functions |
302 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
303 |
("mux1 %1 = %0, @rev" ";;" \ |
("mux1 %1 = %0, @rev" ";;" \ |
304 |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
|
# define EMMS() |
|
305 |
|
|
|
# ifdef _PROFILING_ |
|
306 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
307 |
{ |
{ |
308 |
unsigned long result; |
unsigned long result; |
309 |
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
310 |
return result; |
return result; |
311 |
} |
} |
|
# endif |
|
312 |
|
|
313 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
314 |
| gcc GENERIC (plain C only) specific macros/functions |
| gcc GENERIC (plain C only) specific macros/functions |
317 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
318 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
319 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
|
# define EMMS() |
|
320 |
|
|
|
# ifdef _PROFILING_ |
|
321 |
# include <time.h> |
# include <time.h> |
322 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
323 |
{ |
{ |
324 |
return (int64_t)clock(); |
return (int64_t)clock(); |
325 |
} |
} |
|
# endif |
|
326 |
|
|
327 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
328 |
| gcc Not given architecture - This is probably an user who tries to build |
| gcc Not given architecture - This is probably an user who tries to build |
332 |
# error You are trying to compile XviD without defining the architecture type. |
# error You are trying to compile XviD without defining the architecture type. |
333 |
# endif |
# endif |
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
/***************************************************************************** |
/***************************************************************************** |
339 |
* OPEN WATCOM C/C++ compiler |
* Open WATCOM C/C++ compiler |
340 |
****************************************************************************/ |
****************************************************************************/ |
341 |
|
|
342 |
#elif defined(__WATCOMC__) |
#elif defined(__WATCOMC__) |
343 |
|
|
344 |
# include <stdio.h> |
# include <stdio.h> |
364 |
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
365 |
|
|
366 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
367 |
| watcom x86 specific macros/functions |
| watcom ia32 specific macros/functions |
368 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
369 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
370 |
|
|
371 |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
372 |
# define EMMS() __asm {emms} |
|
|
# ifdef _PROFILING_ |
|
373 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
374 |
{ |
{ |
375 |
uint64_t ts; |
uint64_t ts; |
382 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
383 |
return ts; |
return ts; |
384 |
} |
} |
|
# endif |
|
385 |
|
|
386 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
387 |
| watcom unsupported architecture |
| watcom GENERIC (plain C only) specific macros/functions. |
388 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
389 |
# else |
# elif defined(ARCH_IS_GENERIC) |
390 |
|
|
391 |
# define BSWAP(x) \ |
# define BSWAP(x) \ |
392 |
x = ((((x) & 0xff000000) >> 24) | \ |
x = ((((x) & 0xff000000) >> 24) | \ |
393 |
(((x) & 0x00ff0000) >> 8) | \ |
(((x) & 0x00ff0000) >> 8) | \ |
394 |
(((x) & 0x0000ff00) << 8) | \ |
(((x) & 0x0000ff00) << 8) | \ |
395 |
(((x) & 0x000000ff) << 24)) |
(((x) & 0x000000ff) << 24)) |
396 |
# define EMMS() |
|
|
# ifdef _PROFILING_ |
|
397 |
static int64_t read_counter() { return 0; } |
static int64_t read_counter() { return 0; } |
|
# endif |
|
398 |
|
|
399 |
|
/*---------------------------------------------------------------------------- |
400 |
|
| watcom Not given architecture - This is probably an user who tries to build |
401 |
|
| XviD the wrong way. |
402 |
|
*---------------------------------------------------------------------------*/ |
403 |
|
# else |
404 |
|
# error You are trying to compile XviD without defining the architecture type. |
405 |
# endif |
# endif |
406 |
|
|
407 |
|
|
408 |
/***************************************************************************** |
/***************************************************************************** |
409 |
* Unknown compiler |
* Unknown compiler |
410 |
****************************************************************************/ |
****************************************************************************/ |
441 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
442 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
443 |
|
|
|
# define EMMS() |
|
|
|
|
|
# ifdef _PROFILING_ |
|
444 |
# include <time.h> |
# include <time.h> |
445 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
446 |
{ |
{ |
447 |
return (int64_t)clock(); |
return (int64_t)clock(); |
448 |
} |
} |
|
# endif |
|
449 |
|
|
450 |
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
451 |
type name[(sizex)*(sizey)] |
type name[(sizex)*(sizey)] |
453 |
#endif /* Compiler test */ |
#endif /* Compiler test */ |
454 |
|
|
455 |
|
|
456 |
#endif |
#endif /* PORTAB_H */ |