[cvs] / xvidcore / src / portab.h Repository:
ViewVC logotype

Diff of /xvidcore/src/portab.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.44, Sun Feb 16 01:41:24 2003 UTC revision 1.46.2.6, Sat May 17 13:26:51 2003 UTC
# Line 34  Line 34 
34   *  Common things   *  Common things
35   ****************************************************************************/   ****************************************************************************/
36    
 /* Debug level masks */  
 #define DPRINTF_ERROR       0x00000001  
 #define DPRINTF_STARTCODE   0x00000002  
 #define DPRINTF_HEADER      0x00000004  
 #define DPRINTF_TIMECODE    0x00000008  
 #define DPRINTF_MB          0x00000010  
 #define DPRINTF_COEFF       0x00000020  
 #define DPRINTF_MV          0x00000040  
 #define DPRINTF_RC          0x00000080  
 #define DPRINTF_DEBUG       0x80000000  
   
 /* debug level for this library */  
 #ifdef _DEBUG  
 #define DPRINTF_LEVEL       0x000000ff  
 #else  
 #define DPRINTF_LEVEL       0  
 #endif  
   
37  /* Buffer size for msvc implementation because it outputs to DebugOutput */  /* Buffer size for msvc implementation because it outputs to DebugOutput */
38    #if defined(_DEBUG)
39    extern unsigned int xvid_debug;
40  #define DPRINTF_BUF_SZ  1024  #define DPRINTF_BUF_SZ  1024
41    #endif
42    
43  /*****************************************************************************  /*****************************************************************************
44   *  Types used in XviD sources   *  Types used in XviD sources
# Line 89  Line 74 
74   ****************************************************************************/   ****************************************************************************/
75    
76  #if defined(ARCH_IS_32BIT)  #if defined(ARCH_IS_32BIT)
77  #    define CACHE_LINE  16  #    define CACHE_LINE 64
78  #    define ptr_t uint32_t  #    define ptr_t uint32_t
79    #    define intptr_t int32_t
80    #    if _MSC_VER < 1300
81    #        define uintptr_t uint32_t
82    #    else
83    #        include <stdarg.h>
84    #    endif
85  #elif defined(ARCH_IS_64BIT)  #elif defined(ARCH_IS_64BIT)
86  #    define CACHE_LINE  32  #    define CACHE_LINE  64
87  #    define ptr_t uint64_t  #    define ptr_t uint64_t
88    #    define intptr_t int64_t
89    #    if _MSC_VER < 1300
90    #        define uintptr_t uint64_t
91    #    else
92    #        include <stdarg.h>
93    #    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.
96  #endif  #endif
# Line 129  Line 126 
126  #   ifdef _DEBUG  #   ifdef _DEBUG
127      static __inline void DPRINTF(int level, char *fmt, ...)      static __inline void DPRINTF(int level, char *fmt, ...)
128      {      {
129          if (DPRINTF_LEVEL & level) {          if (xvid_debug & level) {
130              va_list args;              va_list args;
131              char buf[DPRINTF_BUF_SZ];              char buf[DPRINTF_BUF_SZ];
132              va_start(args, fmt);              va_start(args, fmt);
# Line 139  Line 136 
136           }           }
137       }       }
138  #    else  #    else
139       static __inline void DPRINTF(int level, char *fmt, ...)           static __inline void DPRINTF(int level, char *fmt, ...) {}
      {  
      }  
140  #    endif  #    endif
141    
142  #    if _MSC_VER <= 1200  #    if _MSC_VER <= 1200
# Line 160  Line 155 
155  #    if defined(ARCH_IS_IA32)  #    if defined(ARCH_IS_IA32)
156  #        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
157    
 #        ifdef _PROFILING_  
158               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
159               {               {
160                   int64_t ts;                   int64_t ts;
# Line 173  Line 167 
167                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);
168                   return ts;                   return ts;
169               }               }
 #        endif  
170    
171  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
172   | msvc GENERIC (plain C only) - Probably alpha or some embedded device   | msvc GENERIC (plain C only) - Probably alpha or some embedded device
# Line 183  Line 176 
176                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
177                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
178    
 #        ifdef _PROFILING_  
179  #            include <time.h>  #            include <time.h>
180               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
181               {               {
182                   return (int64_t)clock();                   return (int64_t)clock();
183               }               }
 #        endif  
184    
185  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
186   | 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
# Line 226  Line 217 
217          {          {
218              va_list args;              va_list args;
219              va_start(args, format);              va_start(args, format);
220              if(DPRINTF_LEVEL & level) {              if(xvid_debug & level) {
221                     vfprintf(stderr, format, args);                     vfprintf(stderr, format, args);
222                     fprintf(stderr, "\n");                     fprintf(stderr, "\n");
223                          }                          }
# Line 247  Line 238 
238  #    if defined(ARCH_IS_IA32)  #    if defined(ARCH_IS_IA32)
239  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );
240    
 #        ifdef _PROFILING_  
241               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
242               {               {
243                   int64_t ts;                   int64_t ts;
# Line 256  Line 246 
246                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);                   ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);
247                   return ts;                   return ts;
248               }               }
 #        endif  
249    
250  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
251   | gcc PPC and PPC Altivec specific macros/functions   | gcc PPC and PPC Altivec specific macros/functions
# Line 265  Line 254 
254  #        define BSWAP(a) __asm__ __volatile__ \  #        define BSWAP(a) __asm__ __volatile__ \
255                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));
256    
 #        ifdef _PROFILING_  
257               static __inline unsigned long get_tbl(void)               static __inline unsigned long get_tbl(void)
258               {               {
259                   unsigned long tbl;                   unsigned long tbl;
# Line 289  Line 277 
277                   }while (tb != get_tbl());                   }while (tb != get_tbl());
278                   return (((int64_t) tu) << 32) | (int64_t) tb;                   return (((int64_t) tu) << 32) | (int64_t) tb;
279               }               }
 #        endif  
280    
281  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
282   | gcc IA64 specific macros/functions   | gcc IA64 specific macros/functions
# Line 299  Line 286 
286                  ("mux1 %1 = %0, @rev" ";;" \                  ("mux1 %1 = %0, @rev" ";;" \
287                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));
288    
 #        ifdef _PROFILING_  
289               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
290               {               {
291                   unsigned long result;                   unsigned long result;
292                   __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");                   __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
293                   return result;                   return result;
294               }               }
 #        endif  
295    
296  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
297   | gcc GENERIC (plain C only) specific macros/functions   | gcc GENERIC (plain C only) specific macros/functions
# Line 316  Line 301 
301                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
302                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
303    
 #        ifdef _PROFILING_  
304  #            include <time.h>  #            include <time.h>
305               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
306               {               {
307                   return (int64_t)clock();                   return (int64_t)clock();
308               }               }
 #        endif  
309    
310  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
311   | 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
# Line 347  Line 330 
330  #    ifdef _DEBUG  #    ifdef _DEBUG
331      static __inline void DPRINTF(int level, char *fmt, ...)      static __inline void DPRINTF(int level, char *fmt, ...)
332      {      {
333                  if (DPRINTF_LEVEL & level) {           if (xvid_debug & level) {
334              va_list args;              va_list args;
335              char buf[DPRINTF_BUF_SZ];              char buf[DPRINTF_BUF_SZ];
336              va_start(args, fmt);              va_start(args, fmt);
# Line 370  Line 353 
353    
354  #        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
355    
 #        ifdef _PROFILING_  
356           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
357           {           {
358               uint64_t ts;               uint64_t ts;
# Line 383  Line 365 
365               ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);               ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1);
366               return ts;               return ts;
367           }           }
 #        endif  
368    
369  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
370   | watcom GENERIC (plain C only) specific macros/functions.   | watcom GENERIC (plain C only) specific macros/functions.
# Line 396  Line 377 
377                                  (((x) & 0x0000ff00) <<  8) | \                                  (((x) & 0x0000ff00) <<  8) | \
378                                  (((x) & 0x000000ff) << 24))                                  (((x) & 0x000000ff) << 24))
379    
 #        ifdef _PROFILING_  
380           static int64_t read_counter() { return 0; }           static int64_t read_counter() { return 0; }
 #        endif  
381    
382  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
383   | 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
# Line 431  Line 410 
410          {          {
411              va_list args;              va_list args;
412              va_start(args, format);              va_start(args, format);
413              if(DPRINTF_LEVEL & level) {              if(xvid_debug & level) {
414                     vfprintf(stderr, format, args);                     vfprintf(stderr, format, args);
415                     fprintf(stderr, "\n");                     fprintf(stderr, "\n");
416                          }                          }
# Line 445  Line 424 
424              ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \              ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
425                     (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                     (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
426    
 #    ifdef _PROFILING_  
427  #       include <time.h>  #       include <time.h>
428          static __inline int64_t read_counter(void)          static __inline int64_t read_counter(void)
429          {          {
430              return (int64_t)clock();              return (int64_t)clock();
431          }          }
 #    endif  
432    
433  #        define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \  #        define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \
434                  type name[(sizex)*(sizey)]                  type name[(sizex)*(sizey)]

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.46.2.6

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4