[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.26.2.7, Sun Jan 26 05:09:00 2003 UTC revision 1.29, Sun Sep 22 17:25:13 2002 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
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
  *               2002 Peter Ross <pross@xvid.org>  
  *               2002 Edouard Gomez <ed.gomez@wanadoo.fr>  
7   *   *
8   *  This file is part of XviD, a free MPEG-4 video encoder/decoder   *  This program is an implementation of a part of one or more MPEG-4
9     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
10     *  to use this software module in hardware or software products are
11     *  advised that its use may infringe existing patents or copyrights, and
12     *  any such use would be at such party's own risk.  The original
13     *  developer of this software module and his/her company, and subsequent
14     *  editors and their companies, will have no liability for use of this
15     *  software or modifications or derivatives thereof.
16   *   *
17   *  XviD is free software; you can redistribute it and/or modify it   *  This program is free software ; you can redistribute it and/or modify
18   *  under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
19   *  the Free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
20   *  (at your option) any later version.   *  (at your option) any later version.
21   *   *
# Line 23  Line 28 
28   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
29   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
30   *   *
  *  Under section 8 of the GNU General Public License, the copyright  
  *  holders of XVID explicitly forbid distribution in the following  
  *  countries:  
  *  
  *    - Japan  
  *    - United States of America  
  *  
  *  Linking XviD statically or dynamically with other modules is making a  
  *  combined work based on XviD.  Thus, the terms and conditions of the  
  *  GNU General Public License cover the whole combination.  
  *  
  *  As a special exception, the copyright holders of XviD give you  
  *  permission to link XviD with independent modules that communicate with  
  *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
  *  license terms of these independent modules, and to copy and distribute  
  *  the resulting combined work under terms of your choice, provided that  
  *  every copy of the combined work is accompanied by a complete copy of  
  *  the source code of XviD (the version of XviD used to produce the  
  *  combined work), being distributed under the terms of the GNU General  
  *  Public License plus this exception.  An independent module is a module  
  *  which is not derived from or based on XviD.  
  *  
  *  Note that people who make modified versions of XviD are not obligated  
  *  to grant this special exception for their modified versions; it is  
  *  their choice whether to do so.  The GNU General Public License gives  
  *  permission to release a modified version without this exception; this  
  *  exception also makes it possible to release a modified version which  
  *  carries forward this exception.  
  *  
31   * $Id$   * $Id$
32   *   *
33   ****************************************************************************/   ****************************************************************************/
# Line 71  Line 47 
47  #define DPRINTF_MB                      0x00000010  #define DPRINTF_MB                      0x00000010
48  #define DPRINTF_COEFF           0x00000020  #define DPRINTF_COEFF           0x00000020
49  #define DPRINTF_MV                      0x00000040  #define DPRINTF_MV                      0x00000040
 #define DPRINTF_RC                      0x00000080  
50  #define DPRINTF_DEBUG           0x80000000  #define DPRINTF_DEBUG           0x80000000
51    
52  /* debug level for this library */  /* debug level for this library */
53  #ifdef _DEBUG  #define DPRINTF_LEVEL           0
 #define DPRINTF_LEVEL           (DPRINTF_RC|0x0000007F)  
 #else  
 #define DPRINTF_LEVEL           DPRINTF_RC  
 #endif  
54    
55  /* Buffer size for non C99 compliant compilers (msvc) */  /* Buffer size for non C99 compliant compilers (msvc) */
56  #define DPRINTF_BUF_SZ  1024  #define DPRINTF_BUF_SZ  1024
# Line 115  Line 86 
86   | Fallback when using gcc   | Fallback when using gcc
87   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
88    
89  #elif defined(__GNUC__) || defined(__ICC)  #elif defined(__GNUC__)
90    
91  #    define int8_t   char  #    define int8_t   char
92  #    define uint8_t  unsigned char  #    define uint8_t  unsigned char
# Line 138  Line 109 
109   *  Some things that are only architecture dependant   *  Some things that are only architecture dependant
110   ****************************************************************************/   ****************************************************************************/
111    
112  #if defined(ARCH_X86) || defined(ARCH_PPC) || defined(ARCH_MIPS)  || defined(ARCH_SPARC)  #if defined(ARCH_X86) || defined(ARCH_PPC) || defined(ARCH_MIPS)
113  #    define CACHE_LINE  16  #    define CACHE_LINE  16
114  #    define ptr_t uint32_t  #    define ptr_t uint32_t
115  #elif defined(ARCH_IA64)  #elif defined(ARCH_IA64) || defined(ARCH_SPARC)
116  #    define CACHE_LINE  32  #    define CACHE_LINE  32
117  #    define ptr_t uint64_t  #    define ptr_t uint64_t
118  #else  #else
119  /* todo: fix cache_line 0 operation */  #    error Architecture not supported.
 #    define CACHE_LINE  16  
 #    define ptr_t uint32_t  
120  #endif  #endif
121    
122  /*****************************************************************************  /*****************************************************************************
# Line 167  Line 136 
136  #include <windows.h>  #include <windows.h>
137  #include <stdio.h>  #include <stdio.h>
138    
         /* non-ansi function mapping */  
 #       define snprintf _snprintf  
 #       define vsnprintf _vsnprintf  
   
139      /*      /*
140       * This function must be declared/defined all the time because MSVC does       * This function must be declared/defined all the time because MSVC does
141       * not support C99 variable arguments macros       * not support C99 variable arguments macros
# Line 201  Line 166 
166   | msvc x86 specific macros/functions   | msvc x86 specific macros/functions
167   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
168  #    if defined(ARCH_X86)  #    if defined(ARCH_X86)
169  #        define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax  #        define BSWAP(a)
170                 __asm { \
171                     mov eax,a \
172                     bswap eax \
173                     mov a, eax \
174                 }
175    #        define EMMS() __asm {emms}
176    
177               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
178               {               {
# Line 220  Line 191 
191   | msvc unknown architecture   | msvc unknown architecture
192   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
193  #    else  #    else
194  /* ANSI C version of BSWAP */  #        error Architecture not supported.
 #define BSWAP(x) \  
  x = ((((x) & 0xff000000) >> 24) | \  
      (((x) & 0x00ff0000) >>  8) | \  
      (((x) & 0x0000ff00) <<  8) | \  
      (((x) & 0x000000ff) << 24))  
   
195  #    endif  #    endif
196    
197    
# Line 236  Line 201 
201   *  GNU CC compiler stuff   *  GNU CC compiler stuff
202   ****************************************************************************/   ****************************************************************************/
203    
204  #elif defined(__GNUC__) || defined(__ICC) /* Compiler test */  #elif defined(__GNUC__) /* Compiler test */
205    
206  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
207   | Common gcc stuff   | Common gcc stuff
# Line 272  Line 237 
237   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
238  #    if defined(ARCH_X86)  #    if defined(ARCH_X86)
239  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );
240    #        define EMMS() __asm__ ("emms\n\t");
241    
242           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
243           {           {
# Line 288  Line 254 
254  #    elif defined(ARCH_PPC)  #    elif defined(ARCH_PPC)
255  #        define BSWAP(a) __asm__ __volatile__ \  #        define BSWAP(a) __asm__ __volatile__ \
256                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));
257    #        define EMMS()
258    
259           static __inline unsigned long get_tbl(void)           static __inline unsigned long get_tbl(void)
260           {           {
# Line 320  Line 287 
287  #        define BSWAP(a)  __asm__ __volatile__ \  #        define BSWAP(a)  __asm__ __volatile__ \
288                  ("mux1 %1 = %0, @rev" ";;" \                  ("mux1 %1 = %0, @rev" ";;" \
289                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));
290    #        define EMMS()
291    
292           static __inline int64_t read_counter(void) {           static __inline int64_t read_counter(void) {
293               unsigned long result;               unsigned long result;
# Line 332  Line 300 
300   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
301  #    elif defined(ARCH_SPARC)  #    elif defined(ARCH_SPARC)
302  #        define BSWAP(a) \  #        define BSWAP(a) \
303                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) |
304                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
305    #        define EMMS()
306    
307           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
308           {           {
# Line 345  Line 314 
314   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
315  #    elif defined(ARCH_MIPS)  #    elif defined(ARCH_MIPS)
316  #        define BSWAP(a) \  #        define BSWAP(a) \
317                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) |
318                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
319    #        define EMMS()
320    
321           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
322           {           {
# Line 357  Line 327 
327   | XviD + gcc unsupported Architecture   | XviD + gcc unsupported Architecture
328   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
329  #    else  #    else
330  /* ANSI C version of BSWAP */  #        error Architecture not supported.
 #define BSWAP(x) \  
  x = ((((x) & 0xff000000) >> 24) | \  
      (((x) & 0x00ff0000) >>  8) | \  
      (((x) & 0x0000ff00) <<  8) | \  
      (((x) & 0x000000ff) << 24))  
   
331  #    endif /* Architecture checking */  #    endif /* Architecture checking */
332    
333  /*****************************************************************************  /*****************************************************************************

Legend:
Removed from v.1.26.2.7  
changed lines
  Added in v.1.29

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