25 #define IPRED_SUBS_UH2_UH(in0, in1, out0, out1) \ 27 out0 = __msa_subs_u_h(out0, in0); \ 28 out1 = __msa_subs_u_h(out1, in1); \ 39 for (row = 16; row--;) {
52 src2 =
LD_UB(src + 16);
54 for (row = 32; row--;) {
55 ST_UB2(src1, src2, dst, 16);
67 for (row = 4; row--;) {
71 src0 = (v16u8) __msa_fill_b(inp >> 24);
72 src1 = (v16u8) __msa_fill_b(inp >> 16);
73 src2 = (v16u8) __msa_fill_b(inp >> 8);
74 src3 = (v16u8) __msa_fill_b(inp);
76 ST_UB4(src0, src1, src2, src3, dst, dst_stride);
77 dst += (4 * dst_stride);
88 for (row = 8; row--;) {
92 src0 = (v16u8) __msa_fill_b(inp >> 24);
93 src1 = (v16u8) __msa_fill_b(inp >> 16);
94 src2 = (v16u8) __msa_fill_b(inp >> 8);
95 src3 = (v16u8) __msa_fill_b(inp);
97 ST_UB2(src0, src0, dst, 16);
99 ST_UB2(src1, src1, dst, 16);
101 ST_UB2(src2, src2, dst, 16);
103 ST_UB2(src3, src3, dst, 16);
112 v16i8 store,
src = { 0 };
120 sum_h = __msa_hadd_u_h((v16u8) src, (v16u8) src);
121 sum_w = __msa_hadd_u_w(sum_h, sum_h);
122 sum_d = __msa_hadd_u_d(sum_w, sum_w);
123 sum_w = (v4u32) __msa_srari_w((v4i32)
sum_d, 3);
124 store = __msa_splati_b((v16i8) sum_w, 0);
125 val0 = __msa_copy_u_w((v4i32) store, 0);
127 SW4(val0, val0, val0, val0, dst, dst_stride);
130 #define INTRA_DC_TL_4x4(dir) \ 131 void ff_dc_##dir##_4x4_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 132 const uint8_t *left, \ 133 const uint8_t *top) \ 136 v16i8 store, data = { 0 }; \ 141 data = (v16i8) __msa_insert_w((v4i32) data, 0, val0); \ 142 sum_h = __msa_hadd_u_h((v16u8) data, (v16u8) data); \ 143 sum_w = __msa_hadd_u_w(sum_h, sum_h); \ 144 sum_w = (v4u32) __msa_srari_w((v4i32) sum_w, 2); \ 145 store = __msa_splati_b((v16i8) sum_w, 0); \ 146 val0 = __msa_copy_u_w((v4i32) store, 0); \ 148 SW4(val0, val0, val0, val0, dst, dst_stride); \ 166 sum_h = __msa_hadd_u_h(src, src);
167 sum_w = __msa_hadd_u_w(sum_h, sum_h);
168 sum_d = __msa_hadd_u_d(sum_w, sum_w);
169 sum_w = (v4u32) __msa_pckev_w((v4i32)
sum_d, (v4i32) sum_d);
170 sum_d = __msa_hadd_u_d(sum_w, sum_w);
171 sum_w = (v4u32) __msa_srari_w((v4i32)
sum_d, 4);
172 store = __msa_splati_b((v16i8) sum_w, 0);
173 val0 = __msa_copy_u_d((v2i64) store, 0);
175 SD4(val0, val0, val0, val0, dst, dst_stride);
176 dst += (4 * dst_stride);
177 SD4(val0, val0, val0, val0, dst, dst_stride);
180 #define INTRA_DC_TL_8x8(dir) \ 181 void ff_dc_##dir##_8x8_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 182 const uint8_t *left, \ 183 const uint8_t *top) \ 187 v16u8 data = { 0 }; \ 193 data = (v16u8) __msa_insert_d((v2i64) data, 0, val0); \ 194 sum_h = __msa_hadd_u_h(data, data); \ 195 sum_w = __msa_hadd_u_w(sum_h, sum_h); \ 196 sum_d = __msa_hadd_u_d(sum_w, sum_w); \ 197 sum_w = (v4u32) __msa_srari_w((v4i32) sum_d, 3); \ 198 store = __msa_splati_b((v16i8) sum_w, 0); \ 199 val0 = __msa_copy_u_d((v2i64) store, 0); \ 201 SD4(val0, val0, val0, val0, dst, dst_stride); \ 202 dst += (4 * dst_stride); \ 203 SD4(val0, val0, val0, val0, dst, dst_stride); \ 212 v16u8 top, left,
out;
213 v8u16 sum_h, sum_top, sum_left;
217 top =
LD_UB(src_top);
218 left =
LD_UB(src_left);
220 sum_h = sum_top + sum_left;
221 sum_w = __msa_hadd_u_w(sum_h, sum_h);
222 sum_d = __msa_hadd_u_d(sum_w, sum_w);
223 sum_w = (v4u32) __msa_pckev_w((v4i32)
sum_d, (v4i32) sum_d);
224 sum_d = __msa_hadd_u_d(sum_w, sum_w);
225 sum_w = (v4u32) __msa_srari_w((v4i32)
sum_d, 5);
226 out = (v16u8) __msa_splati_b((v16i8) sum_w, 0);
228 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride);
229 dst += (8 * dst_stride);
230 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride);
233 #define INTRA_DC_TL_16x16(dir) \ 234 void ff_dc_##dir##_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 235 const uint8_t *left, \ 236 const uint8_t *top) \ 244 sum_h = __msa_hadd_u_h(data, data); \ 245 sum_w = __msa_hadd_u_w(sum_h, sum_h); \ 246 sum_d = __msa_hadd_u_d(sum_w, sum_w); \ 247 sum_w = (v4u32) __msa_pckev_w((v4i32) sum_d, (v4i32) sum_d); \ 248 sum_d = __msa_hadd_u_d(sum_w, sum_w); \ 249 sum_w = (v4u32) __msa_srari_w((v4i32) sum_d, 4); \ 250 out = (v16u8) __msa_splati_b((v16i8) sum_w, 0); \ 252 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride); \ 253 dst += (8 * dst_stride); \ 254 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride); \ 263 v16u8 top0, top1, left0, left1,
out;
264 v8u16 sum_h, sum_top0, sum_top1, sum_left0, sum_left1;
268 LD_UB2(src_top, 16, top0, top1);
269 LD_UB2(src_left, 16, left0, left1);
272 sum_h = sum_top0 + sum_top1;
273 sum_h += sum_left0 + sum_left1;
274 sum_w = __msa_hadd_u_w(sum_h, sum_h);
275 sum_d = __msa_hadd_u_d(sum_w, sum_w);
276 sum_w = (v4u32) __msa_pckev_w((v4i32)
sum_d, (v4i32) sum_d);
277 sum_d = __msa_hadd_u_d(sum_w, sum_w);
278 sum_w = (v4u32) __msa_srari_w((v4i32)
sum_d, 6);
279 out = (v16u8) __msa_splati_b((v16i8) sum_w, 0);
281 for (row = 16; row--;)
283 ST_UB2(out, out, dst, 16);
285 ST_UB2(out, out, dst, 16);
290 #define INTRA_DC_TL_32x32(dir) \ 291 void ff_dc_##dir##_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 292 const uint8_t *left, \ 293 const uint8_t *top) \ 296 v16u8 data0, data1, out; \ 297 v8u16 sum_h, sum_data0, sum_data1; \ 301 LD_UB2(dir, 16, data0, data1); \ 302 HADD_UB2_UH(data0, data1, sum_data0, sum_data1); \ 303 sum_h = sum_data0 + sum_data1; \ 304 sum_w = __msa_hadd_u_w(sum_h, sum_h); \ 305 sum_d = __msa_hadd_u_d(sum_w, sum_w); \ 306 sum_w = (v4u32) __msa_pckev_w((v4i32) sum_d, (v4i32) sum_d); \ 307 sum_d = __msa_hadd_u_d(sum_w, sum_w); \ 308 sum_w = (v4u32) __msa_srari_w((v4i32) sum_d, 5); \ 309 out = (v16u8) __msa_splati_b((v16i8) sum_w, 0); \ 311 for (row = 16; row--;) \ 313 ST_UB2(out, out, dst, 16); \ 315 ST_UB2(out, out, dst, 16); \ 322 #define INTRA_PREDICT_VALDC_16X16_MSA(val) \ 323 void ff_dc_##val##_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 324 const uint8_t *left, const uint8_t *top) \ 326 v16u8 out = (v16u8) __msa_ldi_b(val); \ 328 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride); \ 329 dst += (8 * dst_stride); \ 330 ST_UB8(out, out, out, out, out, out, out, out, dst, dst_stride); \ 337 #define INTRA_PREDICT_VALDC_32X32_MSA(val) \ 338 void ff_dc_##val##_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, \ 339 const uint8_t *left, const uint8_t *top) \ 342 v16u8 out = (v16u8) __msa_ldi_b(val); \ 344 for (row = 16; row--;) \ 346 ST_UB2(out, out, dst, 16); \ 348 ST_UB2(out, out, dst, 16); \ 361 uint8_t top_left = src_top_ptr[-1];
362 v16i8 src_top, src_left0, src_left1, src_left2, src_left3, tmp0, tmp1;
364 v8u16 src_top_left, vec0, vec1, vec2, vec3;
366 src_top_left = (v8u16) __msa_fill_h(top_left);
367 src_top =
LD_SB(src_top_ptr);
369 src_left0 = __msa_fill_b(left >> 24);
370 src_left1 = __msa_fill_b(left >> 16);
371 src_left2 = __msa_fill_b(left >> 8);
372 src_left3 = __msa_fill_b(left);
374 ILVR_B4_UB(src_left0, src_top, src_left1, src_top, src_left2, src_top,
375 src_left3, src_top, src0, src1, src2, src3);
376 HADD_UB4_UH(src0, src1, src2, src3, vec0, vec1, vec2, vec3);
381 ST4x4_UB(tmp0, tmp1, 0, 2, 0, 2, dst, dst_stride);
387 uint8_t top_left = src_top_ptr[-1];
388 uint32_t loop_cnt, left;
389 v16i8 src_top, src_left0, src_left1, src_left2, src_left3, tmp0, tmp1;
390 v8u16 src_top_left, vec0, vec1, vec2, vec3;
393 src_top =
LD_SB(src_top_ptr);
394 src_top_left = (v8u16) __msa_fill_h(top_left);
397 for (loop_cnt = 2; loop_cnt--;) {
399 src_left0 = __msa_fill_b(left >> 24);
400 src_left1 = __msa_fill_b(left >> 16);
401 src_left2 = __msa_fill_b(left >> 8);
402 src_left3 = __msa_fill_b(left);
405 ILVR_B4_UB(src_left0, src_top, src_left1, src_top, src_left2, src_top,
406 src_left3, src_top, src0, src1, src2, src3);
407 HADD_UB4_UH(src0, src1, src2, src3, vec0, vec1, vec2, vec3);
412 ST8x4_UB(tmp0, tmp1, dst, dst_stride);
413 dst += (4 * dst_stride);
420 uint8_t top_left = src_top_ptr[-1];
421 uint32_t loop_cnt, left;
422 v16i8 src_top, src_left0, src_left1, src_left2, src_left3;
423 v8u16 src_top_left, res_r, res_l;
425 src_top =
LD_SB(src_top_ptr);
426 src_top_left = (v8u16) __msa_fill_h(top_left);
429 for (loop_cnt = 4; loop_cnt--;) {
431 src_left0 = __msa_fill_b(left >> 24);
432 src_left1 = __msa_fill_b(left >> 16);
433 src_left2 = __msa_fill_b(left >> 8);
434 src_left3 = __msa_fill_b(left);
471 uint8_t top_left = src_top_ptr[-1];
472 uint32_t loop_cnt, left;
473 v16i8 src_top0, src_top1, src_left0, src_left1, src_left2, src_left3;
474 v8u16 src_top_left, res_r0, res_r1, res_l0, res_l1;
476 src_top0 =
LD_SB(src_top_ptr);
477 src_top1 =
LD_SB(src_top_ptr + 16);
478 src_top_left = (v8u16) __msa_fill_h(top_left);
481 for (loop_cnt = 8; loop_cnt--;) {
483 src_left0 = __msa_fill_b(left >> 24);
484 src_left1 = __msa_fill_b(left >> 16);
485 src_left2 = __msa_fill_b(left >> 8);
486 src_left3 = __msa_fill_b(left);
489 ILVR_B2_UH(src_left0, src_top0, src_left0, src_top1, res_r0, res_r1);
490 ILVL_B2_UH(src_left0, src_top0, src_left0, src_top1, res_l0, res_l1);
491 HADD_UB4_UH(res_r0, res_l0, res_r1, res_l1, res_r0, res_l0, res_r1,
495 SAT_UH4_UH(res_r0, res_l0, res_r1, res_l1, 7);
500 ILVR_B2_UH(src_left1, src_top0, src_left1, src_top1, res_r0, res_r1);
501 ILVL_B2_UH(src_left1, src_top0, src_left1, src_top1, res_l0, res_l1);
502 HADD_UB4_UH(res_r0, res_l0, res_r1, res_l1, res_r0, res_l0, res_r1,
506 SAT_UH4_UH(res_r0, res_l0, res_r1, res_l1, 7);
511 ILVR_B2_UH(src_left2, src_top0, src_left2, src_top1, res_r0, res_r1);
512 ILVL_B2_UH(src_left2, src_top0, src_left2, src_top1, res_l0, res_l1);
513 HADD_UB4_UH(res_r0, res_l0, res_r1, res_l1, res_r0, res_l0, res_r1,
517 SAT_UH4_UH(res_r0, res_l0, res_r1, res_l1, 7);
522 ILVR_B2_UH(src_left3, src_top0, src_left3, src_top1, res_r0, res_r1);
523 ILVL_B2_UH(src_left3, src_top0, src_left3, src_top1, res_l0, res_l1);
524 HADD_UB4_UH(res_r0, res_l0, res_r1, res_l1, res_r0, res_l0, res_r1,
528 SAT_UH4_UH(res_r0, res_l0, res_r1, res_l1, 7);
void ff_vert_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *left, const uint8_t *src)
void ff_dc_4x4_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top)
#define INTRA_PREDICT_VALDC_16X16_MSA(val)
void ff_hor_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, const uint8_t *top)
static void sum_d(const int *input, int *output, int len)
#define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride)
#define INTRA_DC_TL_32x32(dir)
void ff_vert_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *left, const uint8_t *src)
#define PCKEV_ST_SB(in0, in1, pdst)
void ff_dc_8x8_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top)
#define INTRA_DC_TL_16x16(dir)
#define INTRA_DC_TL_8x8(dir)
#define IPRED_SUBS_UH2_UH(in0, in1, out0, out1)
#define SW4(in0, in1, in2, in3, pdst, stride)
void ff_hor_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src, const uint8_t *top)
void ff_tm_4x4_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top_ptr)
void ff_tm_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top_ptr)
void ff_tm_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top_ptr)
void ff_dc_16x16_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top)
#define INSERT_W2_SB(...)
#define INTRA_DC_TL_4x4(dir)
#define SD4(in0, in1, in2, in3, pdst, stride)
void ff_tm_8x8_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top_ptr)
#define INSERT_D2_UB(...)
#define ST8x4_UB(in0, in1, pdst, stride)
#define INTRA_PREDICT_VALDC_32X32_MSA(val)
void ff_dc_32x32_msa(uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *src_left, const uint8_t *src_top)