[cvs] / xvidcore / src / xvid.c Repository:
ViewVC logotype

Diff of /xvidcore/src/xvid.c

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

revision 1.80, Mon Dec 1 15:06:48 2008 UTC revision 1.82, Fri Jun 5 07:58:41 2009 UTC
# Line 32  Line 32 
32  #include <unistd.h>  #include <unistd.h>
33  #endif  #endif
34    
35    #if defined(__APPLE__) && defined(__MACH__) && !defined(_SC_NPROCESSORS_CONF)
36    #include <sys/types.h>
37    #include <sys/sysctl.h>
38    #ifdef MAX
39    #undef MAX
40    #endif
41    #ifdef MIN
42    #undef MIN
43    #endif
44    #endif
45    
46    #if defined(__amigaos4__)
47    #include <exec/exec.h>
48    #include <proto/exec.h>
49    #endif
50    
51  #include "xvid.h"  #include "xvid.h"
52  #include "decoder.h"  #include "decoder.h"
53  #include "encoder.h"  #include "encoder.h"
# Line 58  Line 74 
74    
75  #if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER)  #if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER)
76  #       include <windows.h>  #       include <windows.h>
77  #elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC)  #elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__))
78  #       include <signal.h>  #       include <signal.h>
79  #       include <setjmp.h>  #       include <setjmp.h>
80    
# Line 71  Line 87 
87          }          }
88  #endif  #endif
89    
   
90  /*  /*
91   * Calls the funcptr, and returns whether SIGILL (illegal instruction) was   * Calls the funcptr, and returns whether SIGILL (illegal instruction) was
92   * signalled   * signalled
# Line 94  Line 109 
109          }          }
110          return(0);          return(0);
111  }  }
112  #elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC)  #elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__))
113  static int  static int
114  sigill_check(void (*func)())  sigill_check(void (*func)())
115  {  {
# Line 146  Line 161 
161  #endif  #endif
162    
163  #if defined(ARCH_IS_PPC)  #if defined(ARCH_IS_PPC)
164    #if defined(__amigaos4__)
165            {
166                    uint32_t vector_unit = VECTORTYPE_NONE;
167                    IExec->GetCPUInfoTags(GCIT_VectorUnit, &vector_unit, TAG_END);
168                    if (vector_unit == VECTORTYPE_ALTIVEC) {
169                            cpu_flags |= XVID_CPU_ALTIVEC;
170                    }
171            }
172    #else
173          if (!sigill_check(altivec_trigger))          if (!sigill_check(altivec_trigger))
174                  cpu_flags |= XVID_CPU_ALTIVEC;                  cpu_flags |= XVID_CPU_ALTIVEC;
175  #endif  #endif
176    #endif
177    
178          return cpu_flags;          return cpu_flags;
179  }  }
# Line 667  Line 692 
692          info->actual_version = XVID_VERSION;          info->actual_version = XVID_VERSION;
693          info->build = "xvid-1.3.0-dev";          info->build = "xvid-1.3.0-dev";
694          info->cpu_flags = detect_cpu_flags();          info->cpu_flags = detect_cpu_flags();
695          info->num_threads = 0;          info->num_threads = 0; /* single-thread */
696    
697  #if defined(_WIN32)  #if defined(_WIN32)
698    
# Line 677  Line 702 
702          info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */          info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */
703    }    }
704    
705  #else  #elif defined(_SC_NPROCESSORS_CONF) /* should be available on Apple too actually */
706    
707    info->num_threads = sysconf(_SC_NPROCESSORS_CONF);    info->num_threads = sysconf(_SC_NPROCESSORS_CONF);
708    
709    #elif defined(__APPLE__) && defined(__MACH__)
710    
711      {
712        size_t len;
713        int    mib[2], ncpu;
714    
715        mib[0] = CTL_HW;
716        mib[1] = HW_NCPU;
717        len    = sizeof(ncpu);
718        if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == 0)
719          info -> num_threads = ncpu;
720        else
721          info -> num_threads = 1;
722      }
723    
724    #elif defined(__amigaos4__)
725    
726      {
727        uint32_t num_threads = 1;
728        IExec->GetCPUInfoTags(GCIT_NumberOfCPUs, &num_threads, TAG_END);
729        info->num_threads = num_threads;
730      }
731    
732  #endif  #endif
733    
734          return 0;          return 0;

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.82

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