40 |
#include "utils/mbfunctions.h" |
#include "utils/mbfunctions.h" |
41 |
#include "quant/quant.h" |
#include "quant/quant.h" |
42 |
#include "motion/motion.h" |
#include "motion/motion.h" |
43 |
|
#include "motion/gmc.h" |
44 |
#include "motion/sad.h" |
#include "motion/sad.h" |
45 |
#include "utils/emms.h" |
#include "utils/emms.h" |
46 |
#include "utils/timer.h" |
#include "utils/timer.h" |
127 |
|
|
128 |
/* detect cpu flags */ |
/* detect cpu flags */ |
129 |
static unsigned int |
static unsigned int |
130 |
detect_cpu_flags() |
detect_cpu_flags(void) |
131 |
{ |
{ |
132 |
/* enable native assembly optimizations by default */ |
/* enable native assembly optimizations by default */ |
133 |
unsigned int cpu_flags = XVID_CPU_ASM; |
unsigned int cpu_flags = XVID_CPU_ASM; |
184 |
idct = idct_int32; |
idct = idct_int32; |
185 |
|
|
186 |
/* Only needed on PPC Altivec archs */ |
/* Only needed on PPC Altivec archs */ |
187 |
sadInit = 0; |
sadInit = NULL; |
188 |
|
|
189 |
/* Restore FPU context : emms_c is a nop functions */ |
/* Restore FPU context : emms_c is a nop functions */ |
190 |
emms = emms_c; |
emms = emms_c; |
307 |
sse8_16bit = sse8_16bit_c; |
sse8_16bit = sse8_16bit_c; |
308 |
sse8_8bit = sse8_8bit_c; |
sse8_8bit = sse8_8bit_c; |
309 |
|
|
310 |
|
init_GMC(cpu_flags); |
311 |
|
|
312 |
#if defined(ARCH_IS_IA32) |
#if defined(ARCH_IS_IA32) |
313 |
|
|
314 |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
639 |
* features there really are. */ |
* features there really are. */ |
640 |
if (cpu_flags & XVID_CPU_ASM) { |
if (cpu_flags & XVID_CPU_ASM) { |
641 |
/* SIMD state flusher */ |
/* SIMD state flusher */ |
642 |
emms = emms_3dn; |
emms = emms_mmx; |
643 |
|
|
644 |
/* DCT operators */ |
/* DCT operators */ |
645 |
fdct = fdct_skal_x86_64; |
fdct = fdct_skal_x86_64; |
715 |
return XVID_ERR_VERSION; |
return XVID_ERR_VERSION; |
716 |
|
|
717 |
info->actual_version = XVID_VERSION; |
info->actual_version = XVID_VERSION; |
718 |
info->build = "xvid-1.1.0-beta2"; |
info->build = "xvid-1.2.0-dev"; |
719 |
info->cpu_flags = detect_cpu_flags(); |
info->cpu_flags = detect_cpu_flags(); |
|
|
|
|
#if defined(_SMP) && defined(WIN32) |
|
|
info->num_threads = pthread_num_processors_np();; |
|
|
#else |
|
720 |
info->num_threads = 0; |
info->num_threads = 0; |
721 |
|
|
722 |
|
#if defined(WIN32) |
723 |
|
{ |
724 |
|
DWORD dwProcessAffinityMask, dwSystemAffinityMask; |
725 |
|
if (GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask)) { |
726 |
|
int i; |
727 |
|
for(i=0; i<32; i++) { |
728 |
|
if ((dwProcessAffinityMask & (1<<i))) |
729 |
|
info->num_threads++; |
730 |
|
} |
731 |
|
} |
732 |
|
} |
733 |
#endif |
#endif |
734 |
|
|
735 |
return 0; |
return 0; |