annotate libswscale/swscale_template.c @ 28530:c86a4810a0f3

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