annotate i386/dsputil_mmx_rnd.h @ 822:21d400c67fc5 libavcodec

fixing msmpeg4v3 with mb_height % slice_height != 0
author michaelni
date Fri, 01 Nov 2002 18:55:03 +0000
parents 45e8f39fda50
children 13aec7e50c52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
1 /*
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
2 * DSP utils mmx functions are compiled twice for rnd/no_rnd
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
4 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
9 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
13 * Lesser General Public License for more details.
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
14 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
18 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
20 * mostly rewritten by Michael Niedermayer <michaelni@gmx.at>
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
21 * and improved by Zdenek Kabelac <kabi@users.sf.net>
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
22 */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
23
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
24 // put_pixels
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
25 static void DEF(put, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
26 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
27 MOVQ_BFE(mm6);
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
28 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
29 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
30 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
31 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
32 "movq (%1), %%mm0 \n\t"
447
810f726ee3cc * using unrolled loops seems to help to MMX Celerons
kabi
parents: 445
diff changeset
33 "movq 1(%1), %%mm1 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
34 "movq (%1, %3), %%mm2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
35 "movq 1(%1, %3), %%mm3 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
36 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
37 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
38 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
39 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
40 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
41 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
42 "movq 1(%1), %%mm1 \n\t"
447
810f726ee3cc * using unrolled loops seems to help to MMX Celerons
kabi
parents: 445
diff changeset
43 "movq (%1, %3), %%mm2 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
44 "movq 1(%1, %3), %%mm3 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
45 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
46 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
47 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
48 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
49 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
50 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
51 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
52 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
53 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
54 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
55 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
56
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
57 static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
58 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
59 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
60 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
61 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
62 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
63 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
64 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
65 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
66 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
67 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
68 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
69 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
70 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
71 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
72 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
73 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
74 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
75 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
76 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
77 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
78 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
79 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
80 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
81 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
82 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
83 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
84 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
85 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
86 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
87 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
88 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
89 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
90 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
91 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
92 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
93 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
94 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
95 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
96 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
97 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
98 :"+g"(h), "+S"(pixels), "+D"(block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
99 :"r"(line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
100 :"eax", "memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
101 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
102
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
103 static void DEF(put, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
104 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
105 MOVQ_BFE(mm6);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
106 __asm __volatile(
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
107 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
108 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
109 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
110 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
111 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
112 "movq (%1, %%eax),%%mm2 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
113 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
114 "movq %%mm4, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
115 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
116 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
117 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
118 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
119 "movq (%1, %%eax),%%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
120 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
121 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
122 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
123 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
124 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
125 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
126 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
127 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
128 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
129 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
130 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
131
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
132 static void DEF(put, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
133 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
134 MOVQ_ZERO(mm7);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
135 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
136 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
137 "movq (%1), %%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
138 "movq 1(%1), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
139 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
140 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
141 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
142 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
143 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
144 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
145 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
146 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
147 "xorl %%eax, %%eax \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
148 "addl %3, %1 \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
149 ".balign 8 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
150 "1: \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
151 "movq (%1, %%eax), %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
152 "movq 1(%1, %%eax), %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
153 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
154 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
155 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
156 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
157 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
158 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
159 "paddusw %%mm2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
160 "paddusw %%mm3, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
161 "paddusw %%mm6, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
162 "paddusw %%mm6, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
163 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
164 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
165 "psrlw $2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
166 "psrlw $2, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
167 "packuswb %%mm5, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
168 "movq %%mm4, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
169 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
170
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
171 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
172 "movq 1(%1, %%eax), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
173 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
174 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
175 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
176 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
177 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
178 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
179 "paddusw %%mm2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
180 "paddusw %%mm3, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
181 "paddusw %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
182 "paddusw %%mm6, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
183 "paddusw %%mm4, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
184 "paddusw %%mm5, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
185 "psrlw $2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
186 "psrlw $2, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
187 "packuswb %%mm1, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
188 "movq %%mm0, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
189 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
190
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
191 "subl $2, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
192 "jnz 1b \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
193 :"+g"(h), "+S"(pixels)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
194 :"D"(block), "r"(line_size)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
195 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
196 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
197
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
198 // avg_pixels
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
199 // in case more speed is needed - unroling would certainly help
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
200 static void DEF(avg, pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
201 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
202 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
203 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
204 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
205 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
206 "movq %0, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
207 "movq %1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
208 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
209 "movq %%mm2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
210 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
211 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
212 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
213 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
214 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
215 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
216 while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
217 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
218
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
219 static void DEF(avg, pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
220 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
221 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
222 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
223 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
224 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
225 "movq %0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
226 "movq %1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
227 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
228 "movq %%mm2, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
229 "movq 8%0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
230 "movq 8%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
231 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
232 "movq %%mm2, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
233 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
234 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
235 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
236 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
237 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
238 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
239 while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
240 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
241
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
242 static void DEF(avg, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
243 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
244 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
245 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
246 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
247 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
248 "movq %1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
249 "movq 1%1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
250 "movq %0, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
251 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
252 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
253 "movq %%mm0, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
254 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
255 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
256 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
257 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
258 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
259 } while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
260 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
261
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
262 static void DEF(avg, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
263 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
264 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
265 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
266 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
267 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
268 "movq %1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
269 "movq 1%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
270 "movq %0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
271 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
272 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
273 "movq %%mm0, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
274 "movq 8%1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
275 "movq 9%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
276 "movq 8%0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
277 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
278 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
279 "movq %%mm0, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
280 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
281 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
282 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
283 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
284 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
285 } while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
286 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
287
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
288 static void DEF(avg, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
289 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
290 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
291 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
292 "lea (%3, %3), %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
293 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
294 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
295 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
296 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
297 "movq (%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
298 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
299 "movq (%2), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
300 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
301 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
302 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
303 "movq %%mm0, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
304 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
305 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
306 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
307
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
308 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
309 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
310 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
311 "movq (%2), %%mm3 \n\t"
606
72d9661683f2 dont trash mm0, its still used in the next iteration of the loop (fixes strange horizontal lines on some blocks in b frames on mmx only cpus)
michaelni
parents: 470
diff changeset
312 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
313 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
314 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6)
606
72d9661683f2 dont trash mm0, its still used in the next iteration of the loop (fixes strange horizontal lines on some blocks in b frames on mmx only cpus)
michaelni
parents: 470
diff changeset
315 "movq %%mm2, (%2) \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
316 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
317 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
318 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
319
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
320 "subl $4, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
321 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
322 :"+g"(h), "+S"(pixels), "+D"(block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
323 :"r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
324 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
325 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
326
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
327 // this routine is 'slightly' suboptimal but mostly unused
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
328 static void DEF(avg, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
329 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
330 MOVQ_ZERO(mm7);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
331 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
332 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
333 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
334 "movq 1(%1), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
335 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
336 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
337 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
338 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
339 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
340 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
341 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
342 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
343 "xorl %%eax, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
344 "addl %3, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
345 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
346 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
347 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
348 "movq 1(%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
349 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
350 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
351 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
352 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
353 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
354 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
355 "paddusw %%mm2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
356 "paddusw %%mm3, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
357 "paddusw %%mm6, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
358 "paddusw %%mm6, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
359 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
360 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
361 "psrlw $2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
362 "psrlw $2, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
363 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
364 "packuswb %%mm5, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
365 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
366 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
367 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
368 "movq %%mm5, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
369 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
370
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
371 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
372 "movq 1(%1, %%eax), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
373 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
374 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
375 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
376 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
377 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
378 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
379 "paddusw %%mm2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
380 "paddusw %%mm3, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
381 "paddusw %%mm6, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
382 "paddusw %%mm6, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
383 "paddusw %%mm4, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
384 "paddusw %%mm5, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
385 "psrlw $2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
386 "psrlw $2, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
387 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
388 "packuswb %%mm1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
389 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
390 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
391 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
392 "movq %%mm1, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
393 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
394
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
395 "subl $2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
396 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
397 :"+g"(h), "+S"(pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
398 :"D"(block), "r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
399 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
400 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
401
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
402 //FIXME optimize
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
403 static void DEF(put, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
404 DEF(put, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
405 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
406 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
407
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
408 static void DEF(put, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
409 DEF(put, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
410 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
411 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
412
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
413 static void DEF(avg, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
414 DEF(avg, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
415 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
416 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
417
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
418 static void DEF(avg, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
419 DEF(avg, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
420 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
421 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
422
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
423