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