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