75 |
# define CACHE_LINE 64 |
# define CACHE_LINE 64 |
76 |
# define ptr_t uint32_t |
# define ptr_t uint32_t |
77 |
# define intptr_t int32_t |
# define intptr_t int32_t |
78 |
# if _MSC_VER < 1300 |
# define _INTPTR_T_DEFINED |
79 |
# define uintptr_t uint32_t |
# if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) |
|
# else |
|
80 |
# include <stdarg.h> |
# include <stdarg.h> |
81 |
|
# else |
82 |
|
# define uintptr_t uint32_t |
83 |
# endif |
# endif |
84 |
#elif defined(ARCH_IS_64BIT) |
#elif defined(ARCH_IS_64BIT) |
85 |
# define CACHE_LINE 64 |
# define CACHE_LINE 64 |
86 |
# define ptr_t uint64_t |
# define ptr_t uint64_t |
87 |
# define intptr_t int64_t |
# define intptr_t int64_t |
88 |
# if _MSC_VER < 1300 |
# define _INTPTR_T_DEFINED |
89 |
# define uintptr_t uint64_t |
# if defined (_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER) |
|
# else |
|
90 |
# include <stdarg.h> |
# include <stdarg.h> |
91 |
|
# else |
92 |
|
# define uintptr_t uint64_t |
93 |
# endif |
# endif |
94 |
#else |
#else |
95 |
# error You are trying to compile XviD without defining address bus size. |
# error You are trying to compile XviD without defining address bus size. |
131 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
132 |
va_start(args, fmt); |
va_start(args, fmt); |
133 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
134 |
OutputDebugString(buf); |
va_end(args); |
135 |
|
OutputDebugStringA(buf); |
136 |
fprintf(stderr, "%s", buf); |
fprintf(stderr, "%s", buf); |
137 |
} |
} |
138 |
} |
} |
169 |
return ts; |
return ts; |
170 |
} |
} |
171 |
|
|
172 |
|
# elif defined(ARCH_IS_X86_64) |
173 |
|
|
174 |
|
# include <intrin.h> |
175 |
|
|
176 |
|
# define BSWAP(a) ((a) = _byteswap_ulong(a)) |
177 |
|
|
178 |
|
static __inline int64_t read_counter(void) { return __rdtsc(); } |
179 |
|
|
180 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
181 |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
182 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
229 |
if(xvid_debug & level) { |
if(xvid_debug & level) { |
230 |
vfprintf(stderr, format, args); |
vfprintf(stderr, format, args); |
231 |
} |
} |
232 |
|
va_end(args); |
233 |
} |
} |
234 |
|
|
235 |
# else /* _DEBUG */ |
# else /* _DEBUG */ |
244 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
245 |
| gcc IA32 specific macros/functions |
| gcc IA32 specific macros/functions |
246 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
247 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
248 |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
249 |
|
|
250 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
260 |
| gcc PPC and PPC Altivec specific macros/functions |
| gcc PPC and PPC Altivec specific macros/functions |
261 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
262 |
# elif defined(ARCH_IS_PPC) |
# elif defined(ARCH_IS_PPC) |
263 |
|
|
264 |
|
# if defined(HAVE_ALTIVEC_PARENTHESES_DECL) |
265 |
|
# define AVV(x...) (x) |
266 |
|
# elif defined(HAVE_ALTIVEC_BRACES_DECL) |
267 |
|
# define AVV(x...) {x} |
268 |
|
# else |
269 |
|
# error Trying to compile PPC target without a vector declaration type. |
270 |
|
# endif |
271 |
|
|
272 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
273 |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
274 |
|
|
301 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
302 |
# elif defined(ARCH_IS_IA64) |
# elif defined(ARCH_IS_IA64) |
303 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
304 |
("mux1 %1 = %0, @rev" ";;" \ |
("mux1 %0 = %1, @rev" ";;" \ |
305 |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
"shr.u %0 = %0, 32" : "=r" (a) : "r" (a)); |
306 |
|
|
307 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
308 |
{ |
{ |
353 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
354 |
va_start(args, fmt); |
va_start(args, fmt); |
355 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
356 |
|
va_end(args); |
357 |
fprintf(stderr, "%s", buf); |
fprintf(stderr, "%s", buf); |
358 |
} |
} |
359 |
} |
} |
368 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
369 |
| watcom ia32 specific macros/functions |
| watcom ia32 specific macros/functions |
370 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
371 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
372 |
|
|
373 |
# 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 |
374 |
|
|
432 |
if(xvid_debug & level) { |
if(xvid_debug & level) { |
433 |
vfprintf(stderr, format, args); |
vfprintf(stderr, format, args); |
434 |
} |
} |
435 |
|
va_end(args); |
436 |
} |
} |
437 |
|
|
438 |
# else /* _DEBUG */ |
# else /* _DEBUG */ |