[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.6, Sat Jan 11 14:59:23 2003 UTC revision 1.31, Sun Sep 22 18:17:32 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 198  Line 167 
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) __asm mov eax,a __asm bswap eax __asm mov a, eax
170    #        define EMMS() __asm {emms}
171    
172               static __inline int64_t read_counter(void)               static __inline int64_t read_counter(void)
173               {               {
# Line 216  Line 186 
186   | msvc unknown architecture   | msvc unknown architecture
187   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
188  #    else  #    else
189  /* 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))  
   
190  #    endif  #    endif
191    
192    
# Line 232  Line 196 
196   *  GNU CC compiler stuff   *  GNU CC compiler stuff
197   ****************************************************************************/   ****************************************************************************/
198    
199  #elif defined(__GNUC__) || defined(__ICC) /* Compiler test */  #elif defined(__GNUC__) /* Compiler test */
200    
201  /*----------------------------------------------------------------------------  /*----------------------------------------------------------------------------
202   | Common gcc stuff   | Common gcc stuff
# Line 268  Line 232 
232   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
233  #    if defined(ARCH_X86)  #    if defined(ARCH_X86)
234  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );  #        define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) );
235    #        define EMMS() __asm__ ("emms\n\t");
236    
237           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
238           {           {
# Line 284  Line 249 
249  #    elif defined(ARCH_PPC)  #    elif defined(ARCH_PPC)
250  #        define BSWAP(a) __asm__ __volatile__ \  #        define BSWAP(a) __asm__ __volatile__ \
251                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));                  ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a));
252    #        define EMMS()
253    
254           static __inline unsigned long get_tbl(void)           static __inline unsigned long get_tbl(void)
255           {           {
# Line 316  Line 282 
282  #        define BSWAP(a)  __asm__ __volatile__ \  #        define BSWAP(a)  __asm__ __volatile__ \
283                  ("mux1 %1 = %0, @rev" ";;" \                  ("mux1 %1 = %0, @rev" ";;" \
284                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));                   "shr.u %1 = %1, 32" : "=r" (a) : "r" (a));
285    #        define EMMS()
286    
287           static __inline int64_t read_counter(void) {           static __inline int64_t read_counter(void) {
288               unsigned long result;               unsigned long result;
# Line 330  Line 297 
297  #        define BSWAP(a) \  #        define BSWAP(a) \
298                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
299                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
300    #        define EMMS()
301    
302           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
303           {           {
# Line 343  Line 311 
311  #        define BSWAP(a) \  #        define BSWAP(a) \
312                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \                  ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
313                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))                         (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))
314    #        define EMMS()
315    
316           static __inline int64_t read_counter(void)           static __inline int64_t read_counter(void)
317           {           {
# Line 353  Line 322 
322   | XviD + gcc unsupported Architecture   | XviD + gcc unsupported Architecture
323   *---------------------------------------------------------------------------*/   *---------------------------------------------------------------------------*/
324  #    else  #    else
325  /* 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))  
   
326  #    endif /* Architecture checking */  #    endif /* Architecture checking */
327    
328  /*****************************************************************************  /*****************************************************************************

Legend:
Removed from v.1.26.2.6  
changed lines
  Added in v.1.31

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