annotate libmpeg2/libmpeg-0.4.1.diff @ 21923:1658f7d97b27

fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
author henry
date Tue, 16 Jan 2007 09:49:28 +0000
parents f6881c789312
children f0ddd02aec27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
1 --- include/attributes.h 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
2 +++ libmpeg2/attributes.h 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
3 @@ -25,7 +29,7 @@
13147
henry
parents: 13020
diff changeset
4 #ifdef ATTRIBUTE_ALIGNED_MAX
henry
parents: 13020
diff changeset
5 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
henry
parents: 13020
diff changeset
6 #else
henry
parents: 13020
diff changeset
7 -#define ATTR_ALIGN(align)
henry
parents: 13020
diff changeset
8 +#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((16 < align) ? 16 : align)))
henry
parents: 13020
diff changeset
9 #endif
henry
parents: 13020
diff changeset
10
henry
parents: 13020
diff changeset
11 #ifdef HAVE_BUILTIN_EXPECT
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
12 --- libmpeg2/cpu_accel.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
13 +++ libmpeg2/cpu_accel.c 2006-06-16 20:12:50.000000000 +0200
19026
de3edca9a962 Remove copyright notice changes from local diff.
diego
parents: 19024
diff changeset
14 @@ -22,6 +26,7 @@
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
15 */
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
16
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
17 #include "config.h"
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
18 +#include "cpudetect.h"
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
19
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
20 #include <inttypes.h>
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
21
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
22 @@ -30,9 +35,17 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
23 #include "mpeg2_internal.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
24
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
25 #ifdef ACCEL_DETECT
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
26 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
27 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
28 +
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
29 +/* MPlayer imports libmpeg2 as decoder, which detects MMX / 3DNow!
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
30 + * instructions via assembly. However, it is regarded as duplicaed work
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
31 + * in MPlayer, so that we enforce to use MPlayer's implementation.
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
32 + */
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
33 +#define USE_MPLAYER_CPUDETECT
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
34 +
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
35 static inline uint32_t arch_accel (void)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
36 {
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
37 +#if !defined(USE_MPLAYER_CPUDETECT)
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
38 uint32_t eax, ebx, ecx, edx;
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
39 int AMD;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
40 uint32_t caps;
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
41 @@ -105,10 +118,24 @@
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
42 caps |= MPEG2_ACCEL_X86_MMXEXT;
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
43
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
44 return caps;
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
45 +#else /* USE_MPLAYER_CPUDETECT: Use MPlayer's cpu capability property */
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
46 + caps = 0;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
47 + if (gCpuCaps.hasMMX)
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
48 + caps |= MPEG2_ACCEL_X86_MMX;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
49 + if (gCpuCaps.hasSSE2)
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
50 + caps |= MPEG2_ACCEL_X86_SSE2;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
51 + if (gCpuCaps.hasMMX2)
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
52 + caps |= MPEG2_ACCEL_X86_MMXEXT;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
53 + if (gCpuCaps.has3DNow)
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
54 + caps |= MPEG2_ACCEL_X86_3DNOW;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
55 +
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
56 + return caps;
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
57 +
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
58 +#endif /* USE_MPLAYER_CPUDETECT */
13020
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
59 }
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
60 -#endif /* ARCH_X86 */
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
61 +#endif /* ARCH_X86 || ARCH_X86_64 */
13020
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
62
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
63 -#if defined(ARCH_PPC) || defined(ARCH_SPARC)
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
64 +#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS))
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
65 #include <signal.h>
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
66 #include <setjmp.h>
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
67
21377
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
68 @@ -166,10 +166,10 @@
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
69
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
70 canjump = 1;
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
71
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
72 -#ifdef HAVE_ALTIVEC_H /* gnu */
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
73 -#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t"
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
74 -#else /* apple */
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
75 +#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ ) /* apple */
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
76 #define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t"
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
77 +#else /* gnu */
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
78 +#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t"
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
79 #endif
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
80 asm volatile ("mtspr 256, %0\n\t"
6053051bdc75 add missing r15484
henry
parents: 20640
diff changeset
81 VAND (0, 0, 0)
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
82 @@ -195,6 +222,7 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
83 #ifdef ARCH_ALPHA
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
84 static inline uint32_t arch_accel (void)
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
85 {
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
86 +#ifdef CAN_COMPILE_ALPHA_MVI
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
87 uint64_t no_mvi;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
88
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
89 asm volatile ("amask %1, %0"
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
90 @@ -202,6 +230,9 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
91 : "rI" (256)); /* AMASK_MVI */
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
92 return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
93 MPEG2_ACCEL_ALPHA_MVI);
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
94 +#else
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
95 + return MPEG2_ACCEL_ALPHA;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
96 +#endif
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
97 }
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
98 #endif /* ARCH_ALPHA */
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
99 #endif /* ACCEL_DETECT */
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
100 @@ -212,7 +243,7 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
101
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
102 accel = 0;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
103 #ifdef ACCEL_DETECT
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
104 -#if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
105 +#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
106 accel = arch_accel ();
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
107 #endif
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
108 #endif
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
109 --- libmpeg2/cpu_state.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
110 +++ libmpeg2/cpu_state.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
111 @@ -29,14 +33,14 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
112 #include "mpeg2.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
113 #include "attributes.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
114 #include "mpeg2_internal.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
115 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
116 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
117 #include "mmx.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
118 #endif
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
119
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
120 void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
121 void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
122
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
123 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
124 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
125 static void state_restore_mmx (cpu_state_t * state)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
126 {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
127 emms ();
21571
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
128 @@ -48,18 +48,18 @@
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
129 #endif
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
130
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
131 -#ifdef ARCH_PPC
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
132 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
133 -#ifdef HAVE_ALTIVEC_H /* gnu */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
134 -#define LI(a,b) "li " #a "," #b "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
135 -#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
136 -#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
137 -#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
138 -#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
139 -#else /* apple */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
140 +#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ ) /* apple */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
141 #define LI(a,b) "li r" #a "," #b "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
142 #define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
143 #define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
144 #define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
145 #define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
146 +#else /* gnu */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
147 +#define LI(a,b) "li " #a "," #b "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
148 +#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
149 +#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
150 +#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
151 +#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
152 #endif
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
153
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
154 static void state_save_altivec (cpu_state_t * state)
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
155 @@ -115,12 +119,12 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
156
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
157 void mpeg2_cpu_state_init (uint32_t accel)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
158 {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
159 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
160 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
161 if (accel & MPEG2_ACCEL_X86_MMX) {
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
162 mpeg2_cpu_state_restore = state_restore_mmx;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
163 }
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
164 #endif
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
165 -#ifdef ARCH_PPC
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
166 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
167 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
168 mpeg2_cpu_state_save = state_save_altivec;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
169 mpeg2_cpu_state_restore = state_restore_altivec;
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
170 --- libmpeg2/decode.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
171 +++ libmpeg2/decode.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
172 @@ -351,6 +355,15 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
173 fbuf->buf[1] = buf[1];
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
174 fbuf->buf[2] = buf[2];
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
175 fbuf->id = id;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
176 + // HACK! FIXME! At first I frame, copy pointers to prediction frame too!
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
177 + if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
178 + mpeg2dec->fbuf[1]->buf[0]=buf[0];
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
179 + mpeg2dec->fbuf[1]->buf[1]=buf[1];
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
180 + mpeg2dec->fbuf[1]->buf[2]=buf[2];
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
181 + mpeg2dec->fbuf[1]->id=NULL;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
182 + }
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
183 +// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n",
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
184 +// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]);
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
185 }
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
186
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
187 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf)
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
188 --- libmpeg2/header.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
189 +++ libmpeg2/header.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
190 @@ -100,6 +104,9 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
191 mpeg2dec->decoder.convert = NULL;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
192 mpeg2dec->decoder.convert_id = NULL;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
193 mpeg2dec->picture = mpeg2dec->pictures;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
194 + memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t));
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
195 + memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t));
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
196 + memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t));
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
197 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
198 mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
199 mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf;
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
200 @@ -551,6 +558,7 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
201 if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) {
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
202 picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
203 flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
204 + flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
205 } else
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
206 picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
207 break;
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
208 @@ -799,6 +807,7 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
209 mpeg2dec->scaled[index] = mpeg2dec->q_scale_type;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
210 for (i = 0; i < 32; i++) {
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
211 k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1);
13147
henry
parents: 13020
diff changeset
212 + decoder->quantizer_scales[i] = k;
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
213 for (j = 0; j < 64; j++)
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
214 decoder->quantizer_prescale[index][i][j] =
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
215 k * mpeg2dec->quantizer_matrix[index][j];
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
216 --- libmpeg2/idct.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
217 +++ libmpeg2/idct.c 2006-06-16 20:12:50.000000000 +0200
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
218 @@ -239,12 +239,15 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
219
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
220 void mpeg2_idct_init (uint32_t accel)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
221 {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
222 -#ifdef ARCH_X86
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
223 +#ifdef HAVE_MMX2
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
224 if (accel & MPEG2_ACCEL_X86_MMXEXT) {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
225 mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
226 mpeg2_idct_add = mpeg2_idct_add_mmxext;
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
227 mpeg2_idct_mmx_init ();
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
228 - } else if (accel & MPEG2_ACCEL_X86_MMX) {
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
229 + } else
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
230 +#endif
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
231 +#ifdef HAVE_MMX
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
232 + if (accel & MPEG2_ACCEL_X86_MMX) {
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
233 mpeg2_idct_copy = mpeg2_idct_copy_mmx;
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
234 mpeg2_idct_add = mpeg2_idct_add_mmx;
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
235 mpeg2_idct_mmx_init ();
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
236 @@ -254,11 +261,14 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
237 } else
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
238 #endif
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
239 #ifdef ARCH_ALPHA
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
240 +#ifdef CAN_COMPILE_ALPHA_MVI
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
241 if (accel & MPEG2_ACCEL_ALPHA_MVI) {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
242 mpeg2_idct_copy = mpeg2_idct_copy_mvi;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
243 mpeg2_idct_add = mpeg2_idct_add_mvi;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
244 mpeg2_idct_alpha_init ();
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
245 - } else if (accel & MPEG2_ACCEL_ALPHA) {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
246 + } else
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
247 +#endif
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
248 + if (accel & MPEG2_ACCEL_ALPHA) {
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
249 int i;
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
250
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
251 mpeg2_idct_copy = mpeg2_idct_copy_alpha;
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
252 --- libmpeg2/idct_alpha.c 2006-06-16 20:12:26.000000000 +0200
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
253 +++ libmpeg2/idct_alpha.c 2006-06-16 20:12:50.000000000 +0200
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
254 @@ -157,6 +161,7 @@
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
255 block[8*7] = (a0 - b0) >> 17;
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
256 }
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
257
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
258 +#ifdef CAN_COMPILE_ALPHA_MVI
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
259 void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, const int stride)
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
260 {
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
261 uint64_t clampmask;
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
262 @@ -289,6 +294,7 @@
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
263 stq (p7, dest + 7 * stride);
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
264 }
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
265 }
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
266 +#endif
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
267
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
268 void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, const int stride)
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
269 {
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
270 --- libmpeg2/idct_mmx.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
271 +++ libmpeg2/idct_mmx.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
272 @@ -23,7 +27,7 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
273
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
274 #include "config.h"
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
275
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
276 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
277 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
278
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
279 #include <inttypes.h>
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
280
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
281 --- libmpeg2/motion_comp.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
282 +++ libmpeg2/motion_comp.c 2006-06-16 20:12:50.000000000 +0200
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
283 @@ -37,16 +37,22 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
284
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
285 void mpeg2_mc_init (uint32_t accel)
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
286 {
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
287 -#ifdef ARCH_X86
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
288 +#ifdef HAVE_MMX2
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
289 if (accel & MPEG2_ACCEL_X86_MMXEXT)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
290 mpeg2_mc = mpeg2_mc_mmxext;
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
291 - else if (accel & MPEG2_ACCEL_X86_3DNOW)
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
292 + else
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
293 +#endif
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
294 +#ifdef HAVE_3DNOW
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
295 + if (accel & MPEG2_ACCEL_X86_3DNOW)
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
296 mpeg2_mc = mpeg2_mc_3dnow;
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
297 - else if (accel & MPEG2_ACCEL_X86_MMX)
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
298 + else
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
299 +#endif
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
300 +#ifdef HAVE_MMX
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
301 + if (accel & MPEG2_ACCEL_X86_MMX)
14730
4d64117768b1 Update patch with missing changes.
diego
parents: 13864
diff changeset
302 mpeg2_mc = mpeg2_mc_mmx;
21526
60a39d71e247 sync to libmpeg2-0.4.1
henry
parents: 21402
diff changeset
303 else
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
304 #endif
14730
4d64117768b1 Update patch with missing changes.
diego
parents: 13864
diff changeset
305 -#ifdef ARCH_PPC
4d64117768b1 Update patch with missing changes.
diego
parents: 13864
diff changeset
306 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
307 if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
308 mpeg2_mc = mpeg2_mc_altivec;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
309 else
19259
7a9116ae7fc0 Update for changes from r19139 and r19137.
diego
parents: 19026
diff changeset
310 @@ -52,7 +62,7 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
311 mpeg2_mc = mpeg2_mc_alpha;
13020
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
312 else
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
313 #endif
14730
4d64117768b1 Update patch with missing changes.
diego
parents: 13864
diff changeset
314 -#ifdef ARCH_SPARC
4d64117768b1 Update patch with missing changes.
diego
parents: 13864
diff changeset
315 +#if defined(ARCH_SPARC) && defined(HAVE_VIS)
13020
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
316 if (accel & MPEG2_ACCEL_SPARC_VIS)
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
317 mpeg2_mc = mpeg2_mc_vis;
3380d4a65b15 Patch updated for latest changes to libmpeg2.
diego
parents: 13019
diff changeset
318 else
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
319 --- libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
320 +++ libmpeg2/motion_comp_mmx.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
321 @@ -23,7 +27,7 @@
13864
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
322
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
323 #include "config.h"
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
324
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
325 -#ifdef ARCH_X86
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
326 +#if defined(ARCH_X86) || defined(ARCH_X86_64)
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
327
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
328 #include <inttypes.h>
96259a2f2142 enable mmx support on x86_64 in libmpeg2
aurel
parents: 13147
diff changeset
329
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
330 --- include/mpeg2.h 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
331 +++ libmpeg2/mpeg2.h 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
332 @@ -82,6 +86,7 @@
13147
henry
parents: 13020
diff changeset
333 #define PIC_FLAG_COMPOSITE_DISPLAY 32
henry
parents: 13020
diff changeset
334 #define PIC_FLAG_SKIP 64
henry
parents: 13020
diff changeset
335 #define PIC_FLAG_TAGS 128
henry
parents: 13020
diff changeset
336 +#define PIC_FLAG_REPEAT_FIRST_FIELD 256
henry
parents: 13020
diff changeset
337 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
henry
parents: 13020
diff changeset
338
henry
parents: 13020
diff changeset
339 typedef struct mpeg2_picture_s {
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
340 @@ -154,6 +159,7 @@
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
341 #define MPEG2_ACCEL_X86_MMX 1
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
342 #define MPEG2_ACCEL_X86_3DNOW 2
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
343 #define MPEG2_ACCEL_X86_MMXEXT 4
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
344 +#define MPEG2_ACCEL_X86_SSE2 8
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
345 #define MPEG2_ACCEL_PPC_ALTIVEC 1
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
346 #define MPEG2_ACCEL_ALPHA 1
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
347 #define MPEG2_ACCEL_ALPHA_MVI 2
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
348 --- libmpeg2/mpeg2_internal.h 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
349 +++ libmpeg2/mpeg2_internal.h 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
350 @@ -144,6 +148,12 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
351 int second_field;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
352
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
353 int mpeg1;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
354 +
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
355 + /* for MPlayer: */
13147
henry
parents: 13020
diff changeset
356 + int quantizer_scales[32];
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
357 + int quantizer_scale;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
358 + char* quant_store;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
359 + int quant_stride;
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
360 };
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
361
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
362 typedef struct {
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
363 @@ -214,6 +224,10 @@
13147
henry
parents: 13020
diff changeset
364 int8_t q_scale_type, scaled[4];
henry
parents: 13020
diff changeset
365 uint8_t quantizer_matrix[4][64];
henry
parents: 13020
diff changeset
366 uint8_t new_quantizer_matrix[4][64];
henry
parents: 13020
diff changeset
367 +
henry
parents: 13020
diff changeset
368 + /* for MPlayer: */
henry
parents: 13020
diff changeset
369 + unsigned char *pending_buffer;
henry
parents: 13020
diff changeset
370 + int pending_length;
henry
parents: 13020
diff changeset
371 };
henry
parents: 13020
diff changeset
372
henry
parents: 13020
diff changeset
373 typedef struct {
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
374 --- libmpeg2/slice.c 2006-06-16 20:12:26.000000000 +0200
18730
93241711b635 sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents: 14730
diff changeset
375 +++ libmpeg2/slice.c 2006-06-16 20:12:50.000000000 +0200
19024
4733c3e4f353 Update with latest changes and make diff apply cleanly.
diego
parents: 18783
diff changeset
376 @@ -142,6 +146,7 @@
13147
henry
parents: 13020
diff changeset
377
henry
parents: 13020
diff changeset
378 quantizer_scale_code = UBITS (bit_buf, 5);
henry
parents: 13020
diff changeset
379 DUMPBITS (bit_buf, bits, 5);
henry
parents: 13020
diff changeset
380 + decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code];
henry
parents: 13020
diff changeset
381
henry
parents: 13020
diff changeset
382 decoder->quantizer_matrix[0] =
henry
parents: 13020
diff changeset
383 decoder->quantizer_prescale[0][quantizer_scale_code];
20640
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
384 @@ -1568,6 +1569,18 @@
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
385
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
386 #define NEXT_MACROBLOCK \
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
387 do { \
20640
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
388 + if(decoder->quant_store) { \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
389 + if (decoder->picture_structure == TOP_FIELD) \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
390 + decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
391 + +(decoder->offset>>4)] = decoder->quantizer_scale; \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
392 + else if (decoder->picture_structure == BOTTOM_FIELD) \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
393 + decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
394 + + decoder->quant_stride \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
395 + +(decoder->offset>>4)] = decoder->quantizer_scale; \
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
396 + else \
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
397 + decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
398 + +(decoder->offset>>4)] = decoder->quantizer_scale; \
20640
c52bb8d6edea update for r20654
henry
parents: 19259
diff changeset
399 + } \
12937
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
400 decoder->offset += 16; \
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
401 if (decoder->offset == decoder->width) { \
b61f21a54546 summary of the MPlayer specific libmpeg2 changes
henry
parents:
diff changeset
402 do { /* just so we can use the break statement */ \
21923
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
403 @@ -1604,6 +1604,12 @@
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
404 } \
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
405 } while (0)
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
406
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
407 +static void motion_dummy (mpeg2_decoder_t * const decoder,
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
408 + motion_t * const motion,
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
409 + mpeg2_mc_fct * const * const table)
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
410 +{
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
411 +}
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
412 +
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
413 void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
414 uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3])
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
415 {
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
416 @@ -1661,7 +1667,9 @@
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
417
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
418 if (decoder->mpeg1) {
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
419 decoder->motion_parser[0] = motion_zero_420;
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
420 + decoder->motion_parser[MC_FIELD] = motion_dummy;
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
421 decoder->motion_parser[MC_FRAME] = motion_mp1;
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
422 + decoder->motion_parser[MC_DMV] = motion_dummy;
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
423 decoder->motion_parser[4] = motion_reuse_420;
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
424 } else if (decoder->picture_structure == FRAME_PICTURE) {
1658f7d97b27 fix crash with http://sam.zoy.org/zzuf/lol-mplayer.m2v
henry
parents: 21571
diff changeset
425 if (decoder->chroma_format == 0) {
21534
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
426 --- libmpeg2/idct.c 2006-06-16 20:12:26.000000000 +0200
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
427 +++ libmpeg2/idct.c 2006-06-16 20:12:50.000000000 +0200
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
428 @@ -253,7 +253,7 @@
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
429 mpeg2_idct_mmx_init ();
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
430 } else
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
431 #endif
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
432 -#ifdef ARCH_PPC
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
433 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC)
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
434 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
435 mpeg2_idct_copy = mpeg2_idct_copy_altivec;
6bee9fab79f6 Fix ppc without altivec compilation
reimar
parents: 21526
diff changeset
436 mpeg2_idct_add = mpeg2_idct_add_altivec;
21571
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
437 --- libmpeg2/idct_altivec.c 2004/08/02 11:26:43 12933
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
438 +++ libmpeg2/idct_altivec.c 2005/05/15 20:11:34 15484
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
439 @@ -41,7 +41,7 @@
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
440 typedef vector signed int vector_s32_t;
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
441 typedef vector unsigned int vector_u32_t;
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
442
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
443 -#if defined(HAVE_ALTIVEC_H) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
444 +#if defined( HAVE_ALTIVEC_H ) && !defined( __APPLE_ALTIVEC__ ) && (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
445 /* work around gcc <3.3 vec_mergel bug */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
446 static inline vector_s16_t my_vec_mergel (vector_s16_t const A,
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
447 vector_s16_t const B)
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
448 @@ -56,10 +56,10 @@
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
449 #define vec_mergel my_vec_mergel
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
450 #endif
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
451
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
452 -#ifdef HAVE_ALTIVEC_H /* gnu */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
453 -#define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h}
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
454 -#else /* apple */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
455 +#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ ) /* apple */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
456 #define VEC_S16(a,b,c,d,e,f,g,h) (vector_s16_t) (a, b, c, d, e, f, g, h)
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
457 +#else /* gnu */
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
458 +#define VEC_S16(a,b,c,d,e,f,g,h) {a, b, c, d, e, f, g, h}
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
459 #endif
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
460
f6881c789312 (hopefully) the rest of PPC modifications
henry
parents: 21534
diff changeset
461 static const vector_s16_t constants ATTR_ALIGN(16) =