]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/ffmpeg-macosx-intel-mmx.patch
Fix the ffmpeg-mmx-patch. Thanks to David E. Still
[vlc] / extras / contrib / src / Patches / ffmpeg-macosx-intel-mmx.patch
1 Index: libavcodec/i386/motion_est_mmx.c
2 ===================================================================
3 --- libavcodec/i386/motion_est_mmx.c    (revision 11270)
4 +++ libavcodec/i386/motion_est_mmx.c    (working copy)
5 @@ -167,7 +167,7 @@
6  static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
7  {
8      asm volatile(
9 -        "movq "MANGLE(bone)", %%mm5     \n\t"
10 +        "movq %4, %%mm5     \n\t"
11          "movq (%1), %%mm0               \n\t"
12          "pavgb 1(%1), %%mm0             \n\t"
13          "add %3, %1                     \n\t"
14 @@ -190,7 +190,7 @@
15          "sub $2, %0                     \n\t"
16          " jg 1b                         \n\t"
17          : "+r" (h), "+r" (blk1), "+r" (blk2)
18 -        : "r" ((x86_reg)stride)
19 +        : "r" ((x86_reg)stride), "m" (bone)
20      );
21  }
22  
23 @@ -258,7 +258,7 @@
24          "punpckhbw %%mm7, %%mm5         \n\t"
25          "paddw %%mm4, %%mm2             \n\t"
26          "paddw %%mm5, %%mm3             \n\t"
27 -        "movq 16+"MANGLE(round_tab)", %%mm5 \n\t"
28 +        "movq 16+%5, %%mm5 \n\t"
29          "paddw %%mm2, %%mm0             \n\t"
30          "paddw %%mm3, %%mm1             \n\t"
31          "paddw %%mm5, %%mm0             \n\t"
32 @@ -281,7 +281,7 @@
33          "add %4, %%"REG_a"              \n\t"
34          " js 1b                         \n\t"
35          : "+a" (len)
36 -        : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((x86_reg)stride)
37 +        : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((x86_reg)stride), "m" (round_tab[0])
38      );
39  }
40   
41 Index: libavcodec/i386/simple_idct_mmx.c
42 ===================================================================
43 --- libavcodec/i386/simple_idct_mmx.c   (revision 11270)
44 +++ libavcodec/i386/simple_idct_mmx.c   (working copy)
45 @@ -363,7 +363,7 @@
46          "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
47          "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
48          "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
49 -        "movq "MANGLE(wm1010)", %%mm4   \n\t"\
50 +        "movq %3, %%mm4                 \n\t"\
51          "pand %%mm0, %%mm4              \n\t"\
52          "por %%mm1, %%mm4               \n\t"\
53          "por %%mm2, %%mm4               \n\t"\
54 @@ -437,7 +437,7 @@
55          "jmp 2f                         \n\t"\
56          "1:                             \n\t"\
57          "pslld $16, %%mm0               \n\t"\
58 -        "#paddd "MANGLE(d40000)", %%mm0 \n\t"\
59 +        "#paddd %4, %%mm0               \n\t"\
60          "psrad $13, %%mm0               \n\t"\
61          "packssdw %%mm0, %%mm0          \n\t"\
62          "movq %%mm0, " #dst "           \n\t"\
63 @@ -471,7 +471,7 @@
64          "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
65          "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
66          "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
67 -        "movq "MANGLE(wm1010)", %%mm4   \n\t"\
68 +        "movq %3, %%mm4                 \n\t"\
69          "pand %%mm0, %%mm4              \n\t"\
70          "por %%mm1, %%mm4               \n\t"\
71          "por %%mm2, %%mm4               \n\t"\
72 @@ -545,7 +545,7 @@
73          "jmp 2f                         \n\t"\
74          "1:                             \n\t"\
75          "pslld $16, %%mm0               \n\t"\
76 -        "paddd "MANGLE(d40000)", %%mm0  \n\t"\
77 +        "paddd %4, %%mm0                \n\t"\
78          "psrad $13, %%mm0               \n\t"\
79          "packssdw %%mm0, %%mm0          \n\t"\
80          "movq %%mm0, " #dst "           \n\t"\
81 @@ -1270,7 +1270,7 @@
82  */
83  
84  "9: \n\t"
85 -                :: "r" (block), "r" (temp), "r" (coeffs)
86 +                :: "r" (block), "r" (temp), "r" (coeffs), "m" (wm1010), "m"(d40000)
87                  : "%eax"
88          );
89  }
90 Index: libavcodec/i386/cavsdsp_mmx.c
91 ===================================================================
92 --- libavcodec/i386/cavsdsp_mmx.c       (revision 13752)
93 +++ libavcodec/i386/cavsdsp_mmx.c       (working copy)
94 @@ -25,8 +25,30 @@
95  #include "libavutil/common.h"
96  #include "libavutil/x86_cpu.h"
97  #include "libavcodec/dsputil.h"
98 -#include "dsputil_mmx.h"
99  
100 +#define SUMSUB_BA( a, b ) \
101 +"paddw "#b", "#a" \n\t"\
102 +"paddw "#b", "#b" \n\t"\
103 +"psubw "#a", "#b" \n\t"
104 +
105 +#define SBUTTERFLY(a,b,t,n,m)\
106 +"mov" #m " " #a ", " #t "         \n\t" /* abcd */\
107 +"punpckl" #n " " #b ", " #a "     \n\t" /* aebf */\
108 +"punpckh" #n " " #b ", " #t "     \n\t" /* cgdh */\
109 +
110 +#define TRANSPOSE4(a,b,c,d,t)\
111 +SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
112 +SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
113 +SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
114 +SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
115 +
116 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_4 ) = 0x0004000400040004ULL;      
117 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_5 ) = 0x0005000500050005ULL;      
118 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_7 ) = 0x0007000700070007ULL;      
119 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_42) = 0x002A002A002A002AULL;      
120 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_64) = 0x0040004000400040ULL;      
121 +DECLARE_ALIGNED_8(static const uint64_t,ff_pw_96) = 0x0060006000600060ULL;
122 +
123  /*****************************************************************************
124   *
125   * inverse transform
126 Index: libavcodec/i386/flacdsp_mmx.c
127 ===================================================================
128 --- libavcodec/i386/flacdsp_mmx.c       (revision 11888)
129 +++ libavcodec/i386/flacdsp_mmx.c       (working copy)
130 @@ -26,7 +26,6 @@
131      double c = 2.0 / (len-1.0);
132      int n2 = len>>1;
133      x86_reg i = -n2*sizeof(int32_t);
134 -    x86_reg j =  n2*sizeof(int32_t);
135      asm volatile(
136          "movsd   %0,     %%xmm7 \n\t"
137          "movapd  %1,     %%xmm6 \n\t"
138 @@ -54,7 +53,7 @@
139          "sub      $8,      %1                  \n\t"\
140          "add      $8,      %0                  \n\t"\
141          "jl 1b                                 \n\t"\
142 -        :"+&r"(i), "+&r"(j)\
143 +        :"+&r"(i)\
144          :"r"(w_data+n2), "r"(data+n2)\
145      );
146      if(len&1)
147 @@ -84,6 +83,8 @@
148                  "movsd    "MANGLE(ff_pd_1)", %%xmm0 \n\t"
149                  "movsd    "MANGLE(ff_pd_1)", %%xmm1 \n\t"
150                  "movsd    "MANGLE(ff_pd_1)", %%xmm2 \n\t"
151 +                :: "m"(*ff_pd_1) );
152 +            asm volatile(
153                  "1:                                 \n\t"
154                  "movapd   (%4,%0), %%xmm3           \n\t"
155                  "movupd -8(%5,%0), %%xmm4           \n\t"
156 @@ -115,6 +116,8 @@
157              asm volatile(
158                  "movsd    "MANGLE(ff_pd_1)", %%xmm0 \n\t"
159                  "movsd    "MANGLE(ff_pd_1)", %%xmm1 \n\t"
160 +                :: "m"(*ff_pd_1) );
161 +            asm volatile(
162                  "1:                                 \n\t"
163                  "movapd   (%3,%0), %%xmm3           \n\t"
164                  "movupd -8(%4,%0), %%xmm4           \n\t"