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

Diff of /trunk/xvidcore/src/xvid.c

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

revision 1872, Thu May 28 17:03:46 2009 UTC revision 1873, Tue Jun 2 13:06:54 2009 UTC
# Line 19  Line 19 
19   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: xvid.c,v 1.80 2008-12-01 15:06:48 Isibaar Exp $   * $Id: xvid.c,v 1.81 2009-06-02 13:06:49 Isibaar Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# 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  #include "xvid.h"  #include "xvid.h"
47  #include "decoder.h"  #include "decoder.h"
48  #include "encoder.h"  #include "encoder.h"
# Line 667  Line 678 
678          info->actual_version = XVID_VERSION;          info->actual_version = XVID_VERSION;
679          info->build = "xvid-1.3.0-dev";          info->build = "xvid-1.3.0-dev";
680          info->cpu_flags = detect_cpu_flags();          info->cpu_flags = detect_cpu_flags();
681          info->num_threads = 0;          info->num_threads = 0; /* single-thread */
682    
683  #if defined(_WIN32)  #if defined(_WIN32)
684    
# Line 677  Line 688 
688          info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */          info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */
689    }    }
690    
691  #else  #elif defined(_SC_NPROCESSORS_CONF) /* should be available on Apple too actually */
692    
693    info->num_threads = sysconf(_SC_NPROCESSORS_CONF);    info->num_threads = sysconf(_SC_NPROCESSORS_CONF);
694    
695    #elif defined(__APPLE__) && defined(__MACH__)
696    
697      {
698        size_t len;
699        int    mib[2], ncpu;
700    
701        mib[0] = CTL_HW;
702        mib[1] = HW_NCPU;
703        len    = sizeof(ncpu);
704        if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == 0)
705          info -> num_threads = ncpu;
706        else
707          info -> num_threads = 1;
708      }
709    
710  #endif  #endif
711    
712          return 0;          return 0;

Legend:
Removed from v.1872  
changed lines
  Added in v.1873

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