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