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.74 2008-11-14 15:43:27 Isibaar Exp $ |
* $Id: xvid.c,v 1.75 2008-11-26 01:04:34 Isibaar Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
311 |
|
|
312 |
init_GMC(cpu_flags); |
init_GMC(cpu_flags); |
313 |
|
|
314 |
#if defined(ARCH_IS_IA32) |
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
315 |
|
|
316 |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
317 |
(cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) || |
(cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) || |
337 |
quant_h263_inter = quant_h263_inter_mmx; |
quant_h263_inter = quant_h263_inter_mmx; |
338 |
dequant_h263_intra = dequant_h263_intra_mmx; |
dequant_h263_intra = dequant_h263_intra_mmx; |
339 |
dequant_h263_inter = dequant_h263_inter_mmx; |
dequant_h263_inter = dequant_h263_inter_mmx; |
|
|
|
340 |
quant_mpeg_intra = quant_mpeg_intra_mmx; |
quant_mpeg_intra = quant_mpeg_intra_mmx; |
341 |
quant_mpeg_inter = quant_mpeg_inter_mmx; |
quant_mpeg_inter = quant_mpeg_inter_mmx; |
342 |
dequant_mpeg_intra = dequant_mpeg_intra_mmx; |
dequant_mpeg_intra = dequant_mpeg_intra_mmx; |
343 |
dequant_mpeg_inter = dequant_mpeg_inter_mmx; |
dequant_mpeg_inter = dequant_mpeg_inter_mmx; |
344 |
|
|
345 |
|
|
346 |
/* Block related functions */ |
/* Block related functions */ |
347 |
transfer_8to16copy = transfer_8to16copy_mmx; |
transfer_8to16copy = transfer_8to16copy_mmx; |
348 |
transfer_16to8copy = transfer_16to8copy_mmx; |
transfer_16to8copy = transfer_16to8copy_mmx; |
380 |
image_brightness = image_brightness_mmx; |
image_brightness = image_brightness_mmx; |
381 |
|
|
382 |
/* image input xxx_to_yv12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
383 |
|
|
384 |
yv12_to_yv12 = yv12_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
385 |
|
|
386 |
bgr_to_yv12 = bgr_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
387 |
rgb_to_yv12 = rgb_to_yv12_mmx; |
rgb_to_yv12 = rgb_to_yv12_mmx; |
388 |
bgra_to_yv12 = bgra_to_yv12_mmx; |
bgra_to_yv12 = bgra_to_yv12_mmx; |
422 |
|
|
423 |
yuyv_to_yv12 = yuyv_to_yv12_3dn; |
yuyv_to_yv12 = yuyv_to_yv12_3dn; |
424 |
uyvy_to_yv12 = uyvy_to_yv12_3dn; |
uyvy_to_yv12 = uyvy_to_yv12_3dn; |
425 |
|
|
426 |
} |
} |
427 |
|
|
428 |
|
|
457 |
transfer_8to16sub2ro = transfer_8to16sub2ro_xmm; |
transfer_8to16sub2ro = transfer_8to16sub2ro_xmm; |
458 |
|
|
459 |
/* Colorspace transformation */ |
/* Colorspace transformation */ |
460 |
yv12_to_yv12 = yv12_to_yv12_xmm; |
/* yv12_to_yv12 = yv12_to_yv12_xmm; */ /* appears to be slow on many machines */ |
461 |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
462 |
uyvy_to_yv12 = uyvy_to_yv12_xmm; |
uyvy_to_yv12 = uyvy_to_yv12_xmm; |
463 |
|
|
518 |
dequant_h263_inter = dequant_h263_inter_3dne; |
dequant_h263_inter = dequant_h263_inter_3dne; |
519 |
|
|
520 |
/* ME functions */ |
/* ME functions */ |
|
calc_cbp = calc_cbp_3dne; |
|
|
|
|
521 |
sad16 = sad16_3dne; |
sad16 = sad16_3dne; |
522 |
sad8 = sad8_3dne; |
sad8 = sad8_3dne; |
523 |
sad16bi = sad16bi_3dne; |
sad16bi = sad16bi_3dne; |
546 |
|
|
547 |
/* postprocessing */ |
/* postprocessing */ |
548 |
image_brightness = image_brightness_sse2; |
image_brightness = image_brightness_sse2; |
549 |
|
|
550 |
} |
} |
551 |
|
|
552 |
if ((cpu_flags & XVID_CPU_SSE3)) { |
if ((cpu_flags & XVID_CPU_SSE3)) { |
646 |
} |
} |
647 |
#endif |
#endif |
648 |
|
|
|
#if defined(ARCH_IS_X86_64) |
|
|
/* For now, only XVID_CPU_ASM is looked for, so user can still |
|
|
* disable asm usage the usual way. When Intel EMT64 cpus will |
|
|
* be out, maybe we'll have to check more precisely what cpu |
|
|
* features there really are. */ |
|
|
if (cpu_flags & XVID_CPU_ASM) { |
|
|
/* SIMD state flusher */ |
|
|
emms = emms_mmx; |
|
|
|
|
|
/* DCT operators */ |
|
|
fdct = fdct_skal_x86_64; |
|
|
idct = idct_x86_64; |
|
|
|
|
|
/* SAD operators */ |
|
|
sad16 = sad16_x86_64; |
|
|
sad8 = sad8_x86_64; |
|
|
sad16bi = sad16bi_x86_64; |
|
|
sad8bi = sad8bi_x86_64; |
|
|
dev16 = dev16_x86_64; |
|
|
sad16v = sad16v_x86_64; |
|
|
sse8_16bit = sse8_16bit_x86_64; |
|
|
sse8_8bit = sse8_8bit_x86_64; |
|
|
|
|
|
/* Interpolation operators */ |
|
|
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_x86_64; |
|
|
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_x86_64; |
|
|
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_x86_64; |
|
|
|
|
|
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_x86_64; |
|
|
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_x86_64; |
|
|
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_x86_64; |
|
|
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_x86_64; |
|
|
|
|
|
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_x86_64; |
|
|
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_x86_64; |
|
|
|
|
|
interpolate8x8_avg2 = interpolate8x8_avg2_x86_64; |
|
|
interpolate8x8_avg4 = interpolate8x8_avg4_x86_64; |
|
|
|
|
|
/* Quantization related functions */ |
|
|
quant_h263_intra = quant_h263_intra_x86_64; |
|
|
quant_h263_inter = quant_h263_inter_x86_64; |
|
|
dequant_h263_intra = dequant_h263_intra_x86_64; |
|
|
dequant_h263_inter = dequant_h263_inter_x86_64; |
|
|
/*quant_mpeg_intra = quant_mpeg_intra_x86_64; fix me! */ |
|
|
quant_mpeg_inter = quant_mpeg_inter_x86_64; |
|
|
dequant_mpeg_intra = dequant_mpeg_intra_x86_64; |
|
|
dequant_mpeg_inter = dequant_mpeg_inter_x86_64; |
|
|
|
|
|
/* Block related functions */ |
|
|
transfer_8to16copy = transfer_8to16copy_x86_64; |
|
|
transfer_16to8copy = transfer_16to8copy_x86_64; |
|
|
transfer_8to16sub = transfer_8to16sub_x86_64; |
|
|
transfer_8to16subro = transfer_8to16subro_x86_64; |
|
|
transfer_8to16sub2 = transfer_8to16sub2_x86_64; |
|
|
transfer_8to16sub2ro= transfer_8to16sub2ro_x86_64; |
|
|
transfer_16to8add = transfer_16to8add_x86_64; |
|
|
transfer8x8_copy = transfer8x8_copy_x86_64; |
|
|
|
|
|
/* Qpel stuff */ |
|
|
xvid_QP_Funcs = &xvid_QP_Funcs_x86_64; |
|
|
xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_x86_64; |
|
|
|
|
|
/* Interlacing Functions */ |
|
|
MBFieldTest = MBFieldTest_x86_64; |
|
|
} |
|
|
#endif |
|
|
|
|
649 |
#if defined(_DEBUG) |
#if defined(_DEBUG) |
650 |
xvid_debug = init->debug; |
xvid_debug = init->debug; |
651 |
#endif |
#endif |
665 |
info->cpu_flags = detect_cpu_flags(); |
info->cpu_flags = detect_cpu_flags(); |
666 |
info->num_threads = 0; |
info->num_threads = 0; |
667 |
|
|
668 |
#if defined(WIN32) |
#if defined(_WIN32) |
669 |
{ |
{ |
670 |
DWORD dwProcessAffinityMask, dwSystemAffinityMask; |
DWORD dwProcessAffinityMask, dwSystemAffinityMask; |
671 |
if (GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask)) { |
if (GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR) &dwProcessAffinityMask, (PDWORD_PTR) &dwSystemAffinityMask)) { |
672 |
int i; |
int i; |
673 |
for(i=0; i<32; i++) { |
for(i=0; i<32; i++) { |
674 |
if ((dwProcessAffinityMask & (1<<i))) |
if ((dwProcessAffinityMask & (1<<i))) |
676 |
} |
} |
677 |
} |
} |
678 |
} |
} |
679 |
|
#else |
680 |
|
|
681 |
|
#include <unistd.h> |
682 |
|
info->num_threads = sysconf(_SC_NPROCESSORS_CONF); |
683 |
|
|
684 |
#endif |
#endif |
685 |
|
|
686 |
return 0; |
return 0; |