annotate libswscale/rgb2rgb_template.c @ 19380:64f9a6ce71e1

fix segfault if an unknown property is requested
author ivo
date Sun, 13 Aug 2006 16:45:20 +0000
parents 6334c14b38eb
children 8fe37c66d10a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1 /*
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
3 * rgb2rgb.c, Software RGB to RGB convertor
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
4 * pluralize by Software PAL8 to RGB convertor
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
5 * Software YUV to YUV convertor
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
6 * Software YUV to RGB convertor
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
7 * Written by Nick Kurshev.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
8 * palette & yuv & runtime cpu stuff by Michael (michaelni@gmx.at) (under GPL)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
9 * lot of big-endian byteorder fixes by Alex Beregszaszi
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
10 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
11
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
12 #include <stddef.h>
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
13 #include <inttypes.h> /* for __WORDSIZE */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
14
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
15 #ifndef __WORDSIZE
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
16 // #warning You have misconfigured system and probably will lose performance!
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
17 #define __WORDSIZE MP_WORDSIZE
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
18 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
19
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
20 #undef PREFETCH
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
21 #undef MOVNTQ
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
22 #undef EMMS
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
23 #undef SFENCE
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
24 #undef MMREG_SIZE
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
25 #undef PREFETCHW
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
26 #undef PAVGB
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
27
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
28 #ifdef HAVE_SSE2
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
29 #define MMREG_SIZE 16
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
30 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
31 #define MMREG_SIZE 8
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
32 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
33
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
34 #ifdef HAVE_3DNOW
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
35 #define PREFETCH "prefetch"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
36 #define PREFETCHW "prefetchw"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
37 #define PAVGB "pavgusb"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
38 #elif defined ( HAVE_MMX2 )
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
39 #define PREFETCH "prefetchnta"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
40 #define PREFETCHW "prefetcht0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
41 #define PAVGB "pavgb"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
42 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
43 #ifdef __APPLE__
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
44 #define PREFETCH "#"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
45 #define PREFETCHW "#"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
46 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
47 #define PREFETCH "/nop"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
48 #define PREFETCHW "/nop"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
49 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
50 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
51
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
52 #ifdef HAVE_3DNOW
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
53 /* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
54 #define EMMS "femms"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
55 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
56 #define EMMS "emms"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
57 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
58
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
59 #ifdef HAVE_MMX2
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
60 #define MOVNTQ "movntq"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
61 #define SFENCE "sfence"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
62 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
63 #define MOVNTQ "movq"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
64 #ifdef __APPLE__
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
65 #define SFENCE "#"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
66 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
67 #define SFENCE "/nop"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
68 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
69 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
70
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
71 static inline void RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
72 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
73 uint8_t *dest = dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
74 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
75 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
76 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
77 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
78 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
79 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
80 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
81 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
82 mm_end = end - 23;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
83 __asm __volatile("movq %0, %%mm7"::"m"(mask32):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
84 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
85 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
86 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
87 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
88 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
89 "punpckldq 3%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
90 "movd 6%1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
91 "punpckldq 9%1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
92 "movd 12%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
93 "punpckldq 15%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
94 "movd 18%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
95 "punpckldq 21%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
96 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
97 "pand %%mm7, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
98 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
99 "pand %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
100 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
101 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
102 MOVNTQ" %%mm2, 16%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
103 MOVNTQ" %%mm3, 24%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
104 :"=m"(*dest)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
105 :"m"(*s)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
106 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
107 dest += 32;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
108 s += 24;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
109 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
110 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
111 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
112 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
113 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
114 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
115 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
116 /* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
117 *dest++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
118 *dest++ = s[2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
119 *dest++ = s[1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
120 *dest++ = s[0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
121 s+=3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
122 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
123 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
124 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
125 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
126 *dest++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
127 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
128 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
129 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
130
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
131 static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
132 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
133 uint8_t *dest = dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
134 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
135 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
136 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
137 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
138 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
139 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
140 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
141 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
142 mm_end = end - 31;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
143 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
144 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
145 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
146 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
147 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
148 "movq 8%1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
149 "movq 16%1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
150 "movq 24%1, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
151 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
152 "movq %%mm1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
153 "movq %%mm4, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
154 "movq %%mm5, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
155 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
156 "psrlq $8, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
157 "psrlq $8, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
158 "psrlq $8, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
159 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
160 "pand %2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
161 "pand %2, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
162 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
163 "pand %3, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
164 "pand %3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
165 "pand %3, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
166 "pand %3, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
167 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
168 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
169 "por %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
170 "por %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
171
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
172 "movq %%mm1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
173 "movq %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
174 "psllq $48, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
175 "psllq $32, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
176 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
177 "pand %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
178 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
179 "psrlq $16, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
180 "psrlq $32, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
181 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
182 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
183 "pand %6, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
184 "por %%mm5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
185
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
186 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
187 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
188 MOVNTQ" %%mm4, 16%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
189 :"=m"(*dest)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
190 :"m"(*s),"m"(mask24l),
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
191 "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
192 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
193 dest += 24;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
194 s += 32;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
195 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
196 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
197 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
198 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
199 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
200 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
201 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
202 /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
203 s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
204 dest[2] = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
205 dest[1] = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
206 dest[0] = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
207 dest += 3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
208 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
209 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
210 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
211 *dest++ = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
212 s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
213 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
214 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
215 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
216
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
217 /*
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
218 Original by Strepto/Astral
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
219 ported to gcc & bugfixed : A'rpi
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
220 MMX2, 3DNOW optimization by Nick Kurshev
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
221 32bit c version, and and&add trick by Michael Niedermayer
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
222 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
223 static inline void RENAME(rgb15to16)(const uint8_t *src,uint8_t *dst,long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
224 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
225 register const uint8_t* s=src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
226 register uint8_t* d=dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
227 register const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
228 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
229 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
230 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
231 __asm __volatile(PREFETCH" %0"::"m"(*s));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
232 __asm __volatile("movq %0, %%mm4"::"m"(mask15s));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
233 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
234 while(s<mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
235 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
236 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
237 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
238 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
239 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
240 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
241 "movq %%mm2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
242 "pand %%mm4, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
243 "pand %%mm4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
244 "paddw %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
245 "paddw %%mm3, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
246 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
247 MOVNTQ" %%mm2, 8%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
248 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
249 :"m"(*s)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
250 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
251 d+=16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
252 s+=16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
253 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
254 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
255 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
256 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
257 mm_end = end - 3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
258 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
259 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
260 register unsigned x= *((uint32_t *)s);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
261 *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
262 d+=4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
263 s+=4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
264 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
265 if(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
266 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
267 register unsigned short x= *((uint16_t *)s);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
268 *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
269 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
270 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
271
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
272 static inline void RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
273 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
274 register const uint8_t* s=src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
275 register uint8_t* d=dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
276 register const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
277 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
278 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
279 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
280 __asm __volatile(PREFETCH" %0"::"m"(*s));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
281 __asm __volatile("movq %0, %%mm7"::"m"(mask15rg));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
282 __asm __volatile("movq %0, %%mm6"::"m"(mask15b));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
283 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
284 while(s<mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
285 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
286 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
287 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
288 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
289 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
290 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
291 "movq %%mm2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
292 "psrlq $1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
293 "psrlq $1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
294 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
295 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
296 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
297 "pand %%mm6, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
298 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
299 "por %%mm3, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
300 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
301 MOVNTQ" %%mm2, 8%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
302 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
303 :"m"(*s)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
304 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
305 d+=16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
306 s+=16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
307 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
308 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
309 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
310 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
311 mm_end = end - 3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
312 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
313 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
314 register uint32_t x= *((uint32_t *)s);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
315 *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
316 s+=4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
317 d+=4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
318 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
319 if(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
320 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
321 register uint16_t x= *((uint16_t *)s);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
322 *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
323 s+=2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
324 d+=2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
325 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
326 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
327
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
328 static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
329 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
330 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
331 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
332 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
333 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
334 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
335 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
336 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
337 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
338 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
339 #if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
340 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
341 "movq %3, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
342 "movq %4, %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
343 "movq %5, %%mm7 \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
344 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
345 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
346 PREFETCH" 32(%1) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
347 "movd (%1), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
348 "movd 4(%1), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
349 "punpckldq 8(%1), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
350 "punpckldq 12(%1), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
351 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
352 "movq %%mm3, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
353 "pand %%mm6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
354 "pand %%mm6, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
355 "pmaddwd %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
356 "pmaddwd %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
357 "pand %%mm5, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
358 "pand %%mm5, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
359 "por %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
360 "por %%mm4, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
361 "psrld $5, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
362 "pslld $11, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
363 "por %%mm3, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
364 MOVNTQ" %%mm0, (%0) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
365 "add $16, %1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
366 "add $8, %0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
367 "cmp %2, %1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
368 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
369 : "+r" (d), "+r"(s)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
370 : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
371 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
372 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
373 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
374 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
375 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
376 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
377 ::"m"(red_16mask),"m"(green_16mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
378 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
379 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
380 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
381 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
382 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
383 "movd 4%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
384 "punpckldq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
385 "punpckldq 12%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
386 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
387 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
388 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
389 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
390 "psrlq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
391 "psrlq $3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
392 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
393 "pand %2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
394 "psrlq $5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
395 "psrlq $5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
396 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
397 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
398 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
399 "psrlq $8, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
400 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
401 "pand %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
402 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
403 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
404 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
405 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
406 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
407 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
408 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
409 :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
410 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
411 s += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
412 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
413 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
414 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
415 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
416 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
417 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
418 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
419 register int rgb = *(uint32_t*)s; s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
420 *d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
421 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
422 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
423
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
424 static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
425 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
426 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
427 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
428 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
429 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
430 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
431 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
432 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
433 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
434 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
435 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
436 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
437 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
438 ::"m"(red_16mask),"m"(green_16mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
439 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
440 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
441 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
442 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
443 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
444 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
445 "movd 4%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
446 "punpckldq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
447 "punpckldq 12%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
448 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
449 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
450 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
451 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
452 "psllq $8, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
453 "psllq $8, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
454 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
455 "pand %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
456 "psrlq $5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
457 "psrlq $5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
458 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
459 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
460 "psrlq $19, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
461 "psrlq $19, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
462 "pand %2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
463 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
464 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
465 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
466 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
467 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
468 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
469 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
470 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
471 :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
472 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
473 s += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
474 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
475 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
476 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
477 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
478 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
479 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
480 register int rgb = *(uint32_t*)s; s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
481 *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
482 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
483 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
484
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
485 static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
486 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
487 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
488 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
489 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
490 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
491 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
492 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
493 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
494 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
495 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
496 #if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
497 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
498 "movq %3, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
499 "movq %4, %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
500 "movq %5, %%mm7 \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
501 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
502 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
503 PREFETCH" 32(%1) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
504 "movd (%1), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
505 "movd 4(%1), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
506 "punpckldq 8(%1), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
507 "punpckldq 12(%1), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
508 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
509 "movq %%mm3, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
510 "pand %%mm6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
511 "pand %%mm6, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
512 "pmaddwd %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
513 "pmaddwd %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
514 "pand %%mm5, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
515 "pand %%mm5, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
516 "por %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
517 "por %%mm4, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
518 "psrld $6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
519 "pslld $10, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
520 "por %%mm3, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
521 MOVNTQ" %%mm0, (%0) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
522 "add $16, %1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
523 "add $8, %0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
524 "cmp %2, %1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
525 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
526 : "+r" (d), "+r"(s)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
527 : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
528 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
529 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
530 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
531 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
532 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
533 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
534 ::"m"(red_15mask),"m"(green_15mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
535 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
536 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
537 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
538 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
539 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
540 "movd 4%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
541 "punpckldq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
542 "punpckldq 12%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
543 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
544 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
545 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
546 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
547 "psrlq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
548 "psrlq $3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
549 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
550 "pand %2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
551 "psrlq $6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
552 "psrlq $6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
553 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
554 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
555 "psrlq $9, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
556 "psrlq $9, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
557 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
558 "pand %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
559 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
560 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
561 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
562 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
563 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
564 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
565 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
566 :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
567 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
568 s += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
569 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
570 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
571 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
572 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
573 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
574 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
575 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
576 register int rgb = *(uint32_t*)s; s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
577 *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
578 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
579 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
580
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
581 static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
582 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
583 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
584 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
585 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
586 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
587 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
588 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
589 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
590 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
591 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
592 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
593 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
594 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
595 ::"m"(red_15mask),"m"(green_15mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
596 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
597 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
598 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
599 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
600 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
601 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
602 "movd 4%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
603 "punpckldq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
604 "punpckldq 12%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
605 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
606 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
607 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
608 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
609 "psllq $7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
610 "psllq $7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
611 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
612 "pand %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
613 "psrlq $6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
614 "psrlq $6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
615 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
616 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
617 "psrlq $19, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
618 "psrlq $19, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
619 "pand %2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
620 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
621 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
622 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
623 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
624 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
625 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
626 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
627 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
628 :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
629 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
630 s += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
631 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
632 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
633 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
634 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
635 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
636 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
637 register int rgb = *(uint32_t*)s; s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
638 *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
639 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
640 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
641
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
642 static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
643 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
644 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
645 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
646 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
647 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
648 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
649 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
650 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
651 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
652 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
653 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
654 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
655 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
656 ::"m"(red_16mask),"m"(green_16mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
657 mm_end = end - 11;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
658 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
659 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
660 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
661 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
662 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
663 "movd 3%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
664 "punpckldq 6%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
665 "punpckldq 9%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
666 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
667 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
668 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
669 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
670 "psrlq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
671 "psrlq $3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
672 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
673 "pand %2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
674 "psrlq $5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
675 "psrlq $5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
676 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
677 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
678 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
679 "psrlq $8, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
680 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
681 "pand %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
682 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
683 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
684 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
685 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
686 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
687 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
688 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
689 :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
690 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
691 s += 12;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
692 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
693 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
694 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
695 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
696 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
697 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
698 const int b= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
699 const int g= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
700 const int r= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
701 *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
702 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
703 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
704
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
705 static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
706 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
707 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
708 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
709 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
710 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
711 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
712 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
713 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
714 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
715 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
716 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
717 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
718 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
719 ::"m"(red_16mask),"m"(green_16mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
720 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
721 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
722 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
723 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
724 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
725 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
726 "movd 3%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
727 "punpckldq 6%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
728 "punpckldq 9%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
729 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
730 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
731 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
732 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
733 "psllq $8, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
734 "psllq $8, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
735 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
736 "pand %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
737 "psrlq $5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
738 "psrlq $5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
739 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
740 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
741 "psrlq $19, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
742 "psrlq $19, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
743 "pand %2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
744 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
745 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
746 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
747 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
748 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
749 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
750 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
751 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
752 :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
753 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
754 s += 12;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
755 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
756 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
757 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
758 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
759 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
760 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
761 const int r= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
762 const int g= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
763 const int b= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
764 *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
765 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
766 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
767
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
768 static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
769 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
770 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
771 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
772 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
773 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
774 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
775 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
776 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
777 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
778 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
779 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
780 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
781 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
782 ::"m"(red_15mask),"m"(green_15mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
783 mm_end = end - 11;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
784 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
785 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
786 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
787 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
788 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
789 "movd 3%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
790 "punpckldq 6%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
791 "punpckldq 9%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
792 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
793 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
794 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
795 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
796 "psrlq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
797 "psrlq $3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
798 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
799 "pand %2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
800 "psrlq $6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
801 "psrlq $6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
802 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
803 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
804 "psrlq $9, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
805 "psrlq $9, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
806 "pand %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
807 "pand %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
808 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
809 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
810 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
811 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
812 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
813 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
814 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
815 :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
816 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
817 s += 12;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
818 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
819 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
820 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
821 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
822 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
823 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
824 const int b= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
825 const int g= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
826 const int r= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
827 *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
828 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
829 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
830
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
831 static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
832 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
833 const uint8_t *s = src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
834 const uint8_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
835 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
836 const uint8_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
837 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
838 uint16_t *d = (uint16_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
839 end = s + src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
840 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
841 __asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
842 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
843 "movq %0, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
844 "movq %1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
845 ::"m"(red_15mask),"m"(green_15mask));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
846 mm_end = end - 15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
847 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
848 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
849 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
850 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
851 "movd %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
852 "movd 3%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
853 "punpckldq 6%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
854 "punpckldq 9%1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
855 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
856 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
857 "movq %%mm3, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
858 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
859 "psllq $7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
860 "psllq $7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
861 "pand %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
862 "pand %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
863 "psrlq $6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
864 "psrlq $6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
865 "pand %%mm6, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
866 "pand %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
867 "psrlq $19, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
868 "psrlq $19, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
869 "pand %2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
870 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
871 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
872 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
873 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
874 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
875 "psllq $16, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
876 "por %%mm3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
877 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
878 :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
879 d += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
880 s += 12;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
881 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
882 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
883 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
884 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
885 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
886 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
887 const int r= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
888 const int g= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
889 const int b= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
890 *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
891 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
892 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
893
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
894 /*
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
895 I use here less accurate approximation by simply
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
896 left-shifting the input
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
897 value and filling the low order bits with
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
898 zeroes. This method improves png's
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
899 compression but this scheme cannot reproduce white exactly, since it does not
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
900 generate an all-ones maximum value; the net effect is to darken the
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
901 image slightly.
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
902
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
903 The better method should be "left bit replication":
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
904
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
905 4 3 2 1 0
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
906 ---------
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
907 1 1 0 1 1
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
908
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
909 7 6 5 4 3 2 1 0
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
910 ----------------
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
911 1 1 0 1 1 1 1 0
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
912 |=======| |===|
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
913 | Leftmost Bits Repeated to Fill Open Bits
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
914 |
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
915 Original Bits
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
916 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
917 static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
918 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
919 const uint16_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
920 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
921 const uint16_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
922 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
923 uint8_t *d = (uint8_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
924 const uint16_t *s = (uint16_t *)src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
925 end = s + src_size/2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
926 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
927 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
928 mm_end = end - 7;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
929 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
930 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
931 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
932 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
933 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
934 "movq %1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
935 "movq %1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
936 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
937 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
938 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
939 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
940 "psrlq $2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
941 "psrlq $7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
942 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
943 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
944 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
945 "punpcklwd %5, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
946 "punpcklwd %5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
947 "punpcklwd %5, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
948 "punpckhwd %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
949 "punpckhwd %5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
950 "punpckhwd %5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
951 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
952 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
953 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
954 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
955 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
956 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
957 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
958 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
959
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
960 "movq %%mm0, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
961 "movq %%mm3, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
962
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
963 "movq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
964 "movq 8%1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
965 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
966 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
967 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
968 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
969 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
970 "psrlq $2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
971 "psrlq $7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
972 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
973 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
974 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
975 "punpcklwd %5, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
976 "punpcklwd %5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
977 "punpcklwd %5, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
978 "punpckhwd %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
979 "punpckhwd %5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
980 "punpckhwd %5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
981 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
982 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
983 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
984 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
985 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
986 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
987 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
988 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
989
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
990 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
991 :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
992 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
993 /* Borrowed 32 to 24 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
994 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
995 "movq %%mm0, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
996 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
997 "movq %%mm6, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
998 "movq %%mm7, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
999
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1000 "movq %%mm4, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1001 "movq %%mm5, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1002 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1003 "movq %%mm1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1004
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1005 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1006 "psrlq $8, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1007 "psrlq $8, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1008 "psrlq $8, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1009 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1010 "pand %2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1011 "pand %2, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1012 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1013 "pand %3, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1014 "pand %3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1015 "pand %3, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1016 "pand %3, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1017 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1018 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1019 "por %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1020 "por %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1021
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1022 "movq %%mm1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1023 "movq %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1024 "psllq $48, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1025 "psllq $32, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1026 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1027 "pand %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1028 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1029 "psrlq $16, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1030 "psrlq $32, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1031 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1032 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1033 "pand %6, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1034 "por %%mm5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1035
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1036 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1037 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1038 MOVNTQ" %%mm4, 16%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1039
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1040 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1041 :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1042 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1043 d += 24;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1044 s += 8;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1045 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1046 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1047 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1048 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1049 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1050 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1051 register uint16_t bgr;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1052 bgr = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1053 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1054 *d++ = (bgr&0x3E0)>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1055 *d++ = (bgr&0x7C00)>>7;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1056 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1057 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1058
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1059 static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1060 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1061 const uint16_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1062 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1063 const uint16_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1064 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1065 uint8_t *d = (uint8_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1066 const uint16_t *s = (const uint16_t *)src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1067 end = s + src_size/2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1068 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1069 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1070 mm_end = end - 7;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1071 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1072 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1073 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1074 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1075 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1076 "movq %1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1077 "movq %1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1078 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1079 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1080 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1081 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1082 "psrlq $3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1083 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1084 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1085 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1086 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1087 "punpcklwd %5, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1088 "punpcklwd %5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1089 "punpcklwd %5, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1090 "punpckhwd %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1091 "punpckhwd %5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1092 "punpckhwd %5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1093 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1094 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1095 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1096 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1097 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1098 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1099 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1100 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1101
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1102 "movq %%mm0, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1103 "movq %%mm3, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1104
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1105 "movq 8%1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1106 "movq 8%1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1107 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1108 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1109 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1110 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1111 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1112 "psrlq $3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1113 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1114 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1115 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1116 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1117 "punpcklwd %5, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1118 "punpcklwd %5, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1119 "punpcklwd %5, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1120 "punpckhwd %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1121 "punpckhwd %5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1122 "punpckhwd %5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1123 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1124 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1125 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1126 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1127 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1128 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1129 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1130 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1131 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1132 :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1133 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1134 /* Borrowed 32 to 24 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1135 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1136 "movq %%mm0, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1137 "movq %%mm3, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1138 "movq %%mm6, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1139 "movq %%mm7, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1140
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1141 "movq %%mm4, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1142 "movq %%mm5, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1143 "movq %%mm0, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1144 "movq %%mm1, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1145
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1146 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1147 "psrlq $8, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1148 "psrlq $8, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1149 "psrlq $8, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1150 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1151 "pand %2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1152 "pand %2, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1153 "pand %2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1154 "pand %3, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1155 "pand %3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1156 "pand %3, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1157 "pand %3, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1158 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1159 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1160 "por %%mm6, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1161 "por %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1162
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1163 "movq %%mm1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1164 "movq %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1165 "psllq $48, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1166 "psllq $32, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1167 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1168 "pand %5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1169 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1170 "psrlq $16, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1171 "psrlq $32, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1172 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1173 "por %%mm3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1174 "pand %6, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1175 "por %%mm5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1176
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1177 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1178 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1179 MOVNTQ" %%mm4, 16%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1180
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1181 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1182 :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1183 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1184 d += 24;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1185 s += 8;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1186 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1187 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1188 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1189 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1190 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1191 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1192 register uint16_t bgr;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1193 bgr = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1194 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1195 *d++ = (bgr&0x7E0)>>3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1196 *d++ = (bgr&0xF800)>>8;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1197 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1198 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1199
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1200 static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1201 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1202 const uint16_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1203 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1204 const uint16_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1205 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1206 uint8_t *d = (uint8_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1207 const uint16_t *s = (const uint16_t *)src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1208 end = s + src_size/2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1209 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1210 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1211 __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1212 mm_end = end - 3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1213 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1214 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1215 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1216 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1217 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1218 "movq %1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1219 "movq %1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1220 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1221 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1222 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1223 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1224 "psrlq $2, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1225 "psrlq $7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1226 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1227 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1228 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1229 "punpcklwd %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1230 "punpcklwd %%mm7, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1231 "punpcklwd %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1232 "punpckhwd %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1233 "punpckhwd %%mm7, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1234 "punpckhwd %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1235 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1236 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1237 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1238 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1239 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1240 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1241 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1242 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1243 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1244 MOVNTQ" %%mm3, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1245 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1246 :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1247 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1248 d += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1249 s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1250 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1251 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1252 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1253 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1254 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1255 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1256 #if 0 //slightly slower on athlon
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1257 int bgr= *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1258 *((uint32_t*)d)++ = ((bgr&0x1F)<<3) + ((bgr&0x3E0)<<6) + ((bgr&0x7C00)<<9);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1259 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1260 register uint16_t bgr;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1261 bgr = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1262 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1263 *d++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1264 *d++ = (bgr&0x7C00)>>7;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1265 *d++ = (bgr&0x3E0)>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1266 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1267 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1268 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1269 *d++ = (bgr&0x3E0)>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1270 *d++ = (bgr&0x7C00)>>7;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1271 *d++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1272 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1273
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1274 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1275 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1276 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1277
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1278 static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1279 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1280 const uint16_t *end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1281 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1282 const uint16_t *mm_end;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1283 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1284 uint8_t *d = (uint8_t *)dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1285 const uint16_t *s = (uint16_t *)src;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1286 end = s + src_size/2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1287 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1288 __asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1289 __asm __volatile("pxor %%mm7,%%mm7\n\t":::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1290 mm_end = end - 3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1291 while(s < mm_end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1292 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1293 __asm __volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1294 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1295 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1296 "movq %1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1297 "movq %1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1298 "pand %2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1299 "pand %3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1300 "pand %4, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1301 "psllq $3, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1302 "psrlq $3, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1303 "psrlq $8, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1304 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1305 "movq %%mm1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1306 "movq %%mm2, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1307 "punpcklwd %%mm7, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1308 "punpcklwd %%mm7, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1309 "punpcklwd %%mm7, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1310 "punpckhwd %%mm7, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1311 "punpckhwd %%mm7, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1312 "punpckhwd %%mm7, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1313 "psllq $8, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1314 "psllq $16, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1315 "por %%mm1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1316 "por %%mm2, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1317 "psllq $8, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1318 "psllq $16, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1319 "por %%mm4, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1320 "por %%mm5, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1321 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1322 MOVNTQ" %%mm3, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1323 :"=m"(*d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1324 :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1325 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1326 d += 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1327 s += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1328 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1329 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1330 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1331 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1332 while(s < end)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1333 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1334 register uint16_t bgr;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1335 bgr = *s++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1336 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1337 *d++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1338 *d++ = (bgr&0xF800)>>8;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1339 *d++ = (bgr&0x7E0)>>3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1340 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1341 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1342 *d++ = (bgr&0x1F)<<3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1343 *d++ = (bgr&0x7E0)>>3;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1344 *d++ = (bgr&0xF800)>>8;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1345 *d++ = 0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1346 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1347 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1348 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1349
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1350 static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1351 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1352 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1353 /* TODO: unroll this loop */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1354 asm volatile (
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1355 "xor %%"REG_a", %%"REG_a" \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1356 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1357 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1358 PREFETCH" 32(%0, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1359 "movq (%0, %%"REG_a"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1360 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1361 "movq %%mm0, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1362 "pslld $16, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1363 "psrld $16, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1364 "pand "MANGLE(mask32r)", %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1365 "pand "MANGLE(mask32g)", %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1366 "pand "MANGLE(mask32b)", %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1367 "por %%mm0, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1368 "por %%mm1, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1369 MOVNTQ" %%mm2, (%1, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1370 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1371 "cmp %2, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1372 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1373 :: "r" (src), "r"(dst), "r" (src_size-7)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1374 : "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1375 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1376
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1377 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1378 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1379 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1380 unsigned i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1381 unsigned num_pixels = src_size >> 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1382 for(i=0; i<num_pixels; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1383 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1384 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1385 dst[4*i + 1] = src[4*i + 3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1386 dst[4*i + 2] = src[4*i + 2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1387 dst[4*i + 3] = src[4*i + 1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1388 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1389 dst[4*i + 0] = src[4*i + 2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1390 dst[4*i + 1] = src[4*i + 1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1391 dst[4*i + 2] = src[4*i + 0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1392 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1393 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1394 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1395 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1396
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1397 static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1398 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1399 unsigned i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1400 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1401 long mmx_size= 23 - src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1402 asm volatile (
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1403 "movq "MANGLE(mask24r)", %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1404 "movq "MANGLE(mask24g)", %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1405 "movq "MANGLE(mask24b)", %%mm7 \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1406 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1407 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1408 PREFETCH" 32(%1, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1409 "movq (%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1410 "movq (%1, %%"REG_a"), %%mm1 \n\t" // BGR BGR BG
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1411 "movq 2(%1, %%"REG_a"), %%mm2 \n\t" // R BGR BGR B
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1412 "psllq $16, %%mm0 \n\t" // 00 BGR BGR
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1413 "pand %%mm5, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1414 "pand %%mm6, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1415 "pand %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1416 "por %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1417 "por %%mm2, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1418 "movq 6(%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1419 MOVNTQ" %%mm1, (%2, %%"REG_a")\n\t" // RGB RGB RG
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1420 "movq 8(%1, %%"REG_a"), %%mm1 \n\t" // R BGR BGR B
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1421 "movq 10(%1, %%"REG_a"), %%mm2 \n\t" // GR BGR BGR
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1422 "pand %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1423 "pand %%mm5, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1424 "pand %%mm6, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1425 "por %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1426 "por %%mm2, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1427 "movq 14(%1, %%"REG_a"), %%mm0 \n\t" // R BGR BGR B
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1428 MOVNTQ" %%mm1, 8(%2, %%"REG_a")\n\t" // B RGB RGB R
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1429 "movq 16(%1, %%"REG_a"), %%mm1 \n\t" // GR BGR BGR
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1430 "movq 18(%1, %%"REG_a"), %%mm2 \n\t" // BGR BGR BG
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1431 "pand %%mm6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1432 "pand %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1433 "pand %%mm5, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1434 "por %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1435 "por %%mm2, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1436 MOVNTQ" %%mm1, 16(%2, %%"REG_a")\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1437 "add $24, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1438 " js 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1439 : "+a" (mmx_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1440 : "r" (src-mmx_size), "r"(dst-mmx_size)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1441 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1442
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1443 __asm __volatile(SFENCE:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1444 __asm __volatile(EMMS:::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1445
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1446 if(mmx_size==23) return; //finihsed, was multiple of 8
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1447
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1448 src+= src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1449 dst+= src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1450 src_size= 23-mmx_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1451 src-= src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1452 dst-= src_size;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1453 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1454 for(i=0; i<src_size; i+=3)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1455 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1456 register uint8_t x;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1457 x = src[i + 2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1458 dst[i + 1] = src[i + 1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1459 dst[i + 2] = src[i + 0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1460 dst[i + 0] = x;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1461 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1462 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1463
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1464 static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1465 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1466 long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1467 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1468 long y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1469 const long chromWidth= width>>1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1470 for(y=0; y<height; y++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1471 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1472 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1473 //FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1474 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1475 "xor %%"REG_a", %%"REG_a" \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1476 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1477 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1478 PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1479 PREFETCH" 32(%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1480 PREFETCH" 32(%3, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1481 "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1482 "movq %%mm0, %%mm2 \n\t" // U(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1483 "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1484 "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1485 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1486
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1487 "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1488 "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1489 "movq %%mm3, %%mm4 \n\t" // Y(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1490 "movq %%mm5, %%mm6 \n\t" // Y(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1491 "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1492 "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1493 "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1494 "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1495
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1496 MOVNTQ" %%mm3, (%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1497 MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1498 MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1499 MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1500
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1501 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1502 "cmp %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1503 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1504 ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1505 : "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1506 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1507 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1508
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1509 #if defined ARCH_ALPHA && defined HAVE_MVI
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1510 #define pl2yuy2(n) \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1511 y1 = yc[n]; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1512 y2 = yc2[n]; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1513 u = uc[n]; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1514 v = vc[n]; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1515 asm("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1516 asm("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1517 asm("unpkbl %1, %0" : "=r"(u) : "r"(u)); \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1518 asm("unpkbl %1, %0" : "=r"(v) : "r"(v)); \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1519 yuv1 = (u << 8) + (v << 24); \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1520 yuv2 = yuv1 + y2; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1521 yuv1 += y1; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1522 qdst[n] = yuv1; \
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1523 qdst2[n] = yuv2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1524
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1525 int i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1526 uint64_t *qdst = (uint64_t *) dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1527 uint64_t *qdst2 = (uint64_t *) (dst + dstStride);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1528 const uint32_t *yc = (uint32_t *) ysrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1529 const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1530 const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1531 for(i = 0; i < chromWidth; i += 8){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1532 uint64_t y1, y2, yuv1, yuv2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1533 uint64_t u, v;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1534 /* Prefetch */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1535 asm("ldq $31,64(%0)" :: "r"(yc));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1536 asm("ldq $31,64(%0)" :: "r"(yc2));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1537 asm("ldq $31,64(%0)" :: "r"(uc));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1538 asm("ldq $31,64(%0)" :: "r"(vc));
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1539
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1540 pl2yuy2(0);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1541 pl2yuy2(1);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1542 pl2yuy2(2);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1543 pl2yuy2(3);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1544
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1545 yc += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1546 yc2 += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1547 uc += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1548 vc += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1549 qdst += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1550 qdst2 += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1551 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1552 y++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1553 ysrc += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1554 dst += dstStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1555
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1556 #elif __WORDSIZE >= 64
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1557 int i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1558 uint64_t *ldst = (uint64_t *) dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1559 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1560 for(i = 0; i < chromWidth; i += 2){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1561 uint64_t k, l;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1562 k = yc[0] + (uc[0] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1563 (yc[1] << 16) + (vc[0] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1564 l = yc[2] + (uc[1] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1565 (yc[3] << 16) + (vc[1] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1566 *ldst++ = k + (l << 32);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1567 yc += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1568 uc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1569 vc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1570 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1571
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1572 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1573 int i, *idst = (int32_t *) dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1574 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1575 for(i = 0; i < chromWidth; i++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1576 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1577 *idst++ = (yc[0] << 24)+ (uc[0] << 16) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1578 (yc[1] << 8) + (vc[0] << 0);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1579 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1580 *idst++ = yc[0] + (uc[0] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1581 (yc[1] << 16) + (vc[0] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1582 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1583 yc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1584 uc++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1585 vc++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1586 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1587 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1588 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1589 if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1590 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1591 usrc += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1592 vsrc += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1593 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1594 ysrc += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1595 dst += dstStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1596 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1597 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1598 asm( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1599 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1600 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1601 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1602 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1603
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1604 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1605 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1606 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1607 * problem for anyone then tell me, and ill fix it)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1608 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1609 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1610 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1611 long lumStride, long chromStride, long dstStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1612 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1613 //FIXME interpolate chroma
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1614 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1615 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1616
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1617 static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1618 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1619 long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1620 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1621 long y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1622 const long chromWidth= width>>1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1623 for(y=0; y<height; y++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1624 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1625 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1626 //FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1627 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1628 "xor %%"REG_a", %%"REG_a" \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1629 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1630 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1631 PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1632 PREFETCH" 32(%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1633 PREFETCH" 32(%3, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1634 "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1635 "movq %%mm0, %%mm2 \n\t" // U(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1636 "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1637 "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1638 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1639
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1640 "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1641 "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1642 "movq %%mm0, %%mm4 \n\t" // Y(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1643 "movq %%mm2, %%mm6 \n\t" // Y(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1644 "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1645 "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1646 "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1647 "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1648
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1649 MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1650 MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1651 MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1652 MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1653
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1654 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1655 "cmp %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1656 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1657 ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1658 : "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1659 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1660 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1661 //FIXME adapt the alpha asm code from yv12->yuy2
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1662
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1663 #if __WORDSIZE >= 64
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1664 int i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1665 uint64_t *ldst = (uint64_t *) dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1666 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1667 for(i = 0; i < chromWidth; i += 2){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1668 uint64_t k, l;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1669 k = uc[0] + (yc[0] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1670 (vc[0] << 16) + (yc[1] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1671 l = uc[1] + (yc[2] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1672 (vc[1] << 16) + (yc[3] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1673 *ldst++ = k + (l << 32);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1674 yc += 4;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1675 uc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1676 vc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1677 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1678
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1679 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1680 int i, *idst = (int32_t *) dst;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1681 const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1682 for(i = 0; i < chromWidth; i++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1683 #ifdef WORDS_BIGENDIAN
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1684 *idst++ = (uc[0] << 24)+ (yc[0] << 16) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1685 (vc[0] << 8) + (yc[1] << 0);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1686 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1687 *idst++ = uc[0] + (yc[0] << 8) +
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1688 (vc[0] << 16) + (yc[1] << 24);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1689 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1690 yc += 2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1691 uc++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1692 vc++;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1693 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1694 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1695 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1696 if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1697 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1698 usrc += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1699 vsrc += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1700 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1701 ysrc += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1702 dst += dstStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1703 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1704 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1705 asm( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1706 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1707 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1708 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1709 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1710
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1711 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1712 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1713 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1714 * problem for anyone then tell me, and ill fix it)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1715 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1716 static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1717 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1718 long lumStride, long chromStride, long dstStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1719 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1720 //FIXME interpolate chroma
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1721 RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1722 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1723
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1724 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1725 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1726 * width should be a multiple of 16
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1727 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1728 static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1729 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1730 long lumStride, long chromStride, long dstStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1731 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1732 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1733 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1734
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1735 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1736 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1737 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1738 * problem for anyone then tell me, and ill fix it)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1739 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1740 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1741 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1742 long lumStride, long chromStride, long srcStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1743 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1744 long y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1745 const long chromWidth= width>>1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1746 for(y=0; y<height; y+=2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1747 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1748 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1749 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1750 "xor %%"REG_a", %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1751 "pcmpeqw %%mm7, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1752 "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1753 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1754 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1755 PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1756 "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1757 "movq 8(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1758 "movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1759 "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1760 "psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1761 "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1762 "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1763 "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1764 "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1765 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1766
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1767 MOVNTQ" %%mm2, (%1, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1768
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1769 "movq 16(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1770 "movq 24(%0, %%"REG_a", 4), %%mm2\n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1771 "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1772 "movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1773 "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1774 "psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1775 "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1776 "pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1777 "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1778 "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1779
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1780 MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1781
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1782 "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1783 "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1784 "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1785 "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1786 "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1787 "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1788 "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1789 "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1790
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1791 MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1792 MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1793
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1794 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1795 "cmp %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1796 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1797 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1798 : "memory", "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1799 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1800
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1801 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1802 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1803
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1804 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1805 "xor %%"REG_a", %%"REG_a" \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1806 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1807 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1808 PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1809 "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1810 "movq 8(%0, %%"REG_a", 4), %%mm1\n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1811 "movq 16(%0, %%"REG_a", 4), %%mm2\n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1812 "movq 24(%0, %%"REG_a", 4), %%mm3\n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1813 "pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1814 "pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1815 "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1816 "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1817 "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1818 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1819
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1820 MOVNTQ" %%mm0, (%1, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1821 MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1822
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1823 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1824 "cmp %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1825 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1826
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1827 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1828 : "memory", "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1829 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1830 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1831 long i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1832 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1833 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1834 ydst[2*i+0] = src[4*i+0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1835 udst[i] = src[4*i+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1836 ydst[2*i+1] = src[4*i+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1837 vdst[i] = src[4*i+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1838 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1839 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1840 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1841
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1842 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1843 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1844 ydst[2*i+0] = src[4*i+0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1845 ydst[2*i+1] = src[4*i+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1846 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1847 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1848 udst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1849 vdst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1850 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1851 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1852 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1853 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1854 asm volatile( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1855 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1856 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1857 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1858 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1859
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1860 static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1861 uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1862 long width, long height, long lumStride, long chromStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1863 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1864 /* Y Plane */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1865 memcpy(ydst, ysrc, width*height);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1866
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1867 /* XXX: implement upscaling for U,V */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1868 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1869
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1870 static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1871 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1872 long x,y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1873
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1874 dst[0]= src[0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1875
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1876 // first line
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1877 for(x=0; x<srcWidth-1; x++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1878 dst[2*x+1]= (3*src[x] + src[x+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1879 dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1880 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1881 dst[2*srcWidth-1]= src[srcWidth-1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1882
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1883 dst+= dstStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1884
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1885 for(y=1; y<srcHeight; y++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1886 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1887 const long mmxSize= srcWidth&~15;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1888 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1889 "mov %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1890 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1891 "movq (%0, %%"REG_a"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1892 "movq (%1, %%"REG_a"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1893 "movq 1(%0, %%"REG_a"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1894 "movq 1(%1, %%"REG_a"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1895 "movq -1(%0, %%"REG_a"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1896 "movq -1(%1, %%"REG_a"), %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1897 PAVGB" %%mm0, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1898 PAVGB" %%mm0, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1899 PAVGB" %%mm0, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1900 PAVGB" %%mm0, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1901 PAVGB" %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1902 PAVGB" %%mm1, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1903 PAVGB" %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1904 PAVGB" %%mm1, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1905 "movq %%mm5, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1906 "movq %%mm4, %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1907 "punpcklbw %%mm3, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1908 "punpckhbw %%mm3, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1909 "punpcklbw %%mm2, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1910 "punpckhbw %%mm2, %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1911 #if 1
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1912 MOVNTQ" %%mm5, (%2, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1913 MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1914 MOVNTQ" %%mm4, (%3, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1915 MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1916 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1917 "movq %%mm5, (%2, %%"REG_a", 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1918 "movq %%mm7, 8(%2, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1919 "movq %%mm4, (%3, %%"REG_a", 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1920 "movq %%mm6, 8(%3, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1921 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1922 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1923 " js 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1924 :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ),
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1925 "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2),
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1926 "g" (-mmxSize)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1927 : "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1928
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1929 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1930 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1931 const long mmxSize=1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1932 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1933 dst[0 ]= (3*src[0] + src[srcStride])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1934 dst[dstStride]= ( src[0] + 3*src[srcStride])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1935
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1936 for(x=mmxSize-1; x<srcWidth-1; x++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1937 dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1938 dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1939 dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1940 dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1941 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1942 dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1943 dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1944
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1945 dst+=dstStride*2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1946 src+=srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1947 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1948
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1949 // last line
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1950 #if 1
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1951 dst[0]= src[0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1952
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1953 for(x=0; x<srcWidth-1; x++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1954 dst[2*x+1]= (3*src[x] + src[x+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1955 dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1956 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1957 dst[2*srcWidth-1]= src[srcWidth-1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1958 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1959 for(x=0; x<srcWidth; x++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1960 dst[2*x+0]=
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1961 dst[2*x+1]= src[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1962 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1963 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1964
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1965 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1966 asm volatile( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1967 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1968 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1969 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1970 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1971
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1972 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1973 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1974 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1975 * problem for anyone then tell me, and ill fix it)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1976 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1977 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1978 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1979 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1980 long lumStride, long chromStride, long srcStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1981 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1982 long y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1983 const long chromWidth= width>>1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1984 for(y=0; y<height; y+=2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1985 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1986 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1987 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1988 "xorl %%eax, %%eax \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1989 "pcmpeqw %%mm7, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1990 "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
1991 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1992 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1993 PREFETCH" 64(%0, %%eax, 4) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1994 "movq (%0, %%eax, 4), %%mm0 \n\t" // UYVY UYVY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1995 "movq 8(%0, %%eax, 4), %%mm1 \n\t" // UYVY UYVY(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1996 "movq %%mm0, %%mm2 \n\t" // UYVY UYVY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1997 "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1998 "pand %%mm7, %%mm0 \n\t" // U0V0 U0V0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
1999 "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2000 "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2001 "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2002 "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2003 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2004
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2005 MOVNTQ" %%mm2, (%1, %%eax, 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2006
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2007 "movq 16(%0, %%eax, 4), %%mm1 \n\t" // UYVY UYVY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2008 "movq 24(%0, %%eax, 4), %%mm2 \n\t" // UYVY UYVY(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2009 "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2010 "movq %%mm2, %%mm4 \n\t" // UYVY UYVY(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2011 "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2012 "pand %%mm7, %%mm2 \n\t" // U0V0 U0V0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2013 "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2014 "psrlw $8, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2015 "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2016 "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2017
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2018 MOVNTQ" %%mm3, 8(%1, %%eax, 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2019
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2020 "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2021 "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2022 "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2023 "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2024 "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2025 "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2026 "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2027 "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2028
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2029 MOVNTQ" %%mm0, (%3, %%eax) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2030 MOVNTQ" %%mm2, (%2, %%eax) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2031
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2032 "addl $8, %%eax \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2033 "cmpl %4, %%eax \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2034 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2035 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2036 : "memory", "%eax"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2037 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2038
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2039 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2040 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2041
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2042 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2043 "xorl %%eax, %%eax \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
2044 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2045 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2046 PREFETCH" 64(%0, %%eax, 4) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2047 "movq (%0, %%eax, 4), %%mm0 \n\t" // YUYV YUYV(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2048 "movq 8(%0, %%eax, 4), %%mm1 \n\t" // YUYV YUYV(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2049 "movq 16(%0, %%eax, 4), %%mm2 \n\t" // YUYV YUYV(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2050 "movq 24(%0, %%eax, 4), %%mm3 \n\t" // YUYV YUYV(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2051 "psrlw $8, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2052 "psrlw $8, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2053 "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2054 "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2055 "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2056 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2057
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2058 MOVNTQ" %%mm0, (%1, %%eax, 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2059 MOVNTQ" %%mm2, 8(%1, %%eax, 2) \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2060
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2061 "addl $8, %%eax \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2062 "cmpl %4, %%eax \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2063 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2064
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2065 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2066 : "memory", "%eax"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2067 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2068 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2069 long i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2070 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2071 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2072 udst[i] = src[4*i+0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2073 ydst[2*i+0] = src[4*i+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2074 vdst[i] = src[4*i+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2075 ydst[2*i+1] = src[4*i+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2076 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2077 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2078 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2079
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2080 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2081 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2082 ydst[2*i+0] = src[4*i+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2083 ydst[2*i+1] = src[4*i+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2084 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2085 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2086 udst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2087 vdst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2088 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2089 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2090 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2091 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2092 asm volatile( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2093 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2094 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2095 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2096 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2097
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2098 /**
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2099 *
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2100 * height should be a multiple of 2 and width should be a multiple of 2 (if this is a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2101 * problem for anyone then tell me, and ill fix it)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2102 * chrominance data is only taken from every secound line others are ignored in the C version FIXME write HQ version
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2103 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2104 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2105 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2106 long lumStride, long chromStride, long srcStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2107 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2108 long y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2109 const long chromWidth= width>>1;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2110 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2111 for(y=0; y<height-2; y+=2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2112 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2113 long i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2114 for(i=0; i<2; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2115 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2116 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2117 "mov %2, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2118 "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2119 "movq "MANGLE(w1111)", %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2120 "pxor %%mm7, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2121 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
2122 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2123 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2124 PREFETCH" 64(%0, %%"REG_b") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2125 "movd (%0, %%"REG_b"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2126 "movd 3(%0, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2127 "punpcklbw %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2128 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2129 "movd 6(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2130 "movd 9(%0, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2131 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2132 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2133 "pmaddwd %%mm6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2134 "pmaddwd %%mm6, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2135 "pmaddwd %%mm6, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2136 "pmaddwd %%mm6, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2137 #ifndef FAST_BGR2YV12
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2138 "psrad $8, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2139 "psrad $8, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2140 "psrad $8, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2141 "psrad $8, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2142 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2143 "packssdw %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2144 "packssdw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2145 "pmaddwd %%mm5, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2146 "pmaddwd %%mm5, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2147 "packssdw %%mm2, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2148 "psraw $7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2149
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2150 "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2151 "movd 15(%0, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2152 "punpcklbw %%mm7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2153 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2154 "movd 18(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2155 "movd 21(%0, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2156 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2157 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2158 "pmaddwd %%mm6, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2159 "pmaddwd %%mm6, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2160 "pmaddwd %%mm6, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2161 "pmaddwd %%mm6, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2162 #ifndef FAST_BGR2YV12
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2163 "psrad $8, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2164 "psrad $8, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2165 "psrad $8, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2166 "psrad $8, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2167 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2168 "packssdw %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2169 "packssdw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2170 "pmaddwd %%mm5, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2171 "pmaddwd %%mm5, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2172 "add $24, %%"REG_b" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2173 "packssdw %%mm2, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2174 "psraw $7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2175
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2176 "packuswb %%mm4, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2177 "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2178
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2179 MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2180 "add $8, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2181 " js 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2182 : : "r" (src+width*3), "r" (ydst+width), "g" (-width)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2183 : "%"REG_a, "%"REG_b
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2184 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2185 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2186 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2187 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2188 src -= srcStride*2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2189 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2190 "mov %4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2191 "movq "MANGLE(w1111)", %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2192 "movq "MANGLE(bgr2UCoeff)", %%mm6 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2193 "pxor %%mm7, %%mm7 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2194 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2195 "add %%"REG_b", %%"REG_b" \n\t"
19372
6334c14b38eb Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents: 18861
diff changeset
2196 ASMALIGN(4)
18861
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2197 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2198 PREFETCH" 64(%0, %%"REG_b") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2199 PREFETCH" 64(%1, %%"REG_b") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2200 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2201 "movq (%0, %%"REG_b"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2202 "movq (%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2203 "movq 6(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2204 "movq 6(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2205 PAVGB" %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2206 PAVGB" %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2207 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2208 "movq %%mm2, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2209 "psrlq $24, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2210 "psrlq $24, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2211 PAVGB" %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2212 PAVGB" %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2213 "punpcklbw %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2214 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2215 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2216 "movd (%0, %%"REG_b"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2217 "movd (%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2218 "movd 3(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2219 "movd 3(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2220 "punpcklbw %%mm7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2221 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2222 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2223 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2224 "paddw %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2225 "paddw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2226 "paddw %%mm2, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2227 "movd 6(%0, %%"REG_b"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2228 "movd 6(%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2229 "movd 9(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2230 "movd 9(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2231 "punpcklbw %%mm7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2232 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2233 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2234 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2235 "paddw %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2236 "paddw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2237 "paddw %%mm4, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2238 "psrlw $2, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2239 "psrlw $2, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2240 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2241 "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2242 "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2243
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2244 "pmaddwd %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2245 "pmaddwd %%mm2, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2246 "pmaddwd %%mm6, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2247 "pmaddwd %%mm6, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2248 #ifndef FAST_BGR2YV12
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2249 "psrad $8, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2250 "psrad $8, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2251 "psrad $8, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2252 "psrad $8, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2253 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2254 "packssdw %%mm2, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2255 "packssdw %%mm3, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2256 "pmaddwd %%mm5, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2257 "pmaddwd %%mm5, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2258 "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2259 "psraw $7, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2260
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2261 #if defined (HAVE_MMX2) || defined (HAVE_3DNOW)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2262 "movq 12(%0, %%"REG_b"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2263 "movq 12(%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2264 "movq 18(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2265 "movq 18(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2266 PAVGB" %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2267 PAVGB" %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2268 "movq %%mm4, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2269 "movq %%mm2, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2270 "psrlq $24, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2271 "psrlq $24, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2272 PAVGB" %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2273 PAVGB" %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2274 "punpcklbw %%mm7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2275 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2276 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2277 "movd 12(%0, %%"REG_b"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2278 "movd 12(%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2279 "movd 15(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2280 "movd 15(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2281 "punpcklbw %%mm7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2282 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2283 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2284 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2285 "paddw %%mm1, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2286 "paddw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2287 "paddw %%mm2, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2288 "movd 18(%0, %%"REG_b"), %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2289 "movd 18(%1, %%"REG_b"), %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2290 "movd 21(%0, %%"REG_b"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2291 "movd 21(%1, %%"REG_b"), %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2292 "punpcklbw %%mm7, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2293 "punpcklbw %%mm7, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2294 "punpcklbw %%mm7, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2295 "punpcklbw %%mm7, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2296 "paddw %%mm1, %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2297 "paddw %%mm3, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2298 "paddw %%mm5, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2299 "movq "MANGLE(w1111)", %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2300 "psrlw $2, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2301 "psrlw $2, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2302 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2303 "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2304 "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2305
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2306 "pmaddwd %%mm4, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2307 "pmaddwd %%mm2, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2308 "pmaddwd %%mm6, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2309 "pmaddwd %%mm6, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2310 #ifndef FAST_BGR2YV12
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2311 "psrad $8, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2312 "psrad $8, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2313 "psrad $8, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2314 "psrad $8, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2315 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2316 "packssdw %%mm2, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2317 "packssdw %%mm3, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2318 "pmaddwd %%mm5, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2319 "pmaddwd %%mm5, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2320 "add $24, %%"REG_b" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2321 "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2322 "psraw $7, %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2323
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2324 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2325 "punpckldq %%mm4, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2326 "punpckhdq %%mm4, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2327 "packsswb %%mm1, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2328 "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2329 "movd %%mm0, (%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2330 "punpckhdq %%mm0, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2331 "movd %%mm0, (%3, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2332 "add $4, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2333 " js 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2334 : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2335 : "%"REG_a, "%"REG_b
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2336 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2337
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2338 udst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2339 vdst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2340 src += srcStride*2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2341 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2342
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2343 asm volatile( EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2344 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2345 :::"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2346 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2347 y=0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2348 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2349 for(; y<height; y+=2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2350 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2351 long i;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2352 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2353 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2354 unsigned int b= src[6*i+0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2355 unsigned int g= src[6*i+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2356 unsigned int r= src[6*i+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2357
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2358 unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2359 unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2360 unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2361
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2362 udst[i] = U;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2363 vdst[i] = V;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2364 ydst[2*i] = Y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2365
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2366 b= src[6*i+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2367 g= src[6*i+4];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2368 r= src[6*i+5];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2369
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2370 Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2371 ydst[2*i+1] = Y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2372 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2373 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2374 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2375
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2376 for(i=0; i<chromWidth; i++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2377 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2378 unsigned int b= src[6*i+0];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2379 unsigned int g= src[6*i+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2380 unsigned int r= src[6*i+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2381
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2382 unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2383
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2384 ydst[2*i] = Y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2385
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2386 b= src[6*i+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2387 g= src[6*i+4];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2388 r= src[6*i+5];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2389
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2390 Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2391 ydst[2*i+1] = Y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2392 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2393 udst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2394 vdst += chromStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2395 ydst += lumStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2396 src += srcStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2397 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2398 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2399
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2400 void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2401 long width, long height, long src1Stride,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2402 long src2Stride, long dstStride){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2403 long h;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2404
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2405 for(h=0; h < height; h++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2406 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2407 long w;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2408
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2409 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2410 #ifdef HAVE_SSE2
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2411 asm(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2412 "xor %%"REG_a", %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2413 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2414 PREFETCH" 64(%1, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2415 PREFETCH" 64(%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2416 "movdqa (%1, %%"REG_a"), %%xmm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2417 "movdqa (%1, %%"REG_a"), %%xmm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2418 "movdqa (%2, %%"REG_a"), %%xmm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2419 "punpcklbw %%xmm2, %%xmm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2420 "punpckhbw %%xmm2, %%xmm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2421 "movntdq %%xmm0, (%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2422 "movntdq %%xmm1, 16(%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2423 "add $16, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2424 "cmp %3, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2425 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2426 ::"r"(dest), "r"(src1), "r"(src2), "r" (width-15)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2427 : "memory", "%"REG_a""
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2428 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2429 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2430 asm(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2431 "xor %%"REG_a", %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2432 "1: \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2433 PREFETCH" 64(%1, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2434 PREFETCH" 64(%2, %%"REG_a") \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2435 "movq (%1, %%"REG_a"), %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2436 "movq 8(%1, %%"REG_a"), %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2437 "movq %%mm0, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2438 "movq %%mm2, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2439 "movq (%2, %%"REG_a"), %%mm4 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2440 "movq 8(%2, %%"REG_a"), %%mm5 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2441 "punpcklbw %%mm4, %%mm0 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2442 "punpckhbw %%mm4, %%mm1 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2443 "punpcklbw %%mm5, %%mm2 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2444 "punpckhbw %%mm5, %%mm3 \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2445 MOVNTQ" %%mm0, (%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2446 MOVNTQ" %%mm1, 8(%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2447 MOVNTQ" %%mm2, 16(%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2448 MOVNTQ" %%mm3, 24(%0, %%"REG_a", 2)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2449 "add $16, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2450 "cmp %3, %%"REG_a" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2451 " jb 1b \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2452 ::"r"(dest), "r"(src1), "r"(src2), "r" (width-15)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2453 : "memory", "%"REG_a
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2454 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2455 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2456 for(w= (width&(~15)); w < width; w++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2457 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2458 dest[2*w+0] = src1[w];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2459 dest[2*w+1] = src2[w];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2460 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2461 #else
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2462 for(w=0; w < width; w++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2463 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2464 dest[2*w+0] = src1[w];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2465 dest[2*w+1] = src2[w];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2466 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2467 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2468 dest += dstStride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2469 src1 += src1Stride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2470 src2 += src2Stride;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2471 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2472 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2473 asm(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2474 EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2475 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2476 ::: "memory"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2477 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2478 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2479 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2480
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2481 static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2482 uint8_t *dst1, uint8_t *dst2,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2483 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2484 long srcStride1, long srcStride2,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2485 long dstStride1, long dstStride2)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2486 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2487 long y,x,w,h;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2488 w=width/2; h=height/2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2489 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2490 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2491 PREFETCH" %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2492 PREFETCH" %1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2493 ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2494 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2495 for(y=0;y<h;y++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2496 const uint8_t* s1=src1+srcStride1*(y>>1);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2497 uint8_t* d=dst1+dstStride1*y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2498 x=0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2499 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2500 for(;x<w-31;x+=32)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2501 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2502 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2503 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2504 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2505 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2506 "movq 16%1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2507 "movq 24%1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2508 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2509 "movq %%mm2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2510 "movq %%mm4, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2511 "movq %%mm6, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2512 "punpcklbw %%mm0, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2513 "punpckhbw %%mm1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2514 "punpcklbw %%mm2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2515 "punpckhbw %%mm3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2516 "punpcklbw %%mm4, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2517 "punpckhbw %%mm5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2518 "punpcklbw %%mm6, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2519 "punpckhbw %%mm7, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2520 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2521 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2522 MOVNTQ" %%mm2, 16%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2523 MOVNTQ" %%mm3, 24%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2524 MOVNTQ" %%mm4, 32%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2525 MOVNTQ" %%mm5, 40%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2526 MOVNTQ" %%mm6, 48%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2527 MOVNTQ" %%mm7, 56%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2528 :"=m"(d[2*x])
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2529 :"m"(s1[x])
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2530 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2531 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2532 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2533 for(;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2534 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2535 for(y=0;y<h;y++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2536 const uint8_t* s2=src2+srcStride2*(y>>1);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2537 uint8_t* d=dst2+dstStride2*y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2538 x=0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2539 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2540 for(;x<w-31;x+=32)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2541 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2542 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2543 PREFETCH" 32%1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2544 "movq %1, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2545 "movq 8%1, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2546 "movq 16%1, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2547 "movq 24%1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2548 "movq %%mm0, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2549 "movq %%mm2, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2550 "movq %%mm4, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2551 "movq %%mm6, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2552 "punpcklbw %%mm0, %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2553 "punpckhbw %%mm1, %%mm1\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2554 "punpcklbw %%mm2, %%mm2\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2555 "punpckhbw %%mm3, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2556 "punpcklbw %%mm4, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2557 "punpckhbw %%mm5, %%mm5\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2558 "punpcklbw %%mm6, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2559 "punpckhbw %%mm7, %%mm7\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2560 MOVNTQ" %%mm0, %0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2561 MOVNTQ" %%mm1, 8%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2562 MOVNTQ" %%mm2, 16%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2563 MOVNTQ" %%mm3, 24%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2564 MOVNTQ" %%mm4, 32%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2565 MOVNTQ" %%mm5, 40%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2566 MOVNTQ" %%mm6, 48%0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2567 MOVNTQ" %%mm7, 56%0"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2568 :"=m"(d[2*x])
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2569 :"m"(s2[x])
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2570 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2571 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2572 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2573 for(;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2574 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2575 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2576 asm(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2577 EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2578 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2579 ::: "memory"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2580 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2581 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2582 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2583
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2584 static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2585 uint8_t *dst,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2586 long width, long height,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2587 long srcStride1, long srcStride2,
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2588 long srcStride3, long dstStride)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2589 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2590 long y,x,w,h;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2591 w=width/2; h=height;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2592 for(y=0;y<h;y++){
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2593 const uint8_t* yp=src1+srcStride1*y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2594 const uint8_t* up=src2+srcStride2*(y>>2);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2595 const uint8_t* vp=src3+srcStride3*(y>>2);
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2596 uint8_t* d=dst+dstStride*y;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2597 x=0;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2598 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2599 for(;x<w-7;x+=8)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2600 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2601 asm volatile(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2602 PREFETCH" 32(%1, %0)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2603 PREFETCH" 32(%2, %0)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2604 PREFETCH" 32(%3, %0)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2605 "movq (%1, %0, 4), %%mm0\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2606 "movq (%2, %0), %%mm1\n\t" /* U0U1U2U3U4U5U6U7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2607 "movq (%3, %0), %%mm2\n\t" /* V0V1V2V3V4V5V6V7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2608 "movq %%mm0, %%mm3\n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2609 "movq %%mm1, %%mm4\n\t" /* U0U1U2U3U4U5U6U7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2610 "movq %%mm2, %%mm5\n\t" /* V0V1V2V3V4V5V6V7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2611 "punpcklbw %%mm1, %%mm1\n\t" /* U0U0 U1U1 U2U2 U3U3 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2612 "punpcklbw %%mm2, %%mm2\n\t" /* V0V0 V1V1 V2V2 V3V3 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2613 "punpckhbw %%mm4, %%mm4\n\t" /* U4U4 U5U5 U6U6 U7U7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2614 "punpckhbw %%mm5, %%mm5\n\t" /* V4V4 V5V5 V6V6 V7V7 */
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2615
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2616 "movq %%mm1, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2617 "punpcklbw %%mm2, %%mm1\n\t" /* U0V0 U0V0 U1V1 U1V1*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2618 "punpcklbw %%mm1, %%mm0\n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2619 "punpckhbw %%mm1, %%mm3\n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2620 MOVNTQ" %%mm0, (%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2621 MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2622
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2623 "punpckhbw %%mm2, %%mm6\n\t" /* U2V2 U2V2 U3V3 U3V3*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2624 "movq 8(%1, %0, 4), %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2625 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2626 "punpcklbw %%mm6, %%mm0\n\t" /* Y U2 Y V2 Y U2 Y V2*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2627 "punpckhbw %%mm6, %%mm3\n\t" /* Y U3 Y V3 Y U3 Y V3*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2628 MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2629 MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2630
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2631 "movq %%mm4, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2632 "movq 16(%1, %0, 4), %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2633 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2634 "punpcklbw %%mm5, %%mm4\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2635 "punpcklbw %%mm4, %%mm0\n\t" /* Y U4 Y V4 Y U4 Y V4*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2636 "punpckhbw %%mm4, %%mm3\n\t" /* Y U5 Y V5 Y U5 Y V5*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2637 MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2638 MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2639
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2640 "punpckhbw %%mm5, %%mm6\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2641 "movq 24(%1, %0, 4), %%mm0\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2642 "movq %%mm0, %%mm3\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2643 "punpcklbw %%mm6, %%mm0\n\t" /* Y U6 Y V6 Y U6 Y V6*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2644 "punpckhbw %%mm6, %%mm3\n\t" /* Y U7 Y V7 Y U7 Y V7*/
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2645 MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2646 MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2647
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2648 : "+r" (x)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2649 : "r"(yp), "r" (up), "r"(vp), "r"(d)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2650 :"memory");
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2651 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2652 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2653 for(; x<w; x++)
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2654 {
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2655 const long x2= x<<2;
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2656 d[8*x+0]=yp[x2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2657 d[8*x+1]=up[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2658 d[8*x+2]=yp[x2+1];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2659 d[8*x+3]=vp[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2660 d[8*x+4]=yp[x2+2];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2661 d[8*x+5]=up[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2662 d[8*x+6]=yp[x2+3];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2663 d[8*x+7]=vp[x];
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2664 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2665 }
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2666 #ifdef HAVE_MMX
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2667 asm(
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2668 EMMS" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2669 SFENCE" \n\t"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2670 ::: "memory"
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2671 );
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2672 #endif
8579acff875e Move postproc ---> libswscale
lucabe
parents:
diff changeset
2673 }