Mercurial > mplayer.hg
annotate libswscale/rgb2rgb_template.c @ 28816:6e5b9867646c
sync w/r28807
author | gpoirier |
---|---|
date | Fri, 06 Mar 2009 15:52:48 +0000 |
parents | 8a0785c19f48 |
children | e538af2c69c1 |
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; |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
86 __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"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" |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
99 "por %%mm7, %%mm0 \n\t" |
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
100 "por %%mm7, %%mm1 \n\t" |
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
101 "por %%mm7, %%mm2 \n\t" |
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
102 "por %%mm7, %%mm3 \n\t" |
23140
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) */ |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
120 *dest++ = 255; |
23140
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++; |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
129 *dest++ = 255; |
23140
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 | |
28773
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1205 /* |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1206 * mm0 = 00 B3 00 B2 00 B1 00 B0 |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1207 * mm1 = 00 G3 00 G2 00 G1 00 G0 |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1208 * mm2 = 00 R3 00 R2 00 R1 00 R0 |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1209 * mm6 = FF FF FF FF FF FF FF FF |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1210 * mm7 = 00 00 00 00 00 00 00 00 |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1211 */ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1212 #define PACK_RGB32 \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1213 "packuswb %%mm7, %%mm0 \n\t" /* 00 00 00 00 B3 B2 B1 B0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1214 "packuswb %%mm7, %%mm1 \n\t" /* 00 00 00 00 G3 G2 G1 G0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1215 "packuswb %%mm7, %%mm2 \n\t" /* 00 00 00 00 R3 R2 R1 R0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1216 "punpcklbw %%mm1, %%mm0 \n\t" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1217 "punpcklbw %%mm6, %%mm2 \n\t" /* FF R3 FF R2 FF R1 FF R0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1218 "movq %%mm0, %%mm3 \n\t" \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1219 "punpcklwd %%mm2, %%mm0 \n\t" /* FF R1 G1 B1 FF R0 G0 B0 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1220 "punpckhwd %%mm2, %%mm3 \n\t" /* FF R3 G3 B3 FF R2 G2 B2 */ \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1221 MOVNTQ" %%mm0, %0 \n\t" \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1222 MOVNTQ" %%mm3, 8%0 \n\t" \ |
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1223 |
18861 | 1224 static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size) |
1225 { | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1226 const uint16_t *end; |
28276 | 1227 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1228 const uint16_t *mm_end; |
18861 | 1229 #endif |
26909 | 1230 uint8_t *d = dst; |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1231 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
|
1232 end = s + src_size/2; |
28276 | 1233 #if HAVE_MMX |
27744 | 1234 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
1235 __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); | |
28773
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1236 __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory"); |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1237 mm_end = end - 3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1238 while (s < mm_end) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1239 { |
27744 | 1240 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1241 PREFETCH" 32%1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1242 "movq %1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1243 "movq %1, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1244 "movq %1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1245 "pand %2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1246 "pand %3, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1247 "pand %4, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1248 "psllq $3, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1249 "psrlq $2, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1250 "psrlq $7, %%mm2 \n\t" |
28773
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1251 PACK_RGB32 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1252 :"=m"(*d) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1253 :"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
|
1254 :"memory"); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1255 d += 16; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1256 s += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1257 } |
27744 | 1258 __asm__ volatile(SFENCE:::"memory"); |
1259 __asm__ volatile(EMMS:::"memory"); | |
18861 | 1260 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1261 while (s < end) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1262 { |
25109 | 1263 #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
|
1264 int bgr= *s++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1265 *((uint32_t*)d)++ = ((bgr&0x1F)<<3) + ((bgr&0x3E0)<<6) + ((bgr&0x7C00)<<9); |
18861 | 1266 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1267 register uint16_t bgr; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1268 bgr = *s++; |
18861 | 1269 #ifdef WORDS_BIGENDIAN |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
1270 *d++ = 255; |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1271 *d++ = (bgr&0x7C00)>>7; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1272 *d++ = (bgr&0x3E0)>>2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1273 *d++ = (bgr&0x1F)<<3; |
18861 | 1274 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1275 *d++ = (bgr&0x1F)<<3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1276 *d++ = (bgr&0x3E0)>>2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1277 *d++ = (bgr&0x7C00)>>7; |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
1278 *d++ = 255; |
18861 | 1279 #endif |
1280 | |
1281 #endif | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1282 } |
18861 | 1283 } |
1284 | |
1285 static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size) | |
1286 { | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1287 const uint16_t *end; |
28276 | 1288 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1289 const uint16_t *mm_end; |
18861 | 1290 #endif |
26909 | 1291 uint8_t *d = dst; |
26910 | 1292 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
|
1293 end = s + src_size/2; |
28276 | 1294 #if HAVE_MMX |
27744 | 1295 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); |
1296 __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); | |
28773
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1297 __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory"); |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1298 mm_end = end - 3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1299 while (s < mm_end) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1300 { |
27744 | 1301 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1302 PREFETCH" 32%1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1303 "movq %1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1304 "movq %1, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1305 "movq %1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1306 "pand %2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1307 "pand %3, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1308 "pand %4, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1309 "psllq $3, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1310 "psrlq $3, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1311 "psrlq $8, %%mm2 \n\t" |
28773
8a0785c19f48
Rewrite of rgb15to32 and rgb16to32 using fewer asm instructions
sdrik
parents:
28721
diff
changeset
|
1312 PACK_RGB32 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1313 :"=m"(*d) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1314 :"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
|
1315 :"memory"); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1316 d += 16; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1317 s += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1318 } |
27744 | 1319 __asm__ volatile(SFENCE:::"memory"); |
1320 __asm__ volatile(EMMS:::"memory"); | |
18861 | 1321 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1322 while (s < end) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1323 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1324 register uint16_t bgr; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1325 bgr = *s++; |
18861 | 1326 #ifdef WORDS_BIGENDIAN |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
1327 *d++ = 255; |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1328 *d++ = (bgr&0xF800)>>8; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1329 *d++ = (bgr&0x7E0)>>3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1330 *d++ = (bgr&0x1F)<<3; |
18861 | 1331 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1332 *d++ = (bgr&0x1F)<<3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1333 *d++ = (bgr&0x7E0)>>3; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1334 *d++ = (bgr&0xF800)>>8; |
28721
267dd38c800e
When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes
sdrik
parents:
28323
diff
changeset
|
1335 *d++ = 255; |
18861 | 1336 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1337 } |
18861 | 1338 } |
1339 | |
1340 static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size) | |
1341 { | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1342 long idx = 15 - src_size; |
26910 | 1343 const uint8_t *s = src-idx; |
1344 uint8_t *d = dst-idx; | |
28276 | 1345 #if HAVE_MMX |
27744 | 1346 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1347 "test %0, %0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1348 "jns 2f \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1349 PREFETCH" (%1, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1350 "movq %3, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1351 "pxor %4, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1352 "movq %%mm7, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1353 "pxor %5, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1354 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1355 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1356 PREFETCH" 32(%1, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1357 "movq (%1, %0), %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1358 "movq 8(%1, %0), %%mm1 \n\t" |
28276 | 1359 # if HAVE_MMX2 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1360 "pshufw $177, %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1361 "pshufw $177, %%mm1, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1362 "pand %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1363 "pand %%mm6, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1364 "pand %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1365 "pand %%mm6, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1366 "por %%mm3, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1367 "por %%mm5, %%mm1 \n\t" |
22991 | 1368 # else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1369 "movq %%mm0, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1370 "movq %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1371 "pand %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1372 "pand %%mm6, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1373 "pand %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1374 "pand %%mm6, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1375 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1376 "movq %%mm4, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1377 "pslld $16, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1378 "psrld $16, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1379 "pslld $16, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1380 "psrld $16, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1381 "por %%mm2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1382 "por %%mm4, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1383 "por %%mm3, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1384 "por %%mm5, %%mm1 \n\t" |
22991 | 1385 # endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1386 MOVNTQ" %%mm0, (%2, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1387 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
|
1388 "add $16, %0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1389 "js 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1390 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1391 EMMS" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1392 "2: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1393 : "+&r"(idx) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1394 : "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
|
1395 : "memory"); |
18861 | 1396 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1397 for (; idx<15; idx+=4) { |
26910 | 1398 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
|
1399 v &= 0xff00ff; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1400 *(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
|
1401 } |
18861 | 1402 } |
1403 | |
1404 static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) | |
1405 { | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1406 unsigned i; |
28276 | 1407 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1408 long mmx_size= 23 - src_size; |
27744 | 1409 __asm__ volatile ( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1410 "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
|
1411 "jns 2f \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1412 "movq "MANGLE(mask24r)", %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1413 "movq "MANGLE(mask24g)", %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1414 "movq "MANGLE(mask24b)", %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1415 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1416 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1417 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
|
1418 "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
|
1419 "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
|
1420 "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
|
1421 "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
|
1422 "pand %%mm5, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1423 "pand %%mm6, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1424 "pand %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1425 "por %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1426 "por %%mm2, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1427 "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
|
1428 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
|
1429 "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
|
1430 "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
|
1431 "pand %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1432 "pand %%mm5, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1433 "pand %%mm6, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1434 "por %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1435 "por %%mm2, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1436 "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
|
1437 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
|
1438 "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
|
1439 "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
|
1440 "pand %%mm6, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1441 "pand %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1442 "pand %%mm5, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1443 "por %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1444 "por %%mm2, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1445 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
|
1446 "add $24, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1447 " js 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1448 "2: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1449 : "+a" (mmx_size) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1450 : "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
|
1451 ); |
18861 | 1452 |
27744 | 1453 __asm__ volatile(SFENCE:::"memory"); |
1454 __asm__ volatile(EMMS:::"memory"); | |
18861 | 1455 |
27158 | 1456 if (mmx_size==23) return; //finished, was multiple of 8 |
18861 | 1457 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1458 src+= src_size; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1459 dst+= src_size; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1460 src_size= 23-mmx_size; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1461 src-= src_size; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1462 dst-= src_size; |
18861 | 1463 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1464 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
|
1465 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1466 register uint8_t x; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1467 x = src[i + 2]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1468 dst[i + 1] = src[i + 1]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1469 dst[i + 2] = src[i + 0]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1470 dst[i + 0] = x; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1471 } |
18861 | 1472 } |
1473 | |
1474 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
|
1475 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1476 long lumStride, long chromStride, long dstStride, long vertLumPerChroma) |
18861 | 1477 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1478 long y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1479 const long chromWidth= width>>1; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1480 for (y=0; y<height; y++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1481 { |
28276 | 1482 #if HAVE_MMX |
25109 | 1483 //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) |
27744 | 1484 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1485 "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
|
1486 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1487 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1488 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
|
1489 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
|
1490 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
|
1491 "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
|
1492 "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
|
1493 "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
|
1494 "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
|
1495 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8) |
18861 | 1496 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1497 "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
|
1498 "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
|
1499 "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
|
1500 "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
|
1501 "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
|
1502 "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
|
1503 "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
|
1504 "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12) |
18861 | 1505 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1506 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
|
1507 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
|
1508 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
|
1509 MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" |
18861 | 1510 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1511 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1512 "cmp %4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1513 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1514 ::"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
|
1515 : "%"REG_a |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1516 ); |
18861 | 1517 #else |
1518 | |
28276 | 1519 #if ARCH_ALPHA && HAVE_MVI |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1520 #define pl2yuy2(n) \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1521 y1 = yc[n]; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1522 y2 = yc2[n]; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1523 u = uc[n]; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1524 v = vc[n]; \ |
27744 | 1525 __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \ |
1526 __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \ | |
1527 __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u)); \ | |
1528 __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
|
1529 yuv1 = (u << 8) + (v << 24); \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1530 yuv2 = yuv1 + y2; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1531 yuv1 += y1; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1532 qdst[n] = yuv1; \ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1533 qdst2[n] = yuv2; |
18861 | 1534 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1535 int i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1536 uint64_t *qdst = (uint64_t *) dst; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1537 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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 uint64_t y1, y2, yuv1, yuv2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1543 uint64_t u, v; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1544 /* Prefetch */ |
27744 | 1545 __asm__("ldq $31,64(%0)" :: "r"(yc)); |
1546 __asm__("ldq $31,64(%0)" :: "r"(yc2)); | |
1547 __asm__("ldq $31,64(%0)" :: "r"(uc)); | |
1548 __asm__("ldq $31,64(%0)" :: "r"(vc)); | |
18861 | 1549 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1550 pl2yuy2(0); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1551 pl2yuy2(1); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1552 pl2yuy2(2); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1553 pl2yuy2(3); |
18861 | 1554 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1555 yc += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1556 yc2 += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1557 uc += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1558 vc += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1559 qdst += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1560 qdst2 += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1561 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1562 y++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1563 ysrc += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1564 dst += dstStride; |
18861 | 1565 |
27688
49d5420c5698
Use HAVE_FAST_64BIT instead of nonstandard __WORDSIZE macro.
diego
parents:
27666
diff
changeset
|
1566 #elif HAVE_FAST_64BIT |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1567 int i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1568 uint64_t *ldst = (uint64_t *) dst; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1569 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
|
1570 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
|
1571 uint64_t k, l; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1572 k = yc[0] + (uc[0] << 8) + |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1573 (yc[1] << 16) + (vc[0] << 24); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1574 l = yc[2] + (uc[1] << 8) + |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1575 (yc[3] << 16) + (vc[1] << 24); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1576 *ldst++ = k + (l << 32); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1577 yc += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1578 uc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1579 vc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1580 } |
18861 | 1581 |
1582 #else | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1583 int i, *idst = (int32_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++){ |
18861 | 1586 #ifdef WORDS_BIGENDIAN |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1587 *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
|
1588 (yc[1] << 8) + (vc[0] << 0); |
18861 | 1589 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1590 *idst++ = yc[0] + (uc[0] << 8) + |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1591 (yc[1] << 16) + (vc[0] << 24); |
18861 | 1592 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1593 yc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1594 uc++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1595 vc++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1596 } |
18861 | 1597 #endif |
1598 #endif | |
25751 | 1599 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
|
1600 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1601 usrc += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1602 vsrc += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1603 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1604 ysrc += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1605 dst += dstStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1606 } |
28276 | 1607 #if HAVE_MMX |
27744 | 1608 __asm__( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1609 SFENCE" \n\t" |
18861 | 1610 :::"memory"); |
1611 #endif | |
1612 } | |
1613 | |
1614 /** | |
27158 | 1615 * Height should be a multiple of 2 and width should be a multiple of 16. |
1616 * (If this is a problem for anyone then tell me, and I will fix it.) | |
18861 | 1617 */ |
1618 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
|
1619 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1620 long lumStride, long chromStride, long dstStride) |
18861 | 1621 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1622 //FIXME interpolate chroma |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1623 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); |
18861 | 1624 } |
1625 | |
1626 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
|
1627 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1628 long lumStride, long chromStride, long dstStride, long vertLumPerChroma) |
18861 | 1629 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1630 long y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1631 const long chromWidth= width>>1; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1632 for (y=0; y<height; y++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1633 { |
28276 | 1634 #if HAVE_MMX |
25109 | 1635 //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) |
27744 | 1636 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1637 "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
|
1638 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1639 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1640 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
|
1641 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
|
1642 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
|
1643 "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
|
1644 "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
|
1645 "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
|
1646 "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
|
1647 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8) |
18861 | 1648 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1649 "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
|
1650 "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
|
1651 "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
|
1652 "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
|
1653 "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
|
1654 "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
|
1655 "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
|
1656 "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12) |
18861 | 1657 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1658 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
|
1659 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
|
1660 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
|
1661 MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" |
18861 | 1662 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1663 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1664 "cmp %4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1665 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1666 ::"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
|
1667 : "%"REG_a |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1668 ); |
18861 | 1669 #else |
25109 | 1670 //FIXME adapt the Alpha ASM code from yv12->yuy2 |
18861 | 1671 |
27688
49d5420c5698
Use HAVE_FAST_64BIT instead of nonstandard __WORDSIZE macro.
diego
parents:
27666
diff
changeset
|
1672 #if HAVE_FAST_64BIT |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1673 int i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1674 uint64_t *ldst = (uint64_t *) dst; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1675 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
|
1676 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
|
1677 uint64_t k, l; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1678 k = uc[0] + (yc[0] << 8) + |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1679 (vc[0] << 16) + (yc[1] << 24); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1680 l = uc[1] + (yc[2] << 8) + |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1681 (vc[1] << 16) + (yc[3] << 24); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1682 *ldst++ = k + (l << 32); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1683 yc += 4; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1684 uc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1685 vc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1686 } |
18861 | 1687 |
1688 #else | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1689 int i, *idst = (int32_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++){ |
18861 | 1692 #ifdef WORDS_BIGENDIAN |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1693 *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
|
1694 (vc[0] << 8) + (yc[1] << 0); |
18861 | 1695 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1696 *idst++ = uc[0] + (yc[0] << 8) + |
27158 | 1697 (vc[0] << 16) + (yc[1] << 24); |
18861 | 1698 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1699 yc += 2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1700 uc++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1701 vc++; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1702 } |
18861 | 1703 #endif |
1704 #endif | |
25751 | 1705 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
|
1706 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1707 usrc += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1708 vsrc += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1709 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1710 ysrc += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1711 dst += dstStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1712 } |
28276 | 1713 #if HAVE_MMX |
27744 | 1714 __asm__( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1715 SFENCE" \n\t" |
18861 | 1716 :::"memory"); |
1717 #endif | |
1718 } | |
1719 | |
1720 /** | |
27158 | 1721 * Height should be a multiple of 2 and width should be a multiple of 16 |
1722 * (If this is a problem for anyone then tell me, and I will fix it.) | |
18861 | 1723 */ |
1724 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
|
1725 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1726 long lumStride, long chromStride, long dstStride) |
18861 | 1727 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1728 //FIXME interpolate chroma |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1729 RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); |
18861 | 1730 } |
1731 | |
1732 /** | |
25109 | 1733 * Width should be a multiple of 16. |
18861 | 1734 */ |
27495 | 1735 static inline void RENAME(yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
1736 long width, long height, | |
1737 long lumStride, long chromStride, long dstStride) | |
1738 { | |
1739 RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); | |
1740 } | |
1741 | |
1742 /** | |
1743 * Width should be a multiple of 16. | |
1744 */ | |
18861 | 1745 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
|
1746 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1747 long lumStride, long chromStride, long dstStride) |
18861 | 1748 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1749 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); |
18861 | 1750 } |
1751 | |
1752 /** | |
27158 | 1753 * Height should be a multiple of 2 and width should be a multiple of 16. |
1754 * (If this is a problem for anyone then tell me, and I will fix it.) | |
18861 | 1755 */ |
1756 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
|
1757 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1758 long lumStride, long chromStride, long srcStride) |
18861 | 1759 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1760 long y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1761 const long chromWidth= width>>1; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1762 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
|
1763 { |
28276 | 1764 #if HAVE_MMX |
27744 | 1765 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1766 "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
|
1767 "pcmpeqw %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1768 "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
|
1769 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1770 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1771 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
|
1772 "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
|
1773 "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
|
1774 "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
|
1775 "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
|
1776 "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
|
1777 "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
|
1778 "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
|
1779 "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
|
1780 "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
|
1781 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0) |
18861 | 1782 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1783 MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t" |
18861 | 1784 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1785 "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
|
1786 "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
|
1787 "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
|
1788 "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
|
1789 "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
|
1790 "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
|
1791 "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
|
1792 "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
|
1793 "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
|
1794 "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8) |
18861 | 1795 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1796 MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t" |
18861 | 1797 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1798 "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
|
1799 "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
|
1800 "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
|
1801 "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
|
1802 "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
|
1803 "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
|
1804 "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
|
1805 "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0) |
18861 | 1806 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1807 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
|
1808 MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t" |
18861 | 1809 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1810 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1811 "cmp %4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1812 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1813 ::"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
|
1814 : "memory", "%"REG_a |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1815 ); |
18861 | 1816 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1817 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1818 src += srcStride; |
18861 | 1819 |
27744 | 1820 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1821 "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
|
1822 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1823 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1824 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
|
1825 "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
|
1826 "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
|
1827 "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
|
1828 "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
|
1829 "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
|
1830 "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
|
1831 "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
|
1832 "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
|
1833 "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
|
1834 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8) |
18861 | 1835 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1836 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
|
1837 MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t" |
18861 | 1838 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1839 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1840 "cmp %4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1841 " jb 1b \n\t" |
18861 | 1842 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1843 ::"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
|
1844 : "memory", "%"REG_a |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1845 ); |
18861 | 1846 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1847 long i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1848 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1849 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1850 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
|
1851 udst[i] = src[4*i+1]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1852 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
|
1853 vdst[i] = src[4*i+3]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1854 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1855 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1856 src += srcStride; |
18861 | 1857 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1858 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1859 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1860 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
|
1861 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
|
1862 } |
18861 | 1863 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1864 udst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1865 vdst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1866 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1867 src += srcStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1868 } |
28276 | 1869 #if HAVE_MMX |
27744 | 1870 __asm__ volatile( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1871 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1872 :::"memory"); |
18861 | 1873 #endif |
1874 } | |
1875 | |
1876 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
|
1877 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
|
1878 long width, long height, long lumStride, long chromStride) |
18861 | 1879 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1880 /* Y Plane */ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1881 memcpy(ydst, ysrc, width*height); |
18861 | 1882 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1883 /* XXX: implement upscaling for U,V */ |
18861 | 1884 } |
1885 | |
1886 static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride) | |
1887 { | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1888 long x,y; |
23129 | 1889 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1890 dst[0]= src[0]; |
23129 | 1891 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1892 // first line |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1893 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
|
1894 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
|
1895 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
|
1896 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1897 dst[2*srcWidth-1]= src[srcWidth-1]; |
23129 | 1898 |
18861 | 1899 dst+= dstStride; |
1900 | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1901 for (y=1; y<srcHeight; y++){ |
28323
99c49467ebbc
HAVE_3DNOW --> HAVE_AMD3DNOW to sync with latest configure changes.
diego
parents:
28276
diff
changeset
|
1902 #if HAVE_MMX2 || HAVE_AMD3DNOW |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1903 const long mmxSize= srcWidth&~15; |
27744 | 1904 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1905 "mov %4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1906 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1907 "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
|
1908 "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
|
1909 "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
|
1910 "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
|
1911 "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
|
1912 "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
|
1913 PAVGB" %%mm0, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1914 PAVGB" %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1915 PAVGB" %%mm0, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1916 PAVGB" %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1917 PAVGB" %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1918 PAVGB" %%mm1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1919 PAVGB" %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1920 PAVGB" %%mm1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1921 "movq %%mm5, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1922 "movq %%mm4, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1923 "punpcklbw %%mm3, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1924 "punpckhbw %%mm3, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1925 "punpcklbw %%mm2, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1926 "punpckhbw %%mm2, %%mm6 \n\t" |
18861 | 1927 #if 1 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1928 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
|
1929 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
|
1930 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
|
1931 MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2) \n\t" |
18861 | 1932 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1933 "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
|
1934 "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
|
1935 "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
|
1936 "movq %%mm6, 8(%3, %%"REG_a", 2) \n\t" |
18861 | 1937 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1938 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1939 " js 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1940 :: "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
|
1941 "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
|
1942 "g" (-mmxSize) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1943 : "%"REG_a |
18861 | 1944 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1945 ); |
18861 | 1946 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1947 const long mmxSize=1; |
18861 | 1948 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1949 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
|
1950 dst[dstStride]= ( src[0] + 3*src[srcStride])>>2; |
18861 | 1951 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1952 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
|
1953 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
|
1954 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
|
1955 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
|
1956 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
|
1957 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1958 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
|
1959 dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2; |
18861 | 1960 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1961 dst+=dstStride*2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1962 src+=srcStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1963 } |
23129 | 1964 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1965 // last line |
18861 | 1966 #if 1 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1967 dst[0]= src[0]; |
23129 | 1968 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1969 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
|
1970 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
|
1971 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
|
1972 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1973 dst[2*srcWidth-1]= src[srcWidth-1]; |
18861 | 1974 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1975 for (x=0; x<srcWidth; x++){ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1976 dst[2*x+0]= |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1977 dst[2*x+1]= src[x]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1978 } |
18861 | 1979 #endif |
1980 | |
28276 | 1981 #if HAVE_MMX |
27744 | 1982 __asm__ volatile( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1983 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1984 :::"memory"); |
18861 | 1985 #endif |
1986 } | |
1987 | |
1988 /** | |
27158 | 1989 * Height should be a multiple of 2 and width should be a multiple of 16. |
1990 * (If this is a problem for anyone then tell me, and I will fix it.) | |
1991 * Chrominance data is only taken from every second line, others are ignored. | |
25109 | 1992 * FIXME: Write HQ version. |
18861 | 1993 */ |
1994 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
|
1995 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1996 long lumStride, long chromStride, long srcStride) |
18861 | 1997 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1998 long y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
1999 const long chromWidth= width>>1; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2000 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
|
2001 { |
28276 | 2002 #if HAVE_MMX |
27744 | 2003 __asm__ volatile( |
28102 | 2004 "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
|
2005 "pcmpeqw %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2006 "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
|
2007 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2008 "1: \n\t" |
28102 | 2009 PREFETCH" 64(%0, %%"REG_a", 4) \n\t" |
2010 "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // UYVY UYVY(0) | |
2011 "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
|
2012 "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
|
2013 "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
|
2014 "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
|
2015 "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
|
2016 "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
|
2017 "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
|
2018 "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
|
2019 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0) |
18861 | 2020 |
28102 | 2021 MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t" |
18861 | 2022 |
28102 | 2023 "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(8) |
2024 "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
|
2025 "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
|
2026 "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
|
2027 "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
|
2028 "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
|
2029 "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
|
2030 "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
|
2031 "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
|
2032 "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8) |
18861 | 2033 |
28102 | 2034 MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t" |
18861 | 2035 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2036 "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
|
2037 "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
|
2038 "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
|
2039 "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
|
2040 "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
|
2041 "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
|
2042 "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
|
2043 "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0) |
18861 | 2044 |
28102 | 2045 MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t" |
2046 MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t" | |
18861 | 2047 |
28102 | 2048 "add $8, %%"REG_a" \n\t" |
2049 "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
|
2050 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2051 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth) |
28102 | 2052 : "memory", "%"REG_a |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2053 ); |
18861 | 2054 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2055 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2056 src += srcStride; |
18861 | 2057 |
27744 | 2058 __asm__ volatile( |
28102 | 2059 "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
|
2060 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2061 "1: \n\t" |
28102 | 2062 PREFETCH" 64(%0, %%"REG_a", 4) \n\t" |
2063 "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0) | |
2064 "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4) | |
2065 "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8) | |
2066 "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
|
2067 "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
|
2068 "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
|
2069 "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
|
2070 "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
|
2071 "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
|
2072 "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8) |
18861 | 2073 |
28102 | 2074 MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t" |
2075 MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t" | |
18861 | 2076 |
28102 | 2077 "add $8, %%"REG_a" \n\t" |
2078 "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
|
2079 " jb 1b \n\t" |
18861 | 2080 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2081 ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth) |
28102 | 2082 : "memory", "%"REG_a |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2083 ); |
18861 | 2084 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2085 long i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2086 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2087 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2088 udst[i] = src[4*i+0]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2089 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
|
2090 vdst[i] = src[4*i+2]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2091 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
|
2092 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2093 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2094 src += srcStride; |
18861 | 2095 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2096 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2097 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2098 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
|
2099 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
|
2100 } |
18861 | 2101 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2102 udst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2103 vdst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2104 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2105 src += srcStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2106 } |
28276 | 2107 #if HAVE_MMX |
27744 | 2108 __asm__ volatile( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2109 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2110 :::"memory"); |
18861 | 2111 #endif |
2112 } | |
2113 | |
2114 /** | |
27158 | 2115 * Height should be a multiple of 2 and width should be a multiple of 2. |
2116 * (If this is a problem for anyone then tell me, and I will fix it.) | |
2117 * Chrominance data is only taken from every second line, | |
25109 | 2118 * others are ignored in the C version. |
2119 * FIXME: Write HQ version. | |
18861 | 2120 */ |
2121 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
|
2122 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2123 long lumStride, long chromStride, long srcStride) |
18861 | 2124 { |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2125 long y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2126 const long chromWidth= width>>1; |
28276 | 2127 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2128 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
|
2129 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2130 long i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2131 for (i=0; i<2; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2132 { |
27744 | 2133 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2134 "mov %2, %%"REG_a" \n\t" |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2135 "movq "MANGLE(ff_bgr2YCoeff)", %%mm6 \n\t" |
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2136 "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
|
2137 "pxor %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2138 "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
|
2139 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2140 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2141 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
|
2142 "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
|
2143 "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
|
2144 "punpcklbw %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2145 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2146 "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
|
2147 "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
|
2148 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2149 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2150 "pmaddwd %%mm6, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2151 "pmaddwd %%mm6, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2152 "pmaddwd %%mm6, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2153 "pmaddwd %%mm6, %%mm3 \n\t" |
18861 | 2154 #ifndef FAST_BGR2YV12 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2155 "psrad $8, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2156 "psrad $8, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2157 "psrad $8, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2158 "psrad $8, %%mm3 \n\t" |
18861 | 2159 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2160 "packssdw %%mm1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2161 "packssdw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2162 "pmaddwd %%mm5, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2163 "pmaddwd %%mm5, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2164 "packssdw %%mm2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2165 "psraw $7, %%mm0 \n\t" |
18861 | 2166 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2167 "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
|
2168 "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
|
2169 "punpcklbw %%mm7, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2170 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2171 "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
|
2172 "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
|
2173 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2174 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2175 "pmaddwd %%mm6, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2176 "pmaddwd %%mm6, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2177 "pmaddwd %%mm6, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2178 "pmaddwd %%mm6, %%mm3 \n\t" |
18861 | 2179 #ifndef FAST_BGR2YV12 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2180 "psrad $8, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2181 "psrad $8, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2182 "psrad $8, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2183 "psrad $8, %%mm3 \n\t" |
18861 | 2184 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2185 "packssdw %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2186 "packssdw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2187 "pmaddwd %%mm5, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2188 "pmaddwd %%mm5, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2189 "add $24, %%"REG_d" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2190 "packssdw %%mm2, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2191 "psraw $7, %%mm4 \n\t" |
18861 | 2192 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2193 "packuswb %%mm4, %%mm0 \n\t" |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2194 "paddusb "MANGLE(ff_bgr2YOffset)", %%mm0 \n\t" |
18861 | 2195 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2196 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
|
2197 "add $8, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2198 " js 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2199 : : "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
|
2200 : "%"REG_a, "%"REG_d |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2201 ); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2202 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2203 src += srcStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2204 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2205 src -= srcStride*2; |
27744 | 2206 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2207 "mov %4, %%"REG_a" \n\t" |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2208 "movq "MANGLE(ff_w1111)", %%mm5 \n\t" |
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2209 "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
|
2210 "pxor %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2211 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t" |
23156 | 2212 "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
|
2213 ASMALIGN(4) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2214 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2215 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
|
2216 PREFETCH" 64(%1, %%"REG_d") \n\t" |
28323
99c49467ebbc
HAVE_3DNOW --> HAVE_AMD3DNOW to sync with latest configure changes.
diego
parents:
28276
diff
changeset
|
2217 #if HAVE_MMX2 || HAVE_AMD3DNOW |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2218 "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
|
2219 "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
|
2220 "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
|
2221 "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
|
2222 PAVGB" %%mm1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2223 PAVGB" %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2224 "movq %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2225 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2226 "psrlq $24, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2227 "psrlq $24, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2228 PAVGB" %%mm1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2229 PAVGB" %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2230 "punpcklbw %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2231 "punpcklbw %%mm7, %%mm2 \n\t" |
18861 | 2232 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2233 "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
|
2234 "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
|
2235 "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
|
2236 "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
|
2237 "punpcklbw %%mm7, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2238 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2239 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2240 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2241 "paddw %%mm1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2242 "paddw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2243 "paddw %%mm2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2244 "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
|
2245 "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
|
2246 "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
|
2247 "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
|
2248 "punpcklbw %%mm7, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2249 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2250 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2251 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2252 "paddw %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2253 "paddw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2254 "paddw %%mm4, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2255 "psrlw $2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2256 "psrlw $2, %%mm2 \n\t" |
18861 | 2257 #endif |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2258 "movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t" |
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2259 "movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t" |
18861 | 2260 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2261 "pmaddwd %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2262 "pmaddwd %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2263 "pmaddwd %%mm6, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2264 "pmaddwd %%mm6, %%mm2 \n\t" |
18861 | 2265 #ifndef FAST_BGR2YV12 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2266 "psrad $8, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2267 "psrad $8, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2268 "psrad $8, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2269 "psrad $8, %%mm3 \n\t" |
18861 | 2270 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2271 "packssdw %%mm2, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2272 "packssdw %%mm3, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2273 "pmaddwd %%mm5, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2274 "pmaddwd %%mm5, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2275 "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
|
2276 "psraw $7, %%mm0 \n\t" |
18861 | 2277 |
28323
99c49467ebbc
HAVE_3DNOW --> HAVE_AMD3DNOW to sync with latest configure changes.
diego
parents:
28276
diff
changeset
|
2278 #if HAVE_MMX2 || HAVE_AMD3DNOW |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2279 "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
|
2280 "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
|
2281 "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
|
2282 "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
|
2283 PAVGB" %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2284 PAVGB" %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2285 "movq %%mm4, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2286 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2287 "psrlq $24, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2288 "psrlq $24, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2289 PAVGB" %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2290 PAVGB" %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2291 "punpcklbw %%mm7, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2292 "punpcklbw %%mm7, %%mm2 \n\t" |
18861 | 2293 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2294 "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
|
2295 "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
|
2296 "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
|
2297 "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
|
2298 "punpcklbw %%mm7, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2299 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2300 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2301 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2302 "paddw %%mm1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2303 "paddw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2304 "paddw %%mm2, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2305 "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
|
2306 "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
|
2307 "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
|
2308 "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
|
2309 "punpcklbw %%mm7, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2310 "punpcklbw %%mm7, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2311 "punpcklbw %%mm7, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2312 "punpcklbw %%mm7, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2313 "paddw %%mm1, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2314 "paddw %%mm3, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2315 "paddw %%mm5, %%mm2 \n\t" |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2316 "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
|
2317 "psrlw $2, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2318 "psrlw $2, %%mm2 \n\t" |
18861 | 2319 #endif |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2320 "movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t" |
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2321 "movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t" |
18861 | 2322 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2323 "pmaddwd %%mm4, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2324 "pmaddwd %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2325 "pmaddwd %%mm6, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2326 "pmaddwd %%mm6, %%mm2 \n\t" |
18861 | 2327 #ifndef FAST_BGR2YV12 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2328 "psrad $8, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2329 "psrad $8, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2330 "psrad $8, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2331 "psrad $8, %%mm3 \n\t" |
18861 | 2332 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2333 "packssdw %%mm2, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2334 "packssdw %%mm3, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2335 "pmaddwd %%mm5, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2336 "pmaddwd %%mm5, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2337 "add $24, %%"REG_d" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2338 "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
|
2339 "psraw $7, %%mm4 \n\t" |
18861 | 2340 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2341 "movq %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2342 "punpckldq %%mm4, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2343 "punpckhdq %%mm4, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2344 "packsswb %%mm1, %%mm0 \n\t" |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25751
diff
changeset
|
2345 "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
|
2346 "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
|
2347 "punpckhdq %%mm0, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2348 "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
|
2349 "add $4, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2350 " js 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2351 : : "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
|
2352 : "%"REG_a, "%"REG_d |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2353 ); |
18861 | 2354 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2355 udst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2356 vdst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2357 src += srcStride*2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2358 } |
18861 | 2359 |
27744 | 2360 __asm__ volatile( EMMS" \n\t" |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2361 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2362 :::"memory"); |
18861 | 2363 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2364 y=0; |
18861 | 2365 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2366 for (; y<height; y+=2) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2367 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2368 long i; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2369 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2370 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2371 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
|
2372 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
|
2373 unsigned int r = src[6*i+2]; |
18861 | 2374 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2375 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
|
2376 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
|
2377 unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128; |
18861 | 2378 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2379 udst[i] = U; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2380 vdst[i] = V; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2381 ydst[2*i] = Y; |
18861 | 2382 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2383 b = src[6*i+3]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2384 g = src[6*i+4]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2385 r = src[6*i+5]; |
18861 | 2386 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2387 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
|
2388 ydst[2*i+1] = Y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2389 } |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2390 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2391 src += srcStride; |
18861 | 2392 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2393 for (i=0; i<chromWidth; i++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2394 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2395 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
|
2396 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
|
2397 unsigned int r = src[6*i+2]; |
18861 | 2398 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2399 unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16; |
18861 | 2400 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2401 ydst[2*i] = Y; |
18861 | 2402 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2403 b = src[6*i+3]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2404 g = src[6*i+4]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2405 r = src[6*i+5]; |
18861 | 2406 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2407 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
|
2408 ydst[2*i+1] = Y; |
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 udst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2411 vdst += chromStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2412 ydst += lumStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2413 src += srcStride; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2414 } |
18861 | 2415 } |
2416 | |
27703
3815517f49d4
Mark variation-specific interleaveBytes static.
flameeyes
parents:
27690
diff
changeset
|
2417 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
|
2418 long width, long height, long src1Stride, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2419 long src2Stride, long dstStride){ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2420 long h; |
18861 | 2421 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2422 for (h=0; h < height; h++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2423 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2424 long w; |
18861 | 2425 |
28276 | 2426 #if HAVE_MMX |
2427 #if HAVE_SSE2 | |
27744 | 2428 __asm__( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2429 "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
|
2430 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2431 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
|
2432 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
|
2433 "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
|
2434 "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
|
2435 "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
|
2436 "punpcklbw %%xmm2, %%xmm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2437 "punpckhbw %%xmm2, %%xmm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2438 "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
|
2439 "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
|
2440 "add $16, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2441 "cmp %3, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2442 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2443 ::"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
|
2444 : "memory", "%"REG_a"" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2445 ); |
18861 | 2446 #else |
27744 | 2447 __asm__( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2448 "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
|
2449 "1: \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2450 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
|
2451 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
|
2452 "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
|
2453 "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
|
2454 "movq %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2455 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2456 "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
|
2457 "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
|
2458 "punpcklbw %%mm4, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2459 "punpckhbw %%mm4, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2460 "punpcklbw %%mm5, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2461 "punpckhbw %%mm5, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2462 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
|
2463 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
|
2464 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
|
2465 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
|
2466 "add $16, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2467 "cmp %3, %%"REG_a" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2468 " jb 1b \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2469 ::"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
|
2470 : "memory", "%"REG_a |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2471 ); |
18861 | 2472 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2473 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
|
2474 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2475 dest[2*w+0] = src1[w]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2476 dest[2*w+1] = src2[w]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2477 } |
18861 | 2478 #else |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2479 for (w=0; w < width; w++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2480 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2481 dest[2*w+0] = src1[w]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2482 dest[2*w+1] = src2[w]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2483 } |
18861 | 2484 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2485 dest += dstStride; |
18861 | 2486 src1 += src1Stride; |
2487 src2 += src2Stride; | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2488 } |
28276 | 2489 #if HAVE_MMX |
27744 | 2490 __asm__( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2491 EMMS" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2492 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2493 ::: "memory" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2494 ); |
18861 | 2495 #endif |
2496 } | |
2497 | |
2498 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
|
2499 uint8_t *dst1, uint8_t *dst2, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2500 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2501 long srcStride1, long srcStride2, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2502 long dstStride1, long dstStride2) |
18861 | 2503 { |
2504 long y,x,w,h; | |
2505 w=width/2; h=height/2; | |
28276 | 2506 #if HAVE_MMX |
27744 | 2507 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2508 PREFETCH" %0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2509 PREFETCH" %1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2510 ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory"); |
18861 | 2511 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2512 for (y=0;y<h;y++){ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2513 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
|
2514 uint8_t* d=dst1+dstStride1*y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2515 x=0; |
28276 | 2516 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2517 for (;x<w-31;x+=32) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2518 { |
27744 | 2519 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2520 PREFETCH" 32%1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2521 "movq %1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2522 "movq 8%1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2523 "movq 16%1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2524 "movq 24%1, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2525 "movq %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2526 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2527 "movq %%mm4, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2528 "movq %%mm6, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2529 "punpcklbw %%mm0, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2530 "punpckhbw %%mm1, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2531 "punpcklbw %%mm2, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2532 "punpckhbw %%mm3, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2533 "punpcklbw %%mm4, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2534 "punpckhbw %%mm5, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2535 "punpcklbw %%mm6, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2536 "punpckhbw %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2537 MOVNTQ" %%mm0, %0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2538 MOVNTQ" %%mm1, 8%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2539 MOVNTQ" %%mm2, 16%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2540 MOVNTQ" %%mm3, 24%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2541 MOVNTQ" %%mm4, 32%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2542 MOVNTQ" %%mm5, 40%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2543 MOVNTQ" %%mm6, 48%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2544 MOVNTQ" %%mm7, 56%0" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2545 :"=m"(d[2*x]) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2546 :"m"(s1[x]) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2547 :"memory"); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2548 } |
18861 | 2549 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2550 for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x]; |
18861 | 2551 } |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2552 for (y=0;y<h;y++){ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2553 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
|
2554 uint8_t* d=dst2+dstStride2*y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2555 x=0; |
28276 | 2556 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2557 for (;x<w-31;x+=32) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2558 { |
27744 | 2559 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2560 PREFETCH" 32%1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2561 "movq %1, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2562 "movq 8%1, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2563 "movq 16%1, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2564 "movq 24%1, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2565 "movq %%mm0, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2566 "movq %%mm2, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2567 "movq %%mm4, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2568 "movq %%mm6, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2569 "punpcklbw %%mm0, %%mm0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2570 "punpckhbw %%mm1, %%mm1 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2571 "punpcklbw %%mm2, %%mm2 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2572 "punpckhbw %%mm3, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2573 "punpcklbw %%mm4, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2574 "punpckhbw %%mm5, %%mm5 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2575 "punpcklbw %%mm6, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2576 "punpckhbw %%mm7, %%mm7 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2577 MOVNTQ" %%mm0, %0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2578 MOVNTQ" %%mm1, 8%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2579 MOVNTQ" %%mm2, 16%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2580 MOVNTQ" %%mm3, 24%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2581 MOVNTQ" %%mm4, 32%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2582 MOVNTQ" %%mm5, 40%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2583 MOVNTQ" %%mm6, 48%0 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2584 MOVNTQ" %%mm7, 56%0" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2585 :"=m"(d[2*x]) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2586 :"m"(s2[x]) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2587 :"memory"); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2588 } |
18861 | 2589 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2590 for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x]; |
18861 | 2591 } |
28276 | 2592 #if HAVE_MMX |
27744 | 2593 __asm__( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2594 EMMS" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2595 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2596 ::: "memory" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2597 ); |
18861 | 2598 #endif |
2599 } | |
2600 | |
2601 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
|
2602 uint8_t *dst, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2603 long width, long height, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2604 long srcStride1, long srcStride2, |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2605 long srcStride3, long dstStride) |
18861 | 2606 { |
2607 long y,x,w,h; | |
2608 w=width/2; h=height; | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2609 for (y=0;y<h;y++){ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2610 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
|
2611 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
|
2612 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
|
2613 uint8_t* d=dst+dstStride*y; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2614 x=0; |
28276 | 2615 #if HAVE_MMX |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2616 for (;x<w-7;x+=8) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2617 { |
27744 | 2618 __asm__ volatile( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2619 PREFETCH" 32(%1, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2620 PREFETCH" 32(%2, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2621 PREFETCH" 32(%3, %0) \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2622 "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
|
2623 "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
|
2624 "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
|
2625 "movq %%mm0, %%mm3 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2626 "movq %%mm1, %%mm4 \n\t" /* U0U1U2U3U4U5U6U7 */ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2627 "movq %%mm2, %%mm5 \n\t" /* V0V1V2V3V4V5V6V7 */ |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2628 "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
|
2629 "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
|
2630 "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
|
2631 "punpckhbw %%mm5, %%mm5 \n\t" /* V4V4 V5V5 V6V6 V7V7 */ |
18861 | 2632 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2633 "movq %%mm1, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2634 "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
|
2635 "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
|
2636 "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
|
2637 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
|
2638 MOVNTQ" %%mm3, 8(%4, %0, 8) \n\t" |
23129 | 2639 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2640 "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
|
2641 "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
|
2642 "movq %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2643 "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
|
2644 "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
|
2645 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
|
2646 MOVNTQ" %%mm3, 24(%4, %0, 8) \n\t" |
18861 | 2647 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2648 "movq %%mm4, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2649 "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
|
2650 "movq %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2651 "punpcklbw %%mm5, %%mm4 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2652 "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
|
2653 "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
|
2654 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
|
2655 MOVNTQ" %%mm3, 40(%4, %0, 8) \n\t" |
23129 | 2656 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2657 "punpckhbw %%mm5, %%mm6 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2658 "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
|
2659 "movq %%mm0, %%mm3 \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2660 "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
|
2661 "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
|
2662 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
|
2663 MOVNTQ" %%mm3, 56(%4, %0, 8) \n\t" |
18861 | 2664 |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2665 : "+r" (x) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2666 : "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
|
2667 :"memory"); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2668 } |
18861 | 2669 #endif |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2670 for (; x<w; x++) |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2671 { |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2672 const long x2 = x<<2; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2673 d[8*x+0] = yp[x2]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2674 d[8*x+1] = up[x]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2675 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
|
2676 d[8*x+3] = vp[x]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2677 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
|
2678 d[8*x+5] = up[x]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2679 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
|
2680 d[8*x+7] = vp[x]; |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2681 } |
18861 | 2682 } |
28276 | 2683 #if HAVE_MMX |
27744 | 2684 __asm__( |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2685 EMMS" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2686 SFENCE" \n\t" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2687 ::: "memory" |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2688 ); |
18861 | 2689 #endif |
2690 } | |
22960 | 2691 |
2692 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
|
2693 rgb15to16 = RENAME(rgb15to16); |
27486 | 2694 rgb15tobgr24 = RENAME(rgb15tobgr24); |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2695 rgb15to32 = RENAME(rgb15to32); |
27486 | 2696 rgb16tobgr24 = RENAME(rgb16tobgr24); |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2697 rgb16to32 = RENAME(rgb16to32); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2698 rgb16to15 = RENAME(rgb16to15); |
27486 | 2699 rgb24tobgr16 = RENAME(rgb24tobgr16); |
2700 rgb24tobgr15 = RENAME(rgb24tobgr15); | |
2701 rgb24tobgr32 = RENAME(rgb24tobgr32); | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2702 rgb32to16 = RENAME(rgb32to16); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2703 rgb32to15 = RENAME(rgb32to15); |
27486 | 2704 rgb32tobgr24 = RENAME(rgb32tobgr24); |
2705 rgb24to15 = RENAME(rgb24to15); | |
2706 rgb24to16 = RENAME(rgb24to16); | |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2707 rgb24tobgr24 = RENAME(rgb24tobgr24); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2708 rgb32tobgr32 = RENAME(rgb32tobgr32); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2709 rgb32tobgr16 = RENAME(rgb32tobgr16); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2710 rgb32tobgr15 = RENAME(rgb32tobgr15); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2711 yv12toyuy2 = RENAME(yv12toyuy2); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2712 yv12touyvy = RENAME(yv12touyvy); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2713 yuv422ptoyuy2 = RENAME(yuv422ptoyuy2); |
27495 | 2714 yuv422ptouyvy = RENAME(yuv422ptouyvy); |
23140
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2715 yuy2toyv12 = RENAME(yuy2toyv12); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2716 // uyvytoyv12 = RENAME(uyvytoyv12); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2717 // yvu9toyv12 = RENAME(yvu9toyv12); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2718 planar2x = RENAME(planar2x); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2719 rgb24toyv12 = RENAME(rgb24toyv12); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2720 interleaveBytes = RENAME(interleaveBytes); |
4d3870361b73
cosmetics attack, part I: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23139
diff
changeset
|
2721 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
|
2722 yvu9_to_yuy2 = RENAME(yvu9_to_yuy2); |
22960 | 2723 } |