Mercurial > mplayer.hg
annotate libswscale/swscale_template.c @ 30118:cdec8d3a2225
Do not needlessly use the BP register in x86_64-specific code, there are
enough other registers available that are less likely to cause issues.
author | reimar |
---|---|
date | Fri, 01 Jan 2010 09:46:24 +0000 |
parents | 79c5030c2904 |
children | 1e02e823023c |
rev | line source |
---|---|
18861 | 1 /* |
20094
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
2 * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at> |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
3 * |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
4 * This file is part of FFmpeg. |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
5 * |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or modify |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
9 * (at your option) any later version. |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
10 * |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
14 * GNU General Public License for more details. |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
15 * |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
17 * along with FFmpeg; if not, write to the Free Software |
23702 | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20094
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
19 * |
27158 | 20 * The C code (not assembly, MMX, ...) of this file can be used |
21 * under the LGPL license. | |
20094
aca9e9783f67
Change license headers to say 'FFmpeg' instead of 'this program'.
diego
parents:
20015
diff
changeset
|
22 */ |
18861 | 23 |
24 #undef REAL_MOVNTQ | |
25 #undef MOVNTQ | |
26 #undef PAVGB | |
27 #undef PREFETCH | |
28 #undef PREFETCHW | |
29 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
30 #if COMPILE_TEMPLATE_AMD3DNOW |
18861 | 31 #define PREFETCH "prefetch" |
32 #define PREFETCHW "prefetchw" | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
33 #elif COMPILE_TEMPLATE_MMX2 |
18861 | 34 #define PREFETCH "prefetchnta" |
35 #define PREFETCHW "prefetcht0" | |
36 #else | |
20724
b8fe18a742ce
Fix MacIntel build: "/nop" is illegal on Apple's older version of GAS
gpoirier
parents:
20589
diff
changeset
|
37 #define PREFETCH " # nop" |
b8fe18a742ce
Fix MacIntel build: "/nop" is illegal on Apple's older version of GAS
gpoirier
parents:
20589
diff
changeset
|
38 #define PREFETCHW " # nop" |
18861 | 39 #endif |
40 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
41 #if COMPILE_TEMPLATE_MMX2 |
18861 | 42 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
43 #elif COMPILE_TEMPLATE_AMD3DNOW |
18861 | 44 #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" |
45 #endif | |
46 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
47 #if COMPILE_TEMPLATE_MMX2 |
18861 | 48 #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t" |
49 #else | |
50 #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t" | |
51 #endif | |
52 #define MOVNTQ(a,b) REAL_MOVNTQ(a,b) | |
53 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
54 #if COMPILE_TEMPLATE_ALTIVEC |
29060
e7f277bf38b5
Move swscale AltiVec template code to ppc subdirectory.
diego
parents:
28981
diff
changeset
|
55 #include "ppc/swscale_altivec_template.c" |
18861 | 56 #endif |
57 | |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
58 #define YSCALEYUV2YV12X(x, offset, dest, width) \ |
27744 | 59 __asm__ volatile(\ |
29482 | 60 "xor %%"REG_a", %%"REG_a" \n\t"\ |
61 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\ | |
62 "movq %%mm3, %%mm4 \n\t"\ | |
63 "lea " offset "(%0), %%"REG_d" \n\t"\ | |
64 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
65 ASMALIGN(4) /* FIXME Unroll? */\ | |
66 "1: \n\t"\ | |
67 "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\ | |
68 "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\ | |
69 "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm5 \n\t" /* srcData */\ | |
70 "add $16, %%"REG_d" \n\t"\ | |
71 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
72 "test %%"REG_S", %%"REG_S" \n\t"\ | |
73 "pmulhw %%mm0, %%mm2 \n\t"\ | |
74 "pmulhw %%mm0, %%mm5 \n\t"\ | |
75 "paddw %%mm2, %%mm3 \n\t"\ | |
76 "paddw %%mm5, %%mm4 \n\t"\ | |
77 " jnz 1b \n\t"\ | |
78 "psraw $3, %%mm3 \n\t"\ | |
79 "psraw $3, %%mm4 \n\t"\ | |
80 "packuswb %%mm4, %%mm3 \n\t"\ | |
81 MOVNTQ(%%mm3, (%1, %%REGa))\ | |
82 "add $8, %%"REG_a" \n\t"\ | |
83 "cmp %2, %%"REG_a" \n\t"\ | |
84 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\ | |
85 "movq %%mm3, %%mm4 \n\t"\ | |
86 "lea " offset "(%0), %%"REG_d" \n\t"\ | |
87 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
88 "jb 1b \n\t"\ | |
89 :: "r" (&c->redDither),\ | |
90 "r" (dest), "g" (width)\ | |
91 : "%"REG_a, "%"REG_d, "%"REG_S\ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
92 ); |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
93 |
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
94 #define YSCALEYUV2YV12X_ACCURATE(x, offset, dest, width) \ |
27744 | 95 __asm__ volatile(\ |
29482 | 96 "lea " offset "(%0), %%"REG_d" \n\t"\ |
97 "xor %%"REG_a", %%"REG_a" \n\t"\ | |
98 "pxor %%mm4, %%mm4 \n\t"\ | |
99 "pxor %%mm5, %%mm5 \n\t"\ | |
100 "pxor %%mm6, %%mm6 \n\t"\ | |
101 "pxor %%mm7, %%mm7 \n\t"\ | |
102 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
103 ASMALIGN(4) \ | |
104 "1: \n\t"\ | |
105 "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" /* srcData */\ | |
106 "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\ | |
107 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\ | |
108 "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm1 \n\t" /* srcData */\ | |
109 "movq %%mm0, %%mm3 \n\t"\ | |
110 "punpcklwd %%mm1, %%mm0 \n\t"\ | |
111 "punpckhwd %%mm1, %%mm3 \n\t"\ | |
112 "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm1 \n\t" /* filterCoeff */\ | |
113 "pmaddwd %%mm1, %%mm0 \n\t"\ | |
114 "pmaddwd %%mm1, %%mm3 \n\t"\ | |
115 "paddd %%mm0, %%mm4 \n\t"\ | |
116 "paddd %%mm3, %%mm5 \n\t"\ | |
117 "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" /* srcData */\ | |
118 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\ | |
119 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\ | |
120 "test %%"REG_S", %%"REG_S" \n\t"\ | |
121 "movq %%mm2, %%mm0 \n\t"\ | |
122 "punpcklwd %%mm3, %%mm2 \n\t"\ | |
123 "punpckhwd %%mm3, %%mm0 \n\t"\ | |
124 "pmaddwd %%mm1, %%mm2 \n\t"\ | |
125 "pmaddwd %%mm1, %%mm0 \n\t"\ | |
126 "paddd %%mm2, %%mm6 \n\t"\ | |
127 "paddd %%mm0, %%mm7 \n\t"\ | |
128 " jnz 1b \n\t"\ | |
129 "psrad $16, %%mm4 \n\t"\ | |
130 "psrad $16, %%mm5 \n\t"\ | |
131 "psrad $16, %%mm6 \n\t"\ | |
132 "psrad $16, %%mm7 \n\t"\ | |
133 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\ | |
134 "packssdw %%mm5, %%mm4 \n\t"\ | |
135 "packssdw %%mm7, %%mm6 \n\t"\ | |
136 "paddw %%mm0, %%mm4 \n\t"\ | |
137 "paddw %%mm0, %%mm6 \n\t"\ | |
138 "psraw $3, %%mm4 \n\t"\ | |
139 "psraw $3, %%mm6 \n\t"\ | |
140 "packuswb %%mm6, %%mm4 \n\t"\ | |
141 MOVNTQ(%%mm4, (%1, %%REGa))\ | |
142 "add $8, %%"REG_a" \n\t"\ | |
143 "cmp %2, %%"REG_a" \n\t"\ | |
144 "lea " offset "(%0), %%"REG_d" \n\t"\ | |
145 "pxor %%mm4, %%mm4 \n\t"\ | |
146 "pxor %%mm5, %%mm5 \n\t"\ | |
147 "pxor %%mm6, %%mm6 \n\t"\ | |
148 "pxor %%mm7, %%mm7 \n\t"\ | |
149 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
150 "jb 1b \n\t"\ | |
151 :: "r" (&c->redDither),\ | |
152 "r" (dest), "g" (width)\ | |
153 : "%"REG_a, "%"REG_d, "%"REG_S\ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
154 ); |
18861 | 155 |
156 #define YSCALEYUV2YV121 \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
157 "mov %2, %%"REG_a" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
158 ASMALIGN(4) /* FIXME Unroll? */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
159 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
160 "movq (%0, %%"REG_a", 2), %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
161 "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
162 "psraw $7, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
163 "psraw $7, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
164 "packuswb %%mm1, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
165 MOVNTQ(%%mm0, (%1, %%REGa))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
166 "add $8, %%"REG_a" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
167 "jnc 1b \n\t" |
18861 | 168 |
27289
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
169 #define YSCALEYUV2YV121_ACCURATE \ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
170 "mov %2, %%"REG_a" \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
171 "pcmpeqw %%mm7, %%mm7 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
172 "psrlw $15, %%mm7 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
173 "psllw $6, %%mm7 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
174 ASMALIGN(4) /* FIXME Unroll? */\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
175 "1: \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
176 "movq (%0, %%"REG_a", 2), %%mm0 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
177 "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"\ |
27541 | 178 "paddsw %%mm7, %%mm0 \n\t"\ |
179 "paddsw %%mm7, %%mm1 \n\t"\ | |
27289
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
180 "psraw $7, %%mm0 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
181 "psraw $7, %%mm1 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
182 "packuswb %%mm1, %%mm0 \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
183 MOVNTQ(%%mm0, (%1, %%REGa))\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
184 "add $8, %%"REG_a" \n\t"\ |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
185 "jnc 1b \n\t" |
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
186 |
18861 | 187 /* |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
188 :: "m" (-lumFilterSize), "m" (-chrFilterSize), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
189 "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
190 "r" (dest), "m" (dstW), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
191 "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
192 : "%eax", "%ebx", "%ecx", "%edx", "%esi" |
18861 | 193 */ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
194 #define YSCALEYUV2PACKEDX_UV \ |
27744 | 195 __asm__ volatile(\ |
29482 | 196 "xor %%"REG_a", %%"REG_a" \n\t"\ |
197 ASMALIGN(4)\ | |
198 "nop \n\t"\ | |
199 "1: \n\t"\ | |
200 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\ | |
201 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
202 "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\ | |
203 "movq %%mm3, %%mm4 \n\t"\ | |
204 ASMALIGN(4)\ | |
205 "2: \n\t"\ | |
206 "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\ | |
207 "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" /* UsrcData */\ | |
208 "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm5 \n\t" /* VsrcData */\ | |
209 "add $16, %%"REG_d" \n\t"\ | |
210 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
211 "pmulhw %%mm0, %%mm2 \n\t"\ | |
212 "pmulhw %%mm0, %%mm5 \n\t"\ | |
213 "paddw %%mm2, %%mm3 \n\t"\ | |
214 "paddw %%mm5, %%mm4 \n\t"\ | |
215 "test %%"REG_S", %%"REG_S" \n\t"\ | |
216 " jnz 2b \n\t"\ | |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
217 |
28899
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
218 #define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
219 "lea "offset"(%0), %%"REG_d" \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
220 "mov (%%"REG_d"), %%"REG_S" \n\t"\ |
28899
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
221 "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
222 "movq "#dst1", "#dst2" \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
223 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
224 "2: \n\t"\ |
28899
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
225 "movq 8(%%"REG_d"), "#coeff" \n\t" /* filterCoeff */\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
226 "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" /* Y1srcData */\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
227 "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" /* Y2srcData */\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
228 "add $16, %%"REG_d" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
229 "mov (%%"REG_d"), %%"REG_S" \n\t"\ |
28899
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
230 "pmulhw "#coeff", "#src1" \n\t"\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
231 "pmulhw "#coeff", "#src2" \n\t"\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
232 "paddw "#src1", "#dst1" \n\t"\ |
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
233 "paddw "#src2", "#dst2" \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
234 "test %%"REG_S", %%"REG_S" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
235 " jnz 2b \n\t"\ |
18861 | 236 |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
237 #define YSCALEYUV2PACKEDX \ |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
238 YSCALEYUV2PACKEDX_UV \ |
28899
58ed7753cee9
Make MMX registers parametrized in the YSCALEYUV2PACKEDX_YA macro
sdrik
parents:
28881
diff
changeset
|
239 YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
240 |
29482 | 241 #define YSCALEYUV2PACKEDX_END \ |
242 :: "r" (&c->redDither), \ | |
243 "m" (dummy), "m" (dummy), "m" (dummy),\ | |
244 "r" (dest), "m" (dstW) \ | |
245 : "%"REG_a, "%"REG_d, "%"REG_S \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
246 ); |
19173 | 247 |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
248 #define YSCALEYUV2PACKEDX_ACCURATE_UV \ |
27744 | 249 __asm__ volatile(\ |
29482 | 250 "xor %%"REG_a", %%"REG_a" \n\t"\ |
251 ASMALIGN(4)\ | |
252 "nop \n\t"\ | |
253 "1: \n\t"\ | |
254 "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\ | |
255 "mov (%%"REG_d"), %%"REG_S" \n\t"\ | |
256 "pxor %%mm4, %%mm4 \n\t"\ | |
257 "pxor %%mm5, %%mm5 \n\t"\ | |
258 "pxor %%mm6, %%mm6 \n\t"\ | |
259 "pxor %%mm7, %%mm7 \n\t"\ | |
260 ASMALIGN(4)\ | |
261 "2: \n\t"\ | |
262 "movq (%%"REG_S", %%"REG_a"), %%mm0 \n\t" /* UsrcData */\ | |
263 "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm2 \n\t" /* VsrcData */\ | |
264 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\ | |
265 "movq (%%"REG_S", %%"REG_a"), %%mm1 \n\t" /* UsrcData */\ | |
266 "movq %%mm0, %%mm3 \n\t"\ | |
267 "punpcklwd %%mm1, %%mm0 \n\t"\ | |
268 "punpckhwd %%mm1, %%mm3 \n\t"\ | |
269 "movq "STR(APCK_COEF)"(%%"REG_d"),%%mm1 \n\t" /* filterCoeff */\ | |
270 "pmaddwd %%mm1, %%mm0 \n\t"\ | |
271 "pmaddwd %%mm1, %%mm3 \n\t"\ | |
272 "paddd %%mm0, %%mm4 \n\t"\ | |
273 "paddd %%mm3, %%mm5 \n\t"\ | |
274 "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm3 \n\t" /* VsrcData */\ | |
275 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\ | |
276 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\ | |
277 "test %%"REG_S", %%"REG_S" \n\t"\ | |
278 "movq %%mm2, %%mm0 \n\t"\ | |
279 "punpcklwd %%mm3, %%mm2 \n\t"\ | |
280 "punpckhwd %%mm3, %%mm0 \n\t"\ | |
281 "pmaddwd %%mm1, %%mm2 \n\t"\ | |
282 "pmaddwd %%mm1, %%mm0 \n\t"\ | |
283 "paddd %%mm2, %%mm6 \n\t"\ | |
284 "paddd %%mm0, %%mm7 \n\t"\ | |
285 " jnz 2b \n\t"\ | |
286 "psrad $16, %%mm4 \n\t"\ | |
287 "psrad $16, %%mm5 \n\t"\ | |
288 "psrad $16, %%mm6 \n\t"\ | |
289 "psrad $16, %%mm7 \n\t"\ | |
290 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\ | |
291 "packssdw %%mm5, %%mm4 \n\t"\ | |
292 "packssdw %%mm7, %%mm6 \n\t"\ | |
293 "paddw %%mm0, %%mm4 \n\t"\ | |
294 "paddw %%mm0, %%mm6 \n\t"\ | |
295 "movq %%mm4, "U_TEMP"(%0) \n\t"\ | |
296 "movq %%mm6, "V_TEMP"(%0) \n\t"\ | |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
297 |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
298 #define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \ |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
299 "lea "offset"(%0), %%"REG_d" \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
300 "mov (%%"REG_d"), %%"REG_S" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
301 "pxor %%mm1, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
302 "pxor %%mm5, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
303 "pxor %%mm7, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
304 "pxor %%mm6, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
305 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
306 "2: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
307 "movq (%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" /* Y1srcData */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
308 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* Y2srcData */\ |
27513 | 309 "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
310 "movq (%%"REG_S", %%"REG_a", 2), %%mm4 \n\t" /* Y1srcData */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
311 "movq %%mm0, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
312 "punpcklwd %%mm4, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
313 "punpckhwd %%mm4, %%mm3 \n\t"\ |
27513 | 314 "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm4 \n\t" /* filterCoeff */\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
315 "pmaddwd %%mm4, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
316 "pmaddwd %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
317 "paddd %%mm0, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
318 "paddd %%mm3, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
319 "movq 8(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" /* Y2srcData */\ |
27513 | 320 "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\ |
321 "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
322 "test %%"REG_S", %%"REG_S" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
323 "movq %%mm2, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
324 "punpcklwd %%mm3, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
325 "punpckhwd %%mm3, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
326 "pmaddwd %%mm4, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
327 "pmaddwd %%mm4, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
328 "paddd %%mm2, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
329 "paddd %%mm0, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
330 " jnz 2b \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
331 "psrad $16, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
332 "psrad $16, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
333 "psrad $16, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
334 "psrad $16, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
335 "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
336 "packssdw %%mm5, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
337 "packssdw %%mm6, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
338 "paddw %%mm0, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
339 "paddw %%mm0, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
340 "movq "U_TEMP"(%0), %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
341 "movq "V_TEMP"(%0), %%mm4 \n\t"\ |
18861 | 342 |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
343 #define YSCALEYUV2PACKEDX_ACCURATE \ |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
344 YSCALEYUV2PACKEDX_ACCURATE_UV \ |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
345 YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET) |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
346 |
19173 | 347 #define YSCALEYUV2RGBX \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
348 "psubw "U_OFFSET"(%0), %%mm3 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
349 "psubw "V_OFFSET"(%0), %%mm4 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
350 "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
351 "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
352 "pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
353 "pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\ |
29482 | 354 /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
355 "pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
356 "pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
357 "psubw "Y_OFFSET"(%0), %%mm1 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
358 "psubw "Y_OFFSET"(%0), %%mm7 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
359 "pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
360 "pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\ |
29482 | 361 /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
362 "paddw %%mm3, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
363 "movq %%mm2, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
364 "movq %%mm5, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
365 "movq %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
366 "punpcklwd %%mm2, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
367 "punpcklwd %%mm5, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
368 "punpcklwd %%mm4, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
369 "paddw %%mm1, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
370 "paddw %%mm1, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
371 "paddw %%mm1, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
372 "punpckhwd %%mm0, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
373 "punpckhwd %%mm6, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
374 "punpckhwd %%mm3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
375 "paddw %%mm7, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
376 "paddw %%mm7, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
377 "paddw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
378 /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
379 "packuswb %%mm0, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
380 "packuswb %%mm6, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
381 "packuswb %%mm3, %%mm4 \n\t"\ |
18861 | 382 |
383 #define REAL_YSCALEYUV2PACKED(index, c) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
384 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
385 "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
386 "psraw $3, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
387 "psraw $3, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
388 "movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
389 "movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
390 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
391 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
392 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
393 "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
394 "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
395 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\ |
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
396 "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
397 "psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
398 "psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
399 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
400 "pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
401 "pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
402 "psraw $7, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
403 "psraw $7, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
404 "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
405 "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
406 "movq (%0, "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
407 "movq (%1, "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
408 "movq 8(%0, "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
409 "movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
410 "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
411 "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
412 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
413 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
414 "psraw $7, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
415 "psraw $7, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
416 "paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
417 "paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ |
23129 | 418 |
18861 | 419 #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c) |
23129 | 420 |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
421 #define REAL_YSCALEYUV2RGB_UV(index, c) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
422 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
423 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
424 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
425 "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
426 "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
427 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\ |
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
428 "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
429 "psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
430 "psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
431 "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
432 "pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
433 "pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
434 "psraw $4, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
435 "psraw $4, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
436 "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
437 "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
438 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
439 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
440 "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
441 "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
442 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
443 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
444 /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
445 |
28908
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
446 #define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \ |
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
447 "movq ("#b1", "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ |
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
448 "movq ("#b2", "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ |
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
449 "movq 8("#b1", "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ |
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
450 "movq 8("#b2", "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
451 "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
452 "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
453 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
454 "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
455 "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
456 "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
457 "paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
458 "paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
459 |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
460 #define REAL_YSCALEYUV2RGB_COEFF(c) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
461 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
462 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
463 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
464 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
465 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
466 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
467 /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
468 "paddw %%mm3, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
469 "movq %%mm2, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
470 "movq %%mm5, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
471 "movq %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
472 "punpcklwd %%mm2, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
473 "punpcklwd %%mm5, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
474 "punpcklwd %%mm4, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
475 "paddw %%mm1, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
476 "paddw %%mm1, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
477 "paddw %%mm1, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
478 "punpckhwd %%mm0, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
479 "punpckhwd %%mm6, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
480 "punpckhwd %%mm3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
481 "paddw %%mm7, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
482 "paddw %%mm7, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
483 "paddw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
484 /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
485 "packuswb %%mm0, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
486 "packuswb %%mm6, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
487 "packuswb %%mm3, %%mm4 \n\t"\ |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
488 |
28908
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
489 #define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
490 |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
491 #define YSCALEYUV2RGB(index, c) \ |
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
492 REAL_YSCALEYUV2RGB_UV(index, c) \ |
28908
3f077f2d4e84
Make the source buffer operands parametrized in the YSCALEYUV2RGB_YA macro
sdrik
parents:
28899
diff
changeset
|
493 REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \ |
28651
7241319c2d93
splits various YSCALEYUV2xxx macros into YSCALEYUV2xxx_UV,
stefang
parents:
28650
diff
changeset
|
494 REAL_YSCALEYUV2RGB_COEFF(c) |
23129 | 495 |
18861 | 496 #define REAL_YSCALEYUV2PACKED1(index, c) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
497 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
498 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
499 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
500 "movq (%2, "#index"), %%mm3 \n\t" /* uvbuf0[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
501 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4 \n\t" /* uvbuf0[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
502 "psraw $7, %%mm3 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
503 "psraw $7, %%mm4 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
504 "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
505 "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
506 "psraw $7, %%mm1 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
507 "psraw $7, %%mm7 \n\t" \ |
23129 | 508 |
18861 | 509 #define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c) |
23129 | 510 |
18861 | 511 #define REAL_YSCALEYUV2RGB1(index, c) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
512 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
513 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
514 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
515 "movq (%2, "#index"), %%mm3 \n\t" /* uvbuf0[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
516 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4 \n\t" /* uvbuf0[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
517 "psraw $4, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
518 "psraw $4, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
519 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
520 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
521 "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
522 "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
523 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
524 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
525 /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
526 "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
527 "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
528 "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
529 "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
530 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
531 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
532 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
533 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
534 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
535 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
536 /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
537 "paddw %%mm3, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
538 "movq %%mm2, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
539 "movq %%mm5, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
540 "movq %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
541 "punpcklwd %%mm2, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
542 "punpcklwd %%mm5, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
543 "punpcklwd %%mm4, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
544 "paddw %%mm1, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
545 "paddw %%mm1, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
546 "paddw %%mm1, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
547 "punpckhwd %%mm0, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
548 "punpckhwd %%mm6, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
549 "punpckhwd %%mm3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
550 "paddw %%mm7, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
551 "paddw %%mm7, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
552 "paddw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
553 /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
554 "packuswb %%mm0, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
555 "packuswb %%mm6, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
556 "packuswb %%mm3, %%mm4 \n\t"\ |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
557 |
18861 | 558 #define YSCALEYUV2RGB1(index, c) REAL_YSCALEYUV2RGB1(index, c) |
559 | |
560 #define REAL_YSCALEYUV2PACKED1b(index, c) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
561 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
562 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
563 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
564 "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
565 "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
566 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\ |
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
567 "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
568 "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
569 "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
570 "psrlw $8, %%mm3 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
571 "psrlw $8, %%mm4 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
572 "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
573 "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
574 "psraw $7, %%mm1 \n\t" \ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
575 "psraw $7, %%mm7 \n\t" |
18861 | 576 #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c) |
23129 | 577 |
18861 | 578 // do vertical chrominance interpolation |
579 #define REAL_YSCALEYUV2RGB1b(index, c) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
580 "xor "#index", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
581 ASMALIGN(4)\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
582 "1: \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
583 "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
584 "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\ |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
585 "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\ |
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
586 "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
587 "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
588 "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
589 "psrlw $5, %%mm3 \n\t" /*FIXME might overflow*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
590 "psrlw $5, %%mm4 \n\t" /*FIXME might overflow*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
591 "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
592 "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
593 "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
594 "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
595 "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
596 "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
597 /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
598 "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
599 "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
600 "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
601 "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
602 "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
603 "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
604 "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
605 "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
606 "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
607 "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
608 /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
609 "paddw %%mm3, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
610 "movq %%mm2, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
611 "movq %%mm5, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
612 "movq %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
613 "punpcklwd %%mm2, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
614 "punpcklwd %%mm5, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
615 "punpcklwd %%mm4, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
616 "paddw %%mm1, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
617 "paddw %%mm1, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
618 "paddw %%mm1, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
619 "punpckhwd %%mm0, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
620 "punpckhwd %%mm6, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
621 "punpckhwd %%mm3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
622 "paddw %%mm7, %%mm0 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
623 "paddw %%mm7, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
624 "paddw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
625 /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
626 "packuswb %%mm0, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
627 "packuswb %%mm6, %%mm5 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
628 "packuswb %%mm3, %%mm4 \n\t"\ |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
629 |
18861 | 630 #define YSCALEYUV2RGB1b(index, c) REAL_YSCALEYUV2RGB1b(index, c) |
631 | |
28976 | 632 #define REAL_YSCALEYUV2RGB1_ALPHA(index) \ |
633 "movq (%1, "#index", 2), %%mm7 \n\t" /* abuf0[index ] */\ | |
634 "movq 8(%1, "#index", 2), %%mm1 \n\t" /* abuf0[index+4] */\ | |
635 "psraw $7, %%mm7 \n\t" /* abuf0[index ] >>7 */\ | |
636 "psraw $7, %%mm1 \n\t" /* abuf0[index+4] >>7 */\ | |
637 "packuswb %%mm1, %%mm7 \n\t" | |
638 #define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index) | |
639 | |
28650
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
640 #define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
641 "movq "#b", "#q2" \n\t" /* B */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
642 "movq "#r", "#t" \n\t" /* R */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
643 "punpcklbw "#g", "#b" \n\t" /* GBGBGBGB 0 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
644 "punpcklbw "#a", "#r" \n\t" /* ARARARAR 0 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
645 "punpckhbw "#g", "#q2" \n\t" /* GBGBGBGB 2 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
646 "punpckhbw "#a", "#t" \n\t" /* ARARARAR 2 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
647 "movq "#b", "#q0" \n\t" /* GBGBGBGB 0 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
648 "movq "#q2", "#q3" \n\t" /* GBGBGBGB 2 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
649 "punpcklwd "#r", "#q0" \n\t" /* ARGBARGB 0 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
650 "punpckhwd "#r", "#b" \n\t" /* ARGBARGB 1 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
651 "punpcklwd "#t", "#q2" \n\t" /* ARGBARGB 2 */\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
652 "punpckhwd "#t", "#q3" \n\t" /* ARGBARGB 3 */\ |
18861 | 653 \ |
28650
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
654 MOVNTQ( q0, (dst, index, 4))\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
655 MOVNTQ( b, 8(dst, index, 4))\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
656 MOVNTQ( q2, 16(dst, index, 4))\ |
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
657 MOVNTQ( q3, 24(dst, index, 4))\ |
18861 | 658 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
659 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
660 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
661 " jb 1b \n\t" |
28650
585b5f224fcd
make MMX registers parametrized in the WRITEBGR32 macro,
stefang
parents:
28520
diff
changeset
|
662 #define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) |
18861 | 663 |
27485 | 664 #define REAL_WRITERGB16(dst, dstw, index) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
665 "pand "MANGLE(bF8)", %%mm2 \n\t" /* B */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
666 "pand "MANGLE(bFC)", %%mm4 \n\t" /* G */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
667 "pand "MANGLE(bF8)", %%mm5 \n\t" /* R */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
668 "psrlq $3, %%mm2 \n\t"\ |
18861 | 669 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
670 "movq %%mm2, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
671 "movq %%mm4, %%mm3 \n\t"\ |
18861 | 672 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
673 "punpcklbw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
674 "punpcklbw %%mm5, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
675 "punpckhbw %%mm7, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
676 "punpckhbw %%mm5, %%mm1 \n\t"\ |
18861 | 677 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
678 "psllq $3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
679 "psllq $3, %%mm4 \n\t"\ |
18861 | 680 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
681 "por %%mm3, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
682 "por %%mm4, %%mm1 \n\t"\ |
18861 | 683 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
684 MOVNTQ(%%mm2, (dst, index, 2))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
685 MOVNTQ(%%mm1, 8(dst, index, 2))\ |
18861 | 686 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
687 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
688 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
689 " jb 1b \n\t" |
27485 | 690 #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index) |
18861 | 691 |
27485 | 692 #define REAL_WRITERGB15(dst, dstw, index) \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
693 "pand "MANGLE(bF8)", %%mm2 \n\t" /* B */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
694 "pand "MANGLE(bF8)", %%mm4 \n\t" /* G */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
695 "pand "MANGLE(bF8)", %%mm5 \n\t" /* R */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
696 "psrlq $3, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
697 "psrlq $1, %%mm5 \n\t"\ |
18861 | 698 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
699 "movq %%mm2, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
700 "movq %%mm4, %%mm3 \n\t"\ |
18861 | 701 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
702 "punpcklbw %%mm7, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
703 "punpcklbw %%mm5, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
704 "punpckhbw %%mm7, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
705 "punpckhbw %%mm5, %%mm1 \n\t"\ |
18861 | 706 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
707 "psllq $2, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
708 "psllq $2, %%mm4 \n\t"\ |
18861 | 709 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
710 "por %%mm3, %%mm2 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
711 "por %%mm4, %%mm1 \n\t"\ |
18861 | 712 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
713 MOVNTQ(%%mm2, (dst, index, 2))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
714 MOVNTQ(%%mm1, 8(dst, index, 2))\ |
18861 | 715 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
716 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
717 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
718 " jb 1b \n\t" |
27485 | 719 #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index) |
18861 | 720 |
721 #define WRITEBGR24OLD(dst, dstw, index) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
722 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
723 "movq %%mm2, %%mm1 \n\t" /* B */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
724 "movq %%mm5, %%mm6 \n\t" /* R */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
725 "punpcklbw %%mm4, %%mm2 \n\t" /* GBGBGBGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
726 "punpcklbw %%mm7, %%mm5 \n\t" /* 0R0R0R0R 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
727 "punpckhbw %%mm4, %%mm1 \n\t" /* GBGBGBGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
728 "punpckhbw %%mm7, %%mm6 \n\t" /* 0R0R0R0R 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
729 "movq %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
730 "movq %%mm1, %%mm3 \n\t" /* GBGBGBGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
731 "punpcklwd %%mm5, %%mm0 \n\t" /* 0RGB0RGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
732 "punpckhwd %%mm5, %%mm2 \n\t" /* 0RGB0RGB 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
733 "punpcklwd %%mm6, %%mm1 \n\t" /* 0RGB0RGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
734 "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */\ |
18861 | 735 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
736 "movq %%mm0, %%mm4 \n\t" /* 0RGB0RGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
737 "psrlq $8, %%mm0 \n\t" /* 00RGB0RG 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
738 "pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
739 "pand "MANGLE(bm11111000)", %%mm0 \n\t" /* 00RGB000 0.5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
740 "por %%mm4, %%mm0 \n\t" /* 00RGBRGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
741 "movq %%mm2, %%mm4 \n\t" /* 0RGB0RGB 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
742 "psllq $48, %%mm2 \n\t" /* GB000000 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
743 "por %%mm2, %%mm0 \n\t" /* GBRGBRGB 0 */\ |
18861 | 744 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
745 "movq %%mm4, %%mm2 \n\t" /* 0RGB0RGB 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
746 "psrld $16, %%mm4 \n\t" /* 000R000R 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
747 "psrlq $24, %%mm2 \n\t" /* 0000RGB0 1.5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
748 "por %%mm4, %%mm2 \n\t" /* 000RRGBR 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
749 "pand "MANGLE(bm00001111)", %%mm2 \n\t" /* 0000RGBR 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
750 "movq %%mm1, %%mm4 \n\t" /* 0RGB0RGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
751 "psrlq $8, %%mm1 \n\t" /* 00RGB0RG 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
752 "pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
753 "pand "MANGLE(bm11111000)", %%mm1 \n\t" /* 00RGB000 2.5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
754 "por %%mm4, %%mm1 \n\t" /* 00RGBRGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
755 "movq %%mm1, %%mm4 \n\t" /* 00RGBRGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
756 "psllq $32, %%mm1 \n\t" /* BRGB0000 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
757 "por %%mm1, %%mm2 \n\t" /* BRGBRGBR 1 */\ |
18861 | 758 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
759 "psrlq $32, %%mm4 \n\t" /* 000000RG 2.5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
760 "movq %%mm3, %%mm5 \n\t" /* 0RGB0RGB 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
761 "psrlq $8, %%mm3 \n\t" /* 00RGB0RG 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
762 "pand "MANGLE(bm00000111)", %%mm5 \n\t" /* 00000RGB 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
763 "pand "MANGLE(bm11111000)", %%mm3 \n\t" /* 00RGB000 3.5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
764 "por %%mm5, %%mm3 \n\t" /* 00RGBRGB 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
765 "psllq $16, %%mm3 \n\t" /* RGBRGB00 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
766 "por %%mm4, %%mm3 \n\t" /* RGBRGBRG 2.5 */\ |
18861 | 767 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
768 MOVNTQ(%%mm0, (dst))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
769 MOVNTQ(%%mm2, 8(dst))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
770 MOVNTQ(%%mm3, 16(dst))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
771 "add $24, "#dst" \n\t"\ |
18861 | 772 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
773 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
774 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
775 " jb 1b \n\t" |
18861 | 776 |
777 #define WRITEBGR24MMX(dst, dstw, index) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
778 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
779 "movq %%mm2, %%mm1 \n\t" /* B */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
780 "movq %%mm5, %%mm6 \n\t" /* R */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
781 "punpcklbw %%mm4, %%mm2 \n\t" /* GBGBGBGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
782 "punpcklbw %%mm7, %%mm5 \n\t" /* 0R0R0R0R 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
783 "punpckhbw %%mm4, %%mm1 \n\t" /* GBGBGBGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
784 "punpckhbw %%mm7, %%mm6 \n\t" /* 0R0R0R0R 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
785 "movq %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
786 "movq %%mm1, %%mm3 \n\t" /* GBGBGBGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
787 "punpcklwd %%mm5, %%mm0 \n\t" /* 0RGB0RGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
788 "punpckhwd %%mm5, %%mm2 \n\t" /* 0RGB0RGB 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
789 "punpcklwd %%mm6, %%mm1 \n\t" /* 0RGB0RGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
790 "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */\ |
18861 | 791 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
792 "movq %%mm0, %%mm4 \n\t" /* 0RGB0RGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
793 "movq %%mm2, %%mm6 \n\t" /* 0RGB0RGB 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
794 "movq %%mm1, %%mm5 \n\t" /* 0RGB0RGB 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
795 "movq %%mm3, %%mm7 \n\t" /* 0RGB0RGB 3 */\ |
18861 | 796 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
797 "psllq $40, %%mm0 \n\t" /* RGB00000 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
798 "psllq $40, %%mm2 \n\t" /* RGB00000 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
799 "psllq $40, %%mm1 \n\t" /* RGB00000 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
800 "psllq $40, %%mm3 \n\t" /* RGB00000 3 */\ |
18861 | 801 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
802 "punpckhdq %%mm4, %%mm0 \n\t" /* 0RGBRGB0 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
803 "punpckhdq %%mm6, %%mm2 \n\t" /* 0RGBRGB0 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
804 "punpckhdq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
805 "punpckhdq %%mm7, %%mm3 \n\t" /* 0RGBRGB0 3 */\ |
18861 | 806 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
807 "psrlq $8, %%mm0 \n\t" /* 00RGBRGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
808 "movq %%mm2, %%mm6 \n\t" /* 0RGBRGB0 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
809 "psllq $40, %%mm2 \n\t" /* GB000000 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
810 "por %%mm2, %%mm0 \n\t" /* GBRGBRGB 0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
811 MOVNTQ(%%mm0, (dst))\ |
18861 | 812 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
813 "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
814 "movq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
815 "psllq $24, %%mm1 \n\t" /* BRGB0000 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
816 "por %%mm1, %%mm6 \n\t" /* BRGBRGBR 1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
817 MOVNTQ(%%mm6, 8(dst))\ |
18861 | 818 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
819 "psrlq $40, %%mm5 \n\t" /* 000000RG 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
820 "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
821 "por %%mm3, %%mm5 \n\t" /* RGBRGBRG 2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
822 MOVNTQ(%%mm5, 16(dst))\ |
18861 | 823 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
824 "add $24, "#dst" \n\t"\ |
18861 | 825 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
826 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
827 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
828 " jb 1b \n\t" |
18861 | 829 |
830 #define WRITEBGR24MMX2(dst, dstw, index) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
831 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\ |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25752
diff
changeset
|
832 "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\ |
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25752
diff
changeset
|
833 "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
834 "pshufw $0x50, %%mm2, %%mm1 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
835 "pshufw $0x50, %%mm4, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
836 "pshufw $0x00, %%mm5, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */\ |
18861 | 837 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
838 "pand %%mm0, %%mm1 \n\t" /* B2 B1 B0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
839 "pand %%mm0, %%mm3 \n\t" /* G2 G1 G0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
840 "pand %%mm7, %%mm6 \n\t" /* R1 R0 */\ |
18861 | 841 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
842 "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
843 "por %%mm1, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
844 "por %%mm3, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
845 MOVNTQ(%%mm6, (dst))\ |
18861 | 846 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
847 "psrlq $8, %%mm4 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
848 "pshufw $0xA5, %%mm2, %%mm1 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
849 "pshufw $0x55, %%mm4, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
850 "pshufw $0xA5, %%mm5, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */\ |
18861 | 851 \ |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25752
diff
changeset
|
852 "pand "MANGLE(ff_M24B)", %%mm1 \n\t" /* B5 B4 B3 */\ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
853 "pand %%mm7, %%mm3 \n\t" /* G4 G3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
854 "pand %%mm0, %%mm6 \n\t" /* R4 R3 R2 */\ |
18861 | 855 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
856 "por %%mm1, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
857 "por %%mm3, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
858 MOVNTQ(%%mm6, 8(dst))\ |
18861 | 859 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
860 "pshufw $0xFF, %%mm2, %%mm1 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
861 "pshufw $0xFA, %%mm4, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
862 "pshufw $0xFA, %%mm5, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */\ |
18861 | 863 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
864 "pand %%mm7, %%mm1 \n\t" /* B7 B6 */\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
865 "pand %%mm0, %%mm3 \n\t" /* G7 G6 G5 */\ |
25882
2ad528dd42a0
Make some assembler constants global instead of declaring them multiple times.
reimar
parents:
25752
diff
changeset
|
866 "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7 R6 R5 */\ |
18861 | 867 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
868 "por %%mm1, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
869 "por %%mm3, %%mm6 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
870 MOVNTQ(%%mm6, 16(dst))\ |
18861 | 871 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
872 "add $24, "#dst" \n\t"\ |
18861 | 873 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
874 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
875 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
876 " jb 1b \n\t" |
18861 | 877 |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
878 #if COMPILE_TEMPLATE_MMX2 |
18861 | 879 #undef WRITEBGR24 |
880 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index) | |
881 #else | |
882 #undef WRITEBGR24 | |
883 #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index) | |
884 #endif | |
885 | |
886 #define REAL_WRITEYUY2(dst, dstw, index) \ | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
887 "packuswb %%mm3, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
888 "packuswb %%mm4, %%mm4 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
889 "packuswb %%mm7, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
890 "punpcklbw %%mm4, %%mm3 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
891 "movq %%mm1, %%mm7 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
892 "punpcklbw %%mm3, %%mm1 \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
893 "punpckhbw %%mm3, %%mm7 \n\t"\ |
18861 | 894 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
895 MOVNTQ(%%mm1, (dst, index, 2))\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
896 MOVNTQ(%%mm7, 8(dst, index, 2))\ |
18861 | 897 \ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
898 "add $8, "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
899 "cmp "#dstw", "#index" \n\t"\ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
900 " jb 1b \n\t" |
18861 | 901 #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index) |
902 | |
903 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
904 static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
905 const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, |
28976 | 906 uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW) |
18861 | 907 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
908 #if COMPILE_TEMPLATE_MMX |
29481 | 909 if(!(c->flags & SWS_BITEXACT)) { |
910 if (c->flags & SWS_ACCURATE_RND) { | |
911 if (uDest) { | |
27568 | 912 YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) |
913 YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) | |
914 } | |
29481 | 915 if (CONFIG_SWSCALE_ALPHA && aDest) { |
28976 | 916 YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) |
917 } | |
18861 | 918 |
27568 | 919 YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) |
29481 | 920 } else { |
921 if (uDest) { | |
27568 | 922 YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) |
923 YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) | |
924 } | |
29481 | 925 if (CONFIG_SWSCALE_ALPHA && aDest) { |
28976 | 926 YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) |
927 } | |
27568 | 928 |
929 YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
930 } |
27565
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
931 return; |
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
932 } |
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
933 #endif |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
934 #if COMPILE_TEMPLATE_ALTIVEC |
29480 | 935 yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, |
936 chrFilter, chrSrc, chrFilterSize, | |
937 dest, uDest, vDest, dstW, chrDstW); | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
938 #else //COMPILE_TEMPLATE_ALTIVEC |
29480 | 939 yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, |
940 chrFilter, chrSrc, chrFilterSize, | |
941 alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
942 #endif //!COMPILE_TEMPLATE_ALTIVEC |
18861 | 943 } |
944 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
945 static inline void RENAME(yuv2nv12X)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
946 const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, |
29815
3e8bf15f96d6
Use enum PixelFormat instead of int for srcFormat and dstFormat.
cehoyos
parents:
29659
diff
changeset
|
947 uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, enum PixelFormat dstFormat) |
18861 | 948 { |
29480 | 949 yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize, |
950 chrFilter, chrSrc, chrFilterSize, | |
951 dest, uDest, dstW, chrDstW, dstFormat); | |
18861 | 952 } |
953 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
954 static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc, |
28976 | 955 uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW) |
18861 | 956 { |
27565
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
957 int i; |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
958 #if COMPILE_TEMPLATE_MMX |
29481 | 959 if(!(c->flags & SWS_BITEXACT)) { |
28976 | 960 long p= 4; |
961 uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; | |
962 uint8_t *dst[4]= {aDest, dest, uDest, vDest}; | |
963 x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW}; | |
27288 | 964 |
29481 | 965 if (c->flags & SWS_ACCURATE_RND) { |
966 while(p--) { | |
967 if (dst[p]) { | |
28979 | 968 __asm__ volatile( |
969 YSCALEYUV2YV121_ACCURATE | |
970 :: "r" (src[p]), "r" (dst[p] + counter[p]), | |
971 "g" (-counter[p]) | |
972 : "%"REG_a | |
973 ); | |
974 } | |
28976 | 975 } |
29481 | 976 } else { |
977 while(p--) { | |
978 if (dst[p]) { | |
28979 | 979 __asm__ volatile( |
980 YSCALEYUV2YV121 | |
981 :: "r" (src[p]), "r" (dst[p] + counter[p]), | |
982 "g" (-counter[p]) | |
983 : "%"REG_a | |
984 ); | |
985 } | |
28976 | 986 } |
27289
2c9fa9b25781
Forgotten accurate rounding function YSCALEYUV2YV121_ACCURATE.
michael
parents:
27288
diff
changeset
|
987 } |
27565
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
988 return; |
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
989 } |
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
990 #endif |
29481 | 991 for (i=0; i<dstW; i++) { |
27291
ca46d66b3143
Make C code in yuv2yuv1() do accurate rounding, this could be split
michael
parents:
27290
diff
changeset
|
992 int val= (lumSrc[i]+64)>>7; |
23129 | 993 |
29481 | 994 if (val&256) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
995 if (val<0) val=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
996 else val=255; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
997 } |
18861 | 998 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
999 dest[i]= val; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1000 } |
18861 | 1001 |
25752
559b0e9d47fb
Change (a == NULL) condition to (!a) and (a != NULL) condition to (a).
benoit
parents:
25749
diff
changeset
|
1002 if (uDest) |
29481 | 1003 for (i=0; i<chrDstW; i++) { |
27291
ca46d66b3143
Make C code in yuv2yuv1() do accurate rounding, this could be split
michael
parents:
27290
diff
changeset
|
1004 int u=(chrSrc[i ]+64)>>7; |
ca46d66b3143
Make C code in yuv2yuv1() do accurate rounding, this could be split
michael
parents:
27290
diff
changeset
|
1005 int v=(chrSrc[i + VOFW]+64)>>7; |
18861 | 1006 |
29481 | 1007 if ((u|v)&256) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1008 if (u<0) u=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1009 else if (u>255) u=255; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1010 if (v<0) v=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1011 else if (v>255) v=255; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1012 } |
18861 | 1013 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1014 uDest[i]= u; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1015 vDest[i]= v; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1016 } |
28976 | 1017 |
1018 if (CONFIG_SWSCALE_ALPHA && aDest) | |
29481 | 1019 for (i=0; i<dstW; i++) { |
28976 | 1020 int val= (alpSrc[i]+64)>>7; |
1021 aDest[i]= av_clip_uint8(val); | |
1022 } | |
18861 | 1023 } |
1024 | |
1025 | |
1026 /** | |
1027 * vertical scale YV12 to RGB | |
1028 */ | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1029 static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1030 const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1031 const int16_t **alpSrc, uint8_t *dest, long dstW, long dstY) |
18861 | 1032 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1033 #if COMPILE_TEMPLATE_MMX |
28957 | 1034 x86_reg dummy=0; |
29481 | 1035 if(!(c->flags & SWS_BITEXACT)) { |
1036 if (c->flags & SWS_ACCURATE_RND) { | |
1037 switch(c->dstFormat) { | |
27568 | 1038 case PIX_FMT_RGB32: |
29481 | 1039 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
28976 | 1040 YSCALEYUV2PACKEDX_ACCURATE |
1041 YSCALEYUV2RGBX | |
1042 "movq %%mm2, "U_TEMP"(%0) \n\t" | |
1043 "movq %%mm4, "V_TEMP"(%0) \n\t" | |
1044 "movq %%mm5, "Y_TEMP"(%0) \n\t" | |
1045 YSCALEYUV2PACKEDX_ACCURATE_YA(ALP_MMX_FILTER_OFFSET) | |
1046 "movq "Y_TEMP"(%0), %%mm5 \n\t" | |
1047 "psraw $3, %%mm1 \n\t" | |
1048 "psraw $3, %%mm7 \n\t" | |
1049 "packuswb %%mm7, %%mm1 \n\t" | |
1050 WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6) | |
1051 | |
1052 YSCALEYUV2PACKEDX_END | |
29481 | 1053 } else { |
28979 | 1054 YSCALEYUV2PACKEDX_ACCURATE |
1055 YSCALEYUV2RGBX | |
1056 "pcmpeqd %%mm7, %%mm7 \n\t" | |
1057 WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1058 |
28979 | 1059 YSCALEYUV2PACKEDX_END |
28976 | 1060 } |
27568 | 1061 return; |
1062 case PIX_FMT_BGR24: | |
1063 YSCALEYUV2PACKEDX_ACCURATE | |
1064 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1065 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1066 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize |
1067 "add %4, %%"REG_c" \n\t" | |
1068 WRITEBGR24(%%REGc, %5, %%REGa) | |
19173 | 1069 |
1070 | |
27568 | 1071 :: "r" (&c->redDither), |
1072 "m" (dummy), "m" (dummy), "m" (dummy), | |
1073 "r" (dest), "m" (dstW) | |
1074 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S | |
1075 ); | |
1076 return; | |
1077 case PIX_FMT_RGB555: | |
1078 YSCALEYUV2PACKEDX_ACCURATE | |
1079 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1080 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1081 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
19173 | 1082 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1083 "paddusb "BLUE_DITHER"(%0), %%mm2\n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1084 "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1085 "paddusb "RED_DITHER"(%0), %%mm5\n\t" |
19173 | 1086 #endif |
1087 | |
27568 | 1088 WRITERGB15(%4, %5, %%REGa) |
1089 YSCALEYUV2PACKEDX_END | |
1090 return; | |
1091 case PIX_FMT_RGB565: | |
1092 YSCALEYUV2PACKEDX_ACCURATE | |
1093 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1094 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1095 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
19173 | 1096 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1097 "paddusb "BLUE_DITHER"(%0), %%mm2\n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1098 "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1099 "paddusb "RED_DITHER"(%0), %%mm5\n\t" |
19173 | 1100 #endif |
1101 | |
27568 | 1102 WRITERGB16(%4, %5, %%REGa) |
1103 YSCALEYUV2PACKEDX_END | |
1104 return; | |
1105 case PIX_FMT_YUYV422: | |
1106 YSCALEYUV2PACKEDX_ACCURATE | |
1107 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
19173 | 1108 |
27568 | 1109 "psraw $3, %%mm3 \n\t" |
1110 "psraw $3, %%mm4 \n\t" | |
1111 "psraw $3, %%mm1 \n\t" | |
1112 "psraw $3, %%mm7 \n\t" | |
1113 WRITEYUY2(%4, %5, %%REGa) | |
1114 YSCALEYUV2PACKEDX_END | |
1115 return; | |
1116 } | |
29481 | 1117 } else { |
1118 switch(c->dstFormat) { | |
27568 | 1119 case PIX_FMT_RGB32: |
29481 | 1120 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
28976 | 1121 YSCALEYUV2PACKEDX |
1122 YSCALEYUV2RGBX | |
1123 YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7) | |
1124 "psraw $3, %%mm1 \n\t" | |
1125 "psraw $3, %%mm7 \n\t" | |
1126 "packuswb %%mm7, %%mm1 \n\t" | |
1127 WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) | |
1128 YSCALEYUV2PACKEDX_END | |
29481 | 1129 } else { |
28979 | 1130 YSCALEYUV2PACKEDX |
1131 YSCALEYUV2RGBX | |
1132 "pcmpeqd %%mm7, %%mm7 \n\t" | |
1133 WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1134 YSCALEYUV2PACKEDX_END | |
28976 | 1135 } |
27568 | 1136 return; |
1137 case PIX_FMT_BGR24: | |
1138 YSCALEYUV2PACKEDX | |
1139 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1140 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1141 "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize |
1142 "add %4, %%"REG_c" \n\t" | |
1143 WRITEBGR24(%%REGc, %5, %%REGa) | |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1144 |
27568 | 1145 :: "r" (&c->redDither), |
1146 "m" (dummy), "m" (dummy), "m" (dummy), | |
1147 "r" (dest), "m" (dstW) | |
1148 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S | |
1149 ); | |
1150 return; | |
1151 case PIX_FMT_RGB555: | |
1152 YSCALEYUV2PACKEDX | |
1153 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1154 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1155 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1156 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1157 "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1158 "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1159 "paddusb "RED_DITHER"(%0), %%mm5 \n\t" |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1160 #endif |
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1161 |
27568 | 1162 WRITERGB15(%4, %5, %%REGa) |
1163 YSCALEYUV2PACKEDX_END | |
1164 return; | |
1165 case PIX_FMT_RGB565: | |
1166 YSCALEYUV2PACKEDX | |
1167 YSCALEYUV2RGBX | |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1168 "pxor %%mm7, %%mm7 \n\t" |
27568 | 1169 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1170 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1171 "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1172 "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1173 "paddusb "RED_DITHER"(%0), %%mm5 \n\t" |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1174 #endif |
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1175 |
27568 | 1176 WRITERGB16(%4, %5, %%REGa) |
1177 YSCALEYUV2PACKEDX_END | |
1178 return; | |
1179 case PIX_FMT_YUYV422: | |
1180 YSCALEYUV2PACKEDX | |
1181 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
18861 | 1182 |
27568 | 1183 "psraw $3, %%mm3 \n\t" |
1184 "psraw $3, %%mm4 \n\t" | |
1185 "psraw $3, %%mm1 \n\t" | |
1186 "psraw $3, %%mm7 \n\t" | |
1187 WRITEYUY2(%4, %5, %%REGa) | |
1188 YSCALEYUV2PACKEDX_END | |
1189 return; | |
1190 } | |
19172
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1191 } |
bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
michael
parents:
18861
diff
changeset
|
1192 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1193 #endif /* COMPILE_TEMPLATE_MMX */ |
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1194 #if COMPILE_TEMPLATE_ALTIVEC |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1195 /* The following list of supported dstFormat values should |
28953
1e56ea9937ce
Consistently use ff_ prefixes for internal symbols.
diego
parents:
28908
diff
changeset
|
1196 match what's found in the body of ff_yuv2packedX_altivec() */ |
28980 | 1197 if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf && |
29480 | 1198 (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA || |
1199 c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 || | |
1200 c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB)) | |
28953
1e56ea9937ce
Consistently use ff_ prefixes for internal symbols.
diego
parents:
28908
diff
changeset
|
1201 ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize, |
1e56ea9937ce
Consistently use ff_ prefixes for internal symbols.
diego
parents:
28908
diff
changeset
|
1202 chrFilter, chrSrc, chrFilterSize, |
1e56ea9937ce
Consistently use ff_ prefixes for internal symbols.
diego
parents:
28908
diff
changeset
|
1203 dest, dstW, dstY); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1204 else |
18861 | 1205 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1206 yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1207 chrFilter, chrSrc, chrFilterSize, |
28976 | 1208 alpSrc, dest, dstW, dstY); |
18861 | 1209 } |
1210 | |
1211 /** | |
1212 * vertical bilinear scale YV12 to RGB | |
1213 */ | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1214 static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *uvbuf0, const uint16_t *uvbuf1, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1215 const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) |
18861 | 1216 { |
27542
090bf8535df8
Make the 2point linear interpolation coefficients correct even for the
michael
parents:
27541
diff
changeset
|
1217 int yalpha1=4095- yalpha; |
090bf8535df8
Make the 2point linear interpolation coefficients correct even for the
michael
parents:
27541
diff
changeset
|
1218 int uvalpha1=4095-uvalpha; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1219 int i; |
18861 | 1220 |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1221 #if COMPILE_TEMPLATE_MMX |
29481 | 1222 if(!(c->flags & SWS_BITEXACT)) { |
1223 switch(c->dstFormat) { | |
29482 | 1224 //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( |
1225 case PIX_FMT_RGB32: | |
1226 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { | |
28976 | 1227 #if ARCH_X86_64 |
29482 | 1228 __asm__ volatile( |
30118
cdec8d3a2225
Do not needlessly use the BP register in x86_64-specific code, there are
reimar
parents:
30090
diff
changeset
|
1229 YSCALEYUV2RGB(%%r8, %5) |
cdec8d3a2225
Do not needlessly use the BP register in x86_64-specific code, there are
reimar
parents:
30090
diff
changeset
|
1230 YSCALEYUV2RGB_YA(%%r8, %5, %6, %7) |
28976 | 1231 "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ |
1232 "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ | |
1233 "packuswb %%mm7, %%mm1 \n\t" | |
30118
cdec8d3a2225
Do not needlessly use the BP register in x86_64-specific code, there are
reimar
parents:
30090
diff
changeset
|
1234 WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) |
28976 | 1235 |
28981
e975109ff839
Do _not_ use rbx on x86_64, it will fail to compile with PIC, besides it
reimar
parents:
28980
diff
changeset
|
1236 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "r" (dest), |
28976 | 1237 "a" (&c->redDither) |
1238 ,"r" (abuf0), "r" (abuf1) | |
30118
cdec8d3a2225
Do not needlessly use the BP register in x86_64-specific code, there are
reimar
parents:
30090
diff
changeset
|
1239 : "%r8" |
29482 | 1240 ); |
28976 | 1241 #else |
29482 | 1242 *(uint16_t **)(&c->u_temp)=abuf0; |
1243 *(uint16_t **)(&c->v_temp)=abuf1; | |
1244 __asm__ volatile( | |
28976 | 1245 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1246 "mov %4, %%"REG_b" \n\t" | |
1247 "push %%"REG_BP" \n\t" | |
1248 YSCALEYUV2RGB(%%REGBP, %5) | |
1249 "push %0 \n\t" | |
1250 "push %1 \n\t" | |
1251 "mov "U_TEMP"(%5), %0 \n\t" | |
1252 "mov "V_TEMP"(%5), %1 \n\t" | |
1253 YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1) | |
1254 "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ | |
1255 "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ | |
1256 "packuswb %%mm7, %%mm1 \n\t" | |
1257 "pop %1 \n\t" | |
1258 "pop %0 \n\t" | |
1259 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) | |
1260 "pop %%"REG_BP" \n\t" | |
1261 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
1262 | |
1263 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), | |
1264 "a" (&c->redDither) | |
29482 | 1265 ); |
28976 | 1266 #endif |
29482 | 1267 } else { |
1268 __asm__ volatile( | |
28979 | 1269 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1270 "mov %4, %%"REG_b" \n\t" | |
1271 "push %%"REG_BP" \n\t" | |
1272 YSCALEYUV2RGB(%%REGBP, %5) | |
1273 "pcmpeqd %%mm7, %%mm7 \n\t" | |
1274 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1275 "pop %%"REG_BP" \n\t" | |
1276 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1277 |
28979 | 1278 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1279 "a" (&c->redDither) | |
29482 | 1280 ); |
1281 } | |
1282 return; | |
1283 case PIX_FMT_BGR24: | |
1284 __asm__ volatile( | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1285 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1286 "mov %4, %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1287 "push %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1288 YSCALEYUV2RGB(%%REGBP, %5) |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1289 "pxor %%mm7, %%mm7 \n\t" |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1290 WRITEBGR24(%%REGb, 8280(%5), %%REGBP) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1291 "pop %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1292 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1293 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1294 "a" (&c->redDither) |
29482 | 1295 ); |
1296 return; | |
1297 case PIX_FMT_RGB555: | |
1298 __asm__ volatile( | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1299 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1300 "mov %4, %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1301 "push %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1302 YSCALEYUV2RGB(%%REGBP, %5) |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1303 "pxor %%mm7, %%mm7 \n\t" |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1304 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
18861 | 1305 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1306 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1307 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1308 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" |
18861 | 1309 #endif |
1310 | |
27485 | 1311 WRITERGB15(%%REGb, 8280(%5), %%REGBP) |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1312 "pop %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1313 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" |
18861 | 1314 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1315 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1316 "a" (&c->redDither) |
29482 | 1317 ); |
1318 return; | |
1319 case PIX_FMT_RGB565: | |
1320 __asm__ volatile( | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1321 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1322 "mov %4, %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1323 "push %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1324 YSCALEYUV2RGB(%%REGBP, %5) |
28652
cc44b3827a6f
move zeroing of alpha channel register out of YSCALEYUV2xxx macros,
stefang
parents:
28651
diff
changeset
|
1325 "pxor %%mm7, %%mm7 \n\t" |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1326 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ |
18861 | 1327 #ifdef DITHER1XBPP |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1328 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1329 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
1330 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" |
18861 | 1331 #endif |
1332 | |
27485 | 1333 WRITERGB16(%%REGb, 8280(%5), %%REGBP) |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1334 "pop %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1335 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1336 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1337 "a" (&c->redDither) |
29482 | 1338 ); |
1339 return; | |
1340 case PIX_FMT_YUYV422: | |
1341 __asm__ volatile( | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1342 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1343 "mov %4, %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1344 "push %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1345 YSCALEYUV2PACKED(%%REGBP, %5) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1346 WRITEYUY2(%%REGb, 8280(%5), %%REGBP) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1347 "pop %%"REG_BP" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1348 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1349 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1350 "a" (&c->redDither) |
29482 | 1351 ); |
1352 return; | |
1353 default: break; | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1354 } |
27565
5ff11e5336e1
Disable mmx routines that are not bitexact when the user wants
michael
parents:
27564
diff
changeset
|
1355 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1356 #endif //COMPILE_TEMPLATE_MMX |
29480 | 1357 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C(void,0), YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C) |
18861 | 1358 } |
1359 | |
1360 /** | |
1361 * YV12 to RGB without scaling or interpolating | |
1362 */ | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1363 static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1, |
29815
3e8bf15f96d6
Use enum PixelFormat instead of int for srcFormat and dstFormat.
cehoyos
parents:
29659
diff
changeset
|
1364 const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y) |
18861 | 1365 { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1366 const int yalpha1=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1367 int i; |
23129 | 1368 |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1369 const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1370 const int yalpha= 4096; //FIXME ... |
18861 | 1371 |
29481 | 1372 if (flags&SWS_FULL_CHR_H_INT) { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
1373 c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1374 return; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1375 } |
18861 | 1376 |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1377 #if COMPILE_TEMPLATE_MMX |
29481 | 1378 if(!(flags & SWS_BITEXACT)) { |
1379 if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster | |
1380 switch(dstFormat) { | |
27568 | 1381 case PIX_FMT_RGB32: |
29481 | 1382 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
28976 | 1383 __asm__ volatile( |
29482 | 1384 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1385 "mov %4, %%"REG_b" \n\t" | |
1386 "push %%"REG_BP" \n\t" | |
1387 YSCALEYUV2RGB1(%%REGBP, %5) | |
1388 YSCALEYUV2RGB1_ALPHA(%%REGBP) | |
1389 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1390 "pop %%"REG_BP" \n\t" | |
1391 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
28976 | 1392 |
29482 | 1393 :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1394 "a" (&c->redDither) | |
28976 | 1395 ); |
29481 | 1396 } else { |
28979 | 1397 __asm__ volatile( |
29482 | 1398 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1399 "mov %4, %%"REG_b" \n\t" | |
1400 "push %%"REG_BP" \n\t" | |
1401 YSCALEYUV2RGB1(%%REGBP, %5) | |
1402 "pcmpeqd %%mm7, %%mm7 \n\t" | |
1403 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1404 "pop %%"REG_BP" \n\t" | |
1405 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1406 |
29482 | 1407 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1408 "a" (&c->redDither) | |
28979 | 1409 ); |
28976 | 1410 } |
27568 | 1411 return; |
1412 case PIX_FMT_BGR24: | |
27744 | 1413 __asm__ volatile( |
29482 | 1414 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1415 "mov %4, %%"REG_b" \n\t" | |
1416 "push %%"REG_BP" \n\t" | |
1417 YSCALEYUV2RGB1(%%REGBP, %5) | |
1418 "pxor %%mm7, %%mm7 \n\t" | |
1419 WRITEBGR24(%%REGb, 8280(%5), %%REGBP) | |
1420 "pop %%"REG_BP" \n\t" | |
1421 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1422 |
29482 | 1423 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1424 "a" (&c->redDither) | |
27568 | 1425 ); |
1426 return; | |
1427 case PIX_FMT_RGB555: | |
27744 | 1428 __asm__ volatile( |
29482 | 1429 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1430 "mov %4, %%"REG_b" \n\t" | |
1431 "push %%"REG_BP" \n\t" | |
1432 YSCALEYUV2RGB1(%%REGBP, %5) | |
1433 "pxor %%mm7, %%mm7 \n\t" | |
1434 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
18861 | 1435 #ifdef DITHER1XBPP |
29482 | 1436 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
1437 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" | |
1438 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" | |
18861 | 1439 #endif |
29482 | 1440 WRITERGB15(%%REGb, 8280(%5), %%REGBP) |
1441 "pop %%"REG_BP" \n\t" | |
1442 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1443 |
29482 | 1444 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1445 "a" (&c->redDither) | |
27568 | 1446 ); |
1447 return; | |
1448 case PIX_FMT_RGB565: | |
27744 | 1449 __asm__ volatile( |
29482 | 1450 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1451 "mov %4, %%"REG_b" \n\t" | |
1452 "push %%"REG_BP" \n\t" | |
1453 YSCALEYUV2RGB1(%%REGBP, %5) | |
1454 "pxor %%mm7, %%mm7 \n\t" | |
1455 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
18861 | 1456 #ifdef DITHER1XBPP |
29482 | 1457 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
1458 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" | |
1459 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" | |
18861 | 1460 #endif |
1461 | |
29482 | 1462 WRITERGB16(%%REGb, 8280(%5), %%REGBP) |
1463 "pop %%"REG_BP" \n\t" | |
1464 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1465 |
29482 | 1466 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1467 "a" (&c->redDither) | |
27568 | 1468 ); |
1469 return; | |
1470 case PIX_FMT_YUYV422: | |
27744 | 1471 __asm__ volatile( |
29482 | 1472 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1473 "mov %4, %%"REG_b" \n\t" | |
1474 "push %%"REG_BP" \n\t" | |
1475 YSCALEYUV2PACKED1(%%REGBP, %5) | |
1476 WRITEYUY2(%%REGb, 8280(%5), %%REGBP) | |
1477 "pop %%"REG_BP" \n\t" | |
1478 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1479 |
29482 | 1480 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1481 "a" (&c->redDither) | |
27568 | 1482 ); |
1483 return; | |
1484 } | |
29481 | 1485 } else { |
1486 switch(dstFormat) { | |
27568 | 1487 case PIX_FMT_RGB32: |
29481 | 1488 if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { |
28976 | 1489 __asm__ volatile( |
29482 | 1490 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1491 "mov %4, %%"REG_b" \n\t" | |
1492 "push %%"REG_BP" \n\t" | |
1493 YSCALEYUV2RGB1b(%%REGBP, %5) | |
1494 YSCALEYUV2RGB1_ALPHA(%%REGBP) | |
1495 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1496 "pop %%"REG_BP" \n\t" | |
1497 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
28976 | 1498 |
29482 | 1499 :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1500 "a" (&c->redDither) | |
28976 | 1501 ); |
29481 | 1502 } else { |
28979 | 1503 __asm__ volatile( |
29482 | 1504 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1505 "mov %4, %%"REG_b" \n\t" | |
1506 "push %%"REG_BP" \n\t" | |
1507 YSCALEYUV2RGB1b(%%REGBP, %5) | |
1508 "pcmpeqd %%mm7, %%mm7 \n\t" | |
1509 WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) | |
1510 "pop %%"REG_BP" \n\t" | |
1511 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1512 |
29482 | 1513 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1514 "a" (&c->redDither) | |
28979 | 1515 ); |
28976 | 1516 } |
27568 | 1517 return; |
1518 case PIX_FMT_BGR24: | |
27744 | 1519 __asm__ volatile( |
29482 | 1520 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1521 "mov %4, %%"REG_b" \n\t" | |
1522 "push %%"REG_BP" \n\t" | |
1523 YSCALEYUV2RGB1b(%%REGBP, %5) | |
1524 "pxor %%mm7, %%mm7 \n\t" | |
1525 WRITEBGR24(%%REGb, 8280(%5), %%REGBP) | |
1526 "pop %%"REG_BP" \n\t" | |
1527 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1528 |
29482 | 1529 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1530 "a" (&c->redDither) | |
27568 | 1531 ); |
1532 return; | |
1533 case PIX_FMT_RGB555: | |
27744 | 1534 __asm__ volatile( |
29482 | 1535 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1536 "mov %4, %%"REG_b" \n\t" | |
1537 "push %%"REG_BP" \n\t" | |
1538 YSCALEYUV2RGB1b(%%REGBP, %5) | |
1539 "pxor %%mm7, %%mm7 \n\t" | |
1540 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
18861 | 1541 #ifdef DITHER1XBPP |
29482 | 1542 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
1543 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" | |
1544 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" | |
18861 | 1545 #endif |
29482 | 1546 WRITERGB15(%%REGb, 8280(%5), %%REGBP) |
1547 "pop %%"REG_BP" \n\t" | |
1548 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1549 |
29482 | 1550 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1551 "a" (&c->redDither) | |
27568 | 1552 ); |
1553 return; | |
1554 case PIX_FMT_RGB565: | |
27744 | 1555 __asm__ volatile( |
29482 | 1556 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1557 "mov %4, %%"REG_b" \n\t" | |
1558 "push %%"REG_BP" \n\t" | |
1559 YSCALEYUV2RGB1b(%%REGBP, %5) | |
1560 "pxor %%mm7, %%mm7 \n\t" | |
1561 /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */ | |
18861 | 1562 #ifdef DITHER1XBPP |
29482 | 1563 "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t" |
1564 "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" | |
1565 "paddusb "RED_DITHER"(%5), %%mm5 \n\t" | |
18861 | 1566 #endif |
1567 | |
29482 | 1568 WRITERGB16(%%REGb, 8280(%5), %%REGBP) |
1569 "pop %%"REG_BP" \n\t" | |
1570 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1571 |
29482 | 1572 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1573 "a" (&c->redDither) | |
27568 | 1574 ); |
1575 return; | |
1576 case PIX_FMT_YUYV422: | |
27744 | 1577 __asm__ volatile( |
29482 | 1578 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1579 "mov %4, %%"REG_b" \n\t" | |
1580 "push %%"REG_BP" \n\t" | |
1581 YSCALEYUV2PACKED1b(%%REGBP, %5) | |
1582 WRITEYUY2(%%REGb, 8280(%5), %%REGBP) | |
1583 "pop %%"REG_BP" \n\t" | |
1584 "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" | |
18861 | 1585 |
29482 | 1586 :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), |
1587 "a" (&c->redDither) | |
27568 | 1588 ); |
1589 return; | |
1590 } | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1591 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1592 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1593 #endif /* COMPILE_TEMPLATE_MMX */ |
29481 | 1594 if (uvalpha < 2048) { |
28976 | 1595 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) |
29481 | 1596 } else { |
28976 | 1597 YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C) |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1598 } |
18861 | 1599 } |
1600 | |
27158 | 1601 //FIXME yuy2* can read up to 7 samples too much |
18861 | 1602 |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1603 static inline void RENAME(yuy2ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
18861 | 1604 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1605 #if COMPILE_TEMPLATE_MMX |
27744 | 1606 __asm__ volatile( |
29482 | 1607 "movq "MANGLE(bm01010101)", %%mm2 \n\t" |
1608 "mov %0, %%"REG_a" \n\t" | |
1609 "1: \n\t" | |
1610 "movq (%1, %%"REG_a",2), %%mm0 \n\t" | |
1611 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" | |
1612 "pand %%mm2, %%mm0 \n\t" | |
1613 "pand %%mm2, %%mm1 \n\t" | |
1614 "packuswb %%mm1, %%mm0 \n\t" | |
1615 "movq %%mm0, (%2, %%"REG_a") \n\t" | |
1616 "add $8, %%"REG_a" \n\t" | |
1617 " js 1b \n\t" | |
1618 : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width) | |
1619 : "%"REG_a | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1620 ); |
18861 | 1621 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1622 int i; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1623 for (i=0; i<width; i++) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1624 dst[i]= src[2*i]; |
18861 | 1625 #endif |
1626 } | |
1627 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1628 static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
18861 | 1629 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1630 #if COMPILE_TEMPLATE_MMX |
27744 | 1631 __asm__ volatile( |
29482 | 1632 "movq "MANGLE(bm01010101)", %%mm4 \n\t" |
1633 "mov %0, %%"REG_a" \n\t" | |
1634 "1: \n\t" | |
1635 "movq (%1, %%"REG_a",4), %%mm0 \n\t" | |
1636 "movq 8(%1, %%"REG_a",4), %%mm1 \n\t" | |
1637 "psrlw $8, %%mm0 \n\t" | |
1638 "psrlw $8, %%mm1 \n\t" | |
1639 "packuswb %%mm1, %%mm0 \n\t" | |
1640 "movq %%mm0, %%mm1 \n\t" | |
1641 "psrlw $8, %%mm0 \n\t" | |
1642 "pand %%mm4, %%mm1 \n\t" | |
1643 "packuswb %%mm0, %%mm0 \n\t" | |
1644 "packuswb %%mm1, %%mm1 \n\t" | |
1645 "movd %%mm0, (%3, %%"REG_a") \n\t" | |
1646 "movd %%mm1, (%2, %%"REG_a") \n\t" | |
1647 "add $4, %%"REG_a" \n\t" | |
1648 " js 1b \n\t" | |
1649 : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) | |
1650 : "%"REG_a | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1651 ); |
18861 | 1652 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1653 int i; |
29481 | 1654 for (i=0; i<width; i++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1655 dstU[i]= src1[4*i + 1]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1656 dstV[i]= src1[4*i + 3]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1657 } |
18861 | 1658 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1659 assert(src1 == src2); |
18861 | 1660 } |
1661 | |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1662 static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1663 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1664 #if COMPILE_TEMPLATE_MMX |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1665 __asm__ volatile( |
29482 | 1666 "mov %0, %%"REG_a" \n\t" |
1667 "1: \n\t" | |
1668 "movq (%1, %%"REG_a",2), %%mm0 \n\t" | |
1669 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" | |
1670 "movq (%2, %%"REG_a",2), %%mm2 \n\t" | |
1671 "movq 8(%2, %%"REG_a",2), %%mm3 \n\t" | |
1672 "psrlw $8, %%mm0 \n\t" | |
1673 "psrlw $8, %%mm1 \n\t" | |
1674 "psrlw $8, %%mm2 \n\t" | |
1675 "psrlw $8, %%mm3 \n\t" | |
1676 "packuswb %%mm1, %%mm0 \n\t" | |
1677 "packuswb %%mm3, %%mm2 \n\t" | |
1678 "movq %%mm0, (%3, %%"REG_a") \n\t" | |
1679 "movq %%mm2, (%4, %%"REG_a") \n\t" | |
1680 "add $8, %%"REG_a" \n\t" | |
1681 " js 1b \n\t" | |
1682 : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width) | |
1683 : "%"REG_a | |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1684 ); |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1685 #else |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1686 int i; |
29481 | 1687 for (i=0; i<width; i++) { |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1688 dstU[i]= src1[2*i + 1]; |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1689 dstV[i]= src2[2*i + 1]; |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1690 } |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1691 #endif |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1692 } |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1693 |
26237 | 1694 /* This is almost identical to the previous, end exists only because |
1695 * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */ | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1696 static inline void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
18861 | 1697 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1698 #if COMPILE_TEMPLATE_MMX |
27744 | 1699 __asm__ volatile( |
29482 | 1700 "mov %0, %%"REG_a" \n\t" |
1701 "1: \n\t" | |
1702 "movq (%1, %%"REG_a",2), %%mm0 \n\t" | |
1703 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" | |
1704 "psrlw $8, %%mm0 \n\t" | |
1705 "psrlw $8, %%mm1 \n\t" | |
1706 "packuswb %%mm1, %%mm0 \n\t" | |
1707 "movq %%mm0, (%2, %%"REG_a") \n\t" | |
1708 "add $8, %%"REG_a" \n\t" | |
1709 " js 1b \n\t" | |
1710 : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width) | |
1711 : "%"REG_a | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1712 ); |
18861 | 1713 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1714 int i; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1715 for (i=0; i<width; i++) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1716 dst[i]= src[2*i+1]; |
18861 | 1717 #endif |
1718 } | |
1719 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1720 static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
18861 | 1721 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1722 #if COMPILE_TEMPLATE_MMX |
27744 | 1723 __asm__ volatile( |
29482 | 1724 "movq "MANGLE(bm01010101)", %%mm4 \n\t" |
1725 "mov %0, %%"REG_a" \n\t" | |
1726 "1: \n\t" | |
1727 "movq (%1, %%"REG_a",4), %%mm0 \n\t" | |
1728 "movq 8(%1, %%"REG_a",4), %%mm1 \n\t" | |
1729 "pand %%mm4, %%mm0 \n\t" | |
1730 "pand %%mm4, %%mm1 \n\t" | |
1731 "packuswb %%mm1, %%mm0 \n\t" | |
1732 "movq %%mm0, %%mm1 \n\t" | |
1733 "psrlw $8, %%mm0 \n\t" | |
1734 "pand %%mm4, %%mm1 \n\t" | |
1735 "packuswb %%mm0, %%mm0 \n\t" | |
1736 "packuswb %%mm1, %%mm1 \n\t" | |
1737 "movd %%mm0, (%3, %%"REG_a") \n\t" | |
1738 "movd %%mm1, (%2, %%"REG_a") \n\t" | |
1739 "add $4, %%"REG_a" \n\t" | |
1740 " js 1b \n\t" | |
1741 : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width) | |
1742 : "%"REG_a | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1743 ); |
18861 | 1744 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1745 int i; |
29481 | 1746 for (i=0; i<width; i++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1747 dstU[i]= src1[4*i + 0]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1748 dstV[i]= src1[4*i + 2]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1749 } |
18861 | 1750 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1751 assert(src1 == src2); |
18861 | 1752 } |
1753 | |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1754 static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1755 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1756 #if COMPILE_TEMPLATE_MMX |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1757 __asm__ volatile( |
29482 | 1758 "movq "MANGLE(bm01010101)", %%mm4 \n\t" |
1759 "mov %0, %%"REG_a" \n\t" | |
1760 "1: \n\t" | |
1761 "movq (%1, %%"REG_a",2), %%mm0 \n\t" | |
1762 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" | |
1763 "movq (%2, %%"REG_a",2), %%mm2 \n\t" | |
1764 "movq 8(%2, %%"REG_a",2), %%mm3 \n\t" | |
1765 "pand %%mm4, %%mm0 \n\t" | |
1766 "pand %%mm4, %%mm1 \n\t" | |
1767 "pand %%mm4, %%mm2 \n\t" | |
1768 "pand %%mm4, %%mm3 \n\t" | |
1769 "packuswb %%mm1, %%mm0 \n\t" | |
1770 "packuswb %%mm3, %%mm2 \n\t" | |
1771 "movq %%mm0, (%3, %%"REG_a") \n\t" | |
1772 "movq %%mm2, (%4, %%"REG_a") \n\t" | |
1773 "add $8, %%"REG_a" \n\t" | |
1774 " js 1b \n\t" | |
1775 : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width) | |
1776 : "%"REG_a | |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1777 ); |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1778 #else |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1779 int i; |
29481 | 1780 for (i=0; i<width; i++) { |
29176
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1781 dstU[i]= src1[2*i]; |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1782 dstV[i]= src2[2*i]; |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1783 } |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1784 #endif |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1785 } |
d18426e37f13
Planar 16bit 420 422 444 YUV support (output is only supported in some
michael
parents:
29139
diff
changeset
|
1786 |
29932 | 1787 static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2, |
1788 const uint8_t *src, long width) | |
1789 { | |
1790 #if COMPILE_TEMPLATE_MMX | |
1791 __asm__ volatile( | |
1792 "movq "MANGLE(bm01010101)", %%mm4 \n\t" | |
1793 "mov %0, %%"REG_a" \n\t" | |
1794 "1: \n\t" | |
1795 "movq (%1, %%"REG_a",2), %%mm0 \n\t" | |
1796 "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" | |
1797 "movq %%mm0, %%mm2 \n\t" | |
1798 "movq %%mm1, %%mm3 \n\t" | |
1799 "pand %%mm4, %%mm0 \n\t" | |
1800 "pand %%mm4, %%mm1 \n\t" | |
1801 "psrlw $8, %%mm2 \n\t" | |
1802 "psrlw $8, %%mm3 \n\t" | |
1803 "packuswb %%mm1, %%mm0 \n\t" | |
1804 "packuswb %%mm3, %%mm2 \n\t" | |
1805 "movq %%mm0, (%2, %%"REG_a") \n\t" | |
1806 "movq %%mm2, (%3, %%"REG_a") \n\t" | |
1807 "add $8, %%"REG_a" \n\t" | |
1808 " js 1b \n\t" | |
1809 : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width) | |
1810 : "%"REG_a | |
1811 ); | |
1812 #else | |
1813 int i; | |
1814 for (i = 0; i < width; i++) { | |
1815 dst1[i] = src[2*i+0]; | |
1816 dst2[i] = src[2*i+1]; | |
1817 } | |
1818 #endif | |
1819 } | |
1820 | |
29934 | 1821 static inline void RENAME(nv12ToUV)(uint8_t *dstU, uint8_t *dstV, |
1822 const uint8_t *src1, const uint8_t *src2, | |
1823 long width, uint32_t *unused) | |
29932 | 1824 { |
1825 RENAME(nvXXtoUV)(dstU, dstV, src1, width); | |
1826 } | |
1827 | |
29934 | 1828 static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV, |
1829 const uint8_t *src1, const uint8_t *src2, | |
1830 long width, uint32_t *unused) | |
29932 | 1831 { |
1832 RENAME(nvXXtoUV)(dstV, dstU, src1, width); | |
1833 } | |
1834 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1835 #if COMPILE_TEMPLATE_MMX |
29815
3e8bf15f96d6
Use enum PixelFormat instead of int for srcFormat and dstFormat.
cehoyos
parents:
29659
diff
changeset
|
1836 static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, enum PixelFormat srcFormat) |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1837 { |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1838 |
29481 | 1839 if(srcFormat == PIX_FMT_BGR24) { |
27744 | 1840 __asm__ volatile( |
27537 | 1841 "movq "MANGLE(ff_bgr24toY1Coeff)", %%mm5 \n\t" |
1842 "movq "MANGLE(ff_bgr24toY2Coeff)", %%mm6 \n\t" | |
1843 : | |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1844 ); |
29481 | 1845 } else { |
27744 | 1846 __asm__ volatile( |
27537 | 1847 "movq "MANGLE(ff_rgb24toY1Coeff)", %%mm5 \n\t" |
1848 "movq "MANGLE(ff_rgb24toY2Coeff)", %%mm6 \n\t" | |
1849 : | |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1850 ); |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1851 } |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1852 |
27744 | 1853 __asm__ volatile( |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1854 "movq "MANGLE(ff_bgr24toYOffset)", %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1855 "mov %2, %%"REG_a" \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1856 "pxor %%mm7, %%mm7 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1857 "1: \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1858 PREFETCH" 64(%0) \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1859 "movd (%0), %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1860 "movd 2(%0), %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1861 "movd 6(%0), %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1862 "movd 8(%0), %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1863 "add $12, %0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1864 "punpcklbw %%mm7, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1865 "punpcklbw %%mm7, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1866 "punpcklbw %%mm7, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1867 "punpcklbw %%mm7, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1868 "pmaddwd %%mm5, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1869 "pmaddwd %%mm6, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1870 "pmaddwd %%mm5, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1871 "pmaddwd %%mm6, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1872 "paddd %%mm1, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1873 "paddd %%mm3, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1874 "paddd %%mm4, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1875 "paddd %%mm4, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1876 "psrad $15, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1877 "psrad $15, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1878 "packssdw %%mm2, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1879 "packuswb %%mm0, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1880 "movd %%mm0, (%1, %%"REG_a") \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1881 "add $4, %%"REG_a" \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1882 " js 1b \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1883 : "+r" (src) |
28957 | 1884 : "r" (dst+width), "g" ((x86_reg)-width) |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1885 : "%"REG_a |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1886 ); |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1887 } |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1888 |
29815
3e8bf15f96d6
Use enum PixelFormat instead of int for srcFormat and dstFormat.
cehoyos
parents:
29659
diff
changeset
|
1889 static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat) |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1890 { |
27744 | 1891 __asm__ volatile( |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1892 "movq 24+%4, %%mm6 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1893 "mov %3, %%"REG_a" \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1894 "pxor %%mm7, %%mm7 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1895 "1: \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1896 PREFETCH" 64(%0) \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1897 "movd (%0), %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1898 "movd 2(%0), %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1899 "punpcklbw %%mm7, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1900 "punpcklbw %%mm7, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1901 "movq %%mm0, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1902 "movq %%mm1, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1903 "pmaddwd %4, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1904 "pmaddwd 8+%4, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1905 "pmaddwd 16+%4, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1906 "pmaddwd %%mm6, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1907 "paddd %%mm1, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1908 "paddd %%mm3, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1909 |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1910 "movd 6(%0), %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1911 "movd 8(%0), %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1912 "add $12, %0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1913 "punpcklbw %%mm7, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1914 "punpcklbw %%mm7, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1915 "movq %%mm1, %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1916 "movq %%mm3, %%mm5 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1917 "pmaddwd %4, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1918 "pmaddwd 8+%4, %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1919 "pmaddwd 16+%4, %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1920 "pmaddwd %%mm6, %%mm5 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1921 "paddd %%mm3, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1922 "paddd %%mm5, %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1923 |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1924 "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1925 "paddd %%mm3, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1926 "paddd %%mm3, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1927 "paddd %%mm3, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1928 "paddd %%mm3, %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1929 "psrad $15, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1930 "psrad $15, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1931 "psrad $15, %%mm1 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1932 "psrad $15, %%mm4 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1933 "packssdw %%mm1, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1934 "packssdw %%mm4, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1935 "packuswb %%mm0, %%mm0 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1936 "packuswb %%mm2, %%mm2 \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1937 "movd %%mm0, (%1, %%"REG_a") \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1938 "movd %%mm2, (%2, %%"REG_a") \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1939 "add $4, %%"REG_a" \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1940 " js 1b \n\t" |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1941 : "+r" (src) |
28957 | 1942 : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0]) |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1943 : "%"REG_a |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1944 ); |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1945 } |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1946 #endif |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1947 |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1948 static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
18861 | 1949 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1950 #if COMPILE_TEMPLATE_MMX |
27570
aa795bfca46f
Fix libswscale build after r27561 if --enable-runtime-cpudetection is used.
ben
parents:
27568
diff
changeset
|
1951 RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); |
18861 | 1952 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1953 int i; |
29481 | 1954 for (i=0; i<width; i++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1955 int b= src[i*3+0]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1956 int g= src[i*3+1]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1957 int r= src[i*3+2]; |
18861 | 1958 |
25749 | 1959 dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1960 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1961 #endif /* COMPILE_TEMPLATE_MMX */ |
18861 | 1962 } |
1963 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1964 static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
18861 | 1965 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1966 #if COMPILE_TEMPLATE_MMX |
27570
aa795bfca46f
Fix libswscale build after r27561 if --enable-runtime-cpudetection is used.
ben
parents:
27568
diff
changeset
|
1967 RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); |
18861 | 1968 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1969 int i; |
29481 | 1970 for (i=0; i<width; i++) { |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1971 int b= src1[3*i + 0]; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1972 int g= src1[3*i + 1]; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1973 int r= src1[3*i + 2]; |
18861 | 1974 |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1975 dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
1976 dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1977 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1978 #endif /* COMPILE_TEMPLATE_MMX */ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
1979 assert(src1 == src2); |
18861 | 1980 } |
1981 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1982 static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
27532 | 1983 { |
1984 int i; | |
29481 | 1985 for (i=0; i<width; i++) { |
27532 | 1986 int b= src1[6*i + 0] + src1[6*i + 3]; |
1987 int g= src1[6*i + 1] + src1[6*i + 4]; | |
1988 int r= src1[6*i + 2] + src1[6*i + 5]; | |
1989 | |
1990 dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); | |
1991 dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); | |
1992 } | |
1993 assert(src1 == src2); | |
1994 } | |
1995 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
1996 static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) |
18861 | 1997 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
1998 #if COMPILE_TEMPLATE_MMX |
27570
aa795bfca46f
Fix libswscale build after r27561 if --enable-runtime-cpudetection is used.
ben
parents:
27568
diff
changeset
|
1999 RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24); |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2000 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2001 int i; |
29481 | 2002 for (i=0; i<width; i++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2003 int r= src[i*3+0]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2004 int g= src[i*3+1]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2005 int b= src[i*3+2]; |
18861 | 2006 |
25749 | 2007 dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2008 } |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2009 #endif |
18861 | 2010 } |
2011 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2012 static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
18861 | 2013 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2014 #if COMPILE_TEMPLATE_MMX |
27911
535e8e3803e9
Put variable declaration inside an #ifdef to avoid an unused variable warning.
diego
parents:
27793
diff
changeset
|
2015 assert(src1==src2); |
535e8e3803e9
Put variable declaration inside an #ifdef to avoid an unused variable warning.
diego
parents:
27793
diff
changeset
|
2016 RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); |
535e8e3803e9
Put variable declaration inside an #ifdef to avoid an unused variable warning.
diego
parents:
27793
diff
changeset
|
2017 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2018 int i; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2019 assert(src1==src2); |
29481 | 2020 for (i=0; i<width; i++) { |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2021 int r= src1[3*i + 0]; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2022 int g= src1[3*i + 1]; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2023 int b= src1[3*i + 2]; |
18861 | 2024 |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2025 dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; |
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2026 dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2027 } |
27529
ffb573fae5e8
Rewrite bgr24->yuv mmx code, the new code is cleaner, more accurate,
michael
parents:
27525
diff
changeset
|
2028 #endif |
18861 | 2029 } |
2030 | |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2031 static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) |
27532 | 2032 { |
2033 int i; | |
2034 assert(src1==src2); | |
29481 | 2035 for (i=0; i<width; i++) { |
27550
3f12d34131a9
Fix typo that lead to averaging of the same pixel in rgb24ToUV_half().
michael
parents:
27548
diff
changeset
|
2036 int r= src1[6*i + 0] + src1[6*i + 3]; |
3f12d34131a9
Fix typo that lead to averaging of the same pixel in rgb24ToUV_half().
michael
parents:
27548
diff
changeset
|
2037 int g= src1[6*i + 1] + src1[6*i + 4]; |
3f12d34131a9
Fix typo that lead to averaging of the same pixel in rgb24ToUV_half().
michael
parents:
27548
diff
changeset
|
2038 int b= src1[6*i + 2] + src1[6*i + 5]; |
27532 | 2039 |
2040 dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); | |
2041 dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1); | |
2042 } | |
2043 } | |
2044 | |
18861 | 2045 |
27158 | 2046 // bilinear / bicubic scaling |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2047 static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc, |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2048 const int16_t *filter, const int16_t *filterPos, long filterSize) |
18861 | 2049 { |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2050 #if COMPILE_TEMPLATE_MMX |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2051 assert(filterSize % 4 == 0 && filterSize>0); |
29481 | 2052 if (filterSize==4) { // Always true for upscaling, sometimes for down, too. |
28957 | 2053 x86_reg counter= -2*dstW; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2054 filter-= counter*2; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2055 filterPos-= counter/2; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2056 dst-= counter/2; |
27744 | 2057 __asm__ volatile( |
19396 | 2058 #if defined(PIC) |
29482 | 2059 "push %%"REG_b" \n\t" |
19396 | 2060 #endif |
29482 | 2061 "pxor %%mm7, %%mm7 \n\t" |
2062 "push %%"REG_BP" \n\t" // we use 7 regs here ... | |
2063 "mov %%"REG_a", %%"REG_BP" \n\t" | |
2064 ASMALIGN(4) | |
2065 "1: \n\t" | |
2066 "movzwl (%2, %%"REG_BP"), %%eax \n\t" | |
2067 "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" | |
2068 "movq (%1, %%"REG_BP", 4), %%mm1 \n\t" | |
2069 "movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t" | |
2070 "movd (%3, %%"REG_a"), %%mm0 \n\t" | |
2071 "movd (%3, %%"REG_b"), %%mm2 \n\t" | |
2072 "punpcklbw %%mm7, %%mm0 \n\t" | |
2073 "punpcklbw %%mm7, %%mm2 \n\t" | |
2074 "pmaddwd %%mm1, %%mm0 \n\t" | |
2075 "pmaddwd %%mm2, %%mm3 \n\t" | |
2076 "movq %%mm0, %%mm4 \n\t" | |
2077 "punpckldq %%mm3, %%mm0 \n\t" | |
2078 "punpckhdq %%mm3, %%mm4 \n\t" | |
2079 "paddd %%mm4, %%mm0 \n\t" | |
2080 "psrad $7, %%mm0 \n\t" | |
2081 "packssdw %%mm0, %%mm0 \n\t" | |
2082 "movd %%mm0, (%4, %%"REG_BP") \n\t" | |
2083 "add $4, %%"REG_BP" \n\t" | |
2084 " jnc 1b \n\t" | |
18861 | 2085 |
29482 | 2086 "pop %%"REG_BP" \n\t" |
19396 | 2087 #if defined(PIC) |
29482 | 2088 "pop %%"REG_b" \n\t" |
19396 | 2089 #endif |
29482 | 2090 : "+a" (counter) |
2091 : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) | |
19396 | 2092 #if !defined(PIC) |
29482 | 2093 : "%"REG_b |
19396 | 2094 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2095 ); |
29481 | 2096 } else if (filterSize==8) { |
28957 | 2097 x86_reg counter= -2*dstW; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2098 filter-= counter*4; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2099 filterPos-= counter/2; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2100 dst-= counter/2; |
27744 | 2101 __asm__ volatile( |
19396 | 2102 #if defined(PIC) |
29482 | 2103 "push %%"REG_b" \n\t" |
19396 | 2104 #endif |
29482 | 2105 "pxor %%mm7, %%mm7 \n\t" |
2106 "push %%"REG_BP" \n\t" // we use 7 regs here ... | |
2107 "mov %%"REG_a", %%"REG_BP" \n\t" | |
2108 ASMALIGN(4) | |
2109 "1: \n\t" | |
2110 "movzwl (%2, %%"REG_BP"), %%eax \n\t" | |
2111 "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t" | |
2112 "movq (%1, %%"REG_BP", 8), %%mm1 \n\t" | |
2113 "movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t" | |
2114 "movd (%3, %%"REG_a"), %%mm0 \n\t" | |
2115 "movd (%3, %%"REG_b"), %%mm2 \n\t" | |
2116 "punpcklbw %%mm7, %%mm0 \n\t" | |
2117 "punpcklbw %%mm7, %%mm2 \n\t" | |
2118 "pmaddwd %%mm1, %%mm0 \n\t" | |
2119 "pmaddwd %%mm2, %%mm3 \n\t" | |
18861 | 2120 |
29482 | 2121 "movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t" |
2122 "movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t" | |
2123 "movd 4(%3, %%"REG_a"), %%mm4 \n\t" | |
2124 "movd 4(%3, %%"REG_b"), %%mm2 \n\t" | |
2125 "punpcklbw %%mm7, %%mm4 \n\t" | |
2126 "punpcklbw %%mm7, %%mm2 \n\t" | |
2127 "pmaddwd %%mm1, %%mm4 \n\t" | |
2128 "pmaddwd %%mm2, %%mm5 \n\t" | |
2129 "paddd %%mm4, %%mm0 \n\t" | |
2130 "paddd %%mm5, %%mm3 \n\t" | |
2131 "movq %%mm0, %%mm4 \n\t" | |
2132 "punpckldq %%mm3, %%mm0 \n\t" | |
2133 "punpckhdq %%mm3, %%mm4 \n\t" | |
2134 "paddd %%mm4, %%mm0 \n\t" | |
2135 "psrad $7, %%mm0 \n\t" | |
2136 "packssdw %%mm0, %%mm0 \n\t" | |
2137 "movd %%mm0, (%4, %%"REG_BP") \n\t" | |
2138 "add $4, %%"REG_BP" \n\t" | |
2139 " jnc 1b \n\t" | |
18861 | 2140 |
29482 | 2141 "pop %%"REG_BP" \n\t" |
19396 | 2142 #if defined(PIC) |
29482 | 2143 "pop %%"REG_b" \n\t" |
19396 | 2144 #endif |
29482 | 2145 : "+a" (counter) |
2146 : "c" (filter), "d" (filterPos), "S" (src), "D" (dst) | |
19396 | 2147 #if !defined(PIC) |
29482 | 2148 : "%"REG_b |
19396 | 2149 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2150 ); |
29481 | 2151 } else { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2152 uint8_t *offset = src+filterSize; |
28957 | 2153 x86_reg counter= -2*dstW; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2154 //filter-= counter*filterSize/2; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2155 filterPos-= counter/2; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2156 dst-= counter/2; |
27744 | 2157 __asm__ volatile( |
29482 | 2158 "pxor %%mm7, %%mm7 \n\t" |
2159 ASMALIGN(4) | |
2160 "1: \n\t" | |
2161 "mov %2, %%"REG_c" \n\t" | |
2162 "movzwl (%%"REG_c", %0), %%eax \n\t" | |
2163 "movzwl 2(%%"REG_c", %0), %%edx \n\t" | |
2164 "mov %5, %%"REG_c" \n\t" | |
2165 "pxor %%mm4, %%mm4 \n\t" | |
2166 "pxor %%mm5, %%mm5 \n\t" | |
2167 "2: \n\t" | |
2168 "movq (%1), %%mm1 \n\t" | |
2169 "movq (%1, %6), %%mm3 \n\t" | |
2170 "movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t" | |
2171 "movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t" | |
2172 "punpcklbw %%mm7, %%mm0 \n\t" | |
2173 "punpcklbw %%mm7, %%mm2 \n\t" | |
2174 "pmaddwd %%mm1, %%mm0 \n\t" | |
2175 "pmaddwd %%mm2, %%mm3 \n\t" | |
2176 "paddd %%mm3, %%mm5 \n\t" | |
2177 "paddd %%mm0, %%mm4 \n\t" | |
2178 "add $8, %1 \n\t" | |
2179 "add $4, %%"REG_c" \n\t" | |
2180 "cmp %4, %%"REG_c" \n\t" | |
2181 " jb 2b \n\t" | |
2182 "add %6, %1 \n\t" | |
2183 "movq %%mm4, %%mm0 \n\t" | |
2184 "punpckldq %%mm5, %%mm4 \n\t" | |
2185 "punpckhdq %%mm5, %%mm0 \n\t" | |
2186 "paddd %%mm0, %%mm4 \n\t" | |
2187 "psrad $7, %%mm4 \n\t" | |
2188 "packssdw %%mm4, %%mm4 \n\t" | |
2189 "mov %3, %%"REG_a" \n\t" | |
2190 "movd %%mm4, (%%"REG_a", %0) \n\t" | |
2191 "add $4, %0 \n\t" | |
2192 " jnc 1b \n\t" | |
18861 | 2193 |
29482 | 2194 : "+r" (counter), "+r" (filter) |
2195 : "m" (filterPos), "m" (dst), "m"(offset), | |
2196 "m" (src), "r" ((x86_reg)filterSize*2) | |
2197 : "%"REG_a, "%"REG_c, "%"REG_d | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2198 ); |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2199 } |
18861 | 2200 #else |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2201 #if COMPILE_TEMPLATE_ALTIVEC |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2202 hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); |
18861 | 2203 #else |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2204 int i; |
29481 | 2205 for (i=0; i<dstW; i++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2206 int j; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2207 int srcPos= filterPos[i]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2208 int val=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2209 //printf("filterPos: %d\n", filterPos[i]); |
29481 | 2210 for (j=0; j<filterSize; j++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2211 //printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]); |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2212 val += ((int)src[srcPos + j])*filter[filterSize*i + j]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2213 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2214 //filter += hFilterSize; |
27561
5e35ed8ae2a3
Make the horizontal C scaler code clip only against INT16_MAX not 0,
michael
parents:
27558
diff
changeset
|
2215 dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ... |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2216 //dst[i] = val>>7; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2217 } |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2218 #endif /* COMPILE_ALTIVEC */ |
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2219 #endif /* COMPILE_MMX */ |
18861 | 2220 } |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2221 |
30040
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2222 //FIXME all pal and rgb srcFormats could do this convertion as well |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2223 //FIXME all scalers more complex than bilinear could do half of this transform |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2224 static void RENAME(chrRangeToJpeg)(uint16_t *dst, int width) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2225 { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2226 int i; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2227 for (i = 0; i < width; i++) { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2228 dst[i ] = (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; //-264 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2229 dst[i+VOFW] = (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2230 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2231 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2232 static void RENAME(chrRangeFromJpeg)(uint16_t *dst, int width) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2233 { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2234 int i; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2235 for (i = 0; i < width; i++) { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2236 dst[i ] = (dst[i ]*1799 + 4081085)>>11; //1469 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2237 dst[i+VOFW] = (dst[i+VOFW]*1799 + 4081085)>>11; //1469 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2238 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2239 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2240 static void RENAME(lumRangeToJpeg)(uint16_t *dst, int width) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2241 { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2242 int i; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2243 for (i = 0; i < width; i++) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2244 dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2245 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2246 static void RENAME(lumRangeFromJpeg)(uint16_t *dst, int width) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2247 { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2248 int i; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2249 for (i = 0; i < width; i++) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2250 dst[i] = (dst[i]*14071 + 33561947)>>14; |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2251 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2252 |
29403 | 2253 #define FAST_BILINEAR_X86 \ |
2254 "subl %%edi, %%esi \n\t" /* src[xx+1] - src[xx] */ \ | |
2255 "imull %%ecx, %%esi \n\t" /* (src[xx+1] - src[xx])*xalpha */ \ | |
2256 "shll $16, %%edi \n\t" \ | |
2257 "addl %%edi, %%esi \n\t" /* src[xx+1]*xalpha + src[xx]*(1-xalpha) */ \ | |
2258 "mov %1, %%"REG_D"\n\t" \ | |
2259 "shrl $9, %%esi \n\t" \ | |
2260 | |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2261 static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2262 long dstWidth, const uint8_t *src, int srcW, |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2263 int xInc) |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2264 { |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2265 #if ARCH_X86 && CONFIG_GPL |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2266 #if COMPILE_TEMPLATE_MMX2 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2267 int32_t *mmx2FilterPos = c->lumMmx2FilterPos; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2268 int16_t *mmx2Filter = c->lumMmx2Filter; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2269 int canMMX2BeUsed = c->canMMX2BeUsed; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2270 void *mmx2FilterCode= c->lumMmx2FilterCode; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2271 int i; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2272 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2273 DECLARE_ALIGNED(8, uint64_t, ebxsave); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2274 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2275 if (canMMX2BeUsed) { |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2276 __asm__ volatile( |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2277 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2278 "mov %%"REG_b", %5 \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2279 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2280 "pxor %%mm7, %%mm7 \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2281 "mov %0, %%"REG_c" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2282 "mov %1, %%"REG_D" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2283 "mov %2, %%"REG_d" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2284 "mov %3, %%"REG_b" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2285 "xor %%"REG_a", %%"REG_a" \n\t" // i |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2286 PREFETCH" (%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2287 PREFETCH" 32(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2288 PREFETCH" 64(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2289 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2290 #if ARCH_X86_64 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2291 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2292 #define CALL_MMX2_FILTER_CODE \ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2293 "movl (%%"REG_b"), %%esi \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2294 "call *%4 \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2295 "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2296 "add %%"REG_S", %%"REG_c" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2297 "add %%"REG_a", %%"REG_D" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2298 "xor %%"REG_a", %%"REG_a" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2299 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2300 #else |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2301 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2302 #define CALL_MMX2_FILTER_CODE \ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2303 "movl (%%"REG_b"), %%esi \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2304 "call *%4 \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2305 "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2306 "add %%"REG_a", %%"REG_D" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2307 "xor %%"REG_a", %%"REG_a" \n\t"\ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2308 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2309 #endif /* ARCH_X86_64 */ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2310 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2311 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2312 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2313 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2314 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2315 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2316 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2317 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2318 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2319 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2320 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2321 "mov %5, %%"REG_b" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2322 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2323 :: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2324 "m" (mmx2FilterCode) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2325 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2326 ,"m" (ebxsave) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2327 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2328 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2329 #if !defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2330 ,"%"REG_b |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2331 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2332 ); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2333 for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2334 } else { |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2335 #endif /* COMPILE_TEMPLATE_MMX2 */ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2336 x86_reg xInc_shr16 = xInc >> 16; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2337 uint16_t xInc_mask = xInc & 0xffff; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2338 //NO MMX just normal asm ... |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2339 __asm__ volatile( |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2340 "xor %%"REG_a", %%"REG_a" \n\t" // i |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2341 "xor %%"REG_d", %%"REG_d" \n\t" // xx |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2342 "xorl %%ecx, %%ecx \n\t" // xalpha |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2343 ASMALIGN(4) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2344 "1: \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2345 "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2346 "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2347 FAST_BILINEAR_X86 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2348 "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2349 "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2350 "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2351 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2352 "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2353 "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2354 FAST_BILINEAR_X86 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2355 "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2356 "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2357 "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2358 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2359 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2360 "add $2, %%"REG_a" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2361 "cmp %2, %%"REG_a" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2362 " jb 1b \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2363 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2364 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2365 :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2366 : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2367 ); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2368 #if COMPILE_TEMPLATE_MMX2 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2369 } //if MMX2 can't be used |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2370 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2371 #else |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2372 int i; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2373 unsigned int xpos=0; |
29481 | 2374 for (i=0;i<dstWidth;i++) { |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2375 register unsigned int xx=xpos>>16; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2376 register unsigned int xalpha=(xpos&0xFFFF)>>9; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2377 dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2378 xpos+=xInc; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2379 } |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2380 #endif /* ARCH_X86 */ |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2381 } |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2382 |
18861 | 2383 // *** horizontal scale Y line to temp buffer |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2384 static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src, int srcW, int xInc, |
30057 | 2385 const int16_t *hLumFilter, |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2386 const int16_t *hLumFilterPos, int hLumFilterSize, |
30057 | 2387 uint8_t *formatConvBuffer, |
29090 | 2388 uint32_t *pal, int isAlpha) |
18861 | 2389 { |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2390 void (*toYV12)(uint8_t *, const uint8_t *, long, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12; |
30040
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2391 void (*convertRange)(uint16_t *, int) = isAlpha ? NULL : c->lumConvertRange; |
29090 | 2392 |
30039
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
2393 src += isAlpha ? c->alpSrcOffset : c->lumSrcOffset; |
29299
24954ec81529
Partial (low bits ignored, no direct transcoding into other RGB formats) support
kostya
parents:
29278
diff
changeset
|
2394 |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2395 if (toYV12) { |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2396 toYV12(formatConvBuffer, src, srcW, pal); |
27555 | 2397 src= formatConvBuffer; |
2398 } | |
18861 | 2399 |
30043
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2400 if (!c->hyscale_fast) |
18861 | 2401 { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2402 c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize); |
29481 | 2403 } else { // fast bilinear upscale / crap downscale |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2404 c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc); |
18861 | 2405 } |
27515 | 2406 |
30040
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2407 if (convertRange) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2408 convertRange(dst, dstWidth); |
18861 | 2409 } |
2410 | |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2411 static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2412 long dstWidth, const uint8_t *src1, |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2413 const uint8_t *src2, int srcW, int xInc) |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2414 { |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2415 #if ARCH_X86 && CONFIG_GPL |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2416 #if COMPILE_TEMPLATE_MMX2 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2417 int32_t *mmx2FilterPos = c->chrMmx2FilterPos; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2418 int16_t *mmx2Filter = c->chrMmx2Filter; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2419 int canMMX2BeUsed = c->canMMX2BeUsed; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2420 void *mmx2FilterCode= c->chrMmx2FilterCode; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2421 int i; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2422 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2423 DECLARE_ALIGNED(8, uint64_t, ebxsave); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2424 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2425 if (canMMX2BeUsed) { |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2426 __asm__ volatile( |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2427 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2428 "mov %%"REG_b", %6 \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2429 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2430 "pxor %%mm7, %%mm7 \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2431 "mov %0, %%"REG_c" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2432 "mov %1, %%"REG_D" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2433 "mov %2, %%"REG_d" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2434 "mov %3, %%"REG_b" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2435 "xor %%"REG_a", %%"REG_a" \n\t" // i |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2436 PREFETCH" (%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2437 PREFETCH" 32(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2438 PREFETCH" 64(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2439 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2440 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2441 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2442 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2443 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2444 "xor %%"REG_a", %%"REG_a" \n\t" // i |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2445 "mov %5, %%"REG_c" \n\t" // src |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2446 "mov %1, %%"REG_D" \n\t" // buf1 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2447 "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2448 PREFETCH" (%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2449 PREFETCH" 32(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2450 PREFETCH" 64(%%"REG_c") \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2451 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2452 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2453 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2454 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2455 CALL_MMX2_FILTER_CODE |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2456 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2457 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2458 "mov %6, %%"REG_b" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2459 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2460 :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2461 "m" (mmx2FilterCode), "m" (src2) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2462 #if defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2463 ,"m" (ebxsave) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2464 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2465 : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2466 #if !defined(PIC) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2467 ,"%"REG_b |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2468 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2469 ); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2470 for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2471 //printf("%d %d %d\n", dstWidth, i, srcW); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2472 dst[i] = src1[srcW-1]*128; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2473 dst[i+VOFW] = src2[srcW-1]*128; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2474 } |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2475 } else { |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2476 #endif /* COMPILE_TEMPLATE_MMX2 */ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2477 x86_reg xInc_shr16 = (x86_reg) (xInc >> 16); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2478 uint16_t xInc_mask = xInc & 0xffff; |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2479 __asm__ volatile( |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2480 "xor %%"REG_a", %%"REG_a" \n\t" // i |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2481 "xor %%"REG_d", %%"REG_d" \n\t" // xx |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2482 "xorl %%ecx, %%ecx \n\t" // xalpha |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2483 ASMALIGN(4) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2484 "1: \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2485 "mov %0, %%"REG_S" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2486 "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2487 "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2488 FAST_BILINEAR_X86 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2489 "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2490 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2491 "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2492 "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1] |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2493 FAST_BILINEAR_X86 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2494 "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2495 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2496 "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2497 "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2498 "add $1, %%"REG_a" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2499 "cmp %2, %%"REG_a" \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2500 " jb 1b \n\t" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2501 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2502 /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2503 which is needed to support GCC 4.0. */ |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2504 #if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2505 :: "m" (src1), "m" (dst), "g" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask), |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2506 #else |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2507 :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask), |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2508 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2509 "r" (src2) |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2510 : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2511 ); |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2512 #if COMPILE_TEMPLATE_MMX2 |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2513 } //if MMX2 can't be used |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2514 #endif |
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2515 #else |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2516 int i; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2517 unsigned int xpos=0; |
29481 | 2518 for (i=0;i<dstWidth;i++) { |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2519 register unsigned int xx=xpos>>16; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2520 register unsigned int xalpha=(xpos&0xFFFF)>>9; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2521 dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2522 dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2523 /* slower |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2524 dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2525 dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2526 */ |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2527 xpos+=xInc; |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2528 } |
30056
ec5ad3da76a9
Move fast bilinear scaler code to the existing h[yc]scale_fast() functions.
ramiro
parents:
30055
diff
changeset
|
2529 #endif /* ARCH_X86 */ |
29089
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2530 } |
e3253ea94757
swscale: Split h[yc]scale_fast() into their own functions.
ramiro
parents:
29088
diff
changeset
|
2531 |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2532 inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2, |
30057 | 2533 int srcW, int xInc, const int16_t *hChrFilter, |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2534 const int16_t *hChrFilterPos, int hChrFilterSize, |
30057 | 2535 uint8_t *formatConvBuffer, |
29090 | 2536 uint32_t *pal) |
18861 | 2537 { |
29090 | 2538 |
30039
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
2539 src1 += c->chrSrcOffset; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
2540 src2 += c->chrSrcOffset; |
29299
24954ec81529
Partial (low bits ignored, no direct transcoding into other RGB formats) support
kostya
parents:
29278
diff
changeset
|
2541 |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2542 if (c->chrToYV12) { |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2543 c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2544 src1= formatConvBuffer; |
26133
94cc4bac8cd0
Turn ancient V offset numerical constants into named ones.
michael
parents:
26059
diff
changeset
|
2545 src2= formatConvBuffer+VOFW; |
22218 | 2546 } |
18861 | 2547 |
30043
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2548 if (!c->hcscale_fast) |
18861 | 2549 { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2550 c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2551 c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); |
29481 | 2552 } else { // fast bilinear upscale / crap downscale |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2553 c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc); |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2554 } |
30040
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2555 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2556 if (c->chrConvertRange) |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
2557 c->chrConvertRange(dst, dstWidth); |
18861 | 2558 } |
2559 | |
29644 | 2560 #define DEBUG_SWSCALE_BUFFERS 0 |
2561 #define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__) | |
2562 | |
18861 | 2563 static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, |
29481 | 2564 int srcSliceH, uint8_t* dst[], int dstStride[]) |
2565 { | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2566 /* load a few things into local vars to make the code more readable? and faster */ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2567 const int srcW= c->srcW; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2568 const int dstW= c->dstW; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2569 const int dstH= c->dstH; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2570 const int chrDstW= c->chrDstW; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2571 const int chrSrcW= c->chrSrcW; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2572 const int lumXInc= c->lumXInc; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2573 const int chrXInc= c->chrXInc; |
29815
3e8bf15f96d6
Use enum PixelFormat instead of int for srcFormat and dstFormat.
cehoyos
parents:
29659
diff
changeset
|
2574 const enum PixelFormat dstFormat= c->dstFormat; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2575 const int flags= c->flags; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2576 int16_t *vLumFilterPos= c->vLumFilterPos; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2577 int16_t *vChrFilterPos= c->vChrFilterPos; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2578 int16_t *hLumFilterPos= c->hLumFilterPos; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2579 int16_t *hChrFilterPos= c->hChrFilterPos; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2580 int16_t *vLumFilter= c->vLumFilter; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2581 int16_t *vChrFilter= c->vChrFilter; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2582 int16_t *hLumFilter= c->hLumFilter; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2583 int16_t *hChrFilter= c->hChrFilter; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2584 int32_t *lumMmxFilter= c->lumMmxFilter; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2585 int32_t *chrMmxFilter= c->chrMmxFilter; |
28976 | 2586 int32_t *alpMmxFilter= c->alpMmxFilter; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2587 const int vLumFilterSize= c->vLumFilterSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2588 const int vChrFilterSize= c->vChrFilterSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2589 const int hLumFilterSize= c->hLumFilterSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2590 const int hChrFilterSize= c->hChrFilterSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2591 int16_t **lumPixBuf= c->lumPixBuf; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2592 int16_t **chrPixBuf= c->chrPixBuf; |
28976 | 2593 int16_t **alpPixBuf= c->alpPixBuf; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2594 const int vLumBufSize= c->vLumBufSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2595 const int vChrBufSize= c->vChrBufSize; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2596 uint8_t *formatConvBuffer= c->formatConvBuffer; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2597 const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2598 const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample); |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2599 int lastDstY; |
27699
31a477d77c57
Do not set src[1] to the palette, it is now in the context
vitor
parents:
27686
diff
changeset
|
2600 uint32_t *pal=c->pal_yuv; |
18861 | 2601 |
27158 | 2602 /* vars which will change and which we need to store back in the context */ |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2603 int dstY= c->dstY; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2604 int lumBufIndex= c->lumBufIndex; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2605 int chrBufIndex= c->chrBufIndex; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2606 int lastInLumBuf= c->lastInLumBuf; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2607 int lastInChrBuf= c->lastInChrBuf; |
23129 | 2608 |
29481 | 2609 if (isPacked(c->srcFormat)) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2610 src[0]= |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2611 src[1]= |
28976 | 2612 src[2]= |
2613 src[3]= src[0]; | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2614 srcStride[0]= |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2615 srcStride[1]= |
28976 | 2616 srcStride[2]= |
2617 srcStride[3]= srcStride[0]; | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2618 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2619 srcStride[1]<<= c->vChrDrop; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2620 srcStride[2]<<= c->vChrDrop; |
18861 | 2621 |
29644 | 2622 DEBUG_BUFFERS("swScale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n", |
2623 src[0], srcStride[0], src[1], srcStride[1], src[2], srcStride[2], src[3], srcStride[3], | |
2624 dst[0], dstStride[0], dst[1], dstStride[1], dst[2], dstStride[2], dst[3], dstStride[3]); | |
2625 DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n", | |
2626 srcSliceY, srcSliceH, dstY, dstH); | |
2627 DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n", | |
2628 vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize); | |
18861 | 2629 |
29481 | 2630 if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) { |
27702
b6a499f72725
Invert logic for the single-pass in swScale() functions.
flameeyes
parents:
27699
diff
changeset
|
2631 static int warnedAlready=0; //FIXME move this into the context perhaps |
29481 | 2632 if (flags & SWS_PRINT_INFO && !warnedAlready) { |
26150
1df4a811aa9c
remove redundant SwScaler text since av_log uses AVClass context
bcoudurier
parents:
26133
diff
changeset
|
2633 av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n" |
27158 | 2634 " ->cannot do aligned memory accesses anymore\n"); |
27702
b6a499f72725
Invert logic for the single-pass in swScale() functions.
flameeyes
parents:
27699
diff
changeset
|
2635 warnedAlready=1; |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2636 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2637 } |
18861 | 2638 |
27158 | 2639 /* Note the user might start scaling the picture in the middle so this |
2640 will not get executed. This is not really intended but works | |
2641 currently, so people might do it. */ | |
29481 | 2642 if (srcSliceY ==0) { |
29935 | 2643 lumBufIndex=-1; |
2644 chrBufIndex=-1; | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2645 dstY=0; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2646 lastInLumBuf= -1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2647 lastInChrBuf= -1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2648 } |
18861 | 2649 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2650 lastDstY= dstY; |
18861 | 2651 |
29481 | 2652 for (;dstY < dstH; dstY++) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2653 unsigned char *dest =dst[0]+dstStride[0]*dstY; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2654 const int chrDstY= dstY>>c->chrDstVSubSample; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2655 unsigned char *uDest=dst[1]+dstStride[1]*chrDstY; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2656 unsigned char *vDest=dst[2]+dstStride[2]*chrDstY; |
28976 | 2657 unsigned char *aDest=(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3]+dstStride[3]*dstY : NULL; |
18861 | 2658 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2659 const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2660 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input |
29408
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2661 int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2662 int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2663 int enough_lines; |
18861 | 2664 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2665 //handle holes (FAST_BILINEAR & weird filters) |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2666 if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2667 if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1; |
27182
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2668 assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1); |
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2669 assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1); |
18861 | 2670 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2671 // Do we have enough lines in this slice to output the dstY line |
29408
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2672 enough_lines = lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample); |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2673 if (!enough_lines) { |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2674 lastLumSrcY = srcSliceY + srcSliceH - 1; |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2675 lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1; |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2676 } |
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2677 |
29644 | 2678 DEBUG_BUFFERS("dstY: %d\n", dstY); |
2679 DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n", | |
2680 firstLumSrcY, lastLumSrcY, lastInLumBuf); | |
2681 DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n", | |
2682 firstChrSrcY, lastChrSrcY, lastInChrBuf); | |
29408
45759bfb13d6
Remove duplicate horizontal scaling when there aren't enough lines in a slice
ramiro
parents:
29404
diff
changeset
|
2683 |
29409 | 2684 //Do horizontal scaling |
29481 | 2685 while(lastInLumBuf < lastLumSrcY) { |
29409 | 2686 uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; |
2687 uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; | |
2688 lumBufIndex++; | |
29644 | 2689 DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n", |
2690 lumBufIndex, lastInLumBuf); | |
29409 | 2691 assert(lumBufIndex < 2*vLumBufSize); |
2692 assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); | |
2693 assert(lastInLumBuf + 1 - srcSliceY >= 0); | |
2694 RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, | |
30057 | 2695 hLumFilter, hLumFilterPos, hLumFilterSize, |
2696 formatConvBuffer, | |
29409 | 2697 pal, 0); |
2698 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) | |
2699 RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, | |
30057 | 2700 hLumFilter, hLumFilterPos, hLumFilterSize, |
2701 formatConvBuffer, | |
29409 | 2702 pal, 1); |
2703 lastInLumBuf++; | |
2704 } | |
29481 | 2705 while(lastInChrBuf < lastChrSrcY) { |
29409 | 2706 uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; |
2707 uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; | |
2708 chrBufIndex++; | |
29644 | 2709 DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n", |
2710 chrBufIndex, lastInChrBuf); | |
29409 | 2711 assert(chrBufIndex < 2*vChrBufSize); |
2712 assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); | |
2713 assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); | |
2714 //FIXME replace parameters through context struct (some at least) | |
18861 | 2715 |
30054
67e244d32f1c
Check if chroma horizontal scaler is needed in sws_init_swScale().
ramiro
parents:
30044
diff
changeset
|
2716 if (c->needs_hcscale) |
29409 | 2717 RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, |
30057 | 2718 hChrFilter, hChrFilterPos, hChrFilterSize, |
2719 formatConvBuffer, | |
29409 | 2720 pal); |
2721 lastInChrBuf++; | |
2722 } | |
2723 //wrap buf index around to stay inside the ring buffer | |
2724 if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; | |
2725 if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; | |
2726 if (!enough_lines) | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2727 break; //we can't output a dstY line so let's try with the next slice |
18861 | 2728 |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2729 #if COMPILE_TEMPLATE_MMX |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
2730 c->blueDither= ff_dither8[dstY&1]; |
27683 | 2731 if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555) |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
2732 c->greenDither= ff_dither8[dstY&1]; |
27683 | 2733 else |
27686
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
2734 c->greenDither= ff_dither4[dstY&1]; |
235164d3b407
Remove b5Dither, g5Dither and r5Dither from libswscale.
cehoyos
parents:
27683
diff
changeset
|
2735 c->redDither= ff_dither8[(dstY+1)&1]; |
18861 | 2736 #endif |
29481 | 2737 if (dstY < dstH-2) { |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2738 const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2739 const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2740 const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2741 #if COMPILE_TEMPLATE_MMX |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2742 int i; |
29481 | 2743 if (flags & SWS_ACCURATE_RND) { |
29480 | 2744 int s= APCK_SIZE / 8; |
29481 | 2745 for (i=0; i<vLumFilterSize; i+=2) { |
29480 | 2746 *(void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; |
2747 *(void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; | |
2748 lumMmxFilter[s*i+APCK_COEF/4 ]= | |
2749 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] | |
2750 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); | |
29481 | 2751 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { |
29480 | 2752 *(void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; |
2753 *(void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; | |
2754 alpMmxFilter[s*i+APCK_COEF/4 ]= | |
2755 alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; | |
2756 } | |
2757 } | |
29481 | 2758 for (i=0; i<vChrFilterSize; i+=2) { |
29480 | 2759 *(void**)&chrMmxFilter[s*i ]= chrSrcPtr[i ]; |
2760 *(void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrSrcPtr[i+(vChrFilterSize>1)]; | |
2761 chrMmxFilter[s*i+APCK_COEF/4 ]= | |
2762 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] | |
2763 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); | |
2764 } | |
29481 | 2765 } else { |
2766 for (i=0; i<vLumFilterSize; i++) { | |
29480 | 2767 lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i]; |
2768 lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32; | |
2769 lumMmxFilter[4*i+2]= | |
2770 lumMmxFilter[4*i+3]= | |
2771 ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001; | |
29481 | 2772 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { |
29480 | 2773 alpMmxFilter[4*i+0]= (int32_t)alpSrcPtr[i]; |
2774 alpMmxFilter[4*i+1]= (uint64_t)alpSrcPtr[i] >> 32; | |
2775 alpMmxFilter[4*i+2]= | |
2776 alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2]; | |
2777 } | |
2778 } | |
29481 | 2779 for (i=0; i<vChrFilterSize; i++) { |
29480 | 2780 chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i]; |
2781 chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32; | |
2782 chrMmxFilter[4*i+2]= | |
2783 chrMmxFilter[4*i+3]= | |
2784 ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001; | |
28976 | 2785 } |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2786 } |
18861 | 2787 #endif |
29481 | 2788 if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2789 const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2790 if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2791 c->yuv2nv12X(c, |
29480 | 2792 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2793 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2794 dest, uDest, dstW, chrDstW, dstFormat); | |
29481 | 2795 } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2796 const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2797 if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi |
29481 | 2798 if (is16BPS(dstFormat)) { |
29475 | 2799 yuv2yuvX16inC( |
29480 | 2800 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2801 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2802 alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, | |
2803 dstFormat); | |
29481 | 2804 } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12 |
29643
c2b0efdf5358
Use correct buffers in vertical scaler in unscaled YV12 case.
ramiro
parents:
29608
diff
changeset
|
2805 int16_t *lumBuf = lumSrcPtr[0]; |
c2b0efdf5358
Use correct buffers in vertical scaler in unscaled YV12 case.
ramiro
parents:
29608
diff
changeset
|
2806 int16_t *chrBuf= chrSrcPtr[0]; |
c2b0efdf5358
Use correct buffers in vertical scaler in unscaled YV12 case.
ramiro
parents:
29608
diff
changeset
|
2807 int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2808 c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW); |
29481 | 2809 } else { //General YV12 |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2810 c->yuv2yuvX(c, |
29480 | 2811 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2812 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2813 alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); | |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2814 } |
29481 | 2815 } else { |
27182
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2816 assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); |
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2817 assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); |
29481 | 2818 if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2819 int chrAlpha= vChrFilter[2*dstY+1]; |
29481 | 2820 if(flags & SWS_FULL_CHR_H_INT) { |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2821 yuv2rgbXinC_full(c, //FIXME write a packed1_full function |
29480 | 2822 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2823 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2824 alpSrcPtr, dest, dstW, dstY); | |
29481 | 2825 } else { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2826 c->yuv2packed1(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1), |
29480 | 2827 alpPixBuf ? *alpSrcPtr : NULL, |
2828 dest, dstW, chrAlpha, dstFormat, flags, dstY); | |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2829 } |
29481 | 2830 } else if (vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2831 int lumAlpha= vLumFilter[2*dstY+1]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2832 int chrAlpha= vChrFilter[2*dstY+1]; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2833 lumMmxFilter[2]= |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2834 lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2835 chrMmxFilter[2]= |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2836 chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; |
29481 | 2837 if(flags & SWS_FULL_CHR_H_INT) { |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2838 yuv2rgbXinC_full(c, //FIXME write a packed2_full function |
29480 | 2839 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2840 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2841 alpSrcPtr, dest, dstW, dstY); | |
29481 | 2842 } else { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2843 c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1), |
29480 | 2844 alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL, |
2845 dest, dstW, lumAlpha, chrAlpha, dstY); | |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2846 } |
29481 | 2847 } else { //general RGB |
2848 if(flags & SWS_FULL_CHR_H_INT) { | |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2849 yuv2rgbXinC_full(c, |
29480 | 2850 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2851 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2852 alpSrcPtr, dest, dstW, dstY); | |
29481 | 2853 } else { |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2854 c->yuv2packedX(c, |
29480 | 2855 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2856 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2857 alpSrcPtr, dest, dstW, dstY); | |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2858 } |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2859 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2860 } |
29481 | 2861 } else { // hmm looks like we can't use MMX here without overwriting this array's tail |
29103
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2862 const int16_t **lumSrcPtr= (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2863 const int16_t **chrSrcPtr= (const int16_t **)chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; |
06c79db43cd8
swscale: Add const to some swScale functions' parameters.
ramiro
parents:
29090
diff
changeset
|
2864 const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; |
29481 | 2865 if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2866 const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2867 if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2868 yuv2nv12XinC( |
29480 | 2869 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2870 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2871 dest, uDest, dstW, chrDstW, dstFormat); | |
29481 | 2872 } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2873 const int chrSkipMask= (1<<c->chrDstVSubSample)-1; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2874 if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi |
29481 | 2875 if (is16BPS(dstFormat)) { |
29475 | 2876 yuv2yuvX16inC( |
29480 | 2877 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2878 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2879 alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, | |
2880 dstFormat); | |
29481 | 2881 } else { |
29476 | 2882 yuv2yuvXinC( |
29480 | 2883 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2884 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2885 alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); | |
29475 | 2886 } |
29481 | 2887 } else { |
27182
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2888 assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); |
f7b6d1014b6b
Remove ASSERT() macro. SoC Patch from Keiji Costantini
lu_zero
parents:
27158
diff
changeset
|
2889 assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); |
29481 | 2890 if(flags & SWS_FULL_CHR_H_INT) { |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2891 yuv2rgbXinC_full(c, |
29480 | 2892 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2893 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2894 alpSrcPtr, dest, dstW, dstY); | |
29481 | 2895 } else { |
27568 | 2896 yuv2packedXinC(c, |
29480 | 2897 vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, |
2898 vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | |
2899 alpSrcPtr, dest, dstW, dstY); | |
27548
78da4c8b2293
Implement full horizontal chroma for rgb/bgr24/32 output.
michael
parents:
27546
diff
changeset
|
2900 } |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2901 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2902 } |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2903 } |
18861 | 2904 |
28977 | 2905 if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf) |
2906 fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255); | |
2907 | |
29404
efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
ramiro
parents:
29403
diff
changeset
|
2908 #if COMPILE_TEMPLATE_MMX |
29088
d8a28bef8bc3
swscale: Execute sfence and emms depending on runtime flags.
ramiro
parents:
29060
diff
changeset
|
2909 if (flags & SWS_CPU_CAPS_MMX2 ) __asm__ volatile("sfence":::"memory"); |
d8a28bef8bc3
swscale: Execute sfence and emms depending on runtime flags.
ramiro
parents:
29060
diff
changeset
|
2910 /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ |
d8a28bef8bc3
swscale: Execute sfence and emms depending on runtime flags.
ramiro
parents:
29060
diff
changeset
|
2911 if (flags & SWS_CPU_CAPS_3DNOW) __asm__ volatile("femms" :::"memory"); |
d8a28bef8bc3
swscale: Execute sfence and emms depending on runtime flags.
ramiro
parents:
29060
diff
changeset
|
2912 else __asm__ volatile("emms" :::"memory"); |
18861 | 2913 #endif |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2914 /* store changed local vars back in the context */ |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2915 c->dstY= dstY; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2916 c->lumBufIndex= lumBufIndex; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2917 c->chrBufIndex= chrBufIndex; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2918 c->lastInLumBuf= lastInLumBuf; |
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2919 c->lastInChrBuf= lastInChrBuf; |
18861 | 2920 |
23161
ee7358c1726c
cosmetics attack, part IV: Remove all tabs and prettyprint/reindent the code.
diego
parents:
23129
diff
changeset
|
2921 return dstY - lastDstY; |
18861 | 2922 } |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2923 |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2924 static void RENAME(sws_init_swScale)(SwsContext *c) |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2925 { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2926 enum PixelFormat srcFormat = c->srcFormat; |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2927 |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2928 c->yuv2nv12X = RENAME(yuv2nv12X ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2929 c->yuv2yuv1 = RENAME(yuv2yuv1 ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2930 c->yuv2yuvX = RENAME(yuv2yuvX ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2931 c->yuv2packed1 = RENAME(yuv2packed1 ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2932 c->yuv2packed2 = RENAME(yuv2packed2 ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2933 c->yuv2packedX = RENAME(yuv2packedX ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2934 |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2935 c->hScale = RENAME(hScale ); |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2936 |
30043
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2937 #if COMPILE_TEMPLATE_MMX |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2938 // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2939 if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed) |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2940 #else |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2941 if (c->flags & SWS_FAST_BILINEAR) |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2942 #endif |
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2943 { |
30044 | 2944 c->hyscale_fast = RENAME(hyscale_fast); |
2945 c->hcscale_fast = RENAME(hcscale_fast); | |
30043
6e9c29e16658
Set fast_bilinear functions in sws_init_swScale().
ramiro
parents:
30040
diff
changeset
|
2946 } |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2947 |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2948 c->chrToYV12 = NULL; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2949 switch(srcFormat) { |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2950 case PIX_FMT_YUYV422 : c->chrToYV12 = RENAME(yuy2ToUV); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2951 case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2952 case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2953 case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2954 case PIX_FMT_RGB8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2955 case PIX_FMT_BGR8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2956 case PIX_FMT_PAL8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2957 case PIX_FMT_BGR4_BYTE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2958 case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break; |
29608
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
2959 case PIX_FMT_YUV420P16BE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
2960 case PIX_FMT_YUV422P16BE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2961 case PIX_FMT_YUV444P16BE: c->chrToYV12 = RENAME(BEToUV); break; |
29608
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
2962 case PIX_FMT_YUV420P16LE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
2963 case PIX_FMT_YUV422P16LE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2964 case PIX_FMT_YUV444P16LE: c->chrToYV12 = RENAME(LEToUV); break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2965 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2966 if (c->chrSrcHSubSample) { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2967 switch(srcFormat) { |
29299
24954ec81529
Partial (low bits ignored, no direct transcoding into other RGB formats) support
kostya
parents:
29278
diff
changeset
|
2968 case PIX_FMT_RGB48BE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2969 case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_half; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2970 case PIX_FMT_RGB32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2971 case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV_half; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2972 case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV_half); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2973 case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_half; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2974 case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_half; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2975 case PIX_FMT_BGR32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2976 case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV_half; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2977 case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV_half); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2978 case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_half; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2979 case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_half; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2980 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2981 } else { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2982 switch(srcFormat) { |
29299
24954ec81529
Partial (low bits ignored, no direct transcoding into other RGB formats) support
kostya
parents:
29278
diff
changeset
|
2983 case PIX_FMT_RGB48BE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2984 case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2985 case PIX_FMT_RGB32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2986 case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2987 case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2988 case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2989 case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2990 case PIX_FMT_BGR32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2991 case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2992 case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2993 case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2994 case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2995 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2996 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
2997 |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2998 c->lumToYV12 = NULL; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
2999 c->alpToYV12 = NULL; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3000 switch (srcFormat) { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3001 case PIX_FMT_YUYV422 : |
29608
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3002 case PIX_FMT_YUV420P16BE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3003 case PIX_FMT_YUV422P16BE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3004 case PIX_FMT_YUV444P16BE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3005 case PIX_FMT_GRAY16BE : c->lumToYV12 = RENAME(yuy2ToY); break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3006 case PIX_FMT_UYVY422 : |
29608
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3007 case PIX_FMT_YUV420P16LE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3008 case PIX_FMT_YUV422P16LE: |
ff34398b14b1
Make 16bit YUV formats compatible with NE avcodec_get_pix_fmt().
ramiro
parents:
29482
diff
changeset
|
3009 case PIX_FMT_YUV444P16LE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3010 case PIX_FMT_GRAY16LE : c->lumToYV12 = RENAME(uyvyToY); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3011 case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3012 case PIX_FMT_BGR565 : c->lumToYV12 = bgr16ToY; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3013 case PIX_FMT_BGR555 : c->lumToYV12 = bgr15ToY; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3014 case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3015 case PIX_FMT_RGB565 : c->lumToYV12 = rgb16ToY; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3016 case PIX_FMT_RGB555 : c->lumToYV12 = rgb15ToY; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3017 case PIX_FMT_RGB8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3018 case PIX_FMT_BGR8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3019 case PIX_FMT_PAL8 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3020 case PIX_FMT_BGR4_BYTE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3021 case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3022 case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y; break; |
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3023 case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y; break; |
29139
cd5d58b02153
Do not use abgrToA for both luma and alpha channel in hyscale.
sdrik
parents:
29105
diff
changeset
|
3024 case PIX_FMT_RGB32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3025 case PIX_FMT_RGB32_1: c->lumToYV12 = bgr32ToY; break; |
29139
cd5d58b02153
Do not use abgrToA for both luma and alpha channel in hyscale.
sdrik
parents:
29105
diff
changeset
|
3026 case PIX_FMT_BGR32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3027 case PIX_FMT_BGR32_1: c->lumToYV12 = rgb32ToY; break; |
29299
24954ec81529
Partial (low bits ignored, no direct transcoding into other RGB formats) support
kostya
parents:
29278
diff
changeset
|
3028 case PIX_FMT_RGB48BE: |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3029 case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48ToY; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3030 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3031 if (c->alpPixBuf) { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3032 switch (srcFormat) { |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3033 case PIX_FMT_RGB32 : |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3034 case PIX_FMT_RGB32_1: |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3035 case PIX_FMT_BGR32 : |
30055
4c712237a601
Rename function pointers used to convert from the input pixel format to the
ramiro
parents:
30054
diff
changeset
|
3036 case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA; break; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3037 } |
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3038 } |
30039
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3039 |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3040 switch (srcFormat) { |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3041 case PIX_FMT_RGB32 : |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3042 case PIX_FMT_BGR32 : |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3043 c->alpSrcOffset = 3; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3044 break; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3045 case PIX_FMT_RGB32_1: |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3046 case PIX_FMT_BGR32_1: |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3047 c->lumSrcOffset = ALT32_CORR; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3048 c->chrSrcOffset = ALT32_CORR; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3049 break; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3050 case PIX_FMT_RGB48LE: |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3051 c->lumSrcOffset = 1; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3052 c->chrSrcOffset = 1; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3053 c->alpSrcOffset = 1; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3054 break; |
3b0026eb9c4d
Set horizontal scaler's src offsets in context in sws_init_swScale().
ramiro
parents:
29935
diff
changeset
|
3055 } |
30040
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3056 |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3057 if (c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))) { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3058 if (c->srcRange) { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3059 c->lumConvertRange = RENAME(lumRangeFromJpeg); |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3060 c->chrConvertRange = RENAME(chrRangeFromJpeg); |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3061 } else { |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3062 c->lumConvertRange = RENAME(lumRangeToJpeg); |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3063 c->chrConvertRange = RENAME(chrRangeToJpeg); |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3064 } |
79adcc3e4e83
Set horizontal scaler's range conversion in context in sws_init_swScale().
ramiro
parents:
30039
diff
changeset
|
3065 } |
30054
67e244d32f1c
Check if chroma horizontal scaler is needed in sws_init_swScale().
ramiro
parents:
30044
diff
changeset
|
3066 |
67e244d32f1c
Check if chroma horizontal scaler is needed in sws_init_swScale().
ramiro
parents:
30044
diff
changeset
|
3067 if (!(isGray(srcFormat) || isGray(c->dstFormat) || |
67e244d32f1c
Check if chroma horizontal scaler is needed in sws_init_swScale().
ramiro
parents:
30044
diff
changeset
|
3068 srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE)) |
67e244d32f1c
Check if chroma horizontal scaler is needed in sws_init_swScale().
ramiro
parents:
30044
diff
changeset
|
3069 c->needs_hcscale = 1; |
29105
9502a8895e77
swscale: Use function pointers for swScale functions.
ramiro
parents:
29103
diff
changeset
|
3070 } |