--- xvid.c 2006/01/09 00:39:43 1.67 +++ xvid.c 2006/06/14 21:44:07 1.69 @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid.c,v 1.67 2006/01/09 00:39:43 Isibaar Exp $ + * $Id: xvid.c,v 1.69 2006/06/14 21:44:07 Skal Exp $ * ****************************************************************************/ @@ -40,6 +40,7 @@ #include "utils/mbfunctions.h" #include "quant/quant.h" #include "motion/motion.h" +#include "motion/gmc.h" #include "motion/sad.h" #include "utils/emms.h" #include "utils/timer.h" @@ -306,6 +307,8 @@ sse8_16bit = sse8_16bit_c; sse8_8bit = sse8_8bit_c; + init_GMC(cpu_flags); + #if defined(ARCH_IS_IA32) if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || @@ -714,11 +717,19 @@ info->actual_version = XVID_VERSION; info->build = "xvid-1.2.0-dev"; info->cpu_flags = detect_cpu_flags(); + info->num_threads = 0; -#if defined(_SMP) && defined(WIN32) - info->num_threads = pthread_num_processors_np();; -#else - info->num_threads = 0; +#if defined(WIN32) + { + DWORD dwProcessAffinityMask, dwSystemAffinityMask; + if (GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask)) { + int i; + for(i=0; i<32; i++) { + if ((dwProcessAffinityMask & (1<num_threads++; + } + } + } #endif return 0;