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
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
|
/*
* Copyright (c) 2023 Loongson Technology Corporation Limited
* Contributed by jinbo <jinbo@loongson.cn>
*
* 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 "loongson_asm.S"
.extern ff_hevc_qpel_filters
.macro LOAD_VAR bit
addi.w t1, a5, 6 //shift
addi.w t3, zero, 1 //one
sub.w t4, t1, t3
sll.w t3, t3, t4 //offset
.if \bit == 128
vreplgr2vr.w vr1, a6 //wx
vreplgr2vr.w vr2, t3 //offset
vreplgr2vr.w vr3, t1 //shift
vreplgr2vr.w vr4, a7 //ox
.else
xvreplgr2vr.w xr1, a6
xvreplgr2vr.w xr2, t3
xvreplgr2vr.w xr3, t1
xvreplgr2vr.w xr4, a7
.endif
.endm
.macro HEVC_PEL_UNI_W_PIXELS8_LSX src0, dst0, w
vldrepl.d vr0, \src0, 0
vsllwil.hu.bu vr0, vr0, 0
vexth.wu.hu vr5, vr0
vsllwil.wu.hu vr0, vr0, 0
vslli.w vr0, vr0, 6
vslli.w vr5, vr5, 6
vmul.w vr0, vr0, vr1
vmul.w vr5, vr5, vr1
vadd.w vr0, vr0, vr2
vadd.w vr5, vr5, vr2
vsra.w vr0, vr0, vr3
vsra.w vr5, vr5, vr3
vadd.w vr0, vr0, vr4
vadd.w vr5, vr5, vr4
vssrani.h.w vr5, vr0, 0
vssrani.bu.h vr5, vr5, 0
.if \w == 6
fst.s f5, \dst0, 0
vstelm.h vr5, \dst0, 4, 2
.else
fst.d f5, \dst0, 0
.endif
.endm
.macro HEVC_PEL_UNI_W_PIXELS8x2_LASX src0, dst0, w
vldrepl.d vr0, \src0, 0
add.d t2, \src0, a3
vldrepl.d vr5, t2, 0
xvpermi.q xr0, xr5, 0x02
xvsllwil.hu.bu xr0, xr0, 0
xvexth.wu.hu xr5, xr0
xvsllwil.wu.hu xr0, xr0, 0
xvslli.w xr0, xr0, 6
xvslli.w xr5, xr5, 6
xvmul.w xr0, xr0, xr1
xvmul.w xr5, xr5, xr1
xvadd.w xr0, xr0, xr2
xvadd.w xr5, xr5, xr2
xvsra.w xr0, xr0, xr3
xvsra.w xr5, xr5, xr3
xvadd.w xr0, xr0, xr4
xvadd.w xr5, xr5, xr4
xvssrani.h.w xr5, xr0, 0
xvpermi.q xr0, xr5, 0x01
xvssrani.bu.h xr0, xr5, 0
add.d t3, \dst0, a1
.if \w == 6
vstelm.w vr0, \dst0, 0, 0
vstelm.h vr0, \dst0, 4, 2
vstelm.w vr0, t3, 0, 2
vstelm.h vr0, t3, 4, 6
.else
vstelm.d vr0, \dst0, 0, 0
vstelm.d vr0, t3, 0, 1
.endif
.endm
.macro HEVC_PEL_UNI_W_PIXELS16_LSX src0, dst0
vld vr0, \src0, 0
vexth.hu.bu vr7, vr0
vexth.wu.hu vr8, vr7
vsllwil.wu.hu vr7, vr7, 0
vsllwil.hu.bu vr5, vr0, 0
vexth.wu.hu vr6, vr5
vsllwil.wu.hu vr5, vr5, 0
vslli.w vr5, vr5, 6
vslli.w vr6, vr6, 6
vslli.w vr7, vr7, 6
vslli.w vr8, vr8, 6
vmul.w vr5, vr5, vr1
vmul.w vr6, vr6, vr1
vmul.w vr7, vr7, vr1
vmul.w vr8, vr8, vr1
vadd.w vr5, vr5, vr2
vadd.w vr6, vr6, vr2
vadd.w vr7, vr7, vr2
vadd.w vr8, vr8, vr2
vsra.w vr5, vr5, vr3
vsra.w vr6, vr6, vr3
vsra.w vr7, vr7, vr3
vsra.w vr8, vr8, vr3
vadd.w vr5, vr5, vr4
vadd.w vr6, vr6, vr4
vadd.w vr7, vr7, vr4
vadd.w vr8, vr8, vr4
vssrani.h.w vr6, vr5, 0
vssrani.h.w vr8, vr7, 0
vssrani.bu.h vr8, vr6, 0
vst vr8, \dst0, 0
.endm
.macro HEVC_PEL_UNI_W_PIXELS16_LASX src0, dst0
vld vr0, \src0, 0
xvpermi.d xr0, xr0, 0xd8
xvsllwil.hu.bu xr0, xr0, 0
xvexth.wu.hu xr6, xr0
xvsllwil.wu.hu xr5, xr0, 0
xvslli.w xr5, xr5, 6
xvslli.w xr6, xr6, 6
xvmul.w xr5, xr5, xr1
xvmul.w xr6, xr6, xr1
xvadd.w xr5, xr5, xr2
xvadd.w xr6, xr6, xr2
xvsra.w xr5, xr5, xr3
xvsra.w xr6, xr6, xr3
xvadd.w xr5, xr5, xr4
xvadd.w xr6, xr6, xr4
xvssrani.h.w xr6, xr5, 0
xvpermi.q xr7, xr6, 0x01
xvssrani.bu.h xr7, xr6, 0
vst vr7, \dst0, 0
.endm
.macro HEVC_PEL_UNI_W_PIXELS32_LASX src0, dst0, w
.if \w == 16
vld vr0, \src0, 0
add.d t2, \src0, a3
vld vr5, t2, 0
xvpermi.q xr0, xr5, 0x02
.else //w=24/32
xvld xr0, \src0, 0
.endif
xvexth.hu.bu xr7, xr0
xvexth.wu.hu xr8, xr7
xvsllwil.wu.hu xr7, xr7, 0
xvsllwil.hu.bu xr5, xr0, 0
xvexth.wu.hu xr6, xr5
xvsllwil.wu.hu xr5, xr5, 0
xvslli.w xr5, xr5, 6
xvslli.w xr6, xr6, 6
xvslli.w xr7, xr7, 6
xvslli.w xr8, xr8, 6
xvmul.w xr5, xr5, xr1
xvmul.w xr6, xr6, xr1
xvmul.w xr7, xr7, xr1
xvmul.w xr8, xr8, xr1
xvadd.w xr5, xr5, xr2
xvadd.w xr6, xr6, xr2
xvadd.w xr7, xr7, xr2
xvadd.w xr8, xr8, xr2
xvsra.w xr5, xr5, xr3
xvsra.w xr6, xr6, xr3
xvsra.w xr7, xr7, xr3
xvsra.w xr8, xr8, xr3
xvadd.w xr5, xr5, xr4
xvadd.w xr6, xr6, xr4
xvadd.w xr7, xr7, xr4
xvadd.w xr8, xr8, xr4
xvssrani.h.w xr6, xr5, 0
xvssrani.h.w xr8, xr7, 0
xvssrani.bu.h xr8, xr6, 0
.if \w == 16
vst vr8, \dst0, 0
add.d t2, \dst0, a1
xvpermi.q xr8, xr8, 0x01
vst vr8, t2, 0
.elseif \w == 24
vst vr8, \dst0, 0
xvstelm.d xr8, \dst0, 16, 2
.else
xvst xr8, \dst0, 0
.endif
.endm
function ff_hevc_put_hevc_pel_uni_w_pixels4_8_lsx
LOAD_VAR 128
srli.w t0, a4, 1
.LOOP_PIXELS4:
vldrepl.w vr0, a2, 0
add.d t1, a2, a3
vldrepl.w vr5, t1, 0
vsllwil.hu.bu vr0, vr0, 0
vsllwil.wu.hu vr0, vr0, 0
vsllwil.hu.bu vr5, vr5, 0
vsllwil.wu.hu vr5, vr5, 0
vslli.w vr0, vr0, 6
vslli.w vr5, vr5, 6
vmul.w vr0, vr0, vr1
vmul.w vr5, vr5, vr1
vadd.w vr0, vr0, vr2
vadd.w vr5, vr5, vr2
vsra.w vr0, vr0, vr3
vsra.w vr5, vr5, vr3
vadd.w vr0, vr0, vr4
vadd.w vr5, vr5, vr4
vssrani.h.w vr5, vr0, 0
vssrani.bu.h vr5, vr5, 0
fst.s f5, a0, 0
add.d t2, a0, a1
vstelm.w vr5, t2, 0, 1
alsl.d a2, a3, a2, 1
alsl.d a0, a1, a0, 1
addi.w t0, t0, -1
bnez t0, .LOOP_PIXELS4
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels6_8_lsx
LOAD_VAR 128
.LOOP_PIXELS6:
HEVC_PEL_UNI_W_PIXELS8_LSX a2, a0, 6
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS6
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels6_8_lasx
LOAD_VAR 256
srli.w t0, a4, 1
.LOOP_PIXELS6_LASX:
HEVC_PEL_UNI_W_PIXELS8x2_LASX a2, a0, 6
alsl.d a2, a3, a2, 1
alsl.d a0, a1, a0, 1
addi.w t0, t0, -1
bnez t0, .LOOP_PIXELS6_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels8_8_lsx
LOAD_VAR 128
.LOOP_PIXELS8:
HEVC_PEL_UNI_W_PIXELS8_LSX a2, a0, 8
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS8
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels8_8_lasx
LOAD_VAR 256
srli.w t0, a4, 1
.LOOP_PIXELS8_LASX:
HEVC_PEL_UNI_W_PIXELS8x2_LASX a2, a0, 8
alsl.d a2, a3, a2, 1
alsl.d a0, a1, a0, 1
addi.w t0, t0, -1
bnez t0, .LOOP_PIXELS8_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels12_8_lsx
LOAD_VAR 128
.LOOP_PIXELS12:
vld vr0, a2, 0
vexth.hu.bu vr7, vr0
vsllwil.wu.hu vr7, vr7, 0
vsllwil.hu.bu vr5, vr0, 0
vexth.wu.hu vr6, vr5
vsllwil.wu.hu vr5, vr5, 0
vslli.w vr5, vr5, 6
vslli.w vr6, vr6, 6
vslli.w vr7, vr7, 6
vmul.w vr5, vr5, vr1
vmul.w vr6, vr6, vr1
vmul.w vr7, vr7, vr1
vadd.w vr5, vr5, vr2
vadd.w vr6, vr6, vr2
vadd.w vr7, vr7, vr2
vsra.w vr5, vr5, vr3
vsra.w vr6, vr6, vr3
vsra.w vr7, vr7, vr3
vadd.w vr5, vr5, vr4
vadd.w vr6, vr6, vr4
vadd.w vr7, vr7, vr4
vssrani.h.w vr6, vr5, 0
vssrani.h.w vr7, vr7, 0
vssrani.bu.h vr7, vr6, 0
fst.d f7, a0, 0
vstelm.w vr7, a0, 8, 2
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS12
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels12_8_lasx
LOAD_VAR 256
.LOOP_PIXELS12_LASX:
vld vr0, a2, 0
xvpermi.d xr0, xr0, 0xd8
xvsllwil.hu.bu xr0, xr0, 0
xvexth.wu.hu xr6, xr0
xvsllwil.wu.hu xr5, xr0, 0
xvslli.w xr5, xr5, 6
xvslli.w xr6, xr6, 6
xvmul.w xr5, xr5, xr1
xvmul.w xr6, xr6, xr1
xvadd.w xr5, xr5, xr2
xvadd.w xr6, xr6, xr2
xvsra.w xr5, xr5, xr3
xvsra.w xr6, xr6, xr3
xvadd.w xr5, xr5, xr4
xvadd.w xr6, xr6, xr4
xvssrani.h.w xr6, xr5, 0
xvpermi.q xr7, xr6, 0x01
xvssrani.bu.h xr7, xr6, 0
fst.d f7, a0, 0
vstelm.w vr7, a0, 8, 2
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS12_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels16_8_lsx
LOAD_VAR 128
.LOOP_PIXELS16:
HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS16
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels16_8_lasx
LOAD_VAR 256
srli.w t0, a4, 1
.LOOP_PIXELS16_LASX:
HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 16
alsl.d a2, a3, a2, 1
alsl.d a0, a1, a0, 1
addi.w t0, t0, -1
bnez t0, .LOOP_PIXELS16_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels24_8_lsx
LOAD_VAR 128
.LOOP_PIXELS24:
HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
addi.d t0, a2, 16
addi.d t1, a0, 16
HEVC_PEL_UNI_W_PIXELS8_LSX t0, t1, 8
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS24
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels24_8_lasx
LOAD_VAR 256
.LOOP_PIXELS24_LASX:
HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 24
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS24_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels32_8_lsx
LOAD_VAR 128
.LOOP_PIXELS32:
HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
addi.d t0, a2, 16
addi.d t1, a0, 16
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS32
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels32_8_lasx
LOAD_VAR 256
.LOOP_PIXELS32_LASX:
HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS32_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels48_8_lsx
LOAD_VAR 128
.LOOP_PIXELS48:
HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
addi.d t0, a2, 16
addi.d t1, a0, 16
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
addi.d t0, a2, 32
addi.d t1, a0, 32
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS48
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels48_8_lasx
LOAD_VAR 256
.LOOP_PIXELS48_LASX:
HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
addi.d t0, a2, 32
addi.d t1, a0, 32
HEVC_PEL_UNI_W_PIXELS16_LASX t0, t1
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS48_LASX
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels64_8_lsx
LOAD_VAR 128
.LOOP_PIXELS64:
HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
addi.d t0, a2, 16
addi.d t1, a0, 16
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
addi.d t0, a2, 32
addi.d t1, a0, 32
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
addi.d t0, a2, 48
addi.d t1, a0, 48
HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS64
endfunc
function ff_hevc_put_hevc_pel_uni_w_pixels64_8_lasx
LOAD_VAR 256
.LOOP_PIXELS64_LASX:
HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
addi.d t0, a2, 32
addi.d t1, a0, 32
HEVC_PEL_UNI_W_PIXELS32_LASX t0, t1, 32
add.d a2, a2, a3
add.d a0, a0, a1
addi.w a4, a4, -1
bnez a4, .LOOP_PIXELS64_LASX
endfunc
.macro vhaddw.d.h in0
vhaddw.w.h \in0, \in0, \in0
vhaddw.d.w \in0, \in0, \in0
.endm
.macro xvhaddw.d.h in0
xvhaddw.w.h \in0, \in0, \in0
xvhaddw.d.w \in0, \in0, \in0
.endm
function ff_hevc_put_hevc_qpel_uni_w_v4_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
fld.s f6, a2, 0 //0
fldx.s f7, a2, a3 //1
fldx.s f8, a2, t0 //2
add.d a2, a2, t1
fld.s f9, a2, 0 //3
fldx.s f10, a2, a3 //4
fldx.s f11, a2, t0 //5
fldx.s f12, a2, t1 //6
add.d a2, a2, t2
vilvl.b vr6, vr7, vr6
vilvl.b vr7, vr9, vr8
vilvl.b vr8, vr11, vr10
vilvl.b vr9, vr13, vr12
vilvl.h vr6, vr7, vr6
vilvl.h vr7, vr9, vr8
vilvl.w vr8, vr7, vr6
vilvh.w vr9, vr7, vr6
.LOOP_V4:
fld.s f13, a2, 0 //7
fldx.s f14, a2, a3 //8 next loop
add.d a2, a2, t0
vextrins.b vr8, vr13, 0x70
vextrins.b vr8, vr13, 0xf1
vextrins.b vr9, vr13, 0x72
vextrins.b vr9, vr13, 0xf3
vbsrl.v vr10, vr8, 1
vbsrl.v vr11, vr9, 1
vextrins.b vr10, vr14, 0x70
vextrins.b vr10, vr14, 0xf1
vextrins.b vr11, vr14, 0x72
vextrins.b vr11, vr14, 0xf3
vdp2.h.bu.b vr6, vr8, vr5 //QPEL_FILTER(src, stride)
vdp2.h.bu.b vr7, vr9, vr5
vdp2.h.bu.b vr12, vr10, vr5
vdp2.h.bu.b vr13, vr11, vr5
vbsrl.v vr8, vr10, 1
vbsrl.v vr9, vr11, 1
vhaddw.d.h vr6
vhaddw.d.h vr7
vhaddw.d.h vr12
vhaddw.d.h vr13
vpickev.w vr6, vr7, vr6
vpickev.w vr12, vr13, vr12
vmulwev.w.h vr6, vr6, vr1 //QPEL_FILTER(src, stride) * wx
vmulwev.w.h vr12, vr12, vr1
vadd.w vr6, vr6, vr2
vsra.w vr6, vr6, vr3
vadd.w vr6, vr6, vr4
vadd.w vr12, vr12, vr2
vsra.w vr12, vr12, vr3
vadd.w vr12, vr12, vr4
vssrani.h.w vr12, vr6, 0
vssrani.bu.h vr12, vr12, 0
fst.s f12, a0, 0
add.d a0, a0, a1
vstelm.w vr12, a0, 0, 1
add.d a0, a0, a1
addi.d a4, a4, -2
bnez a4, .LOOP_V4
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v6_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
fld.d f6, a2, 0
fldx.d f7, a2, a3
fldx.d f8, a2, t0
add.d a2, a2, t1
fld.d f9, a2, 0
fldx.d f10, a2, a3
fldx.d f11, a2, t0
fldx.d f12, a2, t1
add.d a2, a2, t2
vilvl.b vr6, vr7, vr6 //transpose 8x6 to 3x16
vilvl.b vr7, vr9, vr8
vilvl.b vr8, vr11, vr10
vilvl.b vr9, vr13, vr12
vilvl.h vr10, vr7, vr6
vilvh.h vr11, vr7, vr6
vilvl.h vr12, vr9, vr8
vilvh.h vr13, vr9, vr8
vilvl.w vr6, vr12, vr10
vilvh.w vr7, vr12, vr10
vilvl.w vr8, vr13, vr11
.LOOP_V6:
fld.d f13, a2, 0
add.d a2, a2, a3
vextrins.b vr6, vr13, 0x70
vextrins.b vr6, vr13, 0xf1
vextrins.b vr7, vr13, 0x72
vextrins.b vr7, vr13, 0xf3
vextrins.b vr8, vr13, 0x74
vextrins.b vr8, vr13, 0xf5
vdp2.h.bu.b vr10, vr6, vr5 //QPEL_FILTER(src, stride)
vdp2.h.bu.b vr11, vr7, vr5
vdp2.h.bu.b vr12, vr8, vr5
vbsrl.v vr6, vr6, 1
vbsrl.v vr7, vr7, 1
vbsrl.v vr8, vr8, 1
vhaddw.d.h vr10
vhaddw.d.h vr11
vhaddw.d.h vr12
vpickev.w vr10, vr11, vr10
vpickev.w vr11, vr13, vr12
vmulwev.w.h vr10, vr10, vr1 //QPEL_FILTER(src, stride) * wx
vmulwev.w.h vr11, vr11, vr1
vadd.w vr10, vr10, vr2
vadd.w vr11, vr11, vr2
vsra.w vr10, vr10, vr3
vsra.w vr11, vr11, vr3
vadd.w vr10, vr10, vr4
vadd.w vr11, vr11, vr4
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.s f11, a0, 0
vstelm.h vr11, a0, 4, 2
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_V6
endfunc
// transpose 8x8b to 4x16b
.macro TRANSPOSE8X8B_LSX in0, in1, in2, in3, in4, in5, in6, in7, \
out0, out1, out2, out3
vilvl.b \in0, \in1, \in0
vilvl.b \in1, \in3, \in2
vilvl.b \in2, \in5, \in4
vilvl.b \in3, \in7, \in6
vilvl.h \in4, \in1, \in0
vilvh.h \in5, \in1, \in0
vilvl.h \in6, \in3, \in2
vilvh.h \in7, \in3, \in2
vilvl.w \out0, \in6, \in4
vilvh.w \out1, \in6, \in4
vilvl.w \out2, \in7, \in5
vilvh.w \out3, \in7, \in5
.endm
.macro PUT_HEVC_QPEL_UNI_W_V8_LSX in0, in1, in2, in3, out0, out1, pos
.if \pos == 0
vextrins.b \in0, vr13, 0x70 //insert the 8th load
vextrins.b \in0, vr13, 0xf1
vextrins.b \in1, vr13, 0x72
vextrins.b \in1, vr13, 0xf3
vextrins.b \in2, vr13, 0x74
vextrins.b \in2, vr13, 0xf5
vextrins.b \in3, vr13, 0x76
vextrins.b \in3, vr13, 0xf7
.else// \pos == 8
vextrins.b \in0, vr13, 0x78
vextrins.b \in0, vr13, 0xf9
vextrins.b \in1, vr13, 0x7a
vextrins.b \in1, vr13, 0xfb
vextrins.b \in2, vr13, 0x7c
vextrins.b \in2, vr13, 0xfd
vextrins.b \in3, vr13, 0x7e
vextrins.b \in3, vr13, 0xff
.endif
vdp2.h.bu.b \out0, \in0, vr5 //QPEL_FILTER(src, stride)
vdp2.h.bu.b \out1, \in1, vr5
vdp2.h.bu.b vr12, \in2, vr5
vdp2.h.bu.b vr20, \in3, vr5
vbsrl.v \in0, \in0, 1 //Back up previous 7 loaded datas,
vbsrl.v \in1, \in1, 1 //so just need to insert the 8th
vbsrl.v \in2, \in2, 1 //load in the next loop.
vbsrl.v \in3, \in3, 1
vhaddw.d.h \out0
vhaddw.d.h \out1
vhaddw.d.h vr12
vhaddw.d.h vr20
vpickev.w \out0, \out1, \out0
vpickev.w \out1, vr20, vr12
vmulwev.w.h \out0, \out0, vr1 //QPEL_FILTER(src, stride) * wx
vmulwev.w.h \out1, \out1, vr1
vadd.w \out0, \out0, vr2
vadd.w \out1, \out1, vr2
vsra.w \out0, \out0, vr3
vsra.w \out1, \out1, vr3
vadd.w \out0, \out0, vr4
vadd.w \out1, \out1, vr4
.endm
function ff_hevc_put_hevc_qpel_uni_w_v8_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
fld.d f6, a2, 0
fldx.d f7, a2, a3
fldx.d f8, a2, t0
add.d a2, a2, t1
fld.d f9, a2, 0
fldx.d f10, a2, a3
fldx.d f11, a2, t0
fldx.d f12, a2, t1
add.d a2, a2, t2
TRANSPOSE8X8B_LSX vr6, vr7, vr8, vr9, vr10, vr11, vr12, vr13, \
vr6, vr7, vr8, vr9
.LOOP_V8:
fld.d f13, a2, 0 //the 8th load
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_V8_LSX vr6, vr7, vr8, vr9, vr10, vr11, 0
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.d f11, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_V8
endfunc
.macro PUT_HEVC_UNI_W_V8_LASX w
fld.d f6, a2, 0
fldx.d f7, a2, a3
fldx.d f8, a2, t0
add.d a2, a2, t1
fld.d f9, a2, 0
fldx.d f10, a2, a3
fldx.d f11, a2, t0
fldx.d f12, a2, t1
add.d a2, a2, t2
TRANSPOSE8X8B_LSX vr6, vr7, vr8, vr9, vr10, vr11, vr12, vr13, \
vr6, vr7, vr8, vr9
xvpermi.q xr6, xr7, 0x02
xvpermi.q xr8, xr9, 0x02
.LOOP_V8_LASX_\w:
fld.d f13, a2, 0 // 0 1 2 3 4 5 6 7 the 8th load
add.d a2, a2, a3
vshuf4i.h vr13, vr13, 0xd8
vbsrl.v vr14, vr13, 4
xvpermi.q xr13, xr14, 0x02 //0 1 4 5 * * * * 2 3 6 7 * * * *
xvextrins.b xr6, xr13, 0x70 //begin to insert the 8th load
xvextrins.b xr6, xr13, 0xf1
xvextrins.b xr8, xr13, 0x72
xvextrins.b xr8, xr13, 0xf3
xvdp2.h.bu.b xr20, xr6, xr5 //QPEL_FILTER(src, stride)
xvdp2.h.bu.b xr21, xr8, xr5
xvbsrl.v xr6, xr6, 1
xvbsrl.v xr8, xr8, 1
xvhaddw.d.h xr20
xvhaddw.d.h xr21
xvpickev.w xr20, xr21, xr20
xvpermi.d xr20, xr20, 0xd8
xvmulwev.w.h xr20, xr20, xr1 //QPEL_FILTER(src, stride) * wx
xvadd.w xr20, xr20, xr2
xvsra.w xr20, xr20, xr3
xvadd.w xr10, xr20, xr4
xvpermi.q xr11, xr10, 0x01
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.d f11, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_V8_LASX_\w
.endm
function ff_hevc_put_hevc_qpel_uni_w_v8_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
PUT_HEVC_UNI_W_V8_LASX 8
endfunc
.macro PUT_HEVC_QPEL_UNI_W_V16_LSX w
vld vr6, a2, 0
vldx vr7, a2, a3
vldx vr8, a2, t0
add.d a2, a2, t1
vld vr9, a2, 0
vldx vr10, a2, a3
vldx vr11, a2, t0
vldx vr12, a2, t1
add.d a2, a2, t2
.if \w > 8
vilvh.d vr14, vr14, vr6
vilvh.d vr15, vr15, vr7
vilvh.d vr16, vr16, vr8
vilvh.d vr17, vr17, vr9
vilvh.d vr18, vr18, vr10
vilvh.d vr19, vr19, vr11
vilvh.d vr20, vr20, vr12
.endif
TRANSPOSE8X8B_LSX vr6, vr7, vr8, vr9, vr10, vr11, vr12, vr13, \
vr6, vr7, vr8, vr9
.if \w > 8
TRANSPOSE8X8B_LSX vr14, vr15, vr16, vr17, vr18, vr19, vr20, vr21, \
vr14, vr15, vr16, vr17
.endif
.LOOP_HORI_16_\w:
vld vr13, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_V8_LSX vr6, vr7, vr8, vr9, vr10, vr11, 0
.if \w > 8
PUT_HEVC_QPEL_UNI_W_V8_LSX vr14, vr15, vr16, vr17, vr18, vr19, 8
.endif
vssrani.h.w vr11, vr10, 0
.if \w > 8
vssrani.h.w vr19, vr18, 0
vssrani.bu.h vr19, vr11, 0
.else
vssrani.bu.h vr11, vr11, 0
.endif
.if \w == 8
fst.d f11, a0, 0
.elseif \w == 12
fst.d f19, a0, 0
vstelm.w vr19, a0, 8, 2
.else
vst vr19, a0, 0
.endif
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_HORI_16_\w
.endm
function ff_hevc_put_hevc_qpel_uni_w_v16_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
PUT_HEVC_QPEL_UNI_W_V16_LSX 16
endfunc
.macro PUT_HEVC_QPEL_UNI_W_V16_LASX w
vld vr6, a2, 0
vldx vr7, a2, a3
vldx vr8, a2, t0
add.d a2, a2, t1
vld vr9, a2, 0
vldx vr10, a2, a3
vldx vr11, a2, t0
vldx vr12, a2, t1
add.d a2, a2, t2
xvpermi.q xr6, xr10, 0x02 //pack and transpose the 8x16 to 4x32 begin
xvpermi.q xr7, xr11, 0x02
xvpermi.q xr8, xr12, 0x02
xvpermi.q xr9, xr13, 0x02
xvilvl.b xr14, xr7, xr6 //0 2
xvilvh.b xr15, xr7, xr6 //1 3
xvilvl.b xr16, xr9, xr8 //0 2
xvilvh.b xr17, xr9, xr8 //1 3
xvpermi.d xr14, xr14, 0xd8
xvpermi.d xr15, xr15, 0xd8
xvpermi.d xr16, xr16, 0xd8
xvpermi.d xr17, xr17, 0xd8
xvilvl.h xr6, xr16, xr14
xvilvh.h xr7, xr16, xr14
xvilvl.h xr8, xr17, xr15
xvilvh.h xr9, xr17, xr15
xvilvl.w xr14, xr7, xr6 //0 1 4 5
xvilvh.w xr15, xr7, xr6 //2 3 6 7
xvilvl.w xr16, xr9, xr8 //8 9 12 13
xvilvh.w xr17, xr9, xr8 //10 11 14 15 end
.LOOP_HORI_16_LASX_\w:
vld vr13, a2, 0 //the 8th load
add.d a2, a2, a3
vshuf4i.w vr13, vr13, 0xd8
vbsrl.v vr12, vr13, 8
xvpermi.q xr13, xr12, 0x02
xvextrins.b xr14, xr13, 0x70 //inset the 8th load
xvextrins.b xr14, xr13, 0xf1
xvextrins.b xr15, xr13, 0x72
xvextrins.b xr15, xr13, 0xf3
xvextrins.b xr16, xr13, 0x74
xvextrins.b xr16, xr13, 0xf5
xvextrins.b xr17, xr13, 0x76
xvextrins.b xr17, xr13, 0xf7
xvdp2.h.bu.b xr6, xr14, xr5 //QPEL_FILTER(src, stride)
xvdp2.h.bu.b xr7, xr15, xr5
xvdp2.h.bu.b xr8, xr16, xr5
xvdp2.h.bu.b xr9, xr17, xr5
xvhaddw.d.h xr6
xvhaddw.d.h xr7
xvhaddw.d.h xr8
xvhaddw.d.h xr9
xvbsrl.v xr14, xr14, 1 //Back up previous 7 loaded datas,
xvbsrl.v xr15, xr15, 1 //so just need to insert the 8th
xvbsrl.v xr16, xr16, 1 //load in next loop.
xvbsrl.v xr17, xr17, 1
xvpickev.w xr6, xr7, xr6 //0 1 2 3 4 5 6 7
xvpickev.w xr7, xr9, xr8 //8 9 10 11 12 13 14 15
xvmulwev.w.h xr6, xr6, xr1 //QPEL_FILTER(src, stride) * wx
xvmulwev.w.h xr7, xr7, xr1
xvadd.w xr6, xr6, xr2
xvadd.w xr7, xr7, xr2
xvsra.w xr6, xr6, xr3
xvsra.w xr7, xr7, xr3
xvadd.w xr6, xr6, xr4
xvadd.w xr7, xr7, xr4
xvssrani.h.w xr7, xr6, 0 //0 1 2 3 8 9 10 11 4 5 6 7 12 13 14 15
xvpermi.q xr6, xr7, 0x01
vssrani.bu.h vr6, vr7, 0
vshuf4i.w vr6, vr6, 0xd8
.if \w == 12
fst.d f6, a0, 0
vstelm.w vr6, a0, 8, 2
.else
vst vr6, a0, 0
.endif
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_HORI_16_LASX_\w
.endm
function ff_hevc_put_hevc_qpel_uni_w_v16_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
PUT_HEVC_QPEL_UNI_W_V16_LASX 16
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v12_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
PUT_HEVC_QPEL_UNI_W_V16_LSX 12
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v12_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
PUT_HEVC_QPEL_UNI_W_V16_LASX 12
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v24_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
PUT_HEVC_QPEL_UNI_W_V16_LSX 24
addi.d a0, t4, 16
addi.d a2, t5, 16
addi.d a4, t6, 0
PUT_HEVC_QPEL_UNI_W_V16_LSX 8
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v24_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
PUT_HEVC_QPEL_UNI_W_V16_LASX 24
addi.d a0, t4, 16
addi.d a2, t5, 16
addi.d a4, t6, 0
PUT_HEVC_UNI_W_V8_LASX 24
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v32_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 2
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V32:
PUT_HEVC_QPEL_UNI_W_V16_LSX 32
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d a2, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V32
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v32_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 2
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V32_LASX:
PUT_HEVC_QPEL_UNI_W_V16_LASX 32
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d a2, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V32_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v48_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 3
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V48:
PUT_HEVC_QPEL_UNI_W_V16_LSX 48
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d t4, t4, 16
addi.d a2, t5, 16
addi.d t5, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V48
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v48_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 3
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V48_LASX:
PUT_HEVC_QPEL_UNI_W_V16_LASX 48
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d t4, t4, 16
addi.d a2, t5, 16
addi.d t5, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V48_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v64_8_lsx
LOAD_VAR 128
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 4
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V64:
PUT_HEVC_QPEL_UNI_W_V16_LSX 64
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d t4, t4, 16
addi.d a2, t5, 16
addi.d t5, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V64
endfunc
function ff_hevc_put_hevc_qpel_uni_w_v64_8_lasx
LOAD_VAR 256
ld.d t0, sp, 8 //my
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
slli.d t0, a3, 1 //stride * 2
add.d t1, t0, a3 //stride * 3
add.d t2, t1, a3 //stride * 4
sub.d a2, a2, t1 //src -= stride*3
addi.d t3, zero, 4
addi.d t4, a0, 0 //save dst
addi.d t5, a2, 0 //save src
addi.d t6, a4, 0
.LOOP_V64_LASX:
PUT_HEVC_QPEL_UNI_W_V16_LASX 64
addi.d t3, t3, -1
addi.d a0, t4, 16
addi.d t4, t4, 16
addi.d a2, t5, 16
addi.d t5, t5, 16
addi.d a4, t6, 0
bnez t3, .LOOP_V64_LASX
endfunc
.macro PUT_HEVC_QPEL_UNI_W_H8_LSX in0, out0, out1
vbsrl.v vr7, \in0, 1
vbsrl.v vr8, \in0, 2
vbsrl.v vr9, \in0, 3
vbsrl.v vr10, \in0, 4
vbsrl.v vr11, \in0, 5
vbsrl.v vr12, \in0, 6
vbsrl.v vr13, \in0, 7
vilvl.d vr6, vr7, \in0
vilvl.d vr7, vr9, vr8
vilvl.d vr8, vr11, vr10
vilvl.d vr9, vr13, vr12
vdp2.h.bu.b vr10, vr6, vr5
vdp2.h.bu.b vr11, vr7, vr5
vdp2.h.bu.b vr12, vr8, vr5
vdp2.h.bu.b vr13, vr9, vr5
vhaddw.d.h vr10
vhaddw.d.h vr11
vhaddw.d.h vr12
vhaddw.d.h vr13
vpickev.w vr10, vr11, vr10
vpickev.w vr11, vr13, vr12
vmulwev.w.h vr10, vr10, vr1
vmulwev.w.h vr11, vr11, vr1
vadd.w vr10, vr10, vr2
vadd.w vr11, vr11, vr2
vsra.w vr10, vr10, vr3
vsra.w vr11, vr11, vr3
vadd.w \out0, vr10, vr4
vadd.w \out1, vr11, vr4
.endm
.macro PUT_HEVC_QPEL_UNI_W_H8_LASX in0, out0
xvbsrl.v xr7, \in0, 4
xvpermi.q xr7, \in0, 0x20
xvbsrl.v xr8, xr7, 1
xvbsrl.v xr9, xr7, 2
xvbsrl.v xr10, xr7, 3
xvpackev.d xr7, xr8, xr7
xvpackev.d xr8, xr10, xr9
xvdp2.h.bu.b xr10, xr7, xr5
xvdp2.h.bu.b xr11, xr8, xr5
xvhaddw.d.h xr10
xvhaddw.d.h xr11
xvpickev.w xr10, xr11, xr10
xvmulwev.w.h xr10, xr10, xr1
xvadd.w xr10, xr10, xr2
xvsra.w xr10, xr10, xr3
xvadd.w \out0, xr10, xr4
.endm
.macro PUT_HEVC_QPEL_UNI_W_H16_LASX in0, out0
xvpermi.d xr6, \in0, 0x94
xvbsrl.v xr7, xr6, 1
xvbsrl.v xr8, xr6, 2
xvbsrl.v xr9, xr6, 3
xvbsrl.v xr10, xr6, 4
xvbsrl.v xr11, xr6, 5
xvbsrl.v xr12, xr6, 6
xvbsrl.v xr13, xr6, 7
xvpackev.d xr6, xr7, xr6
xvpackev.d xr7, xr9, xr8
xvpackev.d xr8, xr11, xr10
xvpackev.d xr9, xr13, xr12
xvdp2.h.bu.b xr10, xr6, xr5
xvdp2.h.bu.b xr11, xr7, xr5
xvdp2.h.bu.b xr12, xr8, xr5
xvdp2.h.bu.b xr13, xr9, xr5
xvhaddw.d.h xr10
xvhaddw.d.h xr11
xvhaddw.d.h xr12
xvhaddw.d.h xr13
xvpickev.w xr10, xr11, xr10
xvpickev.w xr11, xr13, xr12
xvmulwev.w.h xr10, xr10, xr1
xvmulwev.w.h xr11, xr11, xr1
xvadd.w xr10, xr10, xr2
xvadd.w xr11, xr11, xr2
xvsra.w xr10, xr10, xr3
xvsra.w xr11, xr11, xr3
xvadd.w xr10, xr10, xr4
xvadd.w xr11, xr11, xr4
xvssrani.h.w xr11, xr10, 0
xvpermi.q \out0, xr11, 0x01
xvssrani.bu.h \out0, xr11, 0
.endm
function ff_hevc_put_hevc_qpel_uni_w_h4_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H4:
vld vr18, a2, 0
vldx vr19, a2, a3
alsl.d a2, a3, a2, 1
vbsrl.v vr6, vr18, 1
vbsrl.v vr7, vr18, 2
vbsrl.v vr8, vr18, 3
vbsrl.v vr9, vr19, 1
vbsrl.v vr10, vr19, 2
vbsrl.v vr11, vr19, 3
vilvl.d vr6, vr6, vr18
vilvl.d vr7, vr8, vr7
vilvl.d vr8, vr9, vr19
vilvl.d vr9, vr11, vr10
vdp2.h.bu.b vr10, vr6, vr5
vdp2.h.bu.b vr11, vr7, vr5
vdp2.h.bu.b vr12, vr8, vr5
vdp2.h.bu.b vr13, vr9, vr5
vhaddw.d.h vr10
vhaddw.d.h vr11
vhaddw.d.h vr12
vhaddw.d.h vr13
vpickev.w vr10, vr11, vr10
vpickev.w vr11, vr13, vr12
vmulwev.w.h vr10, vr10, vr1
vmulwev.w.h vr11, vr11, vr1
vadd.w vr10, vr10, vr2
vadd.w vr11, vr11, vr2
vsra.w vr10, vr10, vr3
vsra.w vr11, vr11, vr3
vadd.w vr10, vr10, vr4
vadd.w vr11, vr11, vr4
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.s f11, a0, 0
vbsrl.v vr11, vr11, 4
fstx.s f11, a0, a1
alsl.d a0, a1, a0, 1
addi.d a4, a4, -2
bnez a4, .LOOP_H4
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h4_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H4_LASX:
vld vr18, a2, 0
vldx vr19, a2, a3
alsl.d a2, a3, a2, 1
xvpermi.q xr18, xr19, 0x02
xvbsrl.v xr6, xr18, 1
xvbsrl.v xr7, xr18, 2
xvbsrl.v xr8, xr18, 3
xvpackev.d xr6, xr6, xr18
xvpackev.d xr7, xr8, xr7
xvdp2.h.bu.b xr10, xr6, xr5
xvdp2.h.bu.b xr11, xr7, xr5
xvhaddw.d.h xr10
xvhaddw.d.h xr11
xvpickev.w xr10, xr11, xr10
xvmulwev.w.h xr10, xr10, xr1
xvadd.w xr10, xr10, xr2
xvsra.w xr10, xr10, xr3
xvadd.w xr10, xr10, xr4
xvpermi.q xr11, xr10, 0x01
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.s f11, a0, 0
vbsrl.v vr11, vr11, 4
fstx.s f11, a0, a1
alsl.d a0, a1, a0, 1
addi.d a4, a4, -2
bnez a4, .LOOP_H4_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h6_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H6:
vld vr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr10, vr11
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.s f11, a0, 0
vstelm.h vr11, a0, 4, 2
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H6
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h6_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H6_LASX:
vld vr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LASX xr6, xr10
xvpermi.q xr11, xr10, 0x01
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.s f11, a0, 0
vstelm.h vr11, a0, 4, 2
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H6_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h8_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H8:
vld vr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr10, vr11
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.d f11, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H8
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h8_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H8_LASX:
vld vr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LASX xr6, xr10
xvpermi.q xr11, xr10, 0x01
vssrani.h.w vr11, vr10, 0
vssrani.bu.h vr11, vr11, 0
fst.d f11, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H8_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h12_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H12:
vld vr6, a2, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr14, vr15
vld vr6, a2, 8
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr16, vr17
add.d a2, a2, a3
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
fst.d f17, a0, 0
vbsrl.v vr17, vr17, 8
fst.s f17, a0, 8
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H12
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h12_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H12_LASX:
xvld xr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr6, xr14
fst.d f14, a0, 0
vstelm.w vr14, a0, 8, 2
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H12_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h16_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H16:
vld vr6, a2, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr14, vr15
vld vr6, a2, 8
PUT_HEVC_QPEL_UNI_W_H8_LSX vr6, vr16, vr17
add.d a2, a2, a3
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H16
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h16_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H16_LASX:
xvld xr6, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr6, xr10
vst vr10, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H16_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h24_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H24:
vld vr18, a2, 0
vld vr19, a2, 16
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr14, vr15
vshuf4i.d vr18, vr19, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr14, vr15
vssrani.h.w vr15, vr14, 0
vssrani.bu.h vr15, vr15, 0
fst.d f15, a0, 16
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H24
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h24_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H24_LASX:
xvld xr18, a2, 0
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr20
xvpermi.q xr19, xr18, 0x01
vst vr20, a0, 0
PUT_HEVC_QPEL_UNI_W_H8_LASX xr19, xr20
xvpermi.q xr21, xr20, 0x01
vssrani.h.w vr21, vr20, 0
vssrani.bu.h vr21, vr21, 0
fst.d f21, a0, 16
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H24_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h32_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H32:
vld vr18, a2, 0
vld vr19, a2, 16
vld vr20, a2, 32
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr14, vr15
vshuf4i.d vr18, vr19, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr14, vr15
vshuf4i.d vr19, vr20, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 16
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H32
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h32_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H32_LASX:
xvld xr18, a2, 0
xvld xr19, a2, 16
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr20
PUT_HEVC_QPEL_UNI_W_H16_LASX xr19, xr21
xvpermi.q xr20, xr21, 0x02
xvst xr20, a0, 0
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H32_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h48_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H48:
vld vr18, a2, 0
vld vr19, a2, 16
vld vr20, a2, 32
vld vr21, a2, 48
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr14, vr15
vshuf4i.d vr18, vr19, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr14, vr15
vshuf4i.d vr19, vr20, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 16
PUT_HEVC_QPEL_UNI_W_H8_LSX vr20, vr14, vr15
vshuf4i.d vr20, vr21, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr20, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 32
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H48
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h48_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H48_LASX:
xvld xr18, a2, 0
xvld xr19, a2, 32
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr20
xvpermi.q xr18, xr19, 0x03
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr21
xvpermi.q xr20, xr21, 0x02
xvst xr20, a0, 0
PUT_HEVC_QPEL_UNI_W_H16_LASX xr19, xr20
vst vr20, a0, 32
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H48_LASX
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h64_8_lsx
LOAD_VAR 128
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
addi.d a2, a2, -3 //src -= 3
.LOOP_H64:
vld vr18, a2, 0
vld vr19, a2, 16
vld vr20, a2, 32
vld vr21, a2, 48
vld vr22, a2, 64
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr14, vr15
vshuf4i.d vr18, vr19, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr18, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 0
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr14, vr15
vshuf4i.d vr19, vr20, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr19, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 16
PUT_HEVC_QPEL_UNI_W_H8_LSX vr20, vr14, vr15
vshuf4i.d vr20, vr21, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr20, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 32
PUT_HEVC_QPEL_UNI_W_H8_LSX vr21, vr14, vr15
vshuf4i.d vr21, vr22, 0x09
PUT_HEVC_QPEL_UNI_W_H8_LSX vr21, vr16, vr17
vssrani.h.w vr15, vr14, 0
vssrani.h.w vr17, vr16, 0
vssrani.bu.h vr17, vr15, 0
vst vr17, a0, 48
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H64
endfunc
function ff_hevc_put_hevc_qpel_uni_w_h64_8_lasx
LOAD_VAR 256
ld.d t0, sp, 0 //mx
addi.d t0, t0, -1
slli.w t0, t0, 4
la.local t1, ff_hevc_qpel_filters
vldx vr5, t1, t0 //filter
xvreplve0.q xr5, xr5
addi.d a2, a2, -3 //src -= 3
.LOOP_H64_LASX:
xvld xr18, a2, 0
xvld xr19, a2, 32
xvld xr20, a2, 64
add.d a2, a2, a3
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr21
xvpermi.q xr18, xr19, 0x03
PUT_HEVC_QPEL_UNI_W_H16_LASX xr18, xr22
xvpermi.q xr21, xr22, 0x02
xvst xr21, a0, 0
PUT_HEVC_QPEL_UNI_W_H16_LASX xr19, xr21
xvpermi.q xr19, xr20, 0x03
PUT_HEVC_QPEL_UNI_W_H16_LASX xr19, xr22
xvpermi.q xr21, xr22, 0x02
xvst xr21, a0, 32
add.d a0, a0, a1
addi.d a4, a4, -1
bnez a4, .LOOP_H64_LASX
endfunc
|