annotate i386/dsputil_mmx_avg.h @ 909:8ae1e4c24e91 libavcodec

new PSNR code (now works with chroma, b frames, ...) rename *_TYPE to FF_*_TYPE for the external API allow user specified pict_type
author michaelni
date Wed, 04 Dec 2002 21:13:02 +0000
parents 45e8f39fda50
children 13aec7e50c52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * DSP utils : average functions are compiled twice for 3dnow/mmx2
429
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
4 * Copyright (c) 2002 Michael Niedermayer
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 *
429
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
6 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
8 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
9 * version 2 of the License, or (at your option) any later version.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 *
429
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
11 * This library is distributed in the hope that it will be useful,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
14 * Lesser General Public License for more details.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 *
429
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
17 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 416
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
21 * mostly rewritten by Michael Niedermayer <michaelni@gmx.at>
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
22 * and improved by Zdenek Kabelac <kabi@users.sf.net>
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 */
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
24
389
f874493a1970 tried to avoid gcc 2.95.2 bug by puting explicit register constraints - added comment about rounding bug in some functions (need to correct or suppress them for regression tests)
glantau
parents: 387
diff changeset
25 /* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
26 clobber bug - now it will work with 2.95.2 and also with -fPIC
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
27 */
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
28 static void DEF(put_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 {
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
30 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
31 "lea (%3, %3), %%eax \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
32 "1: \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
33 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
34 "movq (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
35 PAVGB" 1(%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
36 PAVGB" 1(%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
37 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
38 "movq %%mm1, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
39 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
40 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
41 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
42 "movq (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
43 PAVGB" 1(%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
44 PAVGB" 1(%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
45 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
46 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
47 "movq %%mm1, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
48 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
49 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
50 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
51 :"+g"(h), "+S"(pixels), "+D"(block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
52 :"r" (line_size)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
53 :"%eax", "memory");
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
54 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
55
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
56 static void DEF(put_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
57 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
58 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
59 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
60 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
61 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
62 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
63 "movq 8(%1), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
64 "movq 8(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
65 PAVGB" 1(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
66 PAVGB" 1(%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
67 PAVGB" 9(%1), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
68 PAVGB" 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
69 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
70 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
71 "movq %%mm2, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
72 "movq %%mm3, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
73 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
74 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
75 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
76 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
77 "movq 8(%1), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
78 "movq 8(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
79 PAVGB" 1(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
80 PAVGB" 1(%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
81 PAVGB" 9(%1), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
82 PAVGB" 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
83 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
84 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
85 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
86 "movq %%mm2, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
87 "movq %%mm3, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
88 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
89 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
90 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
91 :"+g"(h), "+S"(pixels), "+D"(block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
92 :"r" (line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
93 :"%eax", "memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
94 }
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
95
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
96 /* GL: this function does incorrect rounding if overflow */
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
97 static void DEF(put_no_rnd_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
98 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
99 MOVQ_BONE(mm6);
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
100 __asm __volatile(
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
101 "lea (%3, %3), %%eax \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
102 "1: \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
103 "movq (%1), %%mm0 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
104 "movq (%1, %3), %%mm2 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
105 "movq 1(%1), %%mm1 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
106 "movq 1(%1, %3), %%mm3 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
107 "addl %%eax, %1 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
108 "psubusb %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
109 "psubusb %%mm6, %%mm2 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
110 PAVGB" %%mm1, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
111 PAVGB" %%mm3, %%mm2 \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
112 "movq %%mm0, (%2) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
113 "movq %%mm2, (%2, %3) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
114 "movq (%1), %%mm0 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
115 "movq 1(%1), %%mm1 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
116 "movq (%1, %3), %%mm2 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
117 "movq 1(%1, %3), %%mm3 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
118 "addl %%eax, %2 \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
119 "addl %%eax, %1 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
120 "psubusb %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
121 "psubusb %%mm6, %%mm2 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
122 PAVGB" %%mm1, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
123 PAVGB" %%mm3, %%mm2 \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
124 "movq %%mm0, (%2) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
125 "movq %%mm2, (%2, %3) \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
126 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
127 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
128 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
129 :"+g"(h), "+S"(pixels), "+D"(block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
130 :"r" (line_size)
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
131 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
133
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
134 static void DEF(put_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 {
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
136 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
137 "lea (%3, %3), %%eax \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
138 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
139 "subl %3, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
140 "1: \n\t"
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
141 "movq (%1, %3), %%mm1 \n\t"
416
ca1f2c0e44ef * fixed contrains and avoid usage of scale index access
kabi
parents: 414
diff changeset
142 "movq (%1, %%eax), %%mm2 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
143 "addl %%eax, %1 \n\t"
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
144 PAVGB" %%mm1, %%mm0 \n\t"
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
145 PAVGB" %%mm2, %%mm1 \n\t"
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
146 "movq %%mm0, (%2, %3) \n\t"
416
ca1f2c0e44ef * fixed contrains and avoid usage of scale index access
kabi
parents: 414
diff changeset
147 "movq %%mm1, (%2, %%eax) \n\t"
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
148 "movq (%1, %3), %%mm1 \n\t"
416
ca1f2c0e44ef * fixed contrains and avoid usage of scale index access
kabi
parents: 414
diff changeset
149 "movq (%1, %%eax), %%mm0 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
150 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
151 "addl %%eax, %1 \n\t"
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
152 PAVGB" %%mm1, %%mm2 \n\t"
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
153 PAVGB" %%mm0, %%mm1 \n\t"
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
154 "movq %%mm2, (%2, %3) \n\t"
416
ca1f2c0e44ef * fixed contrains and avoid usage of scale index access
kabi
parents: 414
diff changeset
155 "movq %%mm1, (%2, %%eax) \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
156 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
157 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
158 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
159 :"+g"(h), "+S"(pixels), "+D" (block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
160 :"r" (line_size)
413
1548abb7bbed * fix for -fPIC compilation - compiles with 2.95.2 as well - any
kabi
parents: 402
diff changeset
161 :"%eax", "memory");
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
162 }
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
163
389
f874493a1970 tried to avoid gcc 2.95.2 bug by puting explicit register constraints - added comment about rounding bug in some functions (need to correct or suppress them for regression tests)
glantau
parents: 387
diff changeset
164 /* GL: this function does incorrect rounding if overflow */
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
165 static void DEF(put_no_rnd_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
166 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
167 MOVQ_BONE(mm6);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
169 "lea (%3, %3), %%eax \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
170 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
171 "subl %3, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
172 "1: \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
173 "movq (%1, %3), %%mm1 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
174 "movq (%1, %%eax), %%mm2 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
175 "addl %%eax, %1 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
176 "psubusb %%mm6, %%mm1 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
177 PAVGB" %%mm1, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
178 PAVGB" %%mm2, %%mm1 \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
179 "movq %%mm0, (%2, %3) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
180 "movq %%mm1, (%2, %%eax) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
181 "movq (%1, %3), %%mm1 \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
182 "movq (%1, %%eax), %%mm0 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
183 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
184 "addl %%eax, %1 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
185 "psubusb %%mm6, %%mm1 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
186 PAVGB" %%mm1, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
187 PAVGB" %%mm0, %%mm1 \n\t"
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
188 "movq %%mm2, (%2, %3) \n\t"
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
189 "movq %%mm1, (%2, %%eax) \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
190 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
191 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
192 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
193 :"+g"(h), "+S"(pixels), "+D" (block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
194 :"r" (line_size)
439
6ae275655a23 * more PIC friendly and faster code
kabi
parents: 429
diff changeset
195 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
197
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
198 static void DEF(avg_pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
201 "lea (%3, %3), %%eax \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
202 "1: \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
203 "movq (%2), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
204 "movq (%2, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
205 PAVGB" (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
206 PAVGB" (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
207 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
208 "movq %%mm1, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
209 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
210 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
211 "movq (%2), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
212 "movq (%2, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
213 PAVGB" (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
214 PAVGB" (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
215 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
216 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
217 "movq %%mm1, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
218 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
219 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
220 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
221 :"+g"(h), "+S"(pixels), "+D"(block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
222 :"r" (line_size)
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
223 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
225
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
226 static void DEF(avg_pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
229 "lea (%3, %3), %%eax \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
230 "1: \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
231 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
232 "movq (%1, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
233 PAVGB" 1(%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
234 PAVGB" 1(%1, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
235 PAVGB" (%2), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
236 PAVGB" (%2, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
237 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
238 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
239 "movq %%mm2, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
240 "movq (%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
241 "movq (%1, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
242 PAVGB" 1(%1), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
243 PAVGB" 1(%1, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
244 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
245 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
246 PAVGB" (%2), %%mm0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
247 PAVGB" (%2, %3), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
248 "movq %%mm0, (%2) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
249 "movq %%mm2, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
250 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
251 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
252 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
253 :"+g"(h), "+S"(pixels), "+D"(block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
254 :"r" (line_size)
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
255 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
257
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
258 static void DEF(avg_pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 __asm __volatile(
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
261 "lea (%3, %3), %%eax \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
262 "movq (%1), %%mm0 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
263 "subl %3, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
264 "1: \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
265 "movq (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
266 "movq (%1, %%eax), %%mm2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
267 "addl %%eax, %1 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
268 PAVGB" %%mm1, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
269 PAVGB" %%mm2, %%mm1 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
270 "movq (%2, %3), %%mm3 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
271 "movq (%2, %%eax), %%mm4 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
272 PAVGB" %%mm3, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
273 PAVGB" %%mm4, %%mm1 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
274 "movq %%mm0, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
275 "movq %%mm1, (%2, %%eax) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
276 "movq (%1, %3), %%mm1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
277 "movq (%1, %%eax), %%mm0 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
278 PAVGB" %%mm1, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
279 PAVGB" %%mm0, %%mm1 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
280 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
281 "addl %%eax, %1 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
282 "movq (%2, %3), %%mm3 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
283 "movq (%2, %%eax), %%mm4 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
284 PAVGB" %%mm3, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
285 PAVGB" %%mm4, %%mm1 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
286 "movq %%mm2, (%2, %3) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
287 "movq %%mm1, (%2, %%eax) \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
288 "addl %%eax, %2 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
289 "subl $4, %0 \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
290 "jnz 1b \n\t"
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
291 :"+g"(h), "+S"(pixels), "+D"(block)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
292 :"r" (line_size)
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
293 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
295
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
296 // Note this is not correctly rounded, but this function is only used for b frames so it doesnt matter
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
297 static void DEF(avg_pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
298 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
299 MOVQ_BONE(mm6);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
300 __asm __volatile(
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
301 "lea (%3, %3), %%eax \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
302 "movq (%1), %%mm0 \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
303 PAVGB" 1(%1), %%mm0 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
304 ".balign 8 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
305 "1: \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
306 "movq (%1, %%eax), %%mm2 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
307 "movq (%1, %3), %%mm1 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 443
diff changeset
308 "psubusb %%mm6, %%mm2 \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
309 PAVGB" 1(%1, %3), %%mm1 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
310 PAVGB" 1(%1, %%eax), %%mm2 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
311 "addl %%eax, %1 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
312 PAVGB" %%mm1, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
313 PAVGB" %%mm2, %%mm1 \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
314 PAVGB" (%2), %%mm0 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
315 PAVGB" (%2, %3), %%mm1 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
316 "movq %%mm0, (%2) \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
317 "movq %%mm1, (%2, %3) \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
318 "movq (%1, %3), %%mm1 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
319 "movq (%1, %%eax), %%mm0 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
320 PAVGB" 1(%1, %3), %%mm1 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
321 PAVGB" 1(%1, %%eax), %%mm0 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
322 "addl %%eax, %2 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
323 "addl %%eax, %1 \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
324 PAVGB" %%mm1, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
325 PAVGB" %%mm0, %%mm1 \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
326 PAVGB" (%2), %%mm2 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
327 PAVGB" (%2, %3), %%mm1 \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
328 "movq %%mm2, (%2) \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
329 "movq %%mm1, (%2, %3) \n\t"
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
330 "addl %%eax, %2 \n\t"
441
c0de4d3c7d3c * optimized avg_* functions (except xy2)
kabi
parents: 439
diff changeset
331 "subl $4, %0 \n\t"
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
332 "jnz 1b \n\t"
443
63467327c06c * cosmetic minor change
kabi
parents: 442
diff changeset
333 :"+g"(h), "+S"(pixels), "+D"(block)
442
006965950f49 * optimized remaing avg_pixels_xy2
kabi
parents: 441
diff changeset
334 :"r" (line_size)
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 151
diff changeset
335 :"%eax", "memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
337
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
338 //FIXME the following could be optimized too ...
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
339 static void DEF(put_no_rnd_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
340 DEF(put_no_rnd_pixels8_x2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
341 DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
342 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
343 static void DEF(put_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
344 DEF(put_pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
345 DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
346 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
347 static void DEF(put_no_rnd_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
348 DEF(put_no_rnd_pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
349 DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
350 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
351 static void DEF(avg_pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
352 DEF(avg_pixels8)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
353 DEF(avg_pixels8)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
354 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
355 static void DEF(avg_pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
356 DEF(avg_pixels8_x2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
357 DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
358 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
359 static void DEF(avg_pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
360 DEF(avg_pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
361 DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
362 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
363 static void DEF(avg_pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
364 DEF(avg_pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
365 DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
366 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 448
diff changeset
367