--- branches/dev-api-4/xvidcore/src/xvid.c 2003/06/09 01:25:19 1053 +++ branches/dev-api-4/xvidcore/src/xvid.c 2003/08/22 15:52:35 1125 @@ -3,6 +3,8 @@ * XVID MPEG-4 VIDEO CODEC * - Native API implementation - * + * Copyright(C) 2001-2003 Peter Ross + * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation ; either version 2 of the License, or @@ -17,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.45.2.5 2003-06-09 01:16:57 edgomez Exp $ + * $Id: xvid.c,v 1.45.2.13 2003-08-22 15:52:35 Isibaar Exp $ * ****************************************************************************/ @@ -44,6 +46,7 @@ #include "utils/emms.h" #include "utils/timer.h" #include "bitstream/mbcoding.h" +#include "image/qpel.h" #if defined(_DEBUG) unsigned int xvid_debug = 0; /* xvid debug mask */ @@ -161,7 +164,7 @@ { unsigned int cpu_flags; - if (XVID_MAJOR(init->version) != 1) /* v1.x.x */ + if (XVID_VERSION_MAJOR(init->version) != 1) /* v1.x.x */ return XVID_ERR_VERSION; cpu_flags = (init->cpu_flags & XVID_CPU_FORCE) ? init->cpu_flags : detect_cpu_flags(); @@ -180,6 +183,11 @@ /* Restore FPU context : emms_c is a nop functions */ emms = emms_c; + /* Qpel stuff */ + xvid_QP_Funcs = &xvid_QP_Funcs_C; + xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_C; + xvid_Init_QP_mmx(); + /* Quantization functions */ quant_intra = quant_intra_c; dequant_intra = dequant_intra_c; @@ -286,8 +294,7 @@ #if defined(ARCH_IS_IA32) - if ((cpu_flags & XVID_CPU_ASM)) - { + if ((cpu_flags & XVID_CPU_ASM)) { vfilter_31 = xvid_VFilter_31_x86; hfilter_31 = xvid_HFilter_31_x86; } @@ -306,6 +313,10 @@ fdct = fdct_mmx; idct = idct_mmx; + /* Qpel stuff */ + xvid_QP_Funcs = &xvid_QP_Funcs_mmx; + xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_mmx; + /* Quantization related functions */ quant_intra = quant_intra_mmx; dequant_intra = dequant_intra_mmx; @@ -469,7 +480,8 @@ interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne; } - +#if defined(EXPERIMENTAL_SSE2_CODE) /* mark the whole SSE2 stuff as experimental. At least on + my P4, it crashes... */ if ((cpu_flags & XVID_CPU_SSE2)) { calc_cbp = calc_cbp_sse2; @@ -480,16 +492,17 @@ quant_inter = quant_inter_sse2; dequant_inter = dequant_inter_sse2; -#if defined(EXPERIMENTAL_SSE2_CODE) /* ME; slower than xmm */ sad16 = sad16_sse2; dev16 = dev16_sse2; -#endif /* Forward and Inverse DCT */ +#if 0 /* Both function are known to be unprecise, better keep them deactivated */ idct = idct_sse2; fdct = fdct_sse2; +#endif } #endif +#endif #if defined(ARCH_IS_IA64) if ((cpu_flags & XVID_CPU_ASM)) { /* use assembler routines? */ @@ -514,7 +527,6 @@ transfer_8to16sub2 = transfer_8to16sub2_ia64; transfer_16to8add = transfer_16to8add_ia64; transfer8x8_copy = transfer8x8_copy_ia64; - DPRINTF(DPRINTF_DEBUG, "Using IA-64 assembler routines."); } #endif @@ -547,7 +559,7 @@ static int xvid_gbl_info(xvid_gbl_info_t * info) { - if (XVID_MAJOR(info->version) != 1) /* v1.x.x */ + if (XVID_VERSION_MAJOR(info->version) != 1) /* v1.x.x */ return XVID_ERR_VERSION; info->actual_version = XVID_VERSION; @@ -573,7 +585,7 @@ int height2; IMAGE img; - if (XVID_MAJOR(convert->version) != 1) /* v1.x.x */ + if (XVID_VERSION_MAJOR(convert->version) != 1) /* v1.x.x */ return XVID_ERR_VERSION; #if 0