1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - Portable macros, types and inlined assembly - |
5 |
|
* |
6 |
|
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
7 |
|
* 2002 Peter Ross <pross@xvid.org> |
8 |
|
* 2002 Edouard Gomez <ed.gomez@free.fr> |
9 |
|
* |
10 |
|
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
11 |
|
* |
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 |
15 |
|
* (at your option) any later version. |
16 |
|
* |
17 |
|
* This program is distributed in the hope that it will be useful, |
18 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 |
|
* GNU General Public License for more details. |
21 |
|
* |
22 |
|
* You should have received a copy of the GNU General Public License |
23 |
|
* along with this program; if not, write to the Free Software |
24 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 |
|
* |
26 |
|
* $Id$ |
27 |
|
* |
28 |
|
****************************************************************************/ |
29 |
|
|
30 |
#ifndef _PORTAB_H_ |
#ifndef _PORTAB_H_ |
31 |
#define _PORTAB_H_ |
#define _PORTAB_H_ |
32 |
|
|
33 |
#if defined(WIN32) |
/***************************************************************************** |
34 |
|
* Common things |
35 |
#include <windows.h> |
****************************************************************************/ |
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 |
#ifdef _DEBUG |
50 |
#define DEBUG(S) OutputDebugString((S)); |
#define DPRINTF_LEVEL 0x000000ff |
51 |
#define DEBUG1(S,I) { char tmp[100]; wsprintf(tmp, "%s %i\n", (S), (I)); OutputDebugString(tmp); } |
#else |
52 |
#define DEBUG2(X,A,B) { char tmp[100]; wsprintf(tmp, "%s %i %i\n", (X), (A), (B)); OutputDebugString(tmp); } |
#define DPRINTF_LEVEL 0 |
|
#define DEBUG3(X,A,B,C){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i",(X),(A), (B), (C)); OutputDebugString(tmp); } |
|
|
#define DEBUG8(X,A,B,C,D,E,F,G,H){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i %i %i %i %i %i",(X),(A),(B),(C),(D),(E),(F),(G),(H)); OutputDebugString(tmp); } |
|
|
#else |
|
|
#define DEBUG(S) |
|
|
#define DEBUG1(S,I) |
|
|
#define DEBUG2(X,A,B) |
|
|
#define DEBUG3(X,A,B,C) |
|
|
#define DEBUG8(X,A,B,C,D,E,F,G,H) |
|
53 |
#endif |
#endif |
54 |
|
|
55 |
|
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
56 |
|
#define DPRINTF_BUF_SZ 1024 |
57 |
|
|
58 |
|
/***************************************************************************** |
59 |
|
* Types used in XviD sources |
60 |
|
****************************************************************************/ |
61 |
|
|
62 |
|
/*---------------------------------------------------------------------------- |
63 |
|
| For MSVC |
64 |
|
*---------------------------------------------------------------------------*/ |
65 |
|
|
66 |
|
#if defined(_MSC_VER) || defined (__WATCOMC__) |
67 |
#define int8_t char |
#define int8_t char |
68 |
#define uint8_t unsigned char |
#define uint8_t unsigned char |
69 |
#define int16_t short |
#define int16_t short |
73 |
#define int64_t __int64 |
#define int64_t __int64 |
74 |
#define uint64_t unsigned __int64 |
#define uint64_t unsigned __int64 |
75 |
|
|
76 |
#define EMMS() __asm {emms} |
/*---------------------------------------------------------------------------- |
77 |
|
| For all other compilers, use the standard header file |
78 |
|
| (compiler should be ISO C99 compatible, perhaps ISO C89 is enough) |
79 |
|
*---------------------------------------------------------------------------*/ |
80 |
|
|
81 |
|
#else |
82 |
|
|
83 |
|
# include <inttypes.h> |
84 |
|
|
85 |
|
#endif |
86 |
|
|
87 |
|
/***************************************************************************** |
88 |
|
* Some things that are only architecture dependant |
89 |
|
****************************************************************************/ |
90 |
|
|
91 |
|
#if defined(ARCH_IS_32BIT) |
92 |
|
# define CACHE_LINE 64 |
93 |
|
# define ptr_t uint32_t |
94 |
|
# define intptr_t int32_t |
95 |
|
# if _MSC_VER < 1300 |
96 |
|
# define uintptr_t uint32_t |
97 |
|
# else |
98 |
|
# include <stdarg.h> |
99 |
|
# endif |
100 |
|
#elif defined(ARCH_IS_64BIT) |
101 |
|
# define CACHE_LINE 64 |
102 |
|
# define ptr_t uint64_t |
103 |
|
# define intptr_t int64_t |
104 |
|
# if _MSC_VER < 1300 |
105 |
|
# define uintptr_t uint64_t |
106 |
|
# else |
107 |
|
# include <stdarg.h> |
108 |
|
# endif |
109 |
|
#else |
110 |
|
# error You are trying to compile XviD without defining address bus size. |
111 |
|
#endif |
112 |
|
|
113 |
|
/***************************************************************************** |
114 |
|
* Things that must be sorted by compiler and then by architecture |
115 |
|
****************************************************************************/ |
116 |
|
|
117 |
|
/***************************************************************************** |
118 |
|
* MSVC compiler specific macros, functions |
119 |
|
****************************************************************************/ |
120 |
|
|
121 |
|
#if defined(_MSC_VER) |
122 |
|
|
123 |
|
/*---------------------------------------------------------------------------- |
124 |
|
| Common msvc stuff |
125 |
|
*---------------------------------------------------------------------------*/ |
126 |
|
|
127 |
|
# include <windows.h> |
128 |
|
# include <stdio.h> |
129 |
|
|
130 |
|
/* Non ANSI mapping */ |
131 |
|
# define snprintf _snprintf |
132 |
|
# define vsnprintf _vsnprintf |
133 |
|
|
134 |
|
/* |
135 |
|
* This function must be declared/defined all the time because MSVC does |
136 |
|
* not support C99 variable arguments macros. |
137 |
|
* |
138 |
|
* Btw, if the MS compiler does its job well, it should remove the nop |
139 |
|
* DPRINTF function when not compiling in _DEBUG mode |
140 |
|
*/ |
141 |
|
# ifdef _DEBUG |
142 |
|
static __inline void DPRINTF(int level, char *fmt, ...) |
143 |
|
{ |
144 |
|
if (DPRINTF_LEVEL & level) { |
145 |
|
va_list args; |
146 |
|
char buf[DPRINTF_BUF_SZ]; |
147 |
|
va_start(args, fmt); |
148 |
|
vsprintf(buf, fmt, args); |
149 |
|
OutputDebugString(buf); |
150 |
|
fprintf(stderr, "%s\n", buf); |
151 |
|
} |
152 |
|
} |
153 |
|
# else |
154 |
|
static __inline void DPRINTF(int level, char *fmt, ...) {} |
155 |
|
# endif |
156 |
|
|
157 |
|
# if _MSC_VER <= 1200 |
158 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
159 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
160 |
|
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
161 |
|
# else |
162 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
163 |
|
__declspec(align(alignment)) type name[(sizex)*(sizey)] |
164 |
|
# endif |
165 |
|
|
|
#define CACHE_LINE 16 |
|
|
#define CACHE_ALIGN __declspec(align(CACHE_LINE)) |
|
166 |
|
|
167 |
// needed for bitstream.h |
/*---------------------------------------------------------------------------- |
168 |
|
| msvc x86 specific macros/functions |
169 |
|
*---------------------------------------------------------------------------*/ |
170 |
|
# if defined(ARCH_IS_IA32) |
171 |
#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 |
172 |
|
|
173 |
// needed for timer.c |
static __inline int64_t read_counter(void) |
174 |
static __inline int64_t read_counter() { |
{ |
175 |
int64_t ts; |
int64_t ts; |
176 |
uint32_t ts1, ts2; |
uint32_t ts1, ts2; |
|
|
|
177 |
__asm { |
__asm { |
178 |
rdtsc |
rdtsc |
179 |
mov ts1, eax |
mov ts1, eax |
180 |
mov ts2, edx |
mov ts2, edx |
181 |
} |
} |
|
|
|
182 |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
|
|
|
183 |
return ts; |
return ts; |
184 |
} |
} |
185 |
|
|
186 |
#elif defined(LINUX) || defined(DJGPP) |
/*---------------------------------------------------------------------------- |
187 |
|
| msvc GENERIC (plain C only) - Probably alpha or some embedded device |
188 |
|
*---------------------------------------------------------------------------*/ |
189 |
|
# elif defined(ARCH_IS_GENERIC) |
190 |
|
# define BSWAP(a) \ |
191 |
|
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
192 |
|
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
193 |
|
|
194 |
|
# include <time.h> |
195 |
|
static __inline int64_t read_counter(void) |
196 |
|
{ |
197 |
|
return (int64_t)clock(); |
198 |
|
} |
199 |
|
|
200 |
|
/*---------------------------------------------------------------------------- |
201 |
|
| msvc Not given architecture - This is probably an user who tries to build |
202 |
|
| XviD the wrong way. |
203 |
|
*---------------------------------------------------------------------------*/ |
204 |
|
# else |
205 |
|
# error You are trying to compile XviD without defining the architecture type. |
206 |
|
# endif |
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
/***************************************************************************** |
212 |
|
* GNU CC compiler stuff |
213 |
|
****************************************************************************/ |
214 |
|
|
215 |
|
#elif defined(__GNUC__) || defined(__ICC) /* Compiler test */ |
216 |
|
|
217 |
|
/*---------------------------------------------------------------------------- |
218 |
|
| Common gcc stuff |
219 |
|
*---------------------------------------------------------------------------*/ |
220 |
|
|
221 |
|
/* |
222 |
|
* As gcc is (mostly) C99 compliant, we define DPRINTF only if it's realy needed |
223 |
|
* and it's a macro calling fprintf directly |
224 |
|
*/ |
225 |
#ifdef _DEBUG |
#ifdef _DEBUG |
226 |
|
|
227 |
|
/* Needed for all debuf fprintf calls */ |
228 |
#include <stdio.h> |
#include <stdio.h> |
229 |
#define DEBUG_WHERE stdout |
# include <stdarg.h> |
|
#define DEBUG(S) fprintf(DEBUG_WHERE, "%s\n", (S)); |
|
|
#define DEBUG1(S,I) fprintf(DEBUG_WHERE, "%s %i\n", (S), (I)) |
|
|
#define DEBUG2(S,A,B) fprintf(DEBUG_WHERE, "%s%i=%i\n", (S), (A), (B)) |
|
|
#define DEBUG3(S,A,B,C) fprintf(DEBUG_WHERE, "%s %i %x %x\n", (S), (A), (B), (C)) |
|
|
#define DEBUG8(S,A,B,C,D,E,F,G,H) |
|
|
#else |
|
|
#define DEBUG(S) |
|
|
#define DEBUG1(S,I) |
|
|
#define DEBUG2(X,A,B) |
|
|
#define DEBUG3(X,A,B,C) |
|
|
#define DEBUG8(X,A,B,C,D,E,F,G,H) |
|
|
#endif |
|
230 |
|
|
231 |
#define CACHE_LINE 16 |
static __inline void DPRINTF(int level, char *format, ...) |
232 |
#define CACHE_ALIGN __attribute__ ((__aligned__(CACHE_LINE))) |
{ |
233 |
|
va_list args; |
234 |
|
va_start(args, format); |
235 |
|
if(DPRINTF_LEVEL & level) { |
236 |
|
vfprintf(stderr, format, args); |
237 |
|
fprintf(stderr, "\n"); |
238 |
|
} |
239 |
|
} |
240 |
|
|
241 |
|
# else /* _DEBUG */ |
242 |
|
static __inline void DPRINTF(int level, char *format, ...) {} |
243 |
|
# endif /* _DEBUG */ |
244 |
|
|
245 |
|
|
246 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
247 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
248 |
|
type * name = (type *) (((ptr_t) name##_storage+(alignment - 1)) & ~((ptr_t)(alignment)-1)) |
249 |
|
|
250 |
|
/*---------------------------------------------------------------------------- |
251 |
|
| gcc IA32 specific macros/functions |
252 |
|
*---------------------------------------------------------------------------*/ |
253 |
|
# if defined(ARCH_IS_IA32) |
254 |
|
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
255 |
|
|
256 |
#if defined(LINUX) |
static __inline int64_t read_counter(void) |
257 |
|
{ |
258 |
|
int64_t ts; |
259 |
|
uint32_t ts1, ts2; |
260 |
|
__asm__ __volatile__("rdtsc\n\t":"=a"(ts1), "=d"(ts2)); |
261 |
|
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
262 |
|
return ts; |
263 |
|
} |
264 |
|
|
265 |
#include <stdint.h> |
/*---------------------------------------------------------------------------- |
266 |
|
| gcc PPC and PPC Altivec specific macros/functions |
267 |
|
*---------------------------------------------------------------------------*/ |
268 |
|
# elif defined(ARCH_IS_PPC) |
269 |
|
# define BSWAP(a) __asm__ __volatile__ \ |
270 |
|
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
271 |
|
|
272 |
|
static __inline unsigned long get_tbl(void) |
273 |
|
{ |
274 |
|
unsigned long tbl; |
275 |
|
asm volatile ("mftb %0":"=r" (tbl)); |
276 |
|
return tbl; |
277 |
|
} |
278 |
|
|
279 |
#else |
static __inline unsigned long get_tbu(void) |
280 |
|
{ |
281 |
|
unsigned long tbl; |
282 |
|
asm volatile ("mftbu %0":"=r" (tbl)); |
283 |
|
return tbl; |
284 |
|
} |
285 |
|
|
286 |
#define int8_t char |
static __inline int64_t read_counter(void) |
287 |
#define uint8_t unsigned char |
{ |
288 |
#define int16_t short |
unsigned long tb, tu; |
289 |
#define uint16_t unsigned short |
do { |
290 |
#define int32_t int |
tu = get_tbu(); |
291 |
#define uint32_t unsigned int |
tb = get_tbl(); |
292 |
#define int64_t long long |
}while (tb != get_tbl()); |
293 |
#define uint64_t unsigned long long |
return (((int64_t) tu) << 32) | (int64_t) tb; |
294 |
|
} |
295 |
|
|
296 |
#endif |
/*---------------------------------------------------------------------------- |
297 |
|
| gcc IA64 specific macros/functions |
298 |
|
*---------------------------------------------------------------------------*/ |
299 |
|
# elif defined(ARCH_IS_IA64) |
300 |
|
# define BSWAP(a) __asm__ __volatile__ \ |
301 |
|
("mux1 %1 = %0, @rev" ";;" \ |
302 |
|
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
303 |
|
|
304 |
|
static __inline int64_t read_counter(void) |
305 |
|
{ |
306 |
|
unsigned long result; |
307 |
|
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); |
308 |
|
return result; |
309 |
|
} |
310 |
|
|
311 |
|
/*---------------------------------------------------------------------------- |
312 |
|
| gcc GENERIC (plain C only) specific macros/functions |
313 |
|
*---------------------------------------------------------------------------*/ |
314 |
|
# elif defined(ARCH_IS_GENERIC) |
315 |
|
# define BSWAP(a) \ |
316 |
|
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
317 |
|
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
318 |
|
|
319 |
|
# include <time.h> |
320 |
|
static __inline int64_t read_counter(void) |
321 |
|
{ |
322 |
|
return (int64_t)clock(); |
323 |
|
} |
324 |
|
|
325 |
// needed for bitstream.h |
/*---------------------------------------------------------------------------- |
326 |
#ifdef ARCH_PPC |
| gcc Not given architecture - This is probably an user who tries to build |
327 |
#define BSWAP(a) __asm__ ( "lwbrx %0,0,%1; eieio" : "=r" (a) : \ |
| XviD the wrong way. |
328 |
"r" (&(a)), "m" (a)); |
*---------------------------------------------------------------------------*/ |
|
#define EMMS() |
|
329 |
#else |
#else |
330 |
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
# error You are trying to compile XviD without defining the architecture type. |
|
#define EMMS() __asm__("emms\n\t") |
|
331 |
#endif |
#endif |
332 |
|
|
|
// needed for timer.c |
|
|
static __inline int64_t read_counter() { |
|
|
int64_t ts; |
|
|
uint32_t ts1, ts2; |
|
333 |
|
|
|
__asm__ __volatile__("rdtsc\n\t":"=a"(ts1), "=d"(ts2)); |
|
334 |
|
|
|
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
|
335 |
|
|
336 |
|
/***************************************************************************** |
337 |
|
* Open WATCOM C/C++ compiler |
338 |
|
****************************************************************************/ |
339 |
|
|
340 |
|
#elif defined(__WATCOMC__) |
341 |
|
|
342 |
|
# include <stdio.h> |
343 |
|
# include <stdarg.h> |
344 |
|
|
345 |
|
# ifdef _DEBUG |
346 |
|
static __inline void DPRINTF(int level, char *fmt, ...) |
347 |
|
{ |
348 |
|
if (DPRINTF_LEVEL & level) { |
349 |
|
va_list args; |
350 |
|
char buf[DPRINTF_BUF_SZ]; |
351 |
|
va_start(args, fmt); |
352 |
|
vsprintf(buf, fmt, args); |
353 |
|
fprintf(stderr, "%s\n", buf); |
354 |
|
} |
355 |
|
} |
356 |
|
# else /* _DEBUG */ |
357 |
|
static __inline void DPRINTF(int level, char *format, ...) {} |
358 |
|
# endif /* _DEBUG */ |
359 |
|
|
360 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
361 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
362 |
|
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
363 |
|
|
364 |
|
/*---------------------------------------------------------------------------- |
365 |
|
| watcom ia32 specific macros/functions |
366 |
|
*---------------------------------------------------------------------------*/ |
367 |
|
# if defined(ARCH_IS_IA32) |
368 |
|
|
369 |
|
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
370 |
|
|
371 |
|
static __inline int64_t read_counter(void) |
372 |
|
{ |
373 |
|
uint64_t ts; |
374 |
|
uint32_t ts1, ts2; |
375 |
|
__asm { |
376 |
|
rdtsc |
377 |
|
mov ts1, eax |
378 |
|
mov ts2, edx |
379 |
|
} |
380 |
|
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
381 |
return ts; |
return ts; |
382 |
} |
} |
383 |
|
|
384 |
#else // OTHER OS |
/*---------------------------------------------------------------------------- |
385 |
|
| watcom GENERIC (plain C only) specific macros/functions. |
386 |
|
*---------------------------------------------------------------------------*/ |
387 |
|
# elif defined(ARCH_IS_GENERIC) |
388 |
|
|
389 |
|
# define BSWAP(x) \ |
390 |
|
x = ((((x) & 0xff000000) >> 24) | \ |
391 |
|
(((x) & 0x00ff0000) >> 8) | \ |
392 |
|
(((x) & 0x0000ff00) << 8) | \ |
393 |
|
(((x) & 0x000000ff) << 24)) |
394 |
|
|
395 |
|
static int64_t read_counter() { return 0; } |
396 |
|
|
397 |
|
/*---------------------------------------------------------------------------- |
398 |
|
| watcom Not given architecture - This is probably an user who tries to build |
399 |
|
| XviD the wrong way. |
400 |
|
*---------------------------------------------------------------------------*/ |
401 |
|
# else |
402 |
|
# error You are trying to compile XviD without defining the architecture type. |
403 |
|
# endif |
404 |
|
|
405 |
|
|
406 |
#define DEBUG(S) |
/***************************************************************************** |
407 |
#define DEBUG1(S,I) |
* Unknown compiler |
408 |
#define DEBUG2(X,A,B) |
****************************************************************************/ |
409 |
#define DEBUG3(X,A,B,C) |
#else /* Compiler test */ |
410 |
#define DEBUG8(X,A,B,C,D,E,F,G,H) |
|
411 |
|
/* |
412 |
|
* Ok we know nothing about the compiler, so we fallback to ANSI C |
413 |
|
* features, so every compiler should be happy and compile the code. |
414 |
|
* |
415 |
|
* This is (mostly) equivalent to ARCH_IS_GENERIC. |
416 |
|
*/ |
417 |
|
|
418 |
#include <inttypes.h> |
# ifdef _DEBUG |
419 |
|
|
420 |
#define EMMS() |
/* Needed for all debuf fprintf calls */ |
421 |
|
# include <stdio.h> |
422 |
|
# include <stdarg.h> |
423 |
|
|
424 |
|
static __inline void DPRINTF(int level, char *format, ...) |
425 |
|
{ |
426 |
|
va_list args; |
427 |
|
va_start(args, format); |
428 |
|
if(DPRINTF_LEVEL & level) { |
429 |
|
vfprintf(stderr, format, args); |
430 |
|
fprintf(stderr, "\n"); |
431 |
|
} |
432 |
|
} |
433 |
|
|
434 |
|
# else /* _DEBUG */ |
435 |
|
static __inline void DPRINTF(int level, char *format, ...) {} |
436 |
|
# endif /* _DEBUG */ |
437 |
|
|
|
// needed for bitstream.h |
|
438 |
#define BSWAP(a) \ |
#define BSWAP(a) \ |
439 |
((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
440 |
|
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
441 |
|
|
442 |
// rdtsc command most likely not supported, |
# include <time.h> |
443 |
// so just dummy code here |
static __inline int64_t read_counter(void) |
444 |
static __inline int64_t read_counter() { |
{ |
445 |
return 0; |
return (int64_t)clock(); |
446 |
} |
} |
447 |
|
|
448 |
#define CACHE_LINE 16 |
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
449 |
#define CACHE_ALIGN |
type name[(sizex)*(sizey)] |
450 |
|
|
451 |
#endif |
#endif /* Compiler test */ |
452 |
|
|
|
#endif // _PORTAB_H_ |
|
453 |
|
|
454 |
|
#endif /* PORTAB_H */ |