Mercurial > mplayer.hg
annotate libmpeg2/libmpeg-0.4.0.diff @ 21455:dd49d3712e6f
Rename: ass_process_font -> ass_add_font.
author | eugeni |
---|---|
date | Sun, 03 Dec 2006 17:35:40 +0000 |
parents | 8c43ea1ea79a |
children |
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 | 4 #ifdef ATTRIBUTE_ALIGNED_MAX |
5 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) | |
6 #else | |
7 -#define ATTR_ALIGN(align) | |
8 +#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((16 < align) ? 16 : align))) | |
9 #endif | |
10 | |
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 | 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 | 23 #include "mpeg2_internal.h" |
24 | |
25 #ifdef ACCEL_DETECT | |
26 -#ifdef ARCH_X86 | |
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 | 35 static inline uint32_t arch_accel (void) |
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 | 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 | 43 |
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 | 59 } |
13864 | 60 -#endif /* ARCH_X86 */ |
61 +#endif /* ARCH_X86 || ARCH_X86_64 */ | |
13020 | 62 |
63 -#if defined(ARCH_PPC) || defined(ARCH_SPARC) | |
64 +#if defined(ARCH_PPC) || (defined(ARCH_SPARC) && defined(HAVE_VIS)) | |
65 #include <signal.h> | |
66 #include <setjmp.h> | |
67 | |
21377 | 68 @@ -166,10 +166,10 @@ |
69 | |
70 canjump = 1; | |
71 | |
72 -#ifdef HAVE_ALTIVEC_H /* gnu */ | |
73 -#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t" | |
74 -#else /* apple */ | |
75 +#if defined( __APPLE_CC__ ) && defined( __APPLE_ALTIVEC__ ) /* apple */ | |
76 #define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t" | |
77 +#else /* gnu */ | |
78 +#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t" | |
79 #endif | |
80 asm volatile ("mtspr 256, %0\n\t" | |
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 | 83 #ifdef ARCH_ALPHA |
84 static inline uint32_t arch_accel (void) | |
85 { | |
86 +#ifdef CAN_COMPILE_ALPHA_MVI | |
87 uint64_t no_mvi; | |
88 | |
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 | 91 : "rI" (256)); /* AMASK_MVI */ |
92 return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA | | |
93 MPEG2_ACCEL_ALPHA_MVI); | |
94 +#else | |
95 + return MPEG2_ACCEL_ALPHA; | |
96 +#endif | |
97 } | |
98 #endif /* ARCH_ALPHA */ | |
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 | 101 |
102 accel = 0; | |
103 #ifdef ACCEL_DETECT | |
104 -#if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) | |
105 +#if defined (ARCH_X86) || defined (ARCH_X86_64) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC) | |
106 accel = arch_accel (); | |
107 #endif | |
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 | 112 #include "mpeg2.h" |
113 #include "attributes.h" | |
114 #include "mpeg2_internal.h" | |
115 -#ifdef ARCH_X86 | |
116 +#if defined(ARCH_X86) || defined(ARCH_X86_64) | |
117 #include "mmx.h" | |
118 #endif | |
119 | |
120 void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL; | |
121 void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL; | |
122 | |
123 -#ifdef ARCH_X86 | |
124 +#if defined(ARCH_X86) || defined(ARCH_X86_64) | |
125 static void state_restore_mmx (cpu_state_t * state) | |
126 { | |
127 emms (); | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
128 @@ -115,12 +119,12 @@ |
13864 | 129 |
130 void mpeg2_cpu_state_init (uint32_t accel) | |
131 { | |
132 -#ifdef ARCH_X86 | |
133 +#if defined(ARCH_X86) || defined(ARCH_X86_64) | |
134 if (accel & MPEG2_ACCEL_X86_MMX) { | |
12937 | 135 mpeg2_cpu_state_restore = state_restore_mmx; |
136 } | |
137 #endif | |
138 -#ifdef ARCH_PPC | |
139 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC) | |
140 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) { | |
141 mpeg2_cpu_state_save = state_save_altivec; | |
142 mpeg2_cpu_state_restore = state_restore_altivec; | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
143 --- 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
|
144 +++ 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
|
145 @@ -351,6 +355,15 @@ |
12937 | 146 fbuf->buf[1] = buf[1]; |
147 fbuf->buf[2] = buf[2]; | |
148 fbuf->id = id; | |
149 + // HACK! FIXME! At first I frame, copy pointers to prediction frame too! | |
150 + if (mpeg2dec->custom_fbuf && !mpeg2dec->fbuf[1]->buf[0]){ | |
151 + mpeg2dec->fbuf[1]->buf[0]=buf[0]; | |
152 + mpeg2dec->fbuf[1]->buf[1]=buf[1]; | |
153 + mpeg2dec->fbuf[1]->buf[2]=buf[2]; | |
154 + mpeg2dec->fbuf[1]->id=NULL; | |
155 + } | |
156 +// printf("libmpeg2: FBUF 0:%p 1:%p 2:%p\n", | |
157 +// mpeg2dec->fbuf[0]->buf[0],mpeg2dec->fbuf[1]->buf[0],mpeg2dec->fbuf[2]->buf[0]); | |
158 } | |
159 | |
160 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
|
161 --- 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
|
162 +++ 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
|
163 @@ -100,6 +104,9 @@ |
12937 | 164 mpeg2dec->decoder.convert = NULL; |
165 mpeg2dec->decoder.convert_id = NULL; | |
166 mpeg2dec->picture = mpeg2dec->pictures; | |
167 + memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
168 + memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
169 + memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t)); | |
170 mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf; | |
171 mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf; | |
172 mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf; | |
21402 | 173 @@ -272,9 +272,11 @@ |
174 if (!(buffer[2] & 2)) /* missing marker_bit */ | |
175 return 1; | |
176 | |
177 - sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2); | |
178 - sequence->display_height = | |
179 - ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3); | |
180 + if( (buffer[1] << 6) | (buffer[2] >> 2) ) | |
181 + sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2); | |
182 + if( ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3) ) | |
183 + sequence->display_height = | |
184 + ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3); | |
185 | |
186 return 0; | |
187 } | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
188 @@ -551,6 +558,7 @@ |
12937 | 189 if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) { |
190 picture->nb_fields = (buffer[3] & 2) ? 3 : 2; | |
191 flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0; | |
192 + flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0; | |
193 } else | |
194 picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2; | |
195 break; | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
196 @@ -799,6 +807,7 @@ |
12937 | 197 mpeg2dec->scaled[index] = mpeg2dec->q_scale_type; |
198 for (i = 0; i < 32; i++) { | |
199 k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); | |
13147 | 200 + decoder->quantizer_scales[i] = k; |
12937 | 201 for (j = 0; j < 64; j++) |
202 decoder->quantizer_prescale[index][i][j] = | |
203 k * mpeg2dec->quantizer_matrix[index][j]; | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
204 --- 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
|
205 +++ libmpeg2/idct.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
|
206 @@ -66,7 +70,7 @@ |
13864 | 207 } while (0) |
208 #endif | |
209 | |
210 -static void inline idct_row (int16_t * const block) | |
211 +static inline void idct_row (int16_t * const block) | |
212 { | |
213 int d0, d1, d2, d3; | |
214 int a0, a1, a2, a3, b0, b1, b2, b3; | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
215 @@ -119,7 +123,7 @@ |
13864 | 216 block[7] = (a0 - b0) >> 12; |
217 } | |
218 | |
219 -static void inline idct_col (int16_t * const block) | |
220 +static inline void idct_col (int16_t * const block) | |
221 { | |
222 int d0, d1, d2, d3; | |
223 int a0, a1, a2, a3, b0, b1, b2, b3; | |
19259 | 224 @@ -239,12 +239,15 @@ |
13864 | 225 |
226 void mpeg2_idct_init (uint32_t accel) | |
227 { | |
228 -#ifdef ARCH_X86 | |
19259 | 229 +#ifdef HAVE_MMX2 |
13864 | 230 if (accel & MPEG2_ACCEL_X86_MMXEXT) { |
231 mpeg2_idct_copy = mpeg2_idct_copy_mmxext; | |
232 mpeg2_idct_add = mpeg2_idct_add_mmxext; | |
19259 | 233 mpeg2_idct_mmx_init (); |
234 - } else if (accel & MPEG2_ACCEL_X86_MMX) { | |
235 + } else | |
236 +#endif | |
237 +#ifdef HAVE_MMX | |
238 + if (accel & MPEG2_ACCEL_X86_MMX) { | |
239 mpeg2_idct_copy = mpeg2_idct_copy_mmx; | |
240 mpeg2_idct_add = mpeg2_idct_add_mmx; | |
241 mpeg2_idct_mmx_init (); | |
242 @@ -254,11 +261,14 @@ | |
13864 | 243 } else |
244 #endif | |
245 #ifdef ARCH_ALPHA | |
246 +#ifdef CAN_COMPILE_ALPHA_MVI | |
247 if (accel & MPEG2_ACCEL_ALPHA_MVI) { | |
248 mpeg2_idct_copy = mpeg2_idct_copy_mvi; | |
249 mpeg2_idct_add = mpeg2_idct_add_mvi; | |
250 mpeg2_idct_alpha_init (); | |
251 - } else if (accel & MPEG2_ACCEL_ALPHA) { | |
252 + } else | |
253 +#endif | |
254 + if (accel & MPEG2_ACCEL_ALPHA) { | |
255 int i; | |
256 | |
257 mpeg2_idct_copy = mpeg2_idct_copy_alpha; | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
258 --- 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
|
259 +++ 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
|
260 @@ -59,7 +63,7 @@ |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
261 } while (0) |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
262 #endif |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
263 |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
264 -static void inline idct_row (int16_t * const block) |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
265 +static inline void idct_row (int16_t * const block) |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
266 { |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
267 uint64_t l, r; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
268 int_fast32_t d0, d1, d2, d3; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
269 @@ -116,7 +120,7 @@ |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
270 block[7] = (a0 - b0) >> 12; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
271 } |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
272 |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
273 -static void inline idct_col (int16_t * const block) |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
274 +static inline void idct_col (int16_t * const block) |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
275 { |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
276 int_fast32_t d0, d1, d2, d3; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
277 int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
278 @@ -157,6 +161,7 @@ |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
279 block[8*7] = (a0 - b0) >> 17; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
280 } |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
281 |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
282 +#ifdef CAN_COMPILE_ALPHA_MVI |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
283 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
|
284 { |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
285 uint64_t clampmask; |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
286 @@ -289,6 +294,7 @@ |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
287 stq (p7, dest + 7 * stride); |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
288 } |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
289 } |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
290 +#endif |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
291 |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
292 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
|
293 { |
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
294 --- 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
|
295 +++ 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
|
296 @@ -23,7 +27,7 @@ |
13864 | 297 |
298 #include "config.h" | |
12937 | 299 |
13864 | 300 -#ifdef ARCH_X86 |
301 +#if defined(ARCH_X86) || defined(ARCH_X86_64) | |
302 | |
303 #include <inttypes.h> | |
12937 | 304 |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
305 --- 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
|
306 +++ libmpeg2/motion_comp.c 2006-06-16 20:12:50.000000000 +0200 |
19259 | 307 @@ -37,16 +37,22 @@ |
13864 | 308 |
309 void mpeg2_mc_init (uint32_t accel) | |
12937 | 310 { |
13864 | 311 -#ifdef ARCH_X86 |
19259 | 312 +#ifdef HAVE_MMX2 |
13864 | 313 if (accel & MPEG2_ACCEL_X86_MMXEXT) |
314 mpeg2_mc = mpeg2_mc_mmxext; | |
19259 | 315 - else if (accel & MPEG2_ACCEL_X86_3DNOW) |
316 + else | |
317 +#endif | |
318 +#ifdef HAVE_3DNOW | |
319 + if (accel & MPEG2_ACCEL_X86_3DNOW) | |
320 mpeg2_mc = mpeg2_mc_3dnow; | |
321 - else if (accel & MPEG2_ACCEL_X86_MMX) | |
322 + else | |
323 +#endif | |
324 +#ifdef HAVE_MMX | |
325 + if (accel & MPEG2_ACCEL_X86_MMX) | |
14730 | 326 mpeg2_mc = mpeg2_mc_mmx; |
19259 | 327 - elseo |
328 + else | |
12937 | 329 #endif |
14730 | 330 -#ifdef ARCH_PPC |
331 +#if defined(ARCH_PPC) && defined(HAVE_ALTIVEC) | |
12937 | 332 if (accel & MPEG2_ACCEL_PPC_ALTIVEC) |
333 mpeg2_mc = mpeg2_mc_altivec; | |
334 else | |
19259 | 335 @@ -52,7 +62,7 @@ |
12937 | 336 mpeg2_mc = mpeg2_mc_alpha; |
13020 | 337 else |
338 #endif | |
14730 | 339 -#ifdef ARCH_SPARC |
340 +#if defined(ARCH_SPARC) && defined(HAVE_VIS) | |
13020 | 341 if (accel & MPEG2_ACCEL_SPARC_VIS) |
342 mpeg2_mc = mpeg2_mc_vis; | |
343 else | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
344 --- 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
|
345 +++ 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
|
346 @@ -23,7 +27,7 @@ |
13864 | 347 |
348 #include "config.h" | |
349 | |
350 -#ifdef ARCH_X86 | |
351 +#if defined(ARCH_X86) || defined(ARCH_X86_64) | |
352 | |
353 #include <inttypes.h> | |
354 | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
355 --- 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
|
356 +++ 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
|
357 @@ -82,6 +86,7 @@ |
13147 | 358 #define PIC_FLAG_COMPOSITE_DISPLAY 32 |
359 #define PIC_FLAG_SKIP 64 | |
360 #define PIC_FLAG_TAGS 128 | |
361 +#define PIC_FLAG_REPEAT_FIRST_FIELD 256 | |
362 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000 | |
363 | |
364 typedef struct mpeg2_picture_s { | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
365 @@ -154,6 +159,7 @@ |
18730
93241711b635
sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents:
14730
diff
changeset
|
366 #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
|
367 #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
|
368 #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
|
369 +#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
|
370 #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
|
371 #define MPEG2_ACCEL_ALPHA 1 |
93241711b635
sync with 18730 (Use MPlayer's CPU detection module instead of libmpeg2's)
gpoirier
parents:
14730
diff
changeset
|
372 #define MPEG2_ACCEL_ALPHA_MVI 2 |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
373 --- 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
|
374 +++ 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
|
375 @@ -144,6 +148,12 @@ |
12937 | 376 int second_field; |
377 | |
378 int mpeg1; | |
379 + | |
380 + /* for MPlayer: */ | |
13147 | 381 + int quantizer_scales[32]; |
12937 | 382 + int quantizer_scale; |
383 + char* quant_store; | |
384 + int quant_stride; | |
385 }; | |
386 | |
387 typedef struct { | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
388 @@ -214,6 +224,10 @@ |
13147 | 389 int8_t q_scale_type, scaled[4]; |
390 uint8_t quantizer_matrix[4][64]; | |
391 uint8_t new_quantizer_matrix[4][64]; | |
392 + | |
393 + /* for MPlayer: */ | |
394 + unsigned char *pending_buffer; | |
395 + int pending_length; | |
396 }; | |
397 | |
398 typedef struct { | |
19024
4733c3e4f353
Update with latest changes and make diff apply cleanly.
diego
parents:
18783
diff
changeset
|
399 --- 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
|
400 +++ 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
|
401 @@ -142,6 +146,7 @@ |
13147 | 402 |
403 quantizer_scale_code = UBITS (bit_buf, 5); | |
404 DUMPBITS (bit_buf, bits, 5); | |
405 + decoder->quantizer_scale = decoder->quantizer_scales[quantizer_scale_code]; | |
406 | |
407 decoder->quantizer_matrix[0] = | |
408 decoder->quantizer_prescale[0][quantizer_scale_code]; | |
21402 | 409 @@ -1252,7 +1252,7 @@ |
410 ref[0] + offset, decoder->stride, 16); \ | |
411 table[4] (decoder->dest[1] + decoder->offset, \ | |
412 ref[1] + offset, decoder->stride, 16); \ | |
413 - table[4] (decoder->dest[2] + (decoder->offset >> 1), \ | |
414 + table[4] (decoder->dest[2] + decoder->offset, \ | |
415 ref[2] + offset, decoder->stride, 16) | |
416 | |
417 #define bit_buf (decoder->bitstream_buf) | |
20640 | 418 @@ -1568,6 +1569,18 @@ |
12937 | 419 |
420 #define NEXT_MACROBLOCK \ | |
421 do { \ | |
20640 | 422 + if(decoder->quant_store) { \ |
423 + if (decoder->picture_structure == TOP_FIELD) \ | |
424 + decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ | |
425 + +(decoder->offset>>4)] = decoder->quantizer_scale; \ | |
426 + else if (decoder->picture_structure == BOTTOM_FIELD) \ | |
427 + decoder->quant_store[2*decoder->quant_stride*(decoder->v_offset>>4) \ | |
428 + + decoder->quant_stride \ | |
429 + +(decoder->offset>>4)] = decoder->quantizer_scale; \ | |
430 + else \ | |
12937 | 431 + decoder->quant_store[decoder->quant_stride*(decoder->v_offset>>4) \ |
432 + +(decoder->offset>>4)] = decoder->quantizer_scale; \ | |
20640 | 433 + } \ |
12937 | 434 decoder->offset += 16; \ |
435 if (decoder->offset == decoder->width) { \ | |
436 do { /* just so we can use the break statement */ \ |