annotate i386/dsputil_mmx_rnd.h @ 2255:507690ff49a2 libavcodec

assertion when playing AVC/H.264 streams fix by (Loren Merritt <lorenm at u dot washington dot edu>)
author michael
date Sat, 25 Sep 2004 10:06:31 +0000
parents c4a476971abc
children 15cfba1b97b5
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.
1739
07a484280a82 copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents: 1064
diff changeset
4 * Copyright (c) 2003-2004 Michael Niedermayer <michaelni@gmx.at>
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
5 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
6 * 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
7 * 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
8 * 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
9 * 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
10 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * Lesser General Public License for more details.
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
15 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
16 * 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
17 * 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
18 * 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
19 *
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
20 * 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
21 * 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
22 * 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
23 */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
24
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
25 // put_pixels
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
26 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
27 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
28 MOVQ_BFE(mm6);
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
29 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
30 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
31 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
32 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
33 "movq (%1), %%mm0 \n\t"
447
810f726ee3cc * using unrolled loops seems to help to MMX Celerons
kabi
parents: 445
diff changeset
34 "movq 1(%1), %%mm1 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
35 "movq (%1, %3), %%mm2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
36 "movq 1(%1, %3), %%mm3 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
37 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
38 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
39 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
40 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
41 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
42 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
43 "movq 1(%1), %%mm1 \n\t"
447
810f726ee3cc * using unrolled loops seems to help to MMX Celerons
kabi
parents: 445
diff changeset
44 "movq (%1, %3), %%mm2 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
45 "movq 1(%1, %3), %%mm3 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
46 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
47 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
48 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
49 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
50 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
51 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
52 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
53 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
54 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
55 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
56 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
57
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
58 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
59 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
60 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
61 __asm __volatile(
985
42fdf7b24d2e typo (noticed by kabi)
michaelni
parents: 984
diff changeset
62 "testl $1, %0 \n\t"
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
63 " jz 1f \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
64 "movq (%1), %%mm0 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
65 "movq (%2), %%mm1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
66 "addl %4, %1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
67 "addl $8, %2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
68 PAVGB(%%mm0, %%mm1, %%mm4, %%mm6)
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
69 "movq %%mm4, (%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
70 "addl %5, %3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
71 "decl %0 \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
72 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
73 "1: \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 (%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 8(%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 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
81 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
82 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
83 "movq %%mm5, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
84 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
85 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
86 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
87 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
88 "movq (%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
89 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
90 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
91 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
92 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
93 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
94 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
95 "movq %%mm5, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
96 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
97 "subl $4, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
98 "jnz 1b \n\t"
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
99 #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
100 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
101 #else
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
102 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
103 #endif
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 965
diff changeset
104 :"S"(src1Stride), "D"(dstStride)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
105 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
106 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
107
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
108 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
109 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
110 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
111 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
112 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
113 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
114 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
115 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
116 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
117 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
118 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
119 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
120 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
121 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
122 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
123 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
124 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
125 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
126 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
127 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
128 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
129 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
130 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
131 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
132 "movq 1(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
133 "movq (%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
134 "movq 1(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
135 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
136 "movq %%mm4, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
137 "movq %%mm5, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
138 "movq 8(%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
139 "movq 9(%1), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
140 "movq 8(%1, %3), %%mm2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
141 "movq 9(%1, %3), %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
142 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
143 "movq %%mm4, 8(%2) \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
144 "movq %%mm5, 8(%2, %3) \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
145 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
146 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
147 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
148 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
149 :"+g"(h), "+S"(pixels), "+D"(block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
150 :"r"(line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
151 :"eax", "memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
152 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
153
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
154 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
155 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
156 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
157 __asm __volatile(
985
42fdf7b24d2e typo (noticed by kabi)
michaelni
parents: 984
diff changeset
158 "testl $1, %0 \n\t"
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
159 " jz 1f \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
160 "movq (%1), %%mm0 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
161 "movq (%2), %%mm1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
162 "movq 8(%1), %%mm2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
163 "movq 8(%2), %%mm3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
164 "addl %4, %1 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
165 "addl $16, %2 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
166 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
167 "movq %%mm4, (%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
168 "movq %%mm5, 8(%3) \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
169 "addl %5, %3 \n\t"
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
170 "decl %0 \n\t"
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
171 ".balign 8 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
172 "1: \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
173 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
174 "movq (%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
175 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
176 "movq 8(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
177 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
178 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
179 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
180 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
181 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
182 "movq (%1), %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
183 "movq 16(%2), %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
184 "movq 8(%1), %%mm2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
185 "movq 24(%2), %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
186 "addl %4, %1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
187 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
188 "movq %%mm4, (%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
189 "movq %%mm5, 8(%3) \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
190 "addl %5, %3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
191 "addl $32, %2 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
192 "subl $2, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
193 "jnz 1b \n\t"
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
194 #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
195 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
196 #else
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
197 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
198 #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
199 :"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
200 :"memory");
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
201 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
202
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
203 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
204 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
205 MOVQ_BFE(mm6);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
206 __asm __volatile(
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
207 "lea (%3, %3), %%eax \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
208 "movq (%1), %%mm0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
209 ".balign 8 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
210 "1: \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
211 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
212 "movq (%1, %%eax),%%mm2 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
213 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
214 "movq %%mm4, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
215 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
216 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
217 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
218 "movq (%1, %3), %%mm1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
219 "movq (%1, %%eax),%%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
220 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
221 "movq %%mm4, (%2) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
222 "movq %%mm5, (%2, %3) \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
223 "addl %%eax, %1 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
224 "addl %%eax, %2 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
225 "subl $4, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
226 "jnz 1b \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
227 :"+g"(h), "+S"(pixels), "+D"(block)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
228 :"r"(line_size)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
229 :"eax", "memory");
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
230 }
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
231
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
232 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
233 {
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
234 MOVQ_ZERO(mm7);
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
235 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
236 __asm __volatile(
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
237 "movq (%1), %%mm0 \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
238 "movq 1(%1), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
239 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
240 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
241 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
242 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
243 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
244 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
245 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
246 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
247 "xorl %%eax, %%eax \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
248 "addl %3, %1 \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
249 ".balign 8 \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
250 "1: \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
251 "movq (%1, %%eax), %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
252 "movq 1(%1, %%eax), %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
253 "movq %%mm0, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
254 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
255 "punpcklbw %%mm7, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
256 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
257 "punpckhbw %%mm7, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
258 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
259 "paddusw %%mm2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
260 "paddusw %%mm3, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
261 "paddusw %%mm6, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
262 "paddusw %%mm6, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
263 "paddusw %%mm0, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
264 "paddusw %%mm1, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
265 "psrlw $2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
266 "psrlw $2, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
267 "packuswb %%mm5, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
268 "movq %%mm4, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
269 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
270
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
271 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
272 "movq 1(%1, %%eax), %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
273 "movq %%mm2, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
274 "movq %%mm4, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
275 "punpcklbw %%mm7, %%mm2 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
276 "punpcklbw %%mm7, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
277 "punpckhbw %%mm7, %%mm3 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
278 "punpckhbw %%mm7, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
279 "paddusw %%mm2, %%mm4 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
280 "paddusw %%mm3, %%mm5 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
281 "paddusw %%mm6, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
282 "paddusw %%mm6, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
283 "paddusw %%mm4, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
284 "paddusw %%mm5, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
285 "psrlw $2, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
286 "psrlw $2, %%mm1 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
287 "packuswb %%mm1, %%mm0 \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
288 "movq %%mm0, (%2, %%eax) \n\t"
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
289 "addl %3, %%eax \n\t"
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
290
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
291 "subl $2, %0 \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
292 "jnz 1b \n\t"
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
293 :"+g"(h), "+S"(pixels)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 447
diff changeset
294 :"D"(block), "r"(line_size)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
295 :"eax", "memory");
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
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff changeset
298 // avg_pixels
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
299 static void DEF(avg, pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
300 {
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
301 MOVQ_BFE(mm6);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
302 JUMPALIGN();
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
303 do {
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
304 __asm __volatile(
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
305 "movd %0, %%mm0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
306 "movd %1, %%mm1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
307 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
308 "movd %%mm2, %0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
309 :"+m"(*block)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
310 :"m"(*pixels)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
311 :"memory");
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
312 pixels += line_size;
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
313 block += line_size;
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
314 }
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
315 while (--h);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
316 }
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2024
diff changeset
317
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
318 // in case more speed is needed - unroling would certainly help
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
319 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
320 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
321 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
322 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
323 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
324 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
325 "movq %0, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
326 "movq %1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
327 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
328 "movq %%mm2, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
329 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
330 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
331 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
332 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
333 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
334 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
335 while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
336 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
337
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
338 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
339 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
340 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
341 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
342 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
343 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
344 "movq %0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
345 "movq %1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
346 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
347 "movq %%mm2, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
348 "movq 8%0, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
349 "movq 8%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
350 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
351 "movq %%mm2, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
352 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
353 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
354 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
355 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
356 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
357 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
358 while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
359 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
360
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
361 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
362 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
363 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
364 JUMPALIGN();
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
365 do {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
366 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
367 "movq %1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
368 "movq 1%1, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
369 "movq %0, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
370 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
371 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
372 "movq %%mm0, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
373 :"+m"(*block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
374 :"m"(*pixels)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
375 :"memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
376 pixels += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
377 block += line_size;
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
378 } while (--h);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
379 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
380
2024
f65d87bfdd5a some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents: 1739
diff changeset
381 static __attribute__((unused)) void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
382 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
383 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
384 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
385 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
386 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
387 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
388 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
389 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
390 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
391 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
392 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
393 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
394 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
395 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
396 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
397 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
398 src2 += 8;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
399 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
400 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
401
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
402 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
403 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
404 MOVQ_BFE(mm6);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
405 JUMPALIGN();
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
406 do {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
407 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
408 "movq %1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
409 "movq 1%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
410 "movq %0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
411 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
412 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
413 "movq %%mm0, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
414 "movq 8%1, %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
415 "movq 9%1, %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
416 "movq 8%0, %%mm3 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
417 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
418 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
419 "movq %%mm0, 8%0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
420 :"+m"(*block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
421 :"m"(*pixels)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
422 :"memory");
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
423 pixels += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
424 block += line_size;
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
425 } while (--h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
426 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
427
2024
f65d87bfdd5a some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents: 1739
diff changeset
428 static __attribute__((unused)) void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
429 {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
430 MOVQ_BFE(mm6);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
431 JUMPALIGN();
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
432 do {
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
433 __asm __volatile(
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
434 "movq %1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
435 "movq %2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
436 "movq %0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
437 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
438 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
439 "movq %%mm0, %0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
440 "movq 8%1, %%mm0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
441 "movq 8%2, %%mm1 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
442 "movq 8%0, %%mm3 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
443 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
444 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
445 "movq %%mm0, 8%0 \n\t"
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
446 :"+m"(*dst)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
447 :"m"(*src1), "m"(*src2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
448 :"memory");
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
449 dst += dstStride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
450 src1 += src1Stride;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
451 src2 += 16;
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
452 } while (--h);
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
453 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 651
diff changeset
454
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
455 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
456 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
457 MOVQ_BFE(mm6);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
458 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
459 "lea (%3, %3), %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
460 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
461 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
462 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
463 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
464 "movq (%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
465 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
466 "movq (%2), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
467 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
468 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
469 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
470 "movq %%mm0, (%2) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
471 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
472 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
473 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
474
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
475 "movq (%1, %3), %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
476 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
477 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
478 "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
479 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6)
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
480 "movq (%2, %3), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
481 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
482 "movq %%mm2, (%2) \n\t"
470
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
483 "movq %%mm1, (%2, %3) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
484 "addl %%eax, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
485 "addl %%eax, %2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
486
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
487 "subl $4, %0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
488 "jnz 1b \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
489 :"+g"(h), "+S"(pixels), "+D"(block)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
490 :"r"(line_size)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
491 :"eax", "memory");
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
492 }
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
493
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
494 // this routine is 'slightly' suboptimal but mostly unused
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
495 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
496 {
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
497 MOVQ_ZERO(mm7);
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
498 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
499 __asm __volatile(
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
500 "movq (%1), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
501 "movq 1(%1), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
502 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
503 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
504 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
505 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
506 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
507 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
508 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
509 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
510 "xorl %%eax, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
511 "addl %3, %1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
512 ".balign 8 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
513 "1: \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
514 "movq (%1, %%eax), %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
515 "movq 1(%1, %%eax), %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
516 "movq %%mm0, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
517 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
518 "punpcklbw %%mm7, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
519 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
520 "punpckhbw %%mm7, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
521 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
522 "paddusw %%mm2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
523 "paddusw %%mm3, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
524 "paddusw %%mm6, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
525 "paddusw %%mm6, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
526 "paddusw %%mm0, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
527 "paddusw %%mm1, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
528 "psrlw $2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
529 "psrlw $2, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
530 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
531 "packuswb %%mm5, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
532 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
533 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
534 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
535 "movq %%mm5, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
536 "addl %3, %%eax \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
537
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
538 "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
539 "movq 1(%1, %%eax), %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
540 "movq %%mm2, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
541 "movq %%mm4, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
542 "punpcklbw %%mm7, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
543 "punpcklbw %%mm7, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
544 "punpckhbw %%mm7, %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
545 "punpckhbw %%mm7, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
546 "paddusw %%mm2, %%mm4 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
547 "paddusw %%mm3, %%mm5 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
548 "paddusw %%mm6, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
549 "paddusw %%mm6, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
550 "paddusw %%mm4, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
551 "paddusw %%mm5, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
552 "psrlw $2, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
553 "psrlw $2, %%mm1 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
554 "movq (%2, %%eax), %%mm3 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
555 "packuswb %%mm1, %%mm0 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
556 "pcmpeqd %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
557 "paddb %%mm2, %%mm2 \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
558 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
559 "movq %%mm1, (%2, %%eax) \n\t"
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
560 "addl %3, %%eax \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 $2, %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)
b94e82d31b06 * implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents: 448
diff changeset
565 :"D"(block), "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 }
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
568
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
569 //FIXME optimize
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
570 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
571 DEF(put, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
572 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
573 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
574
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
575 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
576 DEF(put, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
577 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
578 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
579
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
580 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
581 DEF(avg, pixels8_y2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
582 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
583 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
584
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 985
diff changeset
585 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
586 DEF(avg, pixels8_xy2)(block , pixels , line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
587 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
588 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
589
45e8f39fda50 put/avg_pixels16
michaelni
parents: 606
diff changeset
590