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
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
|
; Copyright © 2022-2023, VideoLAN and dav1d authors
; Copyright © 2022-2023, Two Orioles, LLC
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this
; list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%include "config.asm"
%include "ext/x86/x86inc.asm"
%if ARCH_X86_64
SECTION_RODATA 64
idct8x8p: db 0, 1, 4, 5, 2, 3, 6, 7, 16, 17, 20, 21, 18, 19, 22, 23
db 8, 9, 12, 13, 10, 11, 14, 15, 24, 25, 28, 29, 26, 27, 30, 31
db 32, 33, 36, 37, 34, 35, 38, 39, 48, 49, 52, 53, 50, 51, 54, 55
db 40, 41, 44, 45, 42, 43, 46, 47, 56, 57, 60, 61, 58, 59, 62, 63
idtx8x8p: db 0, 1, 32, 33, 2, 3, 34, 35, 4, 5, 36, 37, 6, 7, 38, 39
db 8, 9, 40, 41, 10, 11, 42, 43, 12, 13, 44, 45, 14, 15, 46, 47
db 16, 17, 48, 49, 18, 19, 50, 51, 20, 21, 52, 53, 22, 23, 54, 55
db 24, 25, 56, 57, 26, 27, 58, 59, 28, 29, 60, 61, 30, 31, 62, 63
idct8x16p: db 54, 55, 2, 3, 22, 23, 34, 35, 38, 39, 18, 19, 6, 7, 50, 51
db 62, 63, 10, 11, 30, 31, 42, 43, 46, 47, 26, 27, 14, 15, 58, 59
db 52, 53, 4, 5, 20, 21, 36, 37, 32, 33, 0, 1, 48, 49, 16, 17
db 60, 61, 12, 13, 28, 29, 44, 45, 40, 41, 8, 9, 56, 57, 24, 25
iadst8x16p: db 0, 1, 54, 55, 48, 49, 6, 7, 16, 17, 38, 39, 32, 33, 22, 23
db 8, 9, 62, 63, 56, 57, 14, 15, 24, 25, 46, 47, 40, 41, 30, 31
db 4, 5, 50, 51, 52, 53, 2, 3, 20, 21, 34, 35, 36, 37, 18, 19
db 12, 13, 58, 59, 60, 61, 10, 11, 28, 29, 42, 43, 44, 45, 26, 27
permA: db 0, 1, 0, 8, 4, 5, 1, 9, 8, 9, 4, 12, 12, 13, 5, 13
db 16, 17, 16, 24, 20, 21, 17, 25, 24, 25, 20, 28, 28, 29, 21, 29
db 2, 3, 2, 10, 6, 7, 3, 11, 10, 11, 6, 14, 14, 15, 7, 15
db 18, 19, 18, 26, 22, 23, 19, 27, 26, 27, 22, 30, 30, 31, 23, 31
permB: db 4, 2, 1, 8, 0, 0, 1, 0, 12, 3, 3, 10, 8, 1, 3, 2
db 5, 10, 5, 12, 1, 8, 5, 4, 13, 11, 7, 14, 9, 9, 7, 6
db 6, 6, 13, 4, 2, 4, 4, 5, 14, 7, 15, 6, 10, 5, 6, 7
db 7, 14, 9, 0, 3, 12, 0, 1, 15, 15, 11, 2, 11, 13, 2, 3
permC: db 0, 9, 0, 0, 0, 1, 4, 4, 2, 11, 2, 2, 2, 3, 6, 6
db 1, 8, 1, 8, 4, 5, 5, 12, 3, 10, 3, 10, 6, 7, 7, 14
db 9, 1, 8, 1, 1, 0, 12, 5, 11, 3, 10, 3, 3, 2, 14, 7
db 8, 0, 9, 9, 5, 4, 13, 13, 10, 2, 11, 11, 7, 6, 15, 15
idct8x32p: db 0, 1, 4, 5, 16, 17, 20, 21, 32, 33, 36, 37, 48, 49, 52, 53
db 8, 9, 12, 13, 24, 25, 28, 29, 40, 41, 44, 45, 56, 57, 60, 61
db 2, 3, 6, 7, 18, 19, 22, 23, 34, 35, 38, 39, 50, 51, 54, 55
db 10, 11, 14, 15, 26, 27, 30, 31, 42, 43, 46, 47, 58, 59, 62, 63
idct32x8p: db 2, 18, 0, 16, 3, 19, 1, 17, 10, 26, 8, 24, 11, 27, 9, 25
db 34, 50, 32, 48, 35, 51, 33, 49, 42, 58, 40, 56, 43, 59, 41, 57
db 6, 22, 4, 20, 7, 23, 5, 21, 14, 30, 12, 28, 15, 31, 13, 29
db 38, 54, 36, 52, 39, 55, 37, 53, 46, 62, 44, 60, 47, 63, 45, 61
idtx32x8p: db 0, 8, 16, 24, 4, 12, 20, 28, 2, 10, 18, 26, 6, 14, 22, 30
db 32, 40, 48, 56, 36, 44, 52, 60, 34, 42, 50, 58, 38, 46, 54, 62
db 1, 9, 17, 25, 5, 13, 21, 29, 3, 11, 19, 27, 7, 15, 23, 31
db 33, 41, 49, 57, 37, 45, 53, 61, 35, 43, 51, 59, 39, 47, 55, 63
pw_2048_m2048: times 16 dw 2048
pw_m2048_2048: times 16 dw -2048
pw_2048: times 16 dw 2048
; flags: 0 = ++, 1 = +-, 2 = -+, 3 = ++-, 4=--
%macro COEF_PAIR 2-3 0 ; a, b, flags
%if %3 == 1
pd_%1_m%2: dd %1, %1, -%2, -%2
%define pd_%1 (pd_%1_m%2 + 4*0)
%define pd_m%2 (pd_%1_m%2 + 4*2)
%elif %3 == 2
pd_m%1_%2: dd -%1, -%1, %2, %2
%define pd_m%1 (pd_m%1_%2 + 4*0)
%define pd_%2 (pd_m%1_%2 + 4*2)
%elif %3 == 4
pd_m%1_m%2: dd -%1, -%1, -%2, -%2
%define pd_m%1 (pd_m%1_m%2 + 4*0)
%define pd_m%2 (pd_m%1_m%2 + 4*2)
%else
pd_%1_%2: dd %1, %1, %2, %2
%define pd_%1 (pd_%1_%2 + 4*0)
%define pd_%2 (pd_%1_%2 + 4*2)
%if %3 == 3
%define pd_%2_m%2 pd_%2
dd -%2, -%2
%endif
%endif
%endmacro
COEF_PAIR 101, 501
COEF_PAIR 201, 601, 1
COEF_PAIR 201, 995
COEF_PAIR 401, 1189, 1
COEF_PAIR 401, 1931
COEF_PAIR 401, 3920
COEF_PAIR 401, 4076
COEF_PAIR 700, 301, 4
COEF_PAIR 799, 2276, 1
COEF_PAIR 799, 3406
COEF_PAIR 799, 4017
COEF_PAIR 1380, 601
COEF_PAIR 1751, 2440
COEF_PAIR 2598, 1189
COEF_PAIR 2598, 1931, 2
COEF_PAIR 2598, 3612
COEF_PAIR 2751, 2106
COEF_PAIR 2896, 1567, 3
COEF_PAIR 2896, 3784, 3
COEF_PAIR 3035, 3513
COEF_PAIR 3166, 1931
COEF_PAIR 3166, 3612
COEF_PAIR 3166, 3920
COEF_PAIR 3703, 3290
COEF_PAIR 3857, 4052
COEF_PAIR 4017, 2276
COEF_PAIR 4017, 3406
COEF_PAIR 4036, 4085
COEF_PAIR 4076, 1189
COEF_PAIR 4076, 3612
COEF_PAIR 4076, 3920
COEF_PAIR 4091, 3973
COEF_PAIR 4091, 4052
COEF_PAIR 4095, 4065
pb_32: times 4 db 32
pw_5: times 2 dw 5
pw_4096: times 2 dw 4096
pw_8192: times 2 dw 8192
pw_1697x16: times 2 dw 1697*16
pw_2896x8: times 2 dw 2896*8
pixel_10bpc_max: times 2 dw 0x03ff
dconly_10bpc: times 2 dw 0x7c00
clip_18b_min: dd -0x20000
clip_18b_max: dd 0x1ffff
pd_1: dd 1
pd_2: dd 2
pd_1448: dd 1448
pd_2048: dd 2048
pd_3071: dd 3071 ; 1024 + 2048 - 1
pd_3072: dd 3072 ; 1024 + 2048
pd_5119: dd 5119 ; 1024 + 4096 - 1
pd_5120: dd 5120 ; 1024 + 4096
pd_5793: dd 5793
cextern dup16_perm
cextern int8_permA
cextern idct64_mul_16bpc
cextern idct_8x8_internal_8bpc_avx512icl.main
cextern iadst_8x8_internal_8bpc_avx512icl.main_pass2
cextern idct_8x16_internal_8bpc_avx512icl.main
cextern idct_8x16_internal_8bpc_avx512icl.main2
cextern idct_8x16_internal_8bpc_avx512icl.main_fast
cextern idct_8x16_internal_8bpc_avx512icl.main_fast2
cextern iadst_8x16_internal_8bpc_avx512icl.main2
cextern idct_16x8_internal_8bpc_avx512icl.main
cextern iadst_16x8_internal_8bpc_avx512icl.main_pass2
cextern idct_16x16_internal_8bpc_avx512icl.main
cextern idct_16x16_internal_8bpc_avx512icl.main2
cextern idct_16x16_internal_8bpc_avx512icl.main_fast
cextern idct_16x16_internal_8bpc_avx512icl.main_fast2
cextern iadst_16x16_internal_8bpc_avx512icl.main_pass2b
cextern inv_txfm_add_dct_dct_8x32_8bpc_avx512icl.main
cextern inv_txfm_add_dct_dct_8x32_8bpc_avx512icl.main_fast
cextern inv_txfm_add_dct_dct_8x32_8bpc_avx512icl.main_fast2
cextern inv_txfm_add_dct_dct_8x32_8bpc_avx512icl.main_end
cextern inv_txfm_add_dct_dct_16x32_8bpc_avx512icl.main_oddhalf
cextern inv_txfm_add_dct_dct_16x32_8bpc_avx512icl.main_oddhalf_fast
cextern inv_txfm_add_dct_dct_16x32_8bpc_avx512icl.main_oddhalf_fast2
cextern inv_txfm_add_dct_dct_32x8_8bpc_avx512icl.main
cextern inv_txfm_add_dct_dct_32x16_8bpc_avx512icl.main_oddhalf
cextern inv_txfm_add_dct_dct_32x16_8bpc_avx512icl.main_oddhalf_fast
cextern inv_txfm_add_dct_dct_32x16_8bpc_avx512icl.main_oddhalf_fast2
cextern inv_txfm_add_dct_dct_32x16_8bpc_avx512icl.main_oddhalf_fast3
cextern inv_txfm_add_dct_dct_32x32_8bpc_avx512icl.main_oddhalf
cextern inv_txfm_add_dct_dct_32x32_8bpc_avx512icl.main_oddhalf_fast
cextern inv_txfm_add_dct_dct_32x32_8bpc_avx512icl.main_oddhalf_fast2
cextern inv_txfm_add_dct_dct_32x32_8bpc_avx512icl.main_oddhalf_fast3
cextern inv_txfm_add_dct_dct_16x64_8bpc_avx512icl.main_oddhalf
cextern inv_txfm_add_dct_dct_16x64_8bpc_avx512icl.main_oddhalf_fast
cextern inv_txfm_add_dct_dct_32x64_8bpc_avx512icl.main_part1
cextern inv_txfm_add_dct_dct_32x64_8bpc_avx512icl.main_part1_fast
cextern inv_txfm_add_dct_dct_32x64_8bpc_avx512icl.main_part1_fast2
cextern inv_txfm_add_dct_dct_32x64_8bpc_avx512icl.main_part2
SECTION .text
%define o_base (pw_2048+4*128)
%define o_base_8bpc (int8_permA+64*18)
%define o(x) (r5 - o_base + (x))
%define m(x) mangle(private_prefix %+ _ %+ x %+ SUFFIX)
INIT_ZMM avx512icl
; dst1 = (src1 * coef1 - src2 * coef2 + rnd) >> 12
; dst2 = (src1 * coef2 + src2 * coef1 + rnd) >> 12
; flags: 1 = inv_dst1, 2 = inv_dst2
; skip round/shift if rnd is not a number
%macro ITX_MULSUB_2D 8-9 0 ; dst/src[1-2], tmp[1-3], rnd, coef[1-2], flags
%if %8 < 32
pmulld m%4, m%1, m%8
pmulld m%3, m%2, m%8
%else
%if %8 < 4096
vpbroadcastd m%3, [o(pd_%8)]
%else
vbroadcasti32x4 m%3, [o(pd_%8)]
%endif
pmulld m%4, m%1, m%3
pmulld m%3, m%2
%endif
%if %7 < 32
pmulld m%1, m%7
pmulld m%2, m%7
%else
%if %7 < 4096
vpbroadcastd m%5, [o(pd_%7)]
%else
vbroadcasti32x4 m%5, [o(pd_%7)]
%endif
pmulld m%1, m%5
pmulld m%2, m%5
%endif
%if %9 & 2
psubd m%4, m%6, m%4
psubd m%2, m%4, m%2
%else
%ifnum %6
paddd m%4, m%6
%endif
paddd m%2, m%4
%endif
%ifnum %6
paddd m%1, m%6
%endif
%if %9 & 1
psubd m%1, m%3, m%1
%else
psubd m%1, m%3
%endif
%ifnum %6
psrad m%2, 12
psrad m%1, 12
%endif
%endmacro
%macro INV_TXFM_FN 4 ; type1, type2, eob_offset, size
cglobal inv_txfm_add_%1_%2_%4_10bpc, 4, 7, 0, dst, stride, c, eob, tx2
%define %%p1 m(i%1_%4_internal_10bpc)
lea r5, [o_base]
; Jump to the 1st txfm function if we're not taking the fast path, which
; in turn performs an indirect jump to the 2nd txfm function.
lea tx2q, [m(i%2_%4_internal_10bpc).pass2]
%ifidn %1_%2, dct_dct
test eobd, eobd
jnz %%p1
%else
%if %3
add eobd, %3
%endif
; jump to the 1st txfm function unless it's located directly after this
times ((%%end - %%p1) >> 31) & 1 jmp %%p1
ALIGN function_align
%%end:
%endif
%endmacro
%macro INV_TXFM_8X8_FN 2-3 0 ; type1, type2, eob_offset
INV_TXFM_FN %1, %2, %3, 8x8
%ifidn %1_%2, dct_dct
imul r6d, [cq], 181
mov [cq], eobd ; 0
or r3d, 8
.dconly:
add r6d, 384
sar r6d, 9
.dconly2:
vpbroadcastd ym2, [o(dconly_10bpc)]
imul r6d, 181
add r6d, 2176
sar r6d, 12
vpbroadcastw ym1, r6d
paddsw ym1, ym2
.dconly_loop:
mova xm0, [dstq+strideq*0]
vinserti32x4 ym0, [dstq+strideq*1], 1
paddsw ym0, ym1
psubusw ym0, ym2
mova [dstq+strideq*0], xm0
vextracti32x4 [dstq+strideq*1], ym0, 1
lea dstq, [dstq+strideq*2]
sub r3d, 2
jg .dconly_loop
RET
%endif
%endmacro
INV_TXFM_8X8_FN dct, dct
INV_TXFM_8X8_FN dct, adst
INV_TXFM_8X8_FN dct, flipadst
INV_TXFM_8X8_FN dct, identity
cglobal idct_8x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call .load
vpermi2q m1, m0, m2 ; 1 5
vpermi2q m3, m6, m4 ; 7 3
vpermt2q m0, m5, m4 ; 0 2
vpermt2q m2, m5, m6 ; 4 6
call .main
call .main_end
mova m4, [o(idct8x8p)]
packssdw m0, m2 ; 0 1 4 5
packssdw m1, m3 ; 3 2 7 6
vpermb m0, m4, m0
vprolq m1, 32
vpermb m2, m4, m1
punpckhdq m1, m0, m2
punpckldq m0, m2
jmp tx2q
.pass2:
lea r5, [o_base_8bpc]
vextracti32x8 ym2, m0, 1
vextracti32x8 ym3, m1, 1
call m(idct_8x8_internal_8bpc).main
mova m10, [permC]
vpbroadcastd m12, [pw_2048]
.end:
vpermt2q m0, m10, m1
vpermt2q m2, m10, m3
.end2:
vpbroadcastd m11, [pixel_10bpc_max]
lea r6, [strideq*3]
pxor m10, m10
pmulhrsw m8, m12, m0
call .write_8x4_start
pmulhrsw m8, m12, m2
.write_8x4:
lea dstq, [dstq+strideq*4]
add cq, 64*2
.write_8x4_start:
mova xm9, [dstq+strideq*0]
vinserti32x4 ym9, [dstq+strideq*1], 1
vinserti32x4 m9, [dstq+strideq*2], 2
vinserti32x4 m9, [dstq+r6 ], 3
mova [cq+64*0], m10
mova [cq+64*1], m10
paddw m9, m8
pmaxsw m9, m10
pminsw m9, m11
mova [dstq+strideq*0], xm9
vextracti32x4 [dstq+strideq*1], ym9, 1
vextracti32x4 [dstq+strideq*2], m9, 2
vextracti32x4 [dstq+r6 ], m9, 3
ret
ALIGN function_align
.load:
mova m0, [cq+64*0] ; 0 1
mova m4, [cq+64*1] ; 2 3
mova m1, [o(permB)]
mova m2, [cq+64*2] ; 4 5
mova m6, [cq+64*3] ; 6 7
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
psrlq m5, m1, 32
vpbroadcastd m12, [o(pd_2896)]
mova m3, m1
vpbroadcastd m11, [o(pd_1)]
ret
ALIGN function_align
.main_fast: ; bottom half is zero
vbroadcasti32x4 m3, [o(pd_4017_3406)]
vbroadcasti32x4 m8, [o(pd_799_m2276)]
vbroadcasti32x4 m2, [o(pd_2896_3784)]
vbroadcasti32x4 m9, [o(pd_2896_1567)]
pmulld m3, m1 ; t4a t5a
pmulld m1, m8 ; t7a t6a
pmulld m2, m0 ; t0 t3
pmulld m0, m9 ; t1 t2
jmp .main2
.main:
ITX_MULSUB_2D 1, 3, 8, 9, 10, _, 799_3406, 4017_2276
ITX_MULSUB_2D 0, 2, 8, 9, 10, _, 2896_1567, 2896_3784
.main2:
REPX {paddd x, m13}, m1, m3, m0, m2
REPX {psrad x, 12 }, m1, m3, m0, m2
punpcklqdq m8, m1, m3 ; t4a t7a
punpckhqdq m1, m3 ; t5a t6a
psubd m3, m8, m1 ; t5a t6a
paddd m8, m1 ; t4 t7
pmaxsd m3, m14
punpckhqdq m1, m2, m0 ; t3 t2
pminsd m3, m15
punpcklqdq m2, m0 ; t0 t1
pmulld m3, m12
paddd m0, m2, m1 ; dct4 out0 out1
psubd m2, m1 ; dct4 out3 out2
REPX {pmaxsd x, m14}, m8, m0, m2
REPX {pminsd x, m15}, m8, m0, m2
.main3:
pshufd m1, m3, q1032
paddd m3, m13
psubd m9, m3, m1
paddd m3, m1
psrad m9, 12
psrad m3, 12
punpckhqdq m1, m8, m3 ; t7 t6
shufpd m8, m9, 0xaa ; t4 t5
ret
.main_end:
paddd m0, m11
paddd m2, m11
psubd m3, m0, m1 ; out7 out6
paddd m0, m1 ; out0 out1
paddd m1, m2, m8 ; out3 out2
psubd m2, m8 ; out4 out5
REPX {vpsravd x, m11}, m0, m2, m3, m1
ret
INV_TXFM_8X8_FN adst, dct
INV_TXFM_8X8_FN adst, flipadst
INV_TXFM_8X8_FN adst, identity
INV_TXFM_8X8_FN adst, adst
cglobal iadst_8x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call m(idct_8x8_internal_10bpc).load
vpermi2q m1, m6, m2 ; 7 5
vpermi2q m3, m4, m0 ; 3 1
vpermt2q m0, m5, m4 ; 0 2
vpermt2q m2, m5, m6 ; 4 6
call .main
punpckldq m1, m2, m4 ; out4 out6
punpckhdq m2, m0 ; -out5 -out7
punpckldq m0, m3 ; out0 out2
punpckhdq m4, m3 ; -out1 -out3
paddd m1, m11
psubd m3, m11, m2
paddd m0, m11
psubd m4, m11, m4
.pass1_end:
REPX {psrad x, 1}, m1, m0, m3, m4
packssdw m0, m1 ; 0 2 4 6
packssdw m4, m3 ; 1 3 5 7
psrlq m1, [o(permB)], 8
punpckhwd m3, m0, m4
punpcklwd m0, m4
psrlq m2, m1, 32
vpermi2q m1, m0, m3
vpermt2q m0, m2, m3
jmp tx2q
.pass2:
call .main_pass2
movu m10, [permC+2]
vbroadcasti32x8 m12, [pw_2048_m2048+16]
jmp m(idct_8x8_internal_10bpc).end
.main_pass2:
vextracti32x8 ym2, m0, 1
vextracti32x8 ym3, m1, 1
lea r5, [o_base_8bpc]
pshufd ym4, ym0, q1032
pshufd ym5, ym1, q1032
jmp m(iadst_8x8_internal_8bpc).main_pass2
ALIGN function_align
.main:
ITX_MULSUB_2D 1, 0, 4, 5, 6, 13, 401_1931, 4076_3612
ITX_MULSUB_2D 3, 2, 4, 5, 6, 13, 3166_3920, 2598_1189
psubd m4, m0, m2 ; t4 t6
paddd m0, m2 ; t0 t2
psubd m2, m1, m3 ; t5 t7
paddd m1, m3 ; t1 t3
REPX {pmaxsd x, m14}, m4, m2, m0, m1
REPX {pminsd x, m15}, m4, m2, m0, m1
pxor m5, m5
psubd m5, m4
shufpd m4, m2, 0xaa ; t4 t7
shufpd m2, m5, 0xaa ; t5 -t6
ITX_MULSUB_2D 4, 2, 3, 5, 6, 13, 1567, 3784
punpckhqdq m3, m0, m1
punpcklqdq m0, m1
psubd m1, m0, m3 ; t2 t3
paddd m0, m3 ; out0 -out7
punpckhqdq m3, m4, m2 ; t7a t6a
punpcklqdq m4, m2 ; t5a t4a
psubd m2, m4, m3 ; t7 t6
paddd m4, m3 ; out6 -out1
REPX {pmaxsd x, m14}, m1, m2
REPX {pminsd x, m15}, m1, m2
shufpd m3, m1, m2, 0xaa
shufpd m1, m2, 0x55
pmulld m3, m12
pmulld m1, m12
paddd m3, m13
psubd m2, m3, m1
paddd m3, m1
psrad m2, 12 ; out4 -out5
pshufd m3, m3, q1032
psrad m3, 12 ; out2 -out3
ret
INV_TXFM_8X8_FN flipadst, dct
INV_TXFM_8X8_FN flipadst, adst
INV_TXFM_8X8_FN flipadst, identity
INV_TXFM_8X8_FN flipadst, flipadst
cglobal iflipadst_8x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call m(idct_8x8_internal_10bpc).load
vpermi2q m1, m6, m2 ; 7 5
vpermi2q m3, m4, m0 ; 3 1
vpermt2q m0, m5, m4 ; 0 2
vpermt2q m2, m5, m6 ; 4 6
call m(iadst_8x8_internal_10bpc).main
punpckhdq m1, m3, m4 ; -out3 -out1
punpckldq m3, m0 ; out2 out0
punpckhdq m0, m2 ; -out7 -out5
punpckldq m4, m2 ; out6 out4
psubd m1, m11, m1
paddd m3, m11
psubd m0, m11, m0
paddd m4, m11
jmp m(iadst_8x8_internal_10bpc).pass1_end
.pass2:
call m(iadst_8x8_internal_10bpc).main_pass2
movu m10, [permC+1]
vbroadcasti32x8 m12, [pw_m2048_2048+16]
lea r6, [strideq*3]
vpermt2q m0, m10, m1 ; 7 6 5 4
vpbroadcastd m11, [pixel_10bpc_max]
vpermt2q m2, m10, m3 ; 3 2 1 0
pxor m10, m10
pmulhrsw m8, m12, m2
call m(idct_8x8_internal_10bpc).write_8x4_start
pmulhrsw m8, m12, m0
jmp m(idct_8x8_internal_10bpc).write_8x4
INV_TXFM_8X8_FN identity, dct
INV_TXFM_8X8_FN identity, adst
INV_TXFM_8X8_FN identity, flipadst
INV_TXFM_8X8_FN identity, identity
cglobal iidentity_8x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
mova m1, [cq+64*0]
packssdw m1, [cq+64*2] ; 0 4 1 5
mova m2, [cq+64*1] ; 2 6 3 7
packssdw m2, [cq+64*3]
mova m0, [o(idtx8x8p)]
vpermb m1, m0, m1
vpermb m2, m0, m2
punpckldq m0, m1, m2 ; 0 1 4 5
punpckhdq m1, m2 ; 2 3 6 7
jmp tx2q
.pass2:
movu m3, [o(permC+2)]
vpbroadcastd m12, [o(pw_4096)]
psrlq m2, m3, 32
vpermi2q m2, m0, m1
vpermt2q m0, m3, m1
jmp m(idct_8x8_internal_10bpc).end2
%macro INV_TXFM_8X16_FN 2-3 0 ; type1, type2, eob_offset
INV_TXFM_FN %1, %2, %3, 8x16
%ifidn %1_%2, dct_dct
imul r6d, [cq], 181
mov [cq], eobd ; 0
or r3d, 16
add r6d, 128
sar r6d, 8
imul r6d, 181
jmp m(inv_txfm_add_dct_dct_8x8_10bpc).dconly
%endif
%endmacro
INV_TXFM_8X16_FN dct, dct
INV_TXFM_8X16_FN dct, identity, 35
INV_TXFM_8X16_FN dct, flipadst
INV_TXFM_8X16_FN dct, adst
cglobal idct_8x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
cmp eobd, 43
jl .fast
call .load
call .main
call .main_end
.pass1_end:
packssdw m0, m4
packssdw m1, m5
packssdw m2, m6
packssdw m3, m7
jmp tx2q
.pass2:
mova m8, [o(idct8x16p)]
REPX {vpermb x, m8, x}, m0, m1, m2, m3
punpckhdq m5, m0, m1
punpckldq m0, m1
punpckhdq m4, m2, m3
punpckldq m2, m3
punpcklqdq m8, m0, m2 ; 15 1
punpckhqdq m0, m2 ; 7 9
punpckhqdq m1, m5, m4 ; 3 13
punpcklqdq m5, m4 ; 11 5
lea r5, [o_base_8bpc]
vextracti32x8 ym7, m8, 1 ; 14 2
vextracti32x8 ym3, m0, 1 ; 6 10
vextracti32x8 ym6, m1, 1 ; 12 4
vextracti32x8 ym9, m5, 1 ; 8 0
call m(idct_8x16_internal_8bpc).main2
mova m8, [permC]
vpbroadcastd m12, [pw_2048]
vpermt2q m0, m8, m1
lea r6, [strideq*3]
vpermt2q m2, m8, m3
vpbroadcastd m11, [pixel_10bpc_max]
vpermt2q m4, m8, m5
pxor m10, m10
vpermt2q m6, m8, m7
pmulhrsw m8, m12, m0
call m(idct_8x8_internal_10bpc).write_8x4_start
pmulhrsw m8, m12, m2
call m(idct_8x8_internal_10bpc).write_8x4
pmulhrsw m8, m12, m4
call m(idct_8x8_internal_10bpc).write_8x4
pmulhrsw m8, m12, m6
jmp m(idct_8x8_internal_10bpc).write_8x4
.fast:
mova ym0, [cq+64*0]
mova ym4, [cq+64*2]
mova ym1, [cq+64*1]
mova ym5, [cq+64*5]
mova ym2, [cq+64*4]
mova ym6, [cq+64*6]
mova ym3, [cq+64*7]
mova ym7, [cq+64*3]
call .round_input_fast
call m(idct_8x8_internal_10bpc).main
call m(idct_8x8_internal_10bpc).main_end
movu m6, [o(permC+3)]
packssdw m3, m1, m3
packssdw m1, m0, m2
vprolq m3, 32
vpermd m1, m6, m1
vpermd m3, m6, m3
mova ym0, ym1 ; 0 4
vextracti32x8 ym1, m1, 1 ; 1 5
mova ym2, ym3 ; 2 6
vextracti32x8 ym3, m3, 1 ; 3 7
jmp tx2q
ALIGN function_align
.round_input_fast:
movshdup m8, [o(permB)]
vpbroadcastd m12, [o(pd_2896)]
vpermt2q m0, m8, m4
vpermt2q m1, m8, m5
vpermt2q m2, m8, m6
vpermt2q m3, m8, m7
vpbroadcastd m13, [o(pd_2048)]
REPX {pmulld x, m12}, m0, m1, m2, m3
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
REPX {paddd x, m13}, m0, m1, m2, m3
vpbroadcastd m11, [o(pd_1)]
REPX {psrad x, 12 }, m0, m1, m2, m3
ret
ALIGN function_align
.load:
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
.load2:
vpbroadcastd m12, [o(pd_2896)]
pmulld m0, m12, [cq+64*0]
pmulld m1, m12, [cq+64*1]
pmulld m2, m12, [cq+64*2]
pmulld m3, m12, [cq+64*3]
vpbroadcastd m13, [o(pd_2048)]
pmulld m4, m12, [cq+64*4]
pmulld m5, m12, [cq+64*5]
pmulld m6, m12, [cq+64*6]
pmulld m7, m12, [cq+64*7]
.round:
REPX {paddd x, m13}, m0, m1, m2, m3
REPX {psrad x, 12 }, m0, m1, m2, m3
REPX {paddd x, m13}, m4, m5, m6, m7
REPX {psrad x, 12 }, m4, m5, m6, m7
ret
ALIGN function_align
.main_fast2_rect2:
REPX {paddd x, m13}, m0, m1
REPX {psrad x, 12 }, m0, m1
.main_fast2:
pmulld m0, m12
pmulld m6, m1, [o(pd_4017)] {1to16} ; t7a
pmulld m8, m1, [o(pd_799)] {1to16} ; t4a
REPX {paddd x, m13}, m0, m6, m8
REPX {psrad x, 12 }, m0, m6, m8
pmulld m5, m6, m12
pmulld m1, m8, m12
paddd m5, m13
psubd m4, m5, m1
paddd m5, m1
REPX {psrad x, 12 }, m4, m5
REPX {mova x, m0 }, m1, m2, m3
ret
.main_fast_rect2:
REPX {paddd x, m13}, m0, m1, m2, m3
REPX {psrad x, 12 }, m0, m1, m2, m3
.main_fast:
pmulld m0, m12
pmulld m5, m3, [o(pd_2276)] {1to16} ; t5a
pmulld m3, [o(pd_3406)] {1to16} ; t6a
pmulld m7, m1, [o(pd_4017)] {1to16} ; t7a
pmulld m1, [o(pd_799)] {1to16} ; t4a
pmulld m6, m2, [o(pd_3784)] {1to16} ; t3
pmulld m2, [o(pd_1567)] {1to16} ; t2
paddd m0, m13
psubd m5, m13, m5
psrad m0, 12 ; t0
mova m9, m0 ; t1
jmp .main2
.main_rect2:
call .round
.main:
pmulld m0, m12
ITX_MULSUB_2D 5, 3, 8, 9, 10, _, 3406, 2276 ; t5a t6a
ITX_MULSUB_2D 1, 7, 8, 9, 10, _, 799, 4017 ; t4a t7a
ITX_MULSUB_2D 2, 6, 8, 9, 10, _, 1567, 3784 ; t2 t3
pmulld m4, m12
paddd m0, m13
paddd m5, m13
psubd m9, m0, m4 ; t1
paddd m0, m4 ; t0
psrad m9, 12
psrad m0, 12
.main2:
REPX {paddd x, m13}, m3, m1, m7
REPX {psrad x, 12 }, m5, m1, m3, m7
paddd m8, m1, m5 ; t4
psubd m1, m5 ; t5a
psubd m5, m7, m3 ; t6a
paddd m7, m3 ; t7
pmaxsd m5, m14
pmaxsd m1, m14
paddd m2, m13
paddd m6, m13
pminsd m5, m15
pminsd m1, m15
pmulld m5, m12
pmulld m1, m12
pmaxsd m8, m14
pmaxsd m7, m14
pminsd m8, m15
paddd m5, m13
psubd m4, m5, m1
paddd m5, m1
REPX {psrad x, 12 }, m2, m6, m5, m4
paddd m1, m9, m2 ; dct4 out1
psubd m2, m9, m2 ; dct4 out2
psubd m3, m0, m6 ; dct4 out3
paddd m0, m6 ; dct4 out0
pminsd m6, m15, m7
REPX {pmaxsd x, m14}, m0, m1, m2, m3
REPX {pminsd x, m15}, m0, m1, m2, m3
ret
.main_end:
vpbroadcastd m11, [o(pd_1)]
.main_end2:
REPX {paddd x, m11}, m0, m1, m2, m3
psubd m7, m0, m6 ; out7
paddd m0, m6 ; out0
psubd m6, m1, m5 ; out6
paddd m1, m5 ; out1
psubd m5, m2, m4 ; out5
paddd m2, m4 ; out2
psubd m4, m3, m8 ; out4
paddd m3, m8 ; out3
REPX {vpsravd x, m11}, m0, m1, m2, m3, m4, m5, m6, m7
ret
INV_TXFM_8X16_FN adst, dct
INV_TXFM_8X16_FN adst, identity, 35
INV_TXFM_8X16_FN adst, flipadst
INV_TXFM_8X16_FN adst, adst
cglobal iadst_8x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
cmp eobd, 43
jl .fast
call m(idct_8x16_internal_10bpc).load
call .main
psrad m0, 1
psrad m1, 1
psrad m6, m10, 1
psrad m7, m11, 1
psrad m2, 12
psrad m3, 12
psrad m4, m8, 12
psrad m5, m9, 12
jmp m(idct_8x16_internal_10bpc).pass1_end
.fast:
call .fast_main
punpcklqdq m1, m2, m4 ; out4 out6
punpckhqdq m2, m0 ; -out5 -out7
punpcklqdq m0, m3 ; out0 out2
punpckhqdq m4, m3 ; -out1 -out3
paddd m1, m11
psubd m3, m11, m2
paddd m0, m11
psubd m4, m11, m4
.fast_end:
movu m5, [o(permC+3)]
REPX {psrad x, 1}, m1, m0, m3, m4
packssdw m2, m0, m1 ; 0 2 4 6
packssdw m3, m4, m3 ; 1 3 5 7
vpermd m2, m5, m2
vpermd m3, m5, m3
mova ym0, ym2
vextracti32x8 ym2, m2, 1
mova ym1, ym3
vextracti32x8 ym3, m3, 1
jmp tx2q
.pass2:
call .pass2_main
movu m4, [permB+2]
vbroadcasti32x8 m12, [pw_2048_m2048+16]
psrlq m7, m4, 8
vpermi2q m4, m0, m3 ; 0 1 2 3
psrlq m5, m7, 24
vpermi2q m7, m0, m3 ; 12 13 14 15
psrlq m6, m5, 8
vpermq m5, m5, m1 ; 4 5 6 7
vpermq m6, m6, m2 ; 8 9 10 11
.pass2_end:
vpbroadcastd m11, [pixel_10bpc_max]
pxor m10, m10
lea r6, [strideq*3]
pmulhrsw m8, m12, m4
call m(idct_8x8_internal_10bpc).write_8x4_start
pmulhrsw m8, m12, m5
call m(idct_8x8_internal_10bpc).write_8x4
pmulhrsw m8, m12, m6
call m(idct_8x8_internal_10bpc).write_8x4
pmulhrsw m8, m12, m7
jmp m(idct_8x8_internal_10bpc).write_8x4
ALIGN function_align
.main:
ITX_MULSUB_2D 7, 0, 8, 9, 10, 13, 401, 4076 ; t1a, t0a
ITX_MULSUB_2D 1, 6, 8, 9, 10, 13, 3920, 1189 ; t7a, t6a
ITX_MULSUB_2D 5, 2, 8, 9, 10, 13, 1931, 3612 ; t3a, t2a
ITX_MULSUB_2D 3, 4, 8, 9, 10, 13, 3166, 2598 ; t5a, t4a
psubd m8, m2, m6 ; t6
paddd m2, m6 ; t2
psubd m6, m0, m4 ; t4
paddd m0, m4 ; t0
psubd m4, m5, m1 ; t7
paddd m5, m1 ; t3
psubd m1, m7, m3 ; t5
paddd m7, m3 ; t1
REPX {pmaxsd x, m14}, m6, m1, m8, m4, m2, m0, m5, m7
REPX {pminsd x, m15}, m6, m1, m8, m4, m2, m0, m5, m7
vpbroadcastd m10, [o(pd_1567)]
vpbroadcastd m11, [o(pd_3784)]
ITX_MULSUB_2D 6, 1, 3, 9, _, 13, 10, 11 ; t5a, t4a
ITX_MULSUB_2D 4, 8, 3, 9, _, 13, 11, 10 ; t6a, t7a
vpbroadcastd m12, [o(pd_1448)]
psubd m9, m6, m8 ; t7
paddd m6, m8 ; out6
psubd m3, m7, m5 ; t3
paddd m7, m5 ; -out7
psubd m5, m0, m2 ; t2
paddd m0, m2 ; out0
psubd m2, m1, m4 ; t6
paddd m1, m4 ; -out1
REPX {pmaxsd x, m14}, m5, m3, m2, m9
REPX {pminsd x, m15}, m5, m3, m2, m9
REPX {pmulld x, m12}, m5, m3, m2, m9
vpbroadcastd m4, [o(pd_1)]
psubd m8, m5, m3 ; (t2 - t3) * 1448
paddd m3, m5 ; (t2 + t3) * 1448
psubd m5, m2, m9 ; (t6 - t7) * 1448
paddd m2, m9 ; (t6 + t7) * 1448
vpbroadcastd m9, [o(pd_3072)]
paddd m0, m4
psubd m1, m4, m1
paddd m10, m6, m4
psubd m11, m4, m7
paddd m2, m9
paddd m8, m9
vpbroadcastd m9, [o(pd_3071)]
psubd m3, m9, m3
psubd m9, m5
ret
ALIGN function_align
.fast_main:
mova ym0, [cq+64*0]
mova ym4, [cq+64*2]
mova ym1, [cq+64*7]
mova ym5, [cq+64*5]
mova ym2, [cq+64*4]
mova ym6, [cq+64*6]
mova ym3, [cq+64*3]
mova ym7, [cq+64*1]
call m(idct_8x16_internal_10bpc).round_input_fast
jmp m(iadst_8x8_internal_10bpc).main
ALIGN function_align
.pass2_main:
mova m8, [o(iadst8x16p)]
REPX {vpermb x, m8, x}, m0, m1, m2, m3
vpbroadcastd m10, [o(pw_2896x8)]
punpckhdq m5, m0, m1
punpckldq m0, m1
punpckhdq m1, m2, m3
punpckldq m2, m3
lea r5, [o_base_8bpc]
punpckhqdq m4, m0, m2 ; 12 3 14 1
punpcklqdq m0, m2 ; 0 15 2 13
punpckhqdq m6, m5, m1 ; 8 7 10 5
punpcklqdq m5, m1 ; 4 11 6 9
call m(iadst_8x16_internal_8bpc).main2
paddsw m1, m2, m4
psubsw m2, m4
pmulhrsw m1, m10 ; -out7 out4 out6 -out5
pmulhrsw m2, m10 ; out8 -out11 -out9 out10
ret
INV_TXFM_8X16_FN flipadst, dct
INV_TXFM_8X16_FN flipadst, identity, 35
INV_TXFM_8X16_FN flipadst, adst
INV_TXFM_8X16_FN flipadst, flipadst
cglobal iflipadst_8x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
cmp eobd, 43
jl .fast
call m(idct_8x16_internal_10bpc).load
call m(iadst_8x16_internal_10bpc).main
psrad m7, m0, 1
psrad m0, m11, 1
psrad m6, m1, 1
psrad m1, m10, 1
psrad m5, m2, 12
psrad m2, m9, 12
psrad m4, m3, 12
psrad m3, m8, 12
jmp m(idct_8x16_internal_10bpc).pass1_end
.fast:
call m(iadst_8x16_internal_10bpc).fast_main
punpckhqdq m1, m3, m4 ; -out3 -out1
punpcklqdq m3, m0 ; out2 out0
punpckhqdq m0, m2 ; -out7 -out5
punpcklqdq m4, m2 ; out6 out4
psubd m1, m11, m1
paddd m3, m11
psubd m0, m11, m0
paddd m4, m11
jmp m(iadst_8x16_internal_10bpc).fast_end
.pass2:
call m(iadst_8x16_internal_10bpc).pass2_main
movu m7, [permB+2]
vbroadcasti32x8 m12, [pw_m2048_2048+16]
psrlq m4, m7, 8
vpermi2q m7, m3, m0 ; 3 2 1 0
psrlq m5, m4, 24
vpermi2q m4, m3, m0 ; 15 14 13 12
psrlq m6, m5, 8
vpermq m5, m5, m2 ; 11 10 9 8
vpermq m6, m6, m1 ; 7 6 5 4
jmp m(iadst_8x16_internal_10bpc).pass2_end
INV_TXFM_8X16_FN identity, dct
INV_TXFM_8X16_FN identity, adst
INV_TXFM_8X16_FN identity, flipadst
INV_TXFM_8X16_FN identity, identity
cglobal iidentity_8x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call m(idct_8x16_internal_10bpc).load2
jmp m(idct_8x16_internal_10bpc).pass1_end
.pass2:
vpbroadcastd m8, [o(pw_1697x16)]
pmulhrsw m4, m8, m0
pmulhrsw m5, m8, m1
pmulhrsw m6, m8, m2
pmulhrsw m7, m8, m3
REPX {paddsw x, x}, m0, m1, m2, m3
paddsw m0, m4
paddsw m1, m5
paddsw m2, m6
paddsw m3, m7
vpbroadcastd m7, [o(pw_2048)]
punpckhwd m4, m0, m1
punpcklwd m0, m1
punpckhwd m1, m2, m3
punpcklwd m2, m3
vpbroadcastd m6, [o(pixel_10bpc_max)]
punpckhdq m3, m0, m2
punpckldq m0, m2
punpckldq m2, m4, m1
punpckhdq m4, m1
pxor m5, m5
punpckhqdq m1, m0, m2 ; 1 5 9 13
punpcklqdq m0, m2 ; 0 4 8 12
punpcklqdq m2, m3, m4 ; 2 6 10 14
punpckhqdq m3, m4 ; 3 7 11 15
lea r6, [strideq*3]
pmulhrsw m0, m7
call .write_8x4_start
pmulhrsw m0, m7, m1
call .write_8x4
pmulhrsw m0, m7, m2
call .write_8x4
pmulhrsw m0, m7, m3
.write_8x4:
add dstq, strideq
add cq, 64*2
.write_8x4_start:
mova xm4, [dstq+strideq*0]
vinserti32x4 ym4, [dstq+strideq*4], 1
vinserti32x4 m4, [dstq+strideq*8], 2
vinserti32x4 m4, [dstq+r6*4 ], 3
mova [cq+64*0], m5
mova [cq+64*1], m5
paddw m4, m0
pmaxsw m4, m5
pminsw m4, m6
mova [dstq+strideq*0], xm4
vextracti32x4 [dstq+strideq*4], ym4, 1
vextracti32x4 [dstq+strideq*8], m4, 2
vextracti32x4 [dstq+r6*4 ], m4, 3
ret
%macro INV_TXFM_16X8_FN 2-3 0 ; type1, type2, eob_offset
INV_TXFM_FN %1, %2, %3, 16x8
%ifidn %1_%2, dct_dct
imul r6d, [cq], 181
mov [cq], eobd ; 0
or r3d, 8
.dconly:
add r6d, 128
sar r6d, 8
imul r6d, 181
add r6d, 384
sar r6d, 9
.dconly2:
vpbroadcastd m2, [o(dconly_10bpc)]
imul r6d, 181
add r6d, 2176
sar r6d, 12
vpbroadcastw m1, r6d
paddsw m1, m2
.dconly_loop:
mova ym0, [dstq+strideq*0]
vinserti32x8 m0, [dstq+strideq*1], 1
paddsw m0, m1
psubusw m0, m2
mova [dstq+strideq*0], ym0
vextracti32x8 [dstq+strideq*1], m0, 1
lea dstq, [dstq+strideq*2]
sub r3d, 2
jg .dconly_loop
RET
%endif
%endmacro
INV_TXFM_16X8_FN dct, dct
INV_TXFM_16X8_FN dct, identity, -21
INV_TXFM_16X8_FN dct, flipadst
INV_TXFM_16X8_FN dct, adst
cglobal idct_16x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
pmulld m4, m12, [cq+64*0] ; 0 1
pmulld m9, m12, [cq+64*1] ; 2 3
pmulld m8, m12, [cq+64*2] ; 4 5
pmulld m7, m12, [cq+64*3] ; 6 7
vpbroadcastd m13, [o(pd_2048)]
pxor m2, m2
mova m15, [o(permB)]
REPX {mova [cq+64*x], m2}, 0, 1, 2, 3
psrlq m0, m15, 32
REPX {paddd x, m13}, m4, m9, m8, m7
vpbroadcastd m14, [o(clip_18b_min)]
REPX {psrad x, 12 }, m4, m8, m9, m7
mova m1, m0
vpermi2q m0, m4, m8 ; 0 4
cmp eobd, 43
jl .fast
pmulld m5, m12, [cq+64*4] ; 8 9
pmulld m10, m12, [cq+64*5] ; 10 11
pmulld m11, m12, [cq+64*6] ; 12 13
pmulld m6, m12, [cq+64*7] ; 14 15
REPX {mova [cq+64*x], m2}, 4, 5, 6, 7
REPX {paddd x, m13}, m5, m10, m11, m6
REPX {psrad x, 12 }, m10, m5, m11, m6
mova m2, m1
vpermi2q m1, m9, m10 ; 2 10
mova m3, m2
vpermi2q m2, m5, m11 ; 8 12
vpermi2q m3, m6, m7 ; 14 6
vpermt2q m4, m15, m11 ; 1 13
vpermt2q m6, m15, m9 ; 15 3
vpermt2q m5, m15, m8 ; 9 5
vpermt2q m7, m15, m10 ; 7 11
vpbroadcastd m15, [o(clip_18b_max)]
call m(idct_8x8_internal_10bpc).main
call .main
jmp .pass1_end
.fast:
vpermi2q m1, m9, m7 ; 2 6
vpermt2q m4, m15, m9 ; 1 3
vpermt2q m7, m15, m8 ; 7 5
vpbroadcastd m15, [o(clip_18b_max)]
call m(idct_8x8_internal_10bpc).main_fast
call .main_fast
.pass1_end:
call m(idct_8x16_internal_10bpc).main_end
mova m8, [o(permA)]
psrlq m9, m8, 8
.pass1_end2:
mova m10, m9
mova m11, m8
call .transpose_16x8
jmp tx2q
.pass2:
lea r5, [o_base_8bpc]
call m(idct_16x8_internal_8bpc).main
movshdup m4, [permC]
vpbroadcastd m11, [pw_2048]
psrlq m5, m4, 8
.end:
vpbroadcastd m13, [pixel_10bpc_max]
pxor m12, m12
vpermq m8, m4, m0
vpermq m9, m5, m1
lea r6, [strideq*3]
call .write_16x4
vpermq m8, m4, m2
vpermq m9, m5, m3
.write_16x4:
pmulhrsw m8, m11
pmulhrsw m9, m11
.write_16x4_noround:
mova ym10, [dstq+strideq*0]
vinserti32x8 m10, [dstq+strideq*1], 1
paddw m8, m10
mova ym10, [dstq+strideq*2]
vinserti32x8 m10, [dstq+r6 ], 1
paddw m9, m10
pmaxsw m8, m12
pmaxsw m9, m12
pminsw m8, m13
pminsw m9, m13
mova [dstq+strideq*0], ym8
vextracti32x8 [dstq+strideq*1], m8, 1
mova [dstq+strideq*2], ym9
vextracti32x8 [dstq+r6 ], m9, 1
lea dstq, [dstq+strideq*4]
ret
ALIGN function_align
.main_fast: ; bottom half is zero
vbroadcasti32x4 m6, [o(pd_4076_3920)]
vbroadcasti32x4 m3, [o(pd_401_m1189)]
vbroadcasti32x4 m5, [o(pd_m2598_1931)]
vbroadcasti32x4 m9, [o(pd_3166_3612)]
pmulld m6, m4 ; t15a t12a
pmulld m4, m3 ; t8a t11a
pmulld m5, m7 ; t9a t10a
pmulld m7, m9 ; t14a t13a
jmp .main2
.main:
ITX_MULSUB_2D 4, 6, 3, 9, 10, _, 401_3920, 4076_1189
ITX_MULSUB_2D 5, 7, 3, 9, 10, _, 3166_1931, 2598_3612
.main2:
REPX {paddd x, m13}, m4, m6, m5, m7
REPX {psrad x, 12 }, m4, m5, m6, m7
paddd m9, m4, m5 ; t8 t11
psubd m4, m5 ; t9 t10
psubd m5, m6, m7 ; t14 t13
paddd m6, m7 ; t15 t12
REPX {pmaxsd x, m14}, m5, m4, m9, m6
REPX {pminsd x, m15}, m5, m4, m9, m6
.main3:
psubd m3, m0, m1 ; dct8 out7 out6
paddd m0, m1 ; dct8 out0 out1
vbroadcasti32x4 m7, [o(pd_3784_m3784)]
pmulld m7, m5
vpmulld m5, [o(pd_1567)] {1to16}
paddd m1, m2, m8 ; dct8 out3 out2
psubd m2, m8 ; dct8 out4 out5
vbroadcasti32x4 m8, [o(pd_1567_m1567)]
pmulld m8, m4
vpmulld m4, [o(pd_3784)] {1to16}
REPX {pmaxsd x, m14}, m0, m1
REPX {pminsd x, m15}, m0, m1
paddd m7, m13
paddd m5, m13
paddd m7, m8
psubd m5, m4
psrad m7, 12 ; t14a t10a
psrad m5, 12 ; t9a t13a
punpckhqdq m4, m9, m7
punpcklqdq m8, m9, m5
punpckhqdq m5, m6, m5
punpcklqdq m6, m7
psubd m7, m8, m4 ; t11a t10
paddd m8, m4 ; t8a t9
psubd m4, m6, m5 ; t12a t13
paddd m6, m5 ; t15a t14
REPX {pmaxsd x, m14}, m4, m7
REPX {pminsd x, m15}, m4, m7
pmulld m4, m12
pmulld m7, m12
REPX {pmaxsd x, m14}, m2, m3, m6, m8
REPX {pminsd x, m15}, m2, m3, m6, m8
paddd m4, m13
paddd m5, m4, m7
psubd m4, m7
psrad m4, 12 ; t11 t10a
psrad m5, 12 ; t12 t13a
ret
ALIGN function_align
.transpose_16x8:
packssdw m0, m4
packssdw m1, m5
packssdw m2, m6
packssdw m3, m7
vpermi2d m8, m0, m2
vpermt2d m0, m9, m2
vpermi2d m10, m1, m3
vpermi2d m11, m1, m3
punpckhwd m3, m8, m0
punpcklwd m1, m8, m0
punpckhwd m4, m10, m11
punpcklwd m2, m10, m11
punpckldq m0, m1, m2
punpckhdq m1, m2
punpckldq m2, m3, m4
punpckhdq m3, m4
ret
INV_TXFM_16X8_FN adst, dct
INV_TXFM_16X8_FN adst, identity, -21
INV_TXFM_16X8_FN adst, flipadst
INV_TXFM_16X8_FN adst, adst
cglobal iadst_16x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
call .main_pass1
vpbroadcastd m9, [o(pd_1)]
paddd m0, m9
psubd m1, m9, m1
paddd m2, m9
psubd m3, m9, m3
paddd m4, m9, m5
psubd m5, m9, m6
paddd m6, m9, m7
psubd m7, m9, m8
.pass1_end:
mova m9, [o(permA)]
psrlq m8, m9, 8
REPX {psrad x, 1}, m0, m4, m1, m5, m2, m6, m3, m7
jmp m(idct_16x8_internal_10bpc).pass1_end2
.pass2:
call .main_pass2
vpermq m8, m11, m0
vpermq m9, m11, m1
call m(idct_16x8_internal_10bpc).write_16x4_noround
vpermq m8, m11, m2
vpermq m9, m11, m3
jmp m(idct_16x8_internal_10bpc).write_16x4_noround
ALIGN function_align
.main_pass1:
vpbroadcastd m12, [o(pd_2896)]
pmulld m2, m12, [cq+64*0]
pmulld m7, m12, [cq+64*1]
pmulld m1, m12, [cq+64*2]
pmulld m5, m12, [cq+64*3]
vpbroadcastd m13, [o(pd_2048)]
pxor m4, m4
mova m10, [o(permB)]
REPX {mova [cq+64*x], m4}, 0, 1, 2, 3
REPX {paddd x, m13}, m2, m7, m1, m5
psrlq m6, m10, 32
REPX {psrad x, 12 }, m2, m7, m1, m5
mova m0, m6
vpermi2q m0, m2, m7 ; 0 2
vpermt2q m7, m10, m2 ; 3 1
mova m2, m6
vpermi2q m2, m1, m5 ; 4 6
vpermt2q m5, m10, m1 ; 7 5
cmp eobd, 43
jl .main_fast
pmulld m8, m12, [cq+64*4]
pmulld m3, m12, [cq+64*5]
pmulld m9, m12, [cq+64*6]
pmulld m1, m12, [cq+64*7]
REPX {mova [cq+64*x], m4}, 4, 5, 6, 7
REPX {paddd x, m13}, m8, m3, m9, m1
REPX {psrad x, 12 }, m8, m3, m9, m1
mova m4, m6
vpermi2q m4, m8, m3 ; 8 10
vpermt2q m3, m10, m8 ; 11 9
vpermi2q m6, m9, m1 ; 12 14
vpermt2q m1, m10, m9 ; 15 13
.main:
ITX_MULSUB_2D 1, 0, 8, 9, 10, _, 201_995, 4091_3973, 1
ITX_MULSUB_2D 3, 2, 8, 9, 10, _, 1751_2440, 3703_3290, 1
ITX_MULSUB_2D 5, 4, 8, 9, 10, _, 3035_3513, 2751_2106
ITX_MULSUB_2D 7, 6, 8, 9, 10, _, 3857_4052, 1380_601
jmp .main2
.main_fast:
vbroadcasti32x4 m1, [o(pd_4091_3973)]
vbroadcasti32x4 m8, [o(pd_201_995)]
vbroadcasti32x4 m3, [o(pd_3703_3290)]
vbroadcasti32x4 m9, [o(pd_1751_2440)]
vbroadcasti32x4 m4, [o(pd_2751_2106)]
vbroadcasti32x4 m10, [o(pd_3035_3513)]
vbroadcasti32x4 m6, [o(pd_1380_601)]
vbroadcasti32x4 m11, [o(pd_3857_4052)]
pmulld m1, m0
pmulld m0, m8
pmulld m3, m2
pmulld m2, m9
pmulld m4, m5
pmulld m5, m10
pmulld m6, m7
pmulld m7, m11
.main2:
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
REPX {psubd x, m13, x}, m1, m3
REPX {paddd x, m13 }, m0, m2, m4, m5, m6, m7
REPX {psrad x, 12 }, m0, m4, m1, m5, m2, m6, m3, m7
psubd m8, m0, m4 ; t8a t10a
paddd m0, m4 ; t0a t2a
psubd m4, m1, m5 ; t9a t11a
paddd m1, m5 ; t1a t3a
psubd m5, m2, m6 ; t12a t14a
paddd m2, m6 ; t4a t6a
psubd m6, m3, m7 ; t13a t15a
paddd m3, m7 ; t5a t7a
REPX {pmaxsd x, m14}, m8, m4, m5, m6
REPX {pminsd x, m15}, m8, m4, m5, m6
vbroadcasti32x4 m11, [o(pd_4017_2276)]
vbroadcasti32x4 m10, [o(pd_799_3406)]
ITX_MULSUB_2D 8, 4, 7, 9, _, 13, 10, 11
ITX_MULSUB_2D 6, 5, 7, 9, _, 13, 11, 10
REPX {pmaxsd x, m14}, m0, m2, m1, m3
REPX {pminsd x, m15}, m0, m2, m1, m3
psubd m7, m0, m2 ; t4 t6
paddd m0, m2 ; t0 t2
psubd m2, m1, m3 ; t5 t7
paddd m1, m3 ; t1 t3
psubd m3, m4, m6 ; t12a t14a
paddd m4, m6 ; t8a t10a
psubd m6, m8, m5 ; t13a t15a
paddd m8, m5 ; t9a t11a
REPX {pmaxsd x, m14}, m7, m3, m2, m6
REPX {pminsd x, m15}, m7, m3, m2, m6
punpcklqdq m5, m3, m7 ; t12a t4
punpckhqdq m3, m7 ; t14a t6
punpckhqdq m7, m6, m2 ; t15a t7
punpcklqdq m6, m2 ; t13a t5
vpbroadcastd m11, [o(pd_1567)]
vpbroadcastd m10, [o(pd_3784)]
ITX_MULSUB_2D 7, 3, 2, 9, 10, 13, 10, 11
ITX_MULSUB_2D 5, 6, 2, 9, 10, 13, 11, 10
REPX {pmaxsd x, m14}, m0, m4, m1, m8
REPX {pminsd x, m15}, m0, m4, m1, m8
punpckhqdq m2, m4, m0 ; t10a t2
punpcklqdq m4, m0 ; t8a t0
punpckhqdq m0, m8, m1 ; t11a t3
punpcklqdq m8, m1 ; t9a t1
paddd m1, m6, m7 ; out2 -out3
psubd m6, m7 ; t14a t6
paddd m7, m5, m3 ; -out13 out12
psubd m5, m3 ; t15a t7
psubd m3, m8, m0 ; t11 t3a
paddd m8, m0 ; out14 -out15
paddd m0, m4, m2 ; -out1 out0
psubd m4, m2 ; t10 t2a
REPX {pmaxsd x, m14}, m6, m5, m3, m4
mov r6d, 0x3333
REPX {pminsd x, m15}, m6, m5, m3, m4
kmovw k1, r6d
REPX {pmulld x, m12}, m6, m5, m3, m4
pxor m9, m9
REPX {vpsubd x{k1}, m9, x}, m0, m1, m7, m8
paddd m6, m13
paddd m4, m13
paddd m2, m6, m5 ; -out5 out4
psubd m6, m5 ; out10 -out11
psubd m5, m4, m3 ; -out9 out8
paddd m3, m4 ; out6 -out7
REPX {psrad x, 12}, m2, m3, m5, m6
REPX {vpsubd x{k1}, m9, x}, m2, m3, m5, m6
ret
ALIGN function_align
.main_pass2:
lea r5, [o_base_8bpc]
pshufd m4, m0, q1032
pshufd m5, m1, q1032
call m(iadst_16x8_internal_8bpc).main_pass2
movshdup m11, [permC]
pmulhrsw m0, m6
pmulhrsw m1, m6
vpbroadcastd m13, [pixel_10bpc_max]
pxor m12, m12
lea r6, [strideq*3]
ret
INV_TXFM_16X8_FN flipadst, dct
INV_TXFM_16X8_FN flipadst, identity, -21
INV_TXFM_16X8_FN flipadst, adst
INV_TXFM_16X8_FN flipadst, flipadst
cglobal iflipadst_16x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call m(iadst_16x8_internal_10bpc).main_pass1
vpbroadcastd m9, [o(pd_1)]
psubd m4, m9, m3
paddd m3, m9, m5
paddd m5, m9, m2
psubd m2, m9, m6
psubd m6, m9, m1
paddd m1, m9, m7
paddd m7, m9, m0
psubd m0, m9, m8
jmp m(iadst_16x8_internal_10bpc).pass1_end
.pass2:
call m(iadst_16x8_internal_10bpc).main_pass2
psrlq m11, 8
vpermq m8, m11, m3
vpermq m9, m11, m2
call m(idct_16x8_internal_10bpc).write_16x4_noround
vpermq m8, m11, m1
vpermq m9, m11, m0
jmp m(idct_16x8_internal_10bpc).write_16x4_noround
INV_TXFM_16X8_FN identity, dct
INV_TXFM_16X8_FN identity, adst
INV_TXFM_16X8_FN identity, flipadst
INV_TXFM_16X8_FN identity, identity
cglobal iidentity_16x8_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
call m(idct_8x16_internal_10bpc).load2
vpbroadcastd m8, [o(pd_5793)]
vpbroadcastd m13, [o(pd_3072)]
pxor m10, m10
REPX {pmulld x, m8}, m0, m1, m2, m3, m4, m5, m6, m7
REPX {mova [cq+64*x], m10}, 0, 1, 2, 3, 4, 5, 6, 7
call m(idct_8x16_internal_10bpc).round
psrlq m8, [o(permA)], 16
psrlq m9, m8, 8
mova m10, m8
mova m11, m9
call m(idct_16x8_internal_10bpc).transpose_16x8
jmp tx2q
.pass2:
movshdup m4, [o(permC)]
vpbroadcastd m11, [o(pw_4096)]
mova m5, m4
jmp m(idct_16x8_internal_10bpc).end
%macro INV_TXFM_16X16_FN 2-3 0 ; type1, type2, eob_offset
INV_TXFM_FN %1, %2, %3, 16x16
%ifidn %1_%2, dct_dct
imul r6d, [cq], 181
mov [cq], eobd ; 0
or r3d, 16
add r6d, 640
sar r6d, 10
jmp m(inv_txfm_add_dct_dct_16x8_10bpc).dconly2
%endif
%endmacro
INV_TXFM_16X16_FN dct, dct
INV_TXFM_16X16_FN dct, identity, 28
INV_TXFM_16X16_FN dct, flipadst
INV_TXFM_16X16_FN dct, adst
cglobal idct_16x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 36
jl .fast
mova m0, [cq+64* 0]
mova m1, [cq+64* 2]
mova m2, [cq+64* 4]
mova m3, [cq+64* 6]
mova m4, [cq+64* 8]
mova m5, [cq+64*10]
mova m6, [cq+64*12]
mova m7, [cq+64*14]
%if WIN64
movaps [cq+16*0], xmm6
movaps [cq+16*1], xmm7
%endif
call m(idct_8x16_internal_10bpc).main
mova m16, [cq+64* 1]
mova m17, [cq+64* 3]
mova m18, [cq+64* 5]
mova m19, [cq+64* 7]
mova m20, [cq+64* 9]
mova m21, [cq+64*11]
mova m22, [cq+64*13]
mova m23, [cq+64*15]
call .main
call .main_end
.pass1_end:
%if WIN64
movaps xmm6, [cq+16*0]
movaps xmm7, [cq+16*1]
%endif
vzeroupper
.pass1_end2:
call .main_end3
.pass1_end3:
mov r6d, 64*12
pxor m8, m8
.zero_loop:
mova [cq+r6+64*3], m8
mova [cq+r6+64*2], m8
mova [cq+r6+64*1], m8
mova [cq+r6+64*0], m8
sub r6d, 64*4
jge .zero_loop
jmp tx2q
.pass2:
lea r5, [o_base_8bpc]
call m(idct_16x16_internal_8bpc).main
movshdup m12, [permC]
vpbroadcastd m11, [pw_2048]
psrlq m13, m12, 8
vpermq m8, m12, m0
vpermq m0, m13, m7
vpermq m7, m13, m1
vpermq m1, m12, m6
vpermq m6, m12, m2
vpermq m2, m13, m5
vpermq m5, m13, m3
vpermq m3, m12, m4
.pass2_end:
lea r6, [strideq*3]
vpbroadcastd m13, [pixel_10bpc_max]
pxor m12, m12
pmulhrsw m8, m11, m8
pmulhrsw m9, m11, m7
call m(idct_16x8_internal_10bpc).write_16x4_noround
pmulhrsw m8, m11, m6
pmulhrsw m9, m11, m5
call m(idct_16x8_internal_10bpc).write_16x4_noround
pmulhrsw m8, m11, m3
pmulhrsw m9, m11, m2
call m(idct_16x8_internal_10bpc).write_16x4_noround
pmulhrsw m8, m11, m1
pmulhrsw m9, m11, m0
jmp m(idct_16x8_internal_10bpc).write_16x4_noround
.fast:
mova ym0, [cq+64*0]
mova ym2, [cq+64*4]
movshdup m8, [o(permB)]
mova ym1, [cq+64*2]
mova ym3, [cq+64*6]
mova ym4, [cq+64*1]
mova ym5, [cq+64*3]
mova ym6, [cq+64*5]
mova ym7, [cq+64*7]
vpermt2q m0, m8, m2 ; 0 4
vpermt2q m1, m8, m3 ; 2 6
vpermt2q m4, m8, m5 ; 1 3
vpermt2q m7, m8, m6 ; 7 5
call m(idct_8x8_internal_10bpc).main_fast
call m(idct_16x8_internal_10bpc).main_fast
vpbroadcastd m11, [o(pd_2)]
call m(idct_8x16_internal_10bpc).main_end2
mova m8, [o(permA)]
psrlq m9, m8, 8
jmp m(iadst_16x16_internal_10bpc).pass1_fast_end2
ALIGN function_align
.main_fast2_rect2:
REPX {paddd x, m13}, m16, m17
REPX {psrad x, 12 }, m16, m17
.main_fast2:
pmulld m22, m16, [o(pd_4076)] {1to16} ; t15a
pmulld m9, m16, [o(pd_401)] {1to16} ; t8a
pmulld m18, m17, [o(pd_1189)] {1to16} ; t11a
pmulld m17, [o(pd_3920)] {1to16} ; t12a
psubd m18, m13, m18
REPX {paddd x, m13}, m22, m9, m17
REPX {psrad x, 12 }, m18, m22, m9, m17
mova m20, m9
mova m16, m18
mova m23, m22
mova m19, m17
jmp .main3
.main_fast_rect2:
REPX {paddd x, m13}, m16, m17, m18, m19
REPX {psrad x, 12 }, m16, m17, m18, m19
.main_fast:
pmulld m23, m16, [o(pd_4076)] {1to16} ; t15a
pmulld m16, [o(pd_401)] {1to16} ; t8a
pmulld m20, m19, [o(pd_2598)] {1to16} ; t9a
pmulld m19, [o(pd_3166)] {1to16} ; t14a
pmulld m22, m17, [o(pd_1189)] {1to16} ; t11a
pmulld m17, [o(pd_3920)] {1to16} ; t12a
pmulld m21, m18, [o(pd_3612)] {1to16} ; t13a
pmulld m18, [o(pd_1931)] {1to16} ; t10a
psubd m20, m13, m20
psubd m22, m13, m22
call .round2
jmp .main2
.main_rect2:
call .round
.main:
ITX_MULSUB_2D 16, 23, 7, 9, 10, _, 401, 4076 ; t8a, t15a
ITX_MULSUB_2D 20, 19, 7, 9, 10, _, 3166, 2598 ; t9a, t14a
ITX_MULSUB_2D 22, 17, 7, 9, 10, _, 3920, 1189 ; t11a, t12a
ITX_MULSUB_2D 18, 21, 7, 9, 10, _, 1931, 3612 ; t10a, t13a
call .round
.main2:
paddd m9, m20, m16 ; t8
psubd m20, m16, m20 ; t9
psubd m16, m22, m18 ; t10
paddd m18, m22 ; t11
paddd m22, m23, m19 ; t15
psubd m23, m19 ; t14
psubd m19, m17, m21 ; t13
paddd m17, m21 ; t12
REPX {pmaxsd x, m14}, m20, m23, m16, m19
REPX {pminsd x, m15}, m20, m23, m16, m19
REPX {pmaxsd x, m14}, m9, m18, m22, m17
REPX {pminsd x, m15}, m9, m18, m22, m17
.main3:
vpbroadcastd m11, [o(pd_3784)]
vpbroadcastd m10, [o(pd_1567)]
ITX_MULSUB_2D 23, 20, 21, 7, _, 13, 10, 11
ITX_MULSUB_2D 19, 16, 21, 7, _, 13, 10, 11, 2
paddd m21, m20, m19 ; t14
psubd m20, m19 ; t13
psubd m19, m9, m18 ; t11a
paddd m9, m18 ; t8a
psubd m18, m23, m16 ; t10
paddd m16, m23 ; t9
psubd m23, m22, m17 ; t12a
paddd m22, m17 ; t15a
REPX {pmaxsd x, m14}, m20, m23, m18, m19
REPX {pminsd x, m15}, m20, m23, m18, m19
REPX {pmulld x, m12}, m20, m23, m18, m19
psubd m7, m0, m6 ; dct8 out7
paddd m0, m6 ; dct8 out0
psubd m6, m1, m5 ; dct8 out6
paddd m1, m5 ; dct8 out1
REPX {pmaxsd x, m14}, m7, m0, m6, m1
psubd m5, m2, m4 ; dct8 out5
paddd m2, m4 ; dct8 out2
REPX {pminsd x, m15}, m7, m0, m6, m1
psubd m4, m3, m8 ; dct8 out4
paddd m3, m8 ; dct8 out3
REPX {pmaxsd x, m14}, m5, m2, m4, m3
paddd m20, m13
paddd m23, m13
REPX {pminsd x, m15}, m5, m2, m4, m3
psubd m17, m20, m18 ; t10a
paddd m20, m18 ; t13a
REPX {pmaxsd x, m14}, m22, m21, m16, m9
psubd m18, m23, m19 ; t11
paddd m19, m23 ; t12
REPX {pminsd x, m15}, m22, m21, m16, m9
REPX {psrad x, 12 }, m20, m19, m18, m17
ret
.main_end:
vpbroadcastd m11, [o(pd_2)]
.main_end2:
REPX {paddd x, m11}, m0, m1, m2, m3, m4, m5, m6, m7
psubd m23, m0, m22 ; out15
paddd m0, m22 ; out0
psubd m22, m1, m21 ; out14
paddd m1, m21 ; out1
psubd m21, m2, m20 ; out13
paddd m2, m20 ; out2
psubd m20, m3, m19 ; out12
paddd m3, m19 ; out3
psubd m19, m4, m18 ; out11
paddd m4, m18 ; out4
psubd m18, m5, m17 ; out10
paddd m5, m17 ; out5
psubd m17, m6, m16 ; out9
paddd m6, m16 ; out6
psubd m16, m7, m9 ; out8
paddd m7, m9 ; out7
REPX {vpsravd x, m11}, m0, m16, m1, m17, m2, m18, m3, m19, \
m4, m20, m5, m21, m6, m22, m7, m23
packssdw m0, m16
packssdw m1, m17
packssdw m2, m18
packssdw m3, m19
packssdw m4, m20
packssdw m5, m21
packssdw m6, m22
packssdw m7, m23
ret
.main_end3:
punpckhwd m8, m0, m1
punpcklwd m0, m1
punpckhwd m1, m2, m3
punpcklwd m2, m3
punpckhwd m3, m4, m5
punpcklwd m4, m5
punpcklwd m5, m6, m7
punpckhwd m6, m7
punpckhdq m7, m0, m2
punpckldq m0, m2
punpckhdq m2, m8, m1
punpckldq m8, m1
punpckhdq m1, m4, m5
punpckldq m4, m5
punpckhdq m5, m3, m6
punpckldq m3, m6
vshufi32x4 m6, m0, m4, q3232
vinserti32x8 m0, ym4, 1
vinserti32x8 m4, m8, ym3, 1
vshufi32x4 m8, m3, q3232
vinserti32x8 m3, m7, ym1, 1
vshufi32x4 m7, m1, q3232
vshufi32x4 m1, m2, m5, q3232
vinserti32x8 m2, ym5, 1
vshufi32x4 m5, m7, m1, q2020 ; 10 11
vshufi32x4 m7, m1, q3131 ; 14 15
vshufi32x4 m1, m3, m2, q2020 ; 2 3
vshufi32x4 m3, m2, q3131 ; 6 7
vshufi32x4 m2, m0, m4, q3131 ; 4 5
vshufi32x4 m0, m4, q2020 ; 0 1
vshufi32x4 m4, m6, m8, q2020 ; 8 9
vshufi32x4 m6, m8, q3131 ; 12 13
ret
ALIGN function_align
.round:
paddd m20, m13
paddd m22, m13
.round2:
paddd m16, m13
paddd m18, m13
.round3:
REPX {psrad x, 12 }, m16, m18, m20, m22
REPX {paddd x, m13}, m17, m19, m21, m23
REPX {psrad x, 12 }, m17, m19, m21, m23
ret
INV_TXFM_16X16_FN adst, dct
INV_TXFM_16X16_FN adst, flipadst
INV_TXFM_16X16_FN adst, adst
cglobal iadst_16x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
cmp eobd, 36
jl .fast
call .main_pass1
packssdw m0, m16
packssdw m1, m17
packssdw m2, m18
packssdw m3, m19
packssdw m4, m5, m20
packssdw m5, m6, m21
packssdw m6, m7, m22
packssdw m7, m8, m23
jmp m(idct_16x16_internal_10bpc).pass1_end
.fast:
call .main_pass1_fast
vpbroadcastd m9, [o(pd_2)]
paddd m0, m9
psubd m1, m9, m1
paddd m2, m9
psubd m3, m9, m3
paddd m4, m9, m5
psubd m5, m9, m6
paddd m6, m9, m7
psubd m7, m9, m8
.pass1_fast_end:
mova m9, [o(permA)]
psrlq m8, m9, 8
REPX {psrad x, 2}, m0, m1, m2, m3, m4, m5, m6, m7
.pass1_fast_end2:
mova m10, m9
mova m11, m8
call m(idct_16x8_internal_10bpc).transpose_16x8
pxor m4, m4
REPX {mova x, m4}, m5, m6, m7
REPX {mova [cq+64*x], ym4}, 0, 1, 2, 3, 4, 5, 6, 7
jmp tx2q
.pass2:
lea r5, [o_base_8bpc]
call m(iadst_16x16_internal_8bpc).main_pass2b
movshdup m12, [permC]
mova m11, [pw_2048_m2048]
psrlq m13, m12, 8
vpermq m8, m13, m0
vpermq m0, m12, m7
vpermq m7, m13, m1
vpermq m1, m12, m6
vpermq m6, m13, m2
vpermq m2, m12, m5
vpermq m5, m13, m3
vpermq m3, m12, m4
jmp m(idct_16x16_internal_10bpc).pass2_end
ALIGN function_align
.main_pass1:
mova m0, [cq+64* 0]
%if WIN64
movaps [cq+16*0], xmm6
movaps [cq+16*1], xmm7
%endif
mova m23, [cq+64*15]
vpbroadcastd m13, [o(pd_2048)]
ITX_MULSUB_2D 23, 0, 8, 9, 10, 13, 201, 4091 ; t1 t0
mova m7, [cq+64* 7]
mova m16, [cq+64* 8]
ITX_MULSUB_2D 7, 16, 8, 9, 10, 13, 3035, 2751 ; t9 t8
mova m2, [cq+64* 2]
mova m21, [cq+64*13]
ITX_MULSUB_2D 21, 2, 8, 9, 10, 13, 995, 3973 ; t3 t2
mova m5, [cq+64* 5]
mova m18, [cq+64*10]
ITX_MULSUB_2D 5, 18, 8, 9, 10, 13, 3513, 2106 ; t11 t10
mova m4, [cq+64* 4]
mova m19, [cq+64*11]
ITX_MULSUB_2D 19, 4, 8, 9, 10, 13, 1751, 3703 ; t5 t4
mova m3, [cq+64* 3]
mova m20, [cq+64*12]
ITX_MULSUB_2D 3, 20, 8, 9, 10, 13, 3857, 1380 ; t13 t12
mova m6, [cq+64* 6]
mova m17, [cq+64* 9]
ITX_MULSUB_2D 17, 6, 8, 9, 10, 13, 2440, 3290 ; t7 t6
mova m1, [cq+64* 1]
mova m22, [cq+64*14]
ITX_MULSUB_2D 1, 22, 8, 9, 10, 13, 4052, 601 ; t15 t14
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
psubd m9, m23, m7 ; t9a
paddd m23, m7 ; t1a
psubd m7, m2, m18 ; t10a
paddd m18, m2 ; t2a
REPX {pmaxsd x, m14}, m9, m23, m7, m18
psubd m2, m17, m1 ; t15a
paddd m17, m1 ; t7a
REPX {pminsd x, m15}, m9, m23, m7, m18
psubd m1, m21, m5 ; t11a
paddd m21, m5 ; t3a
REPX {pmaxsd x, m14}, m2, m17, m1, m21
psubd m5, m4, m20 ; t12a
paddd m4, m20 ; t4a
REPX {pminsd x, m15}, m2, m17, m1, m21
psubd m20, m19, m3 ; t13a
paddd m19, m3 ; t5a
REPX {pmaxsd x, m14}, m5, m4, m20, m19
psubd m8, m6, m22 ; t14a
paddd m6, m22 ; t6a
REPX {pminsd x, m15}, m5, m4, m20, m19
psubd m22, m0, m16 ; t8a
paddd m16, m0 ; t0a
REPX {pmaxsd x, m14}, m8, m6, m22, m16
vpbroadcastd m11, [o(pd_4017)]
vpbroadcastd m10, [o(pd_799)]
REPX {pminsd x, m15}, m8, m6, m22, m16
ITX_MULSUB_2D 22, 9, 0, 3, _, 13, 10, 11 ; t9 t8
ITX_MULSUB_2D 20, 5, 0, 3, _, 13, 11, 10 ; t12 t13
vpbroadcastd m11, [o(pd_2276)]
vpbroadcastd m10, [o(pd_3406)]
ITX_MULSUB_2D 7, 1, 0, 3, _, 13, 10, 11 ; t11 t10
ITX_MULSUB_2D 2, 8, 0, 3, _, 13, 11, 10 ; t14 t15
paddd m0, m16, m4 ; t0
psubd m16, m4 ; t4
psubd m3, m23, m19 ; t5
paddd m23, m19 ; t1
REPX {pmaxsd x, m14}, m0, m16, m3, m23
psubd m19, m18, m6 ; t6
paddd m18, m6 ; t2
REPX {pminsd x, m15}, m0, m16, m3, m23
psubd m6, m21, m17 ; t7
paddd m21, m17 ; t3
REPX {pmaxsd x, m14}, m19, m18, m6, m21
paddd m17, m9, m20 ; t8a
psubd m9, m20 ; t12a
REPX {pminsd x, m15}, m19, m18, m6, m21
psubd m20, m22, m5 ; t13a
paddd m22, m5 ; t9a
REPX {pmaxsd x, m14}, m17, m9, m20, m22
psubd m5, m1, m2 ; t14a
paddd m1, m2 ; t10a
REPX {pminsd x, m15}, m17, m9, m20, m22
psubd m2, m7, m8 ; t15a
paddd m7, m8 ; t11a
REPX {pmaxsd x, m14}, m5, m1, m2, m7
vpbroadcastd m11, [o(pd_3784)]
vpbroadcastd m10, [o(pd_1567)]
REPX {pminsd x, m15}, m5, m1, m2, m7
ITX_MULSUB_2D 16, 3, 4, 8, _, 13, 10, 11 ; t5a t4a
ITX_MULSUB_2D 6, 19, 4, 8, _, 13, 11, 10 ; t6a t7a
ITX_MULSUB_2D 9, 20, 4, 8, _, 13, 10, 11 ; t13 t12
ITX_MULSUB_2D 2, 5, 4, 8, _, 13, 11, 10 ; t14 t15
psubd m8, m0, m18 ; t2a
paddd m0, m18 ; out0
psubd m18, m23, m21 ; t3a
paddd m23, m21 ; -out15
paddd m21, m9, m5 ; -out13
psubd m9, m5 ; t15a
psubd m5, m3, m6 ; t6
paddd m3, m6 ; -out3
REPX {pmaxsd x, m14}, m8, m18, m9, m5
psubd m6, m20, m2 ; t14a
paddd m2, m20 ; out2
paddd m20, m16, m19 ; out12
psubd m16, m19 ; t7
REPX {pminsd x, m15}, m8, m18, m9, m5
psubd m19, m22, m7 ; t11
paddd m22, m7 ; out14
psubd m7, m17, m1 ; t10
paddd m1, m17 ; -out1
REPX {pmaxsd x, m14}, m6, m16, m19, m7
vpbroadcastd m12, [o(pd_1448)]
vpbroadcastd m4, [o(pd_2)]
vpbroadcastd m10, [o(pd_5120)]
vpbroadcastd m11, [o(pd_5119)]
REPX {pminsd x, m15}, m6, m16, m19, m7
psubd m17, m7, m19 ; -out9
paddd m7, m19 ; out6
psubd m19, m5, m16 ; -out11
paddd m5, m16 ; out4
REPX {pmulld x, m12}, m17, m7, m19, m5
psubd m16, m8, m18 ; out8
paddd m8, m18 ; -out7
psubd m18, m6, m9 ; out10
paddd m6, m9 ; -out5
REPX {pmulld x, m12}, m16, m8, m18, m6
REPX {paddd x, m4 }, m0, m2, m20, m22
REPX {psubd x, m4, x}, m1, m3, m21, m23
REPX {paddd x, m10 }, m7, m5, m16, m18
REPX {psubd x, m11, x}, m17, m19, m8, m6
REPX {psrad x, 2 }, m20, m22, m0, m2, m21, m23, m1, m3
REPX {psrad x, 13}, m17, m19, m5, m7, m16, m18, m6, m8
ret
ALIGN function_align
.main_pass1_fast:
mova ym0, [cq+64*0]
mova ym1, [cq+64*2]
movshdup m8, [o(permB)]
mova ym6, [cq+64*1]
mova ym7, [cq+64*3]
mova ym2, [cq+64*4]
mova ym3, [cq+64*6]
mova ym4, [cq+64*5]
mova ym5, [cq+64*7]
vpermt2q m0, m8, m1 ; 0 2
vpermt2q m7, m8, m6 ; 3 1
vpermt2q m2, m8, m3 ; 4 6
vpermt2q m5, m8, m4 ; 7 5
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m12, [o(pd_2896)]
jmp m(iadst_16x8_internal_10bpc).main_fast
INV_TXFM_16X16_FN flipadst, dct
INV_TXFM_16X16_FN flipadst, adst
INV_TXFM_16X16_FN flipadst, flipadst
cglobal iflipadst_16x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
cmp eobd, 36
jl .fast
call m(iadst_16x16_internal_10bpc).main_pass1
packssdw m4, m19, m3
packssdw m3, m20, m5
packssdw m5, m18, m2
packssdw m2, m21, m6
packssdw m6, m17, m1
packssdw m1, m22, m7
packssdw m7, m16, m0
packssdw m0, m23, m8
jmp m(idct_16x16_internal_10bpc).pass1_end
.fast:
call m(iadst_16x16_internal_10bpc).main_pass1_fast
vpbroadcastd m9, [o(pd_2)]
psubd m4, m9, m3
paddd m3, m9, m5
paddd m5, m9, m2
psubd m2, m9, m6
psubd m6, m9, m1
paddd m1, m9, m7
paddd m7, m9, m0
psubd m0, m9, m8
jmp m(iadst_16x16_internal_10bpc).pass1_fast_end
.pass2:
lea r5, [o_base_8bpc]
call m(iadst_16x16_internal_8bpc).main_pass2b
movshdup m12, [permC]
movu m11, [pw_m2048_2048]
psrlq m13, m12, 8
vpermq m8, m13, m7
vpermq m7, m13, m6
vpermq m6, m13, m5
vpermq m5, m13, m4
vpermq m3, m12, m3
vpermq m2, m12, m2
vpermq m1, m12, m1
vpermq m0, m12, m0
jmp m(idct_16x16_internal_10bpc).pass2_end
INV_TXFM_16X16_FN identity, dct, -92
INV_TXFM_16X16_FN identity, identity
cglobal iidentity_16x16_internal_10bpc, 0, 7, 16, dst, stride, c, eob, tx2
%undef cmp
vpbroadcastd m10, [o(pd_5793)]
vpbroadcastd m11, [o(pd_5120)]
mov r6, cq
cmp eobd, 36
jl .fast
call .pass1_main
packssdw m0, m6, m8
packssdw m1, m7, m9
call .pass1_main
packssdw m2, m6, m8
packssdw m3, m7, m9
call .pass1_main
packssdw m4, m6, m8
packssdw m5, m7, m9
call .pass1_main
packssdw m6, m8
packssdw m7, m9
jmp m(idct_16x16_internal_10bpc).pass1_end2
.fast:
call .pass1_main_fast
packssdw m0, m6, m7
call .pass1_main_fast
packssdw m1, m6, m7
call .pass1_main_fast
packssdw m2, m6, m7
call .pass1_main_fast
packssdw m3, m6, m7
punpckhwd m4, m0, m1
punpcklwd m0, m1
punpckhwd m1, m2, m3
punpcklwd m2, m3
punpckldq m3, m4, m1
punpckhdq m4, m1
punpckhdq m1, m0, m2
punpckldq m0, m2
pxor m7, m7
vshufi32x4 m2, m0, m3, q3131
vshufi32x4 m0, m3, q2020
vshufi32x4 m3, m1, m4, q3131
vshufi32x4 m1, m4, q2020
REPX {mova x, m7}, m4, m5, m6
jmp m(idct_16x16_internal_10bpc).pass1_end3
.pass2:
movshdup m14, [o(permC)]
vpbroadcastd m15, [o(pw_1697x16)]
lea r6, [strideq*3]
vpbroadcastd m11, [o(pw_2048)]
pxor m12, m12
vpbroadcastd m13, [pixel_10bpc_max]
vpermq m8, m14, m0
vpermq m9, m14, m1
call .pass2_main
vpermq m8, m14, m2
vpermq m9, m14, m3
call .pass2_main
vpermq m8, m14, m4
vpermq m9, m14, m5
call .pass2_main
vpermq m8, m14, m6
vpermq m9, m14, m7
.pass2_main:
pmulhrsw m0, m15, m8
pmulhrsw m1, m15, m9
paddsw m8, m8
paddsw m9, m9
paddsw m8, m0
paddsw m9, m1
jmp m(idct_16x8_internal_10bpc).write_16x4
ALIGN function_align
.pass1_main:
pmulld m6, m10, [r6+64*0]
pmulld m7, m10, [r6+64*1]
pmulld m8, m10, [r6+64*8]
pmulld m9, m10, [r6+64*9]
add r6, 64*2
REPX {paddd x, m11}, m6, m7, m8, m9
REPX {psrad x, 13 }, m6, m8, m7, m9
ret
ALIGN function_align
.pass1_main_fast:
mova ym6, [r6+64* 0]
vinserti32x8 m6, [r6+64* 4], 1
mova ym7, [r6+64* 8]
vinserti32x8 m7, [r6+64*12], 1
add r6, 64
REPX {pmulld x, m10}, m6, m7
REPX {paddd x, m11}, m6, m7
REPX {psrad x, 13 }, m6, m7
ret
cglobal inv_txfm_add_dct_dct_8x32_10bpc, 4, 7, 22, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
vpbroadcastd m11, [o(pd_2)]
mova m20, [o(idct8x32p)]
pxor m21, m21
cmp eobd, 43
jl .fast
call .pass1_main
punpcklwd m16, m0, m1
punpcklwd m17, m2, m3
punpckhwd m18, m0, m1
punpckhwd m19, m2, m3
cmp eobd, 107
jge .full
punpckldq m0, m16, m17 ; 0 2
punpckhdq m1, m16, m17 ; 4 6
punpckldq m2, m18, m19 ; 8 10
punpckhdq m3, m18, m19 ; 12 14
lea r5, [o_base_8bpc]
vextracti32x8 ym14, m0, 1
vextracti32x8 ym15, m1, 1
vextracti32x8 ym16, m2, 1
vextracti32x8 ym17, m3, 1
call m(idct_8x16_internal_8bpc).main_fast
call m(inv_txfm_add_dct_dct_8x32_8bpc).main_fast
jmp .end
.full:
add cq, 64
call .pass1_main
punpcklwd m5, m0, m1
punpcklwd m6, m2, m3
punpckhwd m7, m0, m1
punpckhwd m8, m2, m3
punpckldq m0, m16, m17 ; 0 2
punpckhdq m1, m16, m17 ; 4 6
punpckldq m2, m18, m19 ; 8 10
punpckhdq m3, m18, m19 ; 12 14
punpckldq m4, m5, m6 ; 16 18
punpckhdq m5, m6 ; 20 22
punpckldq m6, m7, m8 ; 24 26
punpckhdq m7, m8 ; 28 30
lea r5, [o_base_8bpc]
vextracti32x8 ym14, m0, 1
vextracti32x8 ym15, m1, 1
vextracti32x8 ym16, m2, 1
vextracti32x8 ym17, m3, 1
vextracti32x8 ym18, m4, 1
vextracti32x8 ym19, m5, 1
vextracti32x8 ym20, m6, 1
vextracti32x8 ym21, m7, 1
call m(idct_8x16_internal_8bpc).main
REPX {pshufd x, x, q1032}, ym18, ym19, ym20, ym21
call m(inv_txfm_add_dct_dct_8x32_8bpc).main
jmp .end
.fast:
movshdup m8, [o(permB)]
mova ym1, [cq+128*1]
mova ym5, [cq+128*5]
mova ym7, [cq+128*3]
mova ym3, [cq+128*7]
mova ym0, [cq+128*0]
mova ym4, [cq+128*2]
mova ym2, [cq+128*4]
mova ym6, [cq+128*6]
vpermt2q m1, m8, m5 ; 1 5
vpermt2q m3, m8, m7 ; 7 3
vpermt2q m0, m8, m4 ; 0 2
vpermt2q m2, m8, m6 ; 4 6
mova [cq+128*0], ym21
REPX {vmovdqa32 [cq+128*x], ym21}, 1, 2, 3, 4, 5, 6, 7
call m(idct_8x8_internal_10bpc).main
call m(idct_8x8_internal_10bpc).main_end
packssdw m0, m2
packssdw m1, m3
vpermb m0, m20, m0
vprold m20, 16
vpermb m2, m20, m1
punpckhdq m1, m0, m2
punpckldq m0, m2
lea r5, [o_base_8bpc]
vextracti32x8 ym14, m0, 1
vextracti32x8 ym15, m1, 1
call m(idct_8x16_internal_8bpc).main_fast2
call m(inv_txfm_add_dct_dct_8x32_8bpc).main_fast2
.end:
call m(inv_txfm_add_dct_dct_8x32_8bpc).main_end ; performs vzeroupper
lea r3, [strideq*2]
vpbroadcastd m12, [pixel_10bpc_max]
lea r6, [strideq*3]
pxor m11, m11
lea r3, [dstq+r3*8]
pmulhrsw m0, m10
pmulhrsw m1, m10
call .write_8x4x2
pmulhrsw m0, m10, m2
pmulhrsw m1, m10, m3
call .write_8x4x2
pmulhrsw m0, m10, m4
pmulhrsw m1, m10, m5
call .write_8x4x2
pmulhrsw m0, m10, m6
pmulhrsw m1, m10, m7
.write_8x4x2:
mova xm8, [dstq+strideq*0]
vinserti32x4 ym8, [dstq+strideq*1], 1
vinserti32x4 m8, [dstq+strideq*2], 2
vinserti32x4 m8, [dstq+r6 ], 3
mova xm9, [r3 +r6 ]
vinserti32x4 ym9, [r3 +strideq*2], 1
vinserti32x4 m9, [r3 +strideq*1], 2
vinserti32x4 m9, [r3 +strideq*0], 3
paddw m8, m0
paddw m9, m1
pmaxsw m8, m11
pmaxsw m9, m11
pminsw m8, m12
pminsw m9, m12
mova [dstq+strideq*0], xm8
vextracti32x4 [dstq+strideq*1], ym8, 1
vextracti32x4 [dstq+strideq*2], m8, 2
vextracti32x4 [dstq+r6 ], m8, 3
lea dstq, [dstq+strideq*4]
vextracti32x4 [r3 +strideq*0], m9, 3
vextracti32x4 [r3 +strideq*1], m9, 2
vextracti32x4 [r3 +strideq*2], ym9, 1
mova [r3 +r6 ], xm9
lea r3, [r3+strideq*4]
ret
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 32
add r6d, 640
sar r6d, 10
jmp m(inv_txfm_add_dct_dct_8x8_10bpc).dconly2
ALIGN function_align
.pass1_main:
mova m0, [cq+128*0]
mova m1, [cq+128*1]
mova m2, [cq+128*2]
mova m3, [cq+128*3]
mova m4, [cq+128*4]
mova m5, [cq+128*5]
mova m6, [cq+128*6]
mova m7, [cq+128*7]
REPX {mova [cq+128*x], m21}, 0, 1, 2, 3, 4, 5, 6, 7
call m(idct_8x16_internal_10bpc).main
call m(idct_8x16_internal_10bpc).main_end2
packssdw m0, m4
packssdw m1, m5
packssdw m2, m6
packssdw m3, m7
REPX {vpermb x, m20, x}, m0, m1, m2, m3
ret
cglobal inv_txfm_add_identity_identity_8x32_10bpc, 4, 8, 12, dst, stride, c, eob
vpbroadcastd m9, [pw_5]
lea r4, [strideq*3]
pxor m10, m10
lea r5, [strideq*5]
vpbroadcastd m11, [pixel_10bpc_max]
sub eobd, 107
lea r6, [strideq+r4*2]
.loop:
mova m0, [cq+128*0]
packssdw m0, [cq+128*1]
mova m1, [cq+128*2]
packssdw m1, [cq+128*3]
mova m2, [cq+128*4]
packssdw m2, [cq+128*5]
mova m3, [cq+128*6]
packssdw m3, [cq+128*7]
lea r7, [dstq+strideq*8]
REPX {mova [cq+128*x], m10}, 0, 1, 2, 3
REPX {paddsw x, m9}, m0, m1, m2, m3
REPX {mova [cq+128*x], m10}, 4, 5, 6, 7
REPX {psraw x, 3 }, m0, m1, m2, m3
add cq, 64
mova xm4, [dstq+strideq*0]
mova xm5, [dstq+strideq*1]
mova xm6, [dstq+strideq*2]
mova xm7, [dstq+r4 *1]
punpckhwd m8, m0, m1
vinserti32x4 ym4, [dstq+strideq*4], 1
punpcklwd m0, m1
vinserti32x4 ym5, [dstq+r5 *1], 1
punpckhwd m1, m2, m3
vinserti32x4 ym6, [dstq+r4 *2], 1
punpcklwd m2, m3
vinserti32x4 ym7, [dstq+r6 *1], 1
punpckhwd m3, m0, m8
vinserti32x4 m4, [r7 +strideq*0], 2
punpcklwd m0, m8
vinserti32x4 m5, [r7 +strideq*1], 2
punpckhwd m8, m2, m1
vinserti32x4 m6, [r7 +strideq*2], 2
punpcklwd m2, m1
vinserti32x4 m7, [r7 +r4 *1], 2
punpckhqdq m1, m0, m2
vinserti32x4 m4, [r7 +strideq*4], 3
punpcklqdq m0, m2
vinserti32x4 m5, [r7 +r5 *1], 3
punpcklqdq m2, m3, m8
vinserti32x4 m6, [r7 +r4 *2], 3
punpckhqdq m3, m8
vinserti32x4 m7, [r7 +r6 *1], 3
paddw m0, m4
paddw m1, m5
paddw m2, m6
paddw m3, m7
REPX {pmaxsw x, m10}, m0, m1, m2, m3
REPX {pminsw x, m11}, m0, m1, m2, m3
mova [dstq+strideq*0], xm0
mova [dstq+strideq*1], xm1
mova [dstq+strideq*2], xm2
mova [dstq+r4 *1], xm3
vextracti32x4 [dstq+strideq*4], ym0, 1
vextracti32x4 [dstq+r5 *1], ym1, 1
vextracti32x4 [dstq+r4 *2], ym2, 1
vextracti32x4 [dstq+r6 *1], ym3, 1
lea dstq, [r7+strideq*8]
vextracti32x4 [r7 +strideq*0], m0, 2
vextracti32x4 [r7 +strideq*1], m1, 2
vextracti32x4 [r7 +strideq*2], m2, 2
vextracti32x4 [r7 +r4 *1], m3, 2
vextracti32x4 [r7 +strideq*4], m0, 3
vextracti32x4 [r7 +r5 *1], m1, 3
vextracti32x4 [r7 +r4 *2], m2, 3
vextracti32x4 [r7 +r6 *1], m3, 3
add eobd, 0x80000000
jnc .loop
RET
cglobal inv_txfm_add_dct_dct_32x8_10bpc, 4, 7, 0, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
mova m11, [o(permB)]
mova m0, [cq+64* 0] ; 0 1
mova m4, [cq+64* 1] ; 2 3
mova m1, [cq+64* 2] ; 4 5
mova m8, [cq+64* 3] ; 6 7
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
psrlq m10, m11, 32
%if WIN64
movaps [cq+16*0], xmm6
movaps [cq+16*1], xmm7
%endif
mova m16, m11
vpermi2q m16, m0, m1 ; 1 5
mova m17, m11
vpermi2q m17, m8, m4 ; 7 3
cmp eobd, 43
jl .fast
mova m18, [cq+64* 4] ; 8 9
mova m20, [cq+64* 5] ; 10 11
mova m6, [cq+64* 6] ; 12 13
mova m7, [cq+64* 7] ; 14 15
vpermt2q m0, m10, m18 ; 0 8
vpermt2q m18, m11, m6 ; 9 13
mova m19, m11
vpermi2q m19, m7, m20 ; 15 11
cmp eobd, 107
jge .full
vpermt2q m1, m10, m6 ; 4 12
vpermt2q m4, m10, m8 ; 2 6
vpermt2q m7, m10, m20 ; 14 10
mov r6d, 64*1
call m(idct_8x8_internal_10bpc).main_fast
call m(idct_16x8_internal_10bpc).main_fast
call .main_fast
call m(idct_16x16_internal_10bpc).main_end
jmp .end
.full:
mova m2, [cq+64* 8] ; 16 17
mova m5, [cq+64* 9] ; 18 19
mova m9, [cq+64*10] ; 20 21
mova m21, [cq+64*11] ; 22 23
vpermt2q m1, m10, m9 ; 4 20
vpermt2q m7, m10, m21 ; 14 22
vpermt2q m21, m11, m5 ; 23 19
vpermt2q m5, m10, m20 ; 18 10
mova m20, m11
vpermi2q m20, m2, m9 ; 17 21
mova m22, [cq+64*12] ; 24 25
mova m9, [cq+64*13] ; 26 27
mova m3, [cq+64*14] ; 28 29
mova m23, [cq+64*15] ; 30 31
vpermt2q m2, m10, m22 ; 16 24
vpermt2q m22, m11, m3 ; 25 29
vpermt2q m3, m10, m6 ; 28 12
vpermt2q m4, m10, m9 ; 2 26
mova m6, m10
vpermi2q m6, m23, m8 ; 30 6
vpermt2q m23, m11, m9 ; 31 27
mov r6d, 64*3
call m(idct_8x8_internal_10bpc).main
call m(idct_16x8_internal_10bpc).main
call .main
call m(idct_16x16_internal_10bpc).main_end
jmp .end
.fast:
vpermq m0, m10, m0 ; 0 0
vpermq m1, m10, m1 ; 4 4
vpermt2q m4, m10, m8 ; 2 6
xor r6d, r6d
call .main_fast2
call m(idct_16x16_internal_10bpc).main_end
.end:
%if WIN64
movaps xmm6, [cq+16*0]
movaps xmm7, [cq+16*1]
%endif
vzeroupper
call .transpose_8x32
pxor m14, m14
.zero_loop:
mova [cq+r6*4+64*3], m14
mova [cq+r6*4+64*2], m14
mova [cq+r6*4+64*1], m14
mova [cq+r6*4+64*0], m14
sub r6d, 64
jge .zero_loop
lea r5, [o_base_8bpc]
punpckhqdq m1, m0, m2
punpcklqdq m0, m2
punpcklqdq m2, m3, m4
punpckhqdq m3, m4
punpcklqdq m4, m5, m7
punpckhqdq m5, m7
punpckhqdq m7, m6, m8
punpcklqdq m6, m8
call m(inv_txfm_add_dct_dct_32x8_8bpc).main
pxor m12, m12
.write_32x8_start:
vpbroadcastd m11, [pw_2048]
vpbroadcastd m13, [pixel_10bpc_max]
lea r3, [strideq*3]
.write_32x8:
pmulhrsw m0, m11
pmulhrsw m1, m11
pmulhrsw m2, m11
pmulhrsw m3, m11
call .write_32x4
pmulhrsw m0, m11, m4
pmulhrsw m1, m11, m5
pmulhrsw m2, m11, m6
pmulhrsw m3, m11, m7
.write_32x4:
paddw m0, [dstq+strideq*0]
paddw m1, [dstq+strideq*1]
paddw m2, [dstq+strideq*2]
paddw m3, [dstq+r3 ]
REPX {pmaxsw x, m12}, m0, m1, m2, m3
REPX {pminsw x, m13}, m0, m1, m2, m3
mova [dstq+strideq*0], m0
mova [dstq+strideq*1], m1
mova [dstq+strideq*2], m2
mova [dstq+r3 ], m3
lea dstq, [dstq+strideq*4]
ret
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 8
add r6d, 640
sar r6d, 10
jmp m(inv_txfm_add_dct_dct_32x16_10bpc).dconly2
ALIGN function_align
.main_fast3:
; assuming m0=in0 in0, m4=in2 in2, and m16=in1 in3
vbroadcasti32x4 m5, [o(pd_401_4076)]
pmulld m3, m0, m12
pmulld m4, m5
REPX {paddd x, m13}, m3, m4
REPX {psrad x, 12 }, m3, m4 ; m3=idct8:t0-7, m4=t8a t15a
; t8a t15a -> t8/9 t14/15
vbroadcasti32x4 m5, [o(pd_3784_m3784)]
pshufd m7, m4, q1032
pmulld m6, m4, [o(pd_1567)]{bcstd}
pmulld m5, m7
paddd m6, m13
paddd m5, m6
psrad m5, 12 ; m5=t9a t14a
; t14a t9a -> t13/14 t9/10 [m5] & t8 15 -> t8/11a t12/15a [m4]
shufps m6, m4, m5, q1032 ; t12 t13
shufps m8, m4, m5, q3210 ; t11a t10
pmulld m9, m6, m12
pmulld m7, m8, m12
paddd m9, m13
paddd m5, m9, m7 ; t12 t13a
psubd m4, m9, m7 ; t11 t10a
REPX {psrad x, 12 }, m5, m4
psubd m7, m3, m6 ; dct16 out15 out14
paddd m0, m3, m6 ; dct16 out0 out1
psubd m6, m3, m5 ; dct16 out12 out13
paddd m1, m3, m5 ; dct16 out3 out2
psubd m5, m3, m4 ; dct16 out11 out10
paddd m2, m3, m4 ; dct16 out4 out5
psubd m4, m3, m8 ; dct16 out8 out9
paddd m3, m8 ; dct16 out7 out6
REPX {pmaxsd x, m14}, m7, m0, m6, m1, m5, m2, m4, m3
REPX {pminsd x, m15}, m0, m1, m2, m3, m4, m5, m6, m7
; idct32_bottomhalf
vbroadcasti32x4 m18, [o(pd_201_m601)]
vbroadcasti32x4 m19, [o(pd_4091_4052)]
pmulld m17, m16, m19
pmulld m16, m18
REPX {paddd x, m13}, m17, m16
REPX {psrad x, 12 }, m17, m16
; m17: t31a t24a -> t30/31 t24/25, m16: t16a t23a -> t16/17 t22/23 [step2]
vbroadcasti32x4 m10, [o(pd_799_m2276)]
vbroadcasti32x4 m11, [o(pd_4017_3406)]
pmulld m18, m17, m10
pmulld m19, m17, m11
pmulld m8, m16, m11
pmulld m9, m16, m10
REPX {paddd x, m13}, m18, m19
psubd m18, m8
paddd m19, m9
REPX {psrad x, 12 }, m18, m19
; m17=t31 t24 -> t28/31a t24/27a, m16=t16 t23 -> t16/19a t20/23a
; m18=t17a t22a -> t17/18 t21/22, m19=t30a t25a -> t29/30 t25/26
punpckhqdq m23, m17, m19 ; t24a t25 [or t27a t26]
punpcklqdq m20, m16, m18 ; t16a t17 [or t19a t18]
punpckhqdq m22, m16, m18 ; t23a t22 [or t20a t21]
punpcklqdq m16, m17, m19 ; t28a t29 [or t31a t30]
mova m21, m23
mova m18, m20
mova m17, m22
mova m19, m16
jmp .main4
.main_fast2: ; bottom three-quarters are zero
vbroadcasti32x4 m8, [o(pd_799_4017)]
pmulld m8, m1 ; t4 t7
vpmulld m0, [o(pd_2896)] {1to16} ; t0 t1
REPX {paddd x, m13}, m8, m0
REPX {psrad x, 12 }, m8, m0
pmulld m3, m8, m12
mova m2, m0 ; t3 t2
call m(idct_8x8_internal_10bpc).main3
vbroadcasti32x4 m6, [o(pd_4076_3920)]
vbroadcasti32x4 m3, [o(pd_401_m1189)]
pmulld m6, m4 ; t15 t12
pmulld m4, m3 ; t9 t10
REPX {paddd x, m13}, m6, m4
REPX {psrad x, 12 }, m6, m4
mova m5, m6 ; t14 t13
mova m9, m4 ; t8 t11
call m(idct_16x8_internal_10bpc).main3
vbroadcasti32x4 m23, [o(pd_4091_3973)]
vbroadcasti32x4 m7, [o(pd_201_995)]
vbroadcasti32x4 m22, [o(pd_1380_601)]
vbroadcasti32x4 m9, [o(pd_3857_4052)]
pmulld m23, m16 ; t16 t20
pmulld m16, m7 ; t31 t27
pmulld m22, m17 ; -t19 -t25
pmulld m17, m9 ; t28 t24
REPX {paddd x, m13}, m23, m16, m17
psubd m22, m13, m22
REPX {psrad x, 12 }, m23, m16, m22, m17
mova m20, m23 ; t30 t26
mova m9, m16 ; t17 t21
mova m19, m22 ; t18 t22
mova m18, m17 ; t29 t25
jmp .main3
.main_fast: ; bottom half is zero
vbroadcasti32x4 m23, [o(pd_4091_3973)]
vbroadcasti32x4 m7, [o(pd_201_995)]
vbroadcasti32x4 m20, [o(pd_2751_2106)]
vbroadcasti32x4 m9, [o(pd_3035_3513)]
vbroadcasti32x4 m21, [o(pd_3703_3290)]
vbroadcasti32x4 m10, [o(pd_1751_2440)]
vbroadcasti32x4 m22, [o(pd_1380_601)]
vbroadcasti32x4 m11, [o(pd_3857_4052)]
pmulld m23, m16 ; t16a t20a
pmulld m16, m7 ; t31a t27a
pmulld m20, m19 ; -t17a -t21a
pmulld m19, m9 ; t30a t26a
pmulld m21, m18 ; t18a t22a
pmulld m18, m10 ; t29a t25a
pmulld m22, m17 ; -t19a -t25a
pmulld m17, m11 ; t28a t24a
psubd m20, m13, m20
psubd m22, m13, m22
jmp .main2
.main:
ITX_MULSUB_2D 16, 23, 7, 9, 10, _, 201_995, 4091_3973
ITX_MULSUB_2D 20, 19, 7, 9, 10, _, 3035_3513, 2751_2106
ITX_MULSUB_2D 18, 21, 7, 9, 10, _, 1751_2440, 3703_3290
ITX_MULSUB_2D 22, 17, 7, 9, 10, _, 3857_4052, 1380_601
paddd m20, m13
paddd m22, m13
.main2:
REPX {paddd x, m13}, m16, m23, m19
REPX {psrad x, 12 }, m16, m20, m23, m19
psubd m9, m16, m20 ; t17 t21
paddd m16, m20 ; t16 t20
psubd m20, m23, m19 ; t30 t26
paddd m23, m19 ; t31 t27
REPX {pmaxsd x, m14}, m9, m16, m20, m23
REPX {paddd x, m13}, m21, m18, m17
REPX {psrad x, 12 }, m18, m22, m21, m17
psubd m19, m22, m18 ; t18 t22
paddd m22, m18 ; t19 t23
psubd m18, m17, m21 ; t29 t25
paddd m17, m21 ; t28 t24
REPX {pmaxsd x, m14}, m19, m22, m18, m17
REPX {pminsd x, m15}, m20, m9, m18, m19, m16, m23, m22, m17
.main3:
vbroadcasti32x4 m11, [o(pd_4017_2276)]
vbroadcasti32x4 m10, [o(pd_799_3406)]
psubd m7, m0, m6 ; dct16 out15 out14
paddd m0, m6 ; dct16 out0 out1
psubd m6, m1, m5 ; dct16 out12 out13
paddd m1, m5 ; dct16 out3 out2
psubd m5, m2, m4 ; dct16 out11 out10
paddd m2, m4 ; dct16 out4 out5
psubd m4, m3, m8 ; dct16 out8 out9
paddd m3, m8 ; dct16 out7 out6
ITX_MULSUB_2D 20, 9, 8, 21, _, 13, 10, 11
ITX_MULSUB_2D 18, 19, 8, 21, _, 13, 10, 11, 2
REPX {pmaxsd x, m14}, m7, m0, m6, m1, m5, m2, m4, m3
punpckhqdq m21, m16, m20 ; t20 t21a
punpcklqdq m16, m20 ; t16 t17a
punpcklqdq m20, m22, m19 ; t19 t18a
punpckhqdq m22, m19 ; t23 t22a
REPX {pminsd x, m15}, m0, m1, m2, m3, m4, m5, m6, m7
punpcklqdq m19, m23, m9 ; t31 t30a
punpckhqdq m23, m9 ; t27 t26a
punpckhqdq m9, m17, m18 ; t24 t25a
punpcklqdq m17, m18 ; t28 t29a
psubd m18, m16, m20 ; t19a t18
paddd m20, m16 ; t16a t17
psubd m16, m19, m17 ; t28a t29
paddd m19, m17 ; t31a t30
psubd m17, m22, m21 ; t20a t21
paddd m22, m21 ; t23a t22
psubd m21, m9, m23 ; t27a t26
paddd m23, m9 ; t24a t25
REPX {pmaxsd x, m14}, m18, m16, m17, m21
REPX {pminsd x, m15}, m16, m18, m21, m17
REPX {pmaxsd x, m14}, m20, m22, m19, m23
REPX {pminsd x, m15}, m20, m22, m19, m23
.main4:
vpbroadcastd m11, [o(pd_3784)]
vpbroadcastd m10, [o(pd_1567)]
ITX_MULSUB_2D 16, 18, 8, 9, _, 13, 10, 11
ITX_MULSUB_2D 21, 17, 8, 9, _, 13, 10, 11, 2
paddd m9, m20, m22 ; t16 t17a
psubd m20, m22 ; t23 t22a
paddd m22, m19, m23 ; t31 t30a
psubd m19, m23 ; t24 t25a
psubd m23, m16, m17 ; t20a t21
paddd m16, m17 ; t19a t18
psubd m17, m18, m21 ; t27a t26
paddd m21, m18 ; t28a t29
REPX {pmaxsd x, m14}, m20, m19, m23, m17
REPX {pminsd x, m15}, m19, m20, m17, m23
REPX {pmulld x, m12}, m19, m20, m17, m23
REPX {pmaxsd x, m14}, m22, m21, m16, m9
paddd m19, m13
paddd m17, m13
REPX {pminsd x, m15}, m22, m21, m16, m9
psubd m18, m19, m20 ; t23a t22
paddd m19, m20 ; t24a t25
paddd m20, m17, m23 ; t27 t26a
psubd m17, m23 ; t20 t21a
REPX {psrad x, 12 }, m20, m19, m18, m17
ret
.transpose_8x32:
mova m10, [o(idct32x8p)]
psrlw m8, m10, 8
mova m9, m8
vpermi2w m8, m1, m5
vpermt2w m1, m10, m5
vprold m5, m9, 16
vpermi2w m9, m3, m7
vpermt2w m3, m10, m7
vprold m10, 16
mova m7, m5
vpermi2w m5, m0, m4
vpermt2w m0, m10, m4
vpermi2w m7, m2, m6
vpermt2w m2, m10, m6
punpckhdq m6, m5, m8
punpckldq m5, m8
punpckhdq m8, m7, m9
punpckldq m7, m9
punpckhdq m4, m2, m3
punpckldq m2, m3
punpckhdq m3, m0, m1
punpckldq m0, m1
ret
cglobal inv_txfm_add_identity_identity_32x8_10bpc, 4, 7, 10, dst, stride, c, eob
vpbroadcastd m5, [pw_4096]
lea r4, [strideq*3]
mova m6, [idtx32x8p]
lea r5, [strideq*5]
vpbroadcastd m9, [pixel_10bpc_max]
lea r6, [strideq+r4*2]
pxor m8, m8
sub eobd, 107
psrlw m7, m6, 8
.loop:
mova m0, [cq+64*0]
packssdw m0, [cq+64*1] ; 02 13
mova m1, [cq+64*2]
packssdw m1, [cq+64*3] ; 46 57
mova m2, [cq+64*4]
packssdw m2, [cq+64*5] ; 8a 9b
mova m3, [cq+64*6]
packssdw m3, [cq+64*7] ; ce df
REPX {pmulhrsw x, m5}, m0, m1, m2, m3
REPX {mova [cq+64*x], m8}, 0, 1, 2, 3
mova m4, m6
vpermi2w m4, m1, m3
vpermt2w m1, m7, m3
REPX {mova [cq+64*x], m8}, 4, 5, 6, 7
mova m3, m7
vpermi2w m3, m0, m2
vpermt2w m0, m6, m2
add cq, 64*8
punpcklqdq m2, m3, m1 ; 4 5
punpckhqdq m3, m1 ; 6 7
punpckhqdq m1, m0, m4 ; 2 3
punpcklqdq m0, m4 ; 0 1
mova ym4, [dstq+strideq*0]
vinserti32x8 m4, [dstq+strideq*1], 1
paddw m0, m4
mova ym4, [dstq+strideq*2]
vinserti32x8 m4, [dstq+r4 *1], 1
paddw m1, m4
mova ym4, [dstq+strideq*4]
vinserti32x8 m4, [dstq+r5 *1], 1
paddw m2, m4
mova ym4, [dstq+r4 *2]
vinserti32x8 m4, [dstq+r6 *1], 1
paddw m3, m4
REPX {pmaxsw x, m8}, m0, m1, m2, m3
REPX {pminsw x, m9}, m0, m1, m2, m3
mova [dstq+strideq*0], ym0
vextracti32x8 [dstq+strideq*1], m0, 1
mova [dstq+strideq*2], ym1
vextracti32x8 [dstq+r4 *1], m1, 1
mova [dstq+strideq*4], ym2
vextracti32x8 [dstq+r5 *1], m2, 1
mova [dstq+r4 *2], ym3
vextracti32x8 [dstq+r6 *1], m3, 1
add dstq, 32
add eobd, 0x80000000
jnc .loop
RET
cglobal inv_txfm_add_dct_dct_16x32_10bpc, 4, 7, 0, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
%if WIN64
movaps [rsp+ 8], xmm6
movaps [rsp+24], xmm7
%endif
cmp eobd, 36
jl .fast
call .pass1
cmp eobd, 151
jge .full
lea r5, [o_base_8bpc]
pxor m9, m9
punpcklwd m8, m1, m1 ; 2
punpckhwd m14, m1, m1 ; 3
punpcklwd m1, m3, m3 ; 6
punpckhwd m15, m3, m3 ; 7
punpcklwd m3, m6, m6 ; 12
punpckhwd m19, m6, m6 ; 13
punpcklwd m6, m9, m4 ; __ 8
punpckhwd m20, m4, m4 ; 9
punpckhwd m16, m5, m5 ; 11
punpcklwd m5, m5 ; 10
punpcklwd m9, m0 ; __ 0
punpckhwd m21, m0, m0 ; 1
punpcklwd m0, m7, m7 ; 14
punpckhwd m17, m7, m7 ; 15
punpcklwd m7, m2, m2 ; 4
punpckhwd m18, m2, m2 ; 5
call m(idct_16x16_internal_8bpc).main_fast
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf_fast
mov r6d, 64*3
pxor m8, m8
.zero_loop:
REPX {mova [cq+r6*8+128*x], m8}, 3, 2, 1, 0
sub r6d, 64
jge .zero_loop
jmp .pass2_end
.full:
mova [cq+128*0], m0
mova [cq+128*1], m1
mova [cq+128*2], m2
mova [cq+128*3], m3
mova [cq+128*4], m4
mova [cq+128*5], m5
mova [cq+128*6], m6
mova [cq+128*7], m7
add cq, 64
call .pass1
mova m9, [cq-64* 1] ; 0 1
mova m14, [cq+64* 1] ; 2 3
mova m18, [cq+64* 3] ; 4 5
mova m15, [cq+64* 5] ; 6 7
mova m20, [cq+64* 7] ; 8 9
mova m16, [cq+64* 9] ; 10 11
mova m22, [cq+64*11] ; 12 13
mova m19, [cq+64*13] ; 14 15
lea r5, [o_base_8bpc]
punpcklwd m8, m7, m14 ; 30 2
punpckhwd m21, m7, m9 ; 31 1
punpcklwd m7, m6, m18 ; 28 4
punpckhwd m14, m6 ; 3 29
punpcklwd m9, m0, m9 ; 16 0
punpckhwd m17, m19, m0 ; 15 17
punpcklwd m0, m19, m1 ; 14 18
punpckhwd m19, m1, m22 ; 19 13
punpcklwd m1, m15, m5 ; 6 26
punpckhwd m18, m5, m18 ; 27 5
punpcklwd m6, m4, m20 ; 24 8
punpckhwd m15, m4 ; 7 25
punpcklwd m5, m3, m16 ; 22 10
punpckhwd m20, m3, m20 ; 23 9
punpcklwd m3, m22, m2 ; 12 20
punpckhwd m16, m2 ; 11 21
call m(idct_16x16_internal_8bpc).main2
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf
mov r6d, 32*7
pxor m8, m8
.full_zero_loop:
REPX {mova [cq+r6*8+64*x], m8}, 2, 1, 0, -1
sub r6d, 32
jge .full_zero_loop
jmp .pass2_end
.fast:
mova ym0, [cq+128*0]
mova ym2, [cq+128*4]
movshdup m8, [o(permB)]
mova ym1, [cq+128*2]
mova ym3, [cq+128*6]
mova ym4, [cq+128*1]
mova ym5, [cq+128*3]
mova ym6, [cq+128*5]
mova ym7, [cq+128*7]
vpermt2q m0, m8, m2 ; 0 4
vpermt2q m1, m8, m3 ; 2 6
vpermt2q m4, m8, m5 ; 1 3
vpermt2q m7, m8, m6 ; 7 5
REPX {pmulld x, m12}, m0, m1, m4, m7
pxor ym16, ym16
mova [cq+128*0], ym16
REPX {vmovdqa32 [cq+128*x], ym16}, 1, 2, 3, 4, 5, 6, 7
REPX {paddd x, m13}, m0, m1, m4, m7
REPX {psrad x, 12 }, m0, m1, m4, m7
call m(idct_8x8_internal_10bpc).main_fast
call m(idct_16x8_internal_10bpc).main_fast
vpbroadcastd m11, [o(pd_1)]
call m(idct_8x16_internal_10bpc).main_end2
mova m8, [o(idct8x32p)]
packssdw m0, m4
packssdw m1, m5
packssdw m2, m6
packssdw m3, m7
mova m6, [dup16_perm]
vpermb m0, m8, m0
vpermb m2, m8, m2
vprold m8, 16
vpermb m1, m8, m1
vpermb m3, m8, m3
punpckldq m4, m0, m2
punpckhdq m0, m2
punpckldq m2, m1, m3
punpckhdq m1, m3
punpckldq m21, m4, m2
punpckhdq m14, m4, m2
punpckldq m18, m0, m1
punpckhdq m15, m0, m1
vpermb m8, m6, m14 ; 2
vpermb m1, m6, m15 ; 6
vpermb m7, m6, m18 ; 4
pmovzxwd m9, ym21 ; 0
vpord m6, [o(pb_32)] {1to16}
lea r5, [o_base_8bpc]
vpermb m21, m6, m21 ; 1
vpermb m15, m6, m15 ; 7
vpermb m18, m6, m18 ; 5
vpermb m14, m6, m14 ; 3
pslld m9, 16
call m(idct_16x16_internal_8bpc).main_fast2
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf_fast2
.pass2_end:
movshdup m22, [permC]
vpbroadcastd m11, [pw_2048]
vpbroadcastd m13, [pixel_10bpc_max]
lea r6, [strideq*3]
pxor m12, m12
psrlq m23, m22, 8
vpermq m8, m22, m0
vpermq m9, m23, m1
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m2
vpermq m9, m23, m3
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m4
vpermq m9, m23, m5
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m6
vpermq m9, m23, m7
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m14
vpermq m9, m23, m15
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m16
vpermq m9, m23, m17
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m18
vpermq m9, m23, m19
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m22, m20
vpermq m9, m23, m21
%if WIN64
movaps xmm6, [rsp+ 8]
movaps xmm7, [rsp+24]
%endif
vzeroupper
jmp m(idct_16x8_internal_10bpc).write_16x4
.pass1:
pmulld m0, m12, [cq+128* 0]
pmulld m1, m12, [cq+128* 2]
pmulld m2, m12, [cq+128* 4]
pmulld m3, m12, [cq+128* 6]
pmulld m4, m12, [cq+128* 8]
pmulld m5, m12, [cq+128*10]
pmulld m6, m12, [cq+128*12]
pmulld m7, m12, [cq+128*14]
call m(idct_8x16_internal_10bpc).main_rect2
pmulld m16, m12, [cq+128* 1]
pmulld m17, m12, [cq+128* 3]
pmulld m18, m12, [cq+128* 5]
pmulld m19, m12, [cq+128* 7]
pmulld m20, m12, [cq+128* 9]
pmulld m21, m12, [cq+128*11]
pmulld m22, m12, [cq+128*13]
pmulld m23, m12, [cq+128*15]
call m(idct_16x16_internal_10bpc).main_rect2
vpbroadcastd m11, [o(pd_1)]
call m(idct_16x16_internal_10bpc).main_end2
jmp m(idct_16x16_internal_10bpc).main_end3
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 32
jmp m(inv_txfm_add_dct_dct_16x8_10bpc).dconly
cglobal inv_txfm_add_identity_identity_16x32_10bpc, 4, 7, 16, dst, stride, c, eob
%undef cmp
vpbroadcastd m10, [pw_2896x8]
vpbroadcastd m11, [pw_1697x16]
vpbroadcastd m13, [pw_8192]
vpbroadcastd m15, [pixel_10bpc_max]
lea r6, [strideq*9]
pxor m14, m14
paddw m12, m13, m13 ; pw_16384
cmp eobd, 151
jl .main
call .main
add cq, 64-128*4
lea dstq, [dstq+strideq*8]
.main:
call .main_internal
add cq, 128*4
pmulhrsw m1, m13, m2
pmulhrsw m3, m13, m4
pmulhrsw m5, m13, m6
pmulhrsw m7, m13, m8
call .main_internal
.main2:
pmulhrsw m2, m13
pmulhrsw m4, m13
pmulhrsw m6, m13
pmulhrsw m8, m13
punpcklqdq m0, m1, m2 ; 0 8
punpckhqdq m1, m2 ; 1 9
call .write_16x2x2
punpcklqdq m0, m3, m4 ; 2 10
punpckhqdq m1, m3, m4 ; 3 11
call .write_16x2x2
punpcklqdq m0, m5, m6 ; 4 12
punpckhqdq m1, m5, m6 ; 5 13
call .write_16x2x2
punpcklqdq m0, m7, m8 ; 6 14
punpckhqdq m1, m7, m8 ; 7 15
.write_16x2x2:
mova ym2, [dstq+strideq*0]
vinserti32x8 m2, [dstq+strideq*8], 1
mova ym9, [dstq+strideq*1]
vinserti32x8 m9, [dstq+r6 ], 1
paddw m0, m2
paddw m1, m9
pmaxsw m0, m14
pmaxsw m1, m14
pminsw m0, m15
pminsw m1, m15
mova [dstq+strideq*0], ym0
vextracti32x8 [dstq+strideq*8], m0, 1
mova [dstq+strideq*1], ym1
vextracti32x8 [dstq+r6 ], m1, 1
lea dstq, [dstq+strideq*2]
ret
.main_internal:
mova m8, [cq+128* 0]
packssdw m8, [cq+128* 8]
mova m6, [cq+128* 1]
packssdw m6, [cq+128* 9]
mova m0, [cq+128* 2]
packssdw m0, [cq+128*10]
mova m2, [cq+128* 3]
packssdw m2, [cq+128*11]
REPX {pmulhrsw x, m10}, m8, m6, m0, m2
REPX {vpermq x, x, q3120}, m8, m6, m0, m2
pmulhrsw m4, m11, m8
pmulhrsw m9, m11, m6
REPX {mova [cq+128*x], m14}, 0, 1, 2, 3
pmulhrsw m4, m12
pmulhrsw m9, m12
paddsw m8, m4
paddsw m6, m9
pmulhrsw m4, m11, m0
pmulhrsw m9, m11, m2
REPX {mova [cq+128*x], m14}, 8, 9, 10, 11
pmulhrsw m4, m12
pmulhrsw m9, m12
paddsw m0, m4
paddsw m2, m9
punpcklwd m4, m8, m6
punpckhwd m8, m6
punpcklwd m6, m0, m2
punpckhwd m0, m2
punpckldq m2, m4, m6 ; 0 1
punpckhdq m4, m6 ; 2 3
punpckldq m6, m8, m0 ; 4 5
punpckhdq m8, m0 ; 6 7
ret
cglobal inv_txfm_add_dct_dct_32x16_10bpc, 4, 7, 0, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
%if WIN64
movaps [rsp+ 8], xmm6
movaps [rsp+24], xmm7
%endif
mov r6d, 8*12
cmp eobd, 36
jl .fast
pmulld m0, m12, [cq+64* 0]
pmulld m1, m12, [cq+64* 4]
pmulld m2, m12, [cq+64* 8]
pmulld m3, m12, [cq+64*12]
pmulld m16, m12, [cq+64* 2]
pmulld m17, m12, [cq+64* 6]
pmulld m18, m12, [cq+64*10]
pmulld m19, m12, [cq+64*14]
cmp eobd, 151
jge .full
call m(idct_8x16_internal_10bpc).main_fast_rect2
call m(idct_16x16_internal_10bpc).main_fast_rect2
call .idct16_sumsub
call .pass1_load_spill
call .main_fast_rect2
jmp .pass1_end
.full:
pmulld m4, m12, [cq+64*16]
pmulld m5, m12, [cq+64*20]
pmulld m6, m12, [cq+64*24]
pmulld m7, m12, [cq+64*28]
pmulld m20, m12, [cq+64*18]
pmulld m21, m12, [cq+64*22]
pmulld m22, m12, [cq+64*26]
pmulld m23, m12, [cq+64*30]
add r6d, 8*16
call m(idct_8x16_internal_10bpc).main_rect2
call m(idct_16x16_internal_10bpc).main_rect2
call .idct16_sumsub
call .pass1_load_spill
pmulld m16, m12, [cq+64*17]
pmulld m17, m12, [cq+64*19]
pmulld m18, m12, [cq+64*21]
pmulld m19, m12, [cq+64*23]
pmulld m20, m12, [cq+64*25]
pmulld m21, m12, [cq+64*27]
pmulld m22, m12, [cq+64*29]
pmulld m23, m12, [cq+64*31]
call .main_rect2
.pass1_end:
vpbroadcastd m11, [o(pd_1)]
lea r4, [cq+64]
call .idct32_pass1_end
lea r5, [o_base_8bpc]
punpckhqdq m19, m5, m16 ; 11
punpcklqdq m5, m16 ; 10
punpckhqdq m16, m2, m1 ; 5
punpcklqdq m2, m1 ; 4
punpcklqdq m1, m15, m4 ; 2
punpckhqdq m15, m4 ; 3
punpcklqdq m4, m14, m18 ; 8
punpckhqdq m18, m14, m18 ; 9
punpckhqdq m14, m0, m20 ; 1
punpcklqdq m0, m20 ; 0
punpckhqdq m20, m6, m17 ; 13
punpcklqdq m6, m17 ; 12
punpckhqdq m17, m3, m21 ; 7
punpcklqdq m3, m21 ; 6
punpckhqdq m21, m7, m8 ; 15
punpcklqdq m7, m8 ; 14
call m(inv_txfm_add_dct_dct_32x8_8bpc).main
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf
jmp .end
.fast:
pmulld ym0, ym12, [cq+64*0]
pmulld ym1, ym12, [cq+64*4]
movshdup m7, [o(permB)]
mova ym4, [cq+64*2]
mova ym5, [cq+64*6]
mova ym16, [cq+64*1]
mova ym2, [cq+64*5]
mova ym3, [cq+64*3]
mova ym17, [cq+64*7]
vpermt2q m4, m7, m5 ; 2 6
vpermt2q m16, m7, m2 ; 1 5
vpermt2q m17, m7, m3 ; 7 3
paddd ym0, ym13
paddd ym1, ym13
psrad ym0, 12
psrad ym1, 12
vpermq m0, m7, m0 ; 0 0
vpermq m1, m7, m1 ; 4 4
REPX {pmulld x, m12}, m4, m16, m17
REPX {paddd x, m13}, m4, m16, m17
REPX {psrad x, 12 }, m4, m16, m17
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast2
vpbroadcastd m11, [o(pd_1)]
call m(idct_16x16_internal_10bpc).main_end2
call m(inv_txfm_add_dct_dct_32x8_10bpc).transpose_8x32
lea r5, [o_base_8bpc]
punpckhqdq m14, m0, m2 ; 1
punpcklqdq m0, m2 ; 0
punpcklqdq m1, m3, m4 ; 2
punpckhqdq m15, m3, m4 ; 3
punpcklqdq m2, m5, m7 ; 4
punpckhqdq m16, m5, m7 ; 5
punpcklqdq m3, m6, m8 ; 6
punpckhqdq m17, m6, m8 ; 7
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast
.end:
%if WIN64
movaps xmm6, [rsp+ 8]
movaps xmm7, [rsp+24]
%endif
pxor m12, m12
.zero_loop:
mova [cq+r6*8+64*3], m12
mova [cq+r6*8+64*2], m12
mova [cq+r6*8+64*1], m12
mova [cq+r6*8+64*0], m12
sub r6d, 8*4
jge .zero_loop
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x8_start
pmulhrsw m0, m11, m14
pmulhrsw m1, m11, m15
pmulhrsw m2, m11, m16
pmulhrsw m3, m11, m17
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
pmulhrsw m0, m11, m18
pmulhrsw m1, m11, m19
pmulhrsw m2, m11, m20
pmulhrsw m3, m11, m21
vzeroupper
jmp m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 16
.dconly3:
add r6d, 128
sar r6d, 8
imul r6d, 181
add r6d, 384
sar r6d, 9
.dconly2:
vpbroadcastd m3, [o(dconly_10bpc)]
imul r6d, 181
add r6d, 2176
sar r6d, 12
vpbroadcastw m2, r6d
paddsw m2, m3
.dconly_loop:
paddsw m0, m2, [dstq+strideq*0]
paddsw m1, m2, [dstq+strideq*1]
psubusw m0, m3
psubusw m1, m3
mova [dstq+strideq*0], m0
mova [dstq+strideq*1], m1
lea dstq, [dstq+strideq*2]
sub r3d, 2
jg .dconly_loop
RET
ALIGN function_align
.idct16_sumsub:
psubd m23, m0, m22 ; t15
paddd m0, m22 ; t0
psubd m22, m1, m21 ; t14
paddd m1, m21 ; t1
REPX {pmaxsd x, m14}, m23, m0, m22, m1
psubd m21, m2, m20 ; t13
paddd m2, m20 ; t2
REPX {pminsd x, m15}, m23, m0, m22, m1
psubd m20, m3, m19 ; t12
paddd m3, m19 ; t3
REPX {pmaxsd x, m14}, m21, m2, m20, m3
psubd m19, m4, m18 ; t11
paddd m4, m18 ; t4
REPX {pminsd x, m15}, m21, m2, m20, m3
psubd m18, m5, m17 ; t10
paddd m5, m17 ; t5
REPX {pmaxsd x, m14}, m19, m4, m18, m5
psubd m17, m6, m16 ; t9
paddd m6, m16 ; t6
REPX {pminsd x, m15}, m19, m4, m18, m5
psubd m16, m7, m9 ; t8
paddd m7, m9 ; t7
REPX {pmaxsd x, m14}, m17, m6, m16, m7
REPX {pminsd x, m15}, m17, m6, m16, m7
ret
.idct32_pass1_end:
psrlq m12, [o(permC)], 24 ; 0 2 8 10 1 3 9 11
psrlq m13, m12, 32 ; 4 6 12 14 5 7 13 15
%macro IDCT32_PASS1_END 2 ; low, high
paddd m8, m11, [r4+128*%1]
paddd m9, m11, [cq+128*%1]
psubd m10, m8, m%1 ; out 16+n
paddd m8, m%1 ; out 15-n
paddd m%1, m9, m%2 ; out 0+n
psubd m9, m%2 ; out 31-n
REPX {vpsravd x, m11}, m10, m%1, m8, m9
packssdw m%1, m10 ; 0+n 16+n
packssdw m%2, m8, m9 ; 15-n 31-n
%endmacro
IDCT32_PASS1_END 0, 23 ; 0 16, 15 31
IDCT32_PASS1_END 7, 16 ; 7 23, 8 24
IDCT32_PASS1_END 1, 22 ; 1 17, 14 30
IDCT32_PASS1_END 6, 17 ; 6 22, 9 25
IDCT32_PASS1_END 2, 21 ; 2 18, 13 29
IDCT32_PASS1_END 5, 18 ; 5 21, 10 26
IDCT32_PASS1_END 3, 20 ; 3 19, 12 28
IDCT32_PASS1_END 4, 19 ; 4 20, 11 27
.transpose_16x32:
mova m14, m13
vpermi2q m14, m0, m16
vpermt2q m0, m12, m16
mova m15, m13
vpermi2q m15, m1, m17
vpermt2q m1, m12, m17
mova m16, m13
vpermi2q m16, m2, m18
vpermt2q m2, m12, m18
mova m17, m13
vpermi2q m17, m3, m19
vpermt2q m3, m12, m19
mova m18, m13
vpermi2q m18, m4, m20
vpermt2q m4, m12, m20
mova m19, m13
vpermi2q m19, m5, m21
vpermt2q m5, m12, m21
mova m20, m13
vpermi2q m20, m6, m22
vpermt2q m6, m12, m22
mova m21, m13
vpermi2q m21, m7, m23
vpermt2q m7, m12, m23
punpckhwd m8, m2, m3 ; c04 d04 c05 d05 c06 d06 c07 d07
punpcklwd m2, m3 ; c00 d00 c01 d01 c02 d02 c03 d03
punpckhwd m3, m0, m1 ; a04 b04 a05 b05 a06 b06 a07 b07
punpcklwd m0, m1 ; a00 b00 a01 b01 a02 b02 a03 b03
punpckhwd m1, m4, m5 ; e04 f04 e05 f05 e06 f06 e07 f07
punpcklwd m4, m5 ; e00 f00 e01 f01 e02 f02 e03 f03
punpckhwd m5, m6, m7 ; g04 h04 g05 h05 g06 h06 g07 h07
punpcklwd m6, m7 ; g00 h00 g01 h01 g02 h02 g03 h03
punpckhwd m7, m14, m15 ; a12 b12 a13 b13 a14 b14 a15 b15
punpcklwd m14, m15 ; a08 b08 a09 b09 a10 b10 a11 b11
punpckhwd m15, m16, m17 ; c12 d12 c13 d13 c14 d14 c15 d15
punpcklwd m16, m17 ; c08 d08 c09 d09 c10 d10 c11 d11
punpckhwd m17, m18, m19 ; e12 f12 e13 f13 e14 f14 e15 f15
punpcklwd m18, m19 ; e08 f08 e09 f09 e10 f10 e11 f11
punpckhwd m19, m20, m21 ; g12 h12 g13 h13 g14 h14 g15 h15
punpcklwd m20, m21 ; g08 h08 g09 h09 g10 h10 g11 h11
punpckhdq m21, m1, m5 ; e06 f06 g06 h06 e07 f07 g07 h07
punpckldq m1, m5 ; e04 f04 g04 h04 e05 f05 g05 h05
punpckhdq m5, m14, m16 ; a10 b10 c10 d10 a11 b11 c11 d11
punpckldq m14, m16 ; a08 b08 c08 d08 a09 b09 c09 d09
punpckhdq m16, m18, m20 ; e10 f10 g10 h10 e11 f11 g11 h11
punpckldq m18, m20 ; e08 f08 g08 h08 e09 f09 g09 h09
punpckldq m20, m4, m6 ; e00 f00 g00 h00 e01 f01 g01 h01
punpckhdq m4, m6 ; e02 f02 g02 h02 e03 f03 g03 h03
punpckldq m6, m7, m15 ; a12 b12 c12 d12 a13 b13 c13 d13
punpckhdq m7, m15 ; a14 b14 c14 d14 a15 b15 c15 d15
punpckhdq m15, m0, m2 ; a02 b02 c02 d02 a03 b03 c03 d03
punpckldq m0, m2 ; a00 b00 c00 d00 a01 b01 c01 d01
punpckldq m2, m3, m8 ; a04 b04 c04 d04 a05 b05 c05 d05
punpckhdq m3, m8 ; a06 b06 c06 d06 a07 b07 c07 d07
punpckhdq m8, m17, m19 ; e14 f14 g14 h14 e15 f15 g15 h15
punpckldq m17, m19 ; e12 f12 g12 h12 e13 f13 g13 h13
ret
.pass1_load_spill:
mova [cq+64* 0], m0
mova [cq+64* 2], m1
mova [cq+64* 4], m2
mova [cq+64* 6], m3
mova [cq+64* 8], m4
mova [cq+64*10], m5
mova [cq+64*12], m6
mova [cq+64*14], m7
pmulld m0, m12, [cq+64* 1]
pmulld m1, m12, [cq+64* 3]
pmulld m2, m12, [cq+64* 5]
pmulld m3, m12, [cq+64* 7]
pmulld m4, m12, [cq+64* 9]
pmulld m5, m12, [cq+64*11]
pmulld m6, m12, [cq+64*13]
pmulld m7, m12, [cq+64*15]
mova [cq+64* 1], m23
mova [cq+64* 3], m22
mova [cq+64* 5], m21
mova [cq+64* 7], m20
mova [cq+64* 9], m19
mova [cq+64*11], m18
mova [cq+64*13], m17
mova [cq+64*15], m16
ret
.main_fast2_rect2:
REPX {paddd x, m13}, m0, m1, m2, m3
REPX {psrad x, 12 }, m0, m1, m2, m3
.main_fast2: ; bottom 3/4 is zero
pmulld m23, m0, [o(pd_4091)] {1to16} ; t31a
pmulld m0, [o(pd_201)] {1to16} ; t16a
pmulld m20, m3, [o(pd_1380)] {1to16} ; t19a
pmulld m3, [o(pd_3857)] {1to16} ; t28a
pmulld m21, m2, [o(pd_3973)] {1to16} ; t27a
pmulld m2, [o(pd_995)] {1to16} ; t20a
pmulld m6, m1, [o(pd_601)] {1to16} ; t23a
pmulld m17, m1, [o(pd_4052)] {1to16} ; t24a
REPX {psubd x, m13, x}, m20, m6
REPX {paddd x, m13}, m23, m0, m3, m21, m2, m17
REPX {psrad x, 12 }, m20, m6, m23, m0, m3, m21, m2, m17
mova m8, m0
mova m16, m23
mova m7, m20
mova m4, m3
mova m19, m2
mova m18, m21
mova m5, m6
mova m22, m17
jmp .main3
.main_fast_rect2:
call m(idct_8x16_internal_10bpc).round
.main_fast: ; bottom half is zero
pmulld m23, m0, [o(pd_4091)] {1to16} ; t31a
pmulld m0, [o(pd_201)] {1to16} ; t16a
pmulld m16, m7, [o(pd_2751)] {1to16} ; t17a
pmulld m7, [o(pd_3035)] {1to16} ; t30a
pmulld m19, m4, [o(pd_3703)] {1to16} ; t29a
pmulld m4, [o(pd_1751)] {1to16} ; t18a
pmulld m20, m3, [o(pd_1380)] {1to16} ; t19a
pmulld m3, [o(pd_3857)] {1to16} ; t28a
pmulld m21, m2, [o(pd_3973)] {1to16} ; t27a
pmulld m2, [o(pd_995)] {1to16} ; t20a
pmulld m18, m5, [o(pd_2106)] {1to16} ; t21a
pmulld m5, [o(pd_3513)] {1to16} ; t26a
pmulld m17, m6, [o(pd_3290)] {1to16} ; t25a
pmulld m6, [o(pd_2440)] {1to16} ; t22a
pmulld m22, m1, [o(pd_601)] {1to16} ; t23a
pmulld m1, [o(pd_4052)] {1to16} ; t24a
REPX {psubd x, m13, x}, m16, m20, m18, m22
call m(idct_16x16_internal_10bpc).round3
jmp .main2
.main_rect2:
call m(idct_8x16_internal_10bpc).round
call m(idct_16x16_internal_10bpc).round
.main:
ITX_MULSUB_2D 0, 23, 8, 9, 10, _, 201, 4091 ; t16a, t31a
ITX_MULSUB_2D 16, 7, 8, 9, 10, _, 3035, 2751 ; t17a, t30a
ITX_MULSUB_2D 4, 19, 8, 9, 10, _, 1751, 3703 ; t18a, t29a
ITX_MULSUB_2D 20, 3, 8, 9, 10, _, 3857, 1380 ; t19a, t28a
ITX_MULSUB_2D 2, 21, 8, 9, 10, _, 995, 3973 ; t20a, t27a
ITX_MULSUB_2D 18, 5, 8, 9, 10, _, 3513, 2106 ; t21a, t26a
ITX_MULSUB_2D 6, 17, 8, 9, 10, _, 2440, 3290 ; t22a, t25a
ITX_MULSUB_2D 22, 1, 8, 9, 10, _, 4052, 601 ; t23a, t24a
call m(idct_16x16_internal_10bpc).round
.main2:
call m(idct_8x16_internal_10bpc).round
psubd m8, m0, m16 ; t17
paddd m0, m16 ; t16
psubd m16, m23, m7 ; t30
paddd m23, m7 ; t31
REPX {pmaxsd x, m14}, m8, m0, m16, m23
paddd m7, m20, m4 ; t19
psubd m20, m4 ; t18
REPX {pminsd x, m15}, m8, m0, m16, m23
paddd m4, m3, m19 ; t28
psubd m3, m19 ; t29
REPX {pmaxsd x, m14}, m7, m20, m4, m3
psubd m19, m2, m18 ; t21
paddd m2, m18 ; t20
REPX {pminsd x, m15}, m7, m20, m4, m3
psubd m18, m21, m5 ; t26
paddd m21, m5 ; t27
REPX {pmaxsd x, m14}, m19, m2, m18, m21
psubd m5, m22, m6 ; t22
paddd m6, m22 ; t23
REPX {pminsd x, m15}, m19, m2, m18, m21
psubd m22, m1, m17 ; t25
paddd m17, m1 ; t24
REPX {pmaxsd x, m14}, m5, m6, m22, m17
REPX {pminsd x, m15}, m5, m6, m22, m17
.main3:
vpbroadcastd m11, [o(pd_4017)]
vpbroadcastd m10, [o(pd_799)]
ITX_MULSUB_2D 16, 8, 9, 1, _, 13, 10, 11 ; t17a, t30a
ITX_MULSUB_2D 3, 20, 9, 1, _, 13, 10, 11, 2 ; t29a, t18a
vpbroadcastd m11, [o(pd_2276)]
vpbroadcastd m10, [o(pd_3406)]
ITX_MULSUB_2D 18, 19, 9, 1, _, 13, 10, 11 ; t21a, t26a
ITX_MULSUB_2D 22, 5, 9, 1, _, 13, 10, 11, 2 ; t25a, t22a
paddd m1, m6, m2 ; t23a
psubd m6, m2 ; t20a
psubd m2, m17, m21 ; t27a
paddd m17, m21 ; t24a
REPX {pmaxsd x, m14}, m1, m6, m2, m17
psubd m21, m23, m4 ; t28a
paddd m23, m4 ; t31a
REPX {pminsd x, m15}, m1, m6, m2, m17
psubd m4, m16, m20 ; t18
paddd m16, m20 ; t17
REPX {pmaxsd x, m14}, m21, m23, m4, m16
psubd m20, m0, m7 ; t19a
paddd m0, m7 ; t16a
REPX {pminsd x, m15}, m21, m23, m4, m16
psubd m7, m8, m3 ; t29
paddd m3, m8 ; t30
REPX {pmaxsd x, m14}, m20, m0, m7, m3
paddd m8, m5, m18 ; t22
psubd m5, m18 ; t21
REPX {pminsd x, m15}, m20, m0, m7, m3
psubd m18, m22, m19 ; t26
paddd m22, m19 ; t25
REPX {pmaxsd x, m14}, m8, m5, m18, m22
vpbroadcastd m11, [o(pd_3784)]
vpbroadcastd m10, [o(pd_1567)]
REPX {pminsd x, m15}, m8, m5, m18, m22
ITX_MULSUB_2D 21, 20, 9, 19, _, 13, 10, 11 ; t19, t28
ITX_MULSUB_2D 2, 6, 9, 19, _, 13, 10, 11, 2 ; t27, t20
ITX_MULSUB_2D 7, 4, 9, 19, _, 13, 10, 11 ; t18a, t29a
ITX_MULSUB_2D 18, 5, 9, 19, _, 13, 10, 11, 2 ; t26a, t21a
psubd m19, m0, m1 ; t23
paddd m0, m1 ; t16
paddd m1, m8, m16 ; t17a
psubd m8, m16, m8 ; t22a
REPX {pmaxsd x, m14}, m19, m0, m1, m8
psubd m16, m23, m17 ; t24
paddd m23, m17 ; t31
REPX {pminsd x, m15}, m19, m0, m1, m8
psubd m17, m3, m22 ; t25a
paddd m22, m3 ; t30a
REPX {pmaxsd x, m14}, m16, m23, m17, m22
paddd m3, m6, m21 ; t19a
psubd m6, m21, m6 ; t20a
REPX {pminsd x, m15}, m16, m23, m17, m22
paddd m21, m18, m4 ; t29
psubd m18, m4, m18 ; t26
REPX {pmaxsd x, m14}, m3, m6, m21, m18
psubd m4, m20, m2 ; t27a
paddd m20, m2 ; t28a
REPX {pminsd x, m15}, m3, m6, m21, m18
paddd m2, m7, m5 ; t18
psubd m7, m5 ; t21
REPX {pmaxsd x, m14}, m4, m20, m2, m7
REPX {pminsd x, m15}, m4, m20, m2, m7
REPX {pmulld x, m12}, m18, m16, m4, m17, m7, m19, m6, m8
REPX {paddd x, m13}, m18, m16, m4, m17
psubd m5, m18, m7 ; t21a
paddd m18, m7 ; t26a
psubd m7, m16, m19 ; t23a
paddd m16, m19 ; t24a
REPX {psrad x, 12 }, m5, m18, m7, m16
paddd m19, m4, m6 ; t27
psubd m4, m6 ; t20
psubd m6, m17, m8 ; t22
paddd m17, m8 ; t25
REPX {psrad x, 12 }, m19, m4, m6, m17
ret
cglobal inv_txfm_add_identity_identity_32x16_10bpc, 4, 7, 16, dst, stride, c, eob
%undef cmp
vpbroadcastd m10, [pw_2896x8]
vpbroadcastd m11, [pw_1697x16]
vpbroadcastd m13, [pw_2048]
vpbroadcastd m15, [pixel_10bpc_max]
lea r6, [strideq*9]
pxor m14, m14
cmp eobd, 151
jl .main
mov r4, dstq
call .main
add cq, 64*12
lea dstq, [r4+32]
.main:
call .main_internal
add cq, 64*4
pmulhrsw m1, m13, m2
pmulhrsw m3, m13, m4
pmulhrsw m5, m13, m6
pmulhrsw m7, m13, m8
call .main_internal
jmp m(inv_txfm_add_identity_identity_16x32_10bpc).main2
.main_internal:
mova m8, [cq+64* 0]
packssdw m8, [cq+64* 8]
mova m6, [cq+64* 1]
packssdw m6, [cq+64* 9]
mova m0, [cq+64* 2]
packssdw m0, [cq+64*10]
mova m2, [cq+64* 3]
packssdw m2, [cq+64*11]
REPX {pmulhrsw x, m10}, m8, m6, m0, m2
REPX {paddsw x, x }, m8, m6, m0, m2
REPX {vpermq x, x, q3120}, m8, m6, m0, m2
pmulhrsw m4, m11, m8
pmulhrsw m9, m11, m6
paddsw m8, m8
paddsw m6, m6
REPX {mova [cq+64*x], m14}, 0, 1, 2, 3
paddsw m8, m4
paddsw m6, m9
pmulhrsw m4, m11, m0
pmulhrsw m9, m11, m2
paddsw m0, m0
paddsw m2, m2
REPX {mova [cq+64*x], m14}, 8, 9, 10, 11
paddsw m0, m4
paddsw m2, m9
punpcklwd m4, m8, m6
punpckhwd m8, m6
punpcklwd m6, m0, m2
punpckhwd m0, m2
punpckldq m2, m4, m6 ; 0 1
punpckhdq m4, m6 ; 2 3
punpckldq m6, m8, m0 ; 4 5
punpckhdq m8, m0 ; 6 7
ret
cglobal inv_txfm_add_dct_dct_32x32_10bpc, 4, 7, 0, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
WIN64_SPILL_XMM 30
cmp eobd, 136
jl .fast
add cq, 64
cmp eobd, 543
jge .full
call .pass1_fast ; bottomright 16x16 zero
mov r6d, 16*12
jmp .lefthalf
.full:
call .pass1
mov r6d, 16*28
.lefthalf:
mova [cq+128* 0], m0
mova [cq+128* 1], m1
mova [cq+128* 2], m2
mova [cq+128* 3], m3
mova [cq+128* 4], m14
mova [cq+128* 5], m15
mova [cq+128* 6], m16
mova [cq+128* 7], m17
mova [cq+128* 8], m22
mova [cq+128* 9], m23
mova [cq+128*10], m24
mova [cq+128*11], m25
mova [cq+128*12], m26
mova [cq+128*13], m27
mova [cq+128*14], m28
mova [cq+128*15], m29
sub cq, 64
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
call .pass1
lea r5, [o_base_8bpc]
call .pass2_start
pxor m12, m12
.right_zero_loop:
mova [cq+r6*8+64+128*3], m12
mova [cq+r6*8+64+128*2], m12
mova [cq+r6*8+64+128*1], m12
mova [cq+r6*8+64+128*0], m12
sub r6d, 16*4
jge .right_zero_loop
mov r6d, 16*28
jmp .end2
.pass2_start:
mova m4, [cq+64+128* 0]
mova m5, [cq+64+128* 1]
mova m6, [cq+64+128* 2]
mova m7, [cq+64+128* 3]
mova m18, [cq+64+128* 4]
mova m19, [cq+64+128* 5]
mova m20, [cq+64+128* 6]
mova m21, [cq+64+128* 7]
call m(inv_txfm_add_dct_dct_32x8_8bpc).main
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf
mova [cq+128*0], m14
mova [cq+128*1], m15
mova [cq+128*2], m16
mova [cq+128*3], m17
mova [cq+128*4], m18
mova [cq+128*5], m19
mova [cq+128*6], m20
mova [cq+128*7], m21
mova m14, [cq+64+128* 8]
mova m15, [cq+64+128* 9]
mova m16, [cq+64+128*10]
mova m17, [cq+64+128*11]
mova m18, [cq+64+128*12]
mova m19, [cq+64+128*13]
mova m20, [cq+64+128*14]
mova m21, [cq+64+128*15]
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf
.fast: ; topleft 16x16 nonzero
cmp eobd, 36
jl .fast2
call .pass1_fast
lea r5, [o_base_8bpc]
call .pass2_fast_start
jmp .end
.pass2_fast_start:
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast
mova [cq+128*0], m14
mova [cq+128*1], m15
mova [cq+128*2], m16
mova [cq+128*3], m17
mova [cq+128*4], m18
mova [cq+128*5], m19
mova [cq+128*6], m20
mova [cq+128*7], m21
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf_fast
.fast2: ; topleft 8x8 nonzero
movshdup m7, [o(permB)]
mova ym0, [cq+128*0]
mova ym1, [cq+128*4]
mova ym4, [cq+128*2]
mova ym5, [cq+128*6]
mova ym16, [cq+128*1]
mova ym2, [cq+128*5]
mova ym3, [cq+128*3]
mova ym17, [cq+128*7]
mov r6d, 16*4
vpermq m0, m7, m0 ; 0 0
vpermq m1, m7, m1 ; 4 4
vpermt2q m4, m7, m5 ; 2 6
vpermt2q m16, m7, m2 ; 1 5
vpermt2q m17, m7, m3 ; 7 3
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast2
call m(idct_16x16_internal_10bpc).main_end
call .pass2_fast2_start
.end:
pxor m12, m12
.end2:
call .pass2_end
.zero_loop:
mova [cq+r6*8+128*3], m12
mova [cq+r6*8+128*2], m12
mova [cq+r6*8+128*1], m12
mova [cq+r6*8+128*0], m12
sub r6d, 16*4
jge .zero_loop
WIN64_RESTORE_XMM
vzeroupper
ret
.pass2_fast2_start:
call m(inv_txfm_add_dct_dct_32x8_10bpc).transpose_8x32
lea r5, [o_base_8bpc]
punpckhqdq m22, m0, m2 ; 1
punpcklqdq m0, m2 ; 0
punpcklqdq m1, m5, m7 ; 4
punpckhqdq m24, m5, m7 ; 5
punpcklqdq m14, m3, m4 ; 2
punpckhqdq m23, m3, m4 ; 3
punpcklqdq m15, m6, m8 ; 6
punpckhqdq m25, m6, m8 ; 7
mova m10, m13
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast2
mova [cq+128*0], m14
mova [cq+128*1], m15
mova [cq+128*2], m16
mova [cq+128*3], m17
mova [cq+128*4], m18
mova [cq+128*5], m19
mova [cq+128*6], m20
mova [cq+128*7], m21
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf_fast2
.pass2_end:
psubsw m9, m0, m29 ; out31
paddsw m0, m29 ; out0
psubsw m29, m1, m28 ; out30
paddsw m1, m28 ; out1
psubsw m28, m2, m27 ; out29
paddsw m2, m27 ; out2
psubsw m27, m3, m26 ; out28
paddsw m3, m26 ; out3
psubsw m26, m4, m25 ; out27
paddsw m4, m25 ; out4
psubsw m25, m5, m24 ; out26
paddsw m5, m24 ; out5
psubsw m24, m6, m23 ; out25
paddsw m6, m23 ; out6
psubsw m23, m7, m22 ; out24
paddsw m7, m22 ; out7
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x8_start
mova m0, [cq+128*0]
mova m1, [cq+128*1]
mova m2, [cq+128*2]
mova m3, [cq+128*3]
mova m4, [cq+128*4]
mova m5, [cq+128*5]
mova m6, [cq+128*6]
mova m7, [cq+128*7]
psubsw m22, m0, m21 ; out23
paddsw m0, m21 ; out8
psubsw m21, m1, m20 ; out22
paddsw m1, m20 ; out9
psubsw m20, m2, m19 ; out21
paddsw m2, m19 ; out10
psubsw m19, m3, m18 ; out20
paddsw m3, m18 ; out11
psubsw m18, m4, m17 ; out19
paddsw m4, m17 ; out12
psubsw m17, m5, m16 ; out18
paddsw m5, m16 ; out13
psubsw m16, m6, m15 ; out17
paddsw m6, m15 ; out14
psubsw m15, m7, m14 ; out16
paddsw m7, m14 ; out15
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x8
pmulhrsw m0, m11, m15
pmulhrsw m1, m11, m16
pmulhrsw m2, m11, m17
pmulhrsw m3, m11, m18
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
pmulhrsw m0, m11, m19
pmulhrsw m1, m11, m20
pmulhrsw m2, m11, m21
pmulhrsw m3, m11, m22
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
pmulhrsw m0, m11, m23
pmulhrsw m1, m11, m24
pmulhrsw m2, m11, m25
pmulhrsw m3, m11, m26
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
pmulhrsw m0, m11, m27
pmulhrsw m1, m11, m28
pmulhrsw m2, m11, m29
pmulhrsw m3, m11, m9
jmp m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 32
add r6d, 640
sar r6d, 10
jmp m(inv_txfm_add_dct_dct_32x16_10bpc).dconly2
.pass1_fast:
mova m0, [cq+128* 0]
mova m1, [cq+128* 4]
mova m2, [cq+128* 8]
mova m3, [cq+128*12]
mov r6d, 16*12
call m(idct_8x16_internal_10bpc).main_fast
mova m16, [cq+128* 2]
mova m17, [cq+128* 6]
mova m18, [cq+128*10]
mova m19, [cq+128*14]
call m(idct_16x16_internal_10bpc).main_fast
call .pass1_load_spill
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast
jmp .pass1_end
.pass1:
mova m0, [cq+128* 0]
mova m1, [cq+128* 4]
mova m2, [cq+128* 8]
mova m3, [cq+128*12]
mova m4, [cq+128*16]
mova m5, [cq+128*20]
mova m6, [cq+128*24]
mova m7, [cq+128*28]
call m(idct_8x16_internal_10bpc).main
mova m16, [cq+128* 2]
mova m17, [cq+128* 6]
mova m18, [cq+128*10]
mova m19, [cq+128*14]
mova m20, [cq+128*18]
mova m21, [cq+128*22]
mova m22, [cq+128*26]
mova m23, [cq+128*30]
call m(idct_16x16_internal_10bpc).main
call .pass1_load_spill
mova m16, [cq+128*17]
mova m17, [cq+128*19]
mova m18, [cq+128*21]
mova m19, [cq+128*23]
mova m20, [cq+128*25]
mova m21, [cq+128*27]
mova m22, [cq+128*29]
mova m23, [cq+128*31]
call m(inv_txfm_add_dct_dct_32x16_10bpc).main
.pass1_end:
vpbroadcastd m11, [o(pd_2)]
lea r4, [cq+128*8]
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct32_pass1_end
punpckhqdq m22, m0, m20 ; 1
punpcklqdq m0, m20 ; 0
punpckhqdq m24, m2, m1 ; 5
punpcklqdq m1, m2, m1 ; 4
punpcklqdq m2, m14, m18 ; 8
punpckhqdq m26, m14, m18 ; 9
punpcklqdq m14, m15, m4 ; 2
punpckhqdq m23, m15, m4 ; 3
punpckhqdq m25, m3, m21 ; 7
punpcklqdq m15, m3, m21 ; 6
punpckhqdq m28, m6, m17 ; 13
punpcklqdq m3, m6, m17 ; 12
punpckhqdq m27, m5, m16 ; 11
punpcklqdq m16, m5, m16 ; 10
punpckhqdq m29, m7, m8 ; 15
punpcklqdq m17, m7, m8 ; 14
ret
.pass1_load_spill:
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
mova [cq+128* 0], m0
mova m0, [cq+128* 1]
mova [cq+128* 1], m1
mova [cq+128* 2], m2
mova m1, [cq+128* 3]
mova m2, [cq+128* 5]
mova [cq+128* 3], m3
mova [cq+128* 4], m4
mova m3, [cq+128* 7]
mova m4, [cq+128* 9]
mova [cq+128* 5], m5
mova [cq+128* 6], m6
mova [cq+128* 7], m7
mova m5, [cq+128*11]
mova m6, [cq+128*13]
mova m7, [cq+128*15]
mova [cq+128* 8], m23
mova [cq+128* 9], m22
mova [cq+128*10], m21
mova [cq+128*11], m20
mova [cq+128*12], m19
mova [cq+128*13], m18
mova [cq+128*14], m17
mova [cq+128*15], m16
ret
cglobal inv_txfm_add_identity_identity_32x32_10bpc, 4, 7, 16, dst, stride, c, eob
%undef cmp
vpbroadcastd m13, [pw_8192]
vpbroadcastd m15, [pixel_10bpc_max]
pxor m14, m14
lea r6, [strideq*9]
cmp eobd, 136
jl .main
mov r4, dstq
call .main
add cq, 64-128*4
lea dstq, [dstq+strideq*8]
call .main
add cq, 128*12-64
lea dstq, [r4+32]
cmp eobd, 543
jl .main
call .main
add cq, 64-128*4
lea dstq, [dstq+strideq*8]
.main:
call .main_internal
add cq, 128*4
pmulhrsw m1, m13, m2
pmulhrsw m3, m13, m4
pmulhrsw m5, m13, m6
pmulhrsw m7, m13, m8
call .main_internal
jmp m(inv_txfm_add_identity_identity_16x32_10bpc).main2
.main_internal:
mova m8, [cq+128* 0]
packssdw m8, [cq+128* 8]
mova m6, [cq+128* 1]
packssdw m6, [cq+128* 9]
mova m0, [cq+128* 2]
packssdw m0, [cq+128*10]
mova m2, [cq+128* 3]
packssdw m2, [cq+128*11]
REPX {vpermq x, x, q3120}, m8, m6, m0, m2
REPX {mova [cq+128*x], m14}, 0, 1, 2, 3
punpcklwd m4, m8, m6
punpckhwd m8, m6
punpcklwd m6, m0, m2
punpckhwd m0, m2
REPX {mova [cq+128*x], m14}, 8, 9, 10, 11
punpckldq m2, m4, m6 ; 0 1
punpckhdq m4, m6 ; 2 3
punpckldq m6, m8, m0 ; 4 5
punpckhdq m8, m0 ; 6 7
ret
cglobal inv_txfm_add_dct_dct_16x64_10bpc, 4, 7, 0, dst, stride, c, eob
lea r5, [o_base]
test eobd, eobd
jz .dconly
PROLOGUE 4, 7, 32, -8*mmsize, dst, stride, c, eob
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 36
jl .fast
call .pass1
cmp eobd, 151
jge .full
lea r5, [o_base_8bpc]
punpckhwd m22, m0, m0
punpckhwd m23, m1, m1
punpckhwd m24, m2, m2
punpckhwd m25, m3, m3
punpckhwd m26, m4, m4
punpckhwd m27, m5, m5
punpckhwd m28, m6, m6
punpckhwd m29, m7, m7
punpcklwd m21, m1, m1
punpcklwd m14, m3, m3
punpcklwd m18, m5, m5
punpcklwd m15, m7, m7
pxor m9, m9
punpcklwd m9, m9, m0
punpcklwd m8, m2, m2
punpcklwd m7, m4, m4
punpcklwd m1, m6, m6
call m(idct_16x16_internal_8bpc).main_fast2
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf_fast2
mova [rsp+mmsize*0], m14
mova [rsp+mmsize*1], m15
mova [rsp+mmsize*2], m16
mova [rsp+mmsize*3], m17
mova [rsp+mmsize*4], m18
mova [rsp+mmsize*5], m19
mova [rsp+mmsize*6], m20
mova [rsp+mmsize*7], m21
call m(inv_txfm_add_dct_dct_16x64_8bpc).main_oddhalf_fast
pxor m12, m12
mov r3d, 64*3
.zero_loop:
REPX {mova [cq+r3*8+128*x], m12}, 0, 1, 2, 3
sub r3d, 64
jge .zero_loop
jmp .pass2_end
.full:
mova [cq+128*0], m0
mova [cq+128*1], m1
mova [cq+128*2], m2
mova [cq+128*3], m3
mova [cq+128*4], m4
mova [cq+128*5], m5
mova [cq+128*6], m6
mova [cq+128*7], m7
add cq, 64
call .pass1
sub cq, 64
mova m22, [cq+128*0] ; 0 1
mova m23, [cq+128*1] ; 2 3
mova m24, [cq+128*2] ; 4 5
mova m25, [cq+128*3] ; 6 7
mova m26, [cq+128*4] ; 8 9
mova m27, [cq+128*5] ; 10 11
mova m28, [cq+128*6] ; 12 13
mova m29, [cq+128*7] ; 14 15
mova [cq+64* 8], m0
mova [cq+64* 9], m1
mova [cq+64*10], m2
mova [cq+64*11], m3
mova [cq+64*12], m4
mova [cq+64*13], m5
mova [cq+64*14], m6
mova [cq+64*15], m7
lea r5, [o_base_8bpc]
punpcklwd m20, m1, m1
punpcklwd m16, m3, m3
punpcklwd m19, m5, m5
punpcklwd m17, m7, m7
punpcklwd m8, m24, m24 ; 4
punpcklwd m5, m2, m2 ; 20
punpcklwd m1, m28, m28 ; 12
punpcklwd m7, m26, m26 ; 8
punpcklwd m3, m4, m4 ; 24
punpcklwd m4, m6, m6 ; 28
pxor m9, m9
punpcklwd m6, m9, m0 ; __ 16
mova m0, m4
punpcklwd m9, m9, m22 ; __ 0
call m(idct_16x16_internal_8bpc).main_fast
punpcklwd m21, m23, m23 ; 2
punpcklwd m15, m29, m29 ; 14
punpcklwd m18, m27, m27 ; 10
punpcklwd m14, m25, m25 ; 6
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf_fast
mova [rsp+mmsize*0], m14
mova [rsp+mmsize*1], m15
mova [rsp+mmsize*2], m16
mova [rsp+mmsize*3], m17
mova [rsp+mmsize*4], m18
mova [rsp+mmsize*5], m19
mova [rsp+mmsize*6], m20
mova [rsp+mmsize*7], m21
mova m21, [cq+64*15]
mova m14, [cq+64* 8]
mova m17, [cq+64*11]
mova m18, [cq+64*12]
mova m19, [cq+64*13]
mova m16, [cq+64*10]
mova m15, [cq+64* 9]
mova m20, [cq+64*14]
REPX {punpckhwd x, x}, m22, m21, m14, m29, m26, m17, m18, m25, \
m24, m19, m16, m27, m28, m15, m20, m23
call m(inv_txfm_add_dct_dct_16x64_8bpc).main_oddhalf
pxor m12, m12
mov r3d, 32*7
.full_zero_loop:
REPX {mova [cq+r3*8+64*x], m12}, 0, 1, 2, 3
sub r3d, 32
jge .full_zero_loop
jmp .pass2_end
.fast:
mova ym0, [cq+128*0]
mova ym2, [cq+128*4]
movshdup m8, [o(permB)]
mova ym1, [cq+128*2]
mova ym3, [cq+128*6]
mova ym4, [cq+128*1]
mova ym5, [cq+128*3]
mova ym6, [cq+128*5]
mova ym7, [cq+128*7]
vpermt2q m0, m8, m2 ; 0 4
vpermt2q m1, m8, m3 ; 2 6
vpermt2q m4, m8, m5 ; 1 3
vpermt2q m7, m8, m6 ; 7 5
call m(idct_8x8_internal_10bpc).main_fast
call m(idct_16x8_internal_10bpc).main_fast
vpbroadcastd m11, [o(pd_2)]
call m(idct_8x16_internal_10bpc).main_end2
mova m8, [o(idct8x32p)]
packssdw m0, m4
packssdw m1, m5
packssdw m2, m6
packssdw m3, m7
mova m6, [dup16_perm]
vpermb m0, m8, m0
vpermb m2, m8, m2
vprold m8, 16
vpermb m1, m8, m1
vpermb m3, m8, m3
punpckldq m4, m0, m2
punpckhdq m0, m2
punpckldq m2, m1, m3
punpckhdq m1, m3
punpckldq m21, m4, m2
punpckhdq m14, m4, m2
punpckldq m18, m0, m1
punpckhdq m15, m0, m1
vpord m7, m6, [o(pb_32)] {1to16}
vpermb m22, m7, m21 ; 1
pmovzxwd m9, ym21 ; 0
vpermb m8, m6, m18 ; 4
vpermb m24, m7, m18 ; 5
vpermb m21, m6, m14 ; 2
vpermb m23, m7, m14 ; 3
vpermb m14, m6, m15 ; 6
vpermb m25, m7, m15 ; 7
lea r5, [o_base_8bpc]
pslld m9, 16
pxor m7, m7
REPX {mova x, m7}, m1, m18, m15, m26, m27, m28, m29
call m(idct_16x16_internal_8bpc).main_fast2
call m(inv_txfm_add_dct_dct_16x32_8bpc).main_oddhalf_fast2
mova [rsp+mmsize*0], m14
mova [rsp+mmsize*1], m15
mova [rsp+mmsize*2], m16
mova [rsp+mmsize*3], m17
mova [rsp+mmsize*4], m18
mova [rsp+mmsize*5], m19
mova [rsp+mmsize*6], m20
mova [rsp+mmsize*7], m21
call m(inv_txfm_add_dct_dct_16x64_8bpc).main_oddhalf_fast
pxor m12, m12
REPX {mova [cq+128*x], ym12}, 0, 1, 2, 3, 4, 5, 6, 7
.pass2_end:
movshdup m30, [permC]
vpbroadcastd m11, [pw_2048]
vpbroadcastd m13, [pixel_10bpc_max]
lea r6, [strideq*3]
psrlq m31, m30, 8
vpermq m8, m30, m0
vpermq m9, m31, m1
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m2
vpermq m9, m31, m3
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m4
vpermq m9, m31, m5
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m6
vpermq m9, m31, m7
call m(idct_16x8_internal_10bpc).write_16x4
mova m1, [rsp+mmsize*0]
mova m2, [rsp+mmsize*1]
mova m3, [rsp+mmsize*2]
mova m4, [rsp+mmsize*3]
mova m5, [rsp+mmsize*4]
mova m6, [rsp+mmsize*5]
mova m7, [rsp+mmsize*6]
mova m8, [rsp+mmsize*7]
paddsw m0, m1, m21
psubsw m21, m1, m21
paddsw m1, m2, m20
psubsw m20, m2, m20
paddsw m2, m3, m19
psubsw m19, m3, m19
paddsw m3, m4, m18
psubsw m18, m4, m18
paddsw m4, m5, m17
psubsw m17, m5, m17
paddsw m5, m6, m16
psubsw m16, m6, m16
paddsw m6, m7, m15
psubsw m15, m7, m15
paddsw m7, m8, m14
psubsw m14, m8, m14
vpermq m8, m30, m0
vpermq m9, m31, m1
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m2
vpermq m9, m31, m3
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m4
vpermq m9, m31, m5
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m6
vpermq m9, m31, m7
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m14
vpermq m9, m31, m15
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m16
vpermq m9, m31, m17
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m18
vpermq m9, m31, m19
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m20
vpermq m9, m31, m21
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m22
vpermq m9, m31, m23
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m24
vpermq m9, m31, m25
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m26
vpermq m9, m31, m27
call m(idct_16x8_internal_10bpc).write_16x4
vpermq m8, m30, m28
vpermq m9, m31, m29
call m(idct_16x8_internal_10bpc).write_16x4
RET
.pass1:
mova m0, [cq+128* 0]
mova m1, [cq+128* 2]
mova m2, [cq+128* 4]
mova m3, [cq+128* 6]
mova m4, [cq+128* 8]
mova m5, [cq+128*10]
mova m6, [cq+128*12]
mova m7, [cq+128*14]
call m(idct_8x16_internal_10bpc).main
mova m16, [cq+128* 1]
mova m17, [cq+128* 3]
mova m18, [cq+128* 5]
mova m19, [cq+128* 7]
mova m20, [cq+128* 9]
mova m21, [cq+128*11]
mova m22, [cq+128*13]
mova m23, [cq+128*15]
call m(idct_16x16_internal_10bpc).main
call m(idct_16x16_internal_10bpc).main_end
jmp m(idct_16x16_internal_10bpc).main_end3
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 64
add r6d, 640
sar r6d, 10
jmp m(inv_txfm_add_dct_dct_16x8_10bpc).dconly2
cglobal inv_txfm_add_dct_dct_32x64_10bpc, 4, 7, 0, dst, stride, c, eob
lea r5, [o_base]
test eobd, eobd
jz .dconly
PROLOGUE 4, 7, 32, -64*40, dst, stride, c, eob
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 136
jl .fast
add cq, 64
cmp eobd, 543
jge .full
call .pass1_fast ; bottomright 16x16 zero
jmp .lefthalf
.full:
call .pass1
mov r3d, 16*28
.lefthalf:
mova [cq+128* 0], m27
mova [cq+128* 1], m14
mova [cq+128* 2], m28
mova [cq+128* 3], m15
mova [cq+128* 4], m22
mova [cq+128* 5], m23
mova [cq+128* 6], m24
mova [cq+128* 7], m25
mova [cq+128* 8], m0
mova [cq+128* 9], m26
mova [cq+128*10], m20
mova [cq+128*11], m21
mova [cq+128*12], m18
mova [cq+128*13], m16
mova [cq+128*14], m17
mova [cq+128*15], m3
sub cq, 64
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
call .pass1
call .pass2_start
pxor m31, m31
.right_zero_loop:
REPX {mova [cq+r3*8+64+128*x], m31}, 0, 1, 2, 3
sub r3d, 16*4
jge .right_zero_loop
mov r3d, 16*28
jmp .left_zero_loop
.pass2_start:
vpbroadcastd m10, [o(pd_2048)]
lea r5, [o_base_8bpc]
lea r4, [rsp+gprsize]
mova m1, [cq+128*15+64]
mova m2, [cq+128* 8+64]
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1
mova m0, m21
mova m1, [cq+128*12+64]
mova m2, [cq+128*11+64]
mova m3, m18
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1
mova m0, m20
mova m1, [cq+128*13+64]
mova m2, [cq+128*10+64]
mova m3, m16
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1
mova m0, m26
mova m1, [cq+128*14+64]
mova m2, [cq+128* 9+64]
mova m3, m17
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part2
mova m0, m27
mova m1, m28
mova m2, [cq+128* 0+64]
mova m3, [cq+128* 2+64]
mova m16, [cq+128* 1+64]
mova m17, [cq+128* 3+64]
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast
mova m26, [cq+128* 4+64]
mova m27, [cq+128* 5+64]
mova m28, [cq+128* 6+64]
mova m29, [cq+128* 7+64]
mova [rsp+64*32+gprsize], m14
mova [rsp+64*33+gprsize], m15
mova [rsp+64*34+gprsize], m16
mova [rsp+64*35+gprsize], m17
mova [rsp+64*36+gprsize], m18
mova [rsp+64*37+gprsize], m19
mova [rsp+64*38+gprsize], m20
mova [rsp+64*39+gprsize], m21
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf_fast
.fast: ; topleft 16x16 nonzero
cmp eobd, 36
jl .fast2
call .pass1_fast
vpbroadcastd m10, [o(pd_2048)]
call .pass2_fast_start
jmp .end
.fast2: ; topleft 8x8 nonzero
movshdup m7, [o(permB)]
mova ym0, [cq+128*0]
mova ym1, [cq+128*4]
mova ym4, [cq+128*2]
mova ym5, [cq+128*6]
mova ym16, [cq+128*1]
mova ym2, [cq+128*5]
mova ym3, [cq+128*3]
mova ym17, [cq+128*7]
mov r3d, 16*4
vpermq m0, m7, m0 ; 0 0
vpermq m1, m7, m1 ; 4 4
vpermt2q m4, m7, m5 ; 2 6
vpermt2q m16, m7, m2 ; 1 5
vpermt2q m17, m7, m3 ; 7 3
REPX {pmulld x, m12}, m0, m1, m4, m16, m17
REPX {paddd x, m13}, m0, m1, m4, m16, m17
REPX {psrad x, 12 }, m0, m1, m4, m16, m17
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast2
vpbroadcastd m11, [o(pd_1)]
call m(idct_16x16_internal_10bpc).main_end2
call m(inv_txfm_add_dct_dct_32x8_10bpc).transpose_8x32
punpcklqdq m27, m0, m2 ; 0
punpckhqdq m0, m2 ; 1
punpcklqdq m22, m3, m4 ; 2
punpckhqdq m26, m3, m4 ; 3
punpcklqdq m14, m5, m7 ; 4
punpckhqdq m20, m5, m7 ; 5
punpcklqdq m23, m6, m8 ; 6
punpckhqdq m21, m6, m8 ; 7
mova m10, m13
call .pass2_fast2_start
.end:
pxor m31, m31
.left_zero_loop:
REPX {mova [cq+r3*8+128*x], m31}, 0, 1, 2, 3
sub r3d, 16*4
jge .left_zero_loop
call .pass2_end
RET
.pass2_end:
DEFINE_ARGS dst, stride, _, dst2, stride32, stklo, stkhi
vpbroadcastd m30, [pixel_10bpc_max]
vpbroadcastd m13, [pw_2048]
mov stride32q, strideq
shl stride32q, 5
lea stkhiq, [rsp+31*mmsize+gprsize]
lea dst2q, [dstq+stride32q]
lea stkloq, [rsp+gprsize]
sub dst2q, strideq ; dst31
paddsw m8, m0, m29 ; t0[idct32]
psubsw m9, m0, m29 ; t31[idct32]
call .end_sumsub_write
paddsw m8, m1, m28 ; t1[idct32]
psubsw m9, m1, m28 ; t30[idct32]
call .end_sumsub_write
paddsw m8, m2, m27 ; t2[idct32]
psubsw m9, m2, m27 ; t29[idct32]
call .end_sumsub_write
paddsw m8, m3, m26 ; t3[idct32]
psubsw m9, m3, m26 ; t28[idct32]
call .end_sumsub_write
paddsw m8, m4, m25 ; t4[idct32]
psubsw m9, m4, m25 ; t27[idct32]
call .end_sumsub_write
paddsw m8, m5, m24 ; t5[idct32]
psubsw m9, m5, m24 ; t26[idct32]
call .end_sumsub_write
paddsw m8, m6, m23 ; t6[idct32]
psubsw m9, m6, m23 ; t25[idct32]
call .end_sumsub_write
paddsw m8, m7, m22 ; t7[idct32]
psubsw m9, m7, m22 ; t24[idct32]
call .end_sumsub_write
mova m0, [rsp+64*32+gprsize]
mova m1, [rsp+64*33+gprsize]
mova m2, [rsp+64*34+gprsize]
mova m3, [rsp+64*35+gprsize]
mova m4, [rsp+64*36+gprsize]
mova m5, [rsp+64*37+gprsize]
mova m6, [rsp+64*38+gprsize]
mova m7, [rsp+64*39+gprsize]
paddsw m8, m0, m21 ; t8[idct32]
psubsw m9, m0, m21 ; t23[idct32]
call .end_sumsub_write
paddsw m8, m1, m20 ; t9[idct32]
psubsw m9, m1, m20 ; t22[idct32]
call .end_sumsub_write
paddsw m8, m2, m19 ; t10[idct32]
psubsw m9, m2, m19 ; t21[idct32]
call .end_sumsub_write
paddsw m8, m3, m18 ; t11[idct32]
psubsw m9, m3, m18 ; t20[idct32]
call .end_sumsub_write
paddsw m8, m4, m17 ; t12[idct32]
psubsw m9, m4, m17 ; t19[idct32]
call .end_sumsub_write
paddsw m8, m5, m16 ; t13[idct32]
psubsw m9, m5, m16 ; t18[idct32]
call .end_sumsub_write
paddsw m8, m6, m15 ; t14[idct32]
psubsw m9, m6, m15 ; t17[idct32]
call .end_sumsub_write
paddsw m8, m7, m14 ; t15[idct32]
psubsw m9, m7, m14 ; t16[idct32]
; fall-through
.end_sumsub_write:
mova m10, [stkhiq] ; t63-n
mova m12, [stkloq] ; t32+n
psubsw m11, m8, m10 ; out63-n
paddsw m8, m10 ; out0 +n
psubsw m10, m9, m12 ; out32+n
paddsw m9, m12 ; out32-n
REPX {pmulhrsw x, m13}, m11, m8, m10, m9
paddw m8, [dstq]
paddw m9, [dst2q]
paddw m10, [dstq+stride32q]
paddw m11, [dst2q+stride32q]
REPX {pminsw x, m30}, m11, m8, m10, m9
REPX {pmaxsw x, m31}, m11, m8, m10, m9
mova [dstq ], m8
mova [dst2q ], m9
mova [dstq +stride32q], m10
mova [dst2q+stride32q], m11
add stkloq, mmsize
sub stkhiq, mmsize
add dstq, strideq
sub dst2q, strideq
ret
.pass2_fast_start:
lea r5, [o_base_8bpc]
lea r4, [rsp+gprsize]
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast
mova m0, m21
mova m3, m18
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast
mova m0, m20
mova m3, m16
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast
mova m0, m26
mova m3, m17
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part2
mova m0, m27
mova m1, m28
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast2
mova [rsp+64*32+gprsize], m14
mova [rsp+64*33+gprsize], m15
mova [rsp+64*34+gprsize], m16
mova [rsp+64*35+gprsize], m17
mova [rsp+64*36+gprsize], m18
mova [rsp+64*37+gprsize], m19
mova [rsp+64*38+gprsize], m20
mova [rsp+64*39+gprsize], m21
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf_fast2
.pass2_fast2_start:
lea r5, [o_base_8bpc]
lea r4, [rsp+gprsize]
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast2
mova m0, m21
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast2
mova m0, m20
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast2
mova m0, m26
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part1_fast2
call m(inv_txfm_add_dct_dct_32x64_8bpc).main_part2
mova m0, m27
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast3
mova [rsp+64*32+gprsize], m14
mova [rsp+64*33+gprsize], m15
mova [rsp+64*34+gprsize], m16
mova [rsp+64*35+gprsize], m17
mova [rsp+64*36+gprsize], m18
mova [rsp+64*37+gprsize], m19
mova [rsp+64*38+gprsize], m20
mova [rsp+64*39+gprsize], m21
jmp m(inv_txfm_add_dct_dct_32x32_8bpc).main_oddhalf_fast3
.dconly:
DEFINE_ARGS dst, stride, c, eob
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 64
jmp m(inv_txfm_add_dct_dct_32x16_10bpc).dconly3
.pass1_fast:
pmulld m0, m12, [cq+128* 0]
pmulld m1, m12, [cq+128* 4]
pmulld m2, m12, [cq+128* 8]
pmulld m3, m12, [cq+128*12]
mov r3d, 16*12
call m(idct_8x16_internal_10bpc).main_fast_rect2
pmulld m16, m12, [cq+128* 2]
pmulld m17, m12, [cq+128* 6]
pmulld m18, m12, [cq+128*10]
pmulld m19, m12, [cq+128*14]
call m(idct_16x16_internal_10bpc).main_fast_rect2
call .pass1_load_spill
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast_rect2
jmp .pass1_end
.pass1:
pmulld m0, m12, [cq+128* 0]
pmulld m1, m12, [cq+128* 4]
pmulld m2, m12, [cq+128* 8]
pmulld m3, m12, [cq+128*12]
pmulld m4, m12, [cq+128*16]
pmulld m5, m12, [cq+128*20]
pmulld m6, m12, [cq+128*24]
pmulld m7, m12, [cq+128*28]
call m(idct_8x16_internal_10bpc).main_rect2
pmulld m16, m12, [cq+128* 2]
pmulld m17, m12, [cq+128* 6]
pmulld m18, m12, [cq+128*10]
pmulld m19, m12, [cq+128*14]
pmulld m20, m12, [cq+128*18]
pmulld m21, m12, [cq+128*22]
pmulld m22, m12, [cq+128*26]
pmulld m23, m12, [cq+128*30]
call m(idct_16x16_internal_10bpc).main_rect2
call .pass1_load_spill
pmulld m16, m12, [cq+128*17]
pmulld m17, m12, [cq+128*19]
pmulld m18, m12, [cq+128*21]
pmulld m19, m12, [cq+128*23]
pmulld m20, m12, [cq+128*25]
pmulld m21, m12, [cq+128*27]
pmulld m22, m12, [cq+128*29]
pmulld m23, m12, [cq+128*31]
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_rect2
.pass1_end:
vpbroadcastd m11, [o(pd_1)]
lea r4, [cq+128*8]
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct32_pass1_end
punpcklqdq m27, m0, m20 ; 0
punpckhqdq m0, m20 ; 1
punpcklqdq m24, m5, m16 ; 10
punpckhqdq m16, m5, m16 ; 11
punpcklqdq m23, m3, m21 ; 6
punpckhqdq m21, m3, m21 ; 7
punpcklqdq m25, m7, m8 ; 14
punpckhqdq m3, m7, m8 ; 15
punpcklqdq m22, m15, m4 ; 2
punpckhqdq m26, m15, m4 ; 3
punpcklqdq m15, m6, m17 ; 12
punpckhqdq m17, m6, m17 ; 13
punpcklqdq m28, m14, m18 ; 8
punpckhqdq m18, m14, m18 ; 9
punpcklqdq m14, m2, m1 ; 4
punpckhqdq m20, m2, m1 ; 5
ret
.pass1_load_spill:
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
mova [cq+128* 0], m0
pmulld m0, m12, [cq+128* 1]
mova [cq+128* 1], m1
mova [cq+128* 2], m2
pmulld m1, m12, [cq+128* 3]
pmulld m2, m12, [cq+128* 5]
mova [cq+128* 3], m3
mova [cq+128* 4], m4
pmulld m3, m12, [cq+128* 7]
pmulld m4, m12, [cq+128* 9]
mova [cq+128* 5], m5
mova [cq+128* 6], m6
mova [cq+128* 7], m7
pmulld m5, m12, [cq+128*11]
pmulld m6, m12, [cq+128*13]
pmulld m7, m12, [cq+128*15]
mova [cq+128* 8], m23
mova [cq+128* 9], m22
mova [cq+128*10], m21
mova [cq+128*11], m20
mova [cq+128*12], m19
mova [cq+128*13], m18
mova [cq+128*14], m17
mova [cq+128*15], m16
ret
cglobal inv_txfm_add_dct_dct_64x16_10bpc, 4, 7, 0, dst, stride, c, eob
%undef cmp
lea r5, [o_base]
test eobd, eobd
jz .dconly
PROLOGUE 4, 7, 32, -64*32, dst, stride, c, eob
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 36
jl .fast ; 8x8
cmp eobd, 151
jge .full ; 16x16
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64]
mova m0, [cq+64* 1]
mova m3, [cq+64*15]
call .main_part1_fast
mova m0, [cq+64* 7]
mova m3, [cq+64* 9]
call .main_part1_fast
mova m0, [cq+64* 5]
mova m3, [cq+64*11]
call .main_part1_fast
mova m0, [cq+64* 3]
mova m3, [cq+64*13]
call .main_part1_fast
call .main_part2
mova m0, [cq+64* 0]
mova m1, [cq+64* 8]
mova m16, [cq+64* 4]
mova m17, [cq+64*12]
call m(idct_8x16_internal_10bpc).main_fast2
call m(idct_16x16_internal_10bpc).main_fast2
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
call .pass1_load_spill
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast2
mov r6d, 12*8
jmp .idct64_end
.full:
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64]
mova m0, [cq+64* 1]
mova m1, [cq+64*31]
mova m2, [cq+64*17]
mova m3, [cq+64*15]
call .main_part1
mova m0, [cq+64* 7]
mova m1, [cq+64*25]
mova m2, [cq+64*23]
mova m3, [cq+64* 9]
call .main_part1
mova m0, [cq+64* 5]
mova m1, [cq+64*27]
mova m2, [cq+64*21]
mova m3, [cq+64*11]
call .main_part1
mova m0, [cq+64* 3]
mova m1, [cq+64*29]
mova m2, [cq+64*19]
mova m3, [cq+64*13]
call .main_part1
call .main_part2
mova m0, [cq+64* 0]
mova m1, [cq+64* 8]
mova m2, [cq+64*16]
mova m3, [cq+64*24]
mova m16, [cq+64* 4]
mova m17, [cq+64*12]
mova m18, [cq+64*20]
mova m19, [cq+64*28]
call m(idct_8x16_internal_10bpc).main_fast
call m(idct_16x16_internal_10bpc).main_fast
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
call .pass1_load_spill
mova m4, [cq+64*18]
mova m5, [cq+64*22]
mova m6, [cq+64*26]
mova m7, [cq+64*30]
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast
mov r6d, 28*8
jmp .idct64_end
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 16
.dconly1:
add r6d, 640
sar r6d, 10
.dconly2:
vpbroadcastd m3, [o(dconly_10bpc)]
imul r6d, 181
add r6d, 2176
sar r6d, 12
vpbroadcastw m2, r6d
paddsw m2, m3
.dconly_loop:
paddsw m0, m2, [dstq+64*0]
paddsw m1, m2, [dstq+64*1]
psubusw m0, m3
psubusw m1, m3
mova [dstq+64*0], m0
mova [dstq+64*1], m1
add dstq, strideq
dec r3d
jg .dconly_loop
ret
.pass1_load_spill:
mova [cq+64* 0], m0
mova m0, [cq+64* 2]
mova [cq+64* 2], m1
mova m1, [cq+64* 6]
mova [cq+64* 4], m2
mova [cq+64* 6], m3
mova m2, [cq+64*10]
mova m3, [cq+64*14]
mova [cq+64* 8], m4
mova [cq+64*10], m5
mova [cq+64*12], m6
mova [cq+64*14], m7
mova [cq+64* 1], m23
mova [cq+64* 3], m22
mova [cq+64* 5], m21
mova [cq+64* 7], m20
mova [cq+64* 9], m19
mova [cq+64*11], m18
mova [cq+64*13], m17
mova [cq+64*15], m16
ret
ALIGN function_align
.main_part1_fast_rect2:
REPX {paddd x, m13}, m0, m3
REPX {psrad x, 12 }, m0, m3
.main_part1_fast:
pmulld m7, m0, [r4+4*0]{bcstd} ; t63a
pmulld m0, [r4+4*1]{bcstd} ; t32a
pmulld m4, m3, [r4+4*6]{bcstd} ; t60a
pmulld m3, [r4+4*7]{bcstd} ; t35a
vpbroadcastd m10, [r4+4*8]
vpbroadcastd m11, [r4+4*9]
REPX {paddd x, m13}, m7, m0, m4, m3
REPX {psrad x, 12 }, m7, m0, m4, m3
mova m8, m0
mova m1, m7
mova m6, m3
mova m2, m4
jmp .main_part1b
.main_part1_rect2:
REPX {paddd x, m13}, m0, m1, m2, m3
REPX {psrad x, 12 }, m0, m1, m2, m3
.main_part1: ; idct64 steps 1-5
; in1/31/17/15 -> t32a/33/34a/35/60/61a/62/63a
; in7/25/23/ 9 -> t56a/57/58a/59/36/37a/38/39a
; in5/27/21/11 -> t40a/41/42a/43/52/53a/54/55a
; in3/29/19/13 -> t48a/49/50a/51/44/45a/46/47a
pmulld m7, m0, [r4+4*0]{bcstd} ; t63a
pmulld m0, [r4+4*1]{bcstd} ; t32a
pmulld m6, m1, [r4+4*2]{bcstd} ; t62a
pmulld m1, [r4+4*3]{bcstd} ; t33a
pmulld m5, m2, [r4+4*4]{bcstd} ; t61a
pmulld m2, [r4+4*5]{bcstd} ; t34a
pmulld m4, m3, [r4+4*6]{bcstd} ; t60a
pmulld m3, [r4+4*7]{bcstd} ; t35a
vpbroadcastd m10, [r4+4*8]
vpbroadcastd m11, [r4+4*9]
REPX {paddd x, m13}, m7, m0, m6, m1, m5, m2, m4, m3
REPX {psrad x, 12 }, m0, m1, m7, m6, m2, m3, m5, m4
psubd m8, m0, m1 ; t33
paddd m0, m1 ; t32
psubd m1, m7, m6 ; t62
paddd m7, m6 ; t63
psubd m6, m3, m2 ; t34
paddd m3, m2 ; t35
psubd m2, m4, m5 ; t61
paddd m4, m5 ; t60
.main_part1b:
REPX {pmaxsd x, m14}, m8, m1, m6, m2
REPX {pminsd x, m15}, m8, m1, m6, m2
ITX_MULSUB_2D 1, 8, 5, 9, _, 13, 10, 11 ; t33a, t62a
ITX_MULSUB_2D 2, 6, 5, 9, _, 13, 10, 11, 2 ; t61a, t34a
REPX {pmaxsd x, m14}, m0, m3, m7, m4
REPX {pminsd x, m15}, m0, m3, m7, m4
vpbroadcastd m10, [r4+4*10]
vpbroadcastd m11, [r4+4*11]
psubd m5, m0, m3 ; t35a
paddd m0, m3 ; t32a
psubd m3, m7, m4 ; t60a
paddd m7, m4 ; t63a
psubd m4, m1, m6 ; t34
paddd m1, m6 ; t33
psubd m6, m8, m2 ; t61
paddd m8, m2 ; t62
REPX {pmaxsd x, m14}, m5, m3, m4, m6
REPX {pminsd x, m15}, m5, m3, m4, m6
ITX_MULSUB_2D 3, 5, 2, 9, _, 13, 10, 11 ; t35, t60
ITX_MULSUB_2D 6, 4, 2, 9, _, 13, 10, 11 ; t34a, t61a
REPX {pmaxsd x, m14}, m0, m7, m1, m8
REPX {pminsd x, m15}, m0, m7, m1, m8
add r4, 4*12
mova [r6-64*4], m0
mova [r6+64*3], m7
mova [r6-64*3], m1
mova [r6+64*2], m8
mova [r6-64*2], m6
mova [r6+64*1], m4
mova [r6-64*1], m3
mova [r6+64*0], m5
add r6, 64*8
ret
.main_part2: ; idct64 steps 6-9
lea r4, [r6+64*3]
sub r6, 64*4
vpbroadcastd m10, [pd_1567]
vpbroadcastd m11, [pd_3784]
.main_part2_loop:
mova m0, [r6-64*32] ; t32a
mova m1, [r4-64*24] ; t39a
mova m2, [r4-64*32] ; t63a
mova m3, [r6-64*24] ; t56a
mova m4, [r6-64*16] ; t40a
mova m5, [r4-64* 8] ; t47a
mova m6, [r4-64*16] ; t55a
mova m7, [r6-64* 8] ; t48a
psubd m8, m0, m1 ; t39
paddd m0, m1 ; t32
psubd m1, m2, m3 ; t56
paddd m2, m3 ; t63
psubd m3, m5, m4 ; t40
paddd m5, m4 ; t47
psubd m4, m7, m6 ; t55
paddd m7, m6 ; t48
REPX {pmaxsd x, m14}, m8, m1, m3, m4
REPX {pminsd x, m15}, m8, m1, m3, m4
ITX_MULSUB_2D 1, 8, 6, 9, _, 13, 10, 11 ; t39a, t56a
ITX_MULSUB_2D 4, 3, 6, 9, _, 13, 10, 11, 2 ; t55a, t40a
REPX {pmaxsd x, m14}, m0, m2, m5, m7
REPX {pminsd x, m15}, m0, m5, m2, m7
psubd m6, m2, m7 ; t48a
paddd m2, m7 ; t63a
psubd m7, m0, m5 ; t47a
paddd m0, m5 ; t32a
psubd m5, m8, m4 ; t55
paddd m8, m4 ; t56
psubd m4, m1, m3 ; t40
paddd m1, m3 ; t39
REPX {pmaxsd x, m14}, m6, m7, m5, m4
REPX {pminsd x, m15}, m6, m7, m5, m4
REPX {pmulld x, m12}, m6, m7, m5, m4
REPX {pmaxsd x, m14}, m2, m0, m8, m1
REPX {pminsd x, m15}, m2, m0, m8, m1
paddd m6, m13
paddd m5, m13
psubd m3, m6, m7 ; t47
paddd m6, m7 ; t48
psubd m7, m5, m4 ; t40a
paddd m5, m4 ; t55a
REPX {psrad x, 12}, m3, m6, m7, m5
mova [r4-64* 8], m2
mova [r6-64*32], m0
mova [r6-64* 8], m8
mova [r4-64*32], m1
mova [r4-64*24], m3
mova [r6-64*16], m6
mova [r6-64*24], m7
mova [r4-64*16], m5
add r6, 64
sub r4, 64
cmp r6, r4
jl .main_part2_loop
ret
.idct64_main_end:
%macro IDCT64_PASS1_END 9
mova m%5, [%9+%1*128] ; t0+n [idct32] + idct64 rounding
psubd m%6, m%5, m%2 ; out31-n [idct32] = t31-n [idct64]
paddd m%5, m%2 ; out0+n [idct32] = t0+n [idct64]
REPX {pmaxsd x, m14}, m%6, m%5
REPX {pminsd x, m15}, m%6, m%5
REPX {paddd x, m11}, m%6, m%5
mova m%2, [r3+%3*64] ; t32+n [idct64]
mova m%7, [r3+%4*64] ; t63-n [idct64]
psubd m%8, m%5, m%7 ; out63-n
paddd m%5, m%7 ; out0+n
psubd m%7, m%6, m%2 ; out32+n
paddd m%6, m%2 ; out31-n
REPX {vpsravd x, m11}, m%8, m%5, m%7, m%6
%endmacro
%macro IDCT64_PASS1_ENDx4 1
%assign %%m1 %1 ; t32+n
%assign %%m2 (7-%1) ; t39-n
%assign %%m3 (8+%1) ; t40+n
%assign %%m4 (15-%1) ; t47-n
%assign %%m5 (16+%1) ; t48+n
%assign %%m6 (23-%1) ; t55-n
%assign %%m7 (24+%1) ; t56+n
%assign %%m8 (31-%1) ; t63-n
%assign %%r1 %1 ; t16+n
%assign %%r2 (7-%1) ; t23-n
%assign %%r3 (16+%1) ; t24-n
%assign %%r4 (23-%1) ; t31-n
%assign %%c1 (%1) ; t0/8+n
%assign %%c2 (7-%1) ; t7/15-n
IDCT64_PASS1_END %%c1, %%r4, %%m1, %%m8, 24, 25, 26, 27, cq ; out0/31/32/63
IDCT64_PASS1_END %%c1, %%r1, %%m4, %%m5, 28, 29, 30, 31, r4 ; out15/16/47/48
packssdw m %+ %%r1, m24, m29
packssdw m %+ %%r4, m28, m25
packssdw m26, m31
packssdw m30, m27
mova [r3+%%m5*mmsize], m26
mova [r3+%%m8*mmsize], m30
IDCT64_PASS1_END %%c2, %%r3, %%m2, %%m7, 24, 25, 26, 27, cq ; out7/24/39/56
IDCT64_PASS1_END %%c2, %%r2, %%m3, %%m6, 28, 29, 30, 31, r4 ; out8/23/40/55
packssdw m %+ %%r2, m24, m29
packssdw m %+ %%r3, m28, m25
packssdw m26, m31
packssdw m30, m27
mova [r3+%%m6*mmsize], m26
mova [r3+%%m7*mmsize], m30
%endmacro
IDCT64_PASS1_ENDx4 0
IDCT64_PASS1_ENDx4 1
IDCT64_PASS1_ENDx4 2
IDCT64_PASS1_ENDx4 3
ret
.idct64_end:
vpbroadcastd m11, [o(pd_2)]
lea r4, [cq+64]
mov r3, rsp
lea r5, [o_base_8bpc]
call .idct64_main_end
pxor m12, m12
.zero_loop:
REPX {mova [cq+r6*8+64*x], m12}, 0, 1, 2, 3
sub r6d, 8*4
jge .zero_loop
lea r3, [strideq*3]
mov r4, dstq
call .pass2
mova m0, [rsp+16*mmsize]
mova m1, [rsp+17*mmsize]
mova m2, [rsp+18*mmsize]
mova m3, [rsp+19*mmsize]
mova m4, [rsp+20*mmsize]
mova m5, [rsp+21*mmsize]
mova m6, [rsp+22*mmsize]
mova m7, [rsp+23*mmsize]
mova m16, [rsp+24*mmsize]
mova m17, [rsp+25*mmsize]
mova m18, [rsp+26*mmsize]
mova m19, [rsp+27*mmsize]
mova m20, [rsp+28*mmsize]
mova m21, [rsp+29*mmsize]
mova m22, [rsp+30*mmsize]
mova m23, [rsp+31*mmsize]
lea dstq, [r4+64]
call .pass2
RET
.pass2:
psrlq m12, [permC], 24 ; 0 2 8 10 1 3 9 11
psrlq m13, m12, 32 ; 4 6 12 14 5 7 13 15
call m(inv_txfm_add_dct_dct_32x16_10bpc).transpose_16x32
punpckhqdq m19, m5, m16 ; 11
punpcklqdq m5, m16 ; 10
punpckhqdq m16, m2, m1 ; 5
punpcklqdq m2, m1 ; 4
punpcklqdq m1, m15, m4 ; 2
punpckhqdq m15, m4 ; 3
punpcklqdq m4, m14, m18 ; 8
punpckhqdq m18, m14, m18 ; 9
punpckhqdq m14, m0, m20 ; 1
punpcklqdq m0, m20 ; 0
punpckhqdq m20, m6, m17 ; 13
punpcklqdq m6, m17 ; 12
punpckhqdq m17, m3, m21 ; 7
punpcklqdq m3, m21 ; 6
punpckhqdq m21, m7, m8 ; 15
punpcklqdq m7, m8 ; 14
call m(inv_txfm_add_dct_dct_32x8_8bpc).main
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf
.write:
vpbroadcastd m11, [pw_2048]
pxor m12, m12
vpbroadcastd m13, [pixel_10bpc_max]
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x8
pmulhrsw m0, m11, m14
pmulhrsw m1, m11, m15
pmulhrsw m2, m11, m16
pmulhrsw m3, m11, m17
call m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
pmulhrsw m0, m11, m18
pmulhrsw m1, m11, m19
pmulhrsw m2, m11, m20
pmulhrsw m3, m11, m21
jmp m(inv_txfm_add_dct_dct_32x8_10bpc).write_32x4
.fast: ; 8x8 packed
movshdup m7, [o(permB)]
mova ym0, [cq+64*1]
mova ym2, [cq+64*5]
mova ym3, [cq+64*3]
mova ym1, [cq+64*7]
vpermt2q m0, m7, m2 ; 1 5
vpermt2q m1, m7, m3 ; 7 3
call .main_oddhalf_packed
mova [rsp+ 0*mmsize], m0
mova [rsp+ 1*mmsize], m1
mova [rsp+ 2*mmsize], m2
mova [rsp+ 3*mmsize], m3
mova [rsp+ 4*mmsize], m4
mova [rsp+ 5*mmsize], m5
mova [rsp+ 6*mmsize], m6
mova [rsp+ 7*mmsize], m7
mova [rsp+ 8*mmsize], m16
mova [rsp+ 9*mmsize], m17
mova [rsp+10*mmsize], m18
mova [rsp+11*mmsize], m19
mova [rsp+12*mmsize], m20
mova [rsp+13*mmsize], m21
mova [rsp+14*mmsize], m22
mova [rsp+15*mmsize], m23
movshdup m7, [o(permB)]
mova ym0, [cq+64*0]
mova ym4, [cq+64*4]
mova ym16, [cq+64*2]
mova ym5, [cq+64*6]
vpermt2q m16, m7, m5 ; 2 6
vpermq m0, m7, m0 ; 0 0
vpermq m4, m7, m4 ; 4 4
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast3
; m0-7,9,16-22 contain un-sumsub'ed dct32 output data
; zero input coefs
pxor m12, m12
REPX {mova [cq+x*64], ym12}, 0, 1, 2, 3, 4, 5, 6, 7
vpbroadcastd m11, [o(pd_2)]
call .main_end
lea r3, [strideq*3]
mov r4, dstq
call .pass2_fast
mova m0, m24
mova m1, m25
mova m2, m26
mova m3, m27
mova m4, m28
mova m5, m29
mova m6, m30
mova m7, m31
lea dstq, [r4+64]
lea r5, [o_base]
call .pass2_fast
RET
.pass2_fast:
call m(inv_txfm_add_dct_dct_32x8_10bpc).transpose_8x32
lea r5, [o_base_8bpc]
punpckhqdq m14, m0, m2 ; 1
punpcklqdq m0, m2 ; 0
punpcklqdq m1, m3, m4 ; 2
punpckhqdq m15, m3, m4 ; 3
punpcklqdq m2, m5, m7 ; 4
punpckhqdq m16, m5, m7 ; 5
punpcklqdq m3, m6, m8 ; 6
punpckhqdq m17, m6, m8 ; 7
call m(inv_txfm_add_dct_dct_32x16_8bpc).main_oddhalf_fast
jmp .write
.main_end:
%macro IDCT64_PASS1_PACKED_END 7
psubd m%5, m%1, m%2 ; out31-n [idct32] = t31-n [idct64]
paddd m%1, m%2 ; out0+n [idct32] = t0+n [idct64]
REPX {pmaxsd x, m14}, m%5, m%1
REPX {pminsd x, m15}, m%5, m%1
REPX {paddd x, m11}, m%5, m%1
mova m%2, [rsp+%6*64+gprsize] ; t32+n [idct64]
mova m%3, [rsp+%7*64+gprsize] ; t63-n [idct64]
psubd m%4, m%1, m%3 ; out63-n
paddd m%1, m%3 ; out0+n
psubd m%3, m%5, m%2 ; out32+n
paddd m%2, m%5 ; out31-n
REPX {vpsravd x, m11}, m%4, m%1, m%3, m%2
%endmacro
IDCT64_PASS1_PACKED_END 0, 22, 24, 10, 12, 0, 15 ; out0/1,31/30,32/33,63/62
IDCT64_PASS1_PACKED_END 7, 9, 31, 13, 12, 7, 8 ; out15/14,16/17,47/46,48/49
packssdw m0, m9
packssdw m7, m22
packssdw m24, m13
packssdw m31, m10
IDCT64_PASS1_PACKED_END 1, 21, 25, 10, 12, 1, 14 ; out3/2,28/29,35/34,60/61
IDCT64_PASS1_PACKED_END 6, 16, 30, 13, 12, 6, 9 ; out12/13,19/18,44/45,51/50
packssdw m1, m16
packssdw m6, m21
packssdw m25, m13
packssdw m30, m10
IDCT64_PASS1_PACKED_END 2, 20, 26, 10, 12, 2, 13 ; out4/5,27/26,36/37,59/58
IDCT64_PASS1_PACKED_END 5, 17, 29, 13, 12, 5, 10 ; out11/10,20/21,43/42,52/53
packssdw m2, m17
packssdw m5, m20
packssdw m26, m13
packssdw m29, m10
IDCT64_PASS1_PACKED_END 3, 19, 27, 10, 12, 3, 12 ; out7/6,24/25,39/38,56/57
IDCT64_PASS1_PACKED_END 4, 18, 28, 13, 12, 4, 11 ; out8/9,23/22,40/41,55/54
packssdw m3, m18
packssdw m4, m19
packssdw m27, m13
packssdw m28, m10
ret
.main_oddhalf_packed_rect2:
REPX {paddd x, m13}, m0, m1
REPX {psrad x, 12 }, m0, m1
.main_oddhalf_packed:
; m0=in1 in5, m1=in7 in3
vbroadcasti32x4 m2, [o(pd_101_501)]
vbroadcasti32x4 m3, [o(pd_m700_m301)]
vbroadcasti32x4 m4, [o(pd_4095_4065)]
vbroadcasti32x4 m5, [o(pd_4036_4085)]
pmulld m2, m0
pmulld m3, m1
pmulld m0, m4
pmulld m1, m5
REPX {paddd x, m13}, m2, m3, m0, m1
REPX {psrad x, 12 }, m2, m3, m0, m1
; m2=t32a t40a -> t32/33 t40/41, m3=t39a t47a -> t38/39 t46/47
; m0=t63a t55a -> t62/63 t54/55, m1=t56a t48a -> t56/57 t48/49
; end of step 1-2
vbroadcasti32x4 m10, [o(pd_401_1931)]
vbroadcasti32x4 m11, [o(pd_4076_3612)]
mova m4, m0
mova m5, m2
ITX_MULSUB_2D 4, 5, 8, 9, _, 13, 10, 11
vbroadcasti32x4 m10, [o(pd_3166_3920)]
vbroadcasti32x4 m11, [o(pd_2598_1189)]
mova m6, m3
mova m7, m1
ITX_MULSUB_2D 7, 6, 8, 9, _, 13, 10, 11, 2
; m4=t33a t41a -> t41/42 t33/34, m5=t63a t54a -> t61/62 t53/54
; m6=t38a t46a -> t37/38 t45/46, m7=t57a t49a -> t57/58 t49/50
; and from earlier:
; m0=t63 t55 -> t60/63a t52/55a, m1=t56 t48 -> t56/59a t48/51a
; m2=t32 t40 -> t32/35a t40/43a, m3=t39 t47 -> t36/39a t44/47a
; end of step 3-4
punpcklqdq m22, m2, m4 ; t32a/33 or t35a/34
punpcklqdq m21, m3, m6 ; t36a/37 or t39a/38
punpckhqdq m18, m2, m4 ; t40a/41 or t43a/42
punpckhqdq m17, m3, m6 ; t44a/45 or t47a/46
punpckhqdq m6, m1, m7 ; t48a/49 or t51a/50
punpckhqdq m19, m0, m5 ; t52a/53 or t55a/54
punpcklqdq m8, m1, m7 ; t56a/57 or t59a/58
punpcklqdq m23, m0, m5 ; t60a/61 or t63a/62
mova m0, m22
mova m7, m21
mova m3, m18
mova m16, m17
mova m5, m6
mova m4, m19
mova m2, m8
mova m1, m23
; m0/22/7/21,18/3/17/16,6/5/19/4,2/8/1/23: t32-63[a]
; step5
vpbroadcastd m10, [o(pd_799)]
vpbroadcastd m11, [o(pd_4017)]
ITX_MULSUB_2D 1, 22, 20, 9, _, 13, 10, 11 ; t35/34a, t60/61a
ITX_MULSUB_2D 8, 7, 20, 9, _, 13, 10, 11, 2 ; t59/58a, t36/37a
vpbroadcastd m10, [o(pd_3406)]
vpbroadcastd m11, [o(pd_2276)]
ITX_MULSUB_2D 19, 3, 20, 9, _, 13, 10, 11 ; t43/42a, t52/53a
ITX_MULSUB_2D 5, 17, 20, 9, _, 13, 10, 11, 2 ; t51/50a, t44/45a
; m0-1/7/21: t32-39[a], m18-19/17-16: t40-47[a]
; m6-5/3-4: t48-55[a], m2/8/22-23: t56-63[a]
; step6
psubd m20, m0, m21 ; t39/38a
paddd m0, m21 ; t32/33a
psubd m21, m1, m7 ; t36a/37
paddd m1, m7 ; t35a/34
REPX {pmaxsd x, m14}, m20, m0, m21, m1
psubd m7, m16, m18 ; t40/41a
paddd m16, m18 ; t47/46a
REPX {pminsd x, m15}, m20, m0, m21, m1
psubd m18, m17, m19 ; t43a/42
paddd m17, m19 ; t44a/45
REPX {pmaxsd x, m14}, m7, m16, m18, m17
psubd m19, m6, m4 ; t55/54a
paddd m6, m4 ; t48/49a
REPX {pminsd x, m15}, m7, m16, m18, m17
psubd m4, m5, m3 ; t52a/53
paddd m5, m3 ; t51a/50
REPX {pmaxsd x, m14}, m19, m6, m4, m5
psubd m3, m23, m2 ; t56/57a
paddd m23, m2 ; t63/62a
REPX {pminsd x, m15}, m19, m6, m4, m5
psubd m2, m22, m8 ; t59a/58
paddd m22, m8 ; t60a/61
REPX {pmaxsd x, m14}, m3, m23, m2, m22
REPX {pminsd x, m15}, m3, m23, m2, m22
; m0-1: t32-35[a], m17-16: t44-47[a], m6-5: t48-51[a], m22-23: t60-63[a]
; m21-20: t36-39[a], m7/18: t40-43[a], m4/19: t52-55[a], m3-2: t56-59[a]
; step7
vpbroadcastd m10, [o(pd_1567)]
vpbroadcastd m11, [o(pd_3784)]
ITX_MULSUB_2D 2, 21, 8, 9, _, 13, 10, 11 ; t36/37a, t59/58a
ITX_MULSUB_2D 3, 20, 8, 9, _, 13, 10, 11 ; t39a/38, t56a/57
ITX_MULSUB_2D 19, 7, 8, 9, _, 13, 10, 11, 2 ; t55a/54, t40a/41
ITX_MULSUB_2D 4, 18, 8, 9, _, 13, 10, 11, 2 ; t52/53a, t43/42a
; m0-3: t32-39[a], m7,18-16: t40-47[a], m6-4,19: t48-55[a], m20-23: t56-63[a]
; step8
psubd m8, m0, m16 ; t47a/46
paddd m0, m16 ; t32a/33
psubd m16, m1, m17 ; t44/45a
paddd m1, m17 ; t35/34a
REPX {pmaxsd x, m14}, m8, m0, m16, m1
psubd m17, m2, m18 ; t43a/42
paddd m2, m18 ; t36a/37
REPX {pminsd x, m15}, m8, m0, m16, m1
psubd m18, m3, m7 ; t40/41a
paddd m3, m7 ; t39/38a
REPX {pmaxsd x, m14}, m17, m2, m18, m3
psubd m7, m23, m6 ; t48a/49
paddd m23, m6 ; t63a/62
REPX {pminsd x, m15}, m17, m2, m18, m3
psubd m6, m22, m5 ; t51/50a
paddd m22, m5 ; t60/61a
REPX {pmaxsd x, m14}, m7, m23, m6, m22
psubd m5, m21, m4 ; t52a/53
paddd m21, m4 ; t59a/58
REPX {pminsd x, m15}, m7, m23, m6, m22
psubd m4, m20, m19 ; t55/54a
paddd m20, m19 ; t56/57a
REPX {pmaxsd x, m14}, m5, m21, m4, m20
REPX {pminsd x, m15}, m5, m21, m4, m20
; m0-3=t32-39[a], m18-16,8: t40-47[a], m7-4=t48-55[a], m20-23=t56-63[a]
; step9
REPX {pmulld x, m12}, m4, m18, m5, m17, m6, m16, m7, m8
REPX {paddd x, m13}, m4, m5, m6, m7
paddd m19, m4, m18 ; t55a/54
psubd m4, m18 ; t40a/41
paddd m18, m5, m17 ; t52/53a
psubd m5, m17 ; t43/42a
paddd m17, m6, m16 ; t51a/50
psubd m6, m16 ; t44a/45
paddd m16, m7, m8 ; t48/49a
psubd m7, m8 ; t47/46a
REPX {psrad x, 12 }, m19, m4, m18, m5, m17, m6, m16, m7
; m4-7=t40-47[a], m16-19=t48-55[a]
ret
cglobal inv_txfm_add_dct_dct_64x32_10bpc, 4, 7, 0, dst, stride, c, eob
lea r5, [o_base]
test eobd, eobd
jz .dconly
PROLOGUE 4, 8, 32, -64*32, dst, stride, c, eob
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 136
jl .fast
add cq, 64
cmp eobd, 543
jge .full
call .pass1_fast ; bottomright 16x16 zero
mov r7d, 16*12
jmp .lefthalf
.full:
call .pass1
mov r7d, 16*28
.lefthalf:
mova [cq+128* 0], m0
mova [cq+128* 1], m1
mova [cq+128* 2], m2
mova [cq+128* 3], m3
mova [cq+128* 4], m14
mova [cq+128* 5], m15
mova [cq+128* 6], m16
mova [cq+128* 7], m17
mova [cq+128* 8], m22
mova [cq+128* 9], m23
mova [cq+128*10], m24
mova [cq+128*11], m25
mova [cq+128*12], m26
mova [cq+128*13], m27
mova [cq+128*14], m28
mova [cq+128*15], m29
sub cq, 64
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
sub rsp, 16*64
call .pass1
add rsp, 16*64
lea r5, [o_base_8bpc]
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_start
mov r4, dstq
pxor m12, m12
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_end
lea dstq, [r4+64]
mova m0, [rsp+16*mmsize]
mova m1, [rsp+17*mmsize]
mova m2, [rsp+18*mmsize]
mova m3, [rsp+19*mmsize]
mova m4, [rsp+20*mmsize]
mova m5, [rsp+21*mmsize]
mova m6, [rsp+22*mmsize]
mova m7, [rsp+23*mmsize]
mova m16, [rsp+24*mmsize]
mova m17, [rsp+25*mmsize]
mova m18, [rsp+26*mmsize]
mova m19, [rsp+27*mmsize]
mova m20, [rsp+28*mmsize]
mova m21, [rsp+29*mmsize]
mova m22, [rsp+30*mmsize]
mova m23, [rsp+31*mmsize]
call .transpose
mova [cq+128* 0+64], m0
mova [cq+128* 1+64], m1
mova [cq+128* 2+64], m2
mova [cq+128* 3+64], m3
mova [cq+128* 4+64], m14
mova [cq+128* 5+64], m15
mova [cq+128* 6+64], m16
mova [cq+128* 7+64], m17
mova [cq+128* 8+64], m22
mova [cq+128* 9+64], m23
mova [cq+128*10+64], m24
mova [cq+128*11+64], m25
mova [cq+128*12+64], m26
mova [cq+128*13+64], m27
mova [cq+128*14+64], m28
mova [cq+128*15+64], m29
mova m0, [rsp+ 0*mmsize]
mova m1, [rsp+ 1*mmsize]
mova m2, [rsp+ 2*mmsize]
mova m3, [rsp+ 3*mmsize]
mova m4, [rsp+ 4*mmsize]
mova m5, [rsp+ 5*mmsize]
mova m6, [rsp+ 6*mmsize]
mova m7, [rsp+ 7*mmsize]
mova m16, [rsp+ 8*mmsize]
mova m17, [rsp+ 9*mmsize]
mova m18, [rsp+10*mmsize]
mova m19, [rsp+11*mmsize]
mova m20, [rsp+12*mmsize]
mova m21, [rsp+13*mmsize]
mova m22, [rsp+14*mmsize]
mova m23, [rsp+15*mmsize]
call .transpose
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_start
pxor m12, m12
.right_zero_loop:
mova [cq+r7*8+64+128*3], m12
mova [cq+r7*8+64+128*2], m12
mova [cq+r7*8+64+128*1], m12
mova [cq+r7*8+64+128*0], m12
sub r7d, 16*4
jge .right_zero_loop
mov r7d, 16*28
jmp .end
.fast: ; topleft 16x16 nonzero
cmp eobd, 36
jl .fast2
call .pass1_fast
lea r5, [o_base_8bpc]
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_fast_start
mov r4, dstq
pxor m12, m12
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_end
lea dstq, [r4+64]
mova m0, [rsp+16*mmsize]
mova m1, [rsp+17*mmsize]
mova m2, [rsp+18*mmsize]
mova m3, [rsp+19*mmsize]
mova m4, [rsp+20*mmsize]
mova m5, [rsp+21*mmsize]
mova m6, [rsp+22*mmsize]
mova m7, [rsp+23*mmsize]
mova m16, [rsp+24*mmsize]
mova m17, [rsp+25*mmsize]
mova m18, [rsp+26*mmsize]
mova m19, [rsp+27*mmsize]
mova m20, [rsp+28*mmsize]
mova m21, [rsp+29*mmsize]
mova m22, [rsp+30*mmsize]
mova m23, [rsp+31*mmsize]
call .transpose
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_fast_start
mov r7d, 16*12
pxor m12, m12
jmp .end
.fast2: ; topleft 8x8 nonzero
movshdup m7, [o(permB)]
mova ym0, [cq+128*1]
mova ym2, [cq+128*5]
mova ym3, [cq+128*3]
mova ym1, [cq+128*7]
vpermt2q m0, m7, m2 ; 1 5
vpermt2q m1, m7, m3 ; 7 3
REPX {pmulld x, m12}, m0, m1
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_oddhalf_packed_rect2
mova [rsp+ 0*mmsize], m0
mova [rsp+ 1*mmsize], m1
mova [rsp+ 2*mmsize], m2
mova [rsp+ 3*mmsize], m3
mova [rsp+ 4*mmsize], m4
mova [rsp+ 5*mmsize], m5
mova [rsp+ 6*mmsize], m6
mova [rsp+ 7*mmsize], m7
mova [rsp+ 8*mmsize], m16
mova [rsp+ 9*mmsize], m17
mova [rsp+10*mmsize], m18
mova [rsp+11*mmsize], m19
mova [rsp+12*mmsize], m20
mova [rsp+13*mmsize], m21
mova [rsp+14*mmsize], m22
mova [rsp+15*mmsize], m23
movshdup m7, [o(permB)]
pmulld ym0, ym12, [cq+128*0]
pmulld ym4, ym12, [cq+128*4]
mova ym16, [cq+128*2]
mova ym5, [cq+128*6]
REPX {paddd x, ym13}, ym0, ym4
REPX {psrad x, 12 }, ym0, ym4
vpermt2q m16, m7, m5 ; 2 6
vpermq m0, m7, m0 ; 0 0
vpermq m4, m7, m4 ; 4 4
pmulld m16, m12
paddd m16, m13
psrad m16, 12
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast3
vpbroadcastd m11, [o(pd_1)]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_end
mova [rsp+16*mmsize], m24
mova [rsp+17*mmsize], m25
mova [rsp+18*mmsize], m26
mova [rsp+19*mmsize], m27
mova [rsp+20*mmsize], m28
mova [rsp+21*mmsize], m29
mova [rsp+22*mmsize], m30
mova [rsp+23*mmsize], m31
vpbroadcastd m13, [o(pd_2048)]
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_fast2_start
mov r7d, 16*4
mov r4, dstq
pxor m12, m12
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_end
lea dstq, [r4+64]
mova m0, [rsp+16*mmsize]
mova m1, [rsp+17*mmsize]
mova m2, [rsp+18*mmsize]
mova m3, [rsp+19*mmsize]
mova m4, [rsp+20*mmsize]
mova m5, [rsp+21*mmsize]
mova m6, [rsp+22*mmsize]
mova m7, [rsp+23*mmsize]
lea r5, [o_base]
vpbroadcastd m13, [o(pd_2048)]
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_fast2_start
pxor m12, m12
.end:
call m(inv_txfm_add_dct_dct_32x32_10bpc).pass2_end
.zero_loop:
mova [cq+r7*8+128*3], m12
mova [cq+r7*8+128*2], m12
mova [cq+r7*8+128*1], m12
mova [cq+r7*8+128*0], m12
sub r7d, 16*4
jge .zero_loop
RET
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 32
add r6d, 128
sar r6d, 8
imul r6d, 181
add r6d, 384
sar r6d, 9
jmp m(inv_txfm_add_dct_dct_64x16_10bpc).dconly2
.pass1_fast:
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64+gprsize]
pmulld m0, m12, [cq+128* 1]
pmulld m3, m12, [cq+128*15]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast_rect2
pmulld m0, m12, [cq+128* 7]
pmulld m3, m12, [cq+128* 9]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast_rect2
pmulld m0, m12, [cq+128* 5]
pmulld m3, m12, [cq+128*11]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast_rect2
pmulld m0, m12, [cq+128* 3]
pmulld m3, m12, [cq+128*13]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast_rect2
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part2
pmulld m0, m12, [cq+128* 0]
pmulld m1, m12, [cq+128* 8]
pmulld m16, m12, [cq+128* 4]
pmulld m17, m12, [cq+128*12]
call m(idct_8x16_internal_10bpc).main_fast2_rect2
call m(idct_16x16_internal_10bpc).main_fast2_rect2
call .pass1_load_spill
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast2_rect2
jmp .pass1_end
.pass1:
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64+gprsize]
pmulld m0, m12, [cq+128* 1]
pmulld m1, m12, [cq+128*31]
pmulld m2, m12, [cq+128*17]
pmulld m3, m12, [cq+128*15]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_rect2
pmulld m0, m12, [cq+128* 7]
pmulld m1, m12, [cq+128*25]
pmulld m2, m12, [cq+128*23]
pmulld m3, m12, [cq+128* 9]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_rect2
pmulld m0, m12, [cq+128* 5]
pmulld m1, m12, [cq+128*27]
pmulld m2, m12, [cq+128*21]
pmulld m3, m12, [cq+128*11]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_rect2
pmulld m0, m12, [cq+128* 3]
pmulld m1, m12, [cq+128*29]
pmulld m2, m12, [cq+128*19]
pmulld m3, m12, [cq+128*13]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_rect2
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part2
pmulld m0, m12, [cq+128* 0]
pmulld m1, m12, [cq+128* 8]
pmulld m2, m12, [cq+128*16]
pmulld m3, m12, [cq+128*24]
pmulld m16, m12, [cq+128* 4]
pmulld m17, m12, [cq+128*12]
pmulld m18, m12, [cq+128*20]
pmulld m19, m12, [cq+128*28]
call m(idct_8x16_internal_10bpc).main_fast_rect2
call m(idct_16x16_internal_10bpc).main_fast_rect2
call .pass1_load_spill
pmulld m4, m12, [cq+128*18]
pmulld m5, m12, [cq+128*22]
pmulld m6, m12, [cq+128*26]
pmulld m7, m12, [cq+128*30]
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast_rect2
.pass1_end:
vpbroadcastd m11, [o(pd_1)]
lea r3, [rsp+gprsize]
lea r4, [cq+8*128]
call m(inv_txfm_add_dct_dct_64x16_10bpc).idct64_main_end
; transpose one half immediately, we can transpose lower half later
.transpose:
; transpose m0-7,16-23
psrlq m12, [permC], 24 ; 0 2 8 10 1 3 9 11
psrlq m13, m12, 32 ; 4 6 12 14 5 7 13 15
call m(inv_txfm_add_dct_dct_32x16_10bpc).transpose_16x32
punpckhqdq m22, m0, m20 ; 1
punpcklqdq m0, m20 ; 0
punpckhqdq m24, m2, m1 ; 5
punpcklqdq m1, m2, m1 ; 4
punpcklqdq m2, m14, m18 ; 8
punpckhqdq m26, m14, m18 ; 9
punpcklqdq m14, m15, m4 ; 2
punpckhqdq m23, m15, m4 ; 3
punpckhqdq m25, m3, m21 ; 7
punpcklqdq m15, m3, m21 ; 6
punpckhqdq m28, m6, m17 ; 13
punpcklqdq m3, m6, m17 ; 12
punpckhqdq m27, m5, m16 ; 11
punpcklqdq m16, m5, m16 ; 10
punpckhqdq m29, m7, m8 ; 15
punpcklqdq m17, m7, m8 ; 14
ret
.pass1_load_spill:
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
mova [cq+128* 0], m0
mova [cq+128* 1], m1
pmulld m0, m12, [cq+128* 2]
pmulld m1, m12, [cq+128* 6]
mova [cq+128* 2], m2
mova [cq+128* 3], m3
pmulld m2, m12, [cq+128*10]
pmulld m3, m12, [cq+128*14]
mova [cq+128* 4], m4
mova [cq+128* 5], m5
mova [cq+128* 6], m6
mova [cq+128* 7], m7
mova [cq+128* 8], m23
mova [cq+128* 9], m22
mova [cq+128*10], m21
mova [cq+128*11], m20
mova [cq+128*12], m19
mova [cq+128*13], m18
mova [cq+128*14], m17
mova [cq+128*15], m16
ret
cglobal inv_txfm_add_dct_dct_64x64_10bpc, 4, 7, 0, dst, stride, c, eob
lea r5, [o_base]
test eobd, eobd
jz .dconly
PROLOGUE 4, 9, 32, -64*32, dst, stride, c, eob
%undef cmp
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
cmp eobd, 136
jl .fast
add cq, 64
cmp eobd, 543
jge .full
call .pass1_fast ; bottomright 16x16 zero
mov r7d, 16*12
jmp .lefthalf
.full:
call .pass1
mov r7d, 16*28
.lefthalf:
mova [cq+128* 0], m27
mova [cq+128* 1], m14
mova [cq+128* 2], m28
mova [cq+128* 3], m15
mova [cq+128* 4], m22
mova [cq+128* 5], m23
mova [cq+128* 6], m24
mova [cq+128* 7], m25
mova [cq+128* 8], m0
mova [cq+128* 9], m26
mova [cq+128*10], m20
mova [cq+128*11], m21
mova [cq+128*12], m18
mova [cq+128*13], m16
mova [cq+128*14], m17
mova [cq+128*15], m3
sub cq, 64
vpbroadcastd m12, [o(pd_2896)]
vpbroadcastd m13, [o(pd_2048)]
vpbroadcastd m14, [o(clip_18b_min)]
vpbroadcastd m15, [o(clip_18b_max)]
sub rsp, 16*64
call .pass1
sub rsp, 24*64
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_start
mov r8, dstq
pxor m31, m31
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_end
lea dstq, [r8+64]
mova m0, [rsp+56*mmsize]
mova m1, [rsp+57*mmsize]
mova m2, [rsp+58*mmsize]
mova m3, [rsp+59*mmsize]
mova m4, [rsp+60*mmsize]
mova m5, [rsp+61*mmsize]
mova m6, [rsp+62*mmsize]
mova m7, [rsp+63*mmsize]
mova m16, [rsp+64*mmsize]
mova m17, [rsp+65*mmsize]
mova m18, [rsp+66*mmsize]
mova m19, [rsp+67*mmsize]
mova m20, [rsp+68*mmsize]
mova m21, [rsp+69*mmsize]
mova m22, [rsp+70*mmsize]
mova m23, [rsp+71*mmsize]
call .transpose
mova [cq+128* 0+64], m27
mova [cq+128* 1+64], m14
mova [cq+128* 2+64], m28
mova [cq+128* 3+64], m15
mova [cq+128* 4+64], m22
mova [cq+128* 5+64], m23
mova [cq+128* 6+64], m24
mova [cq+128* 7+64], m25
mova [cq+128* 8+64], m0
mova [cq+128* 9+64], m26
mova [cq+128*10+64], m20
mova [cq+128*11+64], m21
mova [cq+128*12+64], m18
mova [cq+128*13+64], m16
mova [cq+128*14+64], m17
mova [cq+128*15+64], m3
mova m0, [rsp+40*mmsize]
mova m1, [rsp+41*mmsize]
mova m2, [rsp+42*mmsize]
mova m3, [rsp+43*mmsize]
mova m4, [rsp+44*mmsize]
mova m5, [rsp+45*mmsize]
mova m6, [rsp+46*mmsize]
mova m7, [rsp+47*mmsize]
mova m16, [rsp+48*mmsize]
mova m17, [rsp+49*mmsize]
mova m18, [rsp+50*mmsize]
mova m19, [rsp+51*mmsize]
mova m20, [rsp+52*mmsize]
mova m21, [rsp+53*mmsize]
mova m22, [rsp+54*mmsize]
mova m23, [rsp+55*mmsize]
add rsp, 32*64
call .transpose
lea r5, [o_base]
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_start
.right_zero_loop:
REPX {mova [cq+r7*8+64+128*x], m31}, 0, 1, 2, 3
sub r7d, 16*4
jge .right_zero_loop
mov r7d, 16*28
jmp .end
.fast: ; topleft 16x16 nonzero
cmp eobd, 36
jl .fast2
call .pass1_fast
sub rsp, 24*64
vpbroadcastd m10, [o(pd_2048)]
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_fast_start
mov r8, dstq
pxor m31, m31
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_end
lea dstq, [r8+64]
mova m0, [rsp+40*mmsize]
mova m1, [rsp+41*mmsize]
mova m2, [rsp+42*mmsize]
mova m3, [rsp+43*mmsize]
mova m4, [rsp+44*mmsize]
mova m5, [rsp+45*mmsize]
mova m6, [rsp+46*mmsize]
mova m7, [rsp+47*mmsize]
mova m16, [rsp+48*mmsize]
mova m17, [rsp+49*mmsize]
mova m18, [rsp+50*mmsize]
mova m19, [rsp+51*mmsize]
mova m20, [rsp+52*mmsize]
mova m21, [rsp+53*mmsize]
mova m22, [rsp+54*mmsize]
mova m23, [rsp+55*mmsize]
add rsp, 16*64
call .transpose
lea r5, [o_base]
vpbroadcastd m10, [o(pd_2048)]
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_fast_start
mov r7d, 16*12
jmp .end
.fast2: ; topleft 8x8 nonzero
movshdup m7, [o(permB)]
mova ym0, [cq+128*1]
mova ym2, [cq+128*5]
mova ym3, [cq+128*3]
mova ym1, [cq+128*7]
vpermt2q m0, m7, m2 ; 1 5
vpermt2q m1, m7, m3 ; 7 3
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_oddhalf_packed
mova [rsp+ 0*mmsize], m0
mova [rsp+ 1*mmsize], m1
mova [rsp+ 2*mmsize], m2
mova [rsp+ 3*mmsize], m3
mova [rsp+ 4*mmsize], m4
mova [rsp+ 5*mmsize], m5
mova [rsp+ 6*mmsize], m6
mova [rsp+ 7*mmsize], m7
mova [rsp+ 8*mmsize], m16
mova [rsp+ 9*mmsize], m17
mova [rsp+10*mmsize], m18
mova [rsp+11*mmsize], m19
mova [rsp+12*mmsize], m20
mova [rsp+13*mmsize], m21
mova [rsp+14*mmsize], m22
mova [rsp+15*mmsize], m23
movshdup m7, [o(permB)]
mova ym0, [cq+128*0]
mova ym4, [cq+128*4]
mova ym16, [cq+128*2]
mova ym5, [cq+128*6]
vpermt2q m16, m7, m5 ; 2 6
vpermq m0, m7, m0 ; 0 0
vpermq m4, m7, m4 ; 4 4
call m(inv_txfm_add_dct_dct_32x8_10bpc).main_fast3
vpbroadcastd m11, [o(pd_2)]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_end
sub rsp, 16*64
mova [rsp+40*mmsize], m24
mova [rsp+41*mmsize], m25
mova [rsp+42*mmsize], m26
mova [rsp+43*mmsize], m27
mova [rsp+44*mmsize], m28
mova [rsp+45*mmsize], m29
mova [rsp+46*mmsize], m30
mova [rsp+47*mmsize], m31
call .pass2_fast2_start
mov r7d, 16*4
mov r8, dstq
pxor m31, m31
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_end
lea dstq, [r8+64]
mova m0, [rsp+40*mmsize]
mova m1, [rsp+41*mmsize]
mova m2, [rsp+42*mmsize]
mova m3, [rsp+43*mmsize]
mova m4, [rsp+44*mmsize]
mova m5, [rsp+45*mmsize]
mova m6, [rsp+46*mmsize]
mova m7, [rsp+47*mmsize]
add rsp, 8*64
lea r5, [o_base]
call .pass2_fast2_start
.end:
pxor m31, m31
.zero_loop:
REPX {mova [cq+r7*8+128*x], m31}, 0, 1, 2, 3
sub r7d, 16*4
jge .zero_loop
call m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_end
add rsp, 8*64 ; FIXME adjust stack_size_padded instead?
RET
.pass2_fast2_start:
call m(inv_txfm_add_dct_dct_32x8_10bpc).transpose_8x32
punpcklqdq m27, m0, m2 ; 0
punpckhqdq m0, m2 ; 1
punpcklqdq m22, m3, m4 ; 2
punpckhqdq m26, m3, m4 ; 3
punpcklqdq m14, m5, m7 ; 4
punpckhqdq m20, m5, m7 ; 5
punpcklqdq m23, m6, m8 ; 6
punpckhqdq m21, m6, m8 ; 7
vpbroadcastd m10, [o(pd_2048)]
jmp m(inv_txfm_add_dct_dct_32x64_10bpc).pass2_fast2_start
.dconly:
imul r6d, [cq], 181
mov [cq], eobd
or r3d, 64
jmp m(inv_txfm_add_dct_dct_64x16_10bpc).dconly1
.pass1_fast:
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64+gprsize]
mova m0, [cq+128* 1]
mova m3, [cq+128*15]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast
mova m0, [cq+128* 7]
mova m3, [cq+128* 9]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast
mova m0, [cq+128* 5]
mova m3, [cq+128*11]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast
mova m0, [cq+128* 3]
mova m3, [cq+128*13]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1_fast
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part2
mova m0, [cq+128* 0]
mova m1, [cq+128* 8]
mova m16, [cq+128* 4]
mova m17, [cq+128*12]
call m(idct_8x16_internal_10bpc).main_fast2
call m(idct_16x16_internal_10bpc).main_fast2
call .pass1_load_spill
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast2
jmp .pass1_end
.pass1:
lea r4, [idct64_mul_16bpc]
lea r6, [rsp+4*64+gprsize]
mova m0, [cq+128* 1]
mova m1, [cq+128*31]
mova m2, [cq+128*17]
mova m3, [cq+128*15]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1
mova m0, [cq+128* 7]
mova m1, [cq+128*25]
mova m2, [cq+128*23]
mova m3, [cq+128* 9]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1
mova m0, [cq+128* 5]
mova m1, [cq+128*27]
mova m2, [cq+128*21]
mova m3, [cq+128*11]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1
mova m0, [cq+128* 3]
mova m1, [cq+128*29]
mova m2, [cq+128*19]
mova m3, [cq+128*13]
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part1
call m(inv_txfm_add_dct_dct_64x16_10bpc).main_part2
mova m0, [cq+128* 0]
mova m1, [cq+128* 8]
mova m2, [cq+128*16]
mova m3, [cq+128*24]
mova m16, [cq+128* 4]
mova m17, [cq+128*12]
mova m18, [cq+128*20]
mova m19, [cq+128*28]
call m(idct_8x16_internal_10bpc).main_fast
call m(idct_16x16_internal_10bpc).main_fast
call .pass1_load_spill
mova m4, [cq+128*18]
mova m5, [cq+128*22]
mova m6, [cq+128*26]
mova m7, [cq+128*30]
call m(inv_txfm_add_dct_dct_32x16_10bpc).main_fast
.pass1_end:
vpbroadcastd m11, [o(pd_2)]
lea r3, [rsp+gprsize]
lea r4, [cq+8*128]
call m(inv_txfm_add_dct_dct_64x16_10bpc).idct64_main_end
; transpose one half immediately, we can transpose lower half later
.transpose:
; transpose m0-7,16-23
psrlq m12, [permC], 24 ; 0 2 8 10 1 3 9 11
psrlq m13, m12, 32 ; 4 6 12 14 5 7 13 15
call m(inv_txfm_add_dct_dct_32x16_10bpc).transpose_16x32
punpcklqdq m27, m0, m20 ; 0
punpckhqdq m0, m20 ; 1
punpcklqdq m24, m5, m16 ; 10
punpckhqdq m16, m5, m16 ; 11
punpcklqdq m23, m3, m21 ; 6
punpckhqdq m21, m3, m21 ; 7
punpcklqdq m25, m7, m8 ; 14
punpckhqdq m3, m7, m8 ; 15
punpcklqdq m22, m15, m4 ; 2
punpckhqdq m26, m15, m4 ; 3
punpcklqdq m15, m6, m17 ; 12
punpckhqdq m17, m6, m17 ; 13
punpcklqdq m28, m14, m18 ; 8
punpckhqdq m18, m14, m18 ; 9
punpcklqdq m14, m2, m1 ; 4
punpckhqdq m20, m2, m1 ; 5
ret
.pass1_load_spill:
call m(inv_txfm_add_dct_dct_32x16_10bpc).idct16_sumsub
mova [cq+128* 0], m0
mova [cq+128* 1], m1
mova m0, [cq+128* 2]
mova m1, [cq+128* 6]
mova [cq+128* 2], m2
mova [cq+128* 3], m3
mova m2, [cq+128*10]
mova m3, [cq+128*14]
mova [cq+128* 4], m4
mova [cq+128* 5], m5
mova [cq+128* 6], m6
mova [cq+128* 7], m7
mova [cq+128* 8], m23
mova [cq+128* 9], m22
mova [cq+128*10], m21
mova [cq+128*11], m20
mova [cq+128*12], m19
mova [cq+128*13], m18
mova [cq+128*14], m17
mova [cq+128*15], m16
ret
%endif ; ARCH_X86_64
|