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