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; |
257 |
yv12_to_yv12 = yv12_to_yv12_c; |
yv12_to_yv12 = yv12_to_yv12_c; |
258 |
rgb555_to_yv12 = rgb555_to_yv12_c; |
rgb555_to_yv12 = rgb555_to_yv12_c; |
259 |
rgb565_to_yv12 = rgb565_to_yv12_c; |
rgb565_to_yv12 = rgb565_to_yv12_c; |
260 |
|
rgb_to_yv12 = rgb_to_yv12_c; |
261 |
bgr_to_yv12 = bgr_to_yv12_c; |
bgr_to_yv12 = bgr_to_yv12_c; |
262 |
bgra_to_yv12 = bgra_to_yv12_c; |
bgra_to_yv12 = bgra_to_yv12_c; |
263 |
abgr_to_yv12 = abgr_to_yv12_c; |
abgr_to_yv12 = abgr_to_yv12_c; |
279 |
/* All colorspace transformation functions YV12->User format */ |
/* All colorspace transformation functions YV12->User format */ |
280 |
yv12_to_rgb555 = yv12_to_rgb555_c; |
yv12_to_rgb555 = yv12_to_rgb555_c; |
281 |
yv12_to_rgb565 = yv12_to_rgb565_c; |
yv12_to_rgb565 = yv12_to_rgb565_c; |
282 |
|
yv12_to_rgb = yv12_to_rgb_c; |
283 |
yv12_to_bgr = yv12_to_bgr_c; |
yv12_to_bgr = yv12_to_bgr_c; |
284 |
yv12_to_bgra = yv12_to_bgra_c; |
yv12_to_bgra = yv12_to_bgra_c; |
285 |
yv12_to_abgr = yv12_to_abgr_c; |
yv12_to_abgr = yv12_to_abgr_c; |
309 |
sse8_16bit = sse8_16bit_c; |
sse8_16bit = sse8_16bit_c; |
310 |
sse8_8bit = sse8_8bit_c; |
sse8_8bit = sse8_8bit_c; |
311 |
|
|
312 |
|
init_GMC(cpu_flags); |
313 |
|
|
314 |
#if defined(ARCH_IS_IA32) |
#if defined(ARCH_IS_IA32) |
315 |
|
|
316 |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
381 |
/* image input xxx_to_yv12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
382 |
yv12_to_yv12 = yv12_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
383 |
bgr_to_yv12 = bgr_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
384 |
|
rgb_to_yv12 = rgb_to_yv12_mmx; |
385 |
bgra_to_yv12 = bgra_to_yv12_mmx; |
bgra_to_yv12 = bgra_to_yv12_mmx; |
386 |
|
rgba_to_yv12 = rgba_to_yv12_mmx; |
387 |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
388 |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
389 |
|
|
443 |
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_xmm; |
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_xmm; |
444 |
|
|
445 |
/* Quantization */ |
/* Quantization */ |
|
quant_mpeg_intra = quant_mpeg_intra_xmm; |
|
446 |
quant_mpeg_inter = quant_mpeg_inter_xmm; |
quant_mpeg_inter = quant_mpeg_inter_xmm; |
447 |
|
|
448 |
dequant_h263_intra = dequant_h263_intra_xmm; |
dequant_h263_intra = dequant_h263_intra_xmm; |
642 |
* features there really are. */ |
* features there really are. */ |
643 |
if (cpu_flags & XVID_CPU_ASM) { |
if (cpu_flags & XVID_CPU_ASM) { |
644 |
/* SIMD state flusher */ |
/* SIMD state flusher */ |
645 |
emms = emms_3dn; |
emms = emms_mmx; |
646 |
|
|
647 |
/* DCT operators */ |
/* DCT operators */ |
648 |
fdct = fdct_skal_x86_64; |
fdct = fdct_skal_x86_64; |
679 |
quant_h263_inter = quant_h263_inter_x86_64; |
quant_h263_inter = quant_h263_inter_x86_64; |
680 |
dequant_h263_intra = dequant_h263_intra_x86_64; |
dequant_h263_intra = dequant_h263_intra_x86_64; |
681 |
dequant_h263_inter = dequant_h263_inter_x86_64; |
dequant_h263_inter = dequant_h263_inter_x86_64; |
682 |
quant_mpeg_intra = quant_mpeg_intra_x86_64; |
/*quant_mpeg_intra = quant_mpeg_intra_x86_64; fix me! */ |
683 |
quant_mpeg_inter = quant_mpeg_inter_x86_64; |
quant_mpeg_inter = quant_mpeg_inter_x86_64; |
684 |
dequant_mpeg_intra = dequant_mpeg_intra_x86_64; |
dequant_mpeg_intra = dequant_mpeg_intra_x86_64; |
685 |
dequant_mpeg_inter = dequant_mpeg_inter_x86_64; |
dequant_mpeg_inter = dequant_mpeg_inter_x86_64; |
718 |
return XVID_ERR_VERSION; |
return XVID_ERR_VERSION; |
719 |
|
|
720 |
info->actual_version = XVID_VERSION; |
info->actual_version = XVID_VERSION; |
721 |
info->build = "xvid-1.1.0-beta2"; |
info->build = "xvid-1.2.0-dev"; |
722 |
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 |
|
723 |
info->num_threads = 0; |
info->num_threads = 0; |
724 |
|
|
725 |
|
#if defined(WIN32) |
726 |
|
{ |
727 |
|
DWORD dwProcessAffinityMask, dwSystemAffinityMask; |
728 |
|
if (GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask)) { |
729 |
|
int i; |
730 |
|
for(i=0; i<32; i++) { |
731 |
|
if ((dwProcessAffinityMask & (1<<i))) |
732 |
|
info->num_threads++; |
733 |
|
} |
734 |
|
} |
735 |
|
} |
736 |
#endif |
#endif |
737 |
|
|
738 |
return 0; |
return 0; |