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