annotate libmpeg2/motion_comp_mmx.c @ 6555:f54b5148885d

Moved authentication code into its own function. Disabled the user/pass interaction.
author bertrand
date Mon, 24 Jun 2002 20:12:18 +0000
parents 846535ace7a2
children 47984e3f54ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * motion_comp_mmx.c
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
3 * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * (at your option) any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #ifdef ARCH_X86
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <inttypes.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include "mpeg2_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include "attributes.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include "mmx.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #define CPU_MMXEXT 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #define CPU_3DNOW 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
36 /* MMX code - needs a rewrite */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
44 /* some rounding constants */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 mmx_t round1 = {0x0001000100010001LL};
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 mmx_t round4 = {0x0002000200020002LL};
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 * This code should probably be compiled with loop unrolling
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 * (ie, -funroll-loops in gcc)becuase some of the loops
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 * use a small static number of iterations. This was written
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 * with the assumption the compiler knows best about when
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 * unrolling will help
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 static inline void mmx_zero_reg ()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
58 /* load 0 into mm0 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 pxor_r2r (mm0, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 static inline void mmx_average_2_U8 (uint8_t * dest,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 uint8_t * src1, uint8_t * src2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
65 /* *dest = (*src1 + *src2 + 1)/ 2; */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 movq_m2r (*src1, mm1); // load 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 movq_r2r (mm1, mm2); // copy 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 movq_m2r (*src2, mm3); // load 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 movq_r2r (mm3, mm4); // copy 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 punpcklbw_r2r (mm0, mm1); // unpack low src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 punpckhbw_r2r (mm0, mm2); // unpack high src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 punpcklbw_r2r (mm0, mm3); // unpack low src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 punpckhbw_r2r (mm0, mm4); // unpack high src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 paddw_r2r (mm3, mm1); // add lows to mm1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 paddw_m2r (round1, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 psraw_i2r (1, mm1); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 paddw_r2r (mm4, mm2); // add highs to mm2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 paddw_m2r (round1, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 psraw_i2r (1, mm2); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 packuswb_r2r (mm2, mm1); // pack (w/ saturation)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 movq_r2m (mm1, *dest); // store result in dest
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 static inline void mmx_interp_average_2_U8 (uint8_t * dest,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 uint8_t * src1, uint8_t * src2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
94 /* *dest = (*dest + (*src1 + *src2 + 1)/ 2 + 1)/ 2; */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 movq_m2r (*dest, mm1); // load 8 dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 movq_r2r (mm1, mm2); // copy 8 dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 movq_m2r (*src1, mm3); // load 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 movq_r2r (mm3, mm4); // copy 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 movq_m2r (*src2, mm5); // load 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 movq_r2r (mm5, mm6); // copy 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 punpcklbw_r2r (mm0, mm1); // unpack low dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 punpckhbw_r2r (mm0, mm2); // unpack high dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 punpcklbw_r2r (mm0, mm3); // unpack low src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 punpckhbw_r2r (mm0, mm4); // unpack high src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 punpcklbw_r2r (mm0, mm5); // unpack low src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 punpckhbw_r2r (mm0, mm6); // unpack high src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 paddw_r2r (mm5, mm3); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 paddw_m2r (round1, mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 psraw_i2r (1, mm3); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 paddw_r2r (mm6, mm4); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 paddw_m2r (round1, mm4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 psraw_i2r (1, mm4); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 paddw_m2r (round1, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 psraw_i2r (1, mm1); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 paddw_m2r (round1, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 psraw_i2r (1, mm2); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 packuswb_r2r (mm2, mm1); // pack (w/ saturation)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 movq_r2m (mm1, *dest); // store result in dest
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 static inline void mmx_average_4_U8 (uint8_t * dest,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 uint8_t * src1, uint8_t * src2,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 uint8_t * src3, uint8_t * src4)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
138 /* *dest = (*src1 + *src2 + *src3 + *src4 + 2)/ 4; */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 movq_m2r (*src1, mm1); // load 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 movq_r2r (mm1, mm2); // copy 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 punpcklbw_r2r (mm0, mm1); // unpack low src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 punpckhbw_r2r (mm0, mm2); // unpack high src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 movq_m2r (*src2, mm3); // load 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 movq_r2r (mm3, mm4); // copy 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 punpcklbw_r2r (mm0, mm3); // unpack low src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 punpckhbw_r2r (mm0, mm4); // unpack high src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
155 /* now have partials in mm1 and mm2 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 movq_m2r (*src3, mm3); // load 8 src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 movq_r2r (mm3, mm4); // copy 8 src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 punpcklbw_r2r (mm0, mm3); // unpack low src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 punpckhbw_r2r (mm0, mm4); // unpack high src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 movq_m2r (*src4, mm5); // load 8 src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 movq_r2r (mm5, mm6); // copy 8 src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 punpcklbw_r2r (mm0, mm5); // unpack low src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 punpckhbw_r2r (mm0, mm6); // unpack high src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 paddw_r2r (mm5, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 paddw_r2r (mm6, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
175 /* now have subtotal in mm1 and mm2 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 paddw_m2r (round4, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 psraw_i2r (2, mm1); // /4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 paddw_m2r (round4, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 psraw_i2r (2, mm2); // /4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 packuswb_r2r (mm2, mm1); // pack (w/ saturation)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 movq_r2m (mm1, *dest); // store result in dest
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 static inline void mmx_interp_average_4_U8 (uint8_t * dest,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 uint8_t * src1, uint8_t * src2,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 uint8_t * src3, uint8_t * src4)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 {
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
190 /* *dest = (*dest + (*src1 + *src2 + *src3 + *src4 + 2)/ 4 + 1)/ 2; */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 movq_m2r (*src1, mm1); // load 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 movq_r2r (mm1, mm2); // copy 8 src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 punpcklbw_r2r (mm0, mm1); // unpack low src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 punpckhbw_r2r (mm0, mm2); // unpack high src1 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 movq_m2r (*src2, mm3); // load 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 movq_r2r (mm3, mm4); // copy 8 src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 punpcklbw_r2r (mm0, mm3); // unpack low src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 punpckhbw_r2r (mm0, mm4); // unpack high src2 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
207 /* now have partials in mm1 and mm2 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 movq_m2r (*src3, mm3); // load 8 src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 movq_r2r (mm3, mm4); // copy 8 src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 punpcklbw_r2r (mm0, mm3); // unpack low src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 punpckhbw_r2r (mm0, mm4); // unpack high src3 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 movq_m2r (*src4, mm5); // load 8 src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 movq_r2r (mm5, mm6); // copy 8 src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 punpcklbw_r2r (mm0, mm5); // unpack low src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 punpckhbw_r2r (mm0, mm6); // unpack high src4 bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 paddw_r2r (mm5, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 paddw_r2r (mm6, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 paddw_m2r (round4, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 psraw_i2r (2, mm1); // /4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 paddw_m2r (round4, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 psraw_i2r (2, mm2); // /4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
232 /* now have subtotal/4 in mm1 and mm2 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 movq_m2r (*dest, mm3); // load 8 dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 movq_r2r (mm3, mm4); // copy 8 dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 punpcklbw_r2r (mm0, mm3); // unpack low dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 punpckhbw_r2r (mm0, mm4); // unpack high dest bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 paddw_r2r (mm3, mm1); // add lows
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 paddw_r2r (mm4, mm2); // add highs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 paddw_m2r (round1, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 psraw_i2r (1, mm1); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 paddw_m2r (round1, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 psraw_i2r (1, mm2); // /2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
248 /* now have end value in mm1 and mm2 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 packuswb_r2r (mm2, mm1); // pack (w/ saturation)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 movq_r2m (mm1,*dest); // store result in dest
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
254 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 static inline void MC_avg_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 mmx_average_2_U8 (dest, dest, ref);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 mmx_average_2_U8 (dest+8, dest+8, ref+8);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 static void MC_avg_16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 MC_avg_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 static void MC_avg_8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 MC_avg_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
284 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 static inline void MC_put_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 movq_m2r (* ref, mm1); // load 8 ref bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 movq_r2m (mm1,* dest); // store 8 bytes at curr
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 movq_m2r (* (ref+8), mm1); // load 8 ref bytes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 movq_r2m (mm1,* (dest+8)); // store 8 bytes at curr
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 static void MC_put_16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 MC_put_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 static void MC_put_8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 MC_put_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
318 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
320 /* Half pixel interpolation in the x direction */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 static inline void MC_avg_x_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 mmx_interp_average_2_U8 (dest, ref, ref+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 mmx_interp_average_2_U8 (dest+8, ref+8, ref+9);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 static void MC_avg_x16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 MC_avg_x_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 static void MC_avg_x8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 MC_avg_x_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
349 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 static inline void MC_put_x_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 mmx_average_2_U8 (dest, ref, ref+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 mmx_average_2_U8 (dest+8, ref+8, ref+9);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 static void MC_put_x16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 MC_put_x_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 static void MC_put_x8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 MC_put_x_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
379 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 static inline void MC_avg_xy_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 uint8_t * ref_next = ref+stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 mmx_interp_average_4_U8 (dest, ref, ref+1, ref_next, ref_next+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 mmx_interp_average_4_U8 (dest+8, ref+8, ref+9,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 ref_next+8, ref_next+9);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 ref_next += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 static void MC_avg_xy16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 MC_avg_xy_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 static void MC_avg_xy8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 MC_avg_xy_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
413 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 static inline void MC_put_xy_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 uint8_t * ref_next = ref+stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 mmx_average_4_U8 (dest, ref, ref+1, ref_next, ref_next+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 mmx_average_4_U8 (dest+8, ref+8, ref+9, ref_next+8, ref_next+9);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 ref_next += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 static void MC_put_xy16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 MC_put_xy_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 static void MC_put_xy8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 MC_put_xy_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
446 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 static inline void MC_avg_y_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 uint8_t * ref_next = ref+stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 mmx_interp_average_2_U8 (dest, ref, ref_next);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 mmx_interp_average_2_U8 (dest+8, ref+8, ref_next+8);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 ref_next += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 static void MC_avg_y16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 MC_avg_y_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 static void MC_avg_y8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 MC_avg_y_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
479 /*-----------------------------------------------------------------------*/
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481 static inline void MC_put_y_mmx (int width, int height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 uint8_t * dest, uint8_t * ref, int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 uint8_t * ref_next = ref+stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 mmx_zero_reg ();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 mmx_average_2_U8 (dest, ref, ref_next);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 if (width == 16)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 mmx_average_2_U8 (dest+8, ref+8, ref_next+8);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 ref_next += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 static void MC_put_y16_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 MC_put_y_mmx (16, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 static void MC_put_y8_mmx (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509 MC_put_y_mmx (8, height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513 MOTION_COMP_EXTERN (mmx)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
521 /* CPU_MMXEXT/CPU_3DNOW adaptation layer */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 #define pavg_r2r(src,dest) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 do { \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525 if (cpu == CPU_MMXEXT) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 pavgb_r2r (src, dest); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 else \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 pavgusb_r2r (src, dest); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529 } while (0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 #define pavg_m2r(src,dest) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 do { \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533 if (cpu == CPU_MMXEXT) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 pavgb_m2r (src, dest); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 else \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536 pavgusb_m2r (src, dest); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
537 } while (0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539
36
846535ace7a2 libmpeg2-0.2.0 merge
arpi_esp
parents: 1
diff changeset
540 /* CPU_MMXEXT code */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543 static inline void MC_put1_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
544 int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
547 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
548 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
553
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
554 static inline void MC_put1_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 int stride)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
559 movq_m2r (*(ref+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
560 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
561 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
562 movq_r2m (mm1, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
563 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567 static inline void MC_avg1_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
572 pavg_m2r (*dest, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
573 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
575 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 static inline void MC_avg1_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
583 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584 movq_m2r (*(ref+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 pavg_m2r (*dest, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
586 pavg_m2r (*(dest+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
587 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 movq_r2m (mm1, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
591 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 static inline void MC_put2_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595 int stride, int offset, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 pavg_m2r (*(ref+offset), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
603 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
605
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606 static inline void MC_put2_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
607 int stride, int offset, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
608 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
609 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
610 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
611 movq_m2r (*(ref+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
612 pavg_m2r (*(ref+offset), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
613 pavg_m2r (*(ref+offset+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
614 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
615 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
616 movq_r2m (mm1, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
617 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
618 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
619 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
620
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621 static inline void MC_avg2_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 int stride, int offset, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
625 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
626 pavg_m2r (*(ref+offset), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
627 pavg_m2r (*dest, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
628 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
629 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
630 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
631 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
632 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
633
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
634 static inline void MC_avg2_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
635 int stride, int offset, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
636 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
637 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
638 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
639 movq_m2r (*(ref+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
640 pavg_m2r (*(ref+offset), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
641 pavg_m2r (*(ref+offset+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
642 pavg_m2r (*dest, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
643 pavg_m2r (*(dest+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
644 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
645 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
646 movq_r2m (mm1, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
647 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
648 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
649 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
650
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
651 static mmx_t mask_one = {0x0101010101010101LL};
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
652
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
653 static inline void MC_put4_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
654 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
655 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
656 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
657 movq_m2r (*(ref+1), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
658 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
659 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
660 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
661 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
662
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
663 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
664 movq_m2r (*ref, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
665 movq_r2r (mm0, mm5);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
666
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
667 movq_m2r (*(ref+1), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
668 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
669
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
670 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
671 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
672
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
673 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
674 pxor_r2r (mm2, mm5);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
675
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
676 pand_r2r (mm5, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
677 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
678
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
679 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
680
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
681 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
682
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
683 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
684 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
685 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
686
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
687 movq_r2r (mm6, mm7); // unroll !
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
688 movq_r2r (mm2, mm0); // unroll !
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
689 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
690 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
691
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
692 static inline void MC_put4_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
693 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
694 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
695 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
696 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
697 movq_m2r (*(ref+stride+1), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
698 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
699 movq_m2r (*(ref+1), mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
700 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
701 movq_m2r (*(ref+stride), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
702 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
703 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
704 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
705 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
706 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
707 movq_r2r (mm0, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
708 pxor_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
709 pand_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
710 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
711 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
712 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
713 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
714
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
715 movq_m2r (*(ref+8), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
716 movq_m2r (*(ref+stride+9), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
717 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
718 movq_m2r (*(ref+9), mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
719 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
720 movq_m2r (*(ref+stride+8), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
721 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
722 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
723 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
724 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
725 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
726 movq_r2r (mm0, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
727 pxor_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
728 pand_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
729 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
730 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
731 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
732 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
733 movq_r2m (mm0, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
734 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
735 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
736 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
737
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
738 static inline void MC_avg4_8 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
739 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
740 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
741 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
742 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
743 movq_m2r (*(ref+stride+1), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
744 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
745 movq_m2r (*(ref+1), mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
746 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
747 movq_m2r (*(ref+stride), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
748 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
749 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
750 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
751 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
752 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
753 movq_r2r (mm0, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
754 pxor_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
755 pand_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
756 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
757 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
758 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
759 movq_m2r (*dest, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
760 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
761 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
762 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
763 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
764 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
765 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
766
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
767 static inline void MC_avg4_16 (int height, uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
768 int stride, int cpu)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
769 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
770 do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
771 movq_m2r (*ref, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
772 movq_m2r (*(ref+stride+1), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
773 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
774 movq_m2r (*(ref+1), mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
775 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
776 movq_m2r (*(ref+stride), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
777 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
778 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
779 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
780 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
781 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
782 movq_r2r (mm0, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
783 pxor_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
784 pand_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
785 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
786 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
787 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
788 movq_m2r (*dest, mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
789 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
790 movq_r2m (mm0, *dest);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
791
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
792 movq_m2r (*(ref+8), mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
793 movq_m2r (*(ref+stride+9), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
794 movq_r2r (mm0, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
795 movq_m2r (*(ref+9), mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
796 pxor_r2r (mm1, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
797 movq_m2r (*(ref+stride+8), mm3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
798 movq_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
799 pxor_r2r (mm3, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
800 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
801 pavg_r2r (mm3, mm2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
802 por_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
803 movq_r2r (mm0, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
804 pxor_r2r (mm2, mm6);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
805 pand_r2r (mm6, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
806 pand_m2r (mask_one, mm7);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
807 pavg_r2r (mm2, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
808 psubusb_r2r (mm7, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
809 movq_m2r (*(dest+8), mm1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
810 pavg_r2r (mm1, mm0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
811 ref += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
812 movq_r2m (mm0, *(dest+8));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
813 dest += stride;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
814 } while (--height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
815 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
816
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
817 static void MC_avg_16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
818 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
819 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
820 MC_avg1_16 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
821 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
822
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
823 static void MC_avg_8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
824 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
825 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
826 MC_avg1_8 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
827 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
828
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
829 static void MC_put_16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
830 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
831 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
832 MC_put1_16 (height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
833 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
834
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
835 static void MC_put_8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
836 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
837 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
838 MC_put1_8 (height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
839 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
840
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
841 static void MC_avg_x16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
842 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
843 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
844 MC_avg2_16 (height, dest, ref, stride, 1, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
845 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
846
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
847 static void MC_avg_x8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
848 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
849 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
850 MC_avg2_8 (height, dest, ref, stride, 1, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
851 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
852
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
853 static void MC_put_x16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
854 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
855 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
856 MC_put2_16 (height, dest, ref, stride, 1, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
857 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
858
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
859 static void MC_put_x8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
860 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
861 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
862 MC_put2_8 (height, dest, ref, stride, 1, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
863 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
864
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
865 static void MC_avg_y16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
866 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
867 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
868 MC_avg2_16 (height, dest, ref, stride, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
869 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
870
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
871 static void MC_avg_y8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
872 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
873 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
874 MC_avg2_8 (height, dest, ref, stride, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
875 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
876
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
877 static void MC_put_y16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
878 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
879 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
880 MC_put2_16 (height, dest, ref, stride, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
881 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
882
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
883 static void MC_put_y8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
884 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
885 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
886 MC_put2_8 (height, dest, ref, stride, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
887 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
888
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
889 static void MC_avg_xy16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
890 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
891 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
892 MC_avg4_16 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
893 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
894
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
895 static void MC_avg_xy8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
896 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
897 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
898 MC_avg4_8 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
899 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
900
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
901 static void MC_put_xy16_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
902 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
903 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
904 MC_put4_16 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
905 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
906
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
907 static void MC_put_xy8_mmxext (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
908 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
909 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
910 MC_put4_8 (height, dest, ref, stride, CPU_MMXEXT);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
911 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
912
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
913
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
914 MOTION_COMP_EXTERN (mmxext)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
915
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
916
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
917
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
918 static void MC_avg_16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
919 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
920 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
921 MC_avg1_16 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
922 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
923
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
924 static void MC_avg_8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
925 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
926 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
927 MC_avg1_8 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
928 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
929
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
930 static void MC_put_16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
931 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
932 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
933 MC_put1_16 (height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
934 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
935
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
936 static void MC_put_8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
937 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
938 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
939 MC_put1_8 (height, dest, ref, stride);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
940 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
941
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
942 static void MC_avg_x16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
943 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
944 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
945 MC_avg2_16 (height, dest, ref, stride, 1, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
946 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
947
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
948 static void MC_avg_x8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
949 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
950 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
951 MC_avg2_8 (height, dest, ref, stride, 1, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
952 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
953
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
954 static void MC_put_x16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
955 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
956 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
957 MC_put2_16 (height, dest, ref, stride, 1, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
958 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
959
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
960 static void MC_put_x8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
961 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
962 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
963 MC_put2_8 (height, dest, ref, stride, 1, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
964 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
965
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
966 static void MC_avg_y16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
967 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
968 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
969 MC_avg2_16 (height, dest, ref, stride, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
970 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
971
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
972 static void MC_avg_y8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
973 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
974 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
975 MC_avg2_8 (height, dest, ref, stride, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
976 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
977
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
978 static void MC_put_y16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
979 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
980 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
981 MC_put2_16 (height, dest, ref, stride, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
982 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
983
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
984 static void MC_put_y8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
985 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
986 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
987 MC_put2_8 (height, dest, ref, stride, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
988 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
989
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
990 static void MC_avg_xy16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
991 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
992 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
993 MC_avg4_16 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
994 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
995
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
996 static void MC_avg_xy8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
997 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
998 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
999 MC_avg4_8 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1000 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1001
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1002 static void MC_put_xy16_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1003 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1004 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1005 MC_put4_16 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1006 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1007
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1008 static void MC_put_xy8_3dnow (uint8_t * dest, uint8_t * ref,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1009 int stride, int height)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1010 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1011 MC_put4_8 (height, dest, ref, stride, CPU_3DNOW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1012 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1013
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1014
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1015 MOTION_COMP_EXTERN (3dnow)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1016
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1017 #endif