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.59 2004-12-19 13:16:50 syskin Exp $ |
* $Id: xvid.c,v 1.60 2005-01-05 23:02:15 edgomez Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
51 |
unsigned int xvid_debug = 0; /* xvid debug mask */ |
unsigned int xvid_debug = 0; /* xvid debug mask */ |
52 |
#endif |
#endif |
53 |
|
|
54 |
#if defined(ARCH_IS_IA32) && defined(_MSC_VER) |
#if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER) |
55 |
# include <windows.h> |
# include <windows.h> |
56 |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_PPC) |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC) |
57 |
# include <signal.h> |
# include <signal.h> |
58 |
# include <setjmp.h> |
# include <setjmp.h> |
59 |
|
|
76 |
* 0 : SIGILL was *not* signalled |
* 0 : SIGILL was *not* signalled |
77 |
* 1 : SIGILL was signalled |
* 1 : SIGILL was signalled |
78 |
*/ |
*/ |
79 |
#if defined(ARCH_IS_IA32) && defined(_MSC_VER) |
#if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER) |
80 |
static int |
static int |
81 |
sigill_check(void (*func)()) |
sigill_check(void (*func)()) |
82 |
{ |
{ |
89 |
} |
} |
90 |
return(0); |
return(0); |
91 |
} |
} |
92 |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_PPC) |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || defined(ARCH_IS_PPC) |
93 |
static int |
static int |
94 |
sigill_check(void (*func)()) |
sigill_check(void (*func)()) |
95 |
{ |
{ |
131 |
/* enable native assembly optimizations by default */ |
/* enable native assembly optimizations by default */ |
132 |
unsigned int cpu_flags = XVID_CPU_ASM; |
unsigned int cpu_flags = XVID_CPU_ASM; |
133 |
|
|
134 |
#if defined(ARCH_IS_IA32) |
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
135 |
cpu_flags |= check_cpu_features(); |
cpu_flags |= check_cpu_features(); |
136 |
if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) |
if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) |
137 |
cpu_flags &= ~XVID_CPU_SSE; |
cpu_flags &= ~XVID_CPU_SSE; |
603 |
} |
} |
604 |
#endif |
#endif |
605 |
|
|
606 |
|
#if defined(ARCH_IS_X86_64) |
607 |
|
/* For now, only XVID_CPU_ASM is looked for, so user can still |
608 |
|
* disable asm usage the usual way. When Intel EMT64 cpus will |
609 |
|
* be out, maybe we'll have to check more precisely what cpu |
610 |
|
* features there really are. */ |
611 |
|
if (cpu_flags & XVID_CPU_ASM) { |
612 |
|
/* SIMD state flusher */ |
613 |
|
emms = emms_3dn; |
614 |
|
|
615 |
|
/* DCT operators */ |
616 |
|
fdct = fdct_skal_x86_64; |
617 |
|
idct = idct_x86_64; |
618 |
|
|
619 |
|
/* SAD operators */ |
620 |
|
sad16 = sad16_x86_64; |
621 |
|
sad8 = sad8_x86_64; |
622 |
|
sad16bi = sad16bi_x86_64; |
623 |
|
sad8bi = sad8bi_x86_64; |
624 |
|
dev16 = dev16_x86_64; |
625 |
|
sad16v = sad16v_x86_64; |
626 |
|
sse8_16bit = sse8_16bit_x86_64; |
627 |
|
sse8_8bit = sse8_8bit_x86_64; |
628 |
|
|
629 |
|
/* Interpolation operators */ |
630 |
|
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_x86_64; |
631 |
|
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_x86_64; |
632 |
|
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_x86_64; |
633 |
|
|
634 |
|
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_x86_64; |
635 |
|
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_x86_64; |
636 |
|
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_x86_64; |
637 |
|
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_x86_64; |
638 |
|
|
639 |
|
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_x86_64; |
640 |
|
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_x86_64; |
641 |
|
|
642 |
|
interpolate8x8_avg2 = interpolate8x8_avg2_x86_64; |
643 |
|
interpolate8x8_avg4 = interpolate8x8_avg4_x86_64; |
644 |
|
|
645 |
|
/* Quantization related functions */ |
646 |
|
quant_h263_intra = quant_h263_intra_x86_64; |
647 |
|
quant_h263_inter = quant_h263_inter_x86_64; |
648 |
|
dequant_h263_intra = dequant_h263_intra_x86_64; |
649 |
|
dequant_h263_inter = dequant_h263_inter_x86_64; |
650 |
|
quant_mpeg_intra = quant_mpeg_intra_x86_64; |
651 |
|
quant_mpeg_inter = quant_mpeg_inter_x86_64; |
652 |
|
dequant_mpeg_intra = dequant_mpeg_intra_x86_64; |
653 |
|
dequant_mpeg_inter = dequant_mpeg_inter_x86_64; |
654 |
|
|
655 |
|
/* Block related functions */ |
656 |
|
transfer_8to16copy = transfer_8to16copy_x86_64; |
657 |
|
transfer_16to8copy = transfer_16to8copy_x86_64; |
658 |
|
transfer_8to16sub = transfer_8to16sub_x86_64; |
659 |
|
transfer_8to16subro = transfer_8to16subro_x86_64; |
660 |
|
transfer_8to16sub2 = transfer_8to16sub2_x86_64; |
661 |
|
transfer_8to16sub2ro= transfer_8to16sub2ro_x86_64; |
662 |
|
transfer_16to8add = transfer_16to8add_x86_64; |
663 |
|
transfer8x8_copy = transfer8x8_copy_x86_64; |
664 |
|
|
665 |
|
/* Qpel stuff */ |
666 |
|
xvid_QP_Funcs = &xvid_QP_Funcs_x86_64; |
667 |
|
xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_x86_64; |
668 |
|
|
669 |
|
/* Interlacing Functions */ |
670 |
|
MBFieldTest = MBFieldTest_x86_64; |
671 |
|
} |
672 |
|
#endif |
673 |
|
|
674 |
#if defined(_DEBUG) |
#if defined(_DEBUG) |
675 |
xvid_debug = init->debug; |
xvid_debug = init->debug; |
676 |
#endif |
#endif |