~ubuntu-branches/ubuntu/lucid/ffmpeg-extra/lucid

« back to all changes in this revision

Viewing changes to debian/patches/fpic-libswscale-fix.patch

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2010-01-17 09:34:54 UTC
  • Revision ID: james.westby@ubuntu.com-20100117093454-nizyo2zidkw0gipk
Tags: 4:0.5+svn20090706-5ubuntu1
merge from 'ubuntu' branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This patch is currently being worked on to resolve all non-PIC issues with
2
 
the libswscale library.
3
 
For inquiries about this patch, please see bug #528080.
4
 
==========================================================================
5
 
--- a/libswscale/rgb2rgb_template.c
6
 
+++ b/libswscale/rgb2rgb_template.c
7
 
@@ -1424,9 +1424,12 @@
8
 
     __asm__ volatile (
9
 
     "test             %%"REG_a", %%"REG_a"          \n\t"
10
 
     "jns                     2f                     \n\t"
11
 
-    "movq     "MANGLE(mask24r)", %%mm5              \n\t"
12
 
-    "movq     "MANGLE(mask24g)", %%mm6              \n\t"
13
 
-    "movq     "MANGLE(mask24b)", %%mm7              \n\t"
14
 
+    "movq                    %0, %%mm5              \n\t"
15
 
+    "movq                    %1, %%mm6              \n\t"
16
 
+    "movq                    %2, %%mm7              \n\t"
17
 
+    : : "m"(mask24r), "m"(mask24g), "m"(mask24b)
18
 
+    );
19
 
+    __asm__ volatile (
20
 
     ASMALIGN(4)
21
 
     "1:                                             \n\t"
22
 
     PREFETCH" 32(%1, %%"REG_a")                     \n\t"
23
 
@@ -2147,8 +2150,8 @@
24
 
         {
25
 
             __asm__ volatile(
26
 
             "mov                        %2, %%"REG_a"   \n\t"
27
 
-            "movq  "MANGLE(ff_bgr2YCoeff)", %%mm6       \n\t"
28
 
-            "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
29
 
+            "movq                       %3, %%mm6       \n\t"
30
 
+            "movq                       %4, %%mm5       \n\t"
31
 
             "pxor                    %%mm7, %%mm7       \n\t"
32
 
             "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
33
 
             ASMALIGN(4)
34
 
@@ -2206,12 +2209,13 @@
35
 
             "psraw                      $7, %%mm4       \n\t"
36
 
 
37
 
             "packuswb                %%mm4, %%mm0       \n\t"
38
 
-            "paddusb "MANGLE(ff_bgr2YOffset)", %%mm0    \n\t"
39
 
+            "paddusb                    %5, %%mm0       \n\t"
40
 
 
41
 
             MOVNTQ"                  %%mm0, (%1, %%"REG_a") \n\t"
42
 
             "add                        $8,      %%"REG_a"  \n\t"
43
 
             " js                        1b                  \n\t"
44
 
-            : : "r" (src+width*3), "r" (ydst+width), "g" (-width)
45
 
+            : : "r" (src+width*3), "r" (ydst+width), "g" (-width),
46
 
+                "m"(ff_bgr2YCoeff), "m"(ff_w1111), "m"(ff_bgr2YOffset)
47
 
             : "%"REG_a, "%"REG_d
48
 
             );
49
 
             ydst += lumStride;
50
 
@@ -2220,8 +2224,8 @@
51
 
         src -= srcStride*2;
52
 
         __asm__ volatile(
53
 
         "mov                        %4, %%"REG_a"   \n\t"
54
 
-        "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
55
 
-        "movq  "MANGLE(ff_bgr2UCoeff)", %%mm6       \n\t"
56
 
+        "movq                       %5, %%mm5       \n\t"
57
 
+        "movq                       %6, %%mm6       \n\t"
58
 
         "pxor                    %%mm7, %%mm7       \n\t"
59
 
         "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
60
 
         "add                 %%"REG_d", %%"REG_d"   \n\t"
61
 
@@ -2270,8 +2274,8 @@
62
 
         "psrlw                      $2, %%mm0       \n\t"
63
 
         "psrlw                      $2, %%mm2       \n\t"
64
 
 #endif
65
 
-        "movq  "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
66
 
-        "movq  "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
67
 
+        "movq                       %7, %%mm1       \n\t"
68
 
+        "movq                       %7, %%mm3       \n\t"
69
 
 
70
 
         "pmaddwd                 %%mm0, %%mm1       \n\t"
71
 
         "pmaddwd                 %%mm2, %%mm3       \n\t"
72
 
@@ -2328,12 +2332,12 @@
73
 
         "paddw                   %%mm1, %%mm5       \n\t"
74
 
         "paddw                   %%mm3, %%mm2       \n\t"
75
 
         "paddw                   %%mm5, %%mm2       \n\t"
76
 
-        "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
77
 
+        "movq                       %5, %%mm5       \n\t"
78
 
         "psrlw                      $2, %%mm4       \n\t"
79
 
         "psrlw                      $2, %%mm2       \n\t"
80
 
 #endif
81
 
-        "movq  "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
82
 
-        "movq  "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
83
 
+        "movq                       %7, %%mm1       \n\t"
84
 
+        "movq                       %7, %%mm3       \n\t"
85
 
 
86
 
         "pmaddwd                 %%mm4, %%mm1       \n\t"
87
 
         "pmaddwd                 %%mm2, %%mm3       \n\t"
88
 
@@ -2357,13 +2361,16 @@
89
 
         "punpckldq               %%mm4, %%mm0           \n\t"
90
 
         "punpckhdq               %%mm4, %%mm1           \n\t"
91
 
         "packsswb                %%mm1, %%mm0           \n\t"
92
 
-        "paddb "MANGLE(ff_bgr2UVOffset)", %%mm0         \n\t"
93
 
+        "paddb                      %8, %%mm0           \n\t"
94
 
         "movd                    %%mm0, (%2, %%"REG_a") \n\t"
95
 
         "punpckhdq               %%mm0, %%mm0           \n\t"
96
 
         "movd                    %%mm0, (%3, %%"REG_a") \n\t"
97
 
         "add                        $4, %%"REG_a"       \n\t"
98
 
         " js                        1b                  \n\t"
99
 
-        : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
100
 
+        : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6),
101
 
+            "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth),
102
 
+            "m"(ff_w1111), "m"(ff_bgr2UCoeff), "m"(ff_bgr2VCoeff),
103
 
+            "m"(ff_bgr2UVOffset)
104
 
         : "%"REG_a, "%"REG_d
105
 
         );
106
 
 
107
 
--- a/libswscale/rgb2rgb.c
108
 
+++ b/libswscale/rgb2rgb.c
109
 
@@ -123,6 +123,18 @@
110
 
 DECLARE_ASM_CONST(8, uint64_t, red_15mask)   = 0x00007c0000007c00ULL;
111
 
 DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
112
 
 DECLARE_ASM_CONST(8, uint64_t, blue_15mask)  = 0x0000001f0000001fULL;
113
 
+
114
 
+// Some constants from swscale.c that are used here
115
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_bgr2YCoeff;
116
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_bgr2UCoeff;
117
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_bgr2VCoeff;
118
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_bgr2YOffset;
119
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_bgr2UVOffset;
120
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_w1111;
121
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24A;
122
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24B;
123
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24C;
124
 
+
125
 
 #endif /* ARCH_X86 */
126
 
 
127
 
 #define RGB2YUV_SHIFT 8
128
 
--- a/libswscale/swscale_template.c
129
 
+++ b/libswscale/swscale_template.c
130
 
@@ -669,9 +669,9 @@
131
 
 #define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)  REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
132
 
 
133
 
 #define REAL_WRITERGB16(dst, dstw, index) \
134
 
-    "pand "MANGLE(bF8)", %%mm2  \n\t" /* B */\
135
 
-    "pand "MANGLE(bFC)", %%mm4  \n\t" /* G */\
136
 
-    "pand "MANGLE(bF8)", %%mm5  \n\t" /* R */\
137
 
+    "pand            %6, %%mm2  \n\t" /* B */\
138
 
+    "pand            %7, %%mm4  \n\t" /* G */\
139
 
+    "pand            %6, %%mm5  \n\t" /* R */\
140
 
     "psrlq           $3, %%mm2  \n\t"\
141
 
 \
142
 
     "movq         %%mm2, %%mm1  \n\t"\
143
 
@@ -695,11 +695,18 @@
144
 
     "cmp        "#dstw", "#index"   \n\t"\
145
 
     " jb             1b             \n\t"
146
 
 #define WRITERGB16(dst, dstw, index)  REAL_WRITERGB16(dst, dstw, index)
147
 
+#define WRITERGB16_END                 \
148
 
+    :: "r" (&c->redDither),                   \
149
 
+        "m" (dummy), "m" (dummy), "m" (dummy),\
150
 
+        "r" (dest), "m" (dstW), "m" (bF8),    \
151
 
+        "m" (bFC)                             \
152
 
+    : "%"REG_a, "%"REG_d, "%"REG_S            \
153
 
+    );
154
 
 
155
 
 #define REAL_WRITERGB15(dst, dstw, index) \
156
 
-    "pand "MANGLE(bF8)", %%mm2  \n\t" /* B */\
157
 
-    "pand "MANGLE(bF8)", %%mm4  \n\t" /* G */\
158
 
-    "pand "MANGLE(bF8)", %%mm5  \n\t" /* R */\
159
 
+    "pand            %6, %%mm2  \n\t" /* B */\
160
 
+    "pand            %6, %%mm4  \n\t" /* G */\
161
 
+    "pand            %6, %%mm5  \n\t" /* R */\
162
 
     "psrlq           $3, %%mm2  \n\t"\
163
 
     "psrlq           $1, %%mm5  \n\t"\
164
 
 \
165
 
@@ -724,6 +731,12 @@
166
 
     "cmp        "#dstw", "#index"   \n\t"\
167
 
     " jb             1b             \n\t"
168
 
 #define WRITERGB15(dst, dstw, index)  REAL_WRITERGB15(dst, dstw, index)
169
 
+#define WRITERGB15_END                 \
170
 
+    :: "r" (&c->redDither),                   \
171
 
+        "m" (dummy), "m" (dummy), "m" (dummy),\
172
 
+        "r" (dest), "m" (dstW), "m" (bF8)     \
173
 
+    : "%"REG_a, "%"REG_d, "%"REG_S            \
174
 
+    );
175
 
 
176
 
 #define WRITEBGR24OLD(dst, dstw, index) \
177
 
     /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
178
 
@@ -1063,7 +1076,7 @@
179
 
 #endif
180
 
 
181
 
                 WRITERGB15(%4, %5, %%REGa)
182
 
-                YSCALEYUV2PACKEDX_END
183
 
+                WRITERGB15_END
184
 
                 return;
185
 
             case PIX_FMT_RGB565:
186
 
                 YSCALEYUV2PACKEDX_ACCURATE
187
 
@@ -1077,7 +1090,7 @@
188
 
 #endif
189
 
 
190
 
                 WRITERGB16(%4, %5, %%REGa)
191
 
-                YSCALEYUV2PACKEDX_END
192
 
+                WRITERGB16_END
193
 
                 return;
194
 
             case PIX_FMT_YUYV422:
195
 
                 YSCALEYUV2PACKEDX_ACCURATE
196
 
@@ -1127,7 +1140,7 @@
197
 
 #endif
198
 
 
199
 
                 WRITERGB15(%4, %5, %%REGa)
200
 
-                YSCALEYUV2PACKEDX_END
201
 
+                WRITERGB15_END
202
 
                 return;
203
 
             case PIX_FMT_RGB565:
204
 
                 YSCALEYUV2PACKEDX
205
 
@@ -1141,7 +1154,7 @@
206
 
 #endif
207
 
 
208
 
                 WRITERGB16(%4, %5, %%REGa)
209
 
-                YSCALEYUV2PACKEDX_END
210
 
+                WRITERGB16_END
211
 
                 return;
212
 
             case PIX_FMT_YUYV422:
213
 
                 YSCALEYUV2PACKEDX
214
 
@@ -1238,7 +1251,7 @@
215
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
216
 
 
217
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
218
 
-                "a" (&c->redDither)
219
 
+                "a" (&c->redDither), "m" (bF8)
220
 
                 );
221
 
                 return;
222
 
             case PIX_FMT_RGB565:
223
 
@@ -1259,7 +1272,7 @@
224
 
                 "pop %%"REG_BP"                         \n\t"
225
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
226
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
227
 
-                "a" (&c->redDither)
228
 
+                "a" (&c->redDither), "m" (bF8), "m" (bFC)
229
 
                 );
230
 
                 return;
231
 
             case PIX_FMT_YUYV422:
232
 
@@ -1354,7 +1367,7 @@
233
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
234
 
 
235
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
236
 
-                "a" (&c->redDither)
237
 
+                "a" (&c->redDither), "m" (bF8)
238
 
                 );
239
 
                 return;
240
 
             case PIX_FMT_RGB565:
241
 
@@ -1376,7 +1389,7 @@
242
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
243
 
 
244
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
245
 
-                "a" (&c->redDither)
246
 
+                "a" (&c->redDither), "m" (bF8), "m" (bFC)
247
 
                 );
248
 
                 return;
249
 
             case PIX_FMT_YUYV422:
250
 
@@ -1447,7 +1460,7 @@
251
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
252
 
 
253
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
254
 
-                "a" (&c->redDither)
255
 
+                "a" (&c->redDither), "m" (bF8)
256
 
                 );
257
 
                 return;
258
 
             case PIX_FMT_RGB565:
259
 
@@ -1469,7 +1482,7 @@
260
 
                 "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
261
 
 
262
 
                 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
263
 
-                "a" (&c->redDither)
264
 
+                "a" (&c->redDither), "m" (bF8), "m" (bFC)
265
 
                 );
266
 
                 return;
267
 
             case PIX_FMT_YUYV422:
268
 
@@ -1504,7 +1517,7 @@
269
 
 {
270
 
 #if HAVE_MMX
271
 
     __asm__ volatile(
272
 
-    "movq "MANGLE(bm01010101)", %%mm2           \n\t"
273
 
+    "movq                   %3, %%mm2           \n\t"
274
 
     "mov                    %0, %%"REG_a"       \n\t"
275
 
     "1:                                         \n\t"
276
 
     "movq    (%1, %%"REG_a",2), %%mm0           \n\t"
277
 
@@ -1515,7 +1528,7 @@
278
 
     "movq                %%mm0, (%2, %%"REG_a") \n\t"
279
 
     "add                    $8, %%"REG_a"       \n\t"
280
 
     " js                    1b                  \n\t"
281
 
-    : : "g" (-width), "r" (src+width*2), "r" (dst+width)
282
 
+    : : "g" (-width), "r" (src+width*2), "r" (dst+width), "m"(bm01010101)
283
 
     : "%"REG_a
284
 
     );
285
 
 #else
286
 
@@ -1529,7 +1542,7 @@
287
 
 {
288
 
 #if HAVE_MMX
289
 
     __asm__ volatile(
290
 
-    "movq "MANGLE(bm01010101)", %%mm4           \n\t"
291
 
+    "movq                   %4, %%mm4           \n\t"
292
 
     "mov                    %0, %%"REG_a"       \n\t"
293
 
     "1:                                         \n\t"
294
 
     "movq    (%1, %%"REG_a",4), %%mm0           \n\t"
295
 
@@ -1546,7 +1559,8 @@
296
 
     "movd                %%mm1, (%2, %%"REG_a") \n\t"
297
 
     "add                    $4, %%"REG_a"       \n\t"
298
 
     " js                    1b                  \n\t"
299
 
-    : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
300
 
+    : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width),
301
 
+        "m"(bm01010101)
302
 
     : "%"REG_a
303
 
     );
304
 
 #else
305
 
@@ -1590,7 +1604,7 @@
306
 
 {
307
 
 #if HAVE_MMX
308
 
     __asm__ volatile(
309
 
-    "movq "MANGLE(bm01010101)", %%mm4           \n\t"
310
 
+    "movq                   %4, %%mm4           \n\t"
311
 
     "mov                    %0, %%"REG_a"       \n\t"
312
 
     "1:                                         \n\t"
313
 
     "movq    (%1, %%"REG_a",4), %%mm0           \n\t"
314
 
@@ -1607,7 +1621,8 @@
315
 
     "movd                %%mm1, (%2, %%"REG_a") \n\t"
316
 
     "add                    $4, %%"REG_a"       \n\t"
317
 
     " js                    1b                  \n\t"
318
 
-    : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
319
 
+    : : "g" (-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width),
320
 
+        "m"(bm01010101)
321
 
     : "%"REG_a
322
 
     );
323
 
 #else
324
 
@@ -1688,20 +1703,20 @@
325
 
 
326
 
     if(srcFormat == PIX_FMT_BGR24){
327
 
         __asm__ volatile(
328
 
-            "movq  "MANGLE(ff_bgr24toY1Coeff)", %%mm5       \n\t"
329
 
-            "movq  "MANGLE(ff_bgr24toY2Coeff)", %%mm6       \n\t"
330
 
-            :
331
 
+            "movq  %0, %%mm5       \n\t"
332
 
+            "movq  %1, %%mm6       \n\t"
333
 
+            : : "m"(ff_bgr24toY1Coeff), "m"(ff_bgr24toY2Coeff)
334
 
         );
335
 
     }else{
336
 
         __asm__ volatile(
337
 
-            "movq  "MANGLE(ff_rgb24toY1Coeff)", %%mm5       \n\t"
338
 
-            "movq  "MANGLE(ff_rgb24toY2Coeff)", %%mm6       \n\t"
339
 
-            :
340
 
+            "movq  %0, %%mm5       \n\t"
341
 
+            "movq  %1, %%mm6       \n\t"
342
 
+            : : "m"(ff_rgb24toY1Coeff), "m"(ff_rgb24toY2Coeff)
343
 
         );
344
 
     }
345
 
 
346
 
     __asm__ volatile(
347
 
-        "movq  "MANGLE(ff_bgr24toYOffset)", %%mm4   \n\t"
348
 
+        "movq                       %3, %%mm4       \n\t"
349
 
         "mov                        %2, %%"REG_a"   \n\t"
350
 
         "pxor                    %%mm7, %%mm7       \n\t"
351
 
         "1:                                         \n\t"
352
 
@@ -1731,7 +1746,7 @@
353
 
         "add                        $4, %%"REG_a"   \n\t"
354
 
         " js                        1b              \n\t"
355
 
     : "+r" (src)
356
 
-    : "r" (dst+width), "g" (-width)
357
 
+    : "r" (dst+width), "g" (-width), "m"(ff_bgr24toYOffset)
358
 
     : "%"REG_a
359
 
     );
360
 
 }
361
 
@@ -1771,7 +1786,7 @@
362
 
         "paddd                   %%mm3, %%mm1       \n\t"
363
 
         "paddd                   %%mm5, %%mm4       \n\t"
364
 
 
365
 
-        "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3       \n\t"
366
 
+        "movq                       %4, %%mm3       \n\t"
367
 
         "paddd                   %%mm3, %%mm0       \n\t"
368
 
         "paddd                   %%mm3, %%mm2       \n\t"
369
 
         "paddd                   %%mm3, %%mm1       \n\t"
370
 
@@ -1789,7 +1804,8 @@
371
 
         "add                        $4, %%"REG_a"   \n\t"
372
 
         " js                        1b              \n\t"
373
 
     : "+r" (src)
374
 
-    : "r" (dstU+width), "r" (dstV+width), "g" (-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
375
 
+    : "r" (dstU+width), "r" (dstV+width), "g" (-width),
376
 
+      "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]), "m"(ff_bgr24toUVOffset)
377
 
     : "%"REG_a
378
 
     );
379
 
 }
380
 
--- a/libswscale/yuv2rgb_template.c
381
 
+++ b/libswscale/yuv2rgb_template.c
382
 
@@ -74,7 +74,7 @@
383
 
 \
384
 
     /* convert the luma part */\
385
 
     "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
386
 
-    "pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
387
 
+    "pand    %9, %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
388
 
 \
389
 
     "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
390
 
 \
391
 
@@ -158,21 +158,63 @@
392
 
         PREFETCH" 64(%2) \n\t"                                             \
393
 
         */                                                                 \
394
 
 
395
 
-#define YUV2RGB_ENDLOOP(depth) \
396
 
+#define YUV2RGB16_ENDLOOP(depth) \
397
 
         "add $"AV_STRINGIFY(depth*8)", %1    \n\t" \
398
 
         "add                       $4, %0    \n\t" \
399
 
         " js                       1b        \n\t" \
400
 
 \
401
 
         : "+r" (index), "+r" (image) \
402
 
-        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index) \
403
 
+        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), \
404
 
+          "m"(mmx_redmask), "m"(mmx_grnmask), "m"(dummy), "m"(mmx_00ffw) \
405
 
         ); \
406
 
     } \
407
 
     __asm__ volatile (EMMS); \
408
 
     return srcSliceH; \
409
 
 
410
 
+#define YUV2RGB15_ENDLOOP(depth) \
411
 
+        "add $"AV_STRINGIFY(depth*8)", %1    \n\t" \
412
 
+        "add                       $4, %0    \n\t" \
413
 
+        " js                       1b        \n\t" \
414
 
+\
415
 
+        : "+r" (index), "+r" (image) \
416
 
+        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), \
417
 
+          "m"(mmx_redmask), "m"(dummy), "m"(dummy), "m"(mmx_00ffw) \
418
 
+        ); \
419
 
+    } \
420
 
+    __asm__ volatile (EMMS); \
421
 
+    return srcSliceH; \
422
 
+
423
 
+#define YUV2RGB24_ENDLOOP(depth) \
424
 
+        "add $"AV_STRINGIFY(depth*8)", %1    \n\t" \
425
 
+        "add                       $4, %0    \n\t" \
426
 
+        " js                       1b        \n\t" \
427
 
+\
428
 
+        : "+r" (index), "+r" (image) \
429
 
+        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), \
430
 
+          "m"(ff_M24A), "m"(ff_M24C), "m"(ff_M24B), "m"(mmx_00ffw) \
431
 
+        ); \
432
 
+    } \
433
 
+    __asm__ volatile (EMMS); \
434
 
+    return srcSliceH; \
435
 
+
436
 
+#define YUV2RGB32_ENDLOOP(depth) \
437
 
+        "add $"AV_STRINGIFY(depth*8)", %1    \n\t" \
438
 
+        "add                       $4, %0    \n\t" \
439
 
+        " js                       1b        \n\t" \
440
 
+\
441
 
+        : "+r" (index), "+r" (image) \
442
 
+        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), \
443
 
+          "m"(dummy), "m"(dummy), "m"(dummy), "m"(mmx_00ffw) \
444
 
+        ); \
445
 
+    } \
446
 
+    __asm__ volatile (EMMS); \
447
 
+    return srcSliceH; \
448
 
+
449
 
+
450
 
 static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
451
 
                                        int srcSliceH, uint8_t* dst[], int dstStride[]){
452
 
     int y, h_size;
453
 
+    long dummy=0;
454
 
 
455
 
     YUV422_UNSHIFT
456
 
     YUV2RGB_LOOP(2)
457
 
@@ -190,9 +232,9 @@
458
 
         "paddusb "RED_DITHER"(%4), %%mm1;"
459
 
 #endif
460
 
         /* mask unneeded bits off */
461
 
-        "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
462
 
-        "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
463
 
-        "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
464
 
+        "pand    %6, %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
465
 
+        "pand    %7, %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
466
 
+        "pand    %6, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
467
 
 
468
 
         "psrlw   $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
469
 
         "pxor %%mm4, %%mm4;" /* zero mm4 */
470
 
@@ -222,12 +264,13 @@
471
 
 
472
 
         MOVNTQ "   %%mm5, 8 (%1);" /* store pixel 4-7 */
473
 
 
474
 
-    YUV2RGB_ENDLOOP(2)
475
 
+    YUV2RGB16_ENDLOOP(2)
476
 
 }
477
 
 
478
 
 static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
479
 
                                        int srcSliceH, uint8_t* dst[], int dstStride[]){
480
 
     int y, h_size;
481
 
+    long dummy=0;
482
 
 
483
 
     YUV422_UNSHIFT
484
 
     YUV2RGB_LOOP(2)
485
 
@@ -246,9 +289,9 @@
486
 
 #endif
487
 
 
488
 
         /* mask unneeded bits off */
489
 
-        "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
490
 
-        "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
491
 
-        "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
492
 
+        "pand    %6, %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
493
 
+        "pand    %6, %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
494
 
+        "pand    %6, %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
495
 
 
496
 
         "psrlw   $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
497
 
         "psrlw   $1, %%mm1;" /* 0_r7r6r5  r4r3_0_0 0_r7r6r5 r4r3_0_0 */
498
 
@@ -279,12 +322,13 @@
499
 
 
500
 
         MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
501
 
 
502
 
-    YUV2RGB_ENDLOOP(2)
503
 
+    YUV2RGB15_ENDLOOP(2)
504
 
 }
505
 
 
506
 
 static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
507
 
                                        int srcSliceH, uint8_t* dst[], int dstStride[]){
508
 
     int y, h_size;
509
 
+    long dummy=0;
510
 
 
511
 
     YUV422_UNSHIFT
512
 
     YUV2RGB_LOOP(3)
513
 
@@ -293,8 +337,8 @@
514
 
         YUV2RGB
515
 
         /* mm0=B, %%mm2=G, %%mm1=R */
516
 
 #if HAVE_MMX2
517
 
-        "movq "MANGLE(ff_M24A)", %%mm4     \n\t"
518
 
-        "movq "MANGLE(ff_M24C)", %%mm7     \n\t"
519
 
+        "movq      %6, %%mm4            \n\t"
520
 
+        "movq      %7, %%mm7            \n\t"
521
 
         "pshufw $0x50, %%mm0, %%mm5     \n\t" /* B3 B2 B3 B2  B1 B0 B1 B0 */
522
 
         "pshufw $0x50, %%mm2, %%mm3     \n\t" /* G3 G2 G3 G2  G1 G0 G1 G0 */
523
 
         "pshufw $0x00, %%mm1, %%mm6     \n\t" /* R1 R0 R1 R0  R1 R0 R1 R0 */
524
 
@@ -313,7 +357,7 @@
525
 
         "pshufw $0x55, %%mm2, %%mm3     \n\t" /* G4 G3 G4 G3  G4 G3 G4 G3 */
526
 
         "pshufw $0xA5, %%mm1, %%mm6     \n\t" /* R5 R4 R5 R4  R3 R2 R3 R2 */
527
 
 
528
 
-        "pand "MANGLE(ff_M24B)", %%mm5     \n\t" /* B5       B4        B3    */
529
 
+        "pand             %8, %%mm5     \n\t" /* B5       B4        B3    */
530
 
         "pand          %%mm7, %%mm3     \n\t" /*       G4        G3       */
531
 
         "pand          %%mm4, %%mm6     \n\t" /*    R4        R3       R2 */
532
 
 
533
 
@@ -328,7 +372,7 @@
534
 
 
535
 
         "pand          %%mm7, %%mm5     \n\t" /*       B7        B6       */
536
 
         "pand          %%mm4, %%mm3     \n\t" /*    G7        G6       G5 */
537
 
-        "pand "MANGLE(ff_M24B)", %%mm6     \n\t" /* R7       R6        R5    */
538
 
+        "pand             %8, %%mm6     \n\t" /* R7       R6        R5    */
539
 
         "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
540
 
 \
541
 
         "por          %%mm5, %%mm3      \n\t"
542
 
@@ -393,7 +437,7 @@
543
 
         "pxor      %%mm4, %%mm4     \n\t"
544
 
 #endif
545
 
 
546
 
-    YUV2RGB_ENDLOOP(3)
547
 
+    YUV2RGB24_ENDLOOP(3)
548
 
 }
549
 
 
550
 
 #define RGB_PLANAR2PACKED32                                             \
551
 
@@ -440,6 +484,7 @@
552
 
 static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
553
 
                                        int srcSliceH, uint8_t* dst[], int dstStride[]){
554
 
     int y, h_size;
555
 
+    long dummy=0;
556
 
 
557
 
     YUV422_UNSHIFT
558
 
     YUV2RGB_LOOP(4)
559
 
@@ -449,5 +494,5 @@
560
 
         "pcmpeqd   %%mm3, %%mm3;"   /* fill mm3 */
561
 
         RGB_PLANAR2PACKED32
562
 
 
563
 
-    YUV2RGB_ENDLOOP(4)
564
 
+    YUV2RGB32_ENDLOOP(4)
565
 
 }
566
 
--- a/libswscale/yuv2rgb.c
567
 
+++ b/libswscale/yuv2rgb.c
568
 
@@ -47,6 +47,10 @@
569
 
 DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
570
 
 DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
571
 
 
572
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24A;
573
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24B;
574
 
+extern const uint64_t __attribute__((visibility("hidden"))) ff_M24C;
575
 
+
576
 
 //MMX versions
577
 
 #undef RENAME
578
 
 #undef HAVE_MMX2