1 /*
2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "vpx_dsp/mips/common_dspr2.h"
12
13 #if HAVE_DSPR2
vpx_h_predictor_16x16_dspr2(uint8_t * dst,ptrdiff_t stride,const uint8_t * above,const uint8_t * left)14 void vpx_h_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
15 const uint8_t *above, const uint8_t *left) {
16 int32_t tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
17 int32_t tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
18
19 __asm__ __volatile__ (
20 "lb %[tmp1], (%[left]) \n\t"
21 "lb %[tmp2], 1(%[left]) \n\t"
22 "lb %[tmp3], 2(%[left]) \n\t"
23 "lb %[tmp4], 3(%[left]) \n\t"
24 "lb %[tmp5], 4(%[left]) \n\t"
25 "lb %[tmp6], 5(%[left]) \n\t"
26 "lb %[tmp7], 6(%[left]) \n\t"
27 "lb %[tmp8], 7(%[left]) \n\t"
28 "lb %[tmp9], 8(%[left]) \n\t"
29 "lb %[tmp10], 9(%[left]) \n\t"
30 "lb %[tmp11], 10(%[left]) \n\t"
31 "lb %[tmp12], 11(%[left]) \n\t"
32 "lb %[tmp13], 12(%[left]) \n\t"
33 "lb %[tmp14], 13(%[left]) \n\t"
34 "lb %[tmp15], 14(%[left]) \n\t"
35 "lb %[tmp16], 15(%[left]) \n\t"
36
37 "replv.qb %[tmp1], %[tmp1] \n\t"
38 "replv.qb %[tmp2], %[tmp2] \n\t"
39 "replv.qb %[tmp3], %[tmp3] \n\t"
40 "replv.qb %[tmp4], %[tmp4] \n\t"
41 "replv.qb %[tmp5], %[tmp5] \n\t"
42 "replv.qb %[tmp6], %[tmp6] \n\t"
43 "replv.qb %[tmp7], %[tmp7] \n\t"
44 "replv.qb %[tmp8], %[tmp8] \n\t"
45 "replv.qb %[tmp9], %[tmp9] \n\t"
46 "replv.qb %[tmp10], %[tmp10] \n\t"
47 "replv.qb %[tmp11], %[tmp11] \n\t"
48 "replv.qb %[tmp12], %[tmp12] \n\t"
49 "replv.qb %[tmp13], %[tmp13] \n\t"
50 "replv.qb %[tmp14], %[tmp14] \n\t"
51 "replv.qb %[tmp15], %[tmp15] \n\t"
52 "replv.qb %[tmp16], %[tmp16] \n\t"
53
54 "sw %[tmp1], (%[dst]) \n\t"
55 "sw %[tmp1], 4(%[dst]) \n\t"
56 "sw %[tmp1], 8(%[dst]) \n\t"
57 "sw %[tmp1], 12(%[dst]) \n\t"
58
59 "add %[dst], %[dst], %[stride] \n\t"
60 "sw %[tmp2], (%[dst]) \n\t"
61 "sw %[tmp2], 4(%[dst]) \n\t"
62 "sw %[tmp2], 8(%[dst]) \n\t"
63 "sw %[tmp2], 12(%[dst]) \n\t"
64
65 "add %[dst], %[dst], %[stride] \n\t"
66 "sw %[tmp3], (%[dst]) \n\t"
67 "sw %[tmp3], 4(%[dst]) \n\t"
68 "sw %[tmp3], 8(%[dst]) \n\t"
69 "sw %[tmp3], 12(%[dst]) \n\t"
70
71 "add %[dst], %[dst], %[stride] \n\t"
72 "sw %[tmp4], (%[dst]) \n\t"
73 "sw %[tmp4], 4(%[dst]) \n\t"
74 "sw %[tmp4], 8(%[dst]) \n\t"
75 "sw %[tmp4], 12(%[dst]) \n\t"
76
77 "add %[dst], %[dst], %[stride] \n\t"
78 "sw %[tmp5], (%[dst]) \n\t"
79 "sw %[tmp5], 4(%[dst]) \n\t"
80 "sw %[tmp5], 8(%[dst]) \n\t"
81 "sw %[tmp5], 12(%[dst]) \n\t"
82
83 "add %[dst], %[dst], %[stride] \n\t"
84 "sw %[tmp6], (%[dst]) \n\t"
85 "sw %[tmp6], 4(%[dst]) \n\t"
86 "sw %[tmp6], 8(%[dst]) \n\t"
87 "sw %[tmp6], 12(%[dst]) \n\t"
88
89 "add %[dst], %[dst], %[stride] \n\t"
90 "sw %[tmp7], (%[dst]) \n\t"
91 "sw %[tmp7], 4(%[dst]) \n\t"
92 "sw %[tmp7], 8(%[dst]) \n\t"
93 "sw %[tmp7], 12(%[dst]) \n\t"
94
95 "add %[dst], %[dst], %[stride] \n\t"
96 "sw %[tmp8], (%[dst]) \n\t"
97 "sw %[tmp8], 4(%[dst]) \n\t"
98 "sw %[tmp8], 8(%[dst]) \n\t"
99 "sw %[tmp8], 12(%[dst]) \n\t"
100
101 "add %[dst], %[dst], %[stride] \n\t"
102 "sw %[tmp9], (%[dst]) \n\t"
103 "sw %[tmp9], 4(%[dst]) \n\t"
104 "sw %[tmp9], 8(%[dst]) \n\t"
105 "sw %[tmp9], 12(%[dst]) \n\t"
106
107 "add %[dst], %[dst], %[stride] \n\t"
108 "sw %[tmp10], (%[dst]) \n\t"
109 "sw %[tmp10], 4(%[dst]) \n\t"
110 "sw %[tmp10], 8(%[dst]) \n\t"
111 "sw %[tmp10], 12(%[dst]) \n\t"
112
113 "add %[dst], %[dst], %[stride] \n\t"
114 "sw %[tmp11], (%[dst]) \n\t"
115 "sw %[tmp11], 4(%[dst]) \n\t"
116 "sw %[tmp11], 8(%[dst]) \n\t"
117 "sw %[tmp11], 12(%[dst]) \n\t"
118
119 "add %[dst], %[dst], %[stride] \n\t"
120 "sw %[tmp12], (%[dst]) \n\t"
121 "sw %[tmp12], 4(%[dst]) \n\t"
122 "sw %[tmp12], 8(%[dst]) \n\t"
123 "sw %[tmp12], 12(%[dst]) \n\t"
124
125 "add %[dst], %[dst], %[stride] \n\t"
126 "sw %[tmp13], (%[dst]) \n\t"
127 "sw %[tmp13], 4(%[dst]) \n\t"
128 "sw %[tmp13], 8(%[dst]) \n\t"
129 "sw %[tmp13], 12(%[dst]) \n\t"
130
131 "add %[dst], %[dst], %[stride] \n\t"
132 "sw %[tmp14], (%[dst]) \n\t"
133 "sw %[tmp14], 4(%[dst]) \n\t"
134 "sw %[tmp14], 8(%[dst]) \n\t"
135 "sw %[tmp14], 12(%[dst]) \n\t"
136
137 "add %[dst], %[dst], %[stride] \n\t"
138 "sw %[tmp15], (%[dst]) \n\t"
139 "sw %[tmp15], 4(%[dst]) \n\t"
140 "sw %[tmp15], 8(%[dst]) \n\t"
141 "sw %[tmp15], 12(%[dst]) \n\t"
142
143 "add %[dst], %[dst], %[stride] \n\t"
144 "sw %[tmp16], (%[dst]) \n\t"
145 "sw %[tmp16], 4(%[dst]) \n\t"
146 "sw %[tmp16], 8(%[dst]) \n\t"
147 "sw %[tmp16], 12(%[dst]) \n\t"
148
149 : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2),
150 [tmp3] "=&r" (tmp3), [tmp4] "=&r" (tmp4),
151 [tmp5] "=&r" (tmp5), [tmp7] "=&r" (tmp7),
152 [tmp6] "=&r" (tmp6), [tmp8] "=&r" (tmp8),
153 [tmp9] "=&r" (tmp9), [tmp10] "=&r" (tmp10),
154 [tmp11] "=&r" (tmp11), [tmp12] "=&r" (tmp12),
155 [tmp13] "=&r" (tmp13), [tmp14] "=&r" (tmp14),
156 [tmp15] "=&r" (tmp15), [tmp16] "=&r" (tmp16)
157 : [left] "r" (left), [dst] "r" (dst), [stride] "r" (stride)
158 );
159 }
160
vpx_dc_predictor_16x16_dspr2(uint8_t * dst,ptrdiff_t stride,const uint8_t * above,const uint8_t * left)161 void vpx_dc_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
162 const uint8_t *above, const uint8_t *left) {
163 int32_t expected_dc;
164 int32_t average;
165 int32_t tmp, above1, above_l1, above_r1, left1, left_r1, left_l1;
166 int32_t above2, left2;
167
168 __asm__ __volatile__ (
169 "lw %[above1], (%[above]) \n\t"
170 "lw %[above2], 4(%[above]) \n\t"
171 "lw %[left1], (%[left]) \n\t"
172 "lw %[left2], 4(%[left]) \n\t"
173
174 "preceu.ph.qbl %[above_l1], %[above1] \n\t"
175 "preceu.ph.qbr %[above_r1], %[above1] \n\t"
176 "preceu.ph.qbl %[left_l1], %[left1] \n\t"
177 "preceu.ph.qbr %[left_r1], %[left1] \n\t"
178
179 "addu.ph %[average], %[above_r1], %[above_l1] \n\t"
180 "addu.ph %[average], %[average], %[left_l1] \n\t"
181 "addu.ph %[average], %[average], %[left_r1] \n\t"
182
183 "preceu.ph.qbl %[above_l1], %[above2] \n\t"
184 "preceu.ph.qbr %[above_r1], %[above2] \n\t"
185 "preceu.ph.qbl %[left_l1], %[left2] \n\t"
186 "preceu.ph.qbr %[left_r1], %[left2] \n\t"
187
188 "addu.ph %[average], %[average], %[above_l1] \n\t"
189 "addu.ph %[average], %[average], %[above_r1] \n\t"
190 "addu.ph %[average], %[average], %[left_l1] \n\t"
191 "addu.ph %[average], %[average], %[left_r1] \n\t"
192
193 "lw %[above1], 8(%[above]) \n\t"
194 "lw %[above2], 12(%[above]) \n\t"
195 "lw %[left1], 8(%[left]) \n\t"
196 "lw %[left2], 12(%[left]) \n\t"
197
198 "preceu.ph.qbl %[above_l1], %[above1] \n\t"
199 "preceu.ph.qbr %[above_r1], %[above1] \n\t"
200 "preceu.ph.qbl %[left_l1], %[left1] \n\t"
201 "preceu.ph.qbr %[left_r1], %[left1] \n\t"
202
203 "addu.ph %[average], %[average], %[above_l1] \n\t"
204 "addu.ph %[average], %[average], %[above_r1] \n\t"
205 "addu.ph %[average], %[average], %[left_l1] \n\t"
206 "addu.ph %[average], %[average], %[left_r1] \n\t"
207
208 "preceu.ph.qbl %[above_l1], %[above2] \n\t"
209 "preceu.ph.qbr %[above_r1], %[above2] \n\t"
210 "preceu.ph.qbl %[left_l1], %[left2] \n\t"
211 "preceu.ph.qbr %[left_r1], %[left2] \n\t"
212
213 "addu.ph %[average], %[average], %[above_l1] \n\t"
214 "addu.ph %[average], %[average], %[above_r1] \n\t"
215 "addu.ph %[average], %[average], %[left_l1] \n\t"
216 "addu.ph %[average], %[average], %[left_r1] \n\t"
217
218 "addiu %[average], %[average], 16 \n\t"
219 "srl %[tmp], %[average], 16 \n\t"
220 "addu.ph %[average], %[tmp], %[average] \n\t"
221 "srl %[expected_dc], %[average], 5 \n\t"
222 "replv.qb %[expected_dc], %[expected_dc] \n\t"
223
224 "sw %[expected_dc], (%[dst]) \n\t"
225 "sw %[expected_dc], 4(%[dst]) \n\t"
226 "sw %[expected_dc], 8(%[dst]) \n\t"
227 "sw %[expected_dc], 12(%[dst]) \n\t"
228
229 "add %[dst], %[dst], %[stride] \n\t"
230 "sw %[expected_dc], (%[dst]) \n\t"
231 "sw %[expected_dc], 4(%[dst]) \n\t"
232 "sw %[expected_dc], 8(%[dst]) \n\t"
233 "sw %[expected_dc], 12(%[dst]) \n\t"
234
235 "add %[dst], %[dst], %[stride] \n\t"
236 "sw %[expected_dc], (%[dst]) \n\t"
237 "sw %[expected_dc], 4(%[dst]) \n\t"
238 "sw %[expected_dc], 8(%[dst]) \n\t"
239 "sw %[expected_dc], 12(%[dst]) \n\t"
240
241 "add %[dst], %[dst], %[stride] \n\t"
242 "sw %[expected_dc], (%[dst]) \n\t"
243 "sw %[expected_dc], 4(%[dst]) \n\t"
244 "sw %[expected_dc], 8(%[dst]) \n\t"
245 "sw %[expected_dc], 12(%[dst]) \n\t"
246
247 "add %[dst], %[dst], %[stride] \n\t"
248 "sw %[expected_dc], (%[dst]) \n\t"
249 "sw %[expected_dc], 4(%[dst]) \n\t"
250 "sw %[expected_dc], 8(%[dst]) \n\t"
251 "sw %[expected_dc], 12(%[dst]) \n\t"
252
253 "add %[dst], %[dst], %[stride] \n\t"
254 "sw %[expected_dc], (%[dst]) \n\t"
255 "sw %[expected_dc], 4(%[dst]) \n\t"
256 "sw %[expected_dc], 8(%[dst]) \n\t"
257 "sw %[expected_dc], 12(%[dst]) \n\t"
258
259 "add %[dst], %[dst], %[stride] \n\t"
260 "sw %[expected_dc], (%[dst]) \n\t"
261 "sw %[expected_dc], 4(%[dst]) \n\t"
262 "sw %[expected_dc], 8(%[dst]) \n\t"
263 "sw %[expected_dc], 12(%[dst]) \n\t"
264
265 "add %[dst], %[dst], %[stride] \n\t"
266 "sw %[expected_dc], (%[dst]) \n\t"
267 "sw %[expected_dc], 4(%[dst]) \n\t"
268 "sw %[expected_dc], 8(%[dst]) \n\t"
269 "sw %[expected_dc], 12(%[dst]) \n\t"
270
271 "add %[dst], %[dst], %[stride] \n\t"
272 "sw %[expected_dc], (%[dst]) \n\t"
273 "sw %[expected_dc], 4(%[dst]) \n\t"
274 "sw %[expected_dc], 8(%[dst]) \n\t"
275 "sw %[expected_dc], 12(%[dst]) \n\t"
276
277 "add %[dst], %[dst], %[stride] \n\t"
278 "sw %[expected_dc], (%[dst]) \n\t"
279 "sw %[expected_dc], 4(%[dst]) \n\t"
280 "sw %[expected_dc], 8(%[dst]) \n\t"
281 "sw %[expected_dc], 12(%[dst]) \n\t"
282
283 "add %[dst], %[dst], %[stride] \n\t"
284 "sw %[expected_dc], (%[dst]) \n\t"
285 "sw %[expected_dc], 4(%[dst]) \n\t"
286 "sw %[expected_dc], 8(%[dst]) \n\t"
287 "sw %[expected_dc], 12(%[dst]) \n\t"
288
289 "add %[dst], %[dst], %[stride] \n\t"
290 "sw %[expected_dc], (%[dst]) \n\t"
291 "sw %[expected_dc], 4(%[dst]) \n\t"
292 "sw %[expected_dc], 8(%[dst]) \n\t"
293 "sw %[expected_dc], 12(%[dst]) \n\t"
294
295 "add %[dst], %[dst], %[stride] \n\t"
296 "sw %[expected_dc], (%[dst]) \n\t"
297 "sw %[expected_dc], 4(%[dst]) \n\t"
298 "sw %[expected_dc], 8(%[dst]) \n\t"
299 "sw %[expected_dc], 12(%[dst]) \n\t"
300
301 "add %[dst], %[dst], %[stride] \n\t"
302 "sw %[expected_dc], (%[dst]) \n\t"
303 "sw %[expected_dc], 4(%[dst]) \n\t"
304 "sw %[expected_dc], 8(%[dst]) \n\t"
305 "sw %[expected_dc], 12(%[dst]) \n\t"
306
307 "add %[dst], %[dst], %[stride] \n\t"
308 "sw %[expected_dc], (%[dst]) \n\t"
309 "sw %[expected_dc], 4(%[dst]) \n\t"
310 "sw %[expected_dc], 8(%[dst]) \n\t"
311 "sw %[expected_dc], 12(%[dst]) \n\t"
312
313 "add %[dst], %[dst], %[stride] \n\t"
314 "sw %[expected_dc], (%[dst]) \n\t"
315 "sw %[expected_dc], 4(%[dst]) \n\t"
316 "sw %[expected_dc], 8(%[dst]) \n\t"
317 "sw %[expected_dc], 12(%[dst]) \n\t"
318
319 : [left1] "=&r" (left1), [above1] "=&r" (above1),
320 [left_l1] "=&r" (left_l1), [above_l1] "=&r" (above_l1),
321 [left_r1] "=&r" (left_r1), [above_r1] "=&r" (above_r1),
322 [above2] "=&r" (above2), [left2] "=&r" (left2),
323 [average] "=&r" (average), [tmp] "=&r" (tmp),
324 [expected_dc] "=&r" (expected_dc)
325 : [above] "r" (above), [left] "r" (left),
326 [dst] "r" (dst), [stride] "r" (stride)
327 );
328 }
329 #endif // #if HAVE_DSPR2
330