4 |
* - Native API implementation - |
* - Native API implementation - |
5 |
* |
* |
6 |
* Copyright(C) 2001-2004 Peter Ross <pross@xvid.org> |
* Copyright(C) 2001-2004 Peter Ross <pross@xvid.org> |
7 |
|
* 2002-2010 Michael Militzer <isibaar@xvid.org> |
8 |
* |
* |
9 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
10 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
20 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $Id: xvid.c,v 1.59 2004-12-19 13:16:50 syskin Exp $ |
* $Id: xvid.c,v 1.83 2010-03-09 10:00:14 Isibaar Exp $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
29 |
#include <string.h> |
#include <string.h> |
30 |
#include <time.h> |
#include <time.h> |
31 |
|
|
32 |
|
#if !defined(_WIN32) |
33 |
|
#include <unistd.h> |
34 |
|
#endif |
35 |
|
|
36 |
|
#if defined(__APPLE__) && defined(__MACH__) && !defined(_SC_NPROCESSORS_CONF) |
37 |
|
#include <sys/types.h> |
38 |
|
#include <sys/sysctl.h> |
39 |
|
#ifdef MAX |
40 |
|
#undef MAX |
41 |
|
#endif |
42 |
|
#ifdef MIN |
43 |
|
#undef MIN |
44 |
|
#endif |
45 |
|
#endif |
46 |
|
|
47 |
|
#if defined(__amigaos4__) |
48 |
|
#include <exec/exec.h> |
49 |
|
#include <proto/exec.h> |
50 |
|
#endif |
51 |
|
|
52 |
#include "xvid.h" |
#include "xvid.h" |
53 |
#include "decoder.h" |
#include "decoder.h" |
54 |
#include "encoder.h" |
#include "encoder.h" |
61 |
#include "utils/mbfunctions.h" |
#include "utils/mbfunctions.h" |
62 |
#include "quant/quant.h" |
#include "quant/quant.h" |
63 |
#include "motion/motion.h" |
#include "motion/motion.h" |
64 |
|
#include "motion/gmc.h" |
65 |
#include "motion/sad.h" |
#include "motion/sad.h" |
66 |
#include "utils/emms.h" |
#include "utils/emms.h" |
67 |
#include "utils/timer.h" |
#include "utils/timer.h" |
73 |
unsigned int xvid_debug = 0; /* xvid debug mask */ |
unsigned int xvid_debug = 0; /* xvid debug mask */ |
74 |
#endif |
#endif |
75 |
|
|
76 |
#if defined(ARCH_IS_IA32) && defined(_MSC_VER) |
#if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER) |
77 |
# include <windows.h> |
# include <windows.h> |
78 |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_PPC) |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__)) |
79 |
# include <signal.h> |
# include <signal.h> |
80 |
# include <setjmp.h> |
# include <setjmp.h> |
81 |
|
|
88 |
} |
} |
89 |
#endif |
#endif |
90 |
|
|
|
|
|
91 |
/* |
/* |
92 |
* Calls the funcptr, and returns whether SIGILL (illegal instruction) was |
* Calls the funcptr, and returns whether SIGILL (illegal instruction) was |
93 |
* signalled |
* signalled |
97 |
* 0 : SIGILL was *not* signalled |
* 0 : SIGILL was *not* signalled |
98 |
* 1 : SIGILL was signalled |
* 1 : SIGILL was signalled |
99 |
*/ |
*/ |
100 |
#if defined(ARCH_IS_IA32) && defined(_MSC_VER) |
#if (defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64)) && defined(_MSC_VER) |
101 |
static int |
static int |
102 |
sigill_check(void (*func)()) |
sigill_check(void (*func)()) |
103 |
{ |
{ |
110 |
} |
} |
111 |
return(0); |
return(0); |
112 |
} |
} |
113 |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_PPC) |
#elif defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) || (defined(ARCH_IS_PPC) && !defined(__amigaos4__)) |
114 |
static int |
static int |
115 |
sigill_check(void (*func)()) |
sigill_check(void (*func)()) |
116 |
{ |
{ |
147 |
|
|
148 |
/* detect cpu flags */ |
/* detect cpu flags */ |
149 |
static unsigned int |
static unsigned int |
150 |
detect_cpu_flags() |
detect_cpu_flags(void) |
151 |
{ |
{ |
152 |
/* enable native assembly optimizations by default */ |
/* enable native assembly optimizations by default */ |
153 |
unsigned int cpu_flags = XVID_CPU_ASM; |
unsigned int cpu_flags = XVID_CPU_ASM; |
154 |
|
|
155 |
#if defined(ARCH_IS_IA32) |
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
156 |
cpu_flags |= check_cpu_features(); |
cpu_flags |= check_cpu_features(); |
157 |
if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) |
if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) |
158 |
cpu_flags &= ~XVID_CPU_SSE; |
cpu_flags &= ~XVID_CPU_SSE; |
159 |
|
|
160 |
if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger)) |
if ((cpu_flags & (XVID_CPU_SSE2|XVID_CPU_SSE3|XVID_CPU_SSE41)) && sigill_check(sse2_os_trigger)) |
161 |
cpu_flags &= ~XVID_CPU_SSE2; |
cpu_flags &= ~(XVID_CPU_SSE2|XVID_CPU_SSE3|XVID_CPU_SSE41); |
162 |
#endif |
#endif |
163 |
|
|
164 |
#if defined(ARCH_IS_PPC) |
#if defined(ARCH_IS_PPC) |
165 |
|
#if defined(__amigaos4__) |
166 |
|
{ |
167 |
|
uint32_t vector_unit = VECTORTYPE_NONE; |
168 |
|
IExec->GetCPUInfoTags(GCIT_VectorUnit, &vector_unit, TAG_END); |
169 |
|
if (vector_unit == VECTORTYPE_ALTIVEC) { |
170 |
|
cpu_flags |= XVID_CPU_ALTIVEC; |
171 |
|
} |
172 |
|
} |
173 |
|
#else |
174 |
if (!sigill_check(altivec_trigger)) |
if (!sigill_check(altivec_trigger)) |
175 |
cpu_flags |= XVID_CPU_ALTIVEC; |
cpu_flags |= XVID_CPU_ALTIVEC; |
176 |
#endif |
#endif |
177 |
|
#endif |
178 |
|
|
179 |
return cpu_flags; |
return cpu_flags; |
180 |
} |
} |
181 |
|
|
182 |
|
|
183 |
/***************************************************************************** |
/***************************************************************************** |
184 |
* XviD Init Entry point |
* Xvid Init Entry point |
185 |
* |
* |
186 |
* Well this function initialize all internal function pointers according |
* Well this function initialize all internal function pointers according |
187 |
* to the CPU features forced by the library client or autodetected (depending |
* to the CPU features forced by the library client or autodetected (depending |
214 |
idct = idct_int32; |
idct = idct_int32; |
215 |
|
|
216 |
/* Only needed on PPC Altivec archs */ |
/* Only needed on PPC Altivec archs */ |
217 |
sadInit = 0; |
sadInit = NULL; |
218 |
|
|
219 |
/* Restore FPU context : emms_c is a nop functions */ |
/* Restore FPU context : emms_c is a nop functions */ |
220 |
emms = emms_c; |
emms = emms_c; |
244 |
transfer_8to16sub2ro = transfer_8to16sub2ro_c; |
transfer_8to16sub2ro = transfer_8to16sub2ro_c; |
245 |
transfer_16to8add = transfer_16to8add_c; |
transfer_16to8add = transfer_16to8add_c; |
246 |
transfer8x8_copy = transfer8x8_copy_c; |
transfer8x8_copy = transfer8x8_copy_c; |
247 |
|
transfer8x4_copy = transfer8x4_copy_c; |
248 |
|
|
249 |
/* Interlacing functions */ |
/* Interlacing functions */ |
250 |
MBFieldTest = MBFieldTest_c; |
MBFieldTest = MBFieldTest_c; |
254 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_c; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_c; |
255 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_c; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_c; |
256 |
|
|
257 |
|
interpolate8x4_halfpel_h = interpolate8x4_halfpel_h_c; |
258 |
|
interpolate8x4_halfpel_v = interpolate8x4_halfpel_v_c; |
259 |
|
interpolate8x4_halfpel_hv = interpolate8x4_halfpel_hv_c; |
260 |
|
|
261 |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_c; |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_c; |
262 |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_c; |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_c; |
263 |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_c; |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_c; |
287 |
yv12_to_yv12 = yv12_to_yv12_c; |
yv12_to_yv12 = yv12_to_yv12_c; |
288 |
rgb555_to_yv12 = rgb555_to_yv12_c; |
rgb555_to_yv12 = rgb555_to_yv12_c; |
289 |
rgb565_to_yv12 = rgb565_to_yv12_c; |
rgb565_to_yv12 = rgb565_to_yv12_c; |
290 |
|
rgb_to_yv12 = rgb_to_yv12_c; |
291 |
bgr_to_yv12 = bgr_to_yv12_c; |
bgr_to_yv12 = bgr_to_yv12_c; |
292 |
bgra_to_yv12 = bgra_to_yv12_c; |
bgra_to_yv12 = bgra_to_yv12_c; |
293 |
abgr_to_yv12 = abgr_to_yv12_c; |
abgr_to_yv12 = abgr_to_yv12_c; |
309 |
/* All colorspace transformation functions YV12->User format */ |
/* All colorspace transformation functions YV12->User format */ |
310 |
yv12_to_rgb555 = yv12_to_rgb555_c; |
yv12_to_rgb555 = yv12_to_rgb555_c; |
311 |
yv12_to_rgb565 = yv12_to_rgb565_c; |
yv12_to_rgb565 = yv12_to_rgb565_c; |
312 |
|
yv12_to_rgb = yv12_to_rgb_c; |
313 |
yv12_to_bgr = yv12_to_bgr_c; |
yv12_to_bgr = yv12_to_bgr_c; |
314 |
yv12_to_bgra = yv12_to_bgra_c; |
yv12_to_bgra = yv12_to_bgra_c; |
315 |
yv12_to_abgr = yv12_to_abgr_c; |
yv12_to_abgr = yv12_to_abgr_c; |
339 |
sse8_16bit = sse8_16bit_c; |
sse8_16bit = sse8_16bit_c; |
340 |
sse8_8bit = sse8_8bit_c; |
sse8_8bit = sse8_8bit_c; |
341 |
|
|
342 |
#if defined(ARCH_IS_IA32) |
init_GMC(cpu_flags); |
343 |
|
|
344 |
|
#if defined(ARCH_IS_IA32) || defined(ARCH_IS_X86_64) |
345 |
|
|
346 |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || |
347 |
(cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) || |
(cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) || |
348 |
(cpu_flags & XVID_CPU_SSE) || (cpu_flags & XVID_CPU_SSE2)) |
(cpu_flags & XVID_CPU_SSE) || (cpu_flags & XVID_CPU_SSE2) || |
349 |
|
(cpu_flags & XVID_CPU_SSE3) || (cpu_flags & XVID_CPU_SSE41)) |
350 |
{ |
{ |
351 |
/* Restore FPU context : emms_c is a nop functions */ |
/* Restore FPU context : emms_c is a nop functions */ |
352 |
emms = emms_mmx; |
emms = emms_mmx; |
367 |
quant_h263_inter = quant_h263_inter_mmx; |
quant_h263_inter = quant_h263_inter_mmx; |
368 |
dequant_h263_intra = dequant_h263_intra_mmx; |
dequant_h263_intra = dequant_h263_intra_mmx; |
369 |
dequant_h263_inter = dequant_h263_inter_mmx; |
dequant_h263_inter = dequant_h263_inter_mmx; |
|
|
|
370 |
quant_mpeg_intra = quant_mpeg_intra_mmx; |
quant_mpeg_intra = quant_mpeg_intra_mmx; |
371 |
quant_mpeg_inter = quant_mpeg_inter_mmx; |
quant_mpeg_inter = quant_mpeg_inter_mmx; |
372 |
dequant_mpeg_intra = dequant_mpeg_intra_mmx; |
dequant_mpeg_intra = dequant_mpeg_intra_mmx; |
373 |
dequant_mpeg_inter = dequant_mpeg_inter_mmx; |
dequant_mpeg_inter = dequant_mpeg_inter_mmx; |
374 |
|
|
375 |
|
|
376 |
/* Block related functions */ |
/* Block related functions */ |
377 |
transfer_8to16copy = transfer_8to16copy_mmx; |
transfer_8to16copy = transfer_8to16copy_mmx; |
378 |
transfer_16to8copy = transfer_16to8copy_mmx; |
transfer_16to8copy = transfer_16to8copy_mmx; |
381 |
transfer_8to16sub2 = transfer_8to16sub2_mmx; |
transfer_8to16sub2 = transfer_8to16sub2_mmx; |
382 |
transfer_16to8add = transfer_16to8add_mmx; |
transfer_16to8add = transfer_16to8add_mmx; |
383 |
transfer8x8_copy = transfer8x8_copy_mmx; |
transfer8x8_copy = transfer8x8_copy_mmx; |
384 |
|
transfer8x4_copy = transfer8x4_copy_mmx; |
385 |
|
|
386 |
/* Interlacing Functions */ |
/* Interlacing Functions */ |
387 |
MBFieldTest = MBFieldTest_mmx; |
MBFieldTest = MBFieldTest_mmx; |
391 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; |
392 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_mmx; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_mmx; |
393 |
|
|
394 |
|
interpolate8x4_halfpel_h = interpolate8x4_halfpel_h_mmx; |
395 |
|
interpolate8x4_halfpel_v = interpolate8x4_halfpel_v_mmx; |
396 |
|
interpolate8x4_halfpel_hv = interpolate8x4_halfpel_hv_mmx; |
397 |
|
|
398 |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_mmx; |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_mmx; |
399 |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_mmx; |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_mmx; |
400 |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_mmx; |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_mmx; |
410 |
image_brightness = image_brightness_mmx; |
image_brightness = image_brightness_mmx; |
411 |
|
|
412 |
/* image input xxx_to_yv12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
413 |
|
|
414 |
yv12_to_yv12 = yv12_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
415 |
|
|
416 |
bgr_to_yv12 = bgr_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
417 |
|
rgb_to_yv12 = rgb_to_yv12_mmx; |
418 |
bgra_to_yv12 = bgra_to_yv12_mmx; |
bgra_to_yv12 = bgra_to_yv12_mmx; |
419 |
|
rgba_to_yv12 = rgba_to_yv12_mmx; |
420 |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
421 |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
422 |
|
|
452 |
|
|
453 |
yuyv_to_yv12 = yuyv_to_yv12_3dn; |
yuyv_to_yv12 = yuyv_to_yv12_3dn; |
454 |
uyvy_to_yv12 = uyvy_to_yv12_3dn; |
uyvy_to_yv12 = uyvy_to_yv12_3dn; |
455 |
|
|
456 |
} |
} |
457 |
|
|
458 |
|
|
467 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
468 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
469 |
|
|
470 |
|
interpolate8x4_halfpel_h = interpolate8x4_halfpel_h_xmm; |
471 |
|
interpolate8x4_halfpel_v = interpolate8x4_halfpel_v_xmm; |
472 |
|
interpolate8x4_halfpel_hv = interpolate8x4_halfpel_hv_xmm; |
473 |
|
|
474 |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_xmm; |
interpolate8x8_halfpel_add = interpolate8x8_halfpel_add_xmm; |
475 |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_xmm; |
interpolate8x8_halfpel_h_add = interpolate8x8_halfpel_h_add_xmm; |
476 |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_xmm; |
interpolate8x8_halfpel_v_add = interpolate8x8_halfpel_v_add_xmm; |
477 |
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_xmm; |
interpolate8x8_halfpel_hv_add = interpolate8x8_halfpel_hv_add_xmm; |
478 |
|
|
479 |
/* Quantization */ |
/* Quantization */ |
|
quant_mpeg_intra = quant_mpeg_intra_xmm; |
|
480 |
quant_mpeg_inter = quant_mpeg_inter_xmm; |
quant_mpeg_inter = quant_mpeg_inter_xmm; |
481 |
|
|
482 |
dequant_h263_intra = dequant_h263_intra_xmm; |
dequant_h263_intra = dequant_h263_intra_xmm; |
487 |
transfer_8to16sub2ro = transfer_8to16sub2ro_xmm; |
transfer_8to16sub2ro = transfer_8to16sub2ro_xmm; |
488 |
|
|
489 |
/* Colorspace transformation */ |
/* Colorspace transformation */ |
490 |
yv12_to_yv12 = yv12_to_yv12_xmm; |
/* yv12_to_yv12 = yv12_to_yv12_xmm; */ /* appears to be slow on many machines */ |
491 |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
492 |
uyvy_to_yv12 = uyvy_to_yv12_xmm; |
uyvy_to_yv12 = uyvy_to_yv12_xmm; |
493 |
|
|
506 |
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn; |
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn; |
507 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dn; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dn; |
508 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
509 |
|
|
510 |
|
interpolate8x4_halfpel_h = interpolate8x4_halfpel_h_3dn; |
511 |
|
interpolate8x4_halfpel_v = interpolate8x4_halfpel_v_3dn; |
512 |
|
interpolate8x4_halfpel_hv = interpolate8x4_halfpel_hv_3dn; |
513 |
} |
} |
514 |
|
|
515 |
if ((cpu_flags & XVID_CPU_3DNOWEXT)) { |
if ((cpu_flags & XVID_CPU_3DNOWEXT)) { |
521 |
transfer_8to16subro = transfer_8to16subro_3dne; |
transfer_8to16subro = transfer_8to16subro_3dne; |
522 |
transfer_16to8add = transfer_16to8add_3dne; |
transfer_16to8add = transfer_16to8add_3dne; |
523 |
transfer8x8_copy = transfer8x8_copy_3dne; |
transfer8x8_copy = transfer8x8_copy_3dne; |
524 |
|
transfer8x4_copy = transfer8x4_copy_3dne; |
525 |
|
|
526 |
if ((cpu_flags & XVID_CPU_MMXEXT)) { |
if ((cpu_flags & XVID_CPU_MMXEXT)) { |
527 |
/* Inverse DCT */ |
/* Inverse DCT */ |
535 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dne; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dne; |
536 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne; |
537 |
|
|
538 |
|
interpolate8x4_halfpel_h = interpolate8x4_halfpel_h_3dne; |
539 |
|
interpolate8x4_halfpel_v = interpolate8x4_halfpel_v_3dne; |
540 |
|
interpolate8x4_halfpel_hv = interpolate8x4_halfpel_hv_3dne; |
541 |
|
|
542 |
/* Quantization */ |
/* Quantization */ |
543 |
quant_h263_intra = quant_h263_intra_3dne; /* cmov only */ |
quant_h263_intra = quant_h263_intra_3dne; /* cmov only */ |
544 |
quant_h263_inter = quant_h263_inter_3dne; |
quant_h263_inter = quant_h263_inter_3dne; |
548 |
dequant_h263_inter = dequant_h263_inter_3dne; |
dequant_h263_inter = dequant_h263_inter_3dne; |
549 |
|
|
550 |
/* ME functions */ |
/* ME functions */ |
|
calc_cbp = calc_cbp_3dne; |
|
|
|
|
551 |
sad16 = sad16_3dne; |
sad16 = sad16_3dne; |
552 |
sad8 = sad8_3dne; |
sad8 = sad8_3dne; |
553 |
sad16bi = sad16bi_3dne; |
sad16bi = sad16bi_3dne; |
570 |
sad16 = sad16_sse2; |
sad16 = sad16_sse2; |
571 |
dev16 = dev16_sse2; |
dev16 = dev16_sse2; |
572 |
|
|
573 |
/* DCT operators |
/* DCT operators */ |
|
* no iDCT because it's not "Walken matching" */ |
|
574 |
fdct = fdct_sse2_skal; |
fdct = fdct_sse2_skal; |
575 |
|
idct = idct_sse2_skal; /* Is now IEEE1180 and Walken compliant. */ |
576 |
|
|
577 |
/* postprocessing */ |
/* postprocessing */ |
578 |
image_brightness = image_brightness_sse2; |
image_brightness = image_brightness_sse2; |
579 |
|
|
580 |
|
} |
581 |
|
|
582 |
|
if ((cpu_flags & XVID_CPU_SSE3)) { |
583 |
|
|
584 |
|
/* SAD operators */ |
585 |
|
sad16 = sad16_sse3; |
586 |
|
dev16 = dev16_sse3; |
587 |
} |
} |
588 |
|
|
589 |
#endif /* ARCH_IS_IA32 */ |
#endif /* ARCH_IS_IA32 */ |
590 |
|
|
591 |
#if defined(ARCH_IS_IA64) |
#if defined(ARCH_IS_IA64) |
667 |
dequant_h263_intra = dequant_h263_intra_altivec_c; |
dequant_h263_intra = dequant_h263_intra_altivec_c; |
668 |
dequant_h263_inter = dequant_h263_inter_altivec_c; |
dequant_h263_inter = dequant_h263_inter_altivec_c; |
669 |
|
|
670 |
|
dequant_mpeg_intra = dequant_mpeg_intra_altivec_c; |
671 |
|
dequant_mpeg_inter = dequant_mpeg_inter_altivec_c; |
672 |
|
|
673 |
/* Qpel stuff */ |
/* Qpel stuff */ |
674 |
xvid_QP_Funcs = &xvid_QP_Funcs_Altivec_C; |
xvid_QP_Funcs = &xvid_QP_Funcs_Altivec_C; |
675 |
xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_Altivec_C; |
xvid_QP_Add_Funcs = &xvid_QP_Add_Funcs_Altivec_C; |
691 |
return XVID_ERR_VERSION; |
return XVID_ERR_VERSION; |
692 |
|
|
693 |
info->actual_version = XVID_VERSION; |
info->actual_version = XVID_VERSION; |
694 |
info->build = "xvid-1.1-cvshead"; |
info->build = "xvid-1.3.0-dev"; |
695 |
info->cpu_flags = detect_cpu_flags(); |
info->cpu_flags = detect_cpu_flags(); |
696 |
|
info->num_threads = 0; /* single-thread */ |
697 |
|
|
698 |
|
#if defined(_WIN32) |
699 |
|
|
700 |
|
{ |
701 |
|
SYSTEM_INFO siSysInfo; |
702 |
|
GetSystemInfo(&siSysInfo); |
703 |
|
info->num_threads = siSysInfo.dwNumberOfProcessors; /* number of _logical_ cores */ |
704 |
|
} |
705 |
|
|
706 |
|
#elif defined(_SC_NPROCESSORS_CONF) /* should be available on Apple too actually */ |
707 |
|
|
708 |
|
info->num_threads = sysconf(_SC_NPROCESSORS_CONF); |
709 |
|
|
710 |
|
#elif defined(__APPLE__) && defined(__MACH__) |
711 |
|
|
712 |
|
{ |
713 |
|
size_t len; |
714 |
|
int mib[2], ncpu; |
715 |
|
|
716 |
|
mib[0] = CTL_HW; |
717 |
|
mib[1] = HW_NCPU; |
718 |
|
len = sizeof(ncpu); |
719 |
|
if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == 0) |
720 |
|
info -> num_threads = ncpu; |
721 |
|
else |
722 |
|
info -> num_threads = 1; |
723 |
|
} |
724 |
|
|
725 |
|
#elif defined(__amigaos4__) |
726 |
|
|
727 |
|
{ |
728 |
|
uint32_t num_threads = 1; |
729 |
|
IExec->GetCPUInfoTags(GCIT_NumberOfCPUs, &num_threads, TAG_END); |
730 |
|
info->num_threads = num_threads; |
731 |
|
} |
732 |
|
|
|
#if defined(_SMP) && defined(WIN32) |
|
|
info->num_threads = pthread_num_processors_np();; |
|
|
#else |
|
|
info->num_threads = 0; |
|
733 |
#endif |
#endif |
734 |
|
|
735 |
return 0; |
return 0; |
777 |
} |
} |
778 |
|
|
779 |
/***************************************************************************** |
/***************************************************************************** |
780 |
* XviD Global Entry point |
* Xvid Global Entry point |
781 |
* |
* |
782 |
* Well this function initialize all internal function pointers according |
* Well this function initialize all internal function pointers according |
783 |
* to the CPU features forced by the library client or autodetected (depending |
* to the CPU features forced by the library client or autodetected (depending |
810 |
} |
} |
811 |
|
|
812 |
/***************************************************************************** |
/***************************************************************************** |
813 |
* XviD Native decoder entry point |
* Xvid Native decoder entry point |
814 |
* |
* |
815 |
* This function is just a wrapper to all the option cases. |
* This function is just a wrapper to all the option cases. |
816 |
* |
* |
842 |
|
|
843 |
|
|
844 |
/***************************************************************************** |
/***************************************************************************** |
845 |
* XviD Native encoder entry point |
* Xvid Native encoder entry point |
846 |
* |
* |
847 |
* This function is just a wrapper to all the option cases. |
* This function is just a wrapper to all the option cases. |
848 |
* |
* |