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