Mercurial > libavcodec.hg
annotate sparc/dsputil_vis.c @ 11457:766ca433df3b libavcodec
sparc: fix dsputil prototypes
| author | mru |
|---|---|
| date | Wed, 10 Mar 2010 22:24:42 +0000 |
| parents | f9c847fb4839 |
| children | bf6d274fef39 |
| rev | line source |
|---|---|
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1 /* |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2 * Copyright (C) 2003 David S. Miller <davem@redhat.com> |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
4 * This file is part of FFmpeg. |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
5 * |
|
3987
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
|
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
|
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
|
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
10 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
3987
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
14 * Lesser General Public License for more details. |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
15 * |
|
3987
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
|
2c54309fef91
Switch to the LGPL as agreed to by the author according to the
diego
parents:
3947
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
|
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
19 */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
20 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
21 /* The *no_round* functions have been added by James A. Morrison, 2003,2004. |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
22 The vis code from libmpeg2 was adapted for ffmpeg by James A. Morrison. |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
23 */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
24 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
25 #include "config.h" |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
26 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
27 #include <inttypes.h> |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
28 |
| 6763 | 29 #include "libavcodec/dsputil.h" |
| 11457 | 30 #include "dsputil_vis.h" |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
31 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
32 #include "vis.h" |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
33 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
34 /* The trick used in some of this file is the formula from the MMX |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
35 * motion comp code, which is: |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
36 * |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
37 * (x+y+1)>>1 == (x|y)-((x^y)>>1) |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
38 * |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
39 * This allows us to average 8 bytes at a time in a 64-bit FPU reg. |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
40 * We avoid overflows by masking before we do the shift, and we |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
41 * implement the shift by multiplying by 1/2 using mul8x16. So in |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
42 * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
43 * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
44 * the value 0x80808080 is in f8): |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
45 * |
| 2979 | 46 * fxor f0, f2, f10 |
| 47 * fand f10, f4, f10 | |
| 48 * fmul8x16 f8, f10, f10 | |
| 49 * fand f10, f6, f10 | |
| 50 * for f0, f2, f12 | |
| 51 * fpsub16 f12, f10, f10 | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
52 */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
53 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
54 #define ATTR_ALIGN(alignd) __attribute__ ((aligned(alignd))) |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
55 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
56 #define DUP4(x) {x, x, x, x} |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
57 #define DUP8(x) {x, x, x, x, x, x, x, x} |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
58 static const int16_t constants1[] ATTR_ALIGN(8) = DUP4 (1); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
59 static const int16_t constants2[] ATTR_ALIGN(8) = DUP4 (2); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
60 static const int16_t constants3[] ATTR_ALIGN(8) = DUP4 (3); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
61 static const int16_t constants6[] ATTR_ALIGN(8) = DUP4 (6); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
62 static const int8_t constants_fe[] ATTR_ALIGN(8) = DUP8 (0xfe); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
63 static const int8_t constants_7f[] ATTR_ALIGN(8) = DUP8 (0x7f); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
64 static const int8_t constants128[] ATTR_ALIGN(8) = DUP8 (128); |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
65 static const int16_t constants256_512[] ATTR_ALIGN(8) = |
| 2979 | 66 {256, 512, 256, 512}; |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
67 static const int16_t constants256_1024[] ATTR_ALIGN(8) = |
| 2979 | 68 {256, 1024, 256, 1024}; |
| 69 | |
| 70 #define REF_0 0 | |
| 71 #define REF_0_1 1 | |
| 72 #define REF_2 2 | |
| 73 #define REF_2_1 3 | |
| 74 #define REF_4 4 | |
| 75 #define REF_4_1 5 | |
| 76 #define REF_6 6 | |
| 77 #define REF_6_1 7 | |
| 78 #define REF_S0 8 | |
| 79 #define REF_S0_1 9 | |
| 80 #define REF_S2 10 | |
| 81 #define REF_S2_1 11 | |
| 82 #define REF_S4 12 | |
| 83 #define REF_S4_1 13 | |
| 84 #define REF_S6 14 | |
| 85 #define REF_S6_1 15 | |
| 86 #define DST_0 16 | |
| 87 #define DST_1 17 | |
| 88 #define DST_2 18 | |
| 89 #define DST_3 19 | |
| 90 #define CONST_1 20 | |
| 91 #define CONST_2 20 | |
| 92 #define CONST_3 20 | |
| 93 #define CONST_6 20 | |
| 94 #define MASK_fe 20 | |
| 95 #define CONST_128 22 | |
| 96 #define CONST_256 22 | |
| 97 #define CONST_512 22 | |
| 98 #define CONST_1024 22 | |
| 99 #define TMP0 24 | |
| 100 #define TMP1 25 | |
| 101 #define TMP2 26 | |
| 102 #define TMP3 27 | |
| 103 #define TMP4 28 | |
| 104 #define TMP5 29 | |
| 105 #define ZERO 30 | |
| 106 #define MASK_7f 30 | |
| 107 | |
| 108 #define TMP6 32 | |
| 109 #define TMP8 34 | |
| 110 #define TMP10 36 | |
| 111 #define TMP12 38 | |
| 112 #define TMP14 40 | |
| 113 #define TMP16 42 | |
| 114 #define TMP18 44 | |
| 115 #define TMP20 46 | |
| 116 #define TMP22 48 | |
| 117 #define TMP24 50 | |
| 118 #define TMP26 52 | |
| 119 #define TMP28 54 | |
| 120 #define TMP30 56 | |
| 121 #define TMP32 58 | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
122 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
123 static void MC_put_o_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 124 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
125 { |
| 2979 | 126 uint8_t *ref = (uint8_t *) _ref; |
| 127 | |
| 128 ref = vis_alignaddr(ref); | |
| 129 do { /* 5 cycles */ | |
| 130 vis_ld64(ref[0], TMP0); | |
| 131 | |
| 132 vis_ld64_2(ref, 8, TMP2); | |
| 133 | |
| 134 vis_ld64_2(ref, 16, TMP4); | |
| 135 ref += stride; | |
| 136 | |
| 137 vis_faligndata(TMP0, TMP2, REF_0); | |
| 138 vis_st64(REF_0, dest[0]); | |
| 139 | |
| 140 vis_faligndata(TMP2, TMP4, REF_2); | |
| 141 vis_st64_2(REF_2, dest, 8); | |
| 142 dest += stride; | |
| 143 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
144 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
145 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
146 static void MC_put_o_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 147 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
148 { |
| 2979 | 149 uint8_t *ref = (uint8_t *) _ref; |
| 150 | |
| 151 ref = vis_alignaddr(ref); | |
| 152 do { /* 4 cycles */ | |
| 153 vis_ld64(ref[0], TMP0); | |
| 154 | |
| 155 vis_ld64(ref[8], TMP2); | |
| 156 ref += stride; | |
| 157 | |
| 158 /* stall */ | |
| 159 | |
| 160 vis_faligndata(TMP0, TMP2, REF_0); | |
| 161 vis_st64(REF_0, dest[0]); | |
| 162 dest += stride; | |
| 163 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
164 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
165 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
166 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
167 static void MC_avg_o_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 168 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
169 { |
| 2979 | 170 uint8_t *ref = (uint8_t *) _ref; |
| 171 int stride_8 = stride + 8; | |
| 172 | |
| 173 ref = vis_alignaddr(ref); | |
| 174 | |
| 175 vis_ld64(ref[0], TMP0); | |
| 176 | |
| 177 vis_ld64(ref[8], TMP2); | |
| 178 | |
| 179 vis_ld64(ref[16], TMP4); | |
| 180 | |
| 181 vis_ld64(dest[0], DST_0); | |
| 182 | |
| 183 vis_ld64(dest[8], DST_2); | |
| 184 | |
| 185 vis_ld64(constants_fe[0], MASK_fe); | |
| 186 vis_faligndata(TMP0, TMP2, REF_0); | |
| 187 | |
| 188 vis_ld64(constants_7f[0], MASK_7f); | |
| 189 vis_faligndata(TMP2, TMP4, REF_2); | |
| 190 | |
| 191 vis_ld64(constants128[0], CONST_128); | |
| 192 | |
| 193 ref += stride; | |
| 194 height = (height >> 1) - 1; | |
| 195 | |
| 196 do { /* 24 cycles */ | |
| 197 vis_ld64(ref[0], TMP0); | |
| 198 vis_xor(DST_0, REF_0, TMP6); | |
| 199 | |
| 200 vis_ld64_2(ref, 8, TMP2); | |
| 201 vis_and(TMP6, MASK_fe, TMP6); | |
| 202 | |
| 203 vis_ld64_2(ref, 16, TMP4); | |
| 204 ref += stride; | |
| 205 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 206 vis_xor(DST_2, REF_2, TMP8); | |
| 207 | |
| 208 vis_and(TMP8, MASK_fe, TMP8); | |
| 209 | |
| 210 vis_or(DST_0, REF_0, TMP10); | |
| 211 vis_ld64_2(dest, stride, DST_0); | |
| 212 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 213 | |
| 214 vis_or(DST_2, REF_2, TMP12); | |
| 215 vis_ld64_2(dest, stride_8, DST_2); | |
| 216 | |
| 217 vis_ld64(ref[0], TMP14); | |
| 218 vis_and(TMP6, MASK_7f, TMP6); | |
| 219 | |
| 220 vis_and(TMP8, MASK_7f, TMP8); | |
| 221 | |
| 222 vis_psub16(TMP10, TMP6, TMP6); | |
| 223 vis_st64(TMP6, dest[0]); | |
| 224 | |
| 225 vis_psub16(TMP12, TMP8, TMP8); | |
| 226 vis_st64_2(TMP8, dest, 8); | |
| 227 | |
| 228 dest += stride; | |
| 229 vis_ld64_2(ref, 8, TMP16); | |
| 230 vis_faligndata(TMP0, TMP2, REF_0); | |
| 231 | |
| 232 vis_ld64_2(ref, 16, TMP18); | |
| 233 vis_faligndata(TMP2, TMP4, REF_2); | |
| 234 ref += stride; | |
| 235 | |
| 236 vis_xor(DST_0, REF_0, TMP20); | |
| 237 | |
| 238 vis_and(TMP20, MASK_fe, TMP20); | |
| 239 | |
| 240 vis_xor(DST_2, REF_2, TMP22); | |
| 241 vis_mul8x16(CONST_128, TMP20, TMP20); | |
| 242 | |
| 243 vis_and(TMP22, MASK_fe, TMP22); | |
| 244 | |
| 245 vis_or(DST_0, REF_0, TMP24); | |
| 246 vis_mul8x16(CONST_128, TMP22, TMP22); | |
| 247 | |
| 248 vis_or(DST_2, REF_2, TMP26); | |
| 249 | |
| 250 vis_ld64_2(dest, stride, DST_0); | |
| 251 vis_faligndata(TMP14, TMP16, REF_0); | |
| 252 | |
| 253 vis_ld64_2(dest, stride_8, DST_2); | |
| 254 vis_faligndata(TMP16, TMP18, REF_2); | |
| 255 | |
| 256 vis_and(TMP20, MASK_7f, TMP20); | |
| 257 | |
| 258 vis_and(TMP22, MASK_7f, TMP22); | |
| 259 | |
| 260 vis_psub16(TMP24, TMP20, TMP20); | |
| 261 vis_st64(TMP20, dest[0]); | |
| 262 | |
| 263 vis_psub16(TMP26, TMP22, TMP22); | |
| 264 vis_st64_2(TMP22, dest, 8); | |
| 265 dest += stride; | |
| 266 } while (--height); | |
| 267 | |
| 268 vis_ld64(ref[0], TMP0); | |
| 269 vis_xor(DST_0, REF_0, TMP6); | |
| 270 | |
| 271 vis_ld64_2(ref, 8, TMP2); | |
| 272 vis_and(TMP6, MASK_fe, TMP6); | |
| 273 | |
| 274 vis_ld64_2(ref, 16, TMP4); | |
| 275 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 276 vis_xor(DST_2, REF_2, TMP8); | |
| 277 | |
| 278 vis_and(TMP8, MASK_fe, TMP8); | |
| 279 | |
| 280 vis_or(DST_0, REF_0, TMP10); | |
| 281 vis_ld64_2(dest, stride, DST_0); | |
| 282 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 283 | |
| 284 vis_or(DST_2, REF_2, TMP12); | |
| 285 vis_ld64_2(dest, stride_8, DST_2); | |
| 286 | |
| 287 vis_ld64(ref[0], TMP14); | |
| 288 vis_and(TMP6, MASK_7f, TMP6); | |
| 289 | |
| 290 vis_and(TMP8, MASK_7f, TMP8); | |
| 291 | |
| 292 vis_psub16(TMP10, TMP6, TMP6); | |
| 293 vis_st64(TMP6, dest[0]); | |
| 294 | |
| 295 vis_psub16(TMP12, TMP8, TMP8); | |
| 296 vis_st64_2(TMP8, dest, 8); | |
| 297 | |
| 298 dest += stride; | |
| 299 vis_faligndata(TMP0, TMP2, REF_0); | |
| 300 | |
| 301 vis_faligndata(TMP2, TMP4, REF_2); | |
| 302 | |
| 303 vis_xor(DST_0, REF_0, TMP20); | |
| 304 | |
| 305 vis_and(TMP20, MASK_fe, TMP20); | |
| 306 | |
| 307 vis_xor(DST_2, REF_2, TMP22); | |
| 308 vis_mul8x16(CONST_128, TMP20, TMP20); | |
| 309 | |
| 310 vis_and(TMP22, MASK_fe, TMP22); | |
| 311 | |
| 312 vis_or(DST_0, REF_0, TMP24); | |
| 313 vis_mul8x16(CONST_128, TMP22, TMP22); | |
| 314 | |
| 315 vis_or(DST_2, REF_2, TMP26); | |
| 316 | |
| 317 vis_and(TMP20, MASK_7f, TMP20); | |
| 318 | |
| 319 vis_and(TMP22, MASK_7f, TMP22); | |
| 320 | |
| 321 vis_psub16(TMP24, TMP20, TMP20); | |
| 322 vis_st64(TMP20, dest[0]); | |
| 323 | |
| 324 vis_psub16(TMP26, TMP22, TMP22); | |
| 325 vis_st64_2(TMP22, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
326 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
327 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
328 static void MC_avg_o_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 329 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
330 { |
| 2979 | 331 uint8_t *ref = (uint8_t *) _ref; |
| 332 | |
| 333 ref = vis_alignaddr(ref); | |
| 334 | |
| 335 vis_ld64(ref[0], TMP0); | |
| 336 | |
| 337 vis_ld64(ref[8], TMP2); | |
| 338 | |
| 339 vis_ld64(dest[0], DST_0); | |
| 340 | |
| 341 vis_ld64(constants_fe[0], MASK_fe); | |
| 342 | |
| 343 vis_ld64(constants_7f[0], MASK_7f); | |
| 344 vis_faligndata(TMP0, TMP2, REF_0); | |
| 345 | |
| 346 vis_ld64(constants128[0], CONST_128); | |
| 347 | |
| 348 ref += stride; | |
| 349 height = (height >> 1) - 1; | |
| 350 | |
| 351 do { /* 12 cycles */ | |
| 352 vis_ld64(ref[0], TMP0); | |
| 353 vis_xor(DST_0, REF_0, TMP4); | |
| 354 | |
| 355 vis_ld64(ref[8], TMP2); | |
| 356 vis_and(TMP4, MASK_fe, TMP4); | |
| 357 | |
| 358 vis_or(DST_0, REF_0, TMP6); | |
| 359 vis_ld64_2(dest, stride, DST_0); | |
| 360 ref += stride; | |
| 361 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 362 | |
| 363 vis_ld64(ref[0], TMP12); | |
| 364 vis_faligndata(TMP0, TMP2, REF_0); | |
| 365 | |
| 366 vis_ld64(ref[8], TMP2); | |
| 367 vis_xor(DST_0, REF_0, TMP0); | |
| 368 ref += stride; | |
| 369 | |
| 370 vis_and(TMP0, MASK_fe, TMP0); | |
| 371 | |
| 372 vis_and(TMP4, MASK_7f, TMP4); | |
| 373 | |
| 374 vis_psub16(TMP6, TMP4, TMP4); | |
| 375 vis_st64(TMP4, dest[0]); | |
| 376 dest += stride; | |
| 377 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 378 | |
| 379 vis_or(DST_0, REF_0, TMP6); | |
| 380 vis_ld64_2(dest, stride, DST_0); | |
| 381 | |
| 382 vis_faligndata(TMP12, TMP2, REF_0); | |
| 383 | |
| 384 vis_and(TMP0, MASK_7f, TMP0); | |
| 385 | |
| 386 vis_psub16(TMP6, TMP0, TMP4); | |
| 387 vis_st64(TMP4, dest[0]); | |
| 388 dest += stride; | |
| 389 } while (--height); | |
| 390 | |
| 391 vis_ld64(ref[0], TMP0); | |
| 392 vis_xor(DST_0, REF_0, TMP4); | |
| 393 | |
| 394 vis_ld64(ref[8], TMP2); | |
| 395 vis_and(TMP4, MASK_fe, TMP4); | |
| 396 | |
| 397 vis_or(DST_0, REF_0, TMP6); | |
| 398 vis_ld64_2(dest, stride, DST_0); | |
| 399 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 400 | |
| 401 vis_faligndata(TMP0, TMP2, REF_0); | |
| 402 | |
| 403 vis_xor(DST_0, REF_0, TMP0); | |
| 404 | |
| 405 vis_and(TMP0, MASK_fe, TMP0); | |
| 406 | |
| 407 vis_and(TMP4, MASK_7f, TMP4); | |
| 408 | |
| 409 vis_psub16(TMP6, TMP4, TMP4); | |
| 410 vis_st64(TMP4, dest[0]); | |
| 411 dest += stride; | |
| 412 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 413 | |
| 414 vis_or(DST_0, REF_0, TMP6); | |
| 415 | |
| 416 vis_and(TMP0, MASK_7f, TMP0); | |
| 417 | |
| 418 vis_psub16(TMP6, TMP0, TMP4); | |
| 419 vis_st64(TMP4, dest[0]); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
420 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
421 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
422 static void MC_put_x_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 423 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
424 { |
| 2979 | 425 uint8_t *ref = (uint8_t *) _ref; |
| 426 unsigned long off = (unsigned long) ref & 0x7; | |
| 427 unsigned long off_plus_1 = off + 1; | |
| 428 | |
| 429 ref = vis_alignaddr(ref); | |
| 430 | |
| 431 vis_ld64(ref[0], TMP0); | |
| 432 | |
| 433 vis_ld64_2(ref, 8, TMP2); | |
| 434 | |
| 435 vis_ld64_2(ref, 16, TMP4); | |
| 436 | |
| 437 vis_ld64(constants_fe[0], MASK_fe); | |
| 438 | |
| 439 vis_ld64(constants_7f[0], MASK_7f); | |
| 440 vis_faligndata(TMP0, TMP2, REF_0); | |
| 441 | |
| 442 vis_ld64(constants128[0], CONST_128); | |
| 443 vis_faligndata(TMP2, TMP4, REF_4); | |
| 444 | |
| 445 if (off != 0x7) { | |
| 446 vis_alignaddr_g0((void *)off_plus_1); | |
| 447 vis_faligndata(TMP0, TMP2, REF_2); | |
| 448 vis_faligndata(TMP2, TMP4, REF_6); | |
| 449 } else { | |
| 450 vis_src1(TMP2, REF_2); | |
| 451 vis_src1(TMP4, REF_6); | |
| 452 } | |
| 453 | |
| 454 ref += stride; | |
| 455 height = (height >> 1) - 1; | |
| 456 | |
| 457 do { /* 34 cycles */ | |
| 458 vis_ld64(ref[0], TMP0); | |
| 459 vis_xor(REF_0, REF_2, TMP6); | |
| 460 | |
| 461 vis_ld64_2(ref, 8, TMP2); | |
| 462 vis_xor(REF_4, REF_6, TMP8); | |
| 463 | |
| 464 vis_ld64_2(ref, 16, TMP4); | |
| 465 vis_and(TMP6, MASK_fe, TMP6); | |
| 466 ref += stride; | |
| 467 | |
| 468 vis_ld64(ref[0], TMP14); | |
| 469 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 470 vis_and(TMP8, MASK_fe, TMP8); | |
| 471 | |
| 472 vis_ld64_2(ref, 8, TMP16); | |
| 473 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 474 vis_or(REF_0, REF_2, TMP10); | |
| 475 | |
| 476 vis_ld64_2(ref, 16, TMP18); | |
| 477 ref += stride; | |
| 478 vis_or(REF_4, REF_6, TMP12); | |
| 479 | |
| 480 vis_alignaddr_g0((void *)off); | |
| 481 | |
| 482 vis_faligndata(TMP0, TMP2, REF_0); | |
| 483 | |
| 484 vis_faligndata(TMP2, TMP4, REF_4); | |
| 485 | |
| 486 if (off != 0x7) { | |
| 487 vis_alignaddr_g0((void *)off_plus_1); | |
| 488 vis_faligndata(TMP0, TMP2, REF_2); | |
| 489 vis_faligndata(TMP2, TMP4, REF_6); | |
| 490 } else { | |
| 491 vis_src1(TMP2, REF_2); | |
| 492 vis_src1(TMP4, REF_6); | |
| 493 } | |
| 494 | |
| 495 vis_and(TMP6, MASK_7f, TMP6); | |
| 496 | |
| 497 vis_and(TMP8, MASK_7f, TMP8); | |
| 498 | |
| 499 vis_psub16(TMP10, TMP6, TMP6); | |
| 500 vis_st64(TMP6, dest[0]); | |
| 501 | |
| 502 vis_psub16(TMP12, TMP8, TMP8); | |
| 503 vis_st64_2(TMP8, dest, 8); | |
| 504 dest += stride; | |
| 505 | |
| 506 vis_xor(REF_0, REF_2, TMP6); | |
| 507 | |
| 508 vis_xor(REF_4, REF_6, TMP8); | |
| 509 | |
| 510 vis_and(TMP6, MASK_fe, TMP6); | |
| 511 | |
| 512 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 513 vis_and(TMP8, MASK_fe, TMP8); | |
| 514 | |
| 515 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 516 vis_or(REF_0, REF_2, TMP10); | |
| 517 | |
| 518 vis_or(REF_4, REF_6, TMP12); | |
| 519 | |
| 520 vis_alignaddr_g0((void *)off); | |
| 521 | |
| 522 vis_faligndata(TMP14, TMP16, REF_0); | |
| 523 | |
| 524 vis_faligndata(TMP16, TMP18, REF_4); | |
| 525 | |
| 526 if (off != 0x7) { | |
| 527 vis_alignaddr_g0((void *)off_plus_1); | |
| 528 vis_faligndata(TMP14, TMP16, REF_2); | |
| 529 vis_faligndata(TMP16, TMP18, REF_6); | |
| 530 } else { | |
| 531 vis_src1(TMP16, REF_2); | |
| 532 vis_src1(TMP18, REF_6); | |
| 533 } | |
| 534 | |
| 535 vis_and(TMP6, MASK_7f, TMP6); | |
| 536 | |
| 537 vis_and(TMP8, MASK_7f, TMP8); | |
| 538 | |
| 539 vis_psub16(TMP10, TMP6, TMP6); | |
| 540 vis_st64(TMP6, dest[0]); | |
| 541 | |
| 542 vis_psub16(TMP12, TMP8, TMP8); | |
| 543 vis_st64_2(TMP8, dest, 8); | |
| 544 dest += stride; | |
| 545 } while (--height); | |
| 546 | |
| 547 vis_ld64(ref[0], TMP0); | |
| 548 vis_xor(REF_0, REF_2, TMP6); | |
| 549 | |
| 550 vis_ld64_2(ref, 8, TMP2); | |
| 551 vis_xor(REF_4, REF_6, TMP8); | |
| 552 | |
| 553 vis_ld64_2(ref, 16, TMP4); | |
| 554 vis_and(TMP6, MASK_fe, TMP6); | |
| 555 | |
| 556 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 557 vis_and(TMP8, MASK_fe, TMP8); | |
| 558 | |
| 559 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 560 vis_or(REF_0, REF_2, TMP10); | |
| 561 | |
| 562 vis_or(REF_4, REF_6, TMP12); | |
| 563 | |
| 564 vis_alignaddr_g0((void *)off); | |
| 565 | |
| 566 vis_faligndata(TMP0, TMP2, REF_0); | |
| 567 | |
| 568 vis_faligndata(TMP2, TMP4, REF_4); | |
| 569 | |
| 570 if (off != 0x7) { | |
| 571 vis_alignaddr_g0((void *)off_plus_1); | |
| 572 vis_faligndata(TMP0, TMP2, REF_2); | |
| 573 vis_faligndata(TMP2, TMP4, REF_6); | |
| 574 } else { | |
| 575 vis_src1(TMP2, REF_2); | |
| 576 vis_src1(TMP4, REF_6); | |
| 577 } | |
| 578 | |
| 579 vis_and(TMP6, MASK_7f, TMP6); | |
| 580 | |
| 581 vis_and(TMP8, MASK_7f, TMP8); | |
| 582 | |
| 583 vis_psub16(TMP10, TMP6, TMP6); | |
| 584 vis_st64(TMP6, dest[0]); | |
| 585 | |
| 586 vis_psub16(TMP12, TMP8, TMP8); | |
| 587 vis_st64_2(TMP8, dest, 8); | |
| 588 dest += stride; | |
| 589 | |
| 590 vis_xor(REF_0, REF_2, TMP6); | |
| 591 | |
| 592 vis_xor(REF_4, REF_6, TMP8); | |
| 593 | |
| 594 vis_and(TMP6, MASK_fe, TMP6); | |
| 595 | |
| 596 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 597 vis_and(TMP8, MASK_fe, TMP8); | |
| 598 | |
| 599 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 600 vis_or(REF_0, REF_2, TMP10); | |
| 601 | |
| 602 vis_or(REF_4, REF_6, TMP12); | |
| 603 | |
| 604 vis_and(TMP6, MASK_7f, TMP6); | |
| 605 | |
| 606 vis_and(TMP8, MASK_7f, TMP8); | |
| 607 | |
| 608 vis_psub16(TMP10, TMP6, TMP6); | |
| 609 vis_st64(TMP6, dest[0]); | |
| 610 | |
| 611 vis_psub16(TMP12, TMP8, TMP8); | |
| 612 vis_st64_2(TMP8, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
613 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
614 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
615 static void MC_put_x_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 616 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
617 { |
| 2979 | 618 uint8_t *ref = (uint8_t *) _ref; |
| 619 unsigned long off = (unsigned long) ref & 0x7; | |
| 620 unsigned long off_plus_1 = off + 1; | |
| 621 | |
| 622 ref = vis_alignaddr(ref); | |
| 623 | |
| 624 vis_ld64(ref[0], TMP0); | |
| 625 | |
| 626 vis_ld64(ref[8], TMP2); | |
| 627 | |
| 628 vis_ld64(constants_fe[0], MASK_fe); | |
| 629 | |
| 630 vis_ld64(constants_7f[0], MASK_7f); | |
| 631 | |
| 632 vis_ld64(constants128[0], CONST_128); | |
| 633 vis_faligndata(TMP0, TMP2, REF_0); | |
| 634 | |
| 635 if (off != 0x7) { | |
| 636 vis_alignaddr_g0((void *)off_plus_1); | |
| 637 vis_faligndata(TMP0, TMP2, REF_2); | |
| 638 } else { | |
| 639 vis_src1(TMP2, REF_2); | |
| 640 } | |
| 641 | |
| 642 ref += stride; | |
| 643 height = (height >> 1) - 1; | |
| 644 | |
| 645 do { /* 20 cycles */ | |
| 646 vis_ld64(ref[0], TMP0); | |
| 647 vis_xor(REF_0, REF_2, TMP4); | |
| 648 | |
| 649 vis_ld64_2(ref, 8, TMP2); | |
| 650 vis_and(TMP4, MASK_fe, TMP4); | |
| 651 ref += stride; | |
| 652 | |
| 653 vis_ld64(ref[0], TMP8); | |
| 654 vis_or(REF_0, REF_2, TMP6); | |
| 655 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 656 | |
| 657 vis_alignaddr_g0((void *)off); | |
| 658 | |
| 659 vis_ld64_2(ref, 8, TMP10); | |
| 660 ref += stride; | |
| 661 vis_faligndata(TMP0, TMP2, REF_0); | |
| 662 | |
| 663 if (off != 0x7) { | |
| 664 vis_alignaddr_g0((void *)off_plus_1); | |
| 665 vis_faligndata(TMP0, TMP2, REF_2); | |
| 666 } else { | |
| 667 vis_src1(TMP2, REF_2); | |
| 668 } | |
| 669 | |
| 670 vis_and(TMP4, MASK_7f, TMP4); | |
| 671 | |
| 672 vis_psub16(TMP6, TMP4, DST_0); | |
| 673 vis_st64(DST_0, dest[0]); | |
| 674 dest += stride; | |
| 675 | |
| 676 vis_xor(REF_0, REF_2, TMP12); | |
| 677 | |
| 678 vis_and(TMP12, MASK_fe, TMP12); | |
| 679 | |
| 680 vis_or(REF_0, REF_2, TMP14); | |
| 681 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 682 | |
| 683 vis_alignaddr_g0((void *)off); | |
| 684 vis_faligndata(TMP8, TMP10, REF_0); | |
| 685 if (off != 0x7) { | |
| 686 vis_alignaddr_g0((void *)off_plus_1); | |
| 687 vis_faligndata(TMP8, TMP10, REF_2); | |
| 688 } else { | |
| 689 vis_src1(TMP10, REF_2); | |
| 690 } | |
| 691 | |
| 692 vis_and(TMP12, MASK_7f, TMP12); | |
| 693 | |
| 694 vis_psub16(TMP14, TMP12, DST_0); | |
| 695 vis_st64(DST_0, dest[0]); | |
| 696 dest += stride; | |
| 697 } while (--height); | |
| 698 | |
| 699 vis_ld64(ref[0], TMP0); | |
| 700 vis_xor(REF_0, REF_2, TMP4); | |
| 701 | |
| 702 vis_ld64_2(ref, 8, TMP2); | |
| 703 vis_and(TMP4, MASK_fe, TMP4); | |
| 704 | |
| 705 vis_or(REF_0, REF_2, TMP6); | |
| 706 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 707 | |
| 708 vis_alignaddr_g0((void *)off); | |
| 709 | |
| 710 vis_faligndata(TMP0, TMP2, REF_0); | |
| 711 | |
| 712 if (off != 0x7) { | |
| 713 vis_alignaddr_g0((void *)off_plus_1); | |
| 714 vis_faligndata(TMP0, TMP2, REF_2); | |
| 715 } else { | |
| 716 vis_src1(TMP2, REF_2); | |
| 717 } | |
| 718 | |
| 719 vis_and(TMP4, MASK_7f, TMP4); | |
| 720 | |
| 721 vis_psub16(TMP6, TMP4, DST_0); | |
| 722 vis_st64(DST_0, dest[0]); | |
| 723 dest += stride; | |
| 724 | |
| 725 vis_xor(REF_0, REF_2, TMP12); | |
| 726 | |
| 727 vis_and(TMP12, MASK_fe, TMP12); | |
| 728 | |
| 729 vis_or(REF_0, REF_2, TMP14); | |
| 730 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 731 | |
| 732 vis_and(TMP12, MASK_7f, TMP12); | |
| 733 | |
| 734 vis_psub16(TMP14, TMP12, DST_0); | |
| 735 vis_st64(DST_0, dest[0]); | |
| 736 dest += stride; | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
737 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
738 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
739 static void MC_avg_x_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 740 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
741 { |
| 2979 | 742 uint8_t *ref = (uint8_t *) _ref; |
| 743 unsigned long off = (unsigned long) ref & 0x7; | |
| 744 unsigned long off_plus_1 = off + 1; | |
| 745 | |
| 746 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 747 | |
| 748 vis_ld64(constants3[0], CONST_3); | |
| 749 vis_fzero(ZERO); | |
| 750 vis_ld64(constants256_512[0], CONST_256); | |
| 751 | |
| 752 ref = vis_alignaddr(ref); | |
| 753 do { /* 26 cycles */ | |
| 754 vis_ld64(ref[0], TMP0); | |
| 755 | |
| 756 vis_ld64(ref[8], TMP2); | |
| 757 | |
| 758 vis_alignaddr_g0((void *)off); | |
| 759 | |
| 760 vis_ld64(ref[16], TMP4); | |
| 761 | |
| 762 vis_ld64(dest[0], DST_0); | |
| 763 vis_faligndata(TMP0, TMP2, REF_0); | |
| 764 | |
| 765 vis_ld64(dest[8], DST_2); | |
| 766 vis_faligndata(TMP2, TMP4, REF_4); | |
| 767 | |
| 768 if (off != 0x7) { | |
| 769 vis_alignaddr_g0((void *)off_plus_1); | |
| 770 vis_faligndata(TMP0, TMP2, REF_2); | |
| 771 vis_faligndata(TMP2, TMP4, REF_6); | |
| 772 } else { | |
| 773 vis_src1(TMP2, REF_2); | |
| 774 vis_src1(TMP4, REF_6); | |
| 775 } | |
| 776 | |
| 777 vis_mul8x16au(REF_0, CONST_256, TMP0); | |
| 778 | |
| 779 vis_pmerge(ZERO, REF_2, TMP4); | |
| 780 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 781 | |
| 782 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 783 | |
| 784 vis_padd16(TMP0, TMP4, TMP0); | |
| 785 | |
| 786 vis_mul8x16al(DST_0, CONST_512, TMP4); | |
| 787 vis_padd16(TMP2, TMP6, TMP2); | |
| 788 | |
| 789 vis_mul8x16al(DST_1, CONST_512, TMP6); | |
| 790 | |
| 791 vis_mul8x16au(REF_6, CONST_256, TMP12); | |
| 792 | |
| 793 vis_padd16(TMP0, TMP4, TMP0); | |
| 794 vis_mul8x16au(REF_6_1, CONST_256, TMP14); | |
| 795 | |
| 796 vis_padd16(TMP2, TMP6, TMP2); | |
| 797 vis_mul8x16au(REF_4, CONST_256, TMP16); | |
| 798 | |
| 799 vis_padd16(TMP0, CONST_3, TMP8); | |
| 800 vis_mul8x16au(REF_4_1, CONST_256, TMP18); | |
| 801 | |
| 802 vis_padd16(TMP2, CONST_3, TMP10); | |
| 803 vis_pack16(TMP8, DST_0); | |
| 804 | |
| 805 vis_pack16(TMP10, DST_1); | |
| 806 vis_padd16(TMP16, TMP12, TMP0); | |
| 807 | |
| 808 vis_st64(DST_0, dest[0]); | |
| 809 vis_mul8x16al(DST_2, CONST_512, TMP4); | |
| 810 vis_padd16(TMP18, TMP14, TMP2); | |
| 811 | |
| 812 vis_mul8x16al(DST_3, CONST_512, TMP6); | |
| 813 vis_padd16(TMP0, CONST_3, TMP0); | |
| 814 | |
| 815 vis_padd16(TMP2, CONST_3, TMP2); | |
| 816 | |
| 817 vis_padd16(TMP0, TMP4, TMP0); | |
| 818 | |
| 819 vis_padd16(TMP2, TMP6, TMP2); | |
| 820 vis_pack16(TMP0, DST_2); | |
| 821 | |
| 822 vis_pack16(TMP2, DST_3); | |
| 823 vis_st64(DST_2, dest[8]); | |
| 824 | |
| 825 ref += stride; | |
| 826 dest += stride; | |
| 827 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
828 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
829 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
830 static void MC_avg_x_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 831 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
832 { |
| 2979 | 833 uint8_t *ref = (uint8_t *) _ref; |
| 834 unsigned long off = (unsigned long) ref & 0x7; | |
| 835 unsigned long off_plus_1 = off + 1; | |
| 836 int stride_times_2 = stride << 1; | |
| 837 | |
| 838 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 839 | |
| 840 vis_ld64(constants3[0], CONST_3); | |
| 841 vis_fzero(ZERO); | |
| 842 vis_ld64(constants256_512[0], CONST_256); | |
| 843 | |
| 844 ref = vis_alignaddr(ref); | |
| 845 height >>= 2; | |
| 846 do { /* 47 cycles */ | |
| 847 vis_ld64(ref[0], TMP0); | |
| 848 | |
| 849 vis_ld64_2(ref, 8, TMP2); | |
| 850 ref += stride; | |
| 851 | |
| 852 vis_alignaddr_g0((void *)off); | |
| 853 | |
| 854 vis_ld64(ref[0], TMP4); | |
| 855 vis_faligndata(TMP0, TMP2, REF_0); | |
| 856 | |
| 857 vis_ld64_2(ref, 8, TMP6); | |
| 858 ref += stride; | |
| 859 | |
| 860 vis_ld64(ref[0], TMP8); | |
| 861 | |
| 862 vis_ld64_2(ref, 8, TMP10); | |
| 863 ref += stride; | |
| 864 vis_faligndata(TMP4, TMP6, REF_4); | |
| 865 | |
| 866 vis_ld64(ref[0], TMP12); | |
| 867 | |
| 868 vis_ld64_2(ref, 8, TMP14); | |
| 869 ref += stride; | |
| 870 vis_faligndata(TMP8, TMP10, REF_S0); | |
| 871 | |
| 872 vis_faligndata(TMP12, TMP14, REF_S4); | |
| 873 | |
| 874 if (off != 0x7) { | |
| 875 vis_alignaddr_g0((void *)off_plus_1); | |
| 876 | |
| 877 vis_ld64(dest[0], DST_0); | |
| 878 vis_faligndata(TMP0, TMP2, REF_2); | |
| 879 | |
| 880 vis_ld64_2(dest, stride, DST_2); | |
| 881 vis_faligndata(TMP4, TMP6, REF_6); | |
| 882 | |
| 883 vis_faligndata(TMP8, TMP10, REF_S2); | |
| 884 | |
| 885 vis_faligndata(TMP12, TMP14, REF_S6); | |
| 886 } else { | |
| 887 vis_ld64(dest[0], DST_0); | |
| 888 vis_src1(TMP2, REF_2); | |
| 889 | |
| 890 vis_ld64_2(dest, stride, DST_2); | |
| 891 vis_src1(TMP6, REF_6); | |
| 892 | |
| 893 vis_src1(TMP10, REF_S2); | |
| 894 | |
| 895 vis_src1(TMP14, REF_S6); | |
| 896 } | |
| 897 | |
| 898 vis_pmerge(ZERO, REF_0, TMP0); | |
| 899 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 900 | |
| 901 vis_pmerge(ZERO, REF_2, TMP4); | |
| 902 vis_mul8x16au(REF_2_1, CONST_256, TMP6); | |
| 903 | |
| 904 vis_padd16(TMP0, CONST_3, TMP0); | |
| 905 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 906 | |
| 907 vis_padd16(TMP2, CONST_3, TMP2); | |
| 908 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 909 | |
| 910 vis_padd16(TMP0, TMP4, TMP0); | |
| 911 vis_mul8x16au(REF_4, CONST_256, TMP8); | |
| 912 | |
| 913 vis_padd16(TMP2, TMP6, TMP2); | |
| 914 vis_mul8x16au(REF_4_1, CONST_256, TMP10); | |
| 915 | |
| 916 vis_padd16(TMP0, TMP16, TMP0); | |
| 917 vis_mul8x16au(REF_6, CONST_256, TMP12); | |
| 918 | |
| 919 vis_padd16(TMP2, TMP18, TMP2); | |
| 920 vis_mul8x16au(REF_6_1, CONST_256, TMP14); | |
| 921 | |
| 922 vis_padd16(TMP8, CONST_3, TMP8); | |
| 923 vis_mul8x16al(DST_2, CONST_512, TMP16); | |
| 924 | |
| 925 vis_padd16(TMP8, TMP12, TMP8); | |
| 926 vis_mul8x16al(DST_3, CONST_512, TMP18); | |
| 927 | |
| 928 vis_padd16(TMP10, TMP14, TMP10); | |
| 929 vis_pack16(TMP0, DST_0); | |
| 930 | |
| 931 vis_pack16(TMP2, DST_1); | |
| 932 vis_st64(DST_0, dest[0]); | |
| 933 dest += stride; | |
| 934 vis_padd16(TMP10, CONST_3, TMP10); | |
| 935 | |
| 936 vis_ld64_2(dest, stride, DST_0); | |
| 937 vis_padd16(TMP8, TMP16, TMP8); | |
| 938 | |
| 939 vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/); | |
| 940 vis_padd16(TMP10, TMP18, TMP10); | |
| 941 vis_pack16(TMP8, DST_2); | |
| 942 | |
| 943 vis_pack16(TMP10, DST_3); | |
| 944 vis_st64(DST_2, dest[0]); | |
| 945 dest += stride; | |
| 946 | |
| 947 vis_mul8x16au(REF_S0_1, CONST_256, TMP2); | |
| 948 vis_pmerge(ZERO, REF_S0, TMP0); | |
| 949 | |
| 950 vis_pmerge(ZERO, REF_S2, TMP24); | |
| 951 vis_mul8x16au(REF_S2_1, CONST_256, TMP6); | |
| 952 | |
| 953 vis_padd16(TMP0, CONST_3, TMP0); | |
| 954 vis_mul8x16au(REF_S4, CONST_256, TMP8); | |
| 955 | |
| 956 vis_padd16(TMP2, CONST_3, TMP2); | |
| 957 vis_mul8x16au(REF_S4_1, CONST_256, TMP10); | |
| 958 | |
| 959 vis_padd16(TMP0, TMP24, TMP0); | |
| 960 vis_mul8x16au(REF_S6, CONST_256, TMP12); | |
| 961 | |
| 962 vis_padd16(TMP2, TMP6, TMP2); | |
| 963 vis_mul8x16au(REF_S6_1, CONST_256, TMP14); | |
| 964 | |
| 965 vis_padd16(TMP8, CONST_3, TMP8); | |
| 966 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 967 | |
| 968 vis_padd16(TMP10, CONST_3, TMP10); | |
| 969 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 970 | |
| 971 vis_padd16(TMP8, TMP12, TMP8); | |
| 972 vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20); | |
| 973 | |
| 974 vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22); | |
| 975 vis_padd16(TMP0, TMP16, TMP0); | |
| 976 | |
| 977 vis_padd16(TMP2, TMP18, TMP2); | |
| 978 vis_pack16(TMP0, DST_0); | |
| 979 | |
| 980 vis_padd16(TMP10, TMP14, TMP10); | |
| 981 vis_pack16(TMP2, DST_1); | |
| 982 vis_st64(DST_0, dest[0]); | |
| 983 dest += stride; | |
| 984 | |
| 985 vis_padd16(TMP8, TMP20, TMP8); | |
| 986 | |
| 987 vis_padd16(TMP10, TMP22, TMP10); | |
| 988 vis_pack16(TMP8, DST_2); | |
| 989 | |
| 990 vis_pack16(TMP10, DST_3); | |
| 991 vis_st64(DST_2, dest[0]); | |
| 992 dest += stride; | |
| 993 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
994 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
995 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
996 static void MC_put_y_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 997 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
998 { |
| 2979 | 999 uint8_t *ref = (uint8_t *) _ref; |
| 1000 | |
| 1001 ref = vis_alignaddr(ref); | |
| 1002 vis_ld64(ref[0], TMP0); | |
| 1003 | |
| 1004 vis_ld64_2(ref, 8, TMP2); | |
| 1005 | |
| 1006 vis_ld64_2(ref, 16, TMP4); | |
| 1007 ref += stride; | |
| 1008 | |
| 1009 vis_ld64(ref[0], TMP6); | |
| 1010 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1011 | |
| 1012 vis_ld64_2(ref, 8, TMP8); | |
| 1013 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1014 | |
| 1015 vis_ld64_2(ref, 16, TMP10); | |
| 1016 ref += stride; | |
| 1017 | |
| 1018 vis_ld64(constants_fe[0], MASK_fe); | |
| 1019 vis_faligndata(TMP6, TMP8, REF_2); | |
| 1020 | |
| 1021 vis_ld64(constants_7f[0], MASK_7f); | |
| 1022 vis_faligndata(TMP8, TMP10, REF_6); | |
| 1023 | |
| 1024 vis_ld64(constants128[0], CONST_128); | |
| 1025 height = (height >> 1) - 1; | |
| 1026 do { /* 24 cycles */ | |
| 1027 vis_ld64(ref[0], TMP0); | |
| 1028 vis_xor(REF_0, REF_2, TMP12); | |
| 1029 | |
| 1030 vis_ld64_2(ref, 8, TMP2); | |
| 1031 vis_xor(REF_4, REF_6, TMP16); | |
| 1032 | |
| 1033 vis_ld64_2(ref, 16, TMP4); | |
| 1034 ref += stride; | |
| 1035 vis_or(REF_0, REF_2, TMP14); | |
| 1036 | |
| 1037 vis_ld64(ref[0], TMP6); | |
| 1038 vis_or(REF_4, REF_6, TMP18); | |
| 1039 | |
| 1040 vis_ld64_2(ref, 8, TMP8); | |
| 1041 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1042 | |
| 1043 vis_ld64_2(ref, 16, TMP10); | |
| 1044 ref += stride; | |
| 1045 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1046 | |
| 1047 vis_and(TMP12, MASK_fe, TMP12); | |
| 1048 | |
| 1049 vis_and(TMP16, MASK_fe, TMP16); | |
| 1050 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 1051 | |
| 1052 vis_mul8x16(CONST_128, TMP16, TMP16); | |
| 1053 vis_xor(REF_0, REF_2, TMP0); | |
| 1054 | |
| 1055 vis_xor(REF_4, REF_6, TMP2); | |
| 1056 | |
| 1057 vis_or(REF_0, REF_2, TMP20); | |
| 1058 | |
| 1059 vis_and(TMP12, MASK_7f, TMP12); | |
| 1060 | |
| 1061 vis_and(TMP16, MASK_7f, TMP16); | |
| 1062 | |
| 1063 vis_psub16(TMP14, TMP12, TMP12); | |
| 1064 vis_st64(TMP12, dest[0]); | |
| 1065 | |
| 1066 vis_psub16(TMP18, TMP16, TMP16); | |
| 1067 vis_st64_2(TMP16, dest, 8); | |
| 1068 dest += stride; | |
| 1069 | |
| 1070 vis_or(REF_4, REF_6, TMP18); | |
| 1071 | |
| 1072 vis_and(TMP0, MASK_fe, TMP0); | |
| 1073 | |
| 1074 vis_and(TMP2, MASK_fe, TMP2); | |
| 1075 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 1076 | |
| 1077 vis_faligndata(TMP6, TMP8, REF_2); | |
| 1078 vis_mul8x16(CONST_128, TMP2, TMP2); | |
| 1079 | |
| 1080 vis_faligndata(TMP8, TMP10, REF_6); | |
| 1081 | |
| 1082 vis_and(TMP0, MASK_7f, TMP0); | |
| 1083 | |
| 1084 vis_and(TMP2, MASK_7f, TMP2); | |
| 1085 | |
| 1086 vis_psub16(TMP20, TMP0, TMP0); | |
| 1087 vis_st64(TMP0, dest[0]); | |
| 1088 | |
| 1089 vis_psub16(TMP18, TMP2, TMP2); | |
| 1090 vis_st64_2(TMP2, dest, 8); | |
| 1091 dest += stride; | |
| 1092 } while (--height); | |
| 1093 | |
| 1094 vis_ld64(ref[0], TMP0); | |
| 1095 vis_xor(REF_0, REF_2, TMP12); | |
| 1096 | |
| 1097 vis_ld64_2(ref, 8, TMP2); | |
| 1098 vis_xor(REF_4, REF_6, TMP16); | |
| 1099 | |
| 1100 vis_ld64_2(ref, 16, TMP4); | |
| 1101 vis_or(REF_0, REF_2, TMP14); | |
| 1102 | |
| 1103 vis_or(REF_4, REF_6, TMP18); | |
| 1104 | |
| 1105 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1106 | |
| 1107 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1108 | |
| 1109 vis_and(TMP12, MASK_fe, TMP12); | |
| 1110 | |
| 1111 vis_and(TMP16, MASK_fe, TMP16); | |
| 1112 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 1113 | |
| 1114 vis_mul8x16(CONST_128, TMP16, TMP16); | |
| 1115 vis_xor(REF_0, REF_2, TMP0); | |
| 1116 | |
| 1117 vis_xor(REF_4, REF_6, TMP2); | |
| 1118 | |
| 1119 vis_or(REF_0, REF_2, TMP20); | |
| 1120 | |
| 1121 vis_and(TMP12, MASK_7f, TMP12); | |
| 1122 | |
| 1123 vis_and(TMP16, MASK_7f, TMP16); | |
| 1124 | |
| 1125 vis_psub16(TMP14, TMP12, TMP12); | |
| 1126 vis_st64(TMP12, dest[0]); | |
| 1127 | |
| 1128 vis_psub16(TMP18, TMP16, TMP16); | |
| 1129 vis_st64_2(TMP16, dest, 8); | |
| 1130 dest += stride; | |
| 1131 | |
| 1132 vis_or(REF_4, REF_6, TMP18); | |
| 1133 | |
| 1134 vis_and(TMP0, MASK_fe, TMP0); | |
| 1135 | |
| 1136 vis_and(TMP2, MASK_fe, TMP2); | |
| 1137 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 1138 | |
| 1139 vis_mul8x16(CONST_128, TMP2, TMP2); | |
| 1140 | |
| 1141 vis_and(TMP0, MASK_7f, TMP0); | |
| 1142 | |
| 1143 vis_and(TMP2, MASK_7f, TMP2); | |
| 1144 | |
| 1145 vis_psub16(TMP20, TMP0, TMP0); | |
| 1146 vis_st64(TMP0, dest[0]); | |
| 1147 | |
| 1148 vis_psub16(TMP18, TMP2, TMP2); | |
| 1149 vis_st64_2(TMP2, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1150 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1151 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1152 static void MC_put_y_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1153 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1154 { |
| 2979 | 1155 uint8_t *ref = (uint8_t *) _ref; |
| 1156 | |
| 1157 ref = vis_alignaddr(ref); | |
| 1158 vis_ld64(ref[0], TMP0); | |
| 1159 | |
| 1160 vis_ld64_2(ref, 8, TMP2); | |
| 1161 ref += stride; | |
| 1162 | |
| 1163 vis_ld64(ref[0], TMP4); | |
| 1164 | |
| 1165 vis_ld64_2(ref, 8, TMP6); | |
| 1166 ref += stride; | |
| 1167 | |
| 1168 vis_ld64(constants_fe[0], MASK_fe); | |
| 1169 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1170 | |
| 1171 vis_ld64(constants_7f[0], MASK_7f); | |
| 1172 vis_faligndata(TMP4, TMP6, REF_2); | |
| 1173 | |
| 1174 vis_ld64(constants128[0], CONST_128); | |
| 1175 height = (height >> 1) - 1; | |
| 1176 do { /* 12 cycles */ | |
| 1177 vis_ld64(ref[0], TMP0); | |
| 1178 vis_xor(REF_0, REF_2, TMP4); | |
| 1179 | |
| 1180 vis_ld64_2(ref, 8, TMP2); | |
| 1181 ref += stride; | |
| 1182 vis_and(TMP4, MASK_fe, TMP4); | |
| 1183 | |
| 1184 vis_or(REF_0, REF_2, TMP6); | |
| 1185 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 1186 | |
| 1187 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1188 vis_ld64(ref[0], TMP0); | |
| 1189 | |
| 1190 vis_ld64_2(ref, 8, TMP2); | |
| 1191 ref += stride; | |
| 1192 vis_xor(REF_0, REF_2, TMP12); | |
| 1193 | |
| 1194 vis_and(TMP4, MASK_7f, TMP4); | |
| 1195 | |
| 1196 vis_and(TMP12, MASK_fe, TMP12); | |
| 1197 | |
| 1198 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 1199 vis_or(REF_0, REF_2, TMP14); | |
| 1200 | |
| 1201 vis_psub16(TMP6, TMP4, DST_0); | |
| 1202 vis_st64(DST_0, dest[0]); | |
| 1203 dest += stride; | |
| 1204 | |
| 1205 vis_faligndata(TMP0, TMP2, REF_2); | |
| 1206 | |
| 1207 vis_and(TMP12, MASK_7f, TMP12); | |
| 1208 | |
| 1209 vis_psub16(TMP14, TMP12, DST_0); | |
| 1210 vis_st64(DST_0, dest[0]); | |
| 1211 dest += stride; | |
| 1212 } while (--height); | |
| 1213 | |
| 1214 vis_ld64(ref[0], TMP0); | |
| 1215 vis_xor(REF_0, REF_2, TMP4); | |
| 1216 | |
| 1217 vis_ld64_2(ref, 8, TMP2); | |
| 1218 vis_and(TMP4, MASK_fe, TMP4); | |
| 1219 | |
| 1220 vis_or(REF_0, REF_2, TMP6); | |
| 1221 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 1222 | |
| 1223 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1224 | |
| 1225 vis_xor(REF_0, REF_2, TMP12); | |
| 1226 | |
| 1227 vis_and(TMP4, MASK_7f, TMP4); | |
| 1228 | |
| 1229 vis_and(TMP12, MASK_fe, TMP12); | |
| 1230 | |
| 1231 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 1232 vis_or(REF_0, REF_2, TMP14); | |
| 1233 | |
| 1234 vis_psub16(TMP6, TMP4, DST_0); | |
| 1235 vis_st64(DST_0, dest[0]); | |
| 1236 dest += stride; | |
| 1237 | |
| 1238 vis_and(TMP12, MASK_7f, TMP12); | |
| 1239 | |
| 1240 vis_psub16(TMP14, TMP12, DST_0); | |
| 1241 vis_st64(DST_0, dest[0]); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1242 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1243 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1244 static void MC_avg_y_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1245 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1246 { |
| 2979 | 1247 uint8_t *ref = (uint8_t *) _ref; |
| 1248 int stride_8 = stride + 8; | |
| 1249 int stride_16 = stride + 16; | |
| 1250 | |
| 1251 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1252 | |
| 1253 ref = vis_alignaddr(ref); | |
| 1254 | |
| 1255 vis_ld64(ref[ 0], TMP0); | |
| 1256 vis_fzero(ZERO); | |
| 1257 | |
| 1258 vis_ld64(ref[ 8], TMP2); | |
| 1259 | |
| 1260 vis_ld64(ref[16], TMP4); | |
| 1261 | |
| 1262 vis_ld64(constants3[0], CONST_3); | |
| 1263 vis_faligndata(TMP0, TMP2, REF_2); | |
| 1264 | |
| 1265 vis_ld64(constants256_512[0], CONST_256); | |
| 1266 vis_faligndata(TMP2, TMP4, REF_6); | |
| 1267 height >>= 1; | |
| 1268 | |
| 1269 do { /* 31 cycles */ | |
| 1270 vis_ld64_2(ref, stride, TMP0); | |
| 1271 vis_pmerge(ZERO, REF_2, TMP12); | |
| 1272 vis_mul8x16au(REF_2_1, CONST_256, TMP14); | |
| 1273 | |
| 1274 vis_ld64_2(ref, stride_8, TMP2); | |
| 1275 vis_pmerge(ZERO, REF_6, TMP16); | |
| 1276 vis_mul8x16au(REF_6_1, CONST_256, TMP18); | |
| 1277 | |
| 1278 vis_ld64_2(ref, stride_16, TMP4); | |
| 1279 ref += stride; | |
| 1280 | |
| 1281 vis_ld64(dest[0], DST_0); | |
| 1282 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1283 | |
| 1284 vis_ld64_2(dest, 8, DST_2); | |
| 1285 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1286 | |
| 1287 vis_ld64_2(ref, stride, TMP6); | |
| 1288 vis_pmerge(ZERO, REF_0, TMP0); | |
| 1289 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 1290 | |
| 1291 vis_ld64_2(ref, stride_8, TMP8); | |
| 1292 vis_pmerge(ZERO, REF_4, TMP4); | |
| 1293 | |
| 1294 vis_ld64_2(ref, stride_16, TMP10); | |
| 1295 ref += stride; | |
| 1296 | |
| 1297 vis_ld64_2(dest, stride, REF_S0/*DST_4*/); | |
| 1298 vis_faligndata(TMP6, TMP8, REF_2); | |
| 1299 vis_mul8x16au(REF_4_1, CONST_256, TMP6); | |
| 1300 | |
| 1301 vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/); | |
| 1302 vis_faligndata(TMP8, TMP10, REF_6); | |
| 1303 vis_mul8x16al(DST_0, CONST_512, TMP20); | |
| 1304 | |
| 1305 vis_padd16(TMP0, CONST_3, TMP0); | |
| 1306 vis_mul8x16al(DST_1, CONST_512, TMP22); | |
| 1307 | |
| 1308 vis_padd16(TMP2, CONST_3, TMP2); | |
| 1309 vis_mul8x16al(DST_2, CONST_512, TMP24); | |
| 1310 | |
| 1311 vis_padd16(TMP4, CONST_3, TMP4); | |
| 1312 vis_mul8x16al(DST_3, CONST_512, TMP26); | |
| 1313 | |
| 1314 vis_padd16(TMP6, CONST_3, TMP6); | |
| 1315 | |
| 1316 vis_padd16(TMP12, TMP20, TMP12); | |
| 1317 vis_mul8x16al(REF_S0, CONST_512, TMP20); | |
| 1318 | |
| 1319 vis_padd16(TMP14, TMP22, TMP14); | |
| 1320 vis_mul8x16al(REF_S0_1, CONST_512, TMP22); | |
| 1321 | |
| 1322 vis_padd16(TMP16, TMP24, TMP16); | |
| 1323 vis_mul8x16al(REF_S2, CONST_512, TMP24); | |
| 1324 | |
| 1325 vis_padd16(TMP18, TMP26, TMP18); | |
| 1326 vis_mul8x16al(REF_S2_1, CONST_512, TMP26); | |
| 1327 | |
| 1328 vis_padd16(TMP12, TMP0, TMP12); | |
| 1329 vis_mul8x16au(REF_2, CONST_256, TMP28); | |
| 1330 | |
| 1331 vis_padd16(TMP14, TMP2, TMP14); | |
| 1332 vis_mul8x16au(REF_2_1, CONST_256, TMP30); | |
| 1333 | |
| 1334 vis_padd16(TMP16, TMP4, TMP16); | |
| 1335 vis_mul8x16au(REF_6, CONST_256, REF_S4); | |
| 1336 | |
| 1337 vis_padd16(TMP18, TMP6, TMP18); | |
| 1338 vis_mul8x16au(REF_6_1, CONST_256, REF_S6); | |
| 1339 | |
| 1340 vis_pack16(TMP12, DST_0); | |
| 1341 vis_padd16(TMP28, TMP0, TMP12); | |
| 1342 | |
| 1343 vis_pack16(TMP14, DST_1); | |
| 1344 vis_st64(DST_0, dest[0]); | |
| 1345 vis_padd16(TMP30, TMP2, TMP14); | |
| 1346 | |
| 1347 vis_pack16(TMP16, DST_2); | |
| 1348 vis_padd16(REF_S4, TMP4, TMP16); | |
| 1349 | |
| 1350 vis_pack16(TMP18, DST_3); | |
| 1351 vis_st64_2(DST_2, dest, 8); | |
| 1352 dest += stride; | |
| 1353 vis_padd16(REF_S6, TMP6, TMP18); | |
| 1354 | |
| 1355 vis_padd16(TMP12, TMP20, TMP12); | |
| 1356 | |
| 1357 vis_padd16(TMP14, TMP22, TMP14); | |
| 1358 vis_pack16(TMP12, DST_0); | |
| 1359 | |
| 1360 vis_padd16(TMP16, TMP24, TMP16); | |
| 1361 vis_pack16(TMP14, DST_1); | |
| 1362 vis_st64(DST_0, dest[0]); | |
| 1363 | |
| 1364 vis_padd16(TMP18, TMP26, TMP18); | |
| 1365 vis_pack16(TMP16, DST_2); | |
| 1366 | |
| 1367 vis_pack16(TMP18, DST_3); | |
| 1368 vis_st64_2(DST_2, dest, 8); | |
| 1369 dest += stride; | |
| 1370 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1371 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1372 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1373 static void MC_avg_y_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1374 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1375 { |
| 2979 | 1376 uint8_t *ref = (uint8_t *) _ref; |
| 1377 int stride_8 = stride + 8; | |
| 1378 | |
| 1379 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1380 | |
| 1381 ref = vis_alignaddr(ref); | |
| 1382 | |
| 1383 vis_ld64(ref[ 0], TMP0); | |
| 1384 vis_fzero(ZERO); | |
| 1385 | |
| 1386 vis_ld64(ref[ 8], TMP2); | |
| 1387 | |
| 1388 vis_ld64(constants3[0], CONST_3); | |
| 1389 vis_faligndata(TMP0, TMP2, REF_2); | |
| 1390 | |
| 1391 vis_ld64(constants256_512[0], CONST_256); | |
| 1392 | |
| 1393 height >>= 1; | |
| 1394 do { /* 20 cycles */ | |
| 1395 vis_ld64_2(ref, stride, TMP0); | |
| 1396 vis_pmerge(ZERO, REF_2, TMP8); | |
| 1397 vis_mul8x16au(REF_2_1, CONST_256, TMP10); | |
| 1398 | |
| 1399 vis_ld64_2(ref, stride_8, TMP2); | |
| 1400 ref += stride; | |
| 1401 | |
| 1402 vis_ld64(dest[0], DST_0); | |
| 1403 | |
| 1404 vis_ld64_2(dest, stride, DST_2); | |
| 1405 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1406 | |
| 1407 vis_ld64_2(ref, stride, TMP4); | |
| 1408 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 1409 vis_pmerge(ZERO, REF_0, TMP12); | |
| 1410 | |
| 1411 vis_ld64_2(ref, stride_8, TMP6); | |
| 1412 ref += stride; | |
| 1413 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 1414 vis_pmerge(ZERO, REF_0_1, TMP14); | |
| 1415 | |
| 1416 vis_padd16(TMP12, CONST_3, TMP12); | |
| 1417 vis_mul8x16al(DST_2, CONST_512, TMP24); | |
| 1418 | |
| 1419 vis_padd16(TMP14, CONST_3, TMP14); | |
| 1420 vis_mul8x16al(DST_3, CONST_512, TMP26); | |
| 1421 | |
| 1422 vis_faligndata(TMP4, TMP6, REF_2); | |
| 1423 | |
| 1424 vis_padd16(TMP8, TMP12, TMP8); | |
| 1425 | |
| 1426 vis_padd16(TMP10, TMP14, TMP10); | |
| 1427 vis_mul8x16au(REF_2, CONST_256, TMP20); | |
| 1428 | |
| 1429 vis_padd16(TMP8, TMP16, TMP0); | |
| 1430 vis_mul8x16au(REF_2_1, CONST_256, TMP22); | |
| 1431 | |
| 1432 vis_padd16(TMP10, TMP18, TMP2); | |
| 1433 vis_pack16(TMP0, DST_0); | |
| 1434 | |
| 1435 vis_pack16(TMP2, DST_1); | |
| 1436 vis_st64(DST_0, dest[0]); | |
| 1437 dest += stride; | |
| 1438 vis_padd16(TMP12, TMP20, TMP12); | |
| 1439 | |
| 1440 vis_padd16(TMP14, TMP22, TMP14); | |
| 1441 | |
| 1442 vis_padd16(TMP12, TMP24, TMP0); | |
| 1443 | |
| 1444 vis_padd16(TMP14, TMP26, TMP2); | |
| 1445 vis_pack16(TMP0, DST_2); | |
| 1446 | |
| 1447 vis_pack16(TMP2, DST_3); | |
| 1448 vis_st64(DST_2, dest[0]); | |
| 1449 dest += stride; | |
| 1450 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1451 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1452 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1453 static void MC_put_xy_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1454 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1455 { |
| 2979 | 1456 uint8_t *ref = (uint8_t *) _ref; |
| 1457 unsigned long off = (unsigned long) ref & 0x7; | |
| 1458 unsigned long off_plus_1 = off + 1; | |
| 1459 int stride_8 = stride + 8; | |
| 1460 int stride_16 = stride + 16; | |
| 1461 | |
| 1462 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1463 | |
| 1464 ref = vis_alignaddr(ref); | |
| 1465 | |
| 1466 vis_ld64(ref[ 0], TMP0); | |
| 1467 vis_fzero(ZERO); | |
| 1468 | |
| 1469 vis_ld64(ref[ 8], TMP2); | |
| 1470 | |
| 1471 vis_ld64(ref[16], TMP4); | |
| 1472 | |
| 1473 vis_ld64(constants2[0], CONST_2); | |
| 1474 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 1475 | |
| 1476 vis_ld64(constants256_512[0], CONST_256); | |
| 1477 vis_faligndata(TMP2, TMP4, REF_S4); | |
| 1478 | |
| 1479 if (off != 0x7) { | |
| 1480 vis_alignaddr_g0((void *)off_plus_1); | |
| 1481 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 1482 vis_faligndata(TMP2, TMP4, REF_S6); | |
| 1483 } else { | |
| 1484 vis_src1(TMP2, REF_S2); | |
| 1485 vis_src1(TMP4, REF_S6); | |
| 1486 } | |
| 1487 | |
| 1488 height >>= 1; | |
| 1489 do { | |
| 1490 vis_ld64_2(ref, stride, TMP0); | |
| 1491 vis_mul8x16au(REF_S0, CONST_256, TMP12); | |
| 1492 vis_pmerge(ZERO, REF_S0_1, TMP14); | |
| 1493 | |
| 1494 vis_alignaddr_g0((void *)off); | |
| 1495 | |
| 1496 vis_ld64_2(ref, stride_8, TMP2); | |
| 1497 vis_mul8x16au(REF_S2, CONST_256, TMP16); | |
| 1498 vis_pmerge(ZERO, REF_S2_1, TMP18); | |
| 1499 | |
| 1500 vis_ld64_2(ref, stride_16, TMP4); | |
| 1501 ref += stride; | |
| 1502 vis_mul8x16au(REF_S4, CONST_256, TMP20); | |
| 1503 vis_pmerge(ZERO, REF_S4_1, TMP22); | |
| 1504 | |
| 1505 vis_ld64_2(ref, stride, TMP6); | |
| 1506 vis_mul8x16au(REF_S6, CONST_256, TMP24); | |
| 1507 vis_pmerge(ZERO, REF_S6_1, TMP26); | |
| 1508 | |
| 1509 vis_ld64_2(ref, stride_8, TMP8); | |
| 1510 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1511 | |
| 1512 vis_ld64_2(ref, stride_16, TMP10); | |
| 1513 ref += stride; | |
| 1514 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1515 | |
| 1516 vis_faligndata(TMP6, TMP8, REF_S0); | |
| 1517 | |
| 1518 vis_faligndata(TMP8, TMP10, REF_S4); | |
| 1519 | |
| 1520 if (off != 0x7) { | |
| 1521 vis_alignaddr_g0((void *)off_plus_1); | |
| 1522 vis_faligndata(TMP0, TMP2, REF_2); | |
| 1523 vis_faligndata(TMP2, TMP4, REF_6); | |
| 1524 vis_faligndata(TMP6, TMP8, REF_S2); | |
| 1525 vis_faligndata(TMP8, TMP10, REF_S6); | |
| 1526 } else { | |
| 1527 vis_src1(TMP2, REF_2); | |
| 1528 vis_src1(TMP4, REF_6); | |
| 1529 vis_src1(TMP8, REF_S2); | |
| 1530 vis_src1(TMP10, REF_S6); | |
| 1531 } | |
| 1532 | |
| 1533 vis_mul8x16au(REF_0, CONST_256, TMP0); | |
| 1534 vis_pmerge(ZERO, REF_0_1, TMP2); | |
| 1535 | |
| 1536 vis_mul8x16au(REF_2, CONST_256, TMP4); | |
| 1537 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 1538 | |
| 1539 vis_padd16(TMP0, CONST_2, TMP8); | |
| 1540 vis_mul8x16au(REF_4, CONST_256, TMP0); | |
| 1541 | |
| 1542 vis_padd16(TMP2, CONST_2, TMP10); | |
| 1543 vis_mul8x16au(REF_4_1, CONST_256, TMP2); | |
| 1544 | |
| 1545 vis_padd16(TMP8, TMP4, TMP8); | |
| 1546 vis_mul8x16au(REF_6, CONST_256, TMP4); | |
| 1547 | |
| 1548 vis_padd16(TMP10, TMP6, TMP10); | |
| 1549 vis_mul8x16au(REF_6_1, CONST_256, TMP6); | |
| 1550 | |
| 1551 vis_padd16(TMP12, TMP8, TMP12); | |
| 1552 | |
| 1553 vis_padd16(TMP14, TMP10, TMP14); | |
| 1554 | |
| 1555 vis_padd16(TMP12, TMP16, TMP12); | |
| 1556 | |
| 1557 vis_padd16(TMP14, TMP18, TMP14); | |
| 1558 vis_pack16(TMP12, DST_0); | |
| 1559 | |
| 1560 vis_pack16(TMP14, DST_1); | |
| 1561 vis_st64(DST_0, dest[0]); | |
| 1562 vis_padd16(TMP0, CONST_2, TMP12); | |
| 1563 | |
| 1564 vis_mul8x16au(REF_S0, CONST_256, TMP0); | |
| 1565 vis_padd16(TMP2, CONST_2, TMP14); | |
| 1566 | |
| 1567 vis_mul8x16au(REF_S0_1, CONST_256, TMP2); | |
| 1568 vis_padd16(TMP12, TMP4, TMP12); | |
| 1569 | |
| 1570 vis_mul8x16au(REF_S2, CONST_256, TMP4); | |
| 1571 vis_padd16(TMP14, TMP6, TMP14); | |
| 1572 | |
| 1573 vis_mul8x16au(REF_S2_1, CONST_256, TMP6); | |
| 1574 vis_padd16(TMP20, TMP12, TMP20); | |
| 1575 | |
| 1576 vis_padd16(TMP22, TMP14, TMP22); | |
| 1577 | |
| 1578 vis_padd16(TMP20, TMP24, TMP20); | |
| 1579 | |
| 1580 vis_padd16(TMP22, TMP26, TMP22); | |
| 1581 vis_pack16(TMP20, DST_2); | |
| 1582 | |
| 1583 vis_pack16(TMP22, DST_3); | |
| 1584 vis_st64_2(DST_2, dest, 8); | |
| 1585 dest += stride; | |
| 1586 vis_padd16(TMP0, TMP4, TMP24); | |
| 1587 | |
| 1588 vis_mul8x16au(REF_S4, CONST_256, TMP0); | |
| 1589 vis_padd16(TMP2, TMP6, TMP26); | |
| 1590 | |
| 1591 vis_mul8x16au(REF_S4_1, CONST_256, TMP2); | |
| 1592 vis_padd16(TMP24, TMP8, TMP24); | |
| 1593 | |
| 1594 vis_padd16(TMP26, TMP10, TMP26); | |
| 1595 vis_pack16(TMP24, DST_0); | |
| 1596 | |
| 1597 vis_pack16(TMP26, DST_1); | |
| 1598 vis_st64(DST_0, dest[0]); | |
| 1599 vis_pmerge(ZERO, REF_S6, TMP4); | |
| 1600 | |
| 1601 vis_pmerge(ZERO, REF_S6_1, TMP6); | |
| 1602 | |
| 1603 vis_padd16(TMP0, TMP4, TMP0); | |
| 1604 | |
| 1605 vis_padd16(TMP2, TMP6, TMP2); | |
| 1606 | |
| 1607 vis_padd16(TMP0, TMP12, TMP0); | |
| 1608 | |
| 1609 vis_padd16(TMP2, TMP14, TMP2); | |
| 1610 vis_pack16(TMP0, DST_2); | |
| 1611 | |
| 1612 vis_pack16(TMP2, DST_3); | |
| 1613 vis_st64_2(DST_2, dest, 8); | |
| 1614 dest += stride; | |
| 1615 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1616 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1617 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1618 static void MC_put_xy_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1619 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1620 { |
| 2979 | 1621 uint8_t *ref = (uint8_t *) _ref; |
| 1622 unsigned long off = (unsigned long) ref & 0x7; | |
| 1623 unsigned long off_plus_1 = off + 1; | |
| 1624 int stride_8 = stride + 8; | |
| 1625 | |
| 1626 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1627 | |
| 1628 ref = vis_alignaddr(ref); | |
| 1629 | |
| 1630 vis_ld64(ref[ 0], TMP0); | |
| 1631 vis_fzero(ZERO); | |
| 1632 | |
| 1633 vis_ld64(ref[ 8], TMP2); | |
| 1634 | |
| 1635 vis_ld64(constants2[0], CONST_2); | |
| 1636 | |
| 1637 vis_ld64(constants256_512[0], CONST_256); | |
| 1638 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 1639 | |
| 1640 if (off != 0x7) { | |
| 1641 vis_alignaddr_g0((void *)off_plus_1); | |
| 1642 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 1643 } else { | |
| 1644 vis_src1(TMP2, REF_S2); | |
| 1645 } | |
| 1646 | |
| 1647 height >>= 1; | |
| 1648 do { /* 26 cycles */ | |
| 1649 vis_ld64_2(ref, stride, TMP0); | |
| 1650 vis_mul8x16au(REF_S0, CONST_256, TMP8); | |
| 1651 vis_pmerge(ZERO, REF_S2, TMP12); | |
| 1652 | |
| 1653 vis_alignaddr_g0((void *)off); | |
| 1654 | |
| 1655 vis_ld64_2(ref, stride_8, TMP2); | |
| 1656 ref += stride; | |
| 1657 vis_mul8x16au(REF_S0_1, CONST_256, TMP10); | |
| 1658 vis_pmerge(ZERO, REF_S2_1, TMP14); | |
| 1659 | |
| 1660 vis_ld64_2(ref, stride, TMP4); | |
| 1661 | |
| 1662 vis_ld64_2(ref, stride_8, TMP6); | |
| 1663 ref += stride; | |
| 1664 vis_faligndata(TMP0, TMP2, REF_S4); | |
| 1665 | |
| 1666 vis_pmerge(ZERO, REF_S4, TMP18); | |
| 1667 | |
| 1668 vis_pmerge(ZERO, REF_S4_1, TMP20); | |
| 1669 | |
| 1670 vis_faligndata(TMP4, TMP6, REF_S0); | |
| 1671 | |
| 1672 if (off != 0x7) { | |
| 1673 vis_alignaddr_g0((void *)off_plus_1); | |
| 1674 vis_faligndata(TMP0, TMP2, REF_S6); | |
| 1675 vis_faligndata(TMP4, TMP6, REF_S2); | |
| 1676 } else { | |
| 1677 vis_src1(TMP2, REF_S6); | |
| 1678 vis_src1(TMP6, REF_S2); | |
| 1679 } | |
| 1680 | |
| 1681 vis_padd16(TMP18, CONST_2, TMP18); | |
| 1682 vis_mul8x16au(REF_S6, CONST_256, TMP22); | |
| 1683 | |
| 1684 vis_padd16(TMP20, CONST_2, TMP20); | |
| 1685 vis_mul8x16au(REF_S6_1, CONST_256, TMP24); | |
| 1686 | |
| 1687 vis_mul8x16au(REF_S0, CONST_256, TMP26); | |
| 1688 vis_pmerge(ZERO, REF_S0_1, TMP28); | |
| 1689 | |
| 1690 vis_mul8x16au(REF_S2, CONST_256, TMP30); | |
| 1691 vis_padd16(TMP18, TMP22, TMP18); | |
| 1692 | |
| 1693 vis_mul8x16au(REF_S2_1, CONST_256, TMP32); | |
| 1694 vis_padd16(TMP20, TMP24, TMP20); | |
| 1695 | |
| 1696 vis_padd16(TMP8, TMP18, TMP8); | |
| 1697 | |
| 1698 vis_padd16(TMP10, TMP20, TMP10); | |
| 1699 | |
| 1700 vis_padd16(TMP8, TMP12, TMP8); | |
| 1701 | |
| 1702 vis_padd16(TMP10, TMP14, TMP10); | |
| 1703 vis_pack16(TMP8, DST_0); | |
| 1704 | |
| 1705 vis_pack16(TMP10, DST_1); | |
| 1706 vis_st64(DST_0, dest[0]); | |
| 1707 dest += stride; | |
| 1708 vis_padd16(TMP18, TMP26, TMP18); | |
| 1709 | |
| 1710 vis_padd16(TMP20, TMP28, TMP20); | |
| 1711 | |
| 1712 vis_padd16(TMP18, TMP30, TMP18); | |
| 1713 | |
| 1714 vis_padd16(TMP20, TMP32, TMP20); | |
| 1715 vis_pack16(TMP18, DST_2); | |
| 1716 | |
| 1717 vis_pack16(TMP20, DST_3); | |
| 1718 vis_st64(DST_2, dest[0]); | |
| 1719 dest += stride; | |
| 1720 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1721 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1722 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1723 static void MC_avg_xy_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1724 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1725 { |
| 2979 | 1726 uint8_t *ref = (uint8_t *) _ref; |
| 1727 unsigned long off = (unsigned long) ref & 0x7; | |
| 1728 unsigned long off_plus_1 = off + 1; | |
| 1729 int stride_8 = stride + 8; | |
| 1730 int stride_16 = stride + 16; | |
| 1731 | |
| 1732 vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1733 | |
| 1734 ref = vis_alignaddr(ref); | |
| 1735 | |
| 1736 vis_ld64(ref[ 0], TMP0); | |
| 1737 vis_fzero(ZERO); | |
| 1738 | |
| 1739 vis_ld64(ref[ 8], TMP2); | |
| 1740 | |
| 1741 vis_ld64(ref[16], TMP4); | |
| 1742 | |
| 1743 vis_ld64(constants6[0], CONST_6); | |
| 1744 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 1745 | |
| 1746 vis_ld64(constants256_1024[0], CONST_256); | |
| 1747 vis_faligndata(TMP2, TMP4, REF_S4); | |
| 1748 | |
| 1749 if (off != 0x7) { | |
| 1750 vis_alignaddr_g0((void *)off_plus_1); | |
| 1751 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 1752 vis_faligndata(TMP2, TMP4, REF_S6); | |
| 1753 } else { | |
| 1754 vis_src1(TMP2, REF_S2); | |
| 1755 vis_src1(TMP4, REF_S6); | |
| 1756 } | |
| 1757 | |
| 1758 height >>= 1; | |
| 1759 do { /* 55 cycles */ | |
| 1760 vis_ld64_2(ref, stride, TMP0); | |
| 1761 vis_mul8x16au(REF_S0, CONST_256, TMP12); | |
| 1762 vis_pmerge(ZERO, REF_S0_1, TMP14); | |
| 1763 | |
| 1764 vis_alignaddr_g0((void *)off); | |
| 1765 | |
| 1766 vis_ld64_2(ref, stride_8, TMP2); | |
| 1767 vis_mul8x16au(REF_S2, CONST_256, TMP16); | |
| 1768 vis_pmerge(ZERO, REF_S2_1, TMP18); | |
| 1769 | |
| 1770 vis_ld64_2(ref, stride_16, TMP4); | |
| 1771 ref += stride; | |
| 1772 vis_mul8x16au(REF_S4, CONST_256, TMP20); | |
| 1773 vis_pmerge(ZERO, REF_S4_1, TMP22); | |
| 1774 | |
| 1775 vis_ld64_2(ref, stride, TMP6); | |
| 1776 vis_mul8x16au(REF_S6, CONST_256, TMP24); | |
| 1777 vis_pmerge(ZERO, REF_S6_1, TMP26); | |
| 1778 | |
| 1779 vis_ld64_2(ref, stride_8, TMP8); | |
| 1780 vis_faligndata(TMP0, TMP2, REF_0); | |
| 1781 | |
| 1782 vis_ld64_2(ref, stride_16, TMP10); | |
| 1783 ref += stride; | |
| 1784 vis_faligndata(TMP2, TMP4, REF_4); | |
| 1785 | |
| 1786 vis_ld64(dest[0], DST_0); | |
| 1787 vis_faligndata(TMP6, TMP8, REF_S0); | |
| 1788 | |
| 1789 vis_ld64_2(dest, 8, DST_2); | |
| 1790 vis_faligndata(TMP8, TMP10, REF_S4); | |
| 1791 | |
| 1792 if (off != 0x7) { | |
| 1793 vis_alignaddr_g0((void *)off_plus_1); | |
| 1794 vis_faligndata(TMP0, TMP2, REF_2); | |
| 1795 vis_faligndata(TMP2, TMP4, REF_6); | |
| 1796 vis_faligndata(TMP6, TMP8, REF_S2); | |
| 1797 vis_faligndata(TMP8, TMP10, REF_S6); | |
| 1798 } else { | |
| 1799 vis_src1(TMP2, REF_2); | |
| 1800 vis_src1(TMP4, REF_6); | |
| 1801 vis_src1(TMP8, REF_S2); | |
| 1802 vis_src1(TMP10, REF_S6); | |
| 1803 } | |
| 1804 | |
| 1805 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 1806 vis_pmerge(ZERO, REF_0, TMP0); | |
| 1807 | |
| 1808 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 1809 vis_pmerge(ZERO, REF_0_1, TMP2); | |
| 1810 | |
| 1811 vis_mul8x16au(REF_2, CONST_256, TMP4); | |
| 1812 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 1813 | |
| 1814 vis_mul8x16al(DST_2, CONST_1024, REF_0); | |
| 1815 vis_padd16(TMP0, CONST_6, TMP0); | |
| 1816 | |
| 1817 vis_mul8x16al(DST_3, CONST_1024, REF_2); | |
| 1818 vis_padd16(TMP2, CONST_6, TMP2); | |
| 1819 | |
| 1820 vis_padd16(TMP0, TMP4, TMP0); | |
| 1821 vis_mul8x16au(REF_4, CONST_256, TMP4); | |
| 1822 | |
| 1823 vis_padd16(TMP2, TMP6, TMP2); | |
| 1824 vis_mul8x16au(REF_4_1, CONST_256, TMP6); | |
| 1825 | |
| 1826 vis_padd16(TMP12, TMP0, TMP12); | |
| 1827 vis_mul8x16au(REF_6, CONST_256, TMP8); | |
| 1828 | |
| 1829 vis_padd16(TMP14, TMP2, TMP14); | |
| 1830 vis_mul8x16au(REF_6_1, CONST_256, TMP10); | |
| 1831 | |
| 1832 vis_padd16(TMP12, TMP16, TMP12); | |
| 1833 vis_mul8x16au(REF_S0, CONST_256, REF_4); | |
| 1834 | |
| 1835 vis_padd16(TMP14, TMP18, TMP14); | |
| 1836 vis_mul8x16au(REF_S0_1, CONST_256, REF_6); | |
| 1837 | |
| 1838 vis_padd16(TMP12, TMP30, TMP12); | |
| 1839 | |
| 1840 vis_padd16(TMP14, TMP32, TMP14); | |
| 1841 vis_pack16(TMP12, DST_0); | |
| 1842 | |
| 1843 vis_pack16(TMP14, DST_1); | |
| 1844 vis_st64(DST_0, dest[0]); | |
| 1845 vis_padd16(TMP4, CONST_6, TMP4); | |
| 1846 | |
| 1847 vis_ld64_2(dest, stride, DST_0); | |
| 1848 vis_padd16(TMP6, CONST_6, TMP6); | |
| 1849 vis_mul8x16au(REF_S2, CONST_256, TMP12); | |
| 1850 | |
| 1851 vis_padd16(TMP4, TMP8, TMP4); | |
| 1852 vis_mul8x16au(REF_S2_1, CONST_256, TMP14); | |
| 1853 | |
| 1854 vis_padd16(TMP6, TMP10, TMP6); | |
| 1855 | |
| 1856 vis_padd16(TMP20, TMP4, TMP20); | |
| 1857 | |
| 1858 vis_padd16(TMP22, TMP6, TMP22); | |
| 1859 | |
| 1860 vis_padd16(TMP20, TMP24, TMP20); | |
| 1861 | |
| 1862 vis_padd16(TMP22, TMP26, TMP22); | |
| 1863 | |
| 1864 vis_padd16(TMP20, REF_0, TMP20); | |
| 1865 vis_mul8x16au(REF_S4, CONST_256, REF_0); | |
| 1866 | |
| 1867 vis_padd16(TMP22, REF_2, TMP22); | |
| 1868 vis_pack16(TMP20, DST_2); | |
| 1869 | |
| 1870 vis_pack16(TMP22, DST_3); | |
| 1871 vis_st64_2(DST_2, dest, 8); | |
| 1872 dest += stride; | |
| 1873 | |
| 1874 vis_ld64_2(dest, 8, DST_2); | |
| 1875 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 1876 vis_pmerge(ZERO, REF_S4_1, REF_2); | |
| 1877 | |
| 1878 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 1879 vis_padd16(REF_4, TMP0, TMP8); | |
| 1880 | |
| 1881 vis_mul8x16au(REF_S6, CONST_256, REF_4); | |
| 1882 vis_padd16(REF_6, TMP2, TMP10); | |
| 1883 | |
| 1884 vis_mul8x16au(REF_S6_1, CONST_256, REF_6); | |
| 1885 vis_padd16(TMP8, TMP12, TMP8); | |
| 1886 | |
| 1887 vis_padd16(TMP10, TMP14, TMP10); | |
| 1888 | |
| 1889 vis_padd16(TMP8, TMP30, TMP8); | |
| 1890 | |
| 1891 vis_padd16(TMP10, TMP32, TMP10); | |
| 1892 vis_pack16(TMP8, DST_0); | |
| 1893 | |
| 1894 vis_pack16(TMP10, DST_1); | |
| 1895 vis_st64(DST_0, dest[0]); | |
| 1896 | |
| 1897 vis_padd16(REF_0, TMP4, REF_0); | |
| 1898 | |
| 1899 vis_mul8x16al(DST_2, CONST_1024, TMP30); | |
| 1900 vis_padd16(REF_2, TMP6, REF_2); | |
| 1901 | |
| 1902 vis_mul8x16al(DST_3, CONST_1024, TMP32); | |
| 1903 vis_padd16(REF_0, REF_4, REF_0); | |
| 1904 | |
| 1905 vis_padd16(REF_2, REF_6, REF_2); | |
| 1906 | |
| 1907 vis_padd16(REF_0, TMP30, REF_0); | |
| 1908 | |
| 1909 /* stall */ | |
| 1910 | |
| 1911 vis_padd16(REF_2, TMP32, REF_2); | |
| 1912 vis_pack16(REF_0, DST_2); | |
| 1913 | |
| 1914 vis_pack16(REF_2, DST_3); | |
| 1915 vis_st64_2(DST_2, dest, 8); | |
| 1916 dest += stride; | |
| 1917 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1918 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1919 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1920 static void MC_avg_xy_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 1921 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
1922 { |
| 2979 | 1923 uint8_t *ref = (uint8_t *) _ref; |
| 1924 unsigned long off = (unsigned long) ref & 0x7; | |
| 1925 unsigned long off_plus_1 = off + 1; | |
| 1926 int stride_8 = stride + 8; | |
| 1927 | |
| 1928 vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); | |
| 1929 | |
| 1930 ref = vis_alignaddr(ref); | |
| 1931 | |
| 1932 vis_ld64(ref[0], TMP0); | |
| 1933 vis_fzero(ZERO); | |
| 1934 | |
| 1935 vis_ld64_2(ref, 8, TMP2); | |
| 1936 | |
| 1937 vis_ld64(constants6[0], CONST_6); | |
| 1938 | |
| 1939 vis_ld64(constants256_1024[0], CONST_256); | |
| 1940 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 1941 | |
| 1942 if (off != 0x7) { | |
| 1943 vis_alignaddr_g0((void *)off_plus_1); | |
| 1944 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 1945 } else { | |
| 1946 vis_src1(TMP2, REF_S2); | |
| 1947 } | |
| 1948 | |
| 1949 height >>= 1; | |
| 1950 do { /* 31 cycles */ | |
| 1951 vis_ld64_2(ref, stride, TMP0); | |
| 1952 vis_mul8x16au(REF_S0, CONST_256, TMP8); | |
| 1953 vis_pmerge(ZERO, REF_S0_1, TMP10); | |
| 1954 | |
| 1955 vis_ld64_2(ref, stride_8, TMP2); | |
| 1956 ref += stride; | |
| 1957 vis_mul8x16au(REF_S2, CONST_256, TMP12); | |
| 1958 vis_pmerge(ZERO, REF_S2_1, TMP14); | |
| 1959 | |
| 1960 vis_alignaddr_g0((void *)off); | |
| 1961 | |
| 1962 vis_ld64_2(ref, stride, TMP4); | |
| 1963 vis_faligndata(TMP0, TMP2, REF_S4); | |
| 1964 | |
| 1965 vis_ld64_2(ref, stride_8, TMP6); | |
| 1966 ref += stride; | |
| 1967 | |
| 1968 vis_ld64(dest[0], DST_0); | |
| 1969 vis_faligndata(TMP4, TMP6, REF_S0); | |
| 1970 | |
| 1971 vis_ld64_2(dest, stride, DST_2); | |
| 1972 | |
| 1973 if (off != 0x7) { | |
| 1974 vis_alignaddr_g0((void *)off_plus_1); | |
| 1975 vis_faligndata(TMP0, TMP2, REF_S6); | |
| 1976 vis_faligndata(TMP4, TMP6, REF_S2); | |
| 1977 } else { | |
| 1978 vis_src1(TMP2, REF_S6); | |
| 1979 vis_src1(TMP6, REF_S2); | |
| 1980 } | |
| 1981 | |
| 1982 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 1983 vis_pmerge(ZERO, REF_S4, TMP22); | |
| 1984 | |
| 1985 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 1986 vis_pmerge(ZERO, REF_S4_1, TMP24); | |
| 1987 | |
| 1988 vis_mul8x16au(REF_S6, CONST_256, TMP26); | |
| 1989 vis_pmerge(ZERO, REF_S6_1, TMP28); | |
| 1990 | |
| 1991 vis_mul8x16au(REF_S0, CONST_256, REF_S4); | |
| 1992 vis_padd16(TMP22, CONST_6, TMP22); | |
| 1993 | |
| 1994 vis_mul8x16au(REF_S0_1, CONST_256, REF_S6); | |
| 1995 vis_padd16(TMP24, CONST_6, TMP24); | |
| 1996 | |
| 1997 vis_mul8x16al(DST_2, CONST_1024, REF_0); | |
| 1998 vis_padd16(TMP22, TMP26, TMP22); | |
| 1999 | |
| 2000 vis_mul8x16al(DST_3, CONST_1024, REF_2); | |
| 2001 vis_padd16(TMP24, TMP28, TMP24); | |
| 2002 | |
| 2003 vis_mul8x16au(REF_S2, CONST_256, TMP26); | |
| 2004 vis_padd16(TMP8, TMP22, TMP8); | |
| 2005 | |
| 2006 vis_mul8x16au(REF_S2_1, CONST_256, TMP28); | |
| 2007 vis_padd16(TMP10, TMP24, TMP10); | |
| 2008 | |
| 2009 vis_padd16(TMP8, TMP12, TMP8); | |
| 2010 | |
| 2011 vis_padd16(TMP10, TMP14, TMP10); | |
| 2012 | |
| 2013 vis_padd16(TMP8, TMP30, TMP8); | |
| 2014 | |
| 2015 vis_padd16(TMP10, TMP32, TMP10); | |
| 2016 vis_pack16(TMP8, DST_0); | |
| 2017 | |
| 2018 vis_pack16(TMP10, DST_1); | |
| 2019 vis_st64(DST_0, dest[0]); | |
| 2020 dest += stride; | |
| 2021 | |
| 2022 vis_padd16(REF_S4, TMP22, TMP12); | |
| 2023 | |
| 2024 vis_padd16(REF_S6, TMP24, TMP14); | |
| 2025 | |
| 2026 vis_padd16(TMP12, TMP26, TMP12); | |
| 2027 | |
| 2028 vis_padd16(TMP14, TMP28, TMP14); | |
| 2029 | |
| 2030 vis_padd16(TMP12, REF_0, TMP12); | |
| 2031 | |
| 2032 vis_padd16(TMP14, REF_2, TMP14); | |
| 2033 vis_pack16(TMP12, DST_2); | |
| 2034 | |
| 2035 vis_pack16(TMP14, DST_3); | |
| 2036 vis_st64(DST_2, dest[0]); | |
| 2037 dest += stride; | |
| 2038 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2039 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2040 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2041 /* End of rounding code */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2042 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2043 /* Start of no rounding code */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2044 /* The trick used in some of this file is the formula from the MMX |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2045 * motion comp code, which is: |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2046 * |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2047 * (x+y)>>1 == (x&y)+((x^y)>>1) |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2048 * |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2049 * This allows us to average 8 bytes at a time in a 64-bit FPU reg. |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2050 * We avoid overflows by masking before we do the shift, and we |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2051 * implement the shift by multiplying by 1/2 using mul8x16. So in |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2052 * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2053 * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2054 * the value 0x80808080 is in f8): |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2055 * |
| 2979 | 2056 * fxor f0, f2, f10 |
| 2057 * fand f10, f4, f10 | |
| 2058 * fmul8x16 f8, f10, f10 | |
| 2059 * fand f10, f6, f10 | |
| 2060 * fand f0, f2, f12 | |
| 2061 * fpadd16 f12, f10, f10 | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2062 */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2063 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2064 static void MC_put_no_round_o_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2065 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2066 { |
| 2979 | 2067 uint8_t *ref = (uint8_t *) _ref; |
| 2068 | |
| 2069 ref = vis_alignaddr(ref); | |
| 2070 do { /* 5 cycles */ | |
| 2071 vis_ld64(ref[0], TMP0); | |
| 2072 | |
| 2073 vis_ld64_2(ref, 8, TMP2); | |
| 2074 | |
| 2075 vis_ld64_2(ref, 16, TMP4); | |
| 2076 ref += stride; | |
| 2077 | |
| 2078 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2079 vis_st64(REF_0, dest[0]); | |
| 2080 | |
| 2081 vis_faligndata(TMP2, TMP4, REF_2); | |
| 2082 vis_st64_2(REF_2, dest, 8); | |
| 2083 dest += stride; | |
| 2084 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2085 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2086 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2087 static void MC_put_no_round_o_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2088 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2089 { |
| 2979 | 2090 uint8_t *ref = (uint8_t *) _ref; |
| 2091 | |
| 2092 ref = vis_alignaddr(ref); | |
| 2093 do { /* 4 cycles */ | |
| 2094 vis_ld64(ref[0], TMP0); | |
| 2095 | |
| 2096 vis_ld64(ref[8], TMP2); | |
| 2097 ref += stride; | |
| 2098 | |
| 2099 /* stall */ | |
| 2100 | |
| 2101 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2102 vis_st64(REF_0, dest[0]); | |
| 2103 dest += stride; | |
| 2104 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2105 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2106 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2107 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2108 static void MC_avg_no_round_o_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2109 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2110 { |
| 2979 | 2111 uint8_t *ref = (uint8_t *) _ref; |
| 2112 int stride_8 = stride + 8; | |
| 2113 | |
| 2114 ref = vis_alignaddr(ref); | |
| 2115 | |
| 2116 vis_ld64(ref[0], TMP0); | |
| 2117 | |
| 2118 vis_ld64(ref[8], TMP2); | |
| 2119 | |
| 2120 vis_ld64(ref[16], TMP4); | |
| 2121 | |
| 2122 vis_ld64(dest[0], DST_0); | |
| 2123 | |
| 2124 vis_ld64(dest[8], DST_2); | |
| 2125 | |
| 2126 vis_ld64(constants_fe[0], MASK_fe); | |
| 2127 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2128 | |
| 2129 vis_ld64(constants_7f[0], MASK_7f); | |
| 2130 vis_faligndata(TMP2, TMP4, REF_2); | |
| 2131 | |
| 2132 vis_ld64(constants128[0], CONST_128); | |
| 2133 | |
| 2134 ref += stride; | |
| 2135 height = (height >> 1) - 1; | |
| 2136 | |
| 2137 do { /* 24 cycles */ | |
| 2138 vis_ld64(ref[0], TMP0); | |
| 2139 vis_xor(DST_0, REF_0, TMP6); | |
| 2140 | |
| 2141 vis_ld64_2(ref, 8, TMP2); | |
| 2142 vis_and(TMP6, MASK_fe, TMP6); | |
| 2143 | |
| 2144 vis_ld64_2(ref, 16, TMP4); | |
| 2145 ref += stride; | |
| 2146 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2147 vis_xor(DST_2, REF_2, TMP8); | |
| 2148 | |
| 2149 vis_and(TMP8, MASK_fe, TMP8); | |
| 2150 | |
| 2151 vis_and(DST_0, REF_0, TMP10); | |
| 2152 vis_ld64_2(dest, stride, DST_0); | |
| 2153 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2154 | |
| 2155 vis_and(DST_2, REF_2, TMP12); | |
| 2156 vis_ld64_2(dest, stride_8, DST_2); | |
| 2157 | |
| 2158 vis_ld64(ref[0], TMP14); | |
| 2159 vis_and(TMP6, MASK_7f, TMP6); | |
| 2160 | |
| 2161 vis_and(TMP8, MASK_7f, TMP8); | |
| 2162 | |
| 2163 vis_padd16(TMP10, TMP6, TMP6); | |
| 2164 vis_st64(TMP6, dest[0]); | |
| 2165 | |
| 2166 vis_padd16(TMP12, TMP8, TMP8); | |
| 2167 vis_st64_2(TMP8, dest, 8); | |
| 2168 | |
| 2169 dest += stride; | |
| 2170 vis_ld64_2(ref, 8, TMP16); | |
| 2171 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2172 | |
| 2173 vis_ld64_2(ref, 16, TMP18); | |
| 2174 vis_faligndata(TMP2, TMP4, REF_2); | |
| 2175 ref += stride; | |
| 2176 | |
| 2177 vis_xor(DST_0, REF_0, TMP20); | |
| 2178 | |
| 2179 vis_and(TMP20, MASK_fe, TMP20); | |
| 2180 | |
| 2181 vis_xor(DST_2, REF_2, TMP22); | |
| 2182 vis_mul8x16(CONST_128, TMP20, TMP20); | |
| 2183 | |
| 2184 vis_and(TMP22, MASK_fe, TMP22); | |
| 2185 | |
| 2186 vis_and(DST_0, REF_0, TMP24); | |
| 2187 vis_mul8x16(CONST_128, TMP22, TMP22); | |
| 2188 | |
| 2189 vis_and(DST_2, REF_2, TMP26); | |
| 2190 | |
| 2191 vis_ld64_2(dest, stride, DST_0); | |
| 2192 vis_faligndata(TMP14, TMP16, REF_0); | |
| 2193 | |
| 2194 vis_ld64_2(dest, stride_8, DST_2); | |
| 2195 vis_faligndata(TMP16, TMP18, REF_2); | |
| 2196 | |
| 2197 vis_and(TMP20, MASK_7f, TMP20); | |
| 2198 | |
| 2199 vis_and(TMP22, MASK_7f, TMP22); | |
| 2200 | |
| 2201 vis_padd16(TMP24, TMP20, TMP20); | |
| 2202 vis_st64(TMP20, dest[0]); | |
| 2203 | |
| 2204 vis_padd16(TMP26, TMP22, TMP22); | |
| 2205 vis_st64_2(TMP22, dest, 8); | |
| 2206 dest += stride; | |
| 2207 } while (--height); | |
| 2208 | |
| 2209 vis_ld64(ref[0], TMP0); | |
| 2210 vis_xor(DST_0, REF_0, TMP6); | |
| 2211 | |
| 2212 vis_ld64_2(ref, 8, TMP2); | |
| 2213 vis_and(TMP6, MASK_fe, TMP6); | |
| 2214 | |
| 2215 vis_ld64_2(ref, 16, TMP4); | |
| 2216 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2217 vis_xor(DST_2, REF_2, TMP8); | |
| 2218 | |
| 2219 vis_and(TMP8, MASK_fe, TMP8); | |
| 2220 | |
| 2221 vis_and(DST_0, REF_0, TMP10); | |
| 2222 vis_ld64_2(dest, stride, DST_0); | |
| 2223 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2224 | |
| 2225 vis_and(DST_2, REF_2, TMP12); | |
| 2226 vis_ld64_2(dest, stride_8, DST_2); | |
| 2227 | |
| 2228 vis_ld64(ref[0], TMP14); | |
| 2229 vis_and(TMP6, MASK_7f, TMP6); | |
| 2230 | |
| 2231 vis_and(TMP8, MASK_7f, TMP8); | |
| 2232 | |
| 2233 vis_padd16(TMP10, TMP6, TMP6); | |
| 2234 vis_st64(TMP6, dest[0]); | |
| 2235 | |
| 2236 vis_padd16(TMP12, TMP8, TMP8); | |
| 2237 vis_st64_2(TMP8, dest, 8); | |
| 2238 | |
| 2239 dest += stride; | |
| 2240 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2241 | |
| 2242 vis_faligndata(TMP2, TMP4, REF_2); | |
| 2243 | |
| 2244 vis_xor(DST_0, REF_0, TMP20); | |
| 2245 | |
| 2246 vis_and(TMP20, MASK_fe, TMP20); | |
| 2247 | |
| 2248 vis_xor(DST_2, REF_2, TMP22); | |
| 2249 vis_mul8x16(CONST_128, TMP20, TMP20); | |
| 2250 | |
| 2251 vis_and(TMP22, MASK_fe, TMP22); | |
| 2252 | |
| 2253 vis_and(DST_0, REF_0, TMP24); | |
| 2254 vis_mul8x16(CONST_128, TMP22, TMP22); | |
| 2255 | |
| 2256 vis_and(DST_2, REF_2, TMP26); | |
| 2257 | |
| 2258 vis_and(TMP20, MASK_7f, TMP20); | |
| 2259 | |
| 2260 vis_and(TMP22, MASK_7f, TMP22); | |
| 2261 | |
| 2262 vis_padd16(TMP24, TMP20, TMP20); | |
| 2263 vis_st64(TMP20, dest[0]); | |
| 2264 | |
| 2265 vis_padd16(TMP26, TMP22, TMP22); | |
| 2266 vis_st64_2(TMP22, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2267 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2268 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2269 static void MC_avg_no_round_o_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2270 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2271 { |
| 2979 | 2272 uint8_t *ref = (uint8_t *) _ref; |
| 2273 | |
| 2274 ref = vis_alignaddr(ref); | |
| 2275 | |
| 2276 vis_ld64(ref[0], TMP0); | |
| 2277 | |
| 2278 vis_ld64(ref[8], TMP2); | |
| 2279 | |
| 2280 vis_ld64(dest[0], DST_0); | |
| 2281 | |
| 2282 vis_ld64(constants_fe[0], MASK_fe); | |
| 2283 | |
| 2284 vis_ld64(constants_7f[0], MASK_7f); | |
| 2285 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2286 | |
| 2287 vis_ld64(constants128[0], CONST_128); | |
| 2288 | |
| 2289 ref += stride; | |
| 2290 height = (height >> 1) - 1; | |
| 2291 | |
| 2292 do { /* 12 cycles */ | |
| 2293 vis_ld64(ref[0], TMP0); | |
| 2294 vis_xor(DST_0, REF_0, TMP4); | |
| 2295 | |
| 2296 vis_ld64(ref[8], TMP2); | |
| 2297 vis_and(TMP4, MASK_fe, TMP4); | |
| 2298 | |
| 2299 vis_and(DST_0, REF_0, TMP6); | |
| 2300 vis_ld64_2(dest, stride, DST_0); | |
| 2301 ref += stride; | |
| 2302 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 2303 | |
| 2304 vis_ld64(ref[0], TMP12); | |
| 2305 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2306 | |
| 2307 vis_ld64(ref[8], TMP2); | |
| 2308 vis_xor(DST_0, REF_0, TMP0); | |
| 2309 ref += stride; | |
| 2310 | |
| 2311 vis_and(TMP0, MASK_fe, TMP0); | |
| 2312 | |
| 2313 vis_and(TMP4, MASK_7f, TMP4); | |
| 2314 | |
| 2315 vis_padd16(TMP6, TMP4, TMP4); | |
| 2316 vis_st64(TMP4, dest[0]); | |
| 2317 dest += stride; | |
| 2318 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 2319 | |
| 2320 vis_and(DST_0, REF_0, TMP6); | |
| 2321 vis_ld64_2(dest, stride, DST_0); | |
| 2322 | |
| 2323 vis_faligndata(TMP12, TMP2, REF_0); | |
| 2324 | |
| 2325 vis_and(TMP0, MASK_7f, TMP0); | |
| 2326 | |
| 2327 vis_padd16(TMP6, TMP0, TMP4); | |
| 2328 vis_st64(TMP4, dest[0]); | |
| 2329 dest += stride; | |
| 2330 } while (--height); | |
| 2331 | |
| 2332 vis_ld64(ref[0], TMP0); | |
| 2333 vis_xor(DST_0, REF_0, TMP4); | |
| 2334 | |
| 2335 vis_ld64(ref[8], TMP2); | |
| 2336 vis_and(TMP4, MASK_fe, TMP4); | |
| 2337 | |
| 2338 vis_and(DST_0, REF_0, TMP6); | |
| 2339 vis_ld64_2(dest, stride, DST_0); | |
| 2340 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 2341 | |
| 2342 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2343 | |
| 2344 vis_xor(DST_0, REF_0, TMP0); | |
| 2345 | |
| 2346 vis_and(TMP0, MASK_fe, TMP0); | |
| 2347 | |
| 2348 vis_and(TMP4, MASK_7f, TMP4); | |
| 2349 | |
| 2350 vis_padd16(TMP6, TMP4, TMP4); | |
| 2351 vis_st64(TMP4, dest[0]); | |
| 2352 dest += stride; | |
| 2353 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 2354 | |
| 2355 vis_and(DST_0, REF_0, TMP6); | |
| 2356 | |
| 2357 vis_and(TMP0, MASK_7f, TMP0); | |
| 2358 | |
| 2359 vis_padd16(TMP6, TMP0, TMP4); | |
| 2360 vis_st64(TMP4, dest[0]); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2361 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2362 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2363 static void MC_put_no_round_x_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2364 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2365 { |
| 2979 | 2366 uint8_t *ref = (uint8_t *) _ref; |
| 2367 unsigned long off = (unsigned long) ref & 0x7; | |
| 2368 unsigned long off_plus_1 = off + 1; | |
| 2369 | |
| 2370 ref = vis_alignaddr(ref); | |
| 2371 | |
| 2372 vis_ld64(ref[0], TMP0); | |
| 2373 | |
| 2374 vis_ld64_2(ref, 8, TMP2); | |
| 2375 | |
| 2376 vis_ld64_2(ref, 16, TMP4); | |
| 2377 | |
| 2378 vis_ld64(constants_fe[0], MASK_fe); | |
| 2379 | |
| 2380 vis_ld64(constants_7f[0], MASK_7f); | |
| 2381 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2382 | |
| 2383 vis_ld64(constants128[0], CONST_128); | |
| 2384 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2385 | |
| 2386 if (off != 0x7) { | |
| 2387 vis_alignaddr_g0((void *)off_plus_1); | |
| 2388 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2389 vis_faligndata(TMP2, TMP4, REF_6); | |
| 2390 } else { | |
| 2391 vis_src1(TMP2, REF_2); | |
| 2392 vis_src1(TMP4, REF_6); | |
| 2393 } | |
| 2394 | |
| 2395 ref += stride; | |
| 2396 height = (height >> 1) - 1; | |
| 2397 | |
| 2398 do { /* 34 cycles */ | |
| 2399 vis_ld64(ref[0], TMP0); | |
| 2400 vis_xor(REF_0, REF_2, TMP6); | |
| 2401 | |
| 2402 vis_ld64_2(ref, 8, TMP2); | |
| 2403 vis_xor(REF_4, REF_6, TMP8); | |
| 2404 | |
| 2405 vis_ld64_2(ref, 16, TMP4); | |
| 2406 vis_and(TMP6, MASK_fe, TMP6); | |
| 2407 ref += stride; | |
| 2408 | |
| 2409 vis_ld64(ref[0], TMP14); | |
| 2410 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2411 vis_and(TMP8, MASK_fe, TMP8); | |
| 2412 | |
| 2413 vis_ld64_2(ref, 8, TMP16); | |
| 2414 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2415 vis_and(REF_0, REF_2, TMP10); | |
| 2416 | |
| 2417 vis_ld64_2(ref, 16, TMP18); | |
| 2418 ref += stride; | |
| 2419 vis_and(REF_4, REF_6, TMP12); | |
| 2420 | |
| 2421 vis_alignaddr_g0((void *)off); | |
| 2422 | |
| 2423 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2424 | |
| 2425 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2426 | |
| 2427 if (off != 0x7) { | |
| 2428 vis_alignaddr_g0((void *)off_plus_1); | |
| 2429 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2430 vis_faligndata(TMP2, TMP4, REF_6); | |
| 2431 } else { | |
| 2432 vis_src1(TMP2, REF_2); | |
| 2433 vis_src1(TMP4, REF_6); | |
| 2434 } | |
| 2435 | |
| 2436 vis_and(TMP6, MASK_7f, TMP6); | |
| 2437 | |
| 2438 vis_and(TMP8, MASK_7f, TMP8); | |
| 2439 | |
| 2440 vis_padd16(TMP10, TMP6, TMP6); | |
| 2441 vis_st64(TMP6, dest[0]); | |
| 2442 | |
| 2443 vis_padd16(TMP12, TMP8, TMP8); | |
| 2444 vis_st64_2(TMP8, dest, 8); | |
| 2445 dest += stride; | |
| 2446 | |
| 2447 vis_xor(REF_0, REF_2, TMP6); | |
| 2448 | |
| 2449 vis_xor(REF_4, REF_6, TMP8); | |
| 2450 | |
| 2451 vis_and(TMP6, MASK_fe, TMP6); | |
| 2452 | |
| 2453 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2454 vis_and(TMP8, MASK_fe, TMP8); | |
| 2455 | |
| 2456 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2457 vis_and(REF_0, REF_2, TMP10); | |
| 2458 | |
| 2459 vis_and(REF_4, REF_6, TMP12); | |
| 2460 | |
| 2461 vis_alignaddr_g0((void *)off); | |
| 2462 | |
| 2463 vis_faligndata(TMP14, TMP16, REF_0); | |
| 2464 | |
| 2465 vis_faligndata(TMP16, TMP18, REF_4); | |
| 2466 | |
| 2467 if (off != 0x7) { | |
| 2468 vis_alignaddr_g0((void *)off_plus_1); | |
| 2469 vis_faligndata(TMP14, TMP16, REF_2); | |
| 2470 vis_faligndata(TMP16, TMP18, REF_6); | |
| 2471 } else { | |
| 2472 vis_src1(TMP16, REF_2); | |
| 2473 vis_src1(TMP18, REF_6); | |
| 2474 } | |
| 2475 | |
| 2476 vis_and(TMP6, MASK_7f, TMP6); | |
| 2477 | |
| 2478 vis_and(TMP8, MASK_7f, TMP8); | |
| 2479 | |
| 2480 vis_padd16(TMP10, TMP6, TMP6); | |
| 2481 vis_st64(TMP6, dest[0]); | |
| 2482 | |
| 2483 vis_padd16(TMP12, TMP8, TMP8); | |
| 2484 vis_st64_2(TMP8, dest, 8); | |
| 2485 dest += stride; | |
| 2486 } while (--height); | |
| 2487 | |
| 2488 vis_ld64(ref[0], TMP0); | |
| 2489 vis_xor(REF_0, REF_2, TMP6); | |
| 2490 | |
| 2491 vis_ld64_2(ref, 8, TMP2); | |
| 2492 vis_xor(REF_4, REF_6, TMP8); | |
| 2493 | |
| 2494 vis_ld64_2(ref, 16, TMP4); | |
| 2495 vis_and(TMP6, MASK_fe, TMP6); | |
| 2496 | |
| 2497 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2498 vis_and(TMP8, MASK_fe, TMP8); | |
| 2499 | |
| 2500 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2501 vis_and(REF_0, REF_2, TMP10); | |
| 2502 | |
| 2503 vis_and(REF_4, REF_6, TMP12); | |
| 2504 | |
| 2505 vis_alignaddr_g0((void *)off); | |
| 2506 | |
| 2507 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2508 | |
| 2509 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2510 | |
| 2511 if (off != 0x7) { | |
| 2512 vis_alignaddr_g0((void *)off_plus_1); | |
| 2513 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2514 vis_faligndata(TMP2, TMP4, REF_6); | |
| 2515 } else { | |
| 2516 vis_src1(TMP2, REF_2); | |
| 2517 vis_src1(TMP4, REF_6); | |
| 2518 } | |
| 2519 | |
| 2520 vis_and(TMP6, MASK_7f, TMP6); | |
| 2521 | |
| 2522 vis_and(TMP8, MASK_7f, TMP8); | |
| 2523 | |
| 2524 vis_padd16(TMP10, TMP6, TMP6); | |
| 2525 vis_st64(TMP6, dest[0]); | |
| 2526 | |
| 2527 vis_padd16(TMP12, TMP8, TMP8); | |
| 2528 vis_st64_2(TMP8, dest, 8); | |
| 2529 dest += stride; | |
| 2530 | |
| 2531 vis_xor(REF_0, REF_2, TMP6); | |
| 2532 | |
| 2533 vis_xor(REF_4, REF_6, TMP8); | |
| 2534 | |
| 2535 vis_and(TMP6, MASK_fe, TMP6); | |
| 2536 | |
| 2537 vis_mul8x16(CONST_128, TMP6, TMP6); | |
| 2538 vis_and(TMP8, MASK_fe, TMP8); | |
| 2539 | |
| 2540 vis_mul8x16(CONST_128, TMP8, TMP8); | |
| 2541 vis_and(REF_0, REF_2, TMP10); | |
| 2542 | |
| 2543 vis_and(REF_4, REF_6, TMP12); | |
| 2544 | |
| 2545 vis_and(TMP6, MASK_7f, TMP6); | |
| 2546 | |
| 2547 vis_and(TMP8, MASK_7f, TMP8); | |
| 2548 | |
| 2549 vis_padd16(TMP10, TMP6, TMP6); | |
| 2550 vis_st64(TMP6, dest[0]); | |
| 2551 | |
| 2552 vis_padd16(TMP12, TMP8, TMP8); | |
| 2553 vis_st64_2(TMP8, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2554 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2555 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2556 static void MC_put_no_round_x_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2557 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2558 { |
| 2979 | 2559 uint8_t *ref = (uint8_t *) _ref; |
| 2560 unsigned long off = (unsigned long) ref & 0x7; | |
| 2561 unsigned long off_plus_1 = off + 1; | |
| 2562 | |
| 2563 ref = vis_alignaddr(ref); | |
| 2564 | |
| 2565 vis_ld64(ref[0], TMP0); | |
| 2566 | |
| 2567 vis_ld64(ref[8], TMP2); | |
| 2568 | |
| 2569 vis_ld64(constants_fe[0], MASK_fe); | |
| 2570 | |
| 2571 vis_ld64(constants_7f[0], MASK_7f); | |
| 2572 | |
| 2573 vis_ld64(constants128[0], CONST_128); | |
| 2574 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2575 | |
| 2576 if (off != 0x7) { | |
| 2577 vis_alignaddr_g0((void *)off_plus_1); | |
| 2578 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2579 } else { | |
| 2580 vis_src1(TMP2, REF_2); | |
| 2581 } | |
| 2582 | |
| 2583 ref += stride; | |
| 2584 height = (height >> 1) - 1; | |
| 2585 | |
| 2586 do { /* 20 cycles */ | |
| 2587 vis_ld64(ref[0], TMP0); | |
| 2588 vis_xor(REF_0, REF_2, TMP4); | |
| 2589 | |
| 2590 vis_ld64_2(ref, 8, TMP2); | |
| 2591 vis_and(TMP4, MASK_fe, TMP4); | |
| 2592 ref += stride; | |
| 2593 | |
| 2594 vis_ld64(ref[0], TMP8); | |
| 2595 vis_and(REF_0, REF_2, TMP6); | |
| 2596 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 2597 | |
| 2598 vis_alignaddr_g0((void *)off); | |
| 2599 | |
| 2600 vis_ld64_2(ref, 8, TMP10); | |
| 2601 ref += stride; | |
| 2602 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2603 | |
| 2604 if (off != 0x7) { | |
| 2605 vis_alignaddr_g0((void *)off_plus_1); | |
| 2606 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2607 } else { | |
| 2608 vis_src1(TMP2, REF_2); | |
| 2609 } | |
| 2610 | |
| 2611 vis_and(TMP4, MASK_7f, TMP4); | |
| 2612 | |
| 2613 vis_padd16(TMP6, TMP4, DST_0); | |
| 2614 vis_st64(DST_0, dest[0]); | |
| 2615 dest += stride; | |
| 2616 | |
| 2617 vis_xor(REF_0, REF_2, TMP12); | |
| 2618 | |
| 2619 vis_and(TMP12, MASK_fe, TMP12); | |
| 2620 | |
| 2621 vis_and(REF_0, REF_2, TMP14); | |
| 2622 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 2623 | |
| 2624 vis_alignaddr_g0((void *)off); | |
| 2625 vis_faligndata(TMP8, TMP10, REF_0); | |
| 2626 if (off != 0x7) { | |
| 2627 vis_alignaddr_g0((void *)off_plus_1); | |
| 2628 vis_faligndata(TMP8, TMP10, REF_2); | |
| 2629 } else { | |
| 2630 vis_src1(TMP10, REF_2); | |
| 2631 } | |
| 2632 | |
| 2633 vis_and(TMP12, MASK_7f, TMP12); | |
| 2634 | |
| 2635 vis_padd16(TMP14, TMP12, DST_0); | |
| 2636 vis_st64(DST_0, dest[0]); | |
| 2637 dest += stride; | |
| 2638 } while (--height); | |
| 2639 | |
| 2640 vis_ld64(ref[0], TMP0); | |
| 2641 vis_xor(REF_0, REF_2, TMP4); | |
| 2642 | |
| 2643 vis_ld64_2(ref, 8, TMP2); | |
| 2644 vis_and(TMP4, MASK_fe, TMP4); | |
| 2645 | |
| 2646 vis_and(REF_0, REF_2, TMP6); | |
| 2647 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 2648 | |
| 2649 vis_alignaddr_g0((void *)off); | |
| 2650 | |
| 2651 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2652 | |
| 2653 if (off != 0x7) { | |
| 2654 vis_alignaddr_g0((void *)off_plus_1); | |
| 2655 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2656 } else { | |
| 2657 vis_src1(TMP2, REF_2); | |
| 2658 } | |
| 2659 | |
| 2660 vis_and(TMP4, MASK_7f, TMP4); | |
| 2661 | |
| 2662 vis_padd16(TMP6, TMP4, DST_0); | |
| 2663 vis_st64(DST_0, dest[0]); | |
| 2664 dest += stride; | |
| 2665 | |
| 2666 vis_xor(REF_0, REF_2, TMP12); | |
| 2667 | |
| 2668 vis_and(TMP12, MASK_fe, TMP12); | |
| 2669 | |
| 2670 vis_and(REF_0, REF_2, TMP14); | |
| 2671 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 2672 | |
| 2673 vis_and(TMP12, MASK_7f, TMP12); | |
| 2674 | |
| 2675 vis_padd16(TMP14, TMP12, DST_0); | |
| 2676 vis_st64(DST_0, dest[0]); | |
| 2677 dest += stride; | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2678 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2679 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2680 static void MC_avg_no_round_x_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2681 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2682 { |
| 2979 | 2683 uint8_t *ref = (uint8_t *) _ref; |
| 2684 unsigned long off = (unsigned long) ref & 0x7; | |
| 2685 unsigned long off_plus_1 = off + 1; | |
| 2686 | |
| 2687 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 2688 | |
| 2689 vis_ld64(constants3[0], CONST_3); | |
| 2690 vis_fzero(ZERO); | |
| 2691 vis_ld64(constants256_512[0], CONST_256); | |
| 2692 | |
| 2693 ref = vis_alignaddr(ref); | |
| 2694 do { /* 26 cycles */ | |
| 2695 vis_ld64(ref[0], TMP0); | |
| 2696 | |
| 2697 vis_ld64(ref[8], TMP2); | |
| 2698 | |
| 2699 vis_alignaddr_g0((void *)off); | |
| 2700 | |
| 2701 vis_ld64(ref[16], TMP4); | |
| 2702 | |
| 2703 vis_ld64(dest[0], DST_0); | |
| 2704 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2705 | |
| 2706 vis_ld64(dest[8], DST_2); | |
| 2707 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2708 | |
| 2709 if (off != 0x7) { | |
| 2710 vis_alignaddr_g0((void *)off_plus_1); | |
| 2711 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2712 vis_faligndata(TMP2, TMP4, REF_6); | |
| 2713 } else { | |
| 2714 vis_src1(TMP2, REF_2); | |
| 2715 vis_src1(TMP4, REF_6); | |
| 2716 } | |
| 2717 | |
| 2718 vis_mul8x16au(REF_0, CONST_256, TMP0); | |
| 2719 | |
| 2720 vis_pmerge(ZERO, REF_2, TMP4); | |
| 2721 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 2722 | |
| 2723 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 2724 | |
| 2725 vis_padd16(TMP0, TMP4, TMP0); | |
| 2726 | |
| 2727 vis_mul8x16al(DST_0, CONST_512, TMP4); | |
| 2728 vis_padd16(TMP2, TMP6, TMP2); | |
| 2729 | |
| 2730 vis_mul8x16al(DST_1, CONST_512, TMP6); | |
| 2731 | |
| 2732 vis_mul8x16au(REF_6, CONST_256, TMP12); | |
| 2733 | |
| 2734 vis_padd16(TMP0, TMP4, TMP0); | |
| 2735 vis_mul8x16au(REF_6_1, CONST_256, TMP14); | |
| 2736 | |
| 2737 vis_padd16(TMP2, TMP6, TMP2); | |
| 2738 vis_mul8x16au(REF_4, CONST_256, TMP16); | |
| 2739 | |
| 2740 vis_padd16(TMP0, CONST_3, TMP8); | |
| 2741 vis_mul8x16au(REF_4_1, CONST_256, TMP18); | |
| 2742 | |
| 2743 vis_padd16(TMP2, CONST_3, TMP10); | |
| 2744 vis_pack16(TMP8, DST_0); | |
| 2745 | |
| 2746 vis_pack16(TMP10, DST_1); | |
| 2747 vis_padd16(TMP16, TMP12, TMP0); | |
| 2748 | |
| 2749 vis_st64(DST_0, dest[0]); | |
| 2750 vis_mul8x16al(DST_2, CONST_512, TMP4); | |
| 2751 vis_padd16(TMP18, TMP14, TMP2); | |
| 2752 | |
| 2753 vis_mul8x16al(DST_3, CONST_512, TMP6); | |
| 2754 vis_padd16(TMP0, CONST_3, TMP0); | |
| 2755 | |
| 2756 vis_padd16(TMP2, CONST_3, TMP2); | |
| 2757 | |
| 2758 vis_padd16(TMP0, TMP4, TMP0); | |
| 2759 | |
| 2760 vis_padd16(TMP2, TMP6, TMP2); | |
| 2761 vis_pack16(TMP0, DST_2); | |
| 2762 | |
| 2763 vis_pack16(TMP2, DST_3); | |
| 2764 vis_st64(DST_2, dest[8]); | |
| 2765 | |
| 2766 ref += stride; | |
| 2767 dest += stride; | |
| 2768 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2769 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2770 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2771 static void MC_avg_no_round_x_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2772 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2773 { |
| 2979 | 2774 uint8_t *ref = (uint8_t *) _ref; |
| 2775 unsigned long off = (unsigned long) ref & 0x7; | |
| 2776 unsigned long off_plus_1 = off + 1; | |
| 2777 int stride_times_2 = stride << 1; | |
| 2778 | |
| 2779 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 2780 | |
| 2781 vis_ld64(constants3[0], CONST_3); | |
| 2782 vis_fzero(ZERO); | |
| 2783 vis_ld64(constants256_512[0], CONST_256); | |
| 2784 | |
| 2785 ref = vis_alignaddr(ref); | |
| 2786 height >>= 2; | |
| 2787 do { /* 47 cycles */ | |
| 2788 vis_ld64(ref[0], TMP0); | |
| 2789 | |
| 2790 vis_ld64_2(ref, 8, TMP2); | |
| 2791 ref += stride; | |
| 2792 | |
| 2793 vis_alignaddr_g0((void *)off); | |
| 2794 | |
| 2795 vis_ld64(ref[0], TMP4); | |
| 2796 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2797 | |
| 2798 vis_ld64_2(ref, 8, TMP6); | |
| 2799 ref += stride; | |
| 2800 | |
| 2801 vis_ld64(ref[0], TMP8); | |
| 2802 | |
| 2803 vis_ld64_2(ref, 8, TMP10); | |
| 2804 ref += stride; | |
| 2805 vis_faligndata(TMP4, TMP6, REF_4); | |
| 2806 | |
| 2807 vis_ld64(ref[0], TMP12); | |
| 2808 | |
| 2809 vis_ld64_2(ref, 8, TMP14); | |
| 2810 ref += stride; | |
| 2811 vis_faligndata(TMP8, TMP10, REF_S0); | |
| 2812 | |
| 2813 vis_faligndata(TMP12, TMP14, REF_S4); | |
| 2814 | |
| 2815 if (off != 0x7) { | |
| 2816 vis_alignaddr_g0((void *)off_plus_1); | |
| 2817 | |
| 2818 vis_ld64(dest[0], DST_0); | |
| 2819 vis_faligndata(TMP0, TMP2, REF_2); | |
| 2820 | |
| 2821 vis_ld64_2(dest, stride, DST_2); | |
| 2822 vis_faligndata(TMP4, TMP6, REF_6); | |
| 2823 | |
| 2824 vis_faligndata(TMP8, TMP10, REF_S2); | |
| 2825 | |
| 2826 vis_faligndata(TMP12, TMP14, REF_S6); | |
| 2827 } else { | |
| 2828 vis_ld64(dest[0], DST_0); | |
| 2829 vis_src1(TMP2, REF_2); | |
| 2830 | |
| 2831 vis_ld64_2(dest, stride, DST_2); | |
| 2832 vis_src1(TMP6, REF_6); | |
| 2833 | |
| 2834 vis_src1(TMP10, REF_S2); | |
| 2835 | |
| 2836 vis_src1(TMP14, REF_S6); | |
| 2837 } | |
| 2838 | |
| 2839 vis_pmerge(ZERO, REF_0, TMP0); | |
| 2840 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 2841 | |
| 2842 vis_pmerge(ZERO, REF_2, TMP4); | |
| 2843 vis_mul8x16au(REF_2_1, CONST_256, TMP6); | |
| 2844 | |
| 2845 vis_padd16(TMP0, CONST_3, TMP0); | |
| 2846 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 2847 | |
| 2848 vis_padd16(TMP2, CONST_3, TMP2); | |
| 2849 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 2850 | |
| 2851 vis_padd16(TMP0, TMP4, TMP0); | |
| 2852 vis_mul8x16au(REF_4, CONST_256, TMP8); | |
| 2853 | |
| 2854 vis_padd16(TMP2, TMP6, TMP2); | |
| 2855 vis_mul8x16au(REF_4_1, CONST_256, TMP10); | |
| 2856 | |
| 2857 vis_padd16(TMP0, TMP16, TMP0); | |
| 2858 vis_mul8x16au(REF_6, CONST_256, TMP12); | |
| 2859 | |
| 2860 vis_padd16(TMP2, TMP18, TMP2); | |
| 2861 vis_mul8x16au(REF_6_1, CONST_256, TMP14); | |
| 2862 | |
| 2863 vis_padd16(TMP8, CONST_3, TMP8); | |
| 2864 vis_mul8x16al(DST_2, CONST_512, TMP16); | |
| 2865 | |
| 2866 vis_padd16(TMP8, TMP12, TMP8); | |
| 2867 vis_mul8x16al(DST_3, CONST_512, TMP18); | |
| 2868 | |
| 2869 vis_padd16(TMP10, TMP14, TMP10); | |
| 2870 vis_pack16(TMP0, DST_0); | |
| 2871 | |
| 2872 vis_pack16(TMP2, DST_1); | |
| 2873 vis_st64(DST_0, dest[0]); | |
| 2874 dest += stride; | |
| 2875 vis_padd16(TMP10, CONST_3, TMP10); | |
| 2876 | |
| 2877 vis_ld64_2(dest, stride, DST_0); | |
| 2878 vis_padd16(TMP8, TMP16, TMP8); | |
| 2879 | |
| 2880 vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/); | |
| 2881 vis_padd16(TMP10, TMP18, TMP10); | |
| 2882 vis_pack16(TMP8, DST_2); | |
| 2883 | |
| 2884 vis_pack16(TMP10, DST_3); | |
| 2885 vis_st64(DST_2, dest[0]); | |
| 2886 dest += stride; | |
| 2887 | |
| 2888 vis_mul8x16au(REF_S0_1, CONST_256, TMP2); | |
| 2889 vis_pmerge(ZERO, REF_S0, TMP0); | |
| 2890 | |
| 2891 vis_pmerge(ZERO, REF_S2, TMP24); | |
| 2892 vis_mul8x16au(REF_S2_1, CONST_256, TMP6); | |
| 2893 | |
| 2894 vis_padd16(TMP0, CONST_3, TMP0); | |
| 2895 vis_mul8x16au(REF_S4, CONST_256, TMP8); | |
| 2896 | |
| 2897 vis_padd16(TMP2, CONST_3, TMP2); | |
| 2898 vis_mul8x16au(REF_S4_1, CONST_256, TMP10); | |
| 2899 | |
| 2900 vis_padd16(TMP0, TMP24, TMP0); | |
| 2901 vis_mul8x16au(REF_S6, CONST_256, TMP12); | |
| 2902 | |
| 2903 vis_padd16(TMP2, TMP6, TMP2); | |
| 2904 vis_mul8x16au(REF_S6_1, CONST_256, TMP14); | |
| 2905 | |
| 2906 vis_padd16(TMP8, CONST_3, TMP8); | |
| 2907 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 2908 | |
| 2909 vis_padd16(TMP10, CONST_3, TMP10); | |
| 2910 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 2911 | |
| 2912 vis_padd16(TMP8, TMP12, TMP8); | |
| 2913 vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20); | |
| 2914 | |
| 2915 vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22); | |
| 2916 vis_padd16(TMP0, TMP16, TMP0); | |
| 2917 | |
| 2918 vis_padd16(TMP2, TMP18, TMP2); | |
| 2919 vis_pack16(TMP0, DST_0); | |
| 2920 | |
| 2921 vis_padd16(TMP10, TMP14, TMP10); | |
| 2922 vis_pack16(TMP2, DST_1); | |
| 2923 vis_st64(DST_0, dest[0]); | |
| 2924 dest += stride; | |
| 2925 | |
| 2926 vis_padd16(TMP8, TMP20, TMP8); | |
| 2927 | |
| 2928 vis_padd16(TMP10, TMP22, TMP10); | |
| 2929 vis_pack16(TMP8, DST_2); | |
| 2930 | |
| 2931 vis_pack16(TMP10, DST_3); | |
| 2932 vis_st64(DST_2, dest[0]); | |
| 2933 dest += stride; | |
| 2934 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2935 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2936 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2937 static void MC_put_no_round_y_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 2938 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
2939 { |
| 2979 | 2940 uint8_t *ref = (uint8_t *) _ref; |
| 2941 | |
| 2942 ref = vis_alignaddr(ref); | |
| 2943 vis_ld64(ref[0], TMP0); | |
| 2944 | |
| 2945 vis_ld64_2(ref, 8, TMP2); | |
| 2946 | |
| 2947 vis_ld64_2(ref, 16, TMP4); | |
| 2948 ref += stride; | |
| 2949 | |
| 2950 vis_ld64(ref[0], TMP6); | |
| 2951 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2952 | |
| 2953 vis_ld64_2(ref, 8, TMP8); | |
| 2954 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2955 | |
| 2956 vis_ld64_2(ref, 16, TMP10); | |
| 2957 ref += stride; | |
| 2958 | |
| 2959 vis_ld64(constants_fe[0], MASK_fe); | |
| 2960 vis_faligndata(TMP6, TMP8, REF_2); | |
| 2961 | |
| 2962 vis_ld64(constants_7f[0], MASK_7f); | |
| 2963 vis_faligndata(TMP8, TMP10, REF_6); | |
| 2964 | |
| 2965 vis_ld64(constants128[0], CONST_128); | |
| 2966 height = (height >> 1) - 1; | |
| 2967 do { /* 24 cycles */ | |
| 2968 vis_ld64(ref[0], TMP0); | |
| 2969 vis_xor(REF_0, REF_2, TMP12); | |
| 2970 | |
| 2971 vis_ld64_2(ref, 8, TMP2); | |
| 2972 vis_xor(REF_4, REF_6, TMP16); | |
| 2973 | |
| 2974 vis_ld64_2(ref, 16, TMP4); | |
| 2975 ref += stride; | |
| 2976 vis_and(REF_0, REF_2, TMP14); | |
| 2977 | |
| 2978 vis_ld64(ref[0], TMP6); | |
| 2979 vis_and(REF_4, REF_6, TMP18); | |
| 2980 | |
| 2981 vis_ld64_2(ref, 8, TMP8); | |
| 2982 vis_faligndata(TMP0, TMP2, REF_0); | |
| 2983 | |
| 2984 vis_ld64_2(ref, 16, TMP10); | |
| 2985 ref += stride; | |
| 2986 vis_faligndata(TMP2, TMP4, REF_4); | |
| 2987 | |
| 2988 vis_and(TMP12, MASK_fe, TMP12); | |
| 2989 | |
| 2990 vis_and(TMP16, MASK_fe, TMP16); | |
| 2991 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 2992 | |
| 2993 vis_mul8x16(CONST_128, TMP16, TMP16); | |
| 2994 vis_xor(REF_0, REF_2, TMP0); | |
| 2995 | |
| 2996 vis_xor(REF_4, REF_6, TMP2); | |
| 2997 | |
| 2998 vis_and(REF_0, REF_2, TMP20); | |
| 2999 | |
| 3000 vis_and(TMP12, MASK_7f, TMP12); | |
| 3001 | |
| 3002 vis_and(TMP16, MASK_7f, TMP16); | |
| 3003 | |
| 3004 vis_padd16(TMP14, TMP12, TMP12); | |
| 3005 vis_st64(TMP12, dest[0]); | |
| 3006 | |
| 3007 vis_padd16(TMP18, TMP16, TMP16); | |
| 3008 vis_st64_2(TMP16, dest, 8); | |
| 3009 dest += stride; | |
| 3010 | |
| 3011 vis_and(REF_4, REF_6, TMP18); | |
| 3012 | |
| 3013 vis_and(TMP0, MASK_fe, TMP0); | |
| 3014 | |
| 3015 vis_and(TMP2, MASK_fe, TMP2); | |
| 3016 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 3017 | |
| 3018 vis_faligndata(TMP6, TMP8, REF_2); | |
| 3019 vis_mul8x16(CONST_128, TMP2, TMP2); | |
| 3020 | |
| 3021 vis_faligndata(TMP8, TMP10, REF_6); | |
| 3022 | |
| 3023 vis_and(TMP0, MASK_7f, TMP0); | |
| 3024 | |
| 3025 vis_and(TMP2, MASK_7f, TMP2); | |
| 3026 | |
| 3027 vis_padd16(TMP20, TMP0, TMP0); | |
| 3028 vis_st64(TMP0, dest[0]); | |
| 3029 | |
| 3030 vis_padd16(TMP18, TMP2, TMP2); | |
| 3031 vis_st64_2(TMP2, dest, 8); | |
| 3032 dest += stride; | |
| 3033 } while (--height); | |
| 3034 | |
| 3035 vis_ld64(ref[0], TMP0); | |
| 3036 vis_xor(REF_0, REF_2, TMP12); | |
| 3037 | |
| 3038 vis_ld64_2(ref, 8, TMP2); | |
| 3039 vis_xor(REF_4, REF_6, TMP16); | |
| 3040 | |
| 3041 vis_ld64_2(ref, 16, TMP4); | |
| 3042 vis_and(REF_0, REF_2, TMP14); | |
| 3043 | |
| 3044 vis_and(REF_4, REF_6, TMP18); | |
| 3045 | |
| 3046 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3047 | |
| 3048 vis_faligndata(TMP2, TMP4, REF_4); | |
| 3049 | |
| 3050 vis_and(TMP12, MASK_fe, TMP12); | |
| 3051 | |
| 3052 vis_and(TMP16, MASK_fe, TMP16); | |
| 3053 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 3054 | |
| 3055 vis_mul8x16(CONST_128, TMP16, TMP16); | |
| 3056 vis_xor(REF_0, REF_2, TMP0); | |
| 3057 | |
| 3058 vis_xor(REF_4, REF_6, TMP2); | |
| 3059 | |
| 3060 vis_and(REF_0, REF_2, TMP20); | |
| 3061 | |
| 3062 vis_and(TMP12, MASK_7f, TMP12); | |
| 3063 | |
| 3064 vis_and(TMP16, MASK_7f, TMP16); | |
| 3065 | |
| 3066 vis_padd16(TMP14, TMP12, TMP12); | |
| 3067 vis_st64(TMP12, dest[0]); | |
| 3068 | |
| 3069 vis_padd16(TMP18, TMP16, TMP16); | |
| 3070 vis_st64_2(TMP16, dest, 8); | |
| 3071 dest += stride; | |
| 3072 | |
| 3073 vis_and(REF_4, REF_6, TMP18); | |
| 3074 | |
| 3075 vis_and(TMP0, MASK_fe, TMP0); | |
| 3076 | |
| 3077 vis_and(TMP2, MASK_fe, TMP2); | |
| 3078 vis_mul8x16(CONST_128, TMP0, TMP0); | |
| 3079 | |
| 3080 vis_mul8x16(CONST_128, TMP2, TMP2); | |
| 3081 | |
| 3082 vis_and(TMP0, MASK_7f, TMP0); | |
| 3083 | |
| 3084 vis_and(TMP2, MASK_7f, TMP2); | |
| 3085 | |
| 3086 vis_padd16(TMP20, TMP0, TMP0); | |
| 3087 vis_st64(TMP0, dest[0]); | |
| 3088 | |
| 3089 vis_padd16(TMP18, TMP2, TMP2); | |
| 3090 vis_st64_2(TMP2, dest, 8); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3091 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3092 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3093 static void MC_put_no_round_y_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3094 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3095 { |
| 2979 | 3096 uint8_t *ref = (uint8_t *) _ref; |
| 3097 | |
| 3098 ref = vis_alignaddr(ref); | |
| 3099 vis_ld64(ref[0], TMP0); | |
| 3100 | |
| 3101 vis_ld64_2(ref, 8, TMP2); | |
| 3102 ref += stride; | |
| 3103 | |
| 3104 vis_ld64(ref[0], TMP4); | |
| 3105 | |
| 3106 vis_ld64_2(ref, 8, TMP6); | |
| 3107 ref += stride; | |
| 3108 | |
| 3109 vis_ld64(constants_fe[0], MASK_fe); | |
| 3110 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3111 | |
| 3112 vis_ld64(constants_7f[0], MASK_7f); | |
| 3113 vis_faligndata(TMP4, TMP6, REF_2); | |
| 3114 | |
| 3115 vis_ld64(constants128[0], CONST_128); | |
| 3116 height = (height >> 1) - 1; | |
| 3117 do { /* 12 cycles */ | |
| 3118 vis_ld64(ref[0], TMP0); | |
| 3119 vis_xor(REF_0, REF_2, TMP4); | |
| 3120 | |
| 3121 vis_ld64_2(ref, 8, TMP2); | |
| 3122 ref += stride; | |
| 3123 vis_and(TMP4, MASK_fe, TMP4); | |
| 3124 | |
| 3125 vis_and(REF_0, REF_2, TMP6); | |
| 3126 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 3127 | |
| 3128 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3129 vis_ld64(ref[0], TMP0); | |
| 3130 | |
| 3131 vis_ld64_2(ref, 8, TMP2); | |
| 3132 ref += stride; | |
| 3133 vis_xor(REF_0, REF_2, TMP12); | |
| 3134 | |
| 3135 vis_and(TMP4, MASK_7f, TMP4); | |
| 3136 | |
| 3137 vis_and(TMP12, MASK_fe, TMP12); | |
| 3138 | |
| 3139 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 3140 vis_and(REF_0, REF_2, TMP14); | |
| 3141 | |
| 3142 vis_padd16(TMP6, TMP4, DST_0); | |
| 3143 vis_st64(DST_0, dest[0]); | |
| 3144 dest += stride; | |
| 3145 | |
| 3146 vis_faligndata(TMP0, TMP2, REF_2); | |
| 3147 | |
| 3148 vis_and(TMP12, MASK_7f, TMP12); | |
| 3149 | |
| 3150 vis_padd16(TMP14, TMP12, DST_0); | |
| 3151 vis_st64(DST_0, dest[0]); | |
| 3152 dest += stride; | |
| 3153 } while (--height); | |
| 3154 | |
| 3155 vis_ld64(ref[0], TMP0); | |
| 3156 vis_xor(REF_0, REF_2, TMP4); | |
| 3157 | |
| 3158 vis_ld64_2(ref, 8, TMP2); | |
| 3159 vis_and(TMP4, MASK_fe, TMP4); | |
| 3160 | |
| 3161 vis_and(REF_0, REF_2, TMP6); | |
| 3162 vis_mul8x16(CONST_128, TMP4, TMP4); | |
| 3163 | |
| 3164 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3165 | |
| 3166 vis_xor(REF_0, REF_2, TMP12); | |
| 3167 | |
| 3168 vis_and(TMP4, MASK_7f, TMP4); | |
| 3169 | |
| 3170 vis_and(TMP12, MASK_fe, TMP12); | |
| 3171 | |
| 3172 vis_mul8x16(CONST_128, TMP12, TMP12); | |
| 3173 vis_and(REF_0, REF_2, TMP14); | |
| 3174 | |
| 3175 vis_padd16(TMP6, TMP4, DST_0); | |
| 3176 vis_st64(DST_0, dest[0]); | |
| 3177 dest += stride; | |
| 3178 | |
| 3179 vis_and(TMP12, MASK_7f, TMP12); | |
| 3180 | |
| 3181 vis_padd16(TMP14, TMP12, DST_0); | |
| 3182 vis_st64(DST_0, dest[0]); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3183 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3184 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3185 static void MC_avg_no_round_y_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3186 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3187 { |
| 2979 | 3188 uint8_t *ref = (uint8_t *) _ref; |
| 3189 int stride_8 = stride + 8; | |
| 3190 int stride_16 = stride + 16; | |
| 3191 | |
| 3192 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3193 | |
| 3194 ref = vis_alignaddr(ref); | |
| 3195 | |
| 3196 vis_ld64(ref[ 0], TMP0); | |
| 3197 vis_fzero(ZERO); | |
| 3198 | |
| 3199 vis_ld64(ref[ 8], TMP2); | |
| 3200 | |
| 3201 vis_ld64(ref[16], TMP4); | |
| 3202 | |
| 3203 vis_ld64(constants3[0], CONST_3); | |
| 3204 vis_faligndata(TMP0, TMP2, REF_2); | |
| 3205 | |
| 3206 vis_ld64(constants256_512[0], CONST_256); | |
| 3207 vis_faligndata(TMP2, TMP4, REF_6); | |
| 3208 height >>= 1; | |
| 3209 | |
| 3210 do { /* 31 cycles */ | |
| 3211 vis_ld64_2(ref, stride, TMP0); | |
| 3212 vis_pmerge(ZERO, REF_2, TMP12); | |
| 3213 vis_mul8x16au(REF_2_1, CONST_256, TMP14); | |
| 3214 | |
| 3215 vis_ld64_2(ref, stride_8, TMP2); | |
| 3216 vis_pmerge(ZERO, REF_6, TMP16); | |
| 3217 vis_mul8x16au(REF_6_1, CONST_256, TMP18); | |
| 3218 | |
| 3219 vis_ld64_2(ref, stride_16, TMP4); | |
| 3220 ref += stride; | |
| 3221 | |
| 3222 vis_ld64(dest[0], DST_0); | |
| 3223 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3224 | |
| 3225 vis_ld64_2(dest, 8, DST_2); | |
| 3226 vis_faligndata(TMP2, TMP4, REF_4); | |
| 3227 | |
| 3228 vis_ld64_2(ref, stride, TMP6); | |
| 3229 vis_pmerge(ZERO, REF_0, TMP0); | |
| 3230 vis_mul8x16au(REF_0_1, CONST_256, TMP2); | |
| 3231 | |
| 3232 vis_ld64_2(ref, stride_8, TMP8); | |
| 3233 vis_pmerge(ZERO, REF_4, TMP4); | |
| 3234 | |
| 3235 vis_ld64_2(ref, stride_16, TMP10); | |
| 3236 ref += stride; | |
| 3237 | |
| 3238 vis_ld64_2(dest, stride, REF_S0/*DST_4*/); | |
| 3239 vis_faligndata(TMP6, TMP8, REF_2); | |
| 3240 vis_mul8x16au(REF_4_1, CONST_256, TMP6); | |
| 3241 | |
| 3242 vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/); | |
| 3243 vis_faligndata(TMP8, TMP10, REF_6); | |
| 3244 vis_mul8x16al(DST_0, CONST_512, TMP20); | |
| 3245 | |
| 3246 vis_padd16(TMP0, CONST_3, TMP0); | |
| 3247 vis_mul8x16al(DST_1, CONST_512, TMP22); | |
| 3248 | |
| 3249 vis_padd16(TMP2, CONST_3, TMP2); | |
| 3250 vis_mul8x16al(DST_2, CONST_512, TMP24); | |
| 3251 | |
| 3252 vis_padd16(TMP4, CONST_3, TMP4); | |
| 3253 vis_mul8x16al(DST_3, CONST_512, TMP26); | |
| 3254 | |
| 3255 vis_padd16(TMP6, CONST_3, TMP6); | |
| 3256 | |
| 3257 vis_padd16(TMP12, TMP20, TMP12); | |
| 3258 vis_mul8x16al(REF_S0, CONST_512, TMP20); | |
| 3259 | |
| 3260 vis_padd16(TMP14, TMP22, TMP14); | |
| 3261 vis_mul8x16al(REF_S0_1, CONST_512, TMP22); | |
| 3262 | |
| 3263 vis_padd16(TMP16, TMP24, TMP16); | |
| 3264 vis_mul8x16al(REF_S2, CONST_512, TMP24); | |
| 3265 | |
| 3266 vis_padd16(TMP18, TMP26, TMP18); | |
| 3267 vis_mul8x16al(REF_S2_1, CONST_512, TMP26); | |
| 3268 | |
| 3269 vis_padd16(TMP12, TMP0, TMP12); | |
| 3270 vis_mul8x16au(REF_2, CONST_256, TMP28); | |
| 3271 | |
| 3272 vis_padd16(TMP14, TMP2, TMP14); | |
| 3273 vis_mul8x16au(REF_2_1, CONST_256, TMP30); | |
| 3274 | |
| 3275 vis_padd16(TMP16, TMP4, TMP16); | |
| 3276 vis_mul8x16au(REF_6, CONST_256, REF_S4); | |
| 3277 | |
| 3278 vis_padd16(TMP18, TMP6, TMP18); | |
| 3279 vis_mul8x16au(REF_6_1, CONST_256, REF_S6); | |
| 3280 | |
| 3281 vis_pack16(TMP12, DST_0); | |
| 3282 vis_padd16(TMP28, TMP0, TMP12); | |
| 3283 | |
| 3284 vis_pack16(TMP14, DST_1); | |
| 3285 vis_st64(DST_0, dest[0]); | |
| 3286 vis_padd16(TMP30, TMP2, TMP14); | |
| 3287 | |
| 3288 vis_pack16(TMP16, DST_2); | |
| 3289 vis_padd16(REF_S4, TMP4, TMP16); | |
| 3290 | |
| 3291 vis_pack16(TMP18, DST_3); | |
| 3292 vis_st64_2(DST_2, dest, 8); | |
| 3293 dest += stride; | |
| 3294 vis_padd16(REF_S6, TMP6, TMP18); | |
| 3295 | |
| 3296 vis_padd16(TMP12, TMP20, TMP12); | |
| 3297 | |
| 3298 vis_padd16(TMP14, TMP22, TMP14); | |
| 3299 vis_pack16(TMP12, DST_0); | |
| 3300 | |
| 3301 vis_padd16(TMP16, TMP24, TMP16); | |
| 3302 vis_pack16(TMP14, DST_1); | |
| 3303 vis_st64(DST_0, dest[0]); | |
| 3304 | |
| 3305 vis_padd16(TMP18, TMP26, TMP18); | |
| 3306 vis_pack16(TMP16, DST_2); | |
| 3307 | |
| 3308 vis_pack16(TMP18, DST_3); | |
| 3309 vis_st64_2(DST_2, dest, 8); | |
| 3310 dest += stride; | |
| 3311 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3312 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3313 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3314 static void MC_avg_no_round_y_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3315 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3316 { |
| 2979 | 3317 uint8_t *ref = (uint8_t *) _ref; |
| 3318 int stride_8 = stride + 8; | |
| 3319 | |
| 3320 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3321 | |
| 3322 ref = vis_alignaddr(ref); | |
| 3323 | |
| 3324 vis_ld64(ref[ 0], TMP0); | |
| 3325 vis_fzero(ZERO); | |
| 3326 | |
| 3327 vis_ld64(ref[ 8], TMP2); | |
| 3328 | |
| 3329 vis_ld64(constants3[0], CONST_3); | |
| 3330 vis_faligndata(TMP0, TMP2, REF_2); | |
| 3331 | |
| 3332 vis_ld64(constants256_512[0], CONST_256); | |
| 3333 | |
| 3334 height >>= 1; | |
| 3335 do { /* 20 cycles */ | |
| 3336 vis_ld64_2(ref, stride, TMP0); | |
| 3337 vis_pmerge(ZERO, REF_2, TMP8); | |
| 3338 vis_mul8x16au(REF_2_1, CONST_256, TMP10); | |
| 3339 | |
| 3340 vis_ld64_2(ref, stride_8, TMP2); | |
| 3341 ref += stride; | |
| 3342 | |
| 3343 vis_ld64(dest[0], DST_0); | |
| 3344 | |
| 3345 vis_ld64_2(dest, stride, DST_2); | |
| 3346 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3347 | |
| 3348 vis_ld64_2(ref, stride, TMP4); | |
| 3349 vis_mul8x16al(DST_0, CONST_512, TMP16); | |
| 3350 vis_pmerge(ZERO, REF_0, TMP12); | |
| 3351 | |
| 3352 vis_ld64_2(ref, stride_8, TMP6); | |
| 3353 ref += stride; | |
| 3354 vis_mul8x16al(DST_1, CONST_512, TMP18); | |
| 3355 vis_pmerge(ZERO, REF_0_1, TMP14); | |
| 3356 | |
| 3357 vis_padd16(TMP12, CONST_3, TMP12); | |
| 3358 vis_mul8x16al(DST_2, CONST_512, TMP24); | |
| 3359 | |
| 3360 vis_padd16(TMP14, CONST_3, TMP14); | |
| 3361 vis_mul8x16al(DST_3, CONST_512, TMP26); | |
| 3362 | |
| 3363 vis_faligndata(TMP4, TMP6, REF_2); | |
| 3364 | |
| 3365 vis_padd16(TMP8, TMP12, TMP8); | |
| 3366 | |
| 3367 vis_padd16(TMP10, TMP14, TMP10); | |
| 3368 vis_mul8x16au(REF_2, CONST_256, TMP20); | |
| 3369 | |
| 3370 vis_padd16(TMP8, TMP16, TMP0); | |
| 3371 vis_mul8x16au(REF_2_1, CONST_256, TMP22); | |
| 3372 | |
| 3373 vis_padd16(TMP10, TMP18, TMP2); | |
| 3374 vis_pack16(TMP0, DST_0); | |
| 3375 | |
| 3376 vis_pack16(TMP2, DST_1); | |
| 3377 vis_st64(DST_0, dest[0]); | |
| 3378 dest += stride; | |
| 3379 vis_padd16(TMP12, TMP20, TMP12); | |
| 3380 | |
| 3381 vis_padd16(TMP14, TMP22, TMP14); | |
| 3382 | |
| 3383 vis_padd16(TMP12, TMP24, TMP0); | |
| 3384 | |
| 3385 vis_padd16(TMP14, TMP26, TMP2); | |
| 3386 vis_pack16(TMP0, DST_2); | |
| 3387 | |
| 3388 vis_pack16(TMP2, DST_3); | |
| 3389 vis_st64(DST_2, dest[0]); | |
| 3390 dest += stride; | |
| 3391 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3392 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3393 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3394 static void MC_put_no_round_xy_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3395 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3396 { |
| 2979 | 3397 uint8_t *ref = (uint8_t *) _ref; |
| 3398 unsigned long off = (unsigned long) ref & 0x7; | |
| 3399 unsigned long off_plus_1 = off + 1; | |
| 3400 int stride_8 = stride + 8; | |
| 3401 int stride_16 = stride + 16; | |
| 3402 | |
| 3403 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3404 | |
| 3405 ref = vis_alignaddr(ref); | |
| 3406 | |
| 3407 vis_ld64(ref[ 0], TMP0); | |
| 3408 vis_fzero(ZERO); | |
| 3409 | |
| 3410 vis_ld64(ref[ 8], TMP2); | |
| 3411 | |
| 3412 vis_ld64(ref[16], TMP4); | |
| 3413 | |
| 3414 vis_ld64(constants1[0], CONST_1); | |
| 3415 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 3416 | |
| 3417 vis_ld64(constants256_512[0], CONST_256); | |
| 3418 vis_faligndata(TMP2, TMP4, REF_S4); | |
| 3419 | |
| 3420 if (off != 0x7) { | |
| 3421 vis_alignaddr_g0((void *)off_plus_1); | |
| 3422 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 3423 vis_faligndata(TMP2, TMP4, REF_S6); | |
| 3424 } else { | |
| 3425 vis_src1(TMP2, REF_S2); | |
| 3426 vis_src1(TMP4, REF_S6); | |
| 3427 } | |
| 3428 | |
| 3429 height >>= 1; | |
| 3430 do { | |
| 3431 vis_ld64_2(ref, stride, TMP0); | |
| 3432 vis_mul8x16au(REF_S0, CONST_256, TMP12); | |
| 3433 vis_pmerge(ZERO, REF_S0_1, TMP14); | |
| 3434 | |
| 3435 vis_alignaddr_g0((void *)off); | |
| 3436 | |
| 3437 vis_ld64_2(ref, stride_8, TMP2); | |
| 3438 vis_mul8x16au(REF_S2, CONST_256, TMP16); | |
| 3439 vis_pmerge(ZERO, REF_S2_1, TMP18); | |
| 3440 | |
| 3441 vis_ld64_2(ref, stride_16, TMP4); | |
| 3442 ref += stride; | |
| 3443 vis_mul8x16au(REF_S4, CONST_256, TMP20); | |
| 3444 vis_pmerge(ZERO, REF_S4_1, TMP22); | |
| 3445 | |
| 3446 vis_ld64_2(ref, stride, TMP6); | |
| 3447 vis_mul8x16au(REF_S6, CONST_256, TMP24); | |
| 3448 vis_pmerge(ZERO, REF_S6_1, TMP26); | |
| 3449 | |
| 3450 vis_ld64_2(ref, stride_8, TMP8); | |
| 3451 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3452 | |
| 3453 vis_ld64_2(ref, stride_16, TMP10); | |
| 3454 ref += stride; | |
| 3455 vis_faligndata(TMP2, TMP4, REF_4); | |
| 3456 | |
| 3457 vis_faligndata(TMP6, TMP8, REF_S0); | |
| 3458 | |
| 3459 vis_faligndata(TMP8, TMP10, REF_S4); | |
| 3460 | |
| 3461 if (off != 0x7) { | |
| 3462 vis_alignaddr_g0((void *)off_plus_1); | |
| 3463 vis_faligndata(TMP0, TMP2, REF_2); | |
| 3464 vis_faligndata(TMP2, TMP4, REF_6); | |
| 3465 vis_faligndata(TMP6, TMP8, REF_S2); | |
| 3466 vis_faligndata(TMP8, TMP10, REF_S6); | |
| 3467 } else { | |
| 3468 vis_src1(TMP2, REF_2); | |
| 3469 vis_src1(TMP4, REF_6); | |
| 3470 vis_src1(TMP8, REF_S2); | |
| 3471 vis_src1(TMP10, REF_S6); | |
| 3472 } | |
| 3473 | |
| 3474 vis_mul8x16au(REF_0, CONST_256, TMP0); | |
| 3475 vis_pmerge(ZERO, REF_0_1, TMP2); | |
| 3476 | |
| 3477 vis_mul8x16au(REF_2, CONST_256, TMP4); | |
| 3478 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 3479 | |
| 3480 vis_padd16(TMP0, CONST_2, TMP8); | |
| 3481 vis_mul8x16au(REF_4, CONST_256, TMP0); | |
| 3482 | |
| 3483 vis_padd16(TMP2, CONST_1, TMP10); | |
| 3484 vis_mul8x16au(REF_4_1, CONST_256, TMP2); | |
| 3485 | |
| 3486 vis_padd16(TMP8, TMP4, TMP8); | |
| 3487 vis_mul8x16au(REF_6, CONST_256, TMP4); | |
| 3488 | |
| 3489 vis_padd16(TMP10, TMP6, TMP10); | |
| 3490 vis_mul8x16au(REF_6_1, CONST_256, TMP6); | |
| 3491 | |
| 3492 vis_padd16(TMP12, TMP8, TMP12); | |
| 3493 | |
| 3494 vis_padd16(TMP14, TMP10, TMP14); | |
| 3495 | |
| 3496 vis_padd16(TMP12, TMP16, TMP12); | |
| 3497 | |
| 3498 vis_padd16(TMP14, TMP18, TMP14); | |
| 3499 vis_pack16(TMP12, DST_0); | |
| 3500 | |
| 3501 vis_pack16(TMP14, DST_1); | |
| 3502 vis_st64(DST_0, dest[0]); | |
| 3503 vis_padd16(TMP0, CONST_1, TMP12); | |
| 3504 | |
| 3505 vis_mul8x16au(REF_S0, CONST_256, TMP0); | |
| 3506 vis_padd16(TMP2, CONST_1, TMP14); | |
| 3507 | |
| 3508 vis_mul8x16au(REF_S0_1, CONST_256, TMP2); | |
| 3509 vis_padd16(TMP12, TMP4, TMP12); | |
| 3510 | |
| 3511 vis_mul8x16au(REF_S2, CONST_256, TMP4); | |
| 3512 vis_padd16(TMP14, TMP6, TMP14); | |
| 3513 | |
| 3514 vis_mul8x16au(REF_S2_1, CONST_256, TMP6); | |
| 3515 vis_padd16(TMP20, TMP12, TMP20); | |
| 3516 | |
| 3517 vis_padd16(TMP22, TMP14, TMP22); | |
| 3518 | |
| 3519 vis_padd16(TMP20, TMP24, TMP20); | |
| 3520 | |
| 3521 vis_padd16(TMP22, TMP26, TMP22); | |
| 3522 vis_pack16(TMP20, DST_2); | |
| 3523 | |
| 3524 vis_pack16(TMP22, DST_3); | |
| 3525 vis_st64_2(DST_2, dest, 8); | |
| 3526 dest += stride; | |
| 3527 vis_padd16(TMP0, TMP4, TMP24); | |
| 3528 | |
| 3529 vis_mul8x16au(REF_S4, CONST_256, TMP0); | |
| 3530 vis_padd16(TMP2, TMP6, TMP26); | |
| 3531 | |
| 3532 vis_mul8x16au(REF_S4_1, CONST_256, TMP2); | |
| 3533 vis_padd16(TMP24, TMP8, TMP24); | |
| 3534 | |
| 3535 vis_padd16(TMP26, TMP10, TMP26); | |
| 3536 vis_pack16(TMP24, DST_0); | |
| 3537 | |
| 3538 vis_pack16(TMP26, DST_1); | |
| 3539 vis_st64(DST_0, dest[0]); | |
| 3540 vis_pmerge(ZERO, REF_S6, TMP4); | |
| 3541 | |
| 3542 vis_pmerge(ZERO, REF_S6_1, TMP6); | |
| 3543 | |
| 3544 vis_padd16(TMP0, TMP4, TMP0); | |
| 3545 | |
| 3546 vis_padd16(TMP2, TMP6, TMP2); | |
| 3547 | |
| 3548 vis_padd16(TMP0, TMP12, TMP0); | |
| 3549 | |
| 3550 vis_padd16(TMP2, TMP14, TMP2); | |
| 3551 vis_pack16(TMP0, DST_2); | |
| 3552 | |
| 3553 vis_pack16(TMP2, DST_3); | |
| 3554 vis_st64_2(DST_2, dest, 8); | |
| 3555 dest += stride; | |
| 3556 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3557 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3558 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3559 static void MC_put_no_round_xy_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3560 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3561 { |
| 2979 | 3562 uint8_t *ref = (uint8_t *) _ref; |
| 3563 unsigned long off = (unsigned long) ref & 0x7; | |
| 3564 unsigned long off_plus_1 = off + 1; | |
| 3565 int stride_8 = stride + 8; | |
| 3566 | |
| 3567 vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3568 | |
| 3569 ref = vis_alignaddr(ref); | |
| 3570 | |
| 3571 vis_ld64(ref[ 0], TMP0); | |
| 3572 vis_fzero(ZERO); | |
| 3573 | |
| 3574 vis_ld64(ref[ 8], TMP2); | |
| 3575 | |
| 3576 vis_ld64(constants1[0], CONST_1); | |
| 3577 | |
| 3578 vis_ld64(constants256_512[0], CONST_256); | |
| 3579 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 3580 | |
| 3581 if (off != 0x7) { | |
| 3582 vis_alignaddr_g0((void *)off_plus_1); | |
| 3583 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 3584 } else { | |
| 3585 vis_src1(TMP2, REF_S2); | |
| 3586 } | |
| 3587 | |
| 3588 height >>= 1; | |
| 3589 do { /* 26 cycles */ | |
| 3590 vis_ld64_2(ref, stride, TMP0); | |
| 3591 vis_mul8x16au(REF_S0, CONST_256, TMP8); | |
| 3592 vis_pmerge(ZERO, REF_S2, TMP12); | |
| 3593 | |
| 3594 vis_alignaddr_g0((void *)off); | |
| 3595 | |
| 3596 vis_ld64_2(ref, stride_8, TMP2); | |
| 3597 ref += stride; | |
| 3598 vis_mul8x16au(REF_S0_1, CONST_256, TMP10); | |
| 3599 vis_pmerge(ZERO, REF_S2_1, TMP14); | |
| 3600 | |
| 3601 vis_ld64_2(ref, stride, TMP4); | |
| 3602 | |
| 3603 vis_ld64_2(ref, stride_8, TMP6); | |
| 3604 ref += stride; | |
| 3605 vis_faligndata(TMP0, TMP2, REF_S4); | |
| 3606 | |
| 3607 vis_pmerge(ZERO, REF_S4, TMP18); | |
| 3608 | |
| 3609 vis_pmerge(ZERO, REF_S4_1, TMP20); | |
| 3610 | |
| 3611 vis_faligndata(TMP4, TMP6, REF_S0); | |
| 3612 | |
| 3613 if (off != 0x7) { | |
| 3614 vis_alignaddr_g0((void *)off_plus_1); | |
| 3615 vis_faligndata(TMP0, TMP2, REF_S6); | |
| 3616 vis_faligndata(TMP4, TMP6, REF_S2); | |
| 3617 } else { | |
| 3618 vis_src1(TMP2, REF_S6); | |
| 3619 vis_src1(TMP6, REF_S2); | |
| 3620 } | |
| 3621 | |
| 3622 vis_padd16(TMP18, CONST_1, TMP18); | |
| 3623 vis_mul8x16au(REF_S6, CONST_256, TMP22); | |
| 3624 | |
| 3625 vis_padd16(TMP20, CONST_1, TMP20); | |
| 3626 vis_mul8x16au(REF_S6_1, CONST_256, TMP24); | |
| 3627 | |
| 3628 vis_mul8x16au(REF_S0, CONST_256, TMP26); | |
| 3629 vis_pmerge(ZERO, REF_S0_1, TMP28); | |
| 3630 | |
| 3631 vis_mul8x16au(REF_S2, CONST_256, TMP30); | |
| 3632 vis_padd16(TMP18, TMP22, TMP18); | |
| 3633 | |
| 3634 vis_mul8x16au(REF_S2_1, CONST_256, TMP32); | |
| 3635 vis_padd16(TMP20, TMP24, TMP20); | |
| 3636 | |
| 3637 vis_padd16(TMP8, TMP18, TMP8); | |
| 3638 | |
| 3639 vis_padd16(TMP10, TMP20, TMP10); | |
| 3640 | |
| 3641 vis_padd16(TMP8, TMP12, TMP8); | |
| 3642 | |
| 3643 vis_padd16(TMP10, TMP14, TMP10); | |
| 3644 vis_pack16(TMP8, DST_0); | |
| 3645 | |
| 3646 vis_pack16(TMP10, DST_1); | |
| 3647 vis_st64(DST_0, dest[0]); | |
| 3648 dest += stride; | |
| 3649 vis_padd16(TMP18, TMP26, TMP18); | |
| 3650 | |
| 3651 vis_padd16(TMP20, TMP28, TMP20); | |
| 3652 | |
| 3653 vis_padd16(TMP18, TMP30, TMP18); | |
| 3654 | |
| 3655 vis_padd16(TMP20, TMP32, TMP20); | |
| 3656 vis_pack16(TMP18, DST_2); | |
| 3657 | |
| 3658 vis_pack16(TMP20, DST_3); | |
| 3659 vis_st64(DST_2, dest[0]); | |
| 3660 dest += stride; | |
| 3661 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3662 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3663 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3664 static void MC_avg_no_round_xy_16_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3665 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3666 { |
| 2979 | 3667 uint8_t *ref = (uint8_t *) _ref; |
| 3668 unsigned long off = (unsigned long) ref & 0x7; | |
| 3669 unsigned long off_plus_1 = off + 1; | |
| 3670 int stride_8 = stride + 8; | |
| 3671 int stride_16 = stride + 16; | |
| 3672 | |
| 3673 vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3674 | |
| 3675 ref = vis_alignaddr(ref); | |
| 3676 | |
| 3677 vis_ld64(ref[ 0], TMP0); | |
| 3678 vis_fzero(ZERO); | |
| 3679 | |
| 3680 vis_ld64(ref[ 8], TMP2); | |
| 3681 | |
| 3682 vis_ld64(ref[16], TMP4); | |
| 3683 | |
| 3684 vis_ld64(constants6[0], CONST_6); | |
| 3685 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 3686 | |
| 3687 vis_ld64(constants256_1024[0], CONST_256); | |
| 3688 vis_faligndata(TMP2, TMP4, REF_S4); | |
| 3689 | |
| 3690 if (off != 0x7) { | |
| 3691 vis_alignaddr_g0((void *)off_plus_1); | |
| 3692 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 3693 vis_faligndata(TMP2, TMP4, REF_S6); | |
| 3694 } else { | |
| 3695 vis_src1(TMP2, REF_S2); | |
| 3696 vis_src1(TMP4, REF_S6); | |
| 3697 } | |
| 3698 | |
| 3699 height >>= 1; | |
| 3700 do { /* 55 cycles */ | |
| 3701 vis_ld64_2(ref, stride, TMP0); | |
| 3702 vis_mul8x16au(REF_S0, CONST_256, TMP12); | |
| 3703 vis_pmerge(ZERO, REF_S0_1, TMP14); | |
| 3704 | |
| 3705 vis_alignaddr_g0((void *)off); | |
| 3706 | |
| 3707 vis_ld64_2(ref, stride_8, TMP2); | |
| 3708 vis_mul8x16au(REF_S2, CONST_256, TMP16); | |
| 3709 vis_pmerge(ZERO, REF_S2_1, TMP18); | |
| 3710 | |
| 3711 vis_ld64_2(ref, stride_16, TMP4); | |
| 3712 ref += stride; | |
| 3713 vis_mul8x16au(REF_S4, CONST_256, TMP20); | |
| 3714 vis_pmerge(ZERO, REF_S4_1, TMP22); | |
| 3715 | |
| 3716 vis_ld64_2(ref, stride, TMP6); | |
| 3717 vis_mul8x16au(REF_S6, CONST_256, TMP24); | |
| 3718 vis_pmerge(ZERO, REF_S6_1, TMP26); | |
| 3719 | |
| 3720 vis_ld64_2(ref, stride_8, TMP8); | |
| 3721 vis_faligndata(TMP0, TMP2, REF_0); | |
| 3722 | |
| 3723 vis_ld64_2(ref, stride_16, TMP10); | |
| 3724 ref += stride; | |
| 3725 vis_faligndata(TMP2, TMP4, REF_4); | |
| 3726 | |
| 3727 vis_ld64(dest[0], DST_0); | |
| 3728 vis_faligndata(TMP6, TMP8, REF_S0); | |
| 3729 | |
| 3730 vis_ld64_2(dest, 8, DST_2); | |
| 3731 vis_faligndata(TMP8, TMP10, REF_S4); | |
| 3732 | |
| 3733 if (off != 0x7) { | |
| 3734 vis_alignaddr_g0((void *)off_plus_1); | |
| 3735 vis_faligndata(TMP0, TMP2, REF_2); | |
| 3736 vis_faligndata(TMP2, TMP4, REF_6); | |
| 3737 vis_faligndata(TMP6, TMP8, REF_S2); | |
| 3738 vis_faligndata(TMP8, TMP10, REF_S6); | |
| 3739 } else { | |
| 3740 vis_src1(TMP2, REF_2); | |
| 3741 vis_src1(TMP4, REF_6); | |
| 3742 vis_src1(TMP8, REF_S2); | |
| 3743 vis_src1(TMP10, REF_S6); | |
| 3744 } | |
| 3745 | |
| 3746 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 3747 vis_pmerge(ZERO, REF_0, TMP0); | |
| 3748 | |
| 3749 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 3750 vis_pmerge(ZERO, REF_0_1, TMP2); | |
| 3751 | |
| 3752 vis_mul8x16au(REF_2, CONST_256, TMP4); | |
| 3753 vis_pmerge(ZERO, REF_2_1, TMP6); | |
| 3754 | |
| 3755 vis_mul8x16al(DST_2, CONST_1024, REF_0); | |
| 3756 vis_padd16(TMP0, CONST_6, TMP0); | |
| 3757 | |
| 3758 vis_mul8x16al(DST_3, CONST_1024, REF_2); | |
| 3759 vis_padd16(TMP2, CONST_6, TMP2); | |
| 3760 | |
| 3761 vis_padd16(TMP0, TMP4, TMP0); | |
| 3762 vis_mul8x16au(REF_4, CONST_256, TMP4); | |
| 3763 | |
| 3764 vis_padd16(TMP2, TMP6, TMP2); | |
| 3765 vis_mul8x16au(REF_4_1, CONST_256, TMP6); | |
| 3766 | |
| 3767 vis_padd16(TMP12, TMP0, TMP12); | |
| 3768 vis_mul8x16au(REF_6, CONST_256, TMP8); | |
| 3769 | |
| 3770 vis_padd16(TMP14, TMP2, TMP14); | |
| 3771 vis_mul8x16au(REF_6_1, CONST_256, TMP10); | |
| 3772 | |
| 3773 vis_padd16(TMP12, TMP16, TMP12); | |
| 3774 vis_mul8x16au(REF_S0, CONST_256, REF_4); | |
| 3775 | |
| 3776 vis_padd16(TMP14, TMP18, TMP14); | |
| 3777 vis_mul8x16au(REF_S0_1, CONST_256, REF_6); | |
| 3778 | |
| 3779 vis_padd16(TMP12, TMP30, TMP12); | |
| 3780 | |
| 3781 vis_padd16(TMP14, TMP32, TMP14); | |
| 3782 vis_pack16(TMP12, DST_0); | |
| 3783 | |
| 3784 vis_pack16(TMP14, DST_1); | |
| 3785 vis_st64(DST_0, dest[0]); | |
| 3786 vis_padd16(TMP4, CONST_6, TMP4); | |
| 3787 | |
| 3788 vis_ld64_2(dest, stride, DST_0); | |
| 3789 vis_padd16(TMP6, CONST_6, TMP6); | |
| 3790 vis_mul8x16au(REF_S2, CONST_256, TMP12); | |
| 3791 | |
| 3792 vis_padd16(TMP4, TMP8, TMP4); | |
| 3793 vis_mul8x16au(REF_S2_1, CONST_256, TMP14); | |
| 3794 | |
| 3795 vis_padd16(TMP6, TMP10, TMP6); | |
| 3796 | |
| 3797 vis_padd16(TMP20, TMP4, TMP20); | |
| 3798 | |
| 3799 vis_padd16(TMP22, TMP6, TMP22); | |
| 3800 | |
| 3801 vis_padd16(TMP20, TMP24, TMP20); | |
| 3802 | |
| 3803 vis_padd16(TMP22, TMP26, TMP22); | |
| 3804 | |
| 3805 vis_padd16(TMP20, REF_0, TMP20); | |
| 3806 vis_mul8x16au(REF_S4, CONST_256, REF_0); | |
| 3807 | |
| 3808 vis_padd16(TMP22, REF_2, TMP22); | |
| 3809 vis_pack16(TMP20, DST_2); | |
| 3810 | |
| 3811 vis_pack16(TMP22, DST_3); | |
| 3812 vis_st64_2(DST_2, dest, 8); | |
| 3813 dest += stride; | |
| 3814 | |
| 3815 vis_ld64_2(dest, 8, DST_2); | |
| 3816 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 3817 vis_pmerge(ZERO, REF_S4_1, REF_2); | |
| 3818 | |
| 3819 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 3820 vis_padd16(REF_4, TMP0, TMP8); | |
| 3821 | |
| 3822 vis_mul8x16au(REF_S6, CONST_256, REF_4); | |
| 3823 vis_padd16(REF_6, TMP2, TMP10); | |
| 3824 | |
| 3825 vis_mul8x16au(REF_S6_1, CONST_256, REF_6); | |
| 3826 vis_padd16(TMP8, TMP12, TMP8); | |
| 3827 | |
| 3828 vis_padd16(TMP10, TMP14, TMP10); | |
| 3829 | |
| 3830 vis_padd16(TMP8, TMP30, TMP8); | |
| 3831 | |
| 3832 vis_padd16(TMP10, TMP32, TMP10); | |
| 3833 vis_pack16(TMP8, DST_0); | |
| 3834 | |
| 3835 vis_pack16(TMP10, DST_1); | |
| 3836 vis_st64(DST_0, dest[0]); | |
| 3837 | |
| 3838 vis_padd16(REF_0, TMP4, REF_0); | |
| 3839 | |
| 3840 vis_mul8x16al(DST_2, CONST_1024, TMP30); | |
| 3841 vis_padd16(REF_2, TMP6, REF_2); | |
| 3842 | |
| 3843 vis_mul8x16al(DST_3, CONST_1024, TMP32); | |
| 3844 vis_padd16(REF_0, REF_4, REF_0); | |
| 3845 | |
| 3846 vis_padd16(REF_2, REF_6, REF_2); | |
| 3847 | |
| 3848 vis_padd16(REF_0, TMP30, REF_0); | |
| 3849 | |
| 3850 /* stall */ | |
| 3851 | |
| 3852 vis_padd16(REF_2, TMP32, REF_2); | |
| 3853 vis_pack16(REF_0, DST_2); | |
| 3854 | |
| 3855 vis_pack16(REF_2, DST_3); | |
| 3856 vis_st64_2(DST_2, dest, 8); | |
| 3857 dest += stride; | |
| 3858 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3859 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3860 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3861 static void MC_avg_no_round_xy_8_vis (uint8_t * dest, const uint8_t * _ref, |
| 2979 | 3862 const int stride, int height) |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3863 { |
| 2979 | 3864 uint8_t *ref = (uint8_t *) _ref; |
| 3865 unsigned long off = (unsigned long) ref & 0x7; | |
| 3866 unsigned long off_plus_1 = off + 1; | |
| 3867 int stride_8 = stride + 8; | |
| 3868 | |
| 3869 vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); | |
| 3870 | |
| 3871 ref = vis_alignaddr(ref); | |
| 3872 | |
| 3873 vis_ld64(ref[0], TMP0); | |
| 3874 vis_fzero(ZERO); | |
| 3875 | |
| 3876 vis_ld64_2(ref, 8, TMP2); | |
| 3877 | |
| 3878 vis_ld64(constants6[0], CONST_6); | |
| 3879 | |
| 3880 vis_ld64(constants256_1024[0], CONST_256); | |
| 3881 vis_faligndata(TMP0, TMP2, REF_S0); | |
| 3882 | |
| 3883 if (off != 0x7) { | |
| 3884 vis_alignaddr_g0((void *)off_plus_1); | |
| 3885 vis_faligndata(TMP0, TMP2, REF_S2); | |
| 3886 } else { | |
| 3887 vis_src1(TMP2, REF_S2); | |
| 3888 } | |
| 3889 | |
| 3890 height >>= 1; | |
| 3891 do { /* 31 cycles */ | |
| 3892 vis_ld64_2(ref, stride, TMP0); | |
| 3893 vis_mul8x16au(REF_S0, CONST_256, TMP8); | |
| 3894 vis_pmerge(ZERO, REF_S0_1, TMP10); | |
| 3895 | |
| 3896 vis_ld64_2(ref, stride_8, TMP2); | |
| 3897 ref += stride; | |
| 3898 vis_mul8x16au(REF_S2, CONST_256, TMP12); | |
| 3899 vis_pmerge(ZERO, REF_S2_1, TMP14); | |
| 3900 | |
| 3901 vis_alignaddr_g0((void *)off); | |
| 3902 | |
| 3903 vis_ld64_2(ref, stride, TMP4); | |
| 3904 vis_faligndata(TMP0, TMP2, REF_S4); | |
| 3905 | |
| 3906 vis_ld64_2(ref, stride_8, TMP6); | |
| 3907 ref += stride; | |
| 3908 | |
| 3909 vis_ld64(dest[0], DST_0); | |
| 3910 vis_faligndata(TMP4, TMP6, REF_S0); | |
| 3911 | |
| 3912 vis_ld64_2(dest, stride, DST_2); | |
| 3913 | |
| 3914 if (off != 0x7) { | |
| 3915 vis_alignaddr_g0((void *)off_plus_1); | |
| 3916 vis_faligndata(TMP0, TMP2, REF_S6); | |
| 3917 vis_faligndata(TMP4, TMP6, REF_S2); | |
| 3918 } else { | |
| 3919 vis_src1(TMP2, REF_S6); | |
| 3920 vis_src1(TMP6, REF_S2); | |
| 3921 } | |
| 3922 | |
| 3923 vis_mul8x16al(DST_0, CONST_1024, TMP30); | |
| 3924 vis_pmerge(ZERO, REF_S4, TMP22); | |
| 3925 | |
| 3926 vis_mul8x16al(DST_1, CONST_1024, TMP32); | |
| 3927 vis_pmerge(ZERO, REF_S4_1, TMP24); | |
| 3928 | |
| 3929 vis_mul8x16au(REF_S6, CONST_256, TMP26); | |
| 3930 vis_pmerge(ZERO, REF_S6_1, TMP28); | |
| 3931 | |
| 3932 vis_mul8x16au(REF_S0, CONST_256, REF_S4); | |
| 3933 vis_padd16(TMP22, CONST_6, TMP22); | |
| 3934 | |
| 3935 vis_mul8x16au(REF_S0_1, CONST_256, REF_S6); | |
| 3936 vis_padd16(TMP24, CONST_6, TMP24); | |
| 3937 | |
| 3938 vis_mul8x16al(DST_2, CONST_1024, REF_0); | |
| 3939 vis_padd16(TMP22, TMP26, TMP22); | |
| 3940 | |
| 3941 vis_mul8x16al(DST_3, CONST_1024, REF_2); | |
| 3942 vis_padd16(TMP24, TMP28, TMP24); | |
| 3943 | |
| 3944 vis_mul8x16au(REF_S2, CONST_256, TMP26); | |
| 3945 vis_padd16(TMP8, TMP22, TMP8); | |
| 3946 | |
| 3947 vis_mul8x16au(REF_S2_1, CONST_256, TMP28); | |
| 3948 vis_padd16(TMP10, TMP24, TMP10); | |
| 3949 | |
| 3950 vis_padd16(TMP8, TMP12, TMP8); | |
| 3951 | |
| 3952 vis_padd16(TMP10, TMP14, TMP10); | |
| 3953 | |
| 3954 vis_padd16(TMP8, TMP30, TMP8); | |
| 3955 | |
| 3956 vis_padd16(TMP10, TMP32, TMP10); | |
| 3957 vis_pack16(TMP8, DST_0); | |
| 3958 | |
| 3959 vis_pack16(TMP10, DST_1); | |
| 3960 vis_st64(DST_0, dest[0]); | |
| 3961 dest += stride; | |
| 3962 | |
| 3963 vis_padd16(REF_S4, TMP22, TMP12); | |
| 3964 | |
| 3965 vis_padd16(REF_S6, TMP24, TMP14); | |
| 3966 | |
| 3967 vis_padd16(TMP12, TMP26, TMP12); | |
| 3968 | |
| 3969 vis_padd16(TMP14, TMP28, TMP14); | |
| 3970 | |
| 3971 vis_padd16(TMP12, REF_0, TMP12); | |
| 3972 | |
| 3973 vis_padd16(TMP14, REF_2, TMP14); | |
| 3974 vis_pack16(TMP12, DST_2); | |
| 3975 | |
| 3976 vis_pack16(TMP14, DST_3); | |
| 3977 vis_st64(DST_2, dest[0]); | |
| 3978 dest += stride; | |
| 3979 } while (--height); | |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3980 } |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3981 |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3982 /* End of no rounding code */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3983 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3984 #define ACCEL_SPARC_VIS 1 |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3985 #define ACCEL_SPARC_VIS2 2 |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3986 |
|
8693
18737839ed27
Add missing void keyword to parameterless function declarations.
diego
parents:
8250
diff
changeset
|
3987 static int vis_level(void) |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3988 { |
|
5758
a73ecbffc421
Hopefully fix sparc compilation again, add incorrectly removed variable declaration
reimar
parents:
5757
diff
changeset
|
3989 int accel = 0; |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3990 accel |= ACCEL_SPARC_VIS; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3991 accel |= ACCEL_SPARC_VIS2; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3992 return accel; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3993 } |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3994 |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3995 /* libavcodec initialization code */ |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3996 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx) |
|
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
3997 { |
|
5967
15ed47af1838
Misc spelling fixes, prefer American over British English.
diego
parents:
5963
diff
changeset
|
3998 /* VIS-specific optimizations */ |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
3999 int accel = vis_level (); |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4000 |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4001 if (accel & ACCEL_SPARC_VIS) { |
| 5618 | 4002 if(avctx->idct_algo==FF_IDCT_SIMPLEVIS){ |
| 4003 c->idct_put = ff_simple_idct_put_vis; | |
| 4004 c->idct_add = ff_simple_idct_add_vis; | |
| 4005 c->idct = ff_simple_idct_vis; | |
| 4006 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | |
| 4007 } | |
| 4008 | |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4009 c->put_pixels_tab[0][0] = MC_put_o_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4010 c->put_pixels_tab[0][1] = MC_put_x_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4011 c->put_pixels_tab[0][2] = MC_put_y_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4012 c->put_pixels_tab[0][3] = MC_put_xy_16_vis; |
| 2967 | 4013 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4014 c->put_pixels_tab[1][0] = MC_put_o_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4015 c->put_pixels_tab[1][1] = MC_put_x_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4016 c->put_pixels_tab[1][2] = MC_put_y_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4017 c->put_pixels_tab[1][3] = MC_put_xy_8_vis; |
| 2967 | 4018 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4019 c->avg_pixels_tab[0][0] = MC_avg_o_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4020 c->avg_pixels_tab[0][1] = MC_avg_x_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4021 c->avg_pixels_tab[0][2] = MC_avg_y_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4022 c->avg_pixels_tab[0][3] = MC_avg_xy_16_vis; |
| 2967 | 4023 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4024 c->avg_pixels_tab[1][0] = MC_avg_o_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4025 c->avg_pixels_tab[1][1] = MC_avg_x_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4026 c->avg_pixels_tab[1][2] = MC_avg_y_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4027 c->avg_pixels_tab[1][3] = MC_avg_xy_8_vis; |
| 2967 | 4028 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4029 c->put_no_rnd_pixels_tab[0][0] = MC_put_no_round_o_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4030 c->put_no_rnd_pixels_tab[0][1] = MC_put_no_round_x_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4031 c->put_no_rnd_pixels_tab[0][2] = MC_put_no_round_y_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4032 c->put_no_rnd_pixels_tab[0][3] = MC_put_no_round_xy_16_vis; |
| 2967 | 4033 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4034 c->put_no_rnd_pixels_tab[1][0] = MC_put_no_round_o_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4035 c->put_no_rnd_pixels_tab[1][1] = MC_put_no_round_x_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4036 c->put_no_rnd_pixels_tab[1][2] = MC_put_no_round_y_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4037 c->put_no_rnd_pixels_tab[1][3] = MC_put_no_round_xy_8_vis; |
| 2967 | 4038 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4039 c->avg_no_rnd_pixels_tab[0][0] = MC_avg_no_round_o_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4040 c->avg_no_rnd_pixels_tab[0][1] = MC_avg_no_round_x_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4041 c->avg_no_rnd_pixels_tab[0][2] = MC_avg_no_round_y_16_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4042 c->avg_no_rnd_pixels_tab[0][3] = MC_avg_no_round_xy_16_vis; |
| 2967 | 4043 |
|
1966
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4044 c->avg_no_rnd_pixels_tab[1][0] = MC_avg_no_round_o_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4045 c->avg_no_rnd_pixels_tab[1][1] = MC_avg_no_round_x_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4046 c->avg_no_rnd_pixels_tab[1][2] = MC_avg_no_round_y_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4047 c->avg_no_rnd_pixels_tab[1][3] = MC_avg_no_round_xy_8_vis; |
|
e1fc7c598558
License change and cpu detection patch by (James Morrison <ja2morri at csclub dot uwaterloo dot ca>)
michael
parents:
1959
diff
changeset
|
4048 } |
|
1959
55b7435c59b8
VIS optimized motion compensation code. by (David S. Miller <davem at redhat dot com>)
michael
parents:
diff
changeset
|
4049 } |
