26 #define VP9_DCT_CONST_BITS 14
27 #define ROUND_POWER_OF_TWO(value, n) (((value) + (1 << ((n) - 1))) >> (n))
67 #define VP9_DOTP_CONST_PAIR(reg0, reg1, cnst0, cnst1, out0, out1) \
69 v8i16 k0_m = __msa_fill_h(cnst0); \
70 v4i32 s0_m, s1_m, s2_m, s3_m; \
72 s0_m = (v4i32) __msa_fill_h(cnst1); \
73 k0_m = __msa_ilvev_h((v8i16) s0_m, k0_m); \
75 ILVRL_H2_SW((-reg1), reg0, s1_m, s0_m); \
76 ILVRL_H2_SW(reg0, reg1, s3_m, s2_m); \
77 DOTP_SH2_SW(s1_m, s0_m, k0_m, k0_m, s1_m, s0_m); \
78 SRARI_W2_SW(s1_m, s0_m, VP9_DCT_CONST_BITS); \
79 out0 = __msa_pckev_h((v8i16) s0_m, (v8i16) s1_m); \
81 DOTP_SH2_SW(s3_m, s2_m, k0_m, k0_m, s1_m, s0_m); \
82 SRARI_W2_SW(s1_m, s0_m, VP9_DCT_CONST_BITS); \
83 out1 = __msa_pckev_h((v8i16) s0_m, (v8i16) s1_m); \
86 #define VP9_DOT_ADD_SUB_SRARI_PCK(in0, in1, in2, in3, in4, in5, in6, in7, \
87 dst0, dst1, dst2, dst3) \
89 v4i32 tp0_m, tp1_m, tp2_m, tp3_m, tp4_m; \
90 v4i32 tp5_m, tp6_m, tp7_m, tp8_m, tp9_m; \
92 DOTP_SH4_SW(in0, in1, in0, in1, in4, in4, in5, in5, \
93 tp0_m, tp2_m, tp3_m, tp4_m); \
94 DOTP_SH4_SW(in2, in3, in2, in3, in6, in6, in7, in7, \
95 tp5_m, tp6_m, tp7_m, tp8_m); \
96 BUTTERFLY_4(tp0_m, tp3_m, tp7_m, tp5_m, tp1_m, tp9_m, tp7_m, tp5_m); \
97 BUTTERFLY_4(tp2_m, tp4_m, tp8_m, tp6_m, tp3_m, tp0_m, tp4_m, tp2_m); \
98 SRARI_W4_SW(tp1_m, tp9_m, tp7_m, tp5_m, VP9_DCT_CONST_BITS); \
99 SRARI_W4_SW(tp3_m, tp0_m, tp4_m, tp2_m, VP9_DCT_CONST_BITS); \
100 PCKEV_H4_SH(tp1_m, tp3_m, tp9_m, tp0_m, tp7_m, tp4_m, tp5_m, tp2_m, \
101 dst0, dst1, dst2, dst3); \
104 #define VP9_DOT_SHIFT_RIGHT_PCK_H(in0, in1, in2) \
107 v4i32 tp0_m, tp1_m; \
109 DOTP_SH2_SW(in0, in1, in2, in2, tp1_m, tp0_m); \
110 SRARI_W2_SW(tp1_m, tp0_m, VP9_DCT_CONST_BITS); \
111 dst_m = __msa_pckev_h((v8i16) tp1_m, (v8i16) tp0_m); \
116 #define VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, \
117 out0, out1, out2, out3, out4, out5, out6, out7) \
119 v8i16 cnst0_m, cnst1_m, cnst2_m, cnst3_m, cnst4_m; \
120 v8i16 vec0_m, vec1_m, vec2_m, vec3_m, s0_m, s1_m; \
121 v8i16 coeff0_m = { cospi_2_64, cospi_6_64, cospi_10_64, cospi_14_64, \
122 cospi_18_64, cospi_22_64, cospi_26_64, cospi_30_64 }; \
123 v8i16 coeff1_m = { cospi_8_64, -cospi_8_64, cospi_16_64, \
124 -cospi_16_64, cospi_24_64, -cospi_24_64, 0, 0 }; \
126 SPLATI_H2_SH(coeff0_m, 0, 7, cnst0_m, cnst1_m); \
127 cnst2_m = -cnst0_m; \
128 ILVEV_H2_SH(cnst0_m, cnst1_m, cnst1_m, cnst2_m, cnst0_m, cnst1_m); \
129 SPLATI_H2_SH(coeff0_m, 4, 3, cnst2_m, cnst3_m); \
130 cnst4_m = -cnst2_m; \
131 ILVEV_H2_SH(cnst2_m, cnst3_m, cnst3_m, cnst4_m, cnst2_m, cnst3_m); \
133 ILVRL_H2_SH(in0, in7, vec1_m, vec0_m); \
134 ILVRL_H2_SH(in4, in3, vec3_m, vec2_m); \
135 VP9_DOT_ADD_SUB_SRARI_PCK(vec0_m, vec1_m, vec2_m, vec3_m, cnst0_m, \
136 cnst1_m, cnst2_m, cnst3_m, in7, in0, \
139 SPLATI_H2_SH(coeff0_m, 2, 5, cnst0_m, cnst1_m); \
140 cnst2_m = -cnst0_m; \
141 ILVEV_H2_SH(cnst0_m, cnst1_m, cnst1_m, cnst2_m, cnst0_m, cnst1_m); \
142 SPLATI_H2_SH(coeff0_m, 6, 1, cnst2_m, cnst3_m); \
143 cnst4_m = -cnst2_m; \
144 ILVEV_H2_SH(cnst2_m, cnst3_m, cnst3_m, cnst4_m, cnst2_m, cnst3_m); \
146 ILVRL_H2_SH(in2, in5, vec1_m, vec0_m); \
147 ILVRL_H2_SH(in6, in1, vec3_m, vec2_m); \
149 VP9_DOT_ADD_SUB_SRARI_PCK(vec0_m, vec1_m, vec2_m, vec3_m, cnst0_m, \
150 cnst1_m, cnst2_m, cnst3_m, in5, in2, \
152 BUTTERFLY_4(in7, in0, in2, in5, s1_m, s0_m, in2, in5); \
156 SPLATI_H4_SH(coeff1_m, 0, 4, 1, 5, \
157 cnst0_m, cnst1_m, cnst2_m, cnst3_m); \
159 ILVEV_H2_SH(cnst3_m, cnst0_m, cnst1_m, cnst2_m, cnst3_m, cnst2_m); \
160 cnst0_m = __msa_ilvev_h(cnst1_m, cnst0_m); \
163 ILVRL_H2_SH(in4, in3, vec1_m, vec0_m); \
164 ILVRL_H2_SH(in6, in1, vec3_m, vec2_m); \
165 VP9_DOT_ADD_SUB_SRARI_PCK(vec0_m, vec1_m, vec2_m, vec3_m, cnst0_m, \
166 cnst2_m, cnst3_m, cnst1_m, out1, out6, \
169 SPLATI_H2_SH(coeff1_m, 2, 3, cnst0_m, cnst1_m); \
170 cnst1_m = __msa_ilvev_h(cnst1_m, cnst0_m); \
172 ILVRL_H2_SH(in2, in5, vec1_m, vec0_m); \
173 ILVRL_H2_SH(s0_m, s1_m, vec3_m, vec2_m); \
174 out3 = VP9_DOT_SHIFT_RIGHT_PCK_H(vec0_m, vec1_m, cnst0_m); \
175 out4 = VP9_DOT_SHIFT_RIGHT_PCK_H(vec0_m, vec1_m, cnst1_m); \
176 out2 = VP9_DOT_SHIFT_RIGHT_PCK_H(vec2_m, vec3_m, cnst0_m); \
177 out5 = VP9_DOT_SHIFT_RIGHT_PCK_H(vec2_m, vec3_m, cnst1_m); \
184 #define VP9_MADD_SHORT(m0, m1, c0, c1, res0, res1) \
186 v4i32 madd0_m, madd1_m, madd2_m, madd3_m; \
187 v8i16 madd_s0_m, madd_s1_m; \
189 ILVRL_H2_SH(m1, m0, madd_s0_m, madd_s1_m); \
190 DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s0_m, madd_s1_m, \
191 c0, c0, c1, c1, madd0_m, madd1_m, madd2_m, madd3_m); \
192 SRARI_W4_SW(madd0_m, madd1_m, madd2_m, madd3_m, VP9_DCT_CONST_BITS); \
193 PCKEV_H2_SH(madd1_m, madd0_m, madd3_m, madd2_m, res0, res1); \
196 #define VP9_MADD_BF(inp0, inp1, inp2, inp3, cst0, cst1, cst2, cst3, \
197 out0, out1, out2, out3) \
199 v8i16 madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m; \
200 v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m, m4_m, m5_m; \
202 ILVRL_H2_SH(inp1, inp0, madd_s0_m, madd_s1_m); \
203 ILVRL_H2_SH(inp3, inp2, madd_s2_m, madd_s3_m); \
204 DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m, \
205 cst0, cst0, cst2, cst2, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
206 BUTTERFLY_4(tmp0_m, tmp1_m, tmp3_m, tmp2_m, \
207 m4_m, m5_m, tmp3_m, tmp2_m); \
208 SRARI_W4_SW(m4_m, m5_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
209 PCKEV_H2_SH(m5_m, m4_m, tmp3_m, tmp2_m, out0, out1); \
210 DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m, \
211 cst1, cst1, cst3, cst3, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
212 BUTTERFLY_4(tmp0_m, tmp1_m, tmp3_m, tmp2_m, \
213 m4_m, m5_m, tmp3_m, tmp2_m); \
214 SRARI_W4_SW(m4_m, m5_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
215 PCKEV_H2_SH(m5_m, m4_m, tmp3_m, tmp2_m, out2, out3); \
218 #define VP9_SET_COSPI_PAIR(c0_h, c1_h) \
220 v8i16 out0_m, r0_m, r1_m; \
222 r0_m = __msa_fill_h(c0_h); \
223 r1_m = __msa_fill_h(c1_h); \
224 out0_m = __msa_ilvev_h(r1_m, r0_m); \
229 #define VP9_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3) \
231 uint8_t *dst_m = (uint8_t *) (dst); \
232 v16u8 dst0_m, dst1_m, dst2_m, dst3_m; \
233 v16i8 tmp0_m, tmp1_m; \
234 v16i8 zero_m = { 0 }; \
235 v8i16 res0_m, res1_m, res2_m, res3_m; \
237 LD_UB4(dst_m, dst_stride, dst0_m, dst1_m, dst2_m, dst3_m); \
238 ILVR_B4_SH(zero_m, dst0_m, zero_m, dst1_m, zero_m, dst2_m, \
239 zero_m, dst3_m, res0_m, res1_m, res2_m, res3_m); \
240 ADD4(res0_m, in0, res1_m, in1, res2_m, in2, res3_m, in3, \
241 res0_m, res1_m, res2_m, res3_m); \
242 CLIP_SH4_0_255(res0_m, res1_m, res2_m, res3_m); \
243 PCKEV_B2_SB(res1_m, res0_m, res3_m, res2_m, tmp0_m, tmp1_m); \
244 ST_D4(tmp0_m, tmp1_m, 0, 1, 0, 1, dst_m, dst_stride); \
247 #define VP9_IDCT4x4(in0, in1, in2, in3, out0, out1, out2, out3) \
249 v8i16 c0_m, c1_m, c2_m, c3_m; \
250 v8i16 step0_m, step1_m; \
251 v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
252 v16i8 zeros = { 0 }; \
254 c0_m = VP9_SET_COSPI_PAIR(cospi_16_64, cospi_16_64); \
255 c1_m = VP9_SET_COSPI_PAIR(cospi_16_64, -cospi_16_64); \
256 step0_m = __msa_ilvr_h(in2, in0); \
257 DOTP_SH2_SW(step0_m, step0_m, c0_m, c1_m, tmp0_m, tmp1_m); \
259 c2_m = VP9_SET_COSPI_PAIR(cospi_24_64, -cospi_8_64); \
260 c3_m = VP9_SET_COSPI_PAIR(cospi_8_64, cospi_24_64); \
261 step1_m = __msa_ilvr_h(in3, in1); \
262 DOTP_SH2_SW(step1_m, step1_m, c2_m, c3_m, tmp2_m, tmp3_m); \
263 SRARI_W4_SW(tmp0_m, tmp1_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
265 PCKEV_H2_SW(tmp1_m, tmp0_m, tmp3_m, tmp2_m, tmp0_m, tmp2_m); \
266 SLDI_B2_SW(zeros, tmp0_m, zeros, tmp2_m, 8, tmp1_m, tmp3_m); \
267 BUTTERFLY_4((v8i16) tmp0_m, (v8i16) tmp1_m, \
268 (v8i16) tmp2_m, (v8i16) tmp3_m, \
269 out0, out1, out2, out3); \
272 #define VP9_IADST4x4(in0, in1, in2, in3, out0, out1, out2, out3) \
274 v8i16 res0_m, res1_m, c0_m, c1_m; \
275 v8i16 k1_m, k2_m, k3_m, k4_m; \
276 v8i16 zero_m = { 0 }; \
277 v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
278 v4i32 int0_m, int1_m, int2_m, int3_m; \
279 v8i16 mask_m = { sinpi_1_9, sinpi_2_9, sinpi_3_9, \
280 sinpi_4_9, -sinpi_1_9, -sinpi_2_9, -sinpi_3_9, \
283 SPLATI_H4_SH(mask_m, 3, 0, 1, 2, c0_m, c1_m, k1_m, k2_m); \
284 ILVEV_H2_SH(c0_m, c1_m, k1_m, k2_m, c0_m, c1_m); \
285 ILVR_H2_SH(in0, in2, in1, in3, res0_m, res1_m); \
286 DOTP_SH2_SW(res0_m, res1_m, c0_m, c1_m, tmp2_m, tmp1_m); \
287 int0_m = tmp2_m + tmp1_m; \
289 SPLATI_H2_SH(mask_m, 4, 7, k4_m, k3_m); \
290 ILVEV_H2_SH(k4_m, k1_m, k3_m, k2_m, c0_m, c1_m); \
291 DOTP_SH2_SW(res0_m, res1_m, c0_m, c1_m, tmp0_m, tmp1_m); \
292 int1_m = tmp0_m + tmp1_m; \
294 c0_m = __msa_splati_h(mask_m, 6); \
295 ILVL_H2_SH(k2_m, c0_m, zero_m, k2_m, c0_m, c1_m); \
296 ILVR_H2_SH(in0, in2, in1, in3, res0_m, res1_m); \
297 DOTP_SH2_SW(res0_m, res1_m, c0_m, c1_m, tmp0_m, tmp1_m); \
298 int2_m = tmp0_m + tmp1_m; \
300 c0_m = __msa_splati_h(mask_m, 6); \
301 c0_m = __msa_ilvev_h(c0_m, k1_m); \
303 res0_m = __msa_ilvr_h((in1), (in3)); \
304 tmp0_m = __msa_dotp_s_w(res0_m, c0_m); \
305 int3_m = tmp2_m + tmp0_m; \
307 res0_m = __msa_ilvr_h((in2), (in3)); \
308 c1_m = __msa_ilvev_h(k4_m, k3_m); \
310 tmp2_m = __msa_dotp_s_w(res0_m, c1_m); \
311 res1_m = __msa_ilvr_h((in0), (in2)); \
312 c1_m = __msa_ilvev_h(k1_m, zero_m); \
314 tmp3_m = __msa_dotp_s_w(res1_m, c1_m); \
318 SRARI_W4_SW(int0_m, int1_m, int2_m, int3_m, VP9_DCT_CONST_BITS); \
319 PCKEV_H2_SH(int0_m, int0_m, int1_m, int1_m, out0, out1); \
320 PCKEV_H2_SH(int2_m, int2_m, int3_m, int3_m, out2, out3); \
323 #define TRANSPOSE4X8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, \
324 out0, out1, out2, out3, out4, out5, out6, out7) \
326 v8i16 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
327 v8i16 tmp0_n, tmp1_n, tmp2_n, tmp3_n; \
328 v8i16 zero_m = { 0 }; \
330 ILVR_H4_SH(in1, in0, in3, in2, in5, in4, in7, in6, \
331 tmp0_n, tmp1_n, tmp2_n, tmp3_n); \
332 ILVRL_W2_SH(tmp1_n, tmp0_n, tmp0_m, tmp2_m); \
333 ILVRL_W2_SH(tmp3_n, tmp2_n, tmp1_m, tmp3_m); \
335 out0 = (v8i16) __msa_ilvr_d((v2i64) tmp1_m, (v2i64) tmp0_m); \
336 out1 = (v8i16) __msa_ilvl_d((v2i64) tmp1_m, (v2i64) tmp0_m); \
337 out2 = (v8i16) __msa_ilvr_d((v2i64) tmp3_m, (v2i64) tmp2_m); \
338 out3 = (v8i16) __msa_ilvl_d((v2i64) tmp3_m, (v2i64) tmp2_m); \
355 vec = __msa_fill_h(
out);
364 v8i16 in0, in1, in2, in3;
370 in1 = (v8i16) __msa_ilvl_d((v2i64) in0, (v2i64) in0);
371 in3 = (v8i16) __msa_ilvl_d((v2i64) in2, (v2i64) in2);
374 VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
377 VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
386 v8i16 in0, in1, in2, in3;
392 in1 = (v8i16) __msa_ilvl_d((v2i64) in0, (v2i64) in0);
393 in3 = (v8i16) __msa_ilvl_d((v2i64) in2, (v2i64) in2);
408 v8i16 in0, in1, in2, in3;
414 in1 = (v8i16) __msa_ilvl_d((v2i64) in0, (v2i64) in0);
415 in3 = (v8i16) __msa_ilvl_d((v2i64) in2, (v2i64) in2);
421 VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
430 v8i16 in0, in1, in2, in3;
436 in1 = (v8i16) __msa_ilvl_d((v2i64) in0, (v2i64) in0);
437 in3 = (v8i16) __msa_ilvl_d((v2i64) in2, (v2i64) in2);
440 VP9_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
449 #define VP9_SET_CONST_PAIR(mask_h, idx1_h, idx2_h) \
453 SPLATI_H2_SH(mask_h, idx1_h, idx2_h, c0_m, c1_m); \
454 c0_m = __msa_ilvev_h(c1_m, c0_m); \
460 #define VP9_MADD(inp0, inp1, inp2, inp3, cst0, cst1, cst2, cst3, \
461 out0, out1, out2, out3) \
463 v8i16 madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m; \
464 v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
466 ILVRL_H2_SH(inp1, inp0, madd_s1_m, madd_s0_m); \
467 ILVRL_H2_SH(inp3, inp2, madd_s3_m, madd_s2_m); \
468 DOTP_SH4_SW(madd_s1_m, madd_s0_m, madd_s1_m, madd_s0_m, \
469 cst0, cst0, cst1, cst1, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
470 SRARI_W4_SW(tmp0_m, tmp1_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
471 PCKEV_H2_SH(tmp1_m, tmp0_m, tmp3_m, tmp2_m, out0, out1); \
472 DOTP_SH4_SW(madd_s3_m, madd_s2_m, madd_s3_m, madd_s2_m, \
473 cst2, cst2, cst3, cst3, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
474 SRARI_W4_SW(tmp0_m, tmp1_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
475 PCKEV_H2_SH(tmp1_m, tmp0_m, tmp3_m, tmp2_m, out2, out3); \
479 #define VP9_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, \
480 out0, out1, out2, out3, out4, out5, out6, out7) \
482 v8i16 tp0_m, tp1_m, tp2_m, tp3_m, tp4_m, tp5_m, tp6_m, tp7_m; \
483 v8i16 k0_m, k1_m, k2_m, k3_m, res0_m, res1_m, res2_m, res3_m; \
484 v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
485 v8i16 mask_m = { cospi_28_64, cospi_4_64, cospi_20_64, cospi_12_64, \
486 cospi_16_64, -cospi_4_64, -cospi_20_64, -cospi_16_64 }; \
488 k0_m = VP9_SET_CONST_PAIR(mask_m, 0, 5); \
489 k1_m = VP9_SET_CONST_PAIR(mask_m, 1, 0); \
490 k2_m = VP9_SET_CONST_PAIR(mask_m, 6, 3); \
491 k3_m = VP9_SET_CONST_PAIR(mask_m, 3, 2); \
492 VP9_MADD(in1, in7, in3, in5, k0_m, k1_m, k2_m, k3_m, in1, in7, in3, in5); \
493 SUB2(in1, in3, in7, in5, res0_m, res1_m); \
494 k0_m = VP9_SET_CONST_PAIR(mask_m, 4, 7); \
495 k1_m = __msa_splati_h(mask_m, 4); \
497 ILVRL_H2_SH(res0_m, res1_m, res2_m, res3_m); \
498 DOTP_SH4_SW(res2_m, res3_m, res2_m, res3_m, k0_m, k0_m, k1_m, k1_m, \
499 tmp0_m, tmp1_m, tmp2_m, tmp3_m); \
500 SRARI_W4_SW(tmp0_m, tmp1_m, tmp2_m, tmp3_m, VP9_DCT_CONST_BITS); \
502 PCKEV_H2_SH(tmp1_m, tmp0_m, tmp3_m, tmp2_m, tp5_m, tp6_m); \
504 k2_m = VP9_SET_COSPI_PAIR(cospi_24_64, -cospi_8_64); \
505 k3_m = VP9_SET_COSPI_PAIR(cospi_8_64, cospi_24_64); \
506 VP9_MADD(in0, in4, in2, in6, k1_m, k0_m, k2_m, k3_m, \
507 in0, in4, in2, in6); \
508 BUTTERFLY_4(in0, in4, in2, in6, tp0_m, tp1_m, tp2_m, tp3_m); \
509 BUTTERFLY_8(tp0_m, tp1_m, tp2_m, tp3_m, tp4_m, tp5_m, tp6_m, tp7_m, \
510 out0, out1, out2, out3, out4, out5, out6, out7); \
513 #define VP9_IADST8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, \
514 out0, out1, out2, out3, out4, out5, out6, out7) \
516 v4i32 r0_m, r1_m, r2_m, r3_m, r4_m, r5_m, r6_m, r7_m; \
517 v4i32 m0_m, m1_m, m2_m, m3_m, t0_m, t1_m; \
518 v8i16 res0_m, res1_m, res2_m, res3_m, k0_m, k1_m, in_s0, in_s1; \
519 v8i16 mask1_m = { cospi_2_64, cospi_30_64, -cospi_2_64, \
520 cospi_10_64, cospi_22_64, -cospi_10_64, cospi_18_64, cospi_14_64 }; \
521 v8i16 mask2_m = { cospi_14_64, -cospi_18_64, cospi_26_64, \
522 cospi_6_64, -cospi_26_64, cospi_8_64, cospi_24_64, -cospi_8_64 }; \
523 v8i16 mask3_m = { -cospi_24_64, cospi_8_64, cospi_16_64, \
524 -cospi_16_64, 0, 0, 0, 0 }; \
526 k0_m = VP9_SET_CONST_PAIR(mask1_m, 0, 1); \
527 k1_m = VP9_SET_CONST_PAIR(mask1_m, 1, 2); \
528 ILVRL_H2_SH(in1, in0, in_s1, in_s0); \
529 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
530 r0_m, r1_m, r2_m, r3_m); \
531 k0_m = VP9_SET_CONST_PAIR(mask1_m, 6, 7); \
532 k1_m = VP9_SET_CONST_PAIR(mask2_m, 0, 1); \
533 ILVRL_H2_SH(in5, in4, in_s1, in_s0); \
534 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
535 r4_m, r5_m, r6_m, r7_m); \
536 ADD4(r0_m, r4_m, r1_m, r5_m, r2_m, r6_m, r3_m, r7_m, \
537 m0_m, m1_m, m2_m, m3_m); \
538 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
539 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, res0_m, res1_m); \
540 SUB4(r0_m, r4_m, r1_m, r5_m, r2_m, r6_m, r3_m, r7_m, \
541 m0_m, m1_m, m2_m, m3_m); \
542 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
543 PCKEV_H2_SW(m1_m, m0_m, m3_m, m2_m, t0_m, t1_m); \
544 k0_m = VP9_SET_CONST_PAIR(mask1_m, 3, 4); \
545 k1_m = VP9_SET_CONST_PAIR(mask1_m, 4, 5); \
546 ILVRL_H2_SH(in3, in2, in_s1, in_s0); \
547 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
548 r0_m, r1_m, r2_m, r3_m); \
549 k0_m = VP9_SET_CONST_PAIR(mask2_m, 2, 3); \
550 k1_m = VP9_SET_CONST_PAIR(mask2_m, 3, 4); \
551 ILVRL_H2_SH(in7, in6, in_s1, in_s0); \
552 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
553 r4_m, r5_m, r6_m, r7_m); \
554 ADD4(r0_m, r4_m, r1_m, r5_m, r2_m, r6_m, r3_m, r7_m, \
555 m0_m, m1_m, m2_m, m3_m); \
556 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
557 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, res2_m, res3_m); \
558 SUB4(r0_m, r4_m, r1_m, r5_m, r2_m, r6_m, r3_m, r7_m, \
559 m0_m, m1_m, m2_m, m3_m); \
560 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
561 PCKEV_H2_SW(m1_m, m0_m, m3_m, m2_m, r2_m, r3_m); \
562 ILVRL_H2_SW(r3_m, r2_m, m2_m, m3_m); \
563 BUTTERFLY_4(res0_m, res1_m, res3_m, res2_m, out0, in7, in4, in3); \
564 k0_m = VP9_SET_CONST_PAIR(mask2_m, 5, 6); \
565 k1_m = VP9_SET_CONST_PAIR(mask2_m, 6, 7); \
566 ILVRL_H2_SH(t1_m, t0_m, in_s1, in_s0); \
567 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
568 r0_m, r1_m, r2_m, r3_m); \
569 k1_m = VP9_SET_CONST_PAIR(mask3_m, 0, 1); \
570 DOTP_SH4_SW(m2_m, m3_m, m2_m, m3_m, k0_m, k0_m, k1_m, k1_m, \
571 r4_m, r5_m, r6_m, r7_m); \
572 ADD4(r0_m, r6_m, r1_m, r7_m, r2_m, r4_m, r3_m, r5_m, \
573 m0_m, m1_m, m2_m, m3_m); \
574 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
575 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, in1, out6); \
576 SUB4(r0_m, r6_m, r1_m, r7_m, r2_m, r4_m, r3_m, r5_m, \
577 m0_m, m1_m, m2_m, m3_m); \
578 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
579 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, in2, in5); \
580 k0_m = VP9_SET_CONST_PAIR(mask3_m, 2, 2); \
581 k1_m = VP9_SET_CONST_PAIR(mask3_m, 2, 3); \
582 ILVRL_H2_SH(in4, in3, in_s1, in_s0); \
583 DOTP_SH4_SW(in_s1, in_s0, in_s1, in_s0, k0_m, k0_m, k1_m, k1_m, \
584 m0_m, m1_m, m2_m, m3_m); \
585 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
586 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, in3, out4); \
587 ILVRL_H2_SW(in5, in2, m2_m, m3_m); \
588 DOTP_SH4_SW(m2_m, m3_m, m2_m, m3_m, k0_m, k0_m, k1_m, k1_m, \
589 m0_m, m1_m, m2_m, m3_m); \
590 SRARI_W4_SW(m0_m, m1_m, m2_m, m3_m, VP9_DCT_CONST_BITS); \
591 PCKEV_H2_SH(m1_m, m0_m, m3_m, m2_m, out2, in5); \
609 vec = __msa_fill_h(
val);
613 dst += (4 * dst_stride);
620 v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
621 v8i16 s0, s1, s2, s3, s4, s5, s6, s7, k0, k1, k2, k3, m0, m1, m2, m3;
622 v4i32 tmp0, tmp1, tmp2, tmp3;
626 LD_SH8(
input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
637 DOTP_SH4_SW(s0, s0, s1, s1, k0, k1, k2, k3, tmp0, tmp1, tmp2, tmp3);
649 DOTP_SH4_SW(s0, s0, s1, s1, k0, k1, k2, k3, tmp0, tmp1, tmp2, tmp3);
656 s0 = __msa_ilvr_h(s6, s5);
665 in0, in1, in2, in3, in4, in5, in6, in7);
667 in0, in1, in2, in3, in4, in5, in6, in7);
669 in0, in1, in2, in3, in4, in5, in6, in7);
677 dst += (4 * dst_stride);
684 v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
688 LD_SH8(
input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
692 in0, in1, in2, in3, in4, in5, in6, in7);
695 in0, in1, in2, in3, in4, in5, in6, in7);
698 in0, in1, in2, in3, in4, in5, in6, in7);
704 dst += (4 * dst_stride);
711 v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
712 v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
713 v16u8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
714 v8i16 out0, out1, out2, out3, out4, out5, out6, out7;
715 v8i16 cnst0, cnst1, cnst2, cnst3, cnst4;
716 v8i16 temp0, temp1, temp2, temp3, s0, s1;
720 LD_SH8(
input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
724 VP9_ADST8(in0, in1, in2, in3, in4, in5, in6, in7,
725 in0, in1, in2, in3, in4, in5, in6, in7);
729 in0, in1, in2, in3, in4, in5, in6, in7);
734 ILVEV_H2_SH(cnst0, cnst1, cnst1, cnst2, cnst0, cnst1);
738 ILVEV_H2_SH(cnst2, cnst3, cnst3, cnst4, cnst2, cnst3);
743 cnst3, in7, in0, in4, in3);
748 ILVEV_H2_SH(cnst0, cnst1, cnst1, cnst2, cnst0, cnst1);
752 ILVEV_H2_SH(cnst2, cnst3, cnst3, cnst4, cnst2, cnst3);
757 cnst3, in5, in2, in6, in1);
765 res0 = (v8i16) __msa_ilvr_b((v16i8)
zero, (v16i8) dst0);
768 res0 = (v8i16) __msa_pckev_b((v16i8) res0, (v16i8) res0);
771 res7 = (v8i16) __msa_ilvr_b((v16i8)
zero, (v16i8) dst7);
774 res7 = (v8i16) __msa_pckev_b((v16i8) res7, (v16i8) res7);
775 ST_D1(res7, 0,
dst + 7 * dst_stride);
782 ILVEV_H2_SH(cnst3, cnst0, cnst1, cnst2, cnst3, cnst2);
783 cnst0 = __msa_ilvev_h(cnst1, cnst0);
789 cnst1, out1, out6, s0, s1);
795 ADD2(res1, out1, res6, out6, res1, res6);
799 ST_D1(res6, 0,
dst + 6 * dst_stride);
803 cnst1 = __msa_ilvev_h(cnst1, cnst0);
814 ADD2(res3, out3, res4, out4, res3, res4);
817 ST_D1(res3, 0,
dst + 3 * dst_stride);
818 ST_D1(res4, 0,
dst + 4 * dst_stride);
827 ADD2(res2, out2, res5, out5, res2, res5);
830 ST_D1(res2, 0,
dst + 2 * dst_stride);
831 ST_D1(res5, 0,
dst + 5 * dst_stride);
837 v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
841 LD_SH8(
input, 8, in1, in6, in3, in4, in5, in2, in7, in0);
845 in0, in1, in2, in3, in4, in5, in6, in7);
848 in0, in1, in2, in3, in4, in5, in6, in7);
851 in0, in1, in2, in3, in4, in5, in6, in7);
857 dst += (4 * dst_stride);
864 v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
868 LD_SH8(
input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
873 in0, in1, in2, in3, in4, in5, in6, in7);
876 in1, in6, in3, in4, in5, in2, in7, in0);
879 in0, in1, in2, in3, in4, in5, in6, in7);
885 dst += (4 * dst_stride);
889 #define VP9_IADST8x16_1D(r0, r1, r2, r3, r4, r5, r6, r7, r8, \
890 r9, r10, r11, r12, r13, r14, r15, \
891 out0, out1, out2, out3, out4, out5, \
892 out6, out7, out8, out9, out10, out11, \
893 out12, out13, out14, out15) \
895 v8i16 g0_m, g1_m, g2_m, g3_m, g4_m, g5_m, g6_m, g7_m; \
896 v8i16 g8_m, g9_m, g10_m, g11_m, g12_m, g13_m, g14_m, g15_m; \
897 v8i16 h0_m, h1_m, h2_m, h3_m, h4_m, h5_m, h6_m, h7_m; \
898 v8i16 h8_m, h9_m, h10_m, h11_m; \
899 v8i16 k0_m, k1_m, k2_m, k3_m; \
902 k0_m = VP9_SET_COSPI_PAIR(cospi_1_64, cospi_31_64); \
903 k1_m = VP9_SET_COSPI_PAIR(cospi_31_64, -cospi_1_64); \
904 k2_m = VP9_SET_COSPI_PAIR(cospi_17_64, cospi_15_64); \
905 k3_m = VP9_SET_COSPI_PAIR(cospi_15_64, -cospi_17_64); \
906 VP9_MADD_BF(r15, r0, r7, r8, k0_m, k1_m, k2_m, k3_m, \
907 g0_m, g1_m, g2_m, g3_m); \
908 k0_m = VP9_SET_COSPI_PAIR(cospi_5_64, cospi_27_64); \
909 k1_m = VP9_SET_COSPI_PAIR(cospi_27_64, -cospi_5_64); \
910 k2_m = VP9_SET_COSPI_PAIR(cospi_21_64, cospi_11_64); \
911 k3_m = VP9_SET_COSPI_PAIR(cospi_11_64, -cospi_21_64); \
912 VP9_MADD_BF(r13, r2, r5, r10, k0_m, k1_m, k2_m, k3_m, \
913 g4_m, g5_m, g6_m, g7_m); \
914 k0_m = VP9_SET_COSPI_PAIR(cospi_9_64, cospi_23_64); \
915 k1_m = VP9_SET_COSPI_PAIR(cospi_23_64, -cospi_9_64); \
916 k2_m = VP9_SET_COSPI_PAIR(cospi_25_64, cospi_7_64); \
917 k3_m = VP9_SET_COSPI_PAIR(cospi_7_64, -cospi_25_64); \
918 VP9_MADD_BF(r11, r4, r3, r12, k0_m, k1_m, k2_m, k3_m, \
919 g8_m, g9_m, g10_m, g11_m); \
920 k0_m = VP9_SET_COSPI_PAIR(cospi_13_64, cospi_19_64); \
921 k1_m = VP9_SET_COSPI_PAIR(cospi_19_64, -cospi_13_64); \
922 k2_m = VP9_SET_COSPI_PAIR(cospi_29_64, cospi_3_64); \
923 k3_m = VP9_SET_COSPI_PAIR(cospi_3_64, -cospi_29_64); \
924 VP9_MADD_BF(r9, r6, r1, r14, k0_m, k1_m, k2_m, k3_m, \
925 g12_m, g13_m, g14_m, g15_m); \
928 k0_m = VP9_SET_COSPI_PAIR(cospi_4_64, cospi_28_64); \
929 k1_m = VP9_SET_COSPI_PAIR(cospi_28_64, -cospi_4_64); \
930 k2_m = VP9_SET_COSPI_PAIR(-cospi_28_64, cospi_4_64); \
931 VP9_MADD_BF(g1_m, g3_m, g9_m, g11_m, k0_m, k1_m, k2_m, k0_m, \
932 h0_m, h1_m, h2_m, h3_m); \
933 k0_m = VP9_SET_COSPI_PAIR(cospi_12_64, cospi_20_64); \
934 k1_m = VP9_SET_COSPI_PAIR(-cospi_20_64, cospi_12_64); \
935 k2_m = VP9_SET_COSPI_PAIR(cospi_20_64, -cospi_12_64); \
936 VP9_MADD_BF(g7_m, g5_m, g15_m, g13_m, k0_m, k1_m, k2_m, k0_m, \
937 h4_m, h5_m, h6_m, h7_m); \
938 BUTTERFLY_4(h0_m, h2_m, h6_m, h4_m, out8, out9, out11, out10); \
939 BUTTERFLY_8(g0_m, g2_m, g4_m, g6_m, g14_m, g12_m, g10_m, g8_m, \
940 h8_m, h9_m, h10_m, h11_m, h6_m, h4_m, h2_m, h0_m); \
943 BUTTERFLY_4(h8_m, h9_m, h11_m, h10_m, out0, out1, h11_m, h10_m); \
944 k0_m = VP9_SET_COSPI_PAIR(cospi_8_64, cospi_24_64); \
945 k1_m = VP9_SET_COSPI_PAIR(cospi_24_64, -cospi_8_64); \
946 k2_m = VP9_SET_COSPI_PAIR(-cospi_24_64, cospi_8_64); \
947 VP9_MADD_BF(h0_m, h2_m, h4_m, h6_m, k0_m, k1_m, k2_m, k0_m, \
948 out4, out6, out5, out7); \
949 VP9_MADD_BF(h1_m, h3_m, h5_m, h7_m, k0_m, k1_m, k2_m, k0_m, \
950 out12, out14, out13, out15); \
953 k0_m = VP9_SET_COSPI_PAIR(cospi_16_64, cospi_16_64); \
954 k1_m = VP9_SET_COSPI_PAIR(-cospi_16_64, -cospi_16_64); \
955 k2_m = VP9_SET_COSPI_PAIR(cospi_16_64, -cospi_16_64); \
956 k3_m = VP9_SET_COSPI_PAIR(-cospi_16_64, cospi_16_64); \
957 VP9_MADD_SHORT(h10_m, h11_m, k1_m, k2_m, out2, out3); \
958 VP9_MADD_SHORT(out6, out7, k0_m, k3_m, out6, out7); \
959 VP9_MADD_SHORT(out10, out11, k0_m, k3_m, out10, out11); \
960 VP9_MADD_SHORT(out14, out15, k1_m, k2_m, out14, out15); \
966 v8i16 loc0, loc1, loc2, loc3;
967 v8i16 reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14;
968 v8i16 reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15;
969 v8i16 tmp5, tmp6, tmp7;
974 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7,
975 reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15);
983 BUTTERFLY_4(reg2, reg14, reg6, reg10, loc0, loc1, reg14, reg2);
987 BUTTERFLY_4(reg8, reg0, reg4, reg12, reg2, reg6, reg10, reg14);
991 reg12 = reg14 - loc0;
992 reg14 = reg14 + loc0;
996 reg10 = reg10 + loc2;
1004 reg7 = reg15 - loc3;
1005 reg15 = reg15 + loc3;
1009 BUTTERFLY_4(loc0, loc1, reg11, reg5, reg13, reg3, reg11, reg5);
1011 loc1 = reg15 + reg3;
1012 reg3 = reg15 - reg3;
1014 reg15 = reg2 - loc1;
1016 loc1 = reg1 + reg13;
1017 reg13 = reg1 - reg13;
1033 loc0 = reg7 + reg11;
1034 reg11 = reg7 - reg11;
1040 BUTTERFLY_4(reg8, reg10, reg11, reg5, loc0, reg4, reg9, loc1);
1046 BUTTERFLY_4(reg12, reg14, reg13, reg3, reg8, reg6, reg7, reg5);
1056 dst += (4 * dst_stride);
1059 dst += (4 * dst_stride);
1062 dst += (4 * dst_stride);
1069 v8i16 loc0, loc1, loc2, loc3;
1070 v8i16 reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14;
1071 v8i16 reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15;
1072 v8i16 tmp5, tmp6, tmp7;
1077 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7,
1078 reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15);
1086 BUTTERFLY_4(reg2, reg14, reg6, reg10, loc0, loc1, reg14, reg2);
1090 BUTTERFLY_4(reg8, reg0, reg4, reg12, reg2, reg6, reg10, reg14);
1094 reg12 = reg14 - loc0;
1095 reg14 = reg14 + loc0;
1098 reg8 = reg10 - loc2;
1099 reg10 = reg10 + loc2;
1107 reg7 = reg15 - loc3;
1108 reg15 = reg15 + loc3;
1112 BUTTERFLY_4(loc0, loc1, reg11, reg5, reg13, reg3, reg11, reg5);
1114 loc1 = reg15 + reg3;
1115 reg3 = reg15 - reg3;
1117 reg15 = reg2 - loc1;
1119 loc1 = reg1 + reg13;
1120 reg13 = reg1 - reg13;
1136 loc0 = reg7 + reg11;
1137 reg11 = reg7 - reg11;
1144 BUTTERFLY_4(reg8, reg10, reg11, reg5, loc0, reg4, reg9, loc1);
1150 BUTTERFLY_4(reg12, reg14, reg13, reg3, reg8, reg6, reg7, reg5);
1160 reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14);
1162 ST_SH4(reg8, reg10, reg12, reg14, (
output + 4 * 16), 16);
1166 reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15);
1168 ST_SH4(reg7, reg9, reg1, reg15, (
output + 8 + 4 * 16), 16);
1176 v8i16 vec, res0, res1, res2, res3, res4, res5, res6, res7;
1177 v16u8 dst0, dst1, dst2, dst3, tmp0, tmp1, tmp2, tmp3;
1184 vec = __msa_fill_h(
out);
1187 LD_UB4(
dst, dst_stride, dst0, dst1, dst2, dst3);
1192 ADD4(res0, vec, res1, vec, res2, vec, res3, vec, res0, res1, res2,
1194 ADD4(res4, vec, res5, vec, res6, vec, res7, vec, res4, res5, res6,
1197 PCKEV_B4_UB(res4, res0, res5, res1, res6, res2, res7, res3,
1198 tmp0, tmp1, tmp2, tmp3);
1199 ST_UB4(tmp0, tmp1, tmp2, tmp3,
dst, dst_stride);
1200 dst += (4 * dst_stride);
1209 int16_t *
out = out_arr;
1216 for (
i = 12;
i--;) {
1218 "sw $zero, 0(%[out]) \n\t"
1219 "sw $zero, 4(%[out]) \n\t"
1220 "sw $zero, 8(%[out]) \n\t"
1221 "sw $zero, 12(%[out]) \n\t"
1222 "sw $zero, 16(%[out]) \n\t"
1223 "sw $zero, 20(%[out]) \n\t"
1224 "sw $zero, 24(%[out]) \n\t"
1225 "sw $zero, 28(%[out]) \n\t"
1237 for (
i = 0;
i < 2;
i++) {
1249 int16_t *
out = out_arr;
1252 for (
i = 0;
i < 2;
i++) {
1258 for (
i = 0;
i < 2;
i++) {
1267 v8i16 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
1268 v8i16 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15;
1273 l0, l1, l2, l3, l4, l5, l6, l7,
1274 l8, l9, l10, l11, l12, l13, l14, l15);
1282 l8, l9, l10, l11, l12, l13, l14, l15,
1283 r0, r1, r2, r3, r4, r5, r6, r7,
1284 r8, r9, r10, r11, r12, r13, r14, r15);
1292 l0, l1, l2, l3, l4, l5, l6, l7);
1295 l8, l9, l10, l11, l12, l13, l14, l15);
1296 ST_SH8(l8, l9, l10, l11, l12, l13, l14, l15, (
output + 8), 16);
1302 v8i16 v0, v2, v4, v6, k0, k1, k2, k3;
1303 v8i16 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
1304 v8i16 out0, out1, out2, out3, out4, out5, out6, out7;
1305 v8i16 out8, out9, out10, out11, out12, out13, out14, out15;
1306 v8i16 g0, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15;
1307 v8i16
h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11;
1308 v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
1309 v8i16 res8, res9, res10, res11, res12, res13, res14, res15;
1310 v16u8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
1311 v16u8 dst8, dst9, dst10, dst11, dst12, dst13, dst14, dst15;
1328 VP9_MADD_BF(r15, r0, r7, r8, k0, k1, k2, k3, g0, g1, g2, g3);
1333 VP9_MADD_BF(r11, r4, r3, r12, k0, k1, k2, k3, g8, g9, g10, g11);
1338 VP9_MADD_BF(g1, g3, g9, g11, k0, k1, k2, k0,
h0, h1, h2, h3);
1353 VP9_MADD_BF(r13, r2, r5, r10, k0, k1, k2, k3, g4, g5, g6, g7);
1358 VP9_MADD_BF(r9, r6, r1, r14, k0, k1, k2, k3, g12, g13, g14, g15);
1360 BUTTERFLY_4(h8, h9, h11, h10, out0, out1, h11, h10);
1363 dst0 =
LD_UB(
dst + 0 * dst_stride);
1364 dst1 =
LD_UB(
dst + 15 * dst_stride);
1366 ADD2(res0, out0, res1, out1, res0, res1);
1370 ST_D1(res1, 0,
dst + 15 * dst_stride);
1375 VP9_MADD_BF(g7, g5, g15, g13, k0, k1, k2, k0, h4, h5, h6, h7);
1380 dst8 =
LD_UB(
dst + 1 * dst_stride);
1381 dst9 =
LD_UB(
dst + 14 * dst_stride);
1383 ADD2(res8, out8, res9, out9, res8, res9);
1387 ST_D1(res9, 0,
dst + 14 * dst_stride);
1392 VP9_MADD_BF(v0, v2, v4, v6, k0, k1, k2, k0, out4, out6, out5, out7);
1395 dst4 =
LD_UB(
dst + 3 * dst_stride);
1396 dst5 =
LD_UB(
dst + 12 * dst_stride);
1398 ADD2(res4, out4, res5, out5, res4, res5);
1401 ST_D1(res4, 0,
dst + 3 * dst_stride);
1402 ST_D1(res5, 0,
dst + 12 * dst_stride);
1404 VP9_MADD_BF(h1, h3, h5, h7, k0, k1, k2, k0, out12, out14, out13, out15);
1407 dst12 =
LD_UB(
dst + 2 * dst_stride);
1408 dst13 =
LD_UB(
dst + 13 * dst_stride);
1410 ADD2(res12, out12, res13, out13, res12, res13);
1412 PCKEV_B2_SH(res12, res12, res13, res13, res12, res13);
1413 ST_D1(res12, 0,
dst + 2 * dst_stride);
1414 ST_D1(res13, 0,
dst + 13 * dst_stride);
1420 dst6 =
LD_UB(
dst + 4 * dst_stride);
1421 dst7 =
LD_UB(
dst + 11 * dst_stride);
1423 ADD2(res6, out6, res7, out7, res6, res7);
1426 ST_D1(res6, 0,
dst + 4 * dst_stride);
1427 ST_D1(res7, 0,
dst + 11 * dst_stride);
1431 dst10 =
LD_UB(
dst + 6 * dst_stride);
1432 dst11 =
LD_UB(
dst + 9 * dst_stride);
1434 ADD2(res10, out10, res11, out11, res10, res11);
1436 PCKEV_B2_SH(res10, res10, res11, res11, res10, res11);
1437 ST_D1(res10, 0,
dst + 6 * dst_stride);
1438 ST_D1(res11, 0,
dst + 9 * dst_stride);
1444 dst2 =
LD_UB(
dst + 7 * dst_stride);
1445 dst3 =
LD_UB(
dst + 8 * dst_stride);
1447 ADD2(res2, out2, res3, out3, res2, res3);
1450 ST_D1(res2, 0,
dst + 7 * dst_stride);
1451 ST_D1(res3, 0,
dst + 8 * dst_stride);
1455 dst14 =
LD_UB(
dst + 5 * dst_stride);
1456 dst15 =
LD_UB(
dst + 10 * dst_stride);
1458 ADD2(res14, out14, res15, out15, res14, res15);
1460 PCKEV_B2_SH(res14, res14, res15, res15, res14, res15);
1461 ST_D1(res14, 0,
dst + 5 * dst_stride);
1462 ST_D1(res15, 0,
dst + 10 * dst_stride);
1469 int16_t *
out = out_arr;
1473 for (
i = 0;
i < 2;
i++) {
1479 for (
i = 0;
i < 2;
i++) {
1490 int16_t
out[16 * 16];
1491 int16_t *out_ptr = &
out[0];
1494 for (
i = 0;
i < 2;
i++) {
1500 for (
i = 0;
i < 2;
i++) {
1503 (
dst + (
i << 3)), dst_stride);
1511 int16_t
out[16 * 16];
1512 int16_t *out_ptr = &
out[0];
1515 for (
i = 0;
i < 2;
i++) {
1521 for (
i = 0;
i < 2;
i++) {
1524 (
dst + (
i << 3)), dst_stride);
1529 int16_t *tmp_eve_buf,
1530 int16_t *tmp_odd_buf,
1533 v8i16 vec0, vec1, vec2, vec3, loc0, loc1, loc2, loc3;
1534 v8i16 m0, m1, m2, m3, m4, m5, m6, m7, n0, n1, n2, n3, n4, n5, n6, n7;
1537 vec0 =
LD_SH(tmp_odd_buf);
1538 vec1 =
LD_SH(tmp_odd_buf + 9 * 8);
1539 vec2 =
LD_SH(tmp_odd_buf + 14 * 8);
1540 vec3 =
LD_SH(tmp_odd_buf + 6 * 8);
1541 loc0 =
LD_SH(tmp_eve_buf);
1542 loc1 =
LD_SH(tmp_eve_buf + 8 * 8);
1543 loc2 =
LD_SH(tmp_eve_buf + 4 * 8);
1544 loc3 =
LD_SH(tmp_eve_buf + 12 * 8);
1546 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m0, m4, m2, m6);
1548 ST_SH((loc0 - vec3), (tmp_buf + 31 * 8));
1549 ST_SH((loc1 - vec2), (tmp_buf + 23 * 8));
1550 ST_SH((loc2 - vec1), (tmp_buf + 27 * 8));
1551 ST_SH((loc3 - vec0), (tmp_buf + 19 * 8));
1554 vec0 =
LD_SH(tmp_odd_buf + 4 * 8);
1555 vec1 =
LD_SH(tmp_odd_buf + 13 * 8);
1556 vec2 =
LD_SH(tmp_odd_buf + 10 * 8);
1557 vec3 =
LD_SH(tmp_odd_buf + 3 * 8);
1558 loc0 =
LD_SH(tmp_eve_buf + 2 * 8);
1559 loc1 =
LD_SH(tmp_eve_buf + 10 * 8);
1560 loc2 =
LD_SH(tmp_eve_buf + 6 * 8);
1561 loc3 =
LD_SH(tmp_eve_buf + 14 * 8);
1563 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m1, m5, m3, m7);
1565 ST_SH((loc0 - vec3), (tmp_buf + 29 * 8));
1566 ST_SH((loc1 - vec2), (tmp_buf + 21 * 8));
1567 ST_SH((loc2 - vec1), (tmp_buf + 25 * 8));
1568 ST_SH((loc3 - vec0), (tmp_buf + 17 * 8));
1571 vec0 =
LD_SH(tmp_odd_buf + 2 * 8);
1572 vec1 =
LD_SH(tmp_odd_buf + 11 * 8);
1573 vec2 =
LD_SH(tmp_odd_buf + 12 * 8);
1574 vec3 =
LD_SH(tmp_odd_buf + 7 * 8);
1575 loc0 =
LD_SH(tmp_eve_buf + 1 * 8);
1576 loc1 =
LD_SH(tmp_eve_buf + 9 * 8);
1577 loc2 =
LD_SH(tmp_eve_buf + 5 * 8);
1578 loc3 =
LD_SH(tmp_eve_buf + 13 * 8);
1580 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n0, n4, n2, n6);
1582 ST_SH((loc0 - vec3), (tmp_buf + 30 * 8));
1583 ST_SH((loc1 - vec2), (tmp_buf + 22 * 8));
1584 ST_SH((loc2 - vec1), (tmp_buf + 26 * 8));
1585 ST_SH((loc3 - vec0), (tmp_buf + 18 * 8));
1588 vec0 =
LD_SH(tmp_odd_buf + 5 * 8);
1589 vec1 =
LD_SH(tmp_odd_buf + 15 * 8);
1590 vec2 =
LD_SH(tmp_odd_buf + 8 * 8);
1591 vec3 =
LD_SH(tmp_odd_buf + 1 * 8);
1592 loc0 =
LD_SH(tmp_eve_buf + 3 * 8);
1593 loc1 =
LD_SH(tmp_eve_buf + 11 * 8);
1594 loc2 =
LD_SH(tmp_eve_buf + 7 * 8);
1595 loc3 =
LD_SH(tmp_eve_buf + 15 * 8);
1597 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n1, n5, n3, n7);
1599 ST_SH((loc0 - vec3), (tmp_buf + 28 * 8));
1600 ST_SH((loc1 - vec2), (tmp_buf + 20 * 8));
1601 ST_SH((loc2 - vec1), (tmp_buf + 24 * 8));
1602 ST_SH((loc3 - vec0), (tmp_buf + 16 * 8));
1607 m0, n0, m1, n1, m2, n2, m3, n3);
1609 ST_SH4(m2, n2, m3, n3, (
dst + 4 * 32), 32);
1612 m4, n4, m5, n5, m6, n6, m7, n7);
1614 ST_SH4(m6, n6, m7, n7, (
dst + 8 + 4 * 32), 32);
1617 LD_SH8((tmp_buf + 8 * 16), 8, m0, n0, m1, n1, m2, n2, m3, n3);
1618 LD_SH8((tmp_buf + 12 * 16), 8, m4, n4, m5, n5, m6, n6, m7, n7);
1620 m0, n0, m1, n1, m2, n2, m3, n3);
1622 ST_SH4(m2, n2, m3, n3, (
dst + 16 + 4 * 32), 32);
1625 m4, n4, m5, n5, m6, n6, m7, n7);
1627 ST_SH4(m6, n6, m7, n7, (
dst + 24 + 4 * 32), 32);
1631 int16_t *tmp_eve_buf)
1633 v8i16 vec0, vec1, vec2, vec3, loc0, loc1, loc2, loc3;
1634 v8i16 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
1635 v8i16 stp0, stp1, stp2, stp3, stp4, stp5, stp6, stp7;
1639 LD_SH8(tmp_buf, (4 * 32), reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7);
1641 tmp_buf += (2 * 32);
1645 BUTTERFLY_4(reg1, reg7, reg3, reg5, vec1, vec3, vec2, vec0);
1653 BUTTERFLY_4(reg4, reg0, reg2, reg6, vec1, vec3, vec2, vec0);
1654 BUTTERFLY_4(vec0, vec1, loc1, loc0, stp3, stp0, stp7, stp4);
1655 BUTTERFLY_4(vec2, vec3, loc3, loc2, stp2, stp1, stp6, stp5);
1659 LD_SH8(tmp_buf, (4 * 32), reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7);
1696 BUTTERFLY_4(stp0, stp1, reg7, reg5, loc1, loc3, loc2, loc0);
1697 ST_SH2(loc1, loc3, tmp_eve_buf, 8);
1698 ST_SH2(loc2, loc0, (tmp_eve_buf + 14 * 8), 8);
1700 BUTTERFLY_4(stp2, stp3, reg4, reg1, loc1, loc3, loc2, loc0);
1701 ST_SH2(loc1, loc3, (tmp_eve_buf + 2 * 8), 8);
1702 ST_SH2(loc2, loc0, (tmp_eve_buf + 12 * 8), 8);
1705 BUTTERFLY_4(stp4, stp5, reg6, reg3, loc1, loc3, loc2, loc0);
1706 ST_SH2(loc1, loc3, (tmp_eve_buf + 4 * 8), 8);
1707 ST_SH2(loc2, loc0, (tmp_eve_buf + 10 * 8), 8);
1709 BUTTERFLY_4(stp6, stp7, reg2, reg0, loc1, loc3, loc2, loc0);
1710 ST_SH2(loc1, loc3, (tmp_eve_buf + 6 * 8), 8);
1711 ST_SH2(loc2, loc0, (tmp_eve_buf + 8 * 8), 8);
1715 int16_t *tmp_odd_buf)
1717 v8i16 vec0, vec1, vec2, vec3, loc0, loc1, loc2, loc3;
1718 v8i16 reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
1722 reg0 =
LD_SH(tmp_buf + 32);
1723 reg1 =
LD_SH(tmp_buf + 7 * 32);
1724 reg2 =
LD_SH(tmp_buf + 9 * 32);
1725 reg3 =
LD_SH(tmp_buf + 15 * 32);
1726 reg4 =
LD_SH(tmp_buf + 17 * 32);
1727 reg5 =
LD_SH(tmp_buf + 23 * 32);
1728 reg6 =
LD_SH(tmp_buf + 25 * 32);
1729 reg7 =
LD_SH(tmp_buf + 31 * 32);
1756 ADD2(reg5, reg4, reg3, reg2, vec0, vec1);
1757 ST_SH2(vec0, vec1, (tmp_odd_buf + 4 * 8), 8);
1758 SUB2(reg5, reg4, reg3, reg2, vec0, vec1);
1760 ST_SH2(vec0, vec1, tmp_odd_buf, 8);
1765 BUTTERFLY_4(reg0, reg7, reg6, reg1, vec0, vec1, vec2, vec3);
1766 ST_SH2(vec0, vec1, (tmp_odd_buf + 6 * 8), 8);
1768 ST_SH2(vec2, vec3, (tmp_odd_buf + 2 * 8), 8);
1772 reg0 =
LD_SH(tmp_buf + 3 * 32);
1773 reg1 =
LD_SH(tmp_buf + 5 * 32);
1774 reg2 =
LD_SH(tmp_buf + 11 * 32);
1775 reg3 =
LD_SH(tmp_buf + 13 * 32);
1776 reg4 =
LD_SH(tmp_buf + 19 * 32);
1777 reg5 =
LD_SH(tmp_buf + 21 * 32);
1778 reg6 =
LD_SH(tmp_buf + 27 * 32);
1779 reg7 =
LD_SH(tmp_buf + 29 * 32);
1796 SUB4(reg1, reg2, reg6, reg5, reg0, reg3, reg7, reg4,
1797 vec0, vec1, vec2, vec3);
1800 BUTTERFLY_4(loc2, loc3, loc1, loc0, vec0, vec1, vec3, vec2);
1801 ST_SH2(vec0, vec1, (tmp_odd_buf + 12 * 8), 3 * 8);
1803 ST_SH2(vec0, vec1, (tmp_odd_buf + 10 * 8), 8);
1806 ADD4(reg0, reg3, reg1, reg2, reg5, reg6, reg4, reg7,
1807 vec0, vec1, vec2, vec3);
1808 BUTTERFLY_4(vec0, vec3, vec2, vec1, reg0, reg1, reg3, reg2);
1809 ST_SH2(reg0, reg1, (tmp_odd_buf + 13 * 8), 8);
1811 ST_SH2(reg0, reg1, (tmp_odd_buf + 8 * 8), 8);
1815 LD_SH4(tmp_odd_buf, 8, reg0, reg1, reg2, reg3);
1816 LD_SH4((tmp_odd_buf + 8 * 8), 8, reg4, reg5, reg6, reg7);
1818 ADD4(reg0, reg4, reg1, reg5, reg2, reg6, reg3, reg7,
1819 loc0, loc1, loc2, loc3);
1820 ST_SH4(loc0, loc1, loc2, loc3, tmp_odd_buf, 8);
1822 SUB2(reg0, reg4, reg1, reg5, vec0, vec1);
1825 SUB2(reg2, reg6, reg3, reg7, vec0, vec1);
1827 ST_SH4(loc0, loc1, loc2, loc3, (tmp_odd_buf + 8 * 8), 8);
1830 LD_SH4((tmp_odd_buf + 4 * 8), 8, reg1, reg2, reg0, reg3);
1831 LD_SH4((tmp_odd_buf + 12 * 8), 8, reg4, reg5, reg6, reg7);
1833 ADD4(reg0, reg4, reg1, reg5, reg2, reg6, reg3, reg7,
1834 loc0, loc1, loc2, loc3);
1835 ST_SH4(loc0, loc1, loc2, loc3, (tmp_odd_buf + 4 * 8), 8);
1837 SUB2(reg0, reg4, reg3, reg7, vec0, vec1);
1840 SUB2(reg1, reg5, reg2, reg6, vec0, vec1);
1842 ST_SH4(loc0, loc1, loc2, loc3, (tmp_odd_buf + 12 * 8), 8);
1846 int16_t *tmp_odd_buf,
1850 v8i16 vec0, vec1, vec2, vec3, loc0, loc1, loc2, loc3;
1851 v8i16 m0, m1, m2, m3, m4, m5, m6, m7, n0, n1, n2, n3, n4, n5, n6, n7;
1854 vec0 =
LD_SH(tmp_odd_buf);
1855 vec1 =
LD_SH(tmp_odd_buf + 9 * 8);
1856 vec2 =
LD_SH(tmp_odd_buf + 14 * 8);
1857 vec3 =
LD_SH(tmp_odd_buf + 6 * 8);
1858 loc0 =
LD_SH(tmp_eve_buf);
1859 loc1 =
LD_SH(tmp_eve_buf + 8 * 8);
1860 loc2 =
LD_SH(tmp_eve_buf + 4 * 8);
1861 loc3 =
LD_SH(tmp_eve_buf + 12 * 8);
1863 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m0, m4, m2, m6);
1867 SUB4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m6, m2, m4, m0);
1873 vec0 =
LD_SH(tmp_odd_buf + 4 * 8);
1874 vec1 =
LD_SH(tmp_odd_buf + 13 * 8);
1875 vec2 =
LD_SH(tmp_odd_buf + 10 * 8);
1876 vec3 =
LD_SH(tmp_odd_buf + 3 * 8);
1877 loc0 =
LD_SH(tmp_eve_buf + 2 * 8);
1878 loc1 =
LD_SH(tmp_eve_buf + 10 * 8);
1879 loc2 =
LD_SH(tmp_eve_buf + 6 * 8);
1880 loc3 =
LD_SH(tmp_eve_buf + 14 * 8);
1882 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m1, m5, m3, m7);
1887 SUB4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, m7, m3, m5, m1);
1893 vec0 =
LD_SH(tmp_odd_buf + 2 * 8);
1894 vec1 =
LD_SH(tmp_odd_buf + 11 * 8);
1895 vec2 =
LD_SH(tmp_odd_buf + 12 * 8);
1896 vec3 =
LD_SH(tmp_odd_buf + 7 * 8);
1897 loc0 =
LD_SH(tmp_eve_buf + 1 * 8);
1898 loc1 =
LD_SH(tmp_eve_buf + 9 * 8);
1899 loc2 =
LD_SH(tmp_eve_buf + 5 * 8);
1900 loc3 =
LD_SH(tmp_eve_buf + 13 * 8);
1902 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n0, n4, n2, n6);
1907 SUB4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n6, n2, n4, n0);
1913 vec0 =
LD_SH(tmp_odd_buf + 5 * 8);
1914 vec1 =
LD_SH(tmp_odd_buf + 15 * 8);
1915 vec2 =
LD_SH(tmp_odd_buf + 8 * 8);
1916 vec3 =
LD_SH(tmp_odd_buf + 1 * 8);
1917 loc0 =
LD_SH(tmp_eve_buf + 3 * 8);
1918 loc1 =
LD_SH(tmp_eve_buf + 11 * 8);
1919 loc2 =
LD_SH(tmp_eve_buf + 7 * 8);
1920 loc3 =
LD_SH(tmp_eve_buf + 15 * 8);
1922 ADD4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n1, n5, n3, n7);
1927 SUB4(loc0, vec3, loc1, vec2, loc2, vec1, loc3, vec0, n7, n3, n5, n1);
1954 &tmp_odd_buf[0],
output);
1962 v16u8 dst0, dst1, dst2, dst3, tmp0, tmp1, tmp2, tmp3;
1963 v8i16 res0, res1, res2, res3, res4, res5, res6, res7, vec;
1970 vec = __msa_fill_h(
out);
1972 for (
i = 16;
i--;) {
1974 LD_UB2(
dst + dst_stride, 16, dst2, dst3);
1980 ADD4(res0, vec, res1, vec, res2, vec, res3, vec, res0, res1, res2,
1982 ADD4(res4, vec, res5, vec, res6, vec, res7, vec, res4, res5, res6,
1985 PCKEV_B4_UB(res4, res0, res5, res1, res6, res2, res7, res3,
1986 tmp0, tmp1, tmp2, tmp3);
2000 int16_t *out_ptr = out_arr;
2003 for (
i = 32;
i--;) {
2005 "sw $zero, (%[out_ptr]) \n\t"
2006 "sw $zero, 4(%[out_ptr]) \n\t"
2007 "sw $zero, 8(%[out_ptr]) \n\t"
2008 "sw $zero, 12(%[out_ptr]) \n\t"
2009 "sw $zero, 16(%[out_ptr]) \n\t"
2010 "sw $zero, 20(%[out_ptr]) \n\t"
2011 "sw $zero, 24(%[out_ptr]) \n\t"
2012 "sw $zero, 28(%[out_ptr]) \n\t"
2013 "sw $zero, 32(%[out_ptr]) \n\t"
2014 "sw $zero, 36(%[out_ptr]) \n\t"
2015 "sw $zero, 40(%[out_ptr]) \n\t"
2016 "sw $zero, 44(%[out_ptr]) \n\t"
2017 "sw $zero, 48(%[out_ptr]) \n\t"
2018 "sw $zero, 52(%[out_ptr]) \n\t"
2019 "sw $zero, 56(%[out_ptr]) \n\t"
2020 "sw $zero, 60(%[out_ptr]) \n\t"
2023 : [out_ptr]
"r" (out_ptr)
2035 for (
i = 0;
i < 4;
i++) {
2038 (
dst + (
i << 3)), dst_stride);
2047 int16_t *out_ptr = out_arr;
2051 for (
i = 0;
i < 4;
i++) {
2058 for (
i = 0;
i < 4;
i++) {
2061 (
dst + (
i << 3)), dst_stride);
2066 int16_t *
block,
int eob)
2077 int16_t *
block,
int eob)
2082 else if (eob <= 12) {
2091 int16_t *
block,
int eob)
2097 else if (eob <= 10) {
2106 int16_t *
block,
int eob)
2111 else if (eob <= 34) {
2120 int16_t *
block,
int eob)
2126 int16_t *
block,
int eob)
2132 int16_t *
block,
int eob)
2138 int16_t *
block,
int eob)
2144 int16_t *
block,
int eob)
2150 int16_t *
block,
int eob)
2156 int16_t *
block,
int eob)
2162 int16_t *
block,
int eob)
2168 int16_t *
block,
int eob)