annotate libswscale/rgb2rgb_template.c @ 32445:7ec524214684

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