1 |
#ifndef _PORTAB_H_ |
#ifndef _PORTAB_H_ |
2 |
#define _PORTAB_H_ |
#define _PORTAB_H_ |
3 |
|
|
4 |
|
|
5 |
|
// debug level masks |
6 |
|
#define DPRINTF_ERROR 0x00000001 |
7 |
|
#define DPRINTF_STARTCODE 0x00000002 |
8 |
|
#define DPRINTF_HEADER 0x00000004 |
9 |
|
#define DPRINTF_TIMECODE 0x00000008 |
10 |
|
#define DPRINTF_MB 0x00000010 |
11 |
|
#define DPRINTF_COEFF 0x00000020 |
12 |
|
#define DPRINTF_MV 0x00000040 |
13 |
|
#define DPRINTF_DEBUG 0x80000000 |
14 |
|
|
15 |
|
// debug level |
16 |
|
#define DPRINTF_LEVEL 0 |
17 |
|
|
18 |
|
|
19 |
|
#define DPRINTF_BUF_SZ 1024 |
20 |
|
|
21 |
|
|
22 |
#if defined(WIN32) |
#if defined(WIN32) |
23 |
|
|
24 |
#include <windows.h> |
#include <windows.h> |
25 |
#include <stdio.h> |
#include <stdio.h> |
26 |
|
|
27 |
|
static __inline void |
28 |
#define DPRINTF_BUF_SZ 1024 |
DPRINTF(int level, char *fmt, |
|
static void |
|
|
DPRINTF(char *fmt, |
|
29 |
...) |
...) |
30 |
{ |
{ |
31 |
|
if ((DPRINTF_LEVEL & level)) |
32 |
|
{ |
33 |
va_list args; |
va_list args; |
34 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
35 |
|
|
37 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
38 |
OutputDebugString(buf); |
OutputDebugString(buf); |
39 |
fprintf(stdout, "%s\n", buf); |
fprintf(stdout, "%s\n", buf); |
40 |
|
fflush(stdout); |
41 |
|
} |
42 |
} |
} |
43 |
|
|
44 |
|
|
109 |
|
|
110 |
#include <stdio.h> |
#include <stdio.h> |
111 |
#include <stdarg.h> |
#include <stdarg.h> |
112 |
#define DPRINTF_BUF_SZ 1024 |
|
113 |
static void |
static __inline void |
114 |
DPRINTF(char *fmt, |
DPRINTF(int level, char *fmt, |
115 |
...) |
...) |
116 |
{ |
{ |
117 |
|
if ((DPRINTF_LEVEL & level)) { |
118 |
va_list args; |
va_list args; |
119 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
120 |
|
|
122 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
123 |
fprintf(stdout, "%s\n", buf); |
fprintf(stdout, "%s\n", buf); |
124 |
} |
} |
125 |
|
} |
126 |
|
|
127 |
#ifdef _DEBUG |
#ifdef _DEBUG |
128 |
|
|
215 |
#define EMMS() |
#define EMMS() |
216 |
|
|
217 |
// needed for bitstream.h |
// needed for bitstream.h |
218 |
#define BSWAP(a) \ |
#define BSWAP(a) __asm__ __volatile__ ("mux1 %1 = %0, @rev" \ |
219 |
((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) |
";;" \ |
220 |
|
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
221 |
|
|
222 |
// rdtsc command most likely not supported, |
// rdtsc replacement for ia64 |
|
// so just dummy code here |
|
223 |
static __inline int64_t read_counter() { |
static __inline int64_t read_counter() { |
224 |
return 0; |
unsigned long result; |
225 |
|
|
226 |
|
// __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
227 |
|
// while (__builtin_expect ((int) result == -1, 0)) |
228 |
|
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
229 |
|
return result; |
230 |
|
|
231 |
} |
} |
232 |
|
|
233 |
#else |
#else |
261 |
|
|
262 |
#include <stdio.h> |
#include <stdio.h> |
263 |
#include <stdarg.h> |
#include <stdarg.h> |
264 |
#define DPRINTF_BUF_SZ 1024 |
|
265 |
static void |
static __inline void |
266 |
DPRINTF(char *fmt, |
DPRINTF(int level, char *fmt, ...) |
|
...) |
|
267 |
{ |
{ |
268 |
|
if ((DPRINTF_LEVEL & level)) { |
269 |
|
|
270 |
va_list args; |
va_list args; |
271 |
char buf[DPRINTF_BUF_SZ]; |
char buf[DPRINTF_BUF_SZ]; |
272 |
|
|
274 |
vsprintf(buf, fmt, args); |
vsprintf(buf, fmt, args); |
275 |
fprintf(stdout, "%s\n", buf); |
fprintf(stdout, "%s\n", buf); |
276 |
} |
} |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
#define DEBUG(S) |
#define DEBUG(S) |