47 |
|
|
48 |
/* debug level for this library */ |
/* debug level for this library */ |
49 |
#ifdef _DEBUG |
#ifdef _DEBUG |
50 |
#define DPRINTF_LEVEL 0x000000ff |
#ifndef DPRINTF_LEVEL |
51 |
|
#define DPRINTF_LEVEL 0x8000000f |
52 |
|
#endif |
53 |
#else |
#else |
54 |
#define DPRINTF_LEVEL 0 |
#define DPRINTF_LEVEL 0 |
55 |
#endif |
#endif |
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 |
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 |
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 |
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 |
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)) |
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 |
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) ); |
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 |
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)); |
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 |
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)); |
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 |
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)) |
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 |
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 |
|
|
|
# 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 GENERIC (plain C only) specific macros/functions. |
| watcom GENERIC (plain C only) specific macros/functions. |
394 |
(((x) & 0x0000ff00) << 8) | \ |
(((x) & 0x0000ff00) << 8) | \ |
395 |
(((x) & 0x000000ff) << 24)) |
(((x) & 0x000000ff) << 24)) |
396 |
|
|
|
# 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 |
| watcom Not given architecture - This is probably an user who tries to build |
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 |
|
|
|
# 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)] |