4 |
* - Portable macros, types and inlined assembly - |
* - Portable macros, types and inlined assembly - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
7 |
* 2002-2003 Peter Ross <pross@xvid.org> |
* 2002 Peter Ross <pross@xvid.org> |
8 |
* 2002-2003 Edouard Gomez <ed.gomez@free.fr> |
* 2002 Edouard Gomez <ed.gomez@free.fr> |
9 |
* |
* |
10 |
* This program is free software ; you can redistribute it and/or modify |
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
11 |
* it under the terms of the GNU General Public License as published by |
* |
12 |
|
* XviD is free software; you can redistribute it and/or modify it |
13 |
|
* under the terms of the GNU General Public License as published by |
14 |
* the Free Software Foundation ; either version 2 of the License, or |
* the Free Software Foundation ; either version 2 of the License, or |
15 |
* (at your option) any later version. |
* (at your option) any later version. |
16 |
* |
* |
34 |
* Common things |
* Common things |
35 |
****************************************************************************/ |
****************************************************************************/ |
36 |
|
|
37 |
|
/* Debug level masks */ |
38 |
|
#define DPRINTF_ERROR 0x00000001 |
39 |
|
#define DPRINTF_STARTCODE 0x00000002 |
40 |
|
#define DPRINTF_HEADER 0x00000004 |
41 |
|
#define DPRINTF_TIMECODE 0x00000008 |
42 |
|
#define DPRINTF_MB 0x00000010 |
43 |
|
#define DPRINTF_COEFF 0x00000020 |
44 |
|
#define DPRINTF_MV 0x00000040 |
45 |
|
#define DPRINTF_RC 0x00000080 |
46 |
|
#define DPRINTF_DEBUG 0x80000000 |
47 |
|
|
48 |
|
/* debug level for this library */ |
49 |
|
#ifdef _DEBUG |
50 |
|
#define DPRINTF_LEVEL 0x000000ff |
51 |
|
#else |
52 |
|
#define DPRINTF_LEVEL 0 |
53 |
|
#endif |
54 |
|
|
55 |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
|
#if defined(_DEBUG) |
|
|
extern unsigned int xvid_debug; |
|
56 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
|
#endif |
|
57 |
|
|
58 |
/***************************************************************************** |
/***************************************************************************** |
59 |
* Types used in XviD sources |
* Types used in XviD sources |
92 |
# define CACHE_LINE 64 |
# define CACHE_LINE 64 |
93 |
# define ptr_t uint32_t |
# define ptr_t uint32_t |
94 |
# define intptr_t int32_t |
# define intptr_t int32_t |
|
# if _MSC_VER < 1300 |
|
95 |
# define uintptr_t uint32_t |
# define uintptr_t uint32_t |
|
# else |
|
|
# include <stdarg.h> |
|
|
# endif |
|
96 |
#elif defined(ARCH_IS_64BIT) |
#elif defined(ARCH_IS_64BIT) |
97 |
# define CACHE_LINE 64 |
# define CACHE_LINE 64 |
98 |
# define ptr_t uint64_t |
# define ptr_t uint64_t |
99 |
# define intptr_t int64_t |
# define intptr_t int64_t |
|
# if _MSC_VER < 1300 |
|
100 |
# define uintptr_t uint64_t |
# define uintptr_t uint64_t |
101 |
# else |
# else |
|
# include <stdarg.h> |
|
|
# endif |
|
|
#else |
|
102 |
# error You are trying to compile XviD without defining address bus size. |
# error You are trying to compile XviD without defining address bus size. |
103 |
#endif |
#endif |
104 |
|
|
133 |
# ifdef _DEBUG |
# ifdef _DEBUG |
134 |
static __inline void DPRINTF(int level, char *fmt, ...) |
static __inline void DPRINTF(int level, char *fmt, ...) |
135 |
{ |
{ |
136 |
if (xvid_debug & level) { |
if (DPRINTF_LEVEL & level) { |
137 |
va_list args; |
va_list args; |
138 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
139 |
va_start(args, fmt); |
va_start(args, fmt); |
140 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
141 |
OutputDebugString(buf); |
OutputDebugString(buf); |
142 |
fprintf(stderr, "%s", buf); |
fprintf(stderr, "%s\n", buf); |
143 |
} |
} |
144 |
} |
} |
145 |
# else |
# else |
224 |
{ |
{ |
225 |
va_list args; |
va_list args; |
226 |
va_start(args, format); |
va_start(args, format); |
227 |
if(xvid_debug & level) { |
if(DPRINTF_LEVEL & level) { |
228 |
vfprintf(stderr, format, args); |
vfprintf(stderr, format, args); |
229 |
|
fprintf(stderr, "\n"); |
230 |
} |
} |
231 |
} |
} |
232 |
|
|
337 |
# ifdef _DEBUG |
# ifdef _DEBUG |
338 |
static __inline void DPRINTF(int level, char *fmt, ...) |
static __inline void DPRINTF(int level, char *fmt, ...) |
339 |
{ |
{ |
340 |
if (xvid_debug & level) { |
if (DPRINTF_LEVEL & level) { |
341 |
va_list args; |
va_list args; |
342 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
343 |
va_start(args, fmt); |
va_start(args, fmt); |
344 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
345 |
fprintf(stderr, "%s", buf); |
fprintf(stderr, "%s\n", buf); |
346 |
} |
} |
347 |
} |
} |
348 |
# else /* _DEBUG */ |
# else /* _DEBUG */ |
417 |
{ |
{ |
418 |
va_list args; |
va_list args; |
419 |
va_start(args, format); |
va_start(args, format); |
420 |
if(xvid_debug & level) { |
if(DPRINTF_LEVEL & level) { |
421 |
vfprintf(stderr, format, args); |
vfprintf(stderr, format, args); |
422 |
|
fprintf(stderr, "\n"); |
423 |
} |
} |
424 |
} |
} |
425 |
|
|