2 * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "libavutil/mips/generic_macros_msa.h"
22 #include "libavcodec/mips/hevcdsp_mips.h"
23 #include "libavcodec/mips/hevc_macros_msa.h"
25 static void copy_width8_msa(uint8_t *src, int32_t src_stride,
26 uint8_t *dst, int32_t dst_stride,
30 uint64_t out0, out1, out2, out3, out4, out5, out6, out7;
31 v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
33 if (0 == height % 12) {
34 for (cnt = (height / 12); cnt--;) {
35 LD_UB8(src, src_stride,
36 src0, src1, src2, src3, src4, src5, src6, src7);
37 src += (8 * src_stride);
39 out0 = __msa_copy_u_d((v2i64) src0, 0);
40 out1 = __msa_copy_u_d((v2i64) src1, 0);
41 out2 = __msa_copy_u_d((v2i64) src2, 0);
42 out3 = __msa_copy_u_d((v2i64) src3, 0);
43 out4 = __msa_copy_u_d((v2i64) src4, 0);
44 out5 = __msa_copy_u_d((v2i64) src5, 0);
45 out6 = __msa_copy_u_d((v2i64) src6, 0);
46 out7 = __msa_copy_u_d((v2i64) src7, 0);
48 SD4(out0, out1, out2, out3, dst, dst_stride);
49 dst += (4 * dst_stride);
50 SD4(out4, out5, out6, out7, dst, dst_stride);
51 dst += (4 * dst_stride);
53 LD_UB4(src, src_stride, src0, src1, src2, src3);
54 src += (4 * src_stride);
56 out0 = __msa_copy_u_d((v2i64) src0, 0);
57 out1 = __msa_copy_u_d((v2i64) src1, 0);
58 out2 = __msa_copy_u_d((v2i64) src2, 0);
59 out3 = __msa_copy_u_d((v2i64) src3, 0);
61 SD4(out0, out1, out2, out3, dst, dst_stride);
62 dst += (4 * dst_stride);
64 } else if (0 == height % 8) {
65 for (cnt = height >> 3; cnt--;) {
66 LD_UB8(src, src_stride,
67 src0, src1, src2, src3, src4, src5, src6, src7);
68 src += (8 * src_stride);
70 out0 = __msa_copy_u_d((v2i64) src0, 0);
71 out1 = __msa_copy_u_d((v2i64) src1, 0);
72 out2 = __msa_copy_u_d((v2i64) src2, 0);
73 out3 = __msa_copy_u_d((v2i64) src3, 0);
74 out4 = __msa_copy_u_d((v2i64) src4, 0);
75 out5 = __msa_copy_u_d((v2i64) src5, 0);
76 out6 = __msa_copy_u_d((v2i64) src6, 0);
77 out7 = __msa_copy_u_d((v2i64) src7, 0);
79 SD4(out0, out1, out2, out3, dst, dst_stride);
80 dst += (4 * dst_stride);
81 SD4(out4, out5, out6, out7, dst, dst_stride);
82 dst += (4 * dst_stride);
84 } else if (0 == height % 4) {
85 for (cnt = (height / 4); cnt--;) {
86 LD_UB4(src, src_stride, src0, src1, src2, src3);
87 src += (4 * src_stride);
88 out0 = __msa_copy_u_d((v2i64) src0, 0);
89 out1 = __msa_copy_u_d((v2i64) src1, 0);
90 out2 = __msa_copy_u_d((v2i64) src2, 0);
91 out3 = __msa_copy_u_d((v2i64) src3, 0);
93 SD4(out0, out1, out2, out3, dst, dst_stride);
94 dst += (4 * dst_stride);
96 } else if (0 == height % 2) {
97 for (cnt = (height / 2); cnt--;) {
98 LD_UB2(src, src_stride, src0, src1);
99 src += (2 * src_stride);
100 out0 = __msa_copy_u_d((v2i64) src0, 0);
101 out1 = __msa_copy_u_d((v2i64) src1, 0);
111 static void copy_width12_msa(uint8_t *src, int32_t src_stride,
112 uint8_t *dst, int32_t dst_stride,
115 v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
117 LD_UB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6, src7);
118 src += (8 * src_stride);
119 ST12x8_UB(src0, src1, src2, src3, src4, src5, src6, src7, dst, dst_stride);
120 dst += (8 * dst_stride);
121 LD_UB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6, src7);
122 ST12x8_UB(src0, src1, src2, src3, src4, src5, src6, src7, dst, dst_stride);
125 static void copy_16multx8mult_msa(uint8_t *src, int32_t src_stride,
126 uint8_t *dst, int32_t dst_stride,
127 int32_t height, int32_t width)
129 int32_t cnt, loop_cnt;
130 uint8_t *src_tmp, *dst_tmp;
131 v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
133 for (cnt = (width >> 4); cnt--;) {
137 for (loop_cnt = (height >> 3); loop_cnt--;) {
138 LD_UB8(src_tmp, src_stride,
139 src0, src1, src2, src3, src4, src5, src6, src7);
140 src_tmp += (8 * src_stride);
142 ST_UB8(src0, src1, src2, src3, src4, src5, src6, src7,
143 dst_tmp, dst_stride);
144 dst_tmp += (8 * dst_stride);
152 static void copy_width16_msa(uint8_t *src, int32_t src_stride,
153 uint8_t *dst, int32_t dst_stride,
157 v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
159 if (0 == height % 12) {
160 for (cnt = (height / 12); cnt--;) {
161 LD_UB8(src, src_stride,
162 src0, src1, src2, src3, src4, src5, src6, src7);
163 src += (8 * src_stride);
164 ST_UB8(src0, src1, src2, src3, src4, src5, src6, src7,
166 dst += (8 * dst_stride);
168 LD_UB4(src, src_stride, src0, src1, src2, src3);
169 src += (4 * src_stride);
170 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
171 dst += (4 * dst_stride);
173 } else if (0 == height % 8) {
174 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 16);
175 } else if (0 == height % 4) {
176 for (cnt = (height >> 2); cnt--;) {
177 LD_UB4(src, src_stride, src0, src1, src2, src3);
178 src += (4 * src_stride);
180 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
181 dst += (4 * dst_stride);
186 static void copy_width24_msa(uint8_t *src, int32_t src_stride,
187 uint8_t *dst, int32_t dst_stride,
190 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 16);
191 copy_width8_msa(src + 16, src_stride, dst + 16, dst_stride, height);
194 static void copy_width32_msa(uint8_t *src, int32_t src_stride,
195 uint8_t *dst, int32_t dst_stride,
199 v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
201 if (0 == height % 12) {
202 for (cnt = (height / 12); cnt--;) {
203 LD_UB4(src, src_stride, src0, src1, src2, src3);
204 LD_UB4(src + 16, src_stride, src4, src5, src6, src7);
205 src += (4 * src_stride);
206 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
207 ST_UB4(src4, src5, src6, src7, dst + 16, dst_stride);
208 dst += (4 * dst_stride);
210 LD_UB4(src, src_stride, src0, src1, src2, src3);
211 LD_UB4(src + 16, src_stride, src4, src5, src6, src7);
212 src += (4 * src_stride);
213 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
214 ST_UB4(src4, src5, src6, src7, dst + 16, dst_stride);
215 dst += (4 * dst_stride);
217 LD_UB4(src, src_stride, src0, src1, src2, src3);
218 LD_UB4(src + 16, src_stride, src4, src5, src6, src7);
219 src += (4 * src_stride);
220 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
221 ST_UB4(src4, src5, src6, src7, dst + 16, dst_stride);
222 dst += (4 * dst_stride);
224 } else if (0 == height % 8) {
225 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 32);
226 } else if (0 == height % 4) {
227 for (cnt = (height >> 2); cnt--;) {
228 LD_UB4(src, src_stride, src0, src1, src2, src3);
229 LD_UB4(src + 16, src_stride, src4, src5, src6, src7);
230 src += (4 * src_stride);
231 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
232 ST_UB4(src4, src5, src6, src7, dst + 16, dst_stride);
233 dst += (4 * dst_stride);
238 static void copy_width48_msa(uint8_t *src, int32_t src_stride,
239 uint8_t *dst, int32_t dst_stride,
242 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 48);
245 static void copy_width64_msa(uint8_t *src, int32_t src_stride,
246 uint8_t *dst, int32_t dst_stride,
249 copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 64);
252 uint8_t mc_filt_mask_arr[16 * 3] = {
254 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8,
256 0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20,
258 8, 9, 9, 10, 10, 11, 11, 12, 24, 25, 25, 26, 26, 27, 27, 28
261 #define FILT_8TAP_DPADD_S_H(vec0, vec1, vec2, vec3, \
262 filt0, filt1, filt2, filt3) \
266 tmp0 = __msa_dotp_s_h((v16i8) vec0, (v16i8) filt0); \
267 tmp0 = __msa_dpadd_s_h(tmp0, (v16i8) vec1, (v16i8) filt1); \
268 tmp1 = __msa_dotp_s_h((v16i8) vec2, (v16i8) filt2); \
269 tmp1 = __msa_dpadd_s_h(tmp1, (v16i8) vec3, (v16i8) filt3); \
270 tmp0 = __msa_adds_s_h(tmp0, tmp1); \
275 #define HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, \
276 mask0, mask1, mask2, mask3, \
277 filt0, filt1, filt2, filt3, \
280 v16i8 vec0_m, vec1_m, vec2_m, vec3_m, vec4_m, vec5_m, vec6_m, vec7_m; \
281 v8i16 res0_m, res1_m, res2_m, res3_m; \
283 VSHF_B2_SB(src0, src1, src2, src3, mask0, mask0, vec0_m, vec1_m); \
284 DOTP_SB2_SH(vec0_m, vec1_m, filt0, filt0, res0_m, res1_m); \
285 VSHF_B2_SB(src0, src1, src2, src3, mask1, mask1, vec2_m, vec3_m); \
286 DPADD_SB2_SH(vec2_m, vec3_m, filt1, filt1, res0_m, res1_m); \
287 VSHF_B2_SB(src0, src1, src2, src3, mask2, mask2, vec4_m, vec5_m); \
288 DOTP_SB2_SH(vec4_m, vec5_m, filt2, filt2, res2_m, res3_m); \
289 VSHF_B2_SB(src0, src1, src2, src3, mask3, mask3, vec6_m, vec7_m); \
290 DPADD_SB2_SH(vec6_m, vec7_m, filt3, filt3, res2_m, res3_m); \
291 ADDS_SH2_SH(res0_m, res2_m, res1_m, res3_m, out0, out1); \
294 #define HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, \
295 mask0, mask1, mask2, mask3, \
296 filt0, filt1, filt2, filt3, \
297 out0, out1, out2, out3) \
299 v16i8 vec0_m, vec1_m, vec2_m, vec3_m, vec4_m, vec5_m, vec6_m, vec7_m; \
300 v8i16 res0_m, res1_m, res2_m, res3_m, res4_m, res5_m, res6_m, res7_m; \
302 VSHF_B2_SB(src0, src0, src1, src1, mask0, mask0, vec0_m, vec1_m); \
303 VSHF_B2_SB(src2, src2, src3, src3, mask0, mask0, vec2_m, vec3_m); \
304 DOTP_SB4_SH(vec0_m, vec1_m, vec2_m, vec3_m, filt0, filt0, filt0, filt0, \
305 res0_m, res1_m, res2_m, res3_m); \
306 VSHF_B2_SB(src0, src0, src1, src1, mask2, mask2, vec0_m, vec1_m); \
307 VSHF_B2_SB(src2, src2, src3, src3, mask2, mask2, vec2_m, vec3_m); \
308 DOTP_SB4_SH(vec0_m, vec1_m, vec2_m, vec3_m, filt2, filt2, filt2, filt2, \
309 res4_m, res5_m, res6_m, res7_m); \
310 VSHF_B2_SB(src0, src0, src1, src1, mask1, mask1, vec4_m, vec5_m); \
311 VSHF_B2_SB(src2, src2, src3, src3, mask1, mask1, vec6_m, vec7_m); \
312 DPADD_SB4_SH(vec4_m, vec5_m, vec6_m, vec7_m, filt1, filt1, filt1, filt1, \
313 res0_m, res1_m, res2_m, res3_m); \
314 VSHF_B2_SB(src0, src0, src1, src1, mask3, mask3, vec4_m, vec5_m); \
315 VSHF_B2_SB(src2, src2, src3, src3, mask3, mask3, vec6_m, vec7_m); \
316 DPADD_SB4_SH(vec4_m, vec5_m, vec6_m, vec7_m, filt3, filt3, filt3, filt3, \
317 res4_m, res5_m, res6_m, res7_m); \
318 ADDS_SH4_SH(res0_m, res4_m, res1_m, res5_m, res2_m, res6_m, res3_m, \
319 res7_m, out0, out1, out2, out3); \
322 static void common_hz_8t_4x4_msa(uint8_t *src, int32_t src_stride,
323 uint8_t *dst, int32_t dst_stride,
324 const int8_t *filter, uint8_t rnd_val)
326 v16u8 mask0, mask1, mask2, mask3, out;
327 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
328 v8i16 filt, out0, out1;
331 mask0 = LD_UB(&mc_filt_mask_arr[16]);
333 rnd_vec = __msa_fill_h(rnd_val);
335 /* rearranging filter */
336 filt = LD_SH(filter);
337 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
343 LD_SB4(src, src_stride, src0, src1, src2, src3);
344 XORI_B4_128_SB(src0, src1, src2, src3);
345 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
346 mask3, filt0, filt1, filt2, filt3, out0, out1);
347 SRAR_H2_SH(out0, out1, rnd_vec);
348 SAT_SH2_SH(out0, out1, 7);
349 out = PCKEV_XORI128_UB(out0, out1);
350 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
353 static void common_hz_8t_4x8_msa(uint8_t *src, int32_t src_stride,
354 uint8_t *dst, int32_t dst_stride,
355 const int8_t *filter, uint8_t rnd_val)
357 v16i8 filt0, filt1, filt2, filt3;
358 v16i8 src0, src1, src2, src3;
359 v16u8 mask0, mask1, mask2, mask3, out;
360 v8i16 filt, out0, out1, out2, out3;
363 mask0 = LD_UB(&mc_filt_mask_arr[16]);
365 rnd_vec = __msa_fill_h(rnd_val);
367 /* rearranging filter */
368 filt = LD_SH(filter);
369 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
375 LD_SB4(src, src_stride, src0, src1, src2, src3);
376 XORI_B4_128_SB(src0, src1, src2, src3);
377 src += (4 * src_stride);
378 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
379 mask3, filt0, filt1, filt2, filt3, out0, out1);
380 LD_SB4(src, src_stride, src0, src1, src2, src3);
381 XORI_B4_128_SB(src0, src1, src2, src3);
382 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
383 mask3, filt0, filt1, filt2, filt3, out2, out3);
384 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
385 SAT_SH4_SH(out0, out1, out2, out3, 7);
386 out = PCKEV_XORI128_UB(out0, out1);
387 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
388 dst += (4 * dst_stride);
389 out = PCKEV_XORI128_UB(out2, out3);
390 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
393 static void common_hz_8t_4x16_msa(uint8_t *src, int32_t src_stride,
394 uint8_t *dst, int32_t dst_stride,
395 const int8_t *filter, uint8_t rnd_val)
397 v16u8 mask0, mask1, mask2, mask3, out;
398 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
399 v8i16 filt, out0, out1, out2, out3;
402 mask0 = LD_UB(&mc_filt_mask_arr[16]);
404 rnd_vec = __msa_fill_h(rnd_val);
406 /* rearranging filter */
407 filt = LD_SH(filter);
408 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
414 LD_SB4(src, src_stride, src0, src1, src2, src3);
415 XORI_B4_128_SB(src0, src1, src2, src3);
416 src += (4 * src_stride);
417 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
418 mask3, filt0, filt1, filt2, filt3, out0, out1);
419 LD_SB4(src, src_stride, src0, src1, src2, src3);
420 XORI_B4_128_SB(src0, src1, src2, src3);
421 src += (4 * src_stride);
422 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
423 mask3, filt0, filt1, filt2, filt3, out2, out3);
424 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
425 SAT_SH4_SH(out0, out1, out2, out3, 7);
426 out = PCKEV_XORI128_UB(out0, out1);
427 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
428 dst += (4 * dst_stride);
429 out = PCKEV_XORI128_UB(out2, out3);
430 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
431 dst += (4 * dst_stride);
433 LD_SB4(src, src_stride, src0, src1, src2, src3);
434 XORI_B4_128_SB(src0, src1, src2, src3);
435 src += (4 * src_stride);
436 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
437 mask3, filt0, filt1, filt2, filt3, out0, out1);
438 LD_SB4(src, src_stride, src0, src1, src2, src3);
439 XORI_B4_128_SB(src0, src1, src2, src3);
440 src += (4 * src_stride);
441 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
442 mask3, filt0, filt1, filt2, filt3, out2, out3);
444 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
445 SAT_SH4_SH(out0, out1, out2, out3, 7);
446 out = PCKEV_XORI128_UB(out0, out1);
447 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
448 dst += (4 * dst_stride);
449 out = PCKEV_XORI128_UB(out2, out3);
450 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
453 static void common_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
454 uint8_t *dst, int32_t dst_stride,
455 const int8_t *filter, int32_t height, uint8_t rnd_val)
458 common_hz_8t_4x4_msa(src, src_stride, dst, dst_stride, filter, rnd_val);
459 } else if (8 == height) {
460 common_hz_8t_4x8_msa(src, src_stride, dst, dst_stride, filter, rnd_val);
461 } else if (16 == height) {
462 common_hz_8t_4x16_msa(src, src_stride, dst, dst_stride, filter,
467 static void common_hz_8t_8x4_msa(uint8_t *src, int32_t src_stride,
468 uint8_t *dst, int32_t dst_stride,
469 const int8_t *filter, uint8_t rnd_val)
471 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
472 v16u8 mask0, mask1, mask2, mask3, tmp0, tmp1;
473 v8i16 filt, out0, out1, out2, out3;
476 mask0 = LD_UB(&mc_filt_mask_arr[0]);
478 rnd_vec = __msa_fill_h(rnd_val);
480 /* rearranging filter */
481 filt = LD_SH(filter);
482 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
488 LD_SB4(src, src_stride, src0, src1, src2, src3);
489 XORI_B4_128_SB(src0, src1, src2, src3);
490 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
491 mask3, filt0, filt1, filt2, filt3, out0, out1,
493 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
494 SAT_SH4_SH(out0, out1, out2, out3, 7);
495 tmp0 = PCKEV_XORI128_UB(out0, out1);
496 tmp1 = PCKEV_XORI128_UB(out2, out3);
497 ST8x4_UB(tmp0, tmp1, dst, dst_stride);
500 static void common_hz_8t_8x8mult_msa(uint8_t *src, int32_t src_stride,
501 uint8_t *dst, int32_t dst_stride,
502 const int8_t *filter, int32_t height,
506 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
507 v16u8 mask0, mask1, mask2, mask3, tmp0, tmp1;
508 v8i16 filt, out0, out1, out2, out3;
511 mask0 = LD_UB(&mc_filt_mask_arr[0]);
513 rnd_vec = __msa_fill_h(rnd_val);
515 /* rearranging filter */
516 filt = LD_SH(filter);
517 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
523 for (loop_cnt = (height >> 2); loop_cnt--;) {
524 LD_SB4(src, src_stride, src0, src1, src2, src3);
525 XORI_B4_128_SB(src0, src1, src2, src3);
526 src += (4 * src_stride);
527 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
528 mask3, filt0, filt1, filt2, filt3, out0,
530 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
531 SAT_SH4_SH(out0, out1, out2, out3, 7);
532 tmp0 = PCKEV_XORI128_UB(out0, out1);
533 tmp1 = PCKEV_XORI128_UB(out2, out3);
534 ST8x4_UB(tmp0, tmp1, dst, dst_stride);
535 dst += (4 * dst_stride);
539 static void common_hz_8t_8w_msa(uint8_t *src, int32_t src_stride,
540 uint8_t *dst, int32_t dst_stride,
541 const int8_t *filter, int32_t height,
545 common_hz_8t_8x4_msa(src, src_stride, dst, dst_stride, filter, rnd_val);
547 common_hz_8t_8x8mult_msa(src, src_stride, dst, dst_stride, filter,
552 static void common_hz_8t_12w_msa(uint8_t *src, int32_t src_stride,
553 uint8_t *dst, int32_t dst_stride,
554 const int8_t *filter, int32_t height,
557 uint8_t *src1_ptr, *dst1;
559 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
560 v8i16 filt, out0, out1, out2, out3;
561 v16u8 mask0, mask1, mask2, mask3, mask4, mask5, mask6, mask00, tmp0, tmp1;
564 mask00 = LD_UB(&mc_filt_mask_arr[0]);
565 mask0 = LD_UB(&mc_filt_mask_arr[16]);
566 rnd_vec = __msa_fill_h(rnd_val);
574 /* rearranging filter */
575 filt = LD_SH(filter);
576 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
585 for (loop_cnt = (height >> 2); loop_cnt--;) {
587 LD_SB4(src1_ptr, src_stride, src0, src1, src2, src3);
588 XORI_B4_128_SB(src0, src1, src2, src3);
589 src1_ptr += (4 * src_stride);
590 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask00, mask1, mask2,
591 mask3, filt0, filt1, filt2, filt3, out0,
593 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
594 SAT_SH4_SH(out0, out1, out2, out3, 7);
595 tmp0 = PCKEV_XORI128_UB(out0, out1);
596 tmp1 = PCKEV_XORI128_UB(out2, out3);
597 ST8x4_UB(tmp0, tmp1, dst1, dst_stride);
598 dst1 += (4 * dst_stride);
601 LD_SB4(src, src_stride, src0, src1, src2, src3);
602 XORI_B4_128_SB(src0, src1, src2, src3);
603 src += (4 * src_stride);
604 HORIZ_8TAP_4WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask4, mask5,
605 mask6, filt0, filt1, filt2, filt3, out0,
607 SRAR_H2_SH(out0, out1, rnd_vec);
608 SAT_SH2_SH(out0, out1, 7);
609 tmp0 = PCKEV_XORI128_UB(out0, out1);
610 ST4x4_UB(tmp0, tmp0, 0, 1, 2, 3, dst, dst_stride);
611 dst += (4 * dst_stride);
615 static void common_hz_8t_16w_msa(uint8_t *src, int32_t src_stride,
616 uint8_t *dst, int32_t dst_stride,
617 const int8_t *filter, int32_t height,
621 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
622 v16u8 mask0, mask1, mask2, mask3, out;
623 v8i16 filt, out0, out1, out2, out3;
626 mask0 = LD_UB(&mc_filt_mask_arr[0]);
628 rnd_vec = __msa_fill_h(rnd_val);
630 /* rearranging filter */
631 filt = LD_SH(filter);
632 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
638 for (loop_cnt = (height >> 1); loop_cnt--;) {
639 LD_SB2(src, src_stride, src0, src2);
640 LD_SB2(src + 8, src_stride, src1, src3);
641 XORI_B4_128_SB(src0, src1, src2, src3);
642 src += (2 * src_stride);
643 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
644 mask3, filt0, filt1, filt2, filt3, out0,
646 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
647 SAT_SH4_SH(out0, out1, out2, out3, 7);
648 out = PCKEV_XORI128_UB(out0, out1);
651 out = PCKEV_XORI128_UB(out2, out3);
657 static void common_hz_8t_24w_msa(uint8_t *src, int32_t src_stride,
658 uint8_t *dst, int32_t dst_stride,
659 const int8_t *filter, int32_t height,
663 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
664 v16u8 mask0, mask1, mask2, mask3, mask4, mask5, mask6, mask7, out;
665 v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, vec9, vec10;
667 v8i16 out0, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10;
671 mask0 = LD_UB(&mc_filt_mask_arr[0]);
673 rnd_vec = __msa_fill_h(rnd_val);
675 /* rearranging filter */
676 filt = LD_SH(filter);
677 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
687 for (loop_cnt = (height >> 1); loop_cnt--;) {
688 LD_SB2(src, src_stride, src0, src2);
689 LD_SB2(src + 16, src_stride, src1, src3);
690 XORI_B4_128_SB(src0, src1, src2, src3);
691 src += (2 * src_stride);
692 VSHF_B2_SB(src0, src0, src1, src1, mask0, mask0, vec0, vec8);
693 VSHF_B2_SB(src2, src2, src3, src3, mask0, mask0, vec2, vec9);
694 VSHF_B2_SB(src0, src1, src2, src3, mask4, mask4, vec1, vec3);
695 DOTP_SB4_SH(vec0, vec8, vec2, vec9, filt0, filt0, filt0, filt0, out0,
697 DOTP_SB2_SH(vec1, vec3, filt0, filt0, out1, out3);
698 VSHF_B2_SB(src0, src0, src1, src1, mask2, mask2, vec0, vec8);
699 VSHF_B2_SB(src2, src2, src3, src3, mask2, mask2, vec2, vec9);
700 VSHF_B2_SB(src0, src1, src2, src3, mask6, mask6, vec1, vec3);
701 DOTP_SB4_SH(vec0, vec8, vec2, vec9, filt2, filt2, filt2, filt2, out4,
703 DOTP_SB2_SH(vec1, vec3, filt2, filt2, out5, out7);
704 VSHF_B2_SB(src0, src0, src1, src1, mask1, mask1, vec4, vec10);
705 VSHF_B2_SB(src2, src2, src3, src3, mask1, mask1, vec6, vec11);
706 VSHF_B2_SB(src0, src1, src2, src3, mask5, mask5, vec5, vec7);
707 DPADD_SB4_SH(vec4, vec10, vec6, vec11, filt1, filt1, filt1, filt1,
708 out0, out8, out2, out9);
709 DPADD_SB2_SH(vec5, vec7, filt1, filt1, out1, out3);
710 VSHF_B2_SB(src0, src0, src1, src1, mask3, mask3, vec4, vec10);
711 VSHF_B2_SB(src2, src2, src3, src3, mask3, mask3, vec6, vec11);
712 VSHF_B2_SB(src0, src1, src2, src3, mask7, mask7, vec5, vec7);
713 DPADD_SB4_SH(vec4, vec10, vec6, vec11, filt3, filt3, filt3, filt3,
714 out4, out10, out6, out11);
715 DPADD_SB2_SH(vec5, vec7, filt3, filt3, out5, out7);
716 ADDS_SH4_SH(out0, out4, out8, out10, out2, out6, out9, out11, out0,
718 ADDS_SH2_SH(out1, out5, out3, out7, out1, out3);
719 SRAR_H4_SH(out0, out8, out2, out9, rnd_vec);
720 SRAR_H2_SH(out1, out3, rnd_vec);
721 SAT_SH4_SH(out0, out8, out2, out9, 7);
722 SAT_SH2_SH(out1, out3, 7);
723 out = PCKEV_XORI128_UB(out8, out9);
724 ST8x2_UB(out, dst + 16, dst_stride);
725 out = PCKEV_XORI128_UB(out0, out1);
728 out = PCKEV_XORI128_UB(out2, out3);
734 static void common_hz_8t_32w_msa(uint8_t *src, int32_t src_stride,
735 uint8_t *dst, int32_t dst_stride,
736 const int8_t *filter, int32_t height,
740 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
741 v16u8 mask0, mask1, mask2, mask3, out;
742 v8i16 filt, out0, out1, out2, out3;
745 mask0 = LD_UB(&mc_filt_mask_arr[0]);
747 rnd_vec = __msa_fill_h(rnd_val);
749 /* rearranging filter */
750 filt = LD_SH(filter);
751 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
757 for (loop_cnt = (height >> 1); loop_cnt--;) {
759 src2 = LD_SB(src + 16);
760 src3 = LD_SB(src + 24);
761 src1 = __msa_sldi_b(src2, src0, 8);
763 XORI_B4_128_SB(src0, src1, src2, src3);
764 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
765 mask3, filt0, filt1, filt2, filt3, out0,
767 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
768 SAT_SH4_SH(out0, out1, out2, out3, 7);
771 src2 = LD_SB(src + 16);
772 src3 = LD_SB(src + 24);
773 src1 = __msa_sldi_b(src2, src0, 8);
776 out = PCKEV_XORI128_UB(out0, out1);
778 out = PCKEV_XORI128_UB(out2, out3);
779 ST_UB(out, dst + 16);
782 XORI_B4_128_SB(src0, src1, src2, src3);
783 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1, mask2,
784 mask3, filt0, filt1, filt2, filt3, out0,
786 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
787 SAT_SH4_SH(out0, out1, out2, out3, 7);
788 out = PCKEV_XORI128_UB(out0, out1);
790 out = PCKEV_XORI128_UB(out2, out3);
791 ST_UB(out, dst + 16);
796 static void common_hz_8t_48w_msa(uint8_t *src, int32_t src_stride,
797 uint8_t *dst, int32_t dst_stride,
798 const int8_t *filter, int32_t height,
802 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3, vec0, vec1, vec2;
803 v16u8 mask0, mask1, mask2, mask3, mask4, mask5, mask6, mask7, out;
804 v8i16 filt, out0, out1, out2, out3, out4, out5, out6;
807 mask0 = LD_UB(&mc_filt_mask_arr[0]);
809 rnd_vec = __msa_fill_h(rnd_val);
811 /* rearranging filter */
812 filt = LD_SH(filter);
813 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
823 for (loop_cnt = height; loop_cnt--;) {
824 LD_SB3(src, 16, src0, src2, src3);
825 src1 = __msa_sldi_b(src2, src0, 8);
827 XORI_B4_128_SB(src0, src1, src2, src3);
828 VSHF_B3_SB(src0, src0, src1, src1, src2, src2, mask0, mask0, mask0,
830 DOTP_SB3_SH(vec0, vec1, vec2, filt0, filt0, filt0, out0, out1, out2);
831 VSHF_B3_SB(src0, src0, src1, src1, src2, src2, mask1, mask1, mask1,
833 DPADD_SB2_SH(vec0, vec1, filt1, filt1, out0, out1);
834 out2 = __msa_dpadd_s_h(out2, vec2, filt1);
835 VSHF_B3_SB(src0, src0, src1, src1, src2, src2, mask2, mask2, mask2,
837 DOTP_SB3_SH(vec0, vec1, vec2, filt2, filt2, filt2, out3, out4, out5);
838 VSHF_B3_SB(src0, src0, src1, src1, src2, src2, mask3, mask3, mask3,
840 DPADD_SB2_SH(vec0, vec1, filt3, filt3, out3, out4);
841 out5 = __msa_dpadd_s_h(out5, vec2, filt3);
842 ADDS_SH2_SH(out0, out3, out1, out4, out0, out1);
843 out2 = __msa_adds_s_h(out2, out5);
844 SRAR_H2_SH(out0, out1, rnd_vec);
845 out6 = __msa_srar_h(out2, rnd_vec);
846 SAT_SH3_SH(out0, out1, out6, 7);
847 out = PCKEV_XORI128_UB(out0, out1);
850 src1 = LD_SB(src + 40);
852 src1 = (v16i8) __msa_xori_b((v16u8) src1, 128);
854 VSHF_B3_SB(src2, src3, src3, src3, src1, src1, mask4, mask0, mask0,
856 DOTP_SB3_SH(vec0, vec1, vec2, filt0, filt0, filt0, out0, out1, out2);
857 VSHF_B3_SB(src2, src3, src3, src3, src1, src1, mask5, mask1, mask1,
859 DPADD_SB2_SH(vec0, vec1, filt1, filt1, out0, out1);
860 out2 = __msa_dpadd_s_h(out2, vec2, filt1);
861 VSHF_B3_SB(src2, src3, src3, src3, src1, src1, mask6, mask2, mask2,
863 DOTP_SB3_SH(vec0, vec1, vec2, filt2, filt2, filt2, out3, out4, out5);
864 VSHF_B3_SB(src2, src3, src3, src3, src1, src1, mask7, mask3, mask3,
866 DPADD_SB2_SH(vec0, vec1, filt3, filt3, out3, out4);
867 out5 = __msa_dpadd_s_h(out5, vec2, filt3);
868 ADDS_SH2_SH(out0, out3, out1, out4, out3, out4);
869 out5 = __msa_adds_s_h(out2, out5);
870 SRAR_H3_SH(out3, out4, out5, rnd_vec);
871 SAT_SH3_SH(out3, out4, out5, 7);
872 out = PCKEV_XORI128_UB(out6, out3);
873 ST_UB(out, dst + 16);
874 out = PCKEV_XORI128_UB(out4, out5);
875 ST_UB(out, dst + 32);
880 static void common_hz_8t_64w_msa(uint8_t *src, int32_t src_stride,
881 uint8_t *dst, int32_t dst_stride,
882 const int8_t *filter, int32_t height,
886 v16i8 src0, src1, src2, src3, filt0, filt1, filt2, filt3;
887 v16u8 mask0, mask1, mask2, mask3, out;
888 v8i16 filt, out0, out1, out2, out3;
891 mask0 = LD_UB(&mc_filt_mask_arr[0]);
893 rnd_vec = __msa_fill_h(rnd_val);
895 /* rearranging filter */
896 filt = LD_SH(filter);
897 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
903 for (loop_cnt = height; loop_cnt--;) {
905 src2 = LD_SB(src + 16);
906 src3 = LD_SB(src + 24);
907 src1 = __msa_sldi_b(src2, src0, 8);
909 XORI_B4_128_SB(src0, src1, src2, src3);
910 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1,
911 mask2, mask3, filt0, filt1, filt2, filt3,
912 out0, out1, out2, out3);
913 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
914 SAT_SH4_SH(out0, out1, out2, out3, 7);
915 out = PCKEV_XORI128_UB(out0, out1);
917 out = PCKEV_XORI128_UB(out2, out3);
918 ST_UB(out, dst + 16);
920 src0 = LD_SB(src + 32);
921 src2 = LD_SB(src + 48);
922 src3 = LD_SB(src + 56);
923 src1 = __msa_sldi_b(src2, src0, 8);
926 XORI_B4_128_SB(src0, src1, src2, src3);
927 HORIZ_8TAP_8WID_4VECS_FILT(src0, src1, src2, src3, mask0, mask1,
928 mask2, mask3, filt0, filt1, filt2, filt3,
929 out0, out1, out2, out3);
930 SRAR_H4_SH(out0, out1, out2, out3, rnd_vec);
931 SAT_SH4_SH(out0, out1, out2, out3, 7);
932 out = PCKEV_XORI128_UB(out0, out1);
933 ST_UB(out, dst + 32);
934 out = PCKEV_XORI128_UB(out2, out3);
935 ST_UB(out, dst + 48);
940 static void common_vt_8t_4w_msa(uint8_t *src, int32_t src_stride,
941 uint8_t *dst, int32_t dst_stride,
942 const int8_t *filter, int32_t height,
946 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
947 v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
948 v16i8 src65_r, src87_r, src109_r, src2110, src4332, src6554, src8776;
949 v16i8 src10998, filt0, filt1, filt2, filt3;
951 v8i16 filt, out10, out32;
954 src -= (3 * src_stride);
955 rnd_vec = __msa_fill_h(rnd_val);
957 filt = LD_SH(filter);
958 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
960 LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
961 src += (7 * src_stride);
963 ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
965 ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
966 ILVR_D3_SB(src21_r, src10_r, src43_r, src32_r, src65_r, src54_r, src2110,
968 XORI_B3_128_SB(src2110, src4332, src6554);
970 for (loop_cnt = (height >> 2); loop_cnt--;) {
971 LD_SB4(src, src_stride, src7, src8, src9, src10);
972 src += (4 * src_stride);
974 ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
975 src87_r, src98_r, src109_r);
976 ILVR_D2_SB(src87_r, src76_r, src109_r, src98_r, src8776, src10998);
977 XORI_B2_128_SB(src8776, src10998);
978 out10 = FILT_8TAP_DPADD_S_H(src2110, src4332, src6554, src8776, filt0,
979 filt1, filt2, filt3);
980 out32 = FILT_8TAP_DPADD_S_H(src4332, src6554, src8776, src10998, filt0,
981 filt1, filt2, filt3);
982 SRAR_H2_SH(out10, out32, rnd_vec);
983 SAT_SH2_SH(out10, out32, 7);
984 out = PCKEV_XORI128_UB(out10, out32);
985 ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
986 dst += (4 * dst_stride);
995 static void common_vt_8t_8w_msa(uint8_t *src, int32_t src_stride,
996 uint8_t *dst, int32_t dst_stride,
997 const int8_t *filter, int32_t height,
1001 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
1002 v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
1003 v16i8 src65_r, src87_r, src109_r, filt0, filt1, filt2, filt3;
1005 v8i16 filt, out0_r, out1_r, out2_r, out3_r;
1008 src -= (3 * src_stride);
1009 rnd_vec = __msa_fill_h(rnd_val);
1011 filt = LD_SH(filter);
1012 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1014 LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
1015 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1016 src += (7 * src_stride);
1017 ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
1019 ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
1021 for (loop_cnt = (height >> 2); loop_cnt--;) {
1022 LD_SB4(src, src_stride, src7, src8, src9, src10);
1023 XORI_B4_128_SB(src7, src8, src9, src10);
1024 src += (4 * src_stride);
1026 ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
1027 src87_r, src98_r, src109_r);
1028 out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r, filt0,
1029 filt1, filt2, filt3);
1030 out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r, filt0,
1031 filt1, filt2, filt3);
1032 out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r, filt0,
1033 filt1, filt2, filt3);
1034 out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r, filt0,
1035 filt1, filt2, filt3);
1036 SRAR_H4_SH(out0_r, out1_r, out2_r, out3_r, rnd_vec);
1037 SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
1038 tmp0 = PCKEV_XORI128_UB(out0_r, out1_r);
1039 tmp1 = PCKEV_XORI128_UB(out2_r, out3_r);
1040 ST8x4_UB(tmp0, tmp1, dst, dst_stride);
1041 dst += (4 * dst_stride);
1053 static void common_vt_8t_12w_msa(uint8_t *src, int32_t src_stride,
1054 uint8_t *dst, int32_t dst_stride,
1055 const int8_t *filter, int32_t height,
1059 uint32_t out2, out3;
1060 uint64_t out0, out1;
1061 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, res0, res1;
1062 v16i8 res2, vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
1063 v8i16 vec01, vec23, vec45, vec67, tmp0, tmp1, tmp2;
1064 v8i16 filt, filt0, filt1, filt2, filt3;
1066 v4i32 mask = { 2, 6, 2, 6 };
1068 src -= (3 * src_stride);
1069 rnd_vec = __msa_fill_h(rnd_val);
1071 /* rearranging filter_y */
1072 filt = LD_SH(filter);
1073 SPLATI_H4_SH(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1075 LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
1076 src += (7 * src_stride);
1078 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1081 VSHF_W2_SB(src0, src1, src1, src2, mask, mask, vec0, vec1);
1082 VSHF_W2_SB(src2, src3, src3, src4, mask, mask, vec2, vec3);
1083 VSHF_W2_SB(src4, src5, src5, src6, mask, mask, vec4, vec5);
1085 for (loop_cnt = (height >> 1); loop_cnt--;) {
1086 LD_SB2(src, src_stride, src7, src8);
1087 XORI_B2_128_SB(src7, src8);
1088 src += (2 * src_stride);
1090 ILVR_B4_SH(src1, src0, src3, src2, src5, src4, src7, src6,
1091 vec01, vec23, vec45, vec67);
1092 tmp0 = FILT_8TAP_DPADD_S_H(vec01, vec23, vec45, vec67, filt0, filt1,
1094 ILVR_B4_SH(src2, src1, src4, src3, src6, src5, src8, src7, vec01, vec23,
1096 tmp1 = FILT_8TAP_DPADD_S_H(vec01, vec23, vec45, vec67, filt0, filt1,
1100 VSHF_W2_SB(src6, src7, src7, src8, mask, mask, vec6, vec7);
1101 ILVR_B4_SH(vec1, vec0, vec3, vec2, vec5, vec4, vec7, vec6, vec01, vec23,
1103 tmp2 = FILT_8TAP_DPADD_S_H(vec01, vec23, vec45, vec67, filt0, filt1,
1105 SRAR_H3_SH(tmp0, tmp1, tmp2, rnd_vec);
1106 SAT_SH3_SH(tmp0, tmp1, tmp2, 7);
1107 PCKEV_B3_SB(tmp0, tmp0, tmp1, tmp1, tmp2, tmp2, res0, res1, res2);
1108 XORI_B3_128_SB(res0, res1, res2);
1110 out0 = __msa_copy_u_d((v2i64) res0, 0);
1111 out1 = __msa_copy_u_d((v2i64) res1, 0);
1112 out2 = __msa_copy_u_w((v4i32) res2, 0);
1113 out3 = __msa_copy_u_w((v4i32) res2, 1);
1115 SW(out2, (dst + 8));
1118 SW(out3, (dst + 8));
1137 static void common_vt_8t_16w_msa(uint8_t *src, int32_t src_stride,
1138 uint8_t *dst, int32_t dst_stride,
1139 const int8_t *filter, int32_t height,
1143 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
1144 v16i8 filt0, filt1, filt2, filt3;
1145 v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
1146 v16i8 src65_r, src87_r, src109_r, src10_l, src32_l, src54_l, src76_l;
1147 v16i8 src98_l, src21_l, src43_l, src65_l, src87_l, src109_l;
1148 v16u8 tmp0, tmp1, tmp2, tmp3;
1149 v8i16 filt, out0_r, out1_r, out2_r, out3_r, out0_l, out1_l, out2_l, out3_l;
1152 src -= (3 * src_stride);
1153 rnd_vec = __msa_fill_h(rnd_val);
1155 filt = LD_SH(filter);
1156 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1158 LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
1159 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1160 src += (7 * src_stride);
1161 ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
1163 ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
1164 ILVL_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_l, src32_l,
1166 ILVL_B2_SB(src4, src3, src6, src5, src43_l, src65_l);
1168 for (loop_cnt = (height >> 2); loop_cnt--;) {
1169 LD_SB4(src, src_stride, src7, src8, src9, src10);
1170 XORI_B4_128_SB(src7, src8, src9, src10);
1171 src += (4 * src_stride);
1173 ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
1174 src87_r, src98_r, src109_r);
1175 ILVL_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_l,
1176 src87_l, src98_l, src109_l);
1177 out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r, filt0,
1178 filt1, filt2, filt3);
1179 out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r, filt0,
1180 filt1, filt2, filt3);
1181 out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r, filt0,
1182 filt1, filt2, filt3);
1183 out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r, filt0,
1184 filt1, filt2, filt3);
1185 out0_l = FILT_8TAP_DPADD_S_H(src10_l, src32_l, src54_l, src76_l, filt0,
1186 filt1, filt2, filt3);
1187 out1_l = FILT_8TAP_DPADD_S_H(src21_l, src43_l, src65_l, src87_l, filt0,
1188 filt1, filt2, filt3);
1189 out2_l = FILT_8TAP_DPADD_S_H(src32_l, src54_l, src76_l, src98_l, filt0,
1190 filt1, filt2, filt3);
1191 out3_l = FILT_8TAP_DPADD_S_H(src43_l, src65_l, src87_l, src109_l, filt0,
1192 filt1, filt2, filt3);
1193 SRAR_H4_SH(out0_r, out1_r, out2_r, out3_r, rnd_vec);
1194 SRAR_H4_SH(out0_l, out1_l, out2_l, out3_l, rnd_vec);
1195 SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
1196 SAT_SH4_SH(out0_l, out1_l, out2_l, out3_l, 7);
1197 PCKEV_B4_UB(out0_l, out0_r, out1_l, out1_r, out2_l, out2_r, out3_l,
1198 out3_r, tmp0, tmp1, tmp2, tmp3);
1199 XORI_B4_128_UB(tmp0, tmp1, tmp2, tmp3);
1200 ST_UB4(tmp0, tmp1, tmp2, tmp3, dst, dst_stride);
1201 dst += (4 * dst_stride);
1219 static void common_vt_8t_16w_mult_msa(uint8_t *src, int32_t src_stride,
1220 uint8_t *dst, int32_t dst_stride,
1221 const int8_t *filter, int32_t height,
1222 uint8_t rnd_val, int32_t width)
1226 uint32_t loop_cnt, cnt;
1227 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
1228 v16i8 filt0, filt1, filt2, filt3;
1229 v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
1230 v16i8 src65_r, src87_r, src109_r, src10_l, src32_l, src54_l, src76_l;
1231 v16i8 src98_l, src21_l, src43_l, src65_l, src87_l, src109_l;
1232 v16u8 tmp0, tmp1, tmp2, tmp3;
1233 v8i16 filt, out0_r, out1_r, out2_r, out3_r, out0_l, out1_l, out2_l, out3_l;
1236 src -= (3 * src_stride);
1237 rnd_vec = __msa_fill_h(rnd_val);
1239 filt = LD_SH(filter);
1240 SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1242 for (cnt = (width >> 4); cnt--;) {
1246 LD_SB7(src_tmp, src_stride, src0, src1, src2, src3, src4, src5, src6);
1247 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1248 src_tmp += (7 * src_stride);
1249 ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r,
1250 src32_r, src54_r, src21_r);
1251 ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
1252 ILVL_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_l,
1253 src32_l, src54_l, src21_l);
1254 ILVL_B2_SB(src4, src3, src6, src5, src43_l, src65_l);
1256 for (loop_cnt = (height >> 2); loop_cnt--;) {
1257 LD_SB4(src_tmp, src_stride, src7, src8, src9, src10);
1258 XORI_B4_128_SB(src7, src8, src9, src10);
1259 src_tmp += (4 * src_stride);
1260 ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
1261 src87_r, src98_r, src109_r);
1262 ILVL_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_l,
1263 src87_l, src98_l, src109_l);
1264 out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r,
1265 filt0, filt1, filt2, filt3);
1266 out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r,
1267 filt0, filt1, filt2, filt3);
1268 out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r,
1269 filt0, filt1, filt2, filt3);
1270 out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r,
1271 filt0, filt1, filt2, filt3);
1272 out0_l = FILT_8TAP_DPADD_S_H(src10_l, src32_l, src54_l, src76_l,
1273 filt0, filt1, filt2, filt3);
1274 out1_l = FILT_8TAP_DPADD_S_H(src21_l, src43_l, src65_l, src87_l,
1275 filt0, filt1, filt2, filt3);
1276 out2_l = FILT_8TAP_DPADD_S_H(src32_l, src54_l, src76_l, src98_l,
1277 filt0, filt1, filt2, filt3);
1278 out3_l = FILT_8TAP_DPADD_S_H(src43_l, src65_l, src87_l, src109_l,
1279 filt0, filt1, filt2, filt3);
1280 SRAR_H4_SH(out0_r, out1_r, out2_r, out3_r, rnd_vec);
1281 SRAR_H4_SH(out0_l, out1_l, out2_l, out3_l, rnd_vec);
1282 SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
1283 SAT_SH4_SH(out0_l, out1_l, out2_l, out3_l, 7);
1284 PCKEV_B4_UB(out0_l, out0_r, out1_l, out1_r, out2_l, out2_r, out3_l,
1285 out3_r, tmp0, tmp1, tmp2, tmp3);
1286 XORI_B4_128_UB(tmp0, tmp1, tmp2, tmp3);
1287 ST_UB4(tmp0, tmp1, tmp2, tmp3, dst_tmp, dst_stride);
1288 dst_tmp += (4 * dst_stride);
1310 static void common_vt_8t_24w_msa(uint8_t *src, int32_t src_stride,
1311 uint8_t *dst, int32_t dst_stride,
1312 const int8_t *filter, int32_t height, uint8_t rnd_val)
1314 common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
1317 common_vt_8t_8w_msa(src + 16, src_stride, dst + 16, dst_stride, filter,
1321 static void common_vt_8t_32w_msa(uint8_t *src, int32_t src_stride,
1322 uint8_t *dst, int32_t dst_stride,
1323 const int8_t *filter, int32_t height, uint8_t rnd_val)
1325 common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
1329 static void common_vt_8t_48w_msa(uint8_t *src, int32_t src_stride,
1330 uint8_t *dst, int32_t dst_stride,
1331 const int8_t *filter, int32_t height, uint8_t rnd_val)
1333 common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
1337 static void common_vt_8t_64w_msa(uint8_t *src, int32_t src_stride,
1338 uint8_t *dst, int32_t dst_stride,
1339 const int8_t *filter, int32_t height, uint8_t rnd_val)
1341 common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
1345 static void hevc_hv_uni_8t_4w_msa(uint8_t *src,
1349 const int8_t *filter_x,
1350 const int8_t *filter_y,
1354 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
1355 v8i16 filt0, filt1, filt2, filt3;
1356 v4i32 filt_h0, filt_h1, filt_h2, filt_h3;
1357 v16i8 mask1, mask2, mask3;
1358 v8i16 filter_vec, const_vec;
1359 v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
1360 v16i8 vec8, vec9, vec10, vec11, vec12, vec13, vec14, vec15;
1361 v8i16 dst30, dst41, dst52, dst63, dst66, dst87;
1362 v4i32 dst0_r, dst1_r;
1363 v8i16 dst10_r, dst32_r, dst54_r, dst76_r;
1364 v8i16 dst21_r, dst43_r, dst65_r, dst87_r;
1365 v16i8 mask0 = { 0, 1, 1, 2, 2, 3, 3, 4, 16, 17, 17, 18, 18, 19, 19, 20 };
1366 v8i16 mask4 = { 0, 4, 1, 5, 2, 6, 3, 7 };
1368 src -= ((3 * src_stride) + 3);
1369 filter_vec = LD_SH(filter_x);
1370 SPLATI_H4_SH(filter_vec, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1372 filter_vec = LD_SH(filter_y);
1373 vec0 = __msa_clti_s_b((v16i8) filter_vec, 0);
1374 filter_vec = (v8i16) __msa_ilvr_b(vec0, (v16i8) filter_vec);
1376 SPLATI_W4_SW(filter_vec, filt_h0, filt_h1, filt_h2, filt_h3);
1382 const_vec = __msa_ldi_h(128);
1385 LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
1386 src += (7 * src_stride);
1387 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1389 VSHF_B4_SB(src0, src3, mask0, mask1, mask2, mask3, vec0, vec1, vec2, vec3);
1390 VSHF_B4_SB(src1, src4, mask0, mask1, mask2, mask3, vec4, vec5, vec6, vec7);
1391 VSHF_B4_SB(src2, src5, mask0, mask1, mask2, mask3,
1392 vec8, vec9, vec10, vec11);
1393 VSHF_B4_SB(src3, src6, mask0, mask1, mask2, mask3,
1394 vec12, vec13, vec14, vec15);
1397 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1398 dst30, dst30, dst30, dst30);
1400 DPADD_SB4_SH(vec4, vec5, vec6, vec7, filt0, filt1, filt2, filt3,
1401 dst41, dst41, dst41, dst41);
1403 DPADD_SB4_SH(vec8, vec9, vec10, vec11, filt0, filt1, filt2, filt3,
1404 dst52, dst52, dst52, dst52);
1406 DPADD_SB4_SH(vec12, vec13, vec14, vec15, filt0, filt1, filt2, filt3,
1407 dst63, dst63, dst63, dst63);
1409 ILVR_H3_SH(dst41, dst30, dst52, dst41, dst63, dst52,
1410 dst10_r, dst21_r, dst32_r);
1411 dst43_r = __msa_ilvl_h(dst41, dst30);
1412 dst54_r = __msa_ilvl_h(dst52, dst41);
1413 dst65_r = __msa_ilvl_h(dst63, dst52);
1414 dst66 = (v8i16) __msa_splati_d((v2i64) dst63, 1);
1416 for (loop_cnt = height >> 1; loop_cnt--;) {
1417 LD_SB2(src, src_stride, src7, src8);
1418 src += 2 * src_stride;
1419 XORI_B2_128_SB(src7, src8);
1421 VSHF_B4_SB(src7, src8, mask0, mask1, mask2, mask3,
1422 vec0, vec1, vec2, vec3);
1424 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1425 dst87, dst87, dst87, dst87);
1427 dst76_r = __msa_ilvr_h(dst87, dst66);
1428 dst0_r = HEVC_FILT_8TAP(dst10_r, dst32_r, dst54_r, dst76_r,
1429 filt_h0, filt_h1, filt_h2, filt_h3);
1430 dst87_r = __msa_vshf_h(mask4, dst87, dst87);
1431 dst1_r = HEVC_FILT_8TAP(dst21_r, dst43_r, dst65_r, dst87_r,
1432 filt_h0, filt_h1, filt_h2, filt_h3);
1436 SRARI_W2_SW(dst0_r, dst1_r, 6);
1437 dst0_r = CLIP_SW_0_255(dst0_r);
1438 dst1_r = CLIP_SW_0_255(dst1_r);
1440 HEVC_PCK_SW_SB2(dst1_r, dst0_r, dst0_r);
1441 ST4x2_UB(dst0_r, dst, dst_stride);
1442 dst += (2 * dst_stride);
1450 dst66 = (v8i16) __msa_splati_d((v2i64) dst87, 1);
1454 static void hevc_hv_uni_8t_8multx2mult_msa(uint8_t *src,
1458 const int8_t *filter_x,
1459 const int8_t *filter_y,
1460 int32_t height, int32_t width)
1462 uint32_t loop_cnt, cnt;
1465 v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
1466 v8i16 filt0, filt1, filt2, filt3;
1467 v4i32 filt_h0, filt_h1, filt_h2, filt_h3;
1468 v16i8 mask1, mask2, mask3;
1469 v8i16 filter_vec, const_vec;
1470 v16i8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
1471 v16i8 vec8, vec9, vec10, vec11, vec12, vec13, vec14, vec15;
1472 v8i16 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7, dst8;
1473 v4i32 dst0_r, dst0_l, dst1_r, dst1_l;
1474 v8i16 dst10_r, dst32_r, dst54_r, dst76_r;
1475 v8i16 dst10_l, dst32_l, dst54_l, dst76_l;
1476 v8i16 dst21_r, dst43_r, dst65_r, dst87_r;
1477 v8i16 dst21_l, dst43_l, dst65_l, dst87_l;
1478 v16i8 mask0 = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 };
1480 src -= ((3 * src_stride) + 3);
1481 const_vec = __msa_ldi_h(128);
1484 filter_vec = LD_SH(filter_x);
1485 SPLATI_H4_SH(filter_vec, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
1487 filter_vec = LD_SH(filter_y);
1488 vec0 = __msa_clti_s_b((v16i8) filter_vec, 0);
1489 filter_vec = (v8i16) __msa_ilvr_b(vec0, (v16i8) filter_vec);
1491 SPLATI_W4_SW(filter_vec, filt_h0, filt_h1, filt_h2, filt_h3);
1497 for (cnt = width >> 3; cnt--;) {
1501 LD_SB7(src_tmp, src_stride, src0, src1, src2, src3, src4, src5, src6);
1502 src_tmp += (7 * src_stride);
1503 XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
1505 /* row 0 row 1 row 2 row 3 */
1506 VSHF_B4_SB(src0, src0, mask0, mask1, mask2, mask3,
1507 vec0, vec1, vec2, vec3);
1508 VSHF_B4_SB(src1, src1, mask0, mask1, mask2, mask3,
1509 vec4, vec5, vec6, vec7);
1510 VSHF_B4_SB(src2, src2, mask0, mask1, mask2, mask3,
1511 vec8, vec9, vec10, vec11);
1512 VSHF_B4_SB(src3, src3, mask0, mask1, mask2, mask3,
1513 vec12, vec13, vec14, vec15);
1515 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1516 dst0, dst0, dst0, dst0);
1518 DPADD_SB4_SH(vec4, vec5, vec6, vec7, filt0, filt1, filt2, filt3,
1519 dst1, dst1, dst1, dst1);
1521 DPADD_SB4_SH(vec8, vec9, vec10, vec11, filt0, filt1, filt2, filt3,
1522 dst2, dst2, dst2, dst2);
1524 DPADD_SB4_SH(vec12, vec13, vec14, vec15, filt0, filt1, filt2, filt3,
1525 dst3, dst3, dst3, dst3);
1527 VSHF_B4_SB(src4, src4, mask0, mask1, mask2, mask3,
1528 vec0, vec1, vec2, vec3);
1529 VSHF_B4_SB(src5, src5, mask0, mask1, mask2, mask3,
1530 vec4, vec5, vec6, vec7);
1531 VSHF_B4_SB(src6, src6, mask0, mask1, mask2, mask3,
1532 vec8, vec9, vec10, vec11);
1534 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1535 dst4, dst4, dst4, dst4);
1537 DPADD_SB4_SH(vec4, vec5, vec6, vec7, filt0, filt1, filt2, filt3,
1538 dst5, dst5, dst5, dst5);
1540 DPADD_SB4_SH(vec8, vec9, vec10, vec11, filt0, filt1, filt2, filt3,
1541 dst6, dst6, dst6, dst6);
1543 ILVR_H4_SH(dst1, dst0, dst3, dst2, dst5, dst4, dst2, dst1,
1544 dst10_r, dst32_r, dst54_r, dst21_r);
1545 ILVR_H2_SH(dst4, dst3, dst6, dst5, dst43_r, dst65_r);
1546 ILVL_H4_SH(dst1, dst0, dst3, dst2, dst5, dst4, dst2, dst1,
1547 dst10_l, dst32_l, dst54_l, dst21_l);
1548 ILVL_H2_SH(dst4, dst3, dst6, dst5, dst43_l, dst65_l);
1550 for (loop_cnt = height >> 1; loop_cnt--;) {
1551 LD_SB2(src_tmp, src_stride, src7, src8);
1552 XORI_B2_128_SB(src7, src8);
1553 src_tmp += 2 * src_stride;
1555 VSHF_B4_SB(src7, src7, mask0, mask1, mask2, mask3,
1556 vec0, vec1, vec2, vec3);
1558 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1559 dst7, dst7, dst7, dst7);
1561 ILVRL_H2_SH(dst7, dst6, dst76_r, dst76_l);
1562 dst0_r = HEVC_FILT_8TAP(dst10_r, dst32_r, dst54_r, dst76_r,
1563 filt_h0, filt_h1, filt_h2, filt_h3);
1564 dst0_l = HEVC_FILT_8TAP(dst10_l, dst32_l, dst54_l, dst76_l,
1565 filt_h0, filt_h1, filt_h2, filt_h3);
1569 VSHF_B4_SB(src8, src8, mask0, mask1, mask2, mask3,
1570 vec0, vec1, vec2, vec3);
1572 DPADD_SB4_SH(vec0, vec1, vec2, vec3, filt0, filt1, filt2, filt3,
1573 dst8, dst8, dst8, dst8);
1575 ILVRL_H2_SH(dst8, dst7, dst87_r, dst87_l);
1576 dst1_r = HEVC_FILT_8TAP(dst21_r, dst43_r, dst65_r, dst87_r,
1577 filt_h0, filt_h1, filt_h2, filt_h3);
1578 dst1_l = HEVC_FILT_8TAP(dst21_l, dst43_l, dst65_l, dst87_l,
1579 filt_h0, filt_h1, filt_h2, filt_h3);
1582 SRARI_W4_SW(dst0_r, dst0_l, dst1_r, dst1_l, 6);
1583 dst0_r = CLIP_SW_0_255(dst0_r);
1584 dst0_l = CLIP_SW_0_255(dst0_l);
1585 dst1_r = CLIP_SW_0_255(dst1_r);
1586 dst1_l = CLIP_SW_0_255(dst1_l);
1588 HEVC_PCK_SW_SB4(dst0_l, dst0_r, dst1_l, dst1_r, dst0_r);
1589 ST8x2_UB(dst0_r, dst_tmp, dst_stride);
1590 dst_tmp += (2 * dst_stride);
1612 static void hevc_hv_uni_8t_8w_msa(uint8_t *src,
1616 const int8_t *filter_x,
1617 const int8_t *filter_y,
1620 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1621 filter_x, filter_y, height, 8);
1624 static void hevc_hv_uni_8t_12w_msa(uint8_t *src,
1628 const int8_t *filter_x,
1629 const int8_t *filter_y,
1632 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1633 filter_x, filter_y, height, 8);
1635 hevc_hv_uni_8t_4w_msa(src + 8, src_stride, dst + 8, dst_stride,
1636 filter_x, filter_y, height);
1639 static void hevc_hv_uni_8t_16w_msa(uint8_t *src,
1643 const int8_t *filter_x,
1644 const int8_t *filter_y,
1647 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1648 filter_x, filter_y, height, 16);
1651 static void hevc_hv_uni_8t_24w_msa(uint8_t *src,
1655 const int8_t *filter_x,
1656 const int8_t *filter_y,
1659 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1660 filter_x, filter_y, height, 24);
1663 static void hevc_hv_uni_8t_32w_msa(uint8_t *src,
1667 const int8_t *filter_x,
1668 const int8_t *filter_y,
1671 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1672 filter_x, filter_y, height, 32);
1675 static void hevc_hv_uni_8t_48w_msa(uint8_t *src,
1679 const int8_t *filter_x,
1680 const int8_t *filter_y,
1683 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1684 filter_x, filter_y, height, 48);
1687 static void hevc_hv_uni_8t_64w_msa(uint8_t *src,
1691 const int8_t *filter_x,
1692 const int8_t *filter_y,
1695 hevc_hv_uni_8t_8multx2mult_msa(src, src_stride, dst, dst_stride,
1696 filter_x, filter_y, height, 64);
1699 #define UNI_MC_COPY(WIDTH) \
1700 void ff_hevc_put_hevc_uni_pel_pixels##WIDTH##_8_msa(uint8_t *dst, \
1701 ptrdiff_t dst_stride, \
1703 ptrdiff_t src_stride, \
1709 copy_width##WIDTH##_msa(src, src_stride, dst, dst_stride, height); \
1722 #define UNI_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
1723 void ff_hevc_put_hevc_uni_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
1734 const int8_t *filter = ff_hevc_##PEL##_filters[FILT_DIR - 1]; \
1736 common_##DIR1##_##TAP##t_##WIDTH##w_msa(src, src_stride, dst, dst_stride, \
1737 filter, height, 6); \
1740 UNI_MC(qpel, h, 4, 8, hz, mx);
1741 UNI_MC(qpel, h, 8, 8, hz, mx);
1742 UNI_MC(qpel, h, 12, 8, hz, mx);
1743 UNI_MC(qpel, h, 16, 8, hz, mx);
1744 UNI_MC(qpel, h, 24, 8, hz, mx);
1745 UNI_MC(qpel, h, 32, 8, hz, mx);
1746 UNI_MC(qpel, h, 48, 8, hz, mx);
1747 UNI_MC(qpel, h, 64, 8, hz, mx);
1749 UNI_MC(qpel, v, 4, 8, vt, my);
1750 UNI_MC(qpel, v, 8, 8, vt, my);
1751 UNI_MC(qpel, v, 12, 8, vt, my);
1752 UNI_MC(qpel, v, 16, 8, vt, my);
1753 UNI_MC(qpel, v, 24, 8, vt, my);
1754 UNI_MC(qpel, v, 32, 8, vt, my);
1755 UNI_MC(qpel, v, 48, 8, vt, my);
1756 UNI_MC(qpel, v, 64, 8, vt, my);
1760 #define UNI_MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
1761 void ff_hevc_put_hevc_uni_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
1772 const int8_t *filter_x = ff_hevc_##PEL##_filters[mx - 1]; \
1773 const int8_t *filter_y = ff_hevc_##PEL##_filters[my - 1]; \
1775 hevc_##DIR1##_uni_##TAP##t_##WIDTH##w_msa(src, src_stride, dst, \
1776 dst_stride, filter_x, \
1777 filter_y, height); \
1780 UNI_MC_HV(qpel, hv, 4, 8, hv);
1781 UNI_MC_HV(qpel, hv, 8, 8, hv);
1782 UNI_MC_HV(qpel, hv, 12, 8, hv);
1783 UNI_MC_HV(qpel, hv, 16, 8, hv);
1784 UNI_MC_HV(qpel, hv, 24, 8, hv);
1785 UNI_MC_HV(qpel, hv, 32, 8, hv);
1786 UNI_MC_HV(qpel, hv, 48, 8, hv);
1787 UNI_MC_HV(qpel, hv, 64, 8, hv);