annotate i386/dsputil_mmx_rnd.h @ 954:13aec7e50c52 libavcodec

qpel in mmx2/3dnow qpel refinement quality parameter
author michaelni
date Sun, 05 Jan 2003 15:57:10 +0000
parents 45e8f39fda50
children 3ec070eef24a
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
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
57 static void DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
58 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
59 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
60 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
61 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
62 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
63 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
64 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
65 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
66 "movq (%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
67 "movq 8(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
68 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
69 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
70 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
71 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
72 "movq %%mm5, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
73 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
74 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
75 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
76 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
77 "movq (%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
78 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
79 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
80 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
81 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
82 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
83 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
84 "movq %%mm5, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
85 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
86 "subl $4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
87 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
88 :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
89 :"r"(src1Stride), "r"(dstStride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
90 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
91 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
92
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
93 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
94 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
95 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
96 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
97 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
98 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
99 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
100 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
101 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
102 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
103 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
104 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
105 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
106 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
107 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
108 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
109 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
110 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
111 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
112 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
113 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
114 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
115 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
116 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
117 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
118 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
119 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
120 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
121 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
122 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
123 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
124 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
125 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
126 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
127 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
128 "movq %%mm4, 8(%2) \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
129 "movq %%mm5, 8(%2, %3) \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
130 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
131 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
132 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
133 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
134 :"+g"(h), "+S"(pixels), "+D"(block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
135 :"r"(line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
136 :"eax", "memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
137 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
138
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
139 static void DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
140 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
141 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
142 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
143 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
144 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
145 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
146 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
147 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
148 "movq 8(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
149 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
150 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
151 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
152 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
153 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
154 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
155 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
156 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
157 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
158 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
159 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
160 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
161 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
162 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
163 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
164 "subl $2, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
165 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
166 :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
167 :"r"(src1Stride), "r"(dstStride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
168 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
169 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
170
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
171 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
172 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
173 MOVQ_BFE(mm6);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
174 __asm __volatile(
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
175 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
176 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
177 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
178 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
179 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
180 "movq (%1, %%eax),%%mm2 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
181 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
182 "movq %%mm4, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
183 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
184 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
185 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
186 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
187 "movq (%1, %%eax),%%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
188 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
189 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
190 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
191 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
192 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
193 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
194 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
195 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
196 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
197 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
198 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
199
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
200 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
201 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
202 MOVQ_ZERO(mm7);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
203 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
204 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
205 "movq (%1), %%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
206 "movq 1(%1), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
207 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
208 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
209 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
210 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
211 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
212 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
213 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
214 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
215 "xorl %%eax, %%eax \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
216 "addl %3, %1 \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
217 ".balign 8 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
218 "1: \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
219 "movq (%1, %%eax), %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
220 "movq 1(%1, %%eax), %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
221 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
222 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
223 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
224 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
225 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
226 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
227 "paddusw %%mm2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
228 "paddusw %%mm3, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
229 "paddusw %%mm6, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
230 "paddusw %%mm6, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
231 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
232 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
233 "psrlw $2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
234 "psrlw $2, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
235 "packuswb %%mm5, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
236 "movq %%mm4, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
237 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
238
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
239 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
240 "movq 1(%1, %%eax), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
241 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
242 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
243 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
244 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
245 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
246 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
247 "paddusw %%mm2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
248 "paddusw %%mm3, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
249 "paddusw %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
250 "paddusw %%mm6, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
251 "paddusw %%mm4, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
252 "paddusw %%mm5, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
253 "psrlw $2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
254 "psrlw $2, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
255 "packuswb %%mm1, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
256 "movq %%mm0, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
257 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
258
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
259 "subl $2, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
260 "jnz 1b \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
261 :"+g"(h), "+S"(pixels)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
262 :"D"(block), "r"(line_size)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
263 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
264 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
265
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
266 static void DEF(put, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
267 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
268 MOVQ_ZERO(mm7);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
269 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
270 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
271 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
272 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
273 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
274 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
275 "movq 64(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
276 "movq 136(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
277 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
278 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
279 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
280 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
281 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
282 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
283 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
284 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
285 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
286 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
287 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
288 "movq 64(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
289 "movq 136(%2), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
290 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
291 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
292 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
293 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
294 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
295 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
296 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
297 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
298 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
299 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
300 "movq %%mm3, (%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
301 "addl %4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
302 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
303 "addl $8, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
304 "decl %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
305 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
306 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
307 :"r"(stride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
308 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
309 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
310
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
311 static void DEF(put, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
312 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
313 MOVQ_ZERO(mm7);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
314 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
315 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
316 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
317 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
318 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
319 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
320 "movq 256(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
321 "movq 528(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
322 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
323 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
324 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
325 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
326 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
327 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
328 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
329 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
330 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
331 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
332 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
333 "movq 256(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
334 "movq 528(%2), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
335 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
336 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
337 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
338 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
339 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
340 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
341 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
342 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
343 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
344 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
345 "movq %%mm3, (%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
346 "movq 8(%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
347 "movq 8(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
348 "movq 264(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
349 "movq 536(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
350 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
351 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
352 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
353 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
354 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
355 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
356 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
357 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
358 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
359 "movq 8(%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
360 "movq 8(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
361 "movq 264(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
362 "movq 536(%2), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
363 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
364 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
365 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
366 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
367 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
368 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
369 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
370 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
371 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
372 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
373 "movq %%mm3, 8(%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
374 "addl %4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
375 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
376 "addl $16, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
377 "decl %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
378 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
379 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
380 :"r"(stride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
381 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
382 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
383
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
384 // avg_pixels
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
385 // in case more speed is needed - unroling would certainly help
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
386 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
387 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
388 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
389 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
390 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
391 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
392 "movq %0, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
393 "movq %1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
394 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
395 "movq %%mm2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
396 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
397 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
398 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
399 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
400 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
401 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
402 while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
403 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
404
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
405 static void DEF(avg, pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
406 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
407 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
408 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
409 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
410 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
411 "movq %0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
412 "movq %1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
413 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
414 "movq %%mm2, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
415 "movq 8%0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
416 "movq 8%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
417 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
418 "movq %%mm2, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
419 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
420 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
421 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
422 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
423 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
424 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
425 while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
426 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
427
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
428 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
429 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
430 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
431 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
432 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
433 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
434 "movq %1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
435 "movq 1%1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
436 "movq %0, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
437 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
438 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
439 "movq %%mm0, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
440 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
441 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
442 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
443 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
444 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
445 } while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
446 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
447
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
448 static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
449 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
450 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
451 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
452 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
453 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
454 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
455 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
456 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
457 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
458 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
459 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
460 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
461 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
462 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
463 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
464 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
465 src2 += 8;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
466 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
467 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
468
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
469 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
470 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
471 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
472 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
473 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
474 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
475 "movq %1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
476 "movq 1%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
477 "movq %0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
478 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
479 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
480 "movq %%mm0, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
481 "movq 8%1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
482 "movq 9%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
483 "movq 8%0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
484 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
485 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
486 "movq %%mm0, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
487 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
488 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
489 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
490 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
491 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
492 } while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
493 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
494
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
495 static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
496 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
497 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
498 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
499 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
500 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
501 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
502 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
503 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
504 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
505 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
506 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
507 "movq 8%1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
508 "movq 8%2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
509 "movq 8%0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
510 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
511 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
512 "movq %%mm0, 8%0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
513 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
514 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
515 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
516 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
517 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
518 src2 += 16;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
519 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
520 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
521
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
522 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
523 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
524 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
525 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
526 "lea (%3, %3), %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
527 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
528 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
529 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
530 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
531 "movq (%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
532 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
533 "movq (%2), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
534 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
535 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
536 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
537 "movq %%mm0, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
538 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
539 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
540 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
541
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
542 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
543 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
544 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
545 "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
546 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
547 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
548 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
549 "movq %%mm2, (%2) \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
550 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
551 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
552 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
553
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
554 "subl $4, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
555 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
556 :"+g"(h), "+S"(pixels), "+D"(block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
557 :"r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
558 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
559 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
560
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
561 // this routine is 'slightly' suboptimal but mostly unused
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
562 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
563 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
564 MOVQ_ZERO(mm7);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
565 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
566 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
567 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
568 "movq 1(%1), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
569 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
570 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
571 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
572 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
573 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
574 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
575 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
576 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
577 "xorl %%eax, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
578 "addl %3, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
579 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
580 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
581 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
582 "movq 1(%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
583 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
584 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
585 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
586 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
587 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
588 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
589 "paddusw %%mm2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
590 "paddusw %%mm3, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
591 "paddusw %%mm6, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
592 "paddusw %%mm6, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
593 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
594 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
595 "psrlw $2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
596 "psrlw $2, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
597 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
598 "packuswb %%mm5, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
599 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
600 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
601 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
602 "movq %%mm5, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
603 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
604
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
605 "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
606 "movq 1(%1, %%eax), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
607 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
608 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
609 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
610 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
611 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
612 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
613 "paddusw %%mm2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
614 "paddusw %%mm3, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
615 "paddusw %%mm6, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
616 "paddusw %%mm6, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
617 "paddusw %%mm4, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
618 "paddusw %%mm5, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
619 "psrlw $2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
620 "psrlw $2, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
621 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
622 "packuswb %%mm1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
623 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
624 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
625 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
626 "movq %%mm1, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
627 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
628
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
629 "subl $2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
630 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
631 :"+g"(h), "+S"(pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
632 :"D"(block), "r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
633 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
634 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
635
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
636 static void DEF(avg, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
637 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
638 MOVQ_ZERO(mm7);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
639 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
640 MOVQ_BFE(mm5);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
641 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
642 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
643 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
644 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
645 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
646 "movq 64(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
647 "movq 136(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
648 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
649 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
650 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
651 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
652 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
653 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
654 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
655 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
656 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
657 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
658 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
659 "movq 64(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
660 "movq 136(%4), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
661 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
662 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
663 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
664 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
665 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
666 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
667 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
668 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
669 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
670 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
671 "movq (%0), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
672 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
673 "movq %%mm3, (%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
674 "addl %4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
675 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
676 "addl $8, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
677 "decl %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
678 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
679 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
680 :"r"(stride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
681 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
682 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
683
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
684 static void DEF(avg, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
685 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
686 MOVQ_ZERO(mm7);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
687 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
688 MOVQ_BFE(mm5);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
689 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
690 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
691 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
692 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
693 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
694 "movq 256(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
695 "movq 528(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
696 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
697 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
698 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
699 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
700 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
701 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
702 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
703 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
704 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
705 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
706 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
707 "movq 256(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
708 "movq 528(%4), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
709 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
710 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
711 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
712 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
713 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
714 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
715 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
716 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
717 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
718 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
719 "movq (%0), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
720 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
721 "movq %%mm3, (%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
722 "movq 8(%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
723 "movq 8(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
724 "movq 264(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
725 "movq 536(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
726 "punpcklbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
727 "punpcklbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
728 "punpcklbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
729 "punpcklbw %%mm7, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
730 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
731 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
732 "paddusw %%mm2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
733 "paddusw %%mm1, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
734 "psrlw $2, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
735 "movq 8(%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
736 "movq 8(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
737 "movq 264(%2), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
738 "movq 536(%4), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
739 "punpckhbw %%mm7, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
740 "punpckhbw %%mm7, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
741 "punpckhbw %%mm7, %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
742 "punpckhbw %%mm7, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
743 "paddusw %%mm6, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
744 "paddusw %%mm0, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
745 "paddusw %%mm2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
746 "paddusw %%mm1, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
747 "psrlw $2, %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
748 "packuswb %%mm4, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
749 "movq 8(%0), %%mm4 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
750 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
751 "movq %%mm3, 8(%0) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
752 "addl %4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
753 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
754 "addl $16, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
755 "decl %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
756 "jnz 1b \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
757 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
758 :"r"(stride)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
759 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
760 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
761
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
762
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
763 //FIXME optimize
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
764 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
765 DEF(put, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
766 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
767 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
768
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
769 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
770 DEF(put, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
771 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
772 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
773
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
774 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
775 DEF(avg, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
776 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
777 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
778
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
779 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
780 DEF(avg, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
781 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
782 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
783
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
784