annotate i386/dsputil_mmx_rnd.h @ 967:274b518c4ecb libavcodec

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