28 |
#include <string.h> |
#include <string.h> |
29 |
#include <time.h> |
#include <time.h> |
30 |
|
|
31 |
|
#if !defined(_WIN32) |
32 |
|
#include <unistd.h> |
33 |
|
#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" |
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 |
|
|
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 |
|
|
|
#include <unistd.h> |
|
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; |