annotate i386/dsputil_mmx_rnd.h @ 1439:a4d00b1f0271 libavcodec

initial commit for Id RoQ and Interplay MVE multimedia subsystems
author tmmm
date Tue, 02 Sep 2003 04:32:02 +0000
parents b32afefe7d33
children 07a484280a82
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
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
25 static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *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(
985
42fdf7b24d2e typo (noticed by kabi)
michaelni
parents: 984
diff changeset
61 "testl $1, %0 \n\t"
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
62 " jz 1f \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
63 "movq (%1), %%mm0 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
64 "movq (%2), %%mm1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
65 "addl %4, %1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
66 "addl $8, %2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
67 PAVGB(%%mm0, %%mm1, %%mm4, %%mm6)
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
68 "movq %%mm4, (%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
69 "addl %5, %3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
70 "decl %0 \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
71 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
72 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
73 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
74 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
75 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
76 "movq (%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
77 "movq 8(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
78 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
79 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
80 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
81 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
82 "movq %%mm5, (%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 (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
85 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
86 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
87 "movq (%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
88 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
89 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
90 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
91 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
92 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
93 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
94 "movq %%mm5, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
95 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
96 "subl $4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
97 "jnz 1b \n\t"
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
98 #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
99 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
100 #else
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
101 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
102 #endif
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 965
diff changeset
103 :"S"(src1Stride), "D"(dstStride)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
104 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
105 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
106
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
107 static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
108 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
109 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
110 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
111 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
112 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
113 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
114 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
115 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
116 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
117 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
118 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
119 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
120 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
121 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
122 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
123 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
124 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
125 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
126 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
127 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
128 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
129 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
130 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
131 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
132 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
133 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
134 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
135 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
136 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
137 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
138 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
139 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
140 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
141 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
142 "movq %%mm4, 8(%2) \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
143 "movq %%mm5, 8(%2, %3) \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
144 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
145 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
146 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
147 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
148 :"+g"(h), "+S"(pixels), "+D"(block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
149 :"r"(line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
150 :"eax", "memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
151 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
152
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
153 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
154 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
155 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
156 __asm __volatile(
985
42fdf7b24d2e typo (noticed by kabi)
michaelni
parents: 984
diff changeset
157 "testl $1, %0 \n\t"
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
158 " jz 1f \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
159 "movq (%1), %%mm0 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
160 "movq (%2), %%mm1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
161 "movq 8(%1), %%mm2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
162 "movq 8(%2), %%mm3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
163 "addl %4, %1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
164 "addl $16, %2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
165 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
166 "movq %%mm4, (%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
167 "movq %%mm5, 8(%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
168 "addl %5, %3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
169 "decl %0 \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
170 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
171 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
172 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
173 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
174 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
175 "movq 8(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
176 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
177 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
178 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
179 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
180 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
181 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
182 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
183 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
184 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
185 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
186 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
187 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
188 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
189 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
190 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
191 "subl $2, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
192 "jnz 1b \n\t"
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
193 #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
194 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
195 #else
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
196 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
197 #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
198 :"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
199 :"memory");
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
200 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
201
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
202 static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
203 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
204 MOVQ_BFE(mm6);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
205 __asm __volatile(
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
206 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
207 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
208 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
209 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
210 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
211 "movq (%1, %%eax),%%mm2 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
212 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
213 "movq %%mm4, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
214 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
215 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
216 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
217 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
218 "movq (%1, %%eax),%%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
219 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
220 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
221 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
222 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
223 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
224 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
225 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
226 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
227 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
228 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
229 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
230
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
231 static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
232 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
233 MOVQ_ZERO(mm7);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
234 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
235 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
236 "movq (%1), %%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
237 "movq 1(%1), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
238 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
239 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
240 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
241 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
242 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
243 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
244 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
245 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
246 "xorl %%eax, %%eax \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
247 "addl %3, %1 \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
248 ".balign 8 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
249 "1: \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
250 "movq (%1, %%eax), %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
251 "movq 1(%1, %%eax), %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
252 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
253 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
254 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
255 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
256 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
257 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
258 "paddusw %%mm2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
259 "paddusw %%mm3, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
260 "paddusw %%mm6, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
261 "paddusw %%mm6, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
262 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
263 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
264 "psrlw $2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
265 "psrlw $2, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
266 "packuswb %%mm5, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
267 "movq %%mm4, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
268 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
269
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
270 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
271 "movq 1(%1, %%eax), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
272 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
273 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
274 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
275 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
276 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
277 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
278 "paddusw %%mm2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
279 "paddusw %%mm3, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
280 "paddusw %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
281 "paddusw %%mm6, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
282 "paddusw %%mm4, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
283 "paddusw %%mm5, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
284 "psrlw $2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
285 "psrlw $2, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
286 "packuswb %%mm1, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
287 "movq %%mm0, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
288 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
289
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
290 "subl $2, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
291 "jnz 1b \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
292 :"+g"(h), "+S"(pixels)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
293 :"D"(block), "r"(line_size)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
294 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
295 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
296
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
297 // avg_pixels
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
298 // in case more speed is needed - unroling would certainly help
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
299 static void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
300 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
301 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
302 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
303 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
304 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
305 "movq %0, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
306 "movq %1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
307 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
308 "movq %%mm2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
309 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
310 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
311 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
312 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
313 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
314 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
315 while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
316 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
317
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
318 static void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
319 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
320 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
321 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
322 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
323 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
324 "movq %0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
325 "movq %1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
326 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
327 "movq %%mm2, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
328 "movq 8%0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
329 "movq 8%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
330 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
331 "movq %%mm2, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
332 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
333 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
334 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
335 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
336 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
337 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
338 while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
339 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
340
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
341 static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
342 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
343 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
344 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
345 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
346 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
347 "movq %1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
348 "movq 1%1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
349 "movq %0, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
350 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
351 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
352 "movq %%mm0, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
353 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
354 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
355 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
356 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
357 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
358 } while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
359 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
360
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
361 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
362 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
363 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
364 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
365 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
366 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
367 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
368 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
369 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
370 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
371 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
372 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
373 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
374 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
375 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
376 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
377 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
378 src2 += 8;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
379 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
380 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
381
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
382 static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
383 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
384 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
385 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
386 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
387 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
388 "movq %1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
389 "movq 1%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
390 "movq %0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
391 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
392 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
393 "movq %%mm0, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
394 "movq 8%1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
395 "movq 9%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
396 "movq 8%0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
397 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
398 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
399 "movq %%mm0, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
400 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
401 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
402 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
403 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
404 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
405 } while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
406 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
407
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
408 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
409 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
410 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
411 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
412 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
413 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
414 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
415 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
416 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
417 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
418 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
419 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
420 "movq 8%1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
421 "movq 8%2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
422 "movq 8%0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
423 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
424 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
425 "movq %%mm0, 8%0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
426 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
427 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
428 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
429 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
430 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
431 src2 += 16;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
432 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
433 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
434
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
435 static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
436 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
437 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
438 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
439 "lea (%3, %3), %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
440 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
441 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
442 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
443 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
444 "movq (%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
445 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
446 "movq (%2), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
447 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
448 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
449 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
450 "movq %%mm0, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
451 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
452 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
453 "addl %%eax, %2 \n\t"
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 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
456 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
457 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
458 "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
459 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
460 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
461 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
462 "movq %%mm2, (%2) \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
463 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
464 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
465 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
466
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
467 "subl $4, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
468 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
469 :"+g"(h), "+S"(pixels), "+D"(block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
470 :"r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
471 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
472 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
473
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
474 // this routine is 'slightly' suboptimal but mostly unused
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
475 static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
476 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
477 MOVQ_ZERO(mm7);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
478 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
479 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
480 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
481 "movq 1(%1), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
482 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
483 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
484 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
485 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
486 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
487 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
488 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
489 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
490 "xorl %%eax, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
491 "addl %3, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
492 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
493 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
494 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
495 "movq 1(%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
496 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
497 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
498 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
499 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
500 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
501 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
502 "paddusw %%mm2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
503 "paddusw %%mm3, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
504 "paddusw %%mm6, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
505 "paddusw %%mm6, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
506 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
507 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
508 "psrlw $2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
509 "psrlw $2, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
510 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
511 "packuswb %%mm5, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
512 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
513 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
514 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
515 "movq %%mm5, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
516 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
517
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
518 "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
519 "movq 1(%1, %%eax), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
520 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
521 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
522 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
523 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
524 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
525 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
526 "paddusw %%mm2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
527 "paddusw %%mm3, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
528 "paddusw %%mm6, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
529 "paddusw %%mm6, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
530 "paddusw %%mm4, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
531 "paddusw %%mm5, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
532 "psrlw $2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
533 "psrlw $2, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
534 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
535 "packuswb %%mm1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
536 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
537 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
538 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
539 "movq %%mm1, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
540 "addl %3, %%eax \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 "subl $2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
543 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
544 :"+g"(h), "+S"(pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
545 :"D"(block), "r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
546 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
547 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
548
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
549 //FIXME optimize
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
550 static void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
551 DEF(put, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
552 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
553 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
554
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
555 static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
556 DEF(put, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
557 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
558 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
559
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
560 static void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
561 DEF(avg, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
562 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
563 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
564
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
565 static void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
566 DEF(avg, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
567 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
568 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
569
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
570