aboutsummaryrefslogblamecommitdiffstats
path: root/libavcodec/mips/h264pred_msa.c
blob: cddcd2e87803e4e3f79155b8c0e320915de0eaa5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723

















































































































































































































































































































































































































































































































































































































































































































































                                                                               
/*
 * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil@imgtec.com)
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include "libavutil/mips/generic_macros_msa.h"
#include "h264dsp_mips.h"

static void intra_predict_vert_8x8_msa(uint8_t *src, uint8_t *dst,
                                       int32_t dst_stride)
{
    uint32_t row;
    uint32_t src_data1, src_data2;

    src_data1 = LW(src);
    src_data2 = LW(src + 4);

    for (row = 8; row--;) {
        SW(src_data1, dst);
        SW(src_data2, (dst + 4));
        dst += dst_stride;
    }
}

static void intra_predict_vert_16x16_msa(uint8_t *src, uint8_t *dst,
                                         int32_t dst_stride)
{
    uint32_t row;
    v16u8 src0;

    src0 = LD_UB(src);

    for (row = 16; row--;) {
        ST_UB(src0, dst);
        dst += dst_stride;
    }
}

static void intra_predict_horiz_8x8_msa(uint8_t *src, int32_t src_stride,
                                        uint8_t *dst, int32_t dst_stride)
{
    uint64_t out0, out1, out2, out3, out4, out5, out6, out7;

    out0 = src[0 * src_stride] * 0x0101010101010101;
    out1 = src[1 * src_stride] * 0x0101010101010101;
    out2 = src[2 * src_stride] * 0x0101010101010101;
    out3 = src[3 * src_stride] * 0x0101010101010101;
    out4 = src[4 * src_stride] * 0x0101010101010101;
    out5 = src[5 * src_stride] * 0x0101010101010101;
    out6 = src[6 * src_stride] * 0x0101010101010101;
    out7 = src[7 * src_stride] * 0x0101010101010101;

    SD4(out0, out1, out2, out3, dst, dst_stride);
    dst += (4 * dst_stride);
    SD4(out4, out5, out6, out7, dst, dst_stride);
}

static void intra_predict_horiz_16x16_msa(uint8_t *src, int32_t src_stride,
                                          uint8_t *dst, int32_t dst_stride)
{
    uint32_t row;
    uint8_t inp0, inp1, inp2, inp3;
    v16u8 src0, src1, src2, src3;

    for (row = 4; row--;) {
        inp0 = src[0];
        src += src_stride;
        inp1 = src[0];
        src += src_stride;
        inp2 = src[0];
        src += src_stride;
        inp3 = src[0];
        src += src_stride;

        src0 = (v16u8) __msa_fill_b(inp0);
        src1 = (v16u8) __msa_fill_b(inp1);
        src2 = (v16u8) __msa_fill_b(inp2);
        src3 = (v16u8) __msa_fill_b(inp3);

        ST_UB4(src0, src1, src2, src3, dst, dst_stride);
        dst += (4 * dst_stride);
    }
}

static void intra_predict_dc_8x8_msa(uint8_t *src_top, uint8_t *src_left,
                                     int32_t src_stride_left,
                                     uint8_t *dst, int32_t dst_stride,
                                     uint8_t is_above, uint8_t is_left)
{
    uint32_t row;
    uint32_t out, addition = 0;
    v16u8 src_above, store;
    v8u16 sum_above;
    v4u32 sum_top;
    v2u64 sum;

    if (is_left && is_above) {
        src_above = LD_UB(src_top);

        sum_above = __msa_hadd_u_h(src_above, src_above);
        sum_top = __msa_hadd_u_w(sum_above, sum_above);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        addition = __msa_copy_u_w((v4i32) sum, 0);

        for (row = 0; row < 8; row++) {
            addition += src_left[row * src_stride_left];
        }

        addition = (addition + 8) >> 4;
        store = (v16u8) __msa_fill_b(addition);
    } else if (is_left) {
        for (row = 0; row < 8; row++) {
            addition += src_left[row * src_stride_left];
        }

        addition = (addition + 4) >> 3;
        store = (v16u8) __msa_fill_b(addition);
    } else if (is_above) {
        src_above = LD_UB(src_top);

        sum_above = __msa_hadd_u_h(src_above, src_above);
        sum_top = __msa_hadd_u_w(sum_above, sum_above);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        sum = (v2u64) __msa_srari_d((v2i64) sum, 3);
        store = (v16u8) __msa_splati_b((v16i8) sum, 0);
    } else {
        store = (v16u8) __msa_ldi_b(128);
    }

    out = __msa_copy_u_w((v4i32) store, 0);

    for (row = 8; row--;) {
        SW(out, dst);
        SW(out, (dst + 4));
        dst += dst_stride;
    }
}

static void intra_predict_dc_16x16_msa(uint8_t *src_top, uint8_t *src_left,
                                       int32_t src_stride_left,
                                       uint8_t *dst, int32_t dst_stride,
                                       uint8_t is_above, uint8_t is_left)
{
    uint32_t row;
    uint32_t addition = 0;
    v16u8 src_above, store;
    v8u16 sum_above;
    v4u32 sum_top;
    v2u64 sum;

    if (is_left && is_above) {
        src_above = LD_UB(src_top);

        sum_above = __msa_hadd_u_h(src_above, src_above);
        sum_top = __msa_hadd_u_w(sum_above, sum_above);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        sum_top = (v4u32) __msa_pckev_w((v4i32) sum, (v4i32) sum);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        addition = __msa_copy_u_w((v4i32) sum, 0);

        for (row = 0; row < 16; row++) {
            addition += src_left[row * src_stride_left];
        }

        addition = (addition + 16) >> 5;
        store = (v16u8) __msa_fill_b(addition);
    } else if (is_left) {
        for (row = 0; row < 16; row++) {
            addition += src_left[row * src_stride_left];
        }

        addition = (addition + 8) >> 4;
        store = (v16u8) __msa_fill_b(addition);
    } else if (is_above) {
        src_above = LD_UB(src_top);

        sum_above = __msa_hadd_u_h(src_above, src_above);
        sum_top = __msa_hadd_u_w(sum_above, sum_above);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        sum_top = (v4u32) __msa_pckev_w((v4i32) sum, (v4i32) sum);
        sum = __msa_hadd_u_d(sum_top, sum_top);
        sum = (v2u64) __msa_srari_d((v2i64) sum, 4);
        store = (v16u8) __msa_splati_b((v16i8) sum, 0);
    } else {
        store = (v16u8) __msa_ldi_b(128);
    }

    for (row = 16; row--;) {
        ST_UB(store, dst);
        dst += dst_stride;
    }
}

#define INTRA_PREDICT_VALDC_8X8_MSA(val)                         \
static void intra_predict_##val##dc_8x8_msa(uint8_t *dst,        \
                                            int32_t dst_stride)  \
{                                                                \
    uint32_t row, out;                                           \
    v16i8 store;                                                 \
                                                                 \
    store = __msa_ldi_b(val);                                    \
    out = __msa_copy_u_w((v4i32) store, 0);                      \
                                                                 \
    for (row = 8; row--;) {                                      \
        SW(out, dst);                                            \
        SW(out, (dst + 4));                                      \
        dst += dst_stride;                                       \
    }                                                            \
}

INTRA_PREDICT_VALDC_8X8_MSA(127);
INTRA_PREDICT_VALDC_8X8_MSA(129);

#define INTRA_PREDICT_VALDC_16X16_MSA(val)                         \
static void intra_predict_##val##dc_16x16_msa(uint8_t *dst,        \
                                              int32_t dst_stride)  \
{                                                                  \
    uint32_t row;                                                  \
    v16u8 store;                                                   \
                                                                   \
    store = (v16u8) __msa_ldi_b(val);                              \
                                                                   \
    for (row = 16; row--;) {                                       \
        ST_UB(store, dst);                                         \
        dst += dst_stride;                                         \
    }                                                              \
}

INTRA_PREDICT_VALDC_16X16_MSA(127);
INTRA_PREDICT_VALDC_16X16_MSA(129);

static void intra_predict_plane_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lpcnt;
    int32_t res, res0, res1, res2, res3;
    uint64_t out0, out1;
    v16i8 shf_mask = { 3, 5, 2, 6, 1, 7, 0, 8, 3, 5, 2, 6, 1, 7, 0, 8 };
    v8i16 short_multiplier = { 1, 2, 3, 4, 1, 2, 3, 4 };
    v4i32 int_multiplier = { 0, 1, 2, 3 };
    v16u8 src_top;
    v8i16 vec9, vec10, vec11;
    v4i32 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8;
    v2i64 sum;

    src_top = LD_UB(src - (stride + 1));
    src_top = (v16u8) __msa_vshf_b(shf_mask, (v16i8) src_top, (v16i8) src_top);

    vec9 = __msa_hsub_u_h(src_top, src_top);
    vec9 *= short_multiplier;
    vec8 = __msa_hadd_s_w(vec9, vec9);
    sum = __msa_hadd_s_d(vec8, vec8);

    res0 = __msa_copy_s_w((v4i32) sum, 0);

    res1 = (src[4 * stride - 1] - src[2 * stride - 1]) +
        2 * (src[5 * stride - 1] - src[stride - 1]) +
        3 * (src[6 * stride - 1] - src[-1]) +
        4 * (src[7 * stride - 1] - src[-stride - 1]);

    res0 *= 17;
    res1 *= 17;
    res0 = (res0 + 16) >> 5;
    res1 = (res1 + 16) >> 5;

    res3 = 3 * (res0 + res1);
    res2 = 16 * (src[7 * stride - 1] + src[-stride + 7] + 1);
    res = res2 - res3;

    vec8 = __msa_fill_w(res0);
    vec4 = __msa_fill_w(res);
    vec2 = __msa_fill_w(res1);
    vec5 = vec8 * int_multiplier;
    vec3 = vec8 * 4;

    for (lpcnt = 4; lpcnt--;) {
        vec0 = vec5;
        vec0 += vec4;
        vec1 = vec0 + vec3;
        vec6 = vec5;
        vec4 += vec2;
        vec6 += vec4;
        vec7 = vec6 + vec3;

        SRA_4V(vec0, vec1, vec6, vec7, 5);
        PCKEV_H2_SH(vec1, vec0, vec7, vec6, vec10, vec11);
        CLIP_SH2_0_255(vec10, vec11);
        PCKEV_B2_SH(vec10, vec10, vec11, vec11, vec10, vec11);

        out0 = __msa_copy_s_d((v2i64) vec10, 0);
        out1 = __msa_copy_s_d((v2i64) vec11, 0);
        SD(out0, src);
        src += stride;
        SD(out1, src);
        src += stride;

        vec4 += vec2;
    }
}

static void intra_predict_plane_16x16_msa(uint8_t *src, int32_t stride)
{
    uint8_t lpcnt;
    int32_t res0, res1, res2, res3;
    uint64_t load0, load1;
    v16i8 shf_mask = { 7, 8, 6, 9, 5, 10, 4, 11, 3, 12, 2, 13, 1, 14, 0, 15 };
    v8i16 short_multiplier = { 1, 2, 3, 4, 5, 6, 7, 8 };
    v4i32 int_multiplier = { 0, 1, 2, 3 };
    v16u8 src_top = { 0 };
    v8i16 vec9, vec10;
    v4i32 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8, res_add;

    load0 = LD(src - (stride + 1));
    load1 = LD(src - (stride + 1) + 9);

    INSERT_D2_UB(load0, load1, src_top);

    src_top = (v16u8) __msa_vshf_b(shf_mask, (v16i8) src_top, (v16i8) src_top);

    vec9 = __msa_hsub_u_h(src_top, src_top);
    vec9 *= short_multiplier;
    vec8 = __msa_hadd_s_w(vec9, vec9);
    res_add = (v4i32) __msa_hadd_s_d(vec8, vec8);

    res0 = __msa_copy_s_w(res_add, 0) + __msa_copy_s_w(res_add, 2);

    res1 = (src[8 * stride - 1] - src[6 * stride - 1]) +
        2 * (src[9 * stride - 1] - src[5 * stride - 1]) +
        3 * (src[10 * stride - 1] - src[4 * stride - 1]) +
        4 * (src[11 * stride - 1] - src[3 * stride - 1]) +
        5 * (src[12 * stride - 1] - src[2 * stride - 1]) +
        6 * (src[13 * stride - 1] - src[stride - 1]) +
        7 * (src[14 * stride - 1] - src[-1]) +
        8 * (src[15 * stride - 1] - src[-1 * stride - 1]);

    res0 *= 5;
    res1 *= 5;
    res0 = (res0 + 32) >> 6;
    res1 = (res1 + 32) >> 6;

    res3 = 7 * (res0 + res1);
    res2 = 16 * (src[15 * stride - 1] + src[-stride + 15] + 1);
    res2 -= res3;

    vec8 = __msa_fill_w(res0);
    vec4 = __msa_fill_w(res2);
    vec5 = __msa_fill_w(res1);
    vec6 = vec8 * 4;
    vec7 = vec8 * int_multiplier;

    for (lpcnt = 16; lpcnt--;) {
        vec0 = vec7;
        vec0 += vec4;
        vec1 = vec0 + vec6;
        vec2 = vec1 + vec6;
        vec3 = vec2 + vec6;

        SRA_4V(vec0, vec1, vec2, vec3, 5);
        PCKEV_H2_SH(vec1, vec0, vec3, vec2, vec9, vec10);
        CLIP_SH2_0_255(vec9, vec10);
        PCKEV_ST_SB(vec9, vec10, src);
        src += stride;

        vec4 += vec5;
    }
}

static void intra_predict_dc_4blk_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0, src1, src3, src2 = 0;
    uint32_t out0, out1, out2, out3;
    v16u8 src_top;
    v8u16 add;
    v4u32 sum;

    src_top = LD_UB(src - stride);
    add = __msa_hadd_u_h((v16u8) src_top, (v16u8) src_top);
    sum = __msa_hadd_u_w(add, add);
    src0 = __msa_copy_u_w((v4i32) sum, 0);
    src1 = __msa_copy_u_w((v4i32) sum, 1);

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src0 += src[lp_cnt * stride - 1];
        src2 += src[(4 + lp_cnt) * stride - 1];
    }

    src0 = (src0 + 4) >> 3;
    src3 = (src1 + src2 + 4) >> 3;
    src1 = (src1 + 2) >> 2;
    src2 = (src2 + 2) >> 2;
    out0 = src0 * 0x01010101;
    out1 = src1 * 0x01010101;
    out2 = src2 * 0x01010101;
    out3 = src3 * 0x01010101;

    for (lp_cnt = 4; lp_cnt--;) {
        SW(out0, src);
        SW(out1, (src + 4));
        SW(out2, (src + 4 * stride));
        SW(out3, (src + 4 * stride + 4));
        src += stride;
    }
}

static void intra_predict_hor_dc_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0 = 0, src1 = 0;
    uint64_t out0, out1;

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src0 += src[lp_cnt * stride - 1];
        src1 += src[(4 + lp_cnt) * stride - 1];
    }

    src0 = (src0 + 2) >> 2;
    src1 = (src1 + 2) >> 2;
    out0 = src0 * 0x0101010101010101;
    out1 = src1 * 0x0101010101010101;

    for (lp_cnt = 4; lp_cnt--;) {
        SD(out0, src);
        SD(out1, (src + 4 * stride));
        src += stride;
    }
}

static void intra_predict_vert_dc_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t out0 = 0, out1 = 0;
    v16u8 src_top;
    v8u16 add;
    v4u32 sum;
    v4i32 res0, res1;

    src_top = LD_UB(src - stride);
    add = __msa_hadd_u_h(src_top, src_top);
    sum = __msa_hadd_u_w(add, add);
    sum = (v4u32) __msa_srari_w((v4i32) sum, 2);
    res0 = (v4i32) __msa_splati_b((v16i8) sum, 0);
    res1 = (v4i32) __msa_splati_b((v16i8) sum, 4);
    out0 = __msa_copy_u_w(res0, 0);
    out1 = __msa_copy_u_w(res1, 0);

    for (lp_cnt = 8; lp_cnt--;) {
        SW(out0, src);
        SW(out1, src + 4);
        src += stride;
    }
}

static void intra_predict_mad_cow_dc_l0t_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0, src1, src2 = 0;
    uint32_t out0, out1, out2;
    v16u8 src_top;
    v8u16 add;
    v4u32 sum;

    src_top = LD_UB(src - stride);
    add = __msa_hadd_u_h(src_top, src_top);
    sum = __msa_hadd_u_w(add, add);
    src0 = __msa_copy_u_w((v4i32) sum, 0);
    src1 = __msa_copy_u_w((v4i32) sum, 1);

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src2 += src[lp_cnt * stride - 1];
    }
    src2 = (src0 + src2 + 4) >> 3;
    src0 = (src0 + 2) >> 2;
    src1 = (src1 + 2) >> 2;
    out0 = src0 * 0x01010101;
    out1 = src1 * 0x01010101;
    out2 = src2 * 0x01010101;

    for (lp_cnt = 4; lp_cnt--;) {
        SW(out2, src);
        SW(out1, src + 4);
        SW(out0, src + stride * 4);
        SW(out1, src + stride * 4 + 4);
        src += stride;
    }
}

static void intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0, src1, src2 = 0, src3;
    uint32_t out0, out1, out2, out3;
    v16u8 src_top;
    v8u16 add;
    v4u32 sum;

    src_top = LD_UB(src - stride);
    add = __msa_hadd_u_h(src_top, src_top);
    sum = __msa_hadd_u_w(add, add);
    src0 = __msa_copy_u_w((v4i32) sum, 0);
    src1 = __msa_copy_u_w((v4i32) sum, 1);

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src2 += src[(4 + lp_cnt) * stride - 1];
    }

    src0 = (src0 + 2) >> 2;
    src3 = (src1 + src2 + 4) >> 3;
    src1 = (src1 + 2) >> 2;
    src2 = (src2 + 2) >> 2;

    out0 = src0 * 0x01010101;
    out1 = src1 * 0x01010101;
    out2 = src2 * 0x01010101;
    out3 = src3 * 0x01010101;

    for (lp_cnt = 4; lp_cnt--;) {
        SW(out0, src);
        SW(out1, src + 4);
        SW(out2, src + stride * 4);
        SW(out3, src + stride * 4 + 4);
        src += stride;
    }
}

static void intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0 = 0;
    uint64_t out0, out1;

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src0 += src[lp_cnt * stride - 1];
    }

    src0 = (src0 + 2) >> 2;
    out0 = src0 * 0x0101010101010101;
    out1 = 0x8080808080808080;

    for (lp_cnt = 4; lp_cnt--;) {
        SD(out0, src);
        SD(out1, src + stride * 4);
        src += stride;
    }
}

static void intra_predict_mad_cow_dc_0l0_8x8_msa(uint8_t *src, int32_t stride)
{
    uint8_t lp_cnt;
    uint32_t src0 = 0;
    uint64_t out0, out1;

    for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
        src0 += src[(4 + lp_cnt) * stride - 1];
    }

    src0 = (src0 + 2) >> 2;

    out0 = 0x8080808080808080;
    out1 = src0 * 0x0101010101010101;

    for (lp_cnt = 4; lp_cnt--;) {
        SD(out0, src);
        SD(out1, src + stride * 4);
        src += stride;
    }
}

void ff_h264_intra_predict_plane_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_plane_8x8_msa(src, stride);
}

void ff_h264_intra_predict_dc_4blk_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_dc_4blk_8x8_msa(src, stride);
}

void ff_h264_intra_predict_hor_dc_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_hor_dc_8x8_msa(src, stride);
}

void ff_h264_intra_predict_vert_dc_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_vert_dc_8x8_msa(src, stride);
}

void ff_h264_intra_predict_mad_cow_dc_l0t_8x8_msa(uint8_t *src,
                                                  ptrdiff_t stride)
{
    intra_predict_mad_cow_dc_l0t_8x8_msa(src, stride);
}

void ff_h264_intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src,
                                                  ptrdiff_t stride)
{
    intra_predict_mad_cow_dc_0lt_8x8_msa(src, stride);
}

void ff_h264_intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src,
                                                  ptrdiff_t stride)
{
    intra_predict_mad_cow_dc_l00_8x8_msa(src, stride);
}

void ff_h264_intra_predict_mad_cow_dc_0l0_8x8_msa(uint8_t *src,
                                                  ptrdiff_t stride)
{
    intra_predict_mad_cow_dc_0l0_8x8_msa(src, stride);
}

void ff_h264_intra_predict_plane_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_plane_16x16_msa(src, stride);
}

void ff_h264_intra_pred_vert_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *dst = src;

    intra_predict_vert_8x8_msa(src - stride, dst, stride);
}

void ff_h264_intra_pred_horiz_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *dst = src;

    intra_predict_horiz_8x8_msa(src - 1, stride, dst, stride);
}

void ff_h264_intra_pred_dc_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *src_top = src - stride;
    uint8_t *src_left = src - 1;
    uint8_t *dst = src;

    intra_predict_dc_16x16_msa(src_top, src_left, stride, dst, stride, 1, 1);
}

void ff_h264_intra_pred_vert_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *dst = src;

    intra_predict_vert_16x16_msa(src - stride, dst, stride);
}

void ff_h264_intra_pred_horiz_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *dst = src;

    intra_predict_horiz_16x16_msa(src - 1, stride, dst, stride);
}

void ff_h264_intra_pred_dc_left_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *src_top = src - stride;
    uint8_t *src_left = src - 1;
    uint8_t *dst = src;

    intra_predict_dc_16x16_msa(src_top, src_left, stride, dst, stride, 0, 1);
}

void ff_h264_intra_pred_dc_top_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *src_top = src - stride;
    uint8_t *src_left = src - 1;
    uint8_t *dst = src;

    intra_predict_dc_16x16_msa(src_top, src_left, stride, dst, stride, 1, 0);
}

void ff_h264_intra_pred_dc_128_8x8_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *src_top = src - stride;
    uint8_t *src_left = src - 1;
    uint8_t *dst = src;

    intra_predict_dc_8x8_msa(src_top, src_left, stride, dst, stride, 0, 0);
}

void ff_h264_intra_pred_dc_128_16x16_msa(uint8_t *src, ptrdiff_t stride)
{
    uint8_t *src_top = src - stride;
    uint8_t *src_left = src - 1;
    uint8_t *dst = src;

    intra_predict_dc_16x16_msa(src_top, src_left, stride, dst, stride, 0, 0);
}

void ff_vp8_pred8x8_127_dc_8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_127dc_8x8_msa(src, stride);
}

void ff_vp8_pred8x8_129_dc_8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_129dc_8x8_msa(src, stride);
}

void ff_vp8_pred16x16_127_dc_8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_127dc_16x16_msa(src, stride);
}

void ff_vp8_pred16x16_129_dc_8_msa(uint8_t *src, ptrdiff_t stride)
{
    intra_predict_129dc_16x16_msa(src, stride);
}