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
|
/**
* VP8 ARMv6 optimisations
*
* Copyright (c) 2011 The WebM project authors. All Rights Reserved.
* Copyright (c) 2010 Rob Clark <rob@ti.com>
* Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* This code was partially ported from libvpx, which uses this license:
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*
* (Note that the "LICENSE", "AUTHORS" and "PATENTS" files can be
* found in the libvpx source tree.)
*/
#include "asm.S"
@ idct
@ void vp8_luma_dc_wht(DCTELEM block[4][4][16], DCTELEM dc[16])
function ff_vp8_luma_dc_wht_armv6, export=1
push {r4 - r10, lr}
@ load dc[] and zero memory
mov r12, #0
ldr r2, [r1] @ dc0[0,1]
ldr r3, [r1, #4] @ dc0[2,3]
ldr r4, [r1, #8] @ dc1[0,1]
ldr r5, [r1, #12] @ dc1[2,3]
ldr r6, [r1, #16] @ dc2[0,1]
ldr r7, [r1, #20] @ dc2[2,3]
ldr r8, [r1, #24] @ dc3[0,1]
ldr r9, [r1, #28] @ dc3[2,3]
str r12,[r1]
str r12,[r1, #4]
str r12,[r1, #8]
str r12,[r1, #12]
str r12,[r1, #16]
str r12,[r1, #20]
str r12,[r1, #24]
str r12,[r1, #28]
@ loop1
uadd16 r12, r2, r8 @ t0[0,1]
uadd16 r14, r3, r9 @ t0[2,3]
usub16 r2, r2, r8 @ t3[0,1]
usub16 r3, r3, r9 @ t3[2,3]
uadd16 r8, r4, r6 @ t1[0,1]
uadd16 r9, r5, r7 @ t1[2,3]
usub16 r4, r4, r6 @ t2[0,1]
usub16 r5, r5, r7 @ t2[2,3]
uadd16 r6, r12, r8 @ dc0[0,1]
uadd16 r7, r14, r9 @ dc0[2,3]
usub16 r12, r12, r8 @ dc2[0,1]
usub16 r14, r14, r9 @ dc2[2,3]
uadd16 r8, r2, r4 @ dc1[0,1]
uadd16 r9, r3, r5 @ dc1[2,3]
usub16 r2, r2, r4 @ dc3[0,1]
usub16 r3, r3, r5 @ dc3[2,3]
mov r1, #3
orr r1, r1, #0x30000 @ 3 | 3 (round)
@ "transpose"
pkhbt r4, r6, r8, lsl #16 @ dc{0,1}[0]
pkhtb r6, r8, r6, asr #16 @ dc{0,1}[1]
pkhbt r5, r12, r2, lsl #16 @ dc{2,3}[0]
pkhtb r12, r2, r12, asr #16 @ dc{2,3}[1]
pkhbt r8, r7, r9, lsl #16 @ dc{0,1}[2]
uadd16 r4, r4, r1
uadd16 r5, r5, r1
pkhtb r7, r9, r7, asr #16 @ dc{0,1}[3]
pkhbt r2, r14, r3, lsl #16 @ dc{2,3}[2]
pkhtb r14, r3, r14, asr #16 @ dc{2,3}[3]
@ loop2
uadd16 r9, r4, r7 @ t0[0,1]
uadd16 r3, r5, r14 @ t0[2,3]
usub16 r4, r4, r7 @ t3[0,1]
usub16 r5, r5, r14 @ t3[2,3]
uadd16 r7, r6, r8 @ t1[0,1]
uadd16 r14, r12, r2 @ t1[2,3]
usub16 r6, r6, r8 @ t2[0,1]
usub16 r12, r12, r2 @ t2[2,3]
uadd16 r8, r9, r7 @ block[0,1][0]
uadd16 r2, r3, r14 @ block[2,3][0]
usub16 r9, r9, r7 @ block[0,1][2]
usub16 r3, r3, r14 @ block[2,3][2]
uadd16 r7, r4, r6 @ block[0,1][1]
uadd16 r14, r5, r12 @ block[2,3][1]
usub16 r4, r4, r6 @ block[0,1][3]
usub16 r5, r5, r12 @ block[2,3][3]
@ store
mov r6, r8, asr #19 @ block[1][0]
mov r12, r7, asr #19 @ block[1][1]
mov r1, r9, asr #19 @ block[1][2]
mov r10, r4, asr #19 @ block[1][3]
sxth r8, r8
sxth r7, r7
sxth r9, r9
sxth r4, r4
asr r8, #3 @ block[0][0]
asr r7, #3 @ block[0][1]
asr r9, #3 @ block[0][2]
asr r4, #3 @ block[0][3]
strh r8, [r0], #32
strh r7, [r0], #32
strh r9, [r0], #32
strh r4, [r0], #32
strh r6, [r0], #32
strh r12,[r0], #32
strh r1, [r0], #32
strh r10,[r0], #32
mov r6, r2, asr #19 @ block[3][0]
mov r12, r14, asr #19 @ block[3][1]
mov r1, r3, asr #19 @ block[3][2]
mov r10, r5, asr #19 @ block[3][3]
sxth r2, r2
sxth r14, r14
sxth r3, r3
sxth r5, r5
asr r2, #3 @ block[2][0]
asr r14, #3 @ block[2][1]
asr r3, #3 @ block[2][2]
asr r5, #3 @ block[2][3]
strh r2, [r0], #32
strh r14,[r0], #32
strh r3, [r0], #32
strh r5, [r0], #32
strh r6, [r0], #32
strh r12,[r0], #32
strh r1, [r0], #32
strh r10,[r0], #32
pop {r4 - r10, pc}
endfunc
@ void vp8_luma_dc_wht_dc(DCTELEM block[4][4][16], DCTELEM dc[16])
function ff_vp8_luma_dc_wht_dc_armv6, export=1
ldrsh r2, [r1]
mov r3, #0
add r2, r2, #3
strh r3, [r1]
asr r2, r2, #3
.rept 16
strh r2, [r0], #32
.endr
bx lr
endfunc
@ void vp8_idct_add(uint8_t *dst, DCTELEM block[16], int stride)
function ff_vp8_idct_add_armv6, export=1
push {r4 - r11, lr}
sub sp, sp, #32
mov r3, #0x00004E00 @ cos
orr r3, r3, #0x0000007B @ cospi8sqrt2minus1 = 20091
mov r4, #0x00008A00 @ sin
orr r4, r4, #0x0000008C @ sinpi8sqrt2 = 35468
mov r5, #0x2 @ i=2
1:
ldr r6, [r1, #8] @ i5 | i4 = block1[1] | block1[0]
ldr r12,[r1, #24] @ i13 | i12 = block3[1] | block3[0]
ldr r14,[r1, #16] @ i9 | i8 = block2[1] | block2[0]
smulwt r9, r3, r6 @ (ip[5] * cospi8sqrt2minus1) >> 16
smulwb r7, r3, r6 @ (ip[4] * cospi8sqrt2minus1) >> 16
smulwt r10, r4, r6 @ (ip[5] * sinpi8sqrt2) >> 16
smulwb r8, r4, r6 @ (ip[4] * sinpi8sqrt2) >> 16
pkhbt r7, r7, r9, lsl #16 @ 5c | 4c
smulwt r11, r3, r12 @ (ip[13] * cospi8sqrt2minus1) >> 16
pkhbt r8, r8, r10, lsl #16 @ 5s | 4s = t2 first half
uadd16 r6, r6, r7 @ 5c+5 | 4c+4 = t3 first half
smulwt r7, r4, r12 @ (ip[13] * sinpi8sqrt2) >> 16
smulwb r9, r3, r12 @ (ip[12] * cospi8sqrt2minus1) >> 16
smulwb r10, r4, r12 @ (ip[12] * sinpi8sqrt2) >> 16
subs r5, r5, #1 @ i--
pkhbt r9, r9, r11, lsl #16 @ 13c | 12c
ldr r11,[r1] @ i1 | i0
pkhbt r10, r10, r7, lsl #16 @ 13s | 12s = t3 second half
uadd16 r7, r12, r9 @ 13c+13 | 12c+12 = t2 second half
usub16 r7, r8, r7 @ c = t2
uadd16 r6, r6, r10 @ d = t3
uadd16 r10, r11, r14 @ a = t0
usub16 r8, r11, r14 @ b = t1
uadd16 r9, r10, r6 @ a+d = tmp{0,1}[0]
usub16 r10, r10, r6 @ a-d = tmp{0,1}[3]
uadd16 r6, r8, r7 @ b+c = tmp{0,1}[1]
usub16 r7, r8, r7 @ b-c = tmp{0,1}[2]
mov r8, #0
str r6, [sp, #8] @ o5 | o4
str r7, [sp, #16] @ o9 | o8
str r10,[sp, #24] @ o13 | o12
str r9, [sp], #4 @ o1 | o0
str r8, [r1, #24]
str r8, [r1, #16]
str r8, [r1, #8]
str r8, [r1], #4
bne 1b
mov r5, #0x2 @ i=2
sub sp, sp, #8
2:
ldr r6, [sp, #8] @ i5 | i4 = tmp{0,1}[1]
ldr r14,[sp, #4] @ i3 | i2 = tmp{2,3}[0]
ldr r12,[sp, #12] @ i7 | i6 = tmp{2,3}[1]
ldr r1, [sp], #16 @ i1 | i0 = tmp{0,1}[0]
smulwt r9, r3, r6 @ (ip[5] * cospi8sqrt2minus1) >> 16
smulwt r7, r3, r1 @ (ip[1] * cospi8sqrt2minus1) >> 16
smulwt r10, r4, r6 @ (ip[5] * sinpi8sqrt2) >> 16
smulwt r8, r4, r1 @ (ip[1] * sinpi8sqrt2) >> 16
pkhbt r11, r1, r6, lsl #16 @ i4 | i0 = t0/t1 first half
pkhbt r7, r7, r9, lsl #16 @ 5c | 1c
pkhbt r8, r8, r10, lsl #16 @ 5s | 1s = temp1 = t2 first half
pkhtb r1, r6, r1, asr #16 @ i5 | i1
uadd16 r1, r7, r1 @ 5c+5 | 1c+1 = temp2 (d) = t3 first half
pkhbt r9, r14, r12, lsl #16 @ i6 | i2 = t0/t1 second half
uadd16 r10, r11, r9 @ a = t0
usub16 r9, r11, r9 @ b = t1
pkhtb r6, r12, r14, asr #16 @ i7 | i3
subs r5, r5, #0x1 @ i--
smulwt r7, r3, r6 @ (ip[7] * cospi8sqrt2minus1) >> 16
smulwt r11, r4, r6 @ (ip[7] * sinpi8sqrt2) >> 16
smulwb r12, r3, r6 @ (ip[3] * cospi8sqrt2minus1) >> 16
smulwb r14, r4, r6 @ (ip[3] * sinpi8sqrt2) >> 16
pkhbt r7, r12, r7, lsl #16 @ 7c | 3c
pkhbt r11, r14, r11, lsl #16 @ 7s | 3s = temp1 (d) = t3 second half
mov r14, #0x4 @ set up 4's
orr r14, r14, #0x40000 @ 4|4
uadd16 r6, r7, r6 @ 7c+7 | 3c+3 = temp2 (c) = t2 second half
usub16 r12, r8, r6 @ c (o5 | o1) = t2
uadd16 r6, r11, r1 @ d (o7 | o3) = t3
uadd16 r10, r10, r14 @ t0 + 4
uadd16 r9, r9, r14 @ t1 + 4
uadd16 r7, r10, r6 @ a+d = dst{0,1}[0]
usub16 r6, r10, r6 @ a-d = dst{0,1}[3]
uadd16 r10, r9, r12 @ b+c = dst{0,1}[1]
usub16 r1, r9, r12 @ b-c = dst{0,1}[2]
mov r9, r6, asr #3 @ o[1][3]
mov r12, r1, asr #3 @ o[1][2]
pkhtb r8, r12, r7, asr #19 @ o[1][0,2]
pkhtb r11, r9, r10, asr #19 @ o[1][1,3]
ldr r12,[r0]
ldr r9, [r0, r2]
sxth r7, r7
sxth r6, r6
sxth r10, r10
sxth r1, r1
asr r7, #3 @ o[0][0]
asr r10, #3 @ o[0][1]
pkhbt r7, r7, r1, lsl #13 @ o[0][0,2]
pkhbt r10, r10, r6, lsl #13 @ o[0][1,3]
uxtab16 r7, r7, r12
uxtab16 r10, r10, r12, ror #8
uxtab16 r8, r8, r9
uxtab16 r11, r11, r9, ror #8
usat16 r7, #8, r7
usat16 r10, #8, r10
usat16 r8, #8, r8
usat16 r11, #8, r11
orr r7, r7, r10, lsl #8
orr r8, r8, r11, lsl #8
str r8, [r0, r2]
str_post r7, r0, r2, lsl #1
bne 2b
pop {r4 - r11, pc}
endfunc
@ void vp8_idct_dc_add(uint8_t *dst, DCTELEM block[16], int stride)
function ff_vp8_idct_dc_add_armv6, export=1
push {r4 - r5, lr}
ldrsh r3, [r1]
mov r4, #0
add r3, r3, #4
asr r3, #3
strh r4, [r1], #32
ldr r4, [r0, r2]
ldr_post r5, r0, r2, lsl #1
pkhbt r3, r3, r3, lsl #16
uxtab16 lr, r3, r5 @ a1+2 | a1+0
uxtab16 r5, r3, r5, ror #8 @ a1+3 | a1+1
uxtab16 r12, r3, r4
uxtab16 r4, r3, r4, ror #8
usat16 lr, #8, lr
usat16 r5, #8, r5
usat16 r12, #8, r12
usat16 r4, #8, r4
orr lr, lr, r5, lsl #8
orr r12, r12, r4, lsl #8
ldr r5, [r0]
ldr r4, [r0, r2]
sub r0, r0, r2, lsl #1
str r12,[r0, r2]
str_post lr, r0, r2, lsl #1
uxtab16 lr, r3, r5
uxtab16 r5, r3, r5, ror #8
uxtab16 r12, r3, r4
uxtab16 r4, r3, r4, ror #8
usat16 lr, #8, lr
usat16 r5, #8, r5
usat16 r12, #8, r12
usat16 r4, #8, r4
orr lr, lr, r5, lsl #8
orr r12, r12, r4, lsl #8
str r12,[r0, r2]
str_post lr, r0, r2, lsl #1
pop {r4 - r5, pc}
endfunc
@ void vp8_idct_dc_add4uv(uint8_t *dst, DCTELEM block[4][16], int stride)
function ff_vp8_idct_dc_add4uv_armv6, export=1
push {lr}
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, r2, lsl #2
add r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, r2, lsl #2
add r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
pop {pc}
endfunc
@ void vp8_idct_dc_add4y(uint8_t *dst, DCTELEM block[4][16], int stride)
function ff_vp8_idct_dc_add4y_armv6, export=1
push {lr}
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, r2, lsl #2
add r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, r2, lsl #2
add r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
sub r0, r0, r2, lsl #2
add r0, r0, #4
bl ff_vp8_idct_dc_add_armv6
pop {pc}
endfunc
@ loopfilter
@ void vp8_v_loop_filter16_simple(uint8_t *dst, int stride, int flim)
function ff_vp8_v_loop_filter16_simple_armv6, export=1
push {r4 - r11, lr}
ldr_dpren r3, r0, r1, lsl #1 @ p1
ldr_dpren r4, r0, r1 @ p0
ldr r5, [r0] @ q0
ldr r6, [r0, r1] @ q1
orr r2, r2, r2, lsl #16
mov r9, #4 @ count
mov lr, #0 @ need 0 in a couple places
orr r12, r2, r2, lsl #8 @ splat int -> byte
ldr r2, c0x80808080
1:
@ vp8_simple_filter_mask()
uqsub8 r7, r3, r6 @ p1 - q1
uqsub8 r8, r6, r3 @ q1 - p1
uqsub8 r10, r4, r5 @ p0 - q0
uqsub8 r11, r5, r4 @ q0 - p0
orr r8, r8, r7 @ abs(p1 - q1)
orr r10, r10, r11 @ abs(p0 - q0)
uqadd8 r10, r10, r10 @ abs(p0 - q0) * 2
uhadd8 r8, r8, lr @ abs(p1 - q2) >> 1
uqadd8 r10, r10, r8 @ abs(p0 - q0)*2 + abs(p1 - q1)/2
mvn r8, #0
usub8 r10, r12, r10 @ compare to flimit. usub8 sets GE flags
sel r10, r8, lr @ filter mask: F or 0
cmp r10, #0
beq 2f @ skip filtering if all masks are 0x00
@ vp8_simple_filter()
eor r3, r3, r2 @ p1 offset to convert to a signed value
eor r6, r6, r2 @ q1 offset to convert to a signed value
eor r4, r4, r2 @ p0 offset to convert to a signed value
eor r5, r5, r2 @ q0 offset to convert to a signed value
qsub8 r3, r3, r6 @ vp8_filter = p1 - q1
qsub8 r6, r5, r4 @ q0 - p0
qadd8 r3, r3, r6 @ += q0 - p0
ldr r7, c0x04040404
qadd8 r3, r3, r6 @ += q0 - p0
ldr r8, c0x03030303
qadd8 r3, r3, r6 @ vp8_filter = p1-q1 + 3*(q0-p0))
@STALL
and r3, r3, r10 @ vp8_filter &= mask
qadd8 r7, r3, r7 @ Filter1 = vp8_filter + 4
qadd8 r8, r3, r8 @ Filter2 = vp8_filter + 3
shadd8 r7, r7, lr
shadd8 r8, r8, lr
shadd8 r7, r7, lr
shadd8 r8, r8, lr
shadd8 r7, r7, lr @ Filter1 >>= 3
shadd8 r8, r8, lr @ Filter2 >>= 3
qsub8 r5, r5, r7 @ u = q0 - Filter1
qadd8 r4, r4, r8 @ u = p0 + Filter2
eor r5, r5, r2 @ *oq0 = u^0x80
eor r4, r4, r2 @ *op0 = u^0x80
T sub r7, r0, r1
str r5, [r0] @ store oq0 result
A str r4, [r0, -r1] @ store op0 result
T str r4, [r7]
2:
subs r9, r9, #1 @ counter--
add r0, r0, #4 @ next row
T itttt ne
A ldrne r3, [r0, -r1, lsl #1] @ p1
T subne r3, r0, r1, lsl #1
T ldrne r3, [r3] @ p1
A ldrne r4, [r0, -r1] @ p0
T subne r4, r0, r1
T ldrne r4, [r4] @ p0
T itt ne
ldrne r5, [r0] @ q0
ldrne r6, [r0, r1] @ q1
bne 1b
pop {r4 - r11, pc}
endfunc
c0x01010101: .long 0x01010101
c0x03030303: .long 0x03030303
c0x04040404: .long 0x04040404
c0x7F7F7F7F: .long 0x7F7F7F7F
c0x80808080: .long 0x80808080
@ void vp8_v_loop_filter16_inner(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh)
@ and
@ void vp8_v_loop_filter8uv_inner(uint8_t *dstU, uint8_t *dstV, int stride,
@ int fE, int fI, int hev_thresh)
@ call:
@ void vp8_v_loop_filter_inner(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh, int count)
function ff_vp8_v_loop_filter_inner_armv6, export=1
push {r4 - r11, lr}
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
ldr r5, [sp, #40] @ counter
ldr r6, [sp, #36] @ load thresh address
sub sp, sp, #16 @ create temp buffer
ldr r10,[r0, r1] @ p2
ldr_post r9, r0, r1, lsl #1 @ p3
ldr r12,[r0, r1] @ p0
ldr_post r11, r0, r1, lsl #1 @ p1
orr r2, r2, r2, lsl #16
orr r3, r3, r3, lsl #16
orr r6, r6, r6, lsl #16
orr r4, r2, r2, lsl #8 @ flimE splat int -> byte
orr r2, r3, r3, lsl #8 @ flimI splat int -> byte
orr r3, r6, r6, lsl #8 @ thresh splat int -> byte
1:
@ vp8_filter_mask() function
@ calculate breakout conditions
uqsub8 r6, r9, r10 @ p3 - p2
uqsub8 r7, r10, r9 @ p2 - p3
uqsub8 r8, r10, r11 @ p2 - p1
uqsub8 r10, r11, r10 @ p1 - p2
orr r6, r6, r7 @ abs (p3-p2)
orr r8, r8, r10 @ abs (p2-p1)
uqsub8 lr, r6, r2 @ compare to limit. lr: vp8_filter_mask
uqsub8 r8, r8, r2 @ compare to limit
uqsub8 r6, r11, r12 @ p1 - p0
orr lr, lr, r8
uqsub8 r7, r12, r11 @ p0 - p1
ldr r10,[r0, r1] @ q1
ldr_post r9, r0, r1, lsl #1 @ q0
orr r6, r6, r7 @ abs (p1-p0)
uqsub8 r7, r6, r2 @ compare to limit
uqsub8 r8, r6, r3 @ compare to thresh -- save r8 for later
orr lr, lr, r7
uqsub8 r6, r11, r10 @ p1 - q1
uqsub8 r7, r10, r11 @ q1 - p1
uqsub8 r11, r12, r9 @ p0 - q0
uqsub8 r12, r9, r12 @ q0 - p0
orr r6, r6, r7 @ abs (p1-q1)
ldr r7, c0x7F7F7F7F
orr r12, r11, r12 @ abs (p0-q0)
ldr_post r11, r0, r1 @ q2
uqadd8 r12, r12, r12 @ abs (p0-q0) * 2
and r6, r7, r6, lsr #1 @ abs (p1-q1) / 2
uqsub8 r7, r9, r10 @ q0 - q1
uqadd8 r12, r12, r6 @ abs (p0-q0)*2 + abs (p1-q1)/2
uqsub8 r6, r10, r9 @ q1 - q0
uqsub8 r12, r12, r4 @ compare to flimit
uqsub8 r9, r11, r10 @ q2 - q1
orr lr, lr, r12
ldr_post r12, r0, r1 @ q3
uqsub8 r10, r10, r11 @ q1 - q2
orr r6, r7, r6 @ abs (q1-q0)
orr r10, r9, r10 @ abs (q2-q1)
uqsub8 r7, r6, r2 @ compare to limit
uqsub8 r10, r10, r2 @ compare to limit
uqsub8 r6, r6, r3 @ compare to thresh -- save r6 for later
orr lr, lr, r7
orr lr, lr, r10
uqsub8 r10, r12, r11 @ q3 - q2
uqsub8 r9, r11, r12 @ q2 - q3
mvn r11, #0 @ r11 == -1
orr r10, r10, r9 @ abs (q3-q2)
uqsub8 r10, r10, r2 @ compare to limit
mov r12, #0
orr lr, lr, r10
sub r0, r0, r1, lsl #2
usub8 lr, r12, lr @ use usub8 instead of ssub8
sel lr, r11, r12 @ filter mask: lr
cmp lr, #0
beq 2f @ skip filtering
sub r0, r0, r1, lsl #1 @ move r0 pointer down by 6 lines
@vp8_hevmask() function
@calculate high edge variance
orr r10, r6, r8 @ calculate vp8_hevmask
usub8 r10, r12, r10 @ use usub8 instead of ssub8
sel r6, r12, r11 @ obtain vp8_hevmask: r6
@vp8_filter() function
ldr r8, [r0, r1] @ p0
ldr_post r7, r0, r1, lsl #1 @ p1
ldr r12, c0x80808080
ldr r10,[r0, r1] @ q1
ldr_post r9, r0, r1, lsl #1 @ q0
eor r7, r7, r12 @ p1 offset to convert to a signed value
eor r8, r8, r12 @ p0 offset to convert to a signed value
eor r9, r9, r12 @ q0 offset to convert to a signed value
eor r10, r10, r12 @ q1 offset to convert to a signed value
str r9, [sp] @ store qs0 temporarily
str r8, [sp, #4] @ store ps0 temporarily
str r10,[sp, #8] @ store qs1 temporarily
str r7, [sp, #12] @ store ps1 temporarily
qsub8 r7, r7, r10 @ vp8_signed_char_clamp(ps1-qs1)
qsub8 r8, r9, r8 @ vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
and r7, r7, r6 @ vp8_filter (r7) &= hev
qadd8 r7, r7, r8
ldr r9, c0x03030303 @ r9 = 3 --modified for vp8
qadd8 r7, r7, r8
ldr r10, c0x04040404
qadd8 r7, r7, r8
and r7, r7, lr @ vp8_filter &= mask@
qadd8 r8, r7, r9 @ Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
qadd8 r7, r7, r10 @ vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
mov r9, #0
shadd8 r8, r8, r9 @ Filter2 >>= 3
shadd8 r7, r7, r9 @ vp8_filter >>= 3
shadd8 r8, r8, r9
shadd8 r7, r7, r9
shadd8 lr, r8, r9 @ lr: Filter2
shadd8 r7, r7, r9 @ r7: filter
@calculate output
ldr r8, [sp] @ load qs0
ldr r9, [sp, #4] @ load ps0
ldr r10, c0x01010101
qsub8 r8, r8, r7 @ u = vp8_signed_char_clamp(qs0 - vp8_filter)
qadd8 r9, r9, lr @ u = vp8_signed_char_clamp(ps0 + Filter2)
mov lr, #0
sadd8 r7, r7, r10 @ vp8_filter += 1
shadd8 r7, r7, lr @ vp8_filter >>= 1
ldr r11,[sp, #12] @ load ps1
ldr r10,[sp, #8] @ load qs1
bic r7, r7, r6 @ vp8_filter &= ~hev
sub r0, r0, r1, lsl #2
qadd8 r11, r11, r7 @ u = vp8_signed_char_clamp(ps1 + vp8_filter)
qsub8 r10, r10, r7 @ u = vp8_signed_char_clamp(qs1 - vp8_filter)
eor r11, r11, r12 @ *op1 = u^0x80
eor r9, r9, r12 @ *op0 = u^0x80
eor r8, r8, r12 @ *oq0 = u^0x80
eor r10, r10, r12 @ *oq1 = u^0x80
str r9, [r0, r1] @ store op0 result
str_post r11, r0, r1, lsl #1 @ store op1
str r10,[r0, r1] @ store oq1
str_post r8, r0, r1, lsl #1 @ store oq0 result
sub r0, r0, r1, lsl #1
2:
add r0, r0, #4
sub r0, r0, r1, lsl #2
subs r5, r5, #1
T ittt ne
ldrne r10,[r0, r1] @ p2
A ldrne r9, [r0], r1, lsl #1 @ p3
T ldrne r9, [r0] @ p3
T addne r0, r0, r1, lsl #1
T ittt ne
ldrne r12,[r0, r1] @ p0
A ldrne r11,[r0], r1, lsl #1 @ p1
T ldrne r11,[r0] @ p3
T addne r0, r0, r1, lsl #1
bne 1b
add sp, sp, #16
pop {r4 - r11, pc}
endfunc
@ void vp8_v_loop_filter16(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh)
@ and
@ void vp8_v_loop_filter8uv(uint8_t *dstU, uint8_t *dstV, int stride,
@ int fE, int fI, int hev_thresh)
@ call:
@ void vp8_v_loop_filter(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh, int count)
function ff_vp8_v_loop_filter_armv6, export=1
push {r4 - r11, lr}
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
ldr r5, [sp, #40] @ counter
ldr r6, [sp, #36] @ load thresh address
sub sp, sp, #16 @ create temp buffer
ldr r10,[r0, r1] @ p2
ldr_post r9, r0, r1, lsl #1 @ p3
ldr r12,[r0, r1] @ p0
ldr_post r11, r0, r1, lsl #1 @ p1
orr r2, r2, r2, lsl #16
orr r3, r3, r3, lsl #16
orr r6, r6, r6, lsl #16
orr r4, r2, r2, lsl #8 @ flimE splat int -> byte
orr r2, r3, r3, lsl #8 @ flimI splat int -> byte
orr r3, r6, r6, lsl #8 @ thresh splat int -> byte
1:
@ vp8_filter_mask() function
@ calculate breakout conditions
uqsub8 r6, r9, r10 @ p3 - p2
uqsub8 r7, r10, r9 @ p2 - p3
uqsub8 r8, r10, r11 @ p2 - p1
uqsub8 r10, r11, r10 @ p1 - p2
orr r6, r6, r7 @ abs (p3-p2)
orr r8, r8, r10 @ abs (p2-p1)
uqsub8 lr, r6, r2 @ compare to limit. lr: vp8_filter_mask
uqsub8 r8, r8, r2 @ compare to limit
uqsub8 r6, r11, r12 @ p1 - p0
orr lr, lr, r8
uqsub8 r7, r12, r11 @ p0 - p1
ldr r10,[r0, r1] @ q1
ldr_post r9, r0, r1, lsl #1 @ q0
orr r6, r6, r7 @ abs (p1-p0)
uqsub8 r7, r6, r2 @ compare to limit
uqsub8 r8, r6, r3 @ compare to thresh -- save r8 for later
orr lr, lr, r7
uqsub8 r6, r11, r10 @ p1 - q1
uqsub8 r7, r10, r11 @ q1 - p1
uqsub8 r11, r12, r9 @ p0 - q0
uqsub8 r12, r9, r12 @ q0 - p0
orr r6, r6, r7 @ abs (p1-q1)
ldr r7, c0x7F7F7F7F
orr r12, r11, r12 @ abs (p0-q0)
ldr_post r11, r0, r1 @ q2
uqadd8 r12, r12, r12 @ abs (p0-q0) * 2
and r6, r7, r6, lsr #1 @ abs (p1-q1) / 2
uqsub8 r7, r9, r10 @ q0 - q1
uqadd8 r12, r12, r6 @ abs (p0-q0)*2 + abs (p1-q1)/2
uqsub8 r6, r10, r9 @ q1 - q0
uqsub8 r12, r12, r4 @ compare to flimit
uqsub8 r9, r11, r10 @ q2 - q1
orr lr, lr, r12
ldr_post r12, r0, r1 @ q3
uqsub8 r10, r10, r11 @ q1 - q2
orr r6, r7, r6 @ abs (q1-q0)
orr r10, r9, r10 @ abs (q2-q1)
uqsub8 r7, r6, r2 @ compare to limit
uqsub8 r10, r10, r2 @ compare to limit
uqsub8 r6, r6, r3 @ compare to thresh -- save r6 for later
orr lr, lr, r7
orr lr, lr, r10
uqsub8 r10, r12, r11 @ q3 - q2
uqsub8 r9, r11, r12 @ q2 - q3
mvn r11, #0 @ r11 == -1
orr r10, r10, r9 @ abs (q3-q2)
uqsub8 r10, r10, r2 @ compare to limit
mov r12, #0
orr lr, lr, r10
usub8 lr, r12, lr @ use usub8 instead of ssub8
sel lr, r11, r12 @ filter mask: lr
cmp lr, #0
beq 2f @ skip filtering
@vp8_hevmask() function
@calculate high edge variance
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 6 lines
sub r0, r0, r1, lsl #1
orr r10, r6, r8
usub8 r10, r12, r10
sel r6, r12, r11 @ hev mask: r6
@vp8_mbfilter() function
@p2, q2 are only needed at the end. Do not need to load them in now.
ldr r8, [r0, r1] @ p0
ldr_post r7, r0, r1, lsl #1 @ p1
ldr r12, c0x80808080
ldr_post r9, r0, r1 @ q0
ldr r10,[r0] @ q1
eor r7, r7, r12 @ ps1
eor r8, r8, r12 @ ps0
eor r9, r9, r12 @ qs0
eor r10, r10, r12 @ qs1
qsub8 r12, r9, r8 @ vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
str r7, [sp, #12] @ store ps1 temporarily
qsub8 r7, r7, r10 @ vp8_signed_char_clamp(ps1-qs1)
str r10,[sp, #8] @ store qs1 temporarily
qadd8 r7, r7, r12
str r9, [sp] @ store qs0 temporarily
qadd8 r7, r7, r12
str r8, [sp, #4] @ store ps0 temporarily
qadd8 r7, r7, r12 @ vp8_filter: r7
ldr r10, c0x03030303 @ r10 = 3 --modified for vp8
ldr r9, c0x04040404
and r7, r7, lr @ vp8_filter &= mask (lr is free)
mov r12, r7 @ Filter2: r12
and r12, r12, r6 @ Filter2 &= hev
@save bottom 3 bits so that we round one side +4 and the other +3
qadd8 r8, r12, r9 @ Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
qadd8 r12, r12, r10 @ Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
mov r10, #0
shadd8 r8, r8, r10 @ Filter1 >>= 3
shadd8 r12, r12, r10 @ Filter2 >>= 3
shadd8 r8, r8, r10
shadd8 r12, r12, r10
shadd8 r8, r8, r10 @ r8: Filter1
shadd8 r12, r12, r10 @ r12: Filter2
ldr r9, [sp] @ load qs0
ldr r11,[sp, #4] @ load ps0
qsub8 r9, r9, r8 @ qs0 = vp8_signed_char_clamp(qs0 - Filter1)
qadd8 r11, r11, r12 @ ps0 = vp8_signed_char_clamp(ps0 + Filter2)
bic r12, r7, r6 @ vp8_filter &= ~hev ( r6 is free)
@roughly 3/7th difference across boundary
mov lr, #0x1b @ 27
mov r7, #0x3f @ 63
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r7, r10, lr, r7
smultb r10, r10, lr
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
add r10, r10, #63
ssat r7, #8, r7, asr #7
ssat r10, #8, r10, asr #7
ldr lr, c0x80808080
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r7, r10, lsl #16
uxtb16 r6, r6
uxtb16 r10, r10
sub r0, r0, r1
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
qsub8 r8, r9, r10 @ s = vp8_signed_char_clamp(qs0 - u)
qadd8 r10, r11, r10 @ s = vp8_signed_char_clamp(ps0 + u)
eor r8, r8, lr @ *oq0 = s^0x80
str r8, [r0] @ store *oq0
sub r0, r0, r1
eor r10, r10, lr @ *op0 = s^0x80
str r10,[r0] @ store *op0
@roughly 2/7th difference across boundary
mov lr, #0x12 @ 18
mov r7, #0x3f @ 63
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r9, r10, lr, r7
smlatb r10, r10, lr, r7
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
ssat r9, #8, r9, asr #7
ssat r10, #8, r10, asr #7
ldr lr, c0x80808080
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r9, r10, lsl #16
ldr r9, [sp, #8] @ load qs1
ldr r11, [sp, #12] @ load ps1
uxtb16 r6, r6
uxtb16 r10, r10
sub r0, r0, r1
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
qadd8 r11, r11, r10 @ s = vp8_signed_char_clamp(ps1 + u)
qsub8 r8, r9, r10 @ s = vp8_signed_char_clamp(qs1 - u)
eor r11, r11, lr @ *op1 = s^0x80
str_post r11, r0, r1 @ store *op1
eor r8, r8, lr @ *oq1 = s^0x80
add r0, r0, r1, lsl #1
mov r7, #0x3f @ 63
str_post r8, r0, r1 @ store *oq1
@roughly 1/7th difference across boundary
mov lr, #0x9 @ 9
ldr r9, [r0] @ load q2
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r12, r10, lr, r7
smlatb r10, r10, lr, r7
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
ssat r12, #8, r12, asr #7
ssat r10, #8, r10, asr #7
sub r0, r0, r1, lsl #2
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r12, r10, lsl #16
sub r0, r0, r1
ldr lr, c0x80808080
ldr r11, [r0] @ load p2
uxtb16 r6, r6
uxtb16 r10, r10
eor r9, r9, lr
eor r11, r11, lr
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
qadd8 r8, r11, r10 @ s = vp8_signed_char_clamp(ps2 + u)
qsub8 r10, r9, r10 @ s = vp8_signed_char_clamp(qs2 - u)
eor r8, r8, lr @ *op2 = s^0x80
str_post r8, r0, r1, lsl #2 @ store *op2
add r0, r0, r1
eor r10, r10, lr @ *oq2 = s^0x80
str_post r10, r0, r1, lsl #1 @ store *oq2
2:
add r0, r0, #4
sub r0, r0, r1, lsl #3
subs r5, r5, #1
T ittt ne
ldrne r10,[r0, r1] @ p2
A ldrne r9, [r0], r1, lsl #1 @ p3
T ldrne r9, [r0] @ p3
T addne r0, r0, r1, lsl #1
T ittt ne
ldrne r12,[r0, r1] @ p0
A ldrne r11,[r0], r1, lsl #1 @ p1
T ldrne r11,[r0] @ p3
T addne r0, r0, r1, lsl #1
bne 1b
add sp, sp, #16
pop {r4 - r11, pc}
endfunc
.macro TRANSPOSE_MATRIX i0, i1, i2, i3, o3, o2, o1, o0
@ input: $0, $1, $2, $3
@ output: $4, $5, $6, $7
@ i0: 03 02 01 00
@ i1: 13 12 11 10
@ i2: 23 22 21 20
@ i3: 33 32 31 30
@ o3 o2 o1 o0
uxtb16 \o1, \i1 @ xx 12 xx 10
uxtb16 \o0, \i0 @ xx 02 xx 00
uxtb16 \o3, \i3 @ xx 32 xx 30
uxtb16 \o2, \i2 @ xx 22 xx 20
orr \o1, \o0, \o1, lsl #8 @ 12 02 10 00
orr \o3, \o2, \o3, lsl #8 @ 32 22 30 20
uxtb16 \i1, \i1, ror #8 @ xx 13 xx 11
uxtb16 \i3, \i3, ror #8 @ xx 33 xx 31
uxtb16 \i0, \i0, ror #8 @ xx 03 xx 01
uxtb16 \i2, \i2, ror #8 @ xx 23 xx 21
orr \i0, \i0, \i1, lsl #8 @ 13 03 11 01
orr \i2, \i2, \i3, lsl #8 @ 33 23 31 21
pkhtb \o2, \o3, \o1, asr #16 @ 32 22 12 02 -- p1
pkhbt \o0, \o1, \o3, lsl #16 @ 30 20 10 00 -- p3
pkhtb \o3, \i2, \i0, asr #16 @ 33 23 13 03 -- p0
pkhbt \o1, \i0, \i2, lsl #16 @ 31 21 11 01 -- p2
.endm
@ void vp8_h_loop_filter16_simple(uint8_t *dst, int stride, int flim)
function ff_vp8_h_loop_filter16_simple_armv6, export=1
push {r4 - r11, lr}
orr r12, r2, r2, lsl #16
ldr r2, c0x80808080
orr r12, r12, r12, lsl #8
@ load soure data to r7, r8, r9, r10
sub r0, r0, #2
ldr r8, [r0, r1]
ldr_post r7, r0, r1, lsl #1
ldr r10,[r0, r1]
ldr_post r9, r0, r1, lsl #1
add r0, r0, #2
mov r11, #4 @ count (r11) for 4-in-parallel
1:
@transpose r7, r8, r9, r10 to r3, r4, r5, r6
TRANSPOSE_MATRIX r7, r8, r9, r10, r6, r5, r4, r3
@ vp8_simple_filter_mask() function
uqsub8 r7, r3, r6 @ p1 - q1
uqsub8 r8, r6, r3 @ q1 - p1
uqsub8 r9, r4, r5 @ p0 - q0
uqsub8 r10, r5, r4 @ q0 - p0
orr r7, r7, r8 @ abs(p1 - q1)
orr r9, r9, r10 @ abs(p0 - q0)
mov r8, #0
uqadd8 r9, r9, r9 @ abs(p0 - q0) * 2
uhadd8 r7, r7, r8 @ abs(p1 - q1) / 2
uqadd8 r7, r7, r9 @ abs(p0 - q0)*2 + abs(p1 - q1)/2
mvn r10, #0 @ r10 == -1
usub8 r7, r12, r7 @ compare to flimit
sel lr, r10, r8 @ filter mask
cmp lr, #0
beq 2f @ skip filtering
@vp8_simple_filter() function
eor r3, r3, r2 @ p1 offset to convert to a signed value
eor r6, r6, r2 @ q1 offset to convert to a signed value
eor r4, r4, r2 @ p0 offset to convert to a signed value
eor r5, r5, r2 @ q0 offset to convert to a signed value
qsub8 r3, r3, r6 @ vp8_filter = p1 - q1
qsub8 r6, r5, r4 @ q0 - p0
qadd8 r3, r3, r6 @ vp8_filter += q0 - p0
ldr r9, c0x03030303 @ r9 = 3
qadd8 r3, r3, r6 @ vp8_filter += q0 - p0
ldr r7, c0x04040404
qadd8 r3, r3, r6 @ vp8_filter = p1-q1 + 3*(q0-p0))
@STALL
and r3, r3, lr @ vp8_filter &= mask
qadd8 r9, r3, r9 @ Filter2 = vp8_filter + 3
qadd8 r3, r3, r7 @ Filter1 = vp8_filter + 4
shadd8 r9, r9, r8
shadd8 r3, r3, r8
shadd8 r9, r9, r8
shadd8 r3, r3, r8
shadd8 r9, r9, r8 @ Filter2 >>= 3
shadd8 r3, r3, r8 @ Filter1 >>= 3
@calculate output
sub r0, r0, r1, lsl #2
qadd8 r4, r4, r9 @ u = p0 + Filter2
qsub8 r5, r5, r3 @ u = q0 - Filter1
eor r4, r4, r2 @ *op0 = u^0x80
eor r5, r5, r2 @ *oq0 = u^0x80
strb r4, [r0, #-1] @ store the result
mov r4, r4, lsr #8
strb_post r5, r0, r1
mov r5, r5, lsr #8
strb r4, [r0, #-1]
mov r4, r4, lsr #8
strb_post r5, r0, r1
mov r5, r5, lsr #8
strb r4, [r0, #-1]
mov r4, r4, lsr #8
strb_post r5, r0, r1
mov r5, r5, lsr #8
strb r4, [r0, #-1]
strb_post r5, r0, r1
2:
subs r11, r11, #1
@ load soure data to r7, r8, r9, r10
sub r0, r0, #2
T ittt ne
ldrne r8, [r0, r1]
A ldrne r7, [r0], r1, lsl #1
T ldrne r7, [r0]
T addne r0, r0, r1, lsl #1
T ittt ne
ldrne r10,[r0, r1]
A ldrne r9, [r0], r1, lsl #1
T ldrne r9, [r0]
T addne r0, r0, r1, lsl #1
add r0, r0, #2
bne 1b
pop {r4 - r11, pc}
endfunc
@ void vp8_h_loop_filter16_inner(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh)
@ and
@ void vp8_h_loop_filter8uv_inner(uint8_t *dstU, uint8_t *dstV, int stride,
@ int fE, int fI, int hev_thresh)
@ call:
@ void vp8_h_loop_filter_inner(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh, int count)
function ff_vp8_h_loop_filter_inner_armv6, export=1
push {r4 - r11, lr}
sub r0, r0, #4 @ move r0 pointer down by 4
ldr r5, [sp, #40] @ counter
ldr r9, [sp, #36] @ load thresh address
sub sp, sp, #16 @ create temp buffer
ldr r7, [r0, r1] @ transpose will make it into p3-p0
ldr_post r6, r0, r1, lsl #1 @ load source data
ldr lr, [r0, r1]
ldr_post r8, r0, r1, lsl #1
orr r2, r2, r2, lsl #16
orr r3, r3, r3, lsl #16
orr r9, r9, r9, lsl #16
orr r4, r2, r2, lsl #8 @ flimE splat int -> byte
orr r2, r3, r3, lsl #8 @ flimI splat int -> byte
orr r3, r9, r9, lsl #8 @ thresh splat int -> byte
1:
@ vp8_filter_mask() function
@ calculate breakout conditions
@ transpose the source data for 4-in-parallel operation
TRANSPOSE_MATRIX r6, r7, r8, lr, r12, r11, r10, r9
uqsub8 r7, r9, r10 @ p3 - p2
uqsub8 r8, r10, r9 @ p2 - p3
uqsub8 r9, r10, r11 @ p2 - p1
uqsub8 r10, r11, r10 @ p1 - p2
orr r7, r7, r8 @ abs (p3-p2)
orr r10, r9, r10 @ abs (p2-p1)
uqsub8 lr, r7, r2 @ compare to limit. lr: vp8_filter_mask
uqsub8 r10, r10, r2 @ compare to limit
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
orr lr, lr, r10
uqsub8 r6, r11, r12 @ p1 - p0
uqsub8 r7, r12, r11 @ p0 - p1
add r0, r0, #4 @ move r0 pointer up by 4
orr r6, r6, r7 @ abs (p1-p0)
str r11,[sp, #12] @ save p1
uqsub8 r10, r6, r2 @ compare to limit
uqsub8 r11, r6, r3 @ compare to thresh
orr lr, lr, r10
@ transpose uses 8 regs(r6 - r12 and lr). Need to save reg value now
@ transpose the source data for 4-in-parallel operation
str r11,[sp] @ push r11 to stack
ldr r7, [r0, r1]
ldr_post r6, r0, r1, lsl #1 @ load source data
str r12,[sp, #4] @ save current reg before load q0 - q3 data
str lr, [sp, #8]
ldr lr, [r0, r1]
ldr_post r8, r0, r1, lsl #1
TRANSPOSE_MATRIX r6, r7, r8, lr, r12, r11, r10, r9
ldr lr, [sp, #8] @ load back (f)limit accumulator
uqsub8 r6, r12, r11 @ q3 - q2
uqsub8 r7, r11, r12 @ q2 - q3
uqsub8 r12, r11, r10 @ q2 - q1
uqsub8 r11, r10, r11 @ q1 - q2
orr r6, r6, r7 @ abs (q3-q2)
orr r7, r12, r11 @ abs (q2-q1)
uqsub8 r6, r6, r2 @ compare to limit
uqsub8 r7, r7, r2 @ compare to limit
ldr r11,[sp, #4] @ load back p0
ldr r12,[sp, #12] @ load back p1
orr lr, lr, r6
orr lr, lr, r7
uqsub8 r6, r11, r9 @ p0 - q0
uqsub8 r7, r9, r11 @ q0 - p0
uqsub8 r8, r12, r10 @ p1 - q1
uqsub8 r11, r10, r12 @ q1 - p1
orr r6, r6, r7 @ abs (p0-q0)
ldr r7, c0x7F7F7F7F
orr r8, r8, r11 @ abs (p1-q1)
uqadd8 r6, r6, r6 @ abs (p0-q0) * 2
and r8, r7, r8, lsr #1 @ abs (p1-q1) / 2
uqsub8 r11, r10, r9 @ q1 - q0
uqadd8 r6, r8, r6 @ abs (p0-q0)*2 + abs (p1-q1)/2
uqsub8 r12, r9, r10 @ q0 - q1
uqsub8 r6, r6, r4 @ compare to flimit
orr r9, r11, r12 @ abs (q1-q0)
uqsub8 r8, r9, r2 @ compare to limit
uqsub8 r10, r9, r3 @ compare to thresh
orr lr, lr, r6
orr lr, lr, r8
mvn r11, #0 @ r11 == -1
mov r12, #0
usub8 lr, r12, lr
ldr r9, [sp] @ load the compared result
sel lr, r11, r12 @ filter mask: lr
cmp lr, #0
beq 2f @ skip filtering
@vp8_hevmask() function
@calculate high edge variance
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
orr r9, r9, r10
ldrh r7, [r0, #-2]
ldrh_post r8, r0, r1
usub8 r9, r12, r9
sel r6, r12, r11 @ hev mask: r6
@vp8_filter() function
@ load soure data to r6, r11, r12, lr
ldrh r9, [r0, #-2]
ldrh_post r10, r0, r1
pkhbt r12, r7, r8, lsl #16
ldrh r7, [r0, #-2]
ldrh_post r8, r0, r1
pkhbt r11, r9, r10, lsl #16
ldrh r9, [r0, #-2]
ldrh_post r10, r0, r1
@ Transpose needs 8 regs(r6 - r12, and lr). Save r6 and lr first
str r6, [sp]
str lr, [sp, #4]
pkhbt r6, r7, r8, lsl #16
pkhbt lr, r9, r10, lsl #16
@transpose r12, r11, r6, lr to r7, r8, r9, r10
TRANSPOSE_MATRIX r12, r11, r6, lr, r10, r9, r8, r7
@load back hev_mask r6 and filter_mask lr
ldr r12, c0x80808080
ldr r6, [sp]
ldr lr, [sp, #4]
eor r7, r7, r12 @ p1 offset to convert to a signed value
eor r8, r8, r12 @ p0 offset to convert to a signed value
eor r9, r9, r12 @ q0 offset to convert to a signed value
eor r10, r10, r12 @ q1 offset to convert to a signed value
str r9, [sp] @ store qs0 temporarily
str r8, [sp, #4] @ store ps0 temporarily
str r10,[sp, #8] @ store qs1 temporarily
str r7, [sp, #12] @ store ps1 temporarily
qsub8 r7, r7, r10 @ vp8_signed_char_clamp(ps1-qs1)
qsub8 r8, r9, r8 @ vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
and r7, r7, r6 @ vp8_filter (r7) &= hev (r7 : filter)
qadd8 r7, r7, r8
ldr r9, c0x03030303 @ r9 = 3 --modified for vp8
qadd8 r7, r7, r8
ldr r10, c0x04040404
qadd8 r7, r7, r8
and r7, r7, lr @ vp8_filter &= mask
qadd8 r8, r7, r9 @ Filter2 (r8) = vp8_signed_char_clamp(vp8_filter+3)
qadd8 r7, r7, r10 @ vp8_filter = vp8_signed_char_clamp(vp8_filter+4)
mov r9, #0
shadd8 r8, r8, r9 @ Filter2 >>= 3
shadd8 r7, r7, r9 @ vp8_filter >>= 3
shadd8 r8, r8, r9
shadd8 r7, r7, r9
shadd8 lr, r8, r9 @ lr: filter2
shadd8 r7, r7, r9 @ r7: filter
@calculate output
ldr r8, [sp] @ load qs0
ldr r9, [sp, #4] @ load ps0
ldr r10, c0x01010101
qsub8 r8, r8, r7 @ u = vp8_signed_char_clamp(qs0 - vp8_filter)
qadd8 r9, r9, lr @ u = vp8_signed_char_clamp(ps0 + Filter2)
eor r8, r8, r12
eor r9, r9, r12
mov lr, #0
sadd8 r7, r7, r10
shadd8 r7, r7, lr
ldr r10,[sp, #8] @ load qs1
ldr r11,[sp, #12] @ load ps1
bic r7, r7, r6 @ r7: vp8_filter
qsub8 r10, r10, r7 @ u = vp8_signed_char_clamp(qs1 - vp8_filter)
qadd8 r11, r11, r7 @ u = vp8_signed_char_clamp(ps1 + vp8_filter)
eor r10, r10, r12
eor r11, r11, r12
sub r0, r0, r1, lsl #2
@we can use TRANSPOSE_MATRIX macro to transpose output - input: q1, q0, p0, p1
TRANSPOSE_MATRIX r11, r9, r8, r10, lr, r12, r7, r6
strh r6, [r0, #-2] @ store the result
mov r6, r6, lsr #16
strh_post r6, r0, r1
strh r7, [r0, #-2]
mov r7, r7, lsr #16
strh_post r7, r0, r1
strh r12, [r0, #-2]
mov r12, r12, lsr #16
strh_post r12, r0, r1
strh lr, [r0, #-2]
mov lr, lr, lsr #16
strh_post lr, r0, r1
2:
sub r0, r0, #4
subs r5, r5, #1
T ittt ne
ldrne r7, [r0, r1]
A ldrne r6, [r0], r1, lsl #1 @ load source data
T ldrne r6, [r0] @ load source data
T addne r0, r0, r1, lsl #1
T ittt ne
ldrne lr, [r0, r1]
A ldrne r8, [r0], r1, lsl #1
T ldrne r8, [r0]
T addne r0, r0, r1, lsl #1
bne 1b
add sp, sp, #16
pop {r4 - r11, pc}
endfunc
@ void vp8_h_loop_filter16(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh)
@ and
@ void vp8_h_loop_filter8uv(uint8_t *dstU, uint8_t *dstV, int stride,
@ int fE, int fI, int hev_thresh)
@ call:
@ void vp8_h_loop_filter(uint8_t *dst, int stride,
@ int fE, int fI, int hev_thresh, int count)
function ff_vp8_h_loop_filter_armv6, export=1
push {r4 - r11, lr}
sub r0, r0, #4 @ move r0 pointer down by 4
ldr r5, [sp, #40] @ counter
ldr r9, [sp, #36] @ load thresh address
sub sp, sp, #16 @ create temp buffer
ldr r7, [r0, r1] @ transpose will make it into p3-p0
ldr_post r6, r0, r1, lsl #1 @ load source data
ldr lr, [r0, r1]
ldr_post r8, r0, r1, lsl #1
orr r2, r2, r2, lsl #16
orr r3, r3, r3, lsl #16
orr r9, r9, r9, lsl #16
orr r4, r2, r2, lsl #8 @ flimE splat int -> byte
orr r2, r3, r3, lsl #8 @ flimI splat int -> byte
orr r3, r9, r9, lsl #8 @ thresh splat int -> byte
1:
@ vp8_filter_mask() function
@ calculate breakout conditions
@ transpose the source data for 4-in-parallel operation
TRANSPOSE_MATRIX r6, r7, r8, lr, r12, r11, r10, r9
uqsub8 r7, r9, r10 @ p3 - p2
uqsub8 r8, r10, r9 @ p2 - p3
uqsub8 r9, r10, r11 @ p2 - p1
uqsub8 r10, r11, r10 @ p1 - p2
orr r7, r7, r8 @ abs (p3-p2)
orr r10, r9, r10 @ abs (p2-p1)
uqsub8 lr, r7, r2 @ compare to limit. lr: vp8_filter_mask
uqsub8 r10, r10, r2 @ compare to limit
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
orr lr, lr, r10
uqsub8 r6, r11, r12 @ p1 - p0
uqsub8 r7, r12, r11 @ p0 - p1
add r0, r0, #4 @ move r0 pointer up by 4
orr r6, r6, r7 @ abs (p1-p0)
str r11,[sp, #12] @ save p1
uqsub8 r10, r6, r2 @ compare to limit
uqsub8 r11, r6, r3 @ compare to thresh
orr lr, lr, r10
@ transpose uses 8 regs(r6 - r12 and lr). Need to save reg value now
@ transpose the source data for 4-in-parallel operation
str r11,[sp] @ push r11 to stack
ldr r7, [r0, r1]
ldr_post r6, r0, r1, lsl #1 @ load source data
str r12,[sp, #4] @ save current reg before load q0 - q3 data
str lr, [sp, #8]
ldr lr, [r0, r1]
ldr_post r8, r0, r1, lsl #1
TRANSPOSE_MATRIX r6, r7, r8, lr, r12, r11, r10, r9
ldr lr, [sp, #8] @ load back (f)limit accumulator
uqsub8 r6, r12, r11 @ q3 - q2
uqsub8 r7, r11, r12 @ q2 - q3
uqsub8 r12, r11, r10 @ q2 - q1
uqsub8 r11, r10, r11 @ q1 - q2
orr r6, r6, r7 @ abs (q3-q2)
orr r7, r12, r11 @ abs (q2-q1)
uqsub8 r6, r6, r2 @ compare to limit
uqsub8 r7, r7, r2 @ compare to limit
ldr r11,[sp, #4] @ load back p0
ldr r12,[sp, #12] @ load back p1
orr lr, lr, r6
orr lr, lr, r7
uqsub8 r6, r11, r9 @ p0 - q0
uqsub8 r7, r9, r11 @ q0 - p0
uqsub8 r8, r12, r10 @ p1 - q1
uqsub8 r11, r10, r12 @ q1 - p1
orr r6, r6, r7 @ abs (p0-q0)
ldr r7, c0x7F7F7F7F
orr r8, r8, r11 @ abs (p1-q1)
uqadd8 r6, r6, r6 @ abs (p0-q0) * 2
and r8, r7, r8, lsr #1 @ abs (p1-q1) / 2
uqsub8 r11, r10, r9 @ q1 - q0
uqadd8 r6, r8, r6 @ abs (p0-q0)*2 + abs (p1-q1)/2
uqsub8 r12, r9, r10 @ q0 - q1
uqsub8 r6, r6, r4 @ compare to flimit
orr r9, r11, r12 @ abs (q1-q0)
uqsub8 r8, r9, r2 @ compare to limit
uqsub8 r10, r9, r3 @ compare to thresh
orr lr, lr, r6
orr lr, lr, r8
mvn r11, #0 @ r11 == -1
mov r12, #0
usub8 lr, r12, lr
ldr r9, [sp] @ load the compared result
sel lr, r11, r12 @ filter mask: lr
cmp lr, #0
beq 2f @ skip filtering
@vp8_hevmask() function
@calculate high edge variance
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
orr r9, r9, r10
ldrh r7, [r0, #-2]
ldrh_post r8, r0, r1
usub8 r9, r12, r9
sel r6, r12, r11 @ hev mask: r6
@ vp8_mbfilter() function
@ p2, q2 are only needed at the end. do not need to load them in now.
@ Transpose needs 8 regs(r6 - r12, and lr). Save r6 and lr first
@ load soure data to r6, r11, r12, lr
ldrh r9, [r0, #-2]
ldrh_post r10, r0, r1
pkhbt r12, r7, r8, lsl #16
ldrh r7, [r0, #-2]
ldrh_post r8, r0, r1
pkhbt r11, r9, r10, lsl #16
ldrh r9, [r0, #-2]
ldrh_post r10, r0, r1
str r6, [sp] @ save r6
str lr, [sp, #4] @ save lr
pkhbt r6, r7, r8, lsl #16
pkhbt lr, r9, r10, lsl #16
@transpose r12, r11, r6, lr to p1, p0, q0, q1
TRANSPOSE_MATRIX r12, r11, r6, lr, r10, r9, r8, r7
@load back hev_mask r6 and filter_mask lr
ldr r12, c0x80808080
ldr r6, [sp]
ldr lr, [sp, #4]
eor r7, r7, r12 @ ps1
eor r8, r8, r12 @ ps0
eor r9, r9, r12 @ qs0
eor r10, r10, r12 @ qs1
qsub8 r12, r9, r8 @ vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
str r7, [sp, #12] @ store ps1 temporarily
qsub8 r7, r7, r10 @ vp8_signed_char_clamp(ps1-qs1)
str r10,[sp, #8] @ store qs1 temporarily
qadd8 r7, r7, r12
str r9, [sp] @ store qs0 temporarily
qadd8 r7, r7, r12
str r8, [sp, #4] @ store ps0 temporarily
qadd8 r7, r7, r12 @ vp8_filter: r7
ldr r10, c0x03030303 @ r10 = 3 --modified for vp8
ldr r9, c0x04040404
and r7, r7, lr @ vp8_filter &= mask (lr is free)
mov r12, r7 @ Filter2: r12
and r12, r12, r6 @ Filter2 &= hev
@save bottom 3 bits so that we round one side +4 and the other +3
qadd8 r8, r12, r9 @ Filter1 (r8) = vp8_signed_char_clamp(Filter2+4)
qadd8 r12, r12, r10 @ Filter2 (r12) = vp8_signed_char_clamp(Filter2+3)
mov r10, #0
shadd8 r8, r8, r10 @ Filter1 >>= 3
shadd8 r12, r12, r10 @ Filter2 >>= 3
shadd8 r8, r8, r10
shadd8 r12, r12, r10
shadd8 r8, r8, r10 @ r8: Filter1
shadd8 r12, r12, r10 @ r12: Filter2
ldr r9, [sp] @ load qs0
ldr r11,[sp, #4] @ load ps0
qsub8 r9, r9, r8 @ qs0 = vp8_signed_char_clamp(qs0 - Filter1)
qadd8 r11, r11, r12 @ ps0 = vp8_signed_char_clamp(ps0 + Filter2)
bic r12, r7, r6 @vp8_filter &= ~hev ( r6 is free)
@roughly 3/7th difference across boundary
mov lr, #0x1b @ 27
mov r7, #0x3f @ 63
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r7, r10, lr, r7
smultb r10, r10, lr
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
add r10, r10, #63
ssat r7, #8, r7, asr #7
ssat r10, #8, r10, asr #7
ldr lr, c0x80808080
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r7, r10, lsl #16
uxtb16 r6, r6
uxtb16 r10, r10
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
qsub8 r8, r9, r10 @ s = vp8_signed_char_clamp(qs0 - u)
qadd8 r10, r11, r10 @ s = vp8_signed_char_clamp(ps0 + u)
eor r8, r8, lr @ *oq0 = s^0x80
eor r10, r10, lr @ *op0 = s^0x80
strb r10,[r0, #-1] @ store op0 result
strb_post r8, r0, r1 @ store oq0 result
mov r10, r10, lsr #8
mov r8, r8, lsr #8
strb r10,[r0, #-1]
strb_post r8, r0, r1
mov r10, r10, lsr #8
mov r8, r8, lsr #8
strb r10,[r0, #-1]
strb_post r8, r0, r1
mov r10, r10, lsr #8
mov r8, r8, lsr #8
strb r10,[r0, #-1]
strb_post r8, r0, r1
@roughly 2/7th difference across boundary
mov lr, #0x12 @ 18
mov r7, #0x3f @ 63
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r9, r10, lr, r7
smlatb r10, r10, lr, r7
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
ssat r9, #8, r9, asr #7
ssat r10, #8, r10, asr #7
sub r0, r0, r1, lsl #2 @ move r0 pointer down by 4 lines
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r9, r10, lsl #16
ldr r9, [sp, #8] @ load qs1
ldr r11,[sp, #12] @ load ps1
ldr lr, c0x80808080
uxtb16 r6, r6
uxtb16 r10, r10
add r0, r0, #2
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7)
qsub8 r8, r9, r10 @ s = vp8_signed_char_clamp(qs1 - u)
qadd8 r10, r11, r10 @ s = vp8_signed_char_clamp(ps1 + u)
eor r8, r8, lr @ *oq1 = s^0x80
eor r10, r10, lr @ *op1 = s^0x80
ldrb r11,[r0, #-5] @ load p2 for 1/7th difference across boundary
strb r10,[r0, #-4] @ store op1
strb r8, [r0, #-1] @ store oq1
ldrb_post r9, r0, r1 @ load q2 for 1/7th difference across boundary
mov r10, r10, lsr #8
mov r8, r8, lsr #8
ldrb r6, [r0, #-5]
strb r10,[r0, #-4]
strb r8, [r0, #-1]
ldrb_post r7, r0, r1
mov r10, r10, lsr #8
mov r8, r8, lsr #8
orr r11, r11, r6, lsl #8
orr r9, r9, r7, lsl #8
ldrb r6, [r0, #-5]
strb r10,[r0, #-4]
strb r8, [r0, #-1]
ldrb_post r7, r0, r1
mov r10, r10, lsr #8
mov r8, r8, lsr #8
orr r11, r11, r6, lsl #16
orr r9, r9, r7, lsl #16
ldrb r6, [r0, #-5]
strb r10,[r0, #-4]
strb r8, [r0, #-1]
ldrb_post r7, r0, r1
orr r11, r11, r6, lsl #24
orr r9, r9, r7, lsl #24
@roughly 1/7th difference across boundary
eor r9, r9, lr
eor r11, r11, lr
mov lr, #0x9 @ 9
mov r7, #0x3f @ 63
sxtb16 r6, r12
sxtb16 r10, r12, ror #8
smlabb r8, r6, lr, r7
smlatb r6, r6, lr, r7
smlabb r12, r10, lr, r7
smlatb r10, r10, lr, r7
ssat r8, #8, r8, asr #7
ssat r6, #8, r6, asr #7
ssat r12, #8, r12, asr #7
ssat r10, #8, r10, asr #7
sub r0, r0, r1, lsl #2
pkhbt r6, r8, r6, lsl #16
pkhbt r10, r12, r10, lsl #16
uxtb16 r6, r6
uxtb16 r10, r10
ldr lr, c0x80808080
orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7)
qadd8 r8, r11, r10 @ s = vp8_signed_char_clamp(ps2 + u)
qsub8 r10, r9, r10 @ s = vp8_signed_char_clamp(qs2 - u)
eor r8, r8, lr @ *op2 = s^0x80
eor r10, r10, lr @ *oq2 = s^0x80
strb r8, [r0, #-5] @ store *op2
strb_post r10, r0, r1 @ store *oq2
mov r8, r8, lsr #8
mov r10, r10, lsr #8
strb r8, [r0, #-5]
strb_post r10, r0, r1
mov r8, r8, lsr #8
mov r10, r10, lsr #8
strb r8, [r0, #-5]
strb_post r10, r0, r1
mov r8, r8, lsr #8
mov r10, r10, lsr #8
strb r8, [r0, #-5]
strb_post r10, r0, r1
@adjust r0 pointer for next loop
sub r0, r0, #2
2:
sub r0, r0, #4
subs r5, r5, #1
T ittt ne
ldrne r7, [r0, r1]
A ldrne r6, [r0], r1, lsl #1 @ load source data
T ldrne r6, [r0]
T addne r0, r0, r1, lsl #1
T ittt ne
ldrne lr, [r0, r1]
A ldrne r8, [r0], r1, lsl #1
T ldrne r8, [r0]
T addne r0, r0, r1, lsl #1
bne 1b
add sp, sp, #16
pop {r4 - r11, pc}
endfunc
@ MC
@ void put_vp8_pixels16(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int h, int mx, int my)
function ff_put_vp8_pixels16_armv6, export=1
push {r4 - r11}
ldr r12,[sp, #32] @ h
1:
subs r12, r12, #2
ldr r5, [r2, #4]
ldr r6, [r2, #8]
ldr r7, [r2, #12]
ldr_post r4, r2, r3
ldr r9, [r2, #4]
ldr r10,[r2, #8]
ldr r11,[r2, #12]
ldr_post r8, r2, r3
strd r6, r7, [r0, #8]
strd_post r4, r5, r0, r1
strd r10, r11,[r0, #8]
strd_post r8, r9, r0, r1
bgt 1b
pop {r4 - r11}
bx lr
endfunc
@ void put_vp8_pixels8(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int h, int mx, int my)
function ff_put_vp8_pixels8_armv6, export=1
push {r4 - r11}
ldr r12,[sp, #32] @ h
1:
subs r12, r12, #4
ldr r5, [r2, #4]
ldr_post r4, r2, r3
ldr r7, [r2, #4]
ldr_post r6, r2, r3
ldr r9, [r2, #4]
ldr_post r8, r2, r3
ldr r11,[r2, #4]
ldr_post r10, r2, r3
strd_post r4, r5, r0, r1
strd_post r6, r7, r0, r1
strd_post r8, r9, r0, r1
strd_post r10, r11, r0, r1
bgt 1b
pop {r4 - r11}
bx lr
endfunc
@ void put_vp8_pixels4(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int h, int mx, int my)
function ff_put_vp8_pixels4_armv6, export=1
ldr r12, [sp, #0] @ h
push {r4 - r6, lr}
1:
subs r12, r12, #4
ldr r5, [r2, r3]
ldr_post r4, r2, r3, lsl #1
ldr lr, [r2, r3]
ldr_post r6, r2, r3, lsl #1
str r5, [r0, r1]
str_post r4, r0, r1, lsl #1
str lr, [r0, r1]
str_post r6, r0, r1, lsl #1
bgt 1b
pop {r4 - r6, pc}
endfunc
@ note: worst case sum of all 6-tap filter values * 255 is 0x7f80 so 16 bit
@ arithmatic can be used to apply filters
const sixtap_filters_13245600, align=4
.short 2, 108, -11, 36, -8, 1, 0, 0
.short 3, 77, -16, 77, -16, 3, 0, 0
.short 1, 36, -8, 108, -11, 2, 0, 0
endconst
const fourtap_filters_1324, align=4
.short -6, 12, 123, -1
.short -9, 50, 93, -6
.short -6, 93, 50, -9
.short -1, 123, 12, -6
endconst
@ void put_vp8_epel_h6(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int mx)
function ff_put_vp8_epel_h6_armv6, export=1
push {r4 - r11, lr}
sub r2, r2, #2
movrel lr, sixtap_filters_13245600 - 16
ldr r12,[sp, #44] @ vp8_filter index
ldr r4, [sp, #36] @ width
add lr, lr, r12, lsl #3
sub r3, r3, r4 @ src_stride - block_width
sub r1, r1, r4 @ dst_stride - block_width
lsr r4, #2
str r4, [sp, #36] @ "4-in-parallel" loop counter @40
str r3, [sp, #44] @ src_stride - block_width @48
push {r1} @ dst_stride - block_width @0
@ height @44
ldr r1, [lr], #4 @ coefficients
ldr r3, [lr], #4
ldr lr, [lr]
1:
@ 3 loads, 10 shuffles and then mul/acc/add/shr
@ o0: i0/i1/i2/i3/i4/i5 -> i0/i2 (ld1) | i1/i3 (ld1) | i4/i5 (ld2)
@ o1: i1/i2/i3/i4/i5/i6 -> i1/i3 (ld1) | i2/i4 (ld2) | i5/i6 (ld2/3)
@ o2: i2/i3/i4/i5/i6/i7 -> i2/i4 (ld2) | i3/i5 (ld2) | i6/i7 (ld3)
@ o3: i3/i4/i5/i6/i7/i8 -> i3/i5 (ld2) | i4/i6 (ld2/3) | i7/i8 (ld3)
ldr r7, [r2, #5] @ ld3 -> src[5-8]
ldr r6, [r2, #2] @ ld2 -> src[2-5]
ldr r5, [r2], #4 @ ld1 -> src[0-3]
pkhtb r7, r7, r7, asr #8 @ src[8,7,7,6]
uxtb16 r9, r6, ror #8 @ src[5] | src[3]
uxtb16 r6, r6 @ src[4] | src[2]
uxtb16 r8, r5, ror #8 @ src[3] | src[1]
uxtb16 r11, r7, ror #8 @ src[8] | src[7]
uxtb16 r7, r7 @ src[7] | src[6]
pkhtb r10, r9, r6, asr #16 @ src[5] | src[4]
uxtb16 r5, r5 @ src[2] | src[0]
smuad r11, r11, lr @ filter[3][2] -> r11
subs r4, r4, #1
pkhbt r12, r10, r7, lsl #16 @ src[6] | src[4]
smuad r7, r7, lr @ filter[2][2] -> r7
smuad r5, r5, r1 @ filter[0][0] -> r5
smlad r11, r9, r1, r11 @ filter[3][0] -> r11
smlad r7, r9, r3, r7 @ filter[2][1] -> r7
smuad r9, r8, r1 @ filter[1][0] -> r9
smlad r5, r8, r3, r5 @ filter[0][1] -> r5
pkhtb r8, r12, r10, asr #16 @ src[6] | src[5]
smlad r11, r12, r3, r11 @ filter[3][1] -> r11
smlad r9, r6, r3, r9 @ filter[1][1] -> r9
smlad r5, r10, lr, r5 @ filter[0][2] -> r5
smlad r7, r6, r1, r7 @ filter[2][0] -> r7
smlad r9, r8, lr, r9 @ filter[1][2] -> r9
add r5, r5, #0x40 @ round_shift_and_clamp[0]
add r9, r9, #0x40 @ round_shift_and_clamp[1]
add r7, r7, #0x40 @ round_shift_and_clamp[2]
add r11, r11, #0x40 @ round_shift_and_clamp[3]
usat r5, #8, r5, asr #7
usat r9, #8, r9, asr #7
usat r7, #8, r7, asr #7
usat r11, #8, r11, asr #7
strb r5, [r0], #1 @ store res[0]
strb r9, [r0], #1 @ store res[1]
strb r7, [r0], #1 @ store res[2]
strb r11,[r0], #1 @ store res[3]
bne 1b
ldr r12,[sp, #44] @ height = outer-loop counter
subs r12, r12, #1
T itttt ne
ldrne r4, [sp, #40] @ 4-in-parallel loop counter
ldrne r5, [sp, #48]
ldrne r6, [sp]
strne r12,[sp, #44]
add r2, r2, r5 @ move to next input/output lines
add r0, r0, r6
bne 1b
add sp, sp, #4 @ restore stack after push{r1} above
pop {r4 - r11, pc}
endfunc
@ void put_vp8_epel_v6(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int my)
function ff_put_vp8_epel_v6_armv6, export=1
push {r4 - r11, lr}
movrel lr, sixtap_filters_13245600 - 16
ldr r12,[sp, #44] @ vp8_filter index
ldr r4, [sp, #36] @ width
add lr, lr, r12, lsl #3
sub r1, r1, r4 @ dst_stride - block_width
lsr r4, #2
str r4, [sp, #36] @ "4-in-parallel" loop counter @40
str r3, [sp, #44] @ src_stride - block_width @48
push {r1} @ dst_stride - block_width @0
@ height @44
1:
add r1, r3, r3, lsl #1 @ stride * 3
ldr_dpren r5, r2, r3 @ src[0,1,2,3 + stride * 1]
ldr r6, [r2, r3] @ src[0,1,2,3 + stride * 3]
ldr r7, [r2, r3, lsl #1] @ src[0,1,2,3 + stride * 4]
ldr r8, [r2, r1] @ src[0,1,2,3 + stride * 5]
@ byte -> word and "transpose"
uxtb16 r9, r5, ror #8 @ src[3 + stride*1] | src[1 + stride*1]
uxtb16 r10, r6, ror #8 @ src[3 + stride*3] | src[1 + stride*3]
uxtb16 r11, r7, ror #8 @ src[3 + stride*4] | src[1 + stride*4]
uxtb16 r12, r8, ror #8 @ src[3 + stride*5] | src[1 + stride*5]
uxtb16 r5, r5 @ src[2 + stride*1] | src[0 + stride*1]
uxtb16 r6, r6 @ src[2 + stride*3] | src[0 + stride*3]
uxtb16 r7, r7 @ src[2 + stride*4] | src[0 + stride*4]
uxtb16 r8, r8 @ src[2 + stride*5] | src[0 + stride*5]
pkhbt r1, r9, r10, lsl #16 @ src[1 + stride*3] | src[1 + stride*1]
pkhtb r9, r10, r9, asr #16 @ src[3 + stride*3] | src[3 + stride*1]
pkhbt r10, r11, r12, lsl #16 @ src[1 + stride*5] | src[1 + stride*4]
pkhtb r11, r12, r11, asr #16 @ src[3 + stride*5] | src[3 + stride*4]
pkhbt r12, r5, r6, lsl #16 @ src[0 + stride*3] | src[0 + stride*1]
pkhtb r5, r6, r5, asr #16 @ src[2 + stride*3] | src[2 + stride*1]
pkhbt r6, r7, r8, lsl #16 @ src[0 + stride*5] | src[0 + stride*4]
pkhtb r7, r8, r7, asr #16 @ src[2 + stride*5] | src[2 + stride*4]
ldr r8, [lr, #4] @ stall - if only I had more registers...
smuad r12, r12, r8 @ filter[0][1]
smuad r1, r1, r8 @ filter[1][1]
smuad r5, r5, r8 @ filter[2][1]
smuad r9, r9, r8 @ filter[3][1]
ldr r8, [lr, #8] @ stall - if only I had more registers...
smlad r12, r6, r8, r12 @ filter[0][2]
smlad r1, r10, r8, r1 @ filter[1][2]
ldr_dpren r6, r2, r3, lsl #1 @ src[0,1,2,3 + stride * 0]
ldr r10,[r2], #4 @ src[0,1,2,3 + stride * 2]
smlad r5, r7, r8, r5 @ filter[2][2]
smlad r9, r11, r8, r9 @ filter[3][2]
uxtb16 r7, r6, ror #8 @ src[3 + stride*0] | src[1 + stride*0]
uxtb16 r11, r10, ror #8 @ src[3 + stride*2] | src[1 + stride*2]
uxtb16 r6, r6 @ src[2 + stride*0] | src[0 + stride*0]
uxtb16 r10, r10 @ src[2 + stride*2] | src[0 + stride*2]
pkhbt r8, r7, r11, lsl #16 @ src[1 + stride*2] | src[1 + stride*0]
pkhtb r7, r11, r7, asr #16 @ src[3 + stride*2] | src[3 + stride*0]
pkhbt r11, r6, r10, lsl #16 @ src[0 + stride*2] | src[0 + stride*0]
pkhtb r6, r10, r6, asr #16 @ src[2 + stride*2] | src[2 + stride*0]
ldr r10,[lr] @ stall - if only I had more registers...
subs r4, r4, #1 @ counter--
smlad r12, r11, r10, r12 @ filter[0][0]
smlad r1, r8, r10, r1 @ filter[1][0]
smlad r5, r6, r10, r5 @ filter[2][0]
smlad r9, r7, r10, r9 @ filter[3][0]
add r12, r12, #0x40 @ round_shift_and_clamp[0]
add r1, r1, #0x40 @ round_shift_and_clamp[1]
add r5, r5, #0x40 @ round_shift_and_clamp[2]
add r9, r9, #0x40 @ round_shift_and_clamp[3]
usat r12, #8, r12, asr #7
usat r1, #8, r1, asr #7
usat r5, #8, r5, asr #7
usat r9, #8, r9, asr #7
strb r12,[r0], #1 @ store res[0]
strb r1, [r0], #1 @ store res[1]
strb r5, [r0], #1 @ store res[2]
strb r9, [r0], #1 @ store res[3]
bne 1b
ldr r12,[sp, #44] @ height = outer-loop counter
subs r12, r12, #1
T itttt ne
ldrne r4, [sp, #40] @ 4-in-parallel loop counter
ldrne r6, [sp, #0]
subne r2, r2, r4, lsl #2
strne r12,[sp, #44]
add r0, r0, r6
add r2, r2, r3 @ move to next input/output lines
bne 1b
add sp, sp, #4 @ restore stack after push{r1} above
pop {r4 - r11, pc}
endfunc
@ void put_vp8_epel_h4(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int mx)
function ff_put_vp8_epel_h4_armv6, export=1
push {r4 - r11, lr}
subs r2, r2, #1
movrel lr, fourtap_filters_1324 - 4
ldr r4, [sp, #36] @ width
ldr r12,[sp, #44] @ vp8_filter index
add lr, lr, r12, lsl #2
sub r3, r3, r4 @ src_stride - block_width
sub r1, r1, r4 @ dst_stride - block_width
ldr r5, [lr]
ldr r6, [lr, #4]
asr r4, #2
ldr lr, [sp, #40] @ height = outer-loop counter
str r4, [sp, #36] @ "4-in-parallel" inner loop counter
1:
@ 3 loads, 5 uxtb16s and then mul/acc/add/shr
@ o0: i0/i1/i2/i3 -> i0/i2(ld1) + i1/i3(ld1)
@ o1: i1/i2/i3/i4 -> i1/i3(ld1) + i2/i4(ld2)
@ o2: i2/i3/i4/i5 -> i2/i4(ld2) + i3/i5(ld2)
@ o3: i3/i4/i5/i6 -> i3/i5(ld2) + i4/i6(ld3)
ldr r9, [r2, #3] @ load source data
ldr r8, [r2, #2]
ldr r7, [r2], #4
uxtb16 r9, r9, ror #8 @ src[6] | src[4]
uxtb16 r10, r8, ror #8 @ src[5] | src[3]
uxtb16 r8, r8 @ src[4] | src[2]
uxtb16 r11, r7, ror #8 @ src[3] | src[1]
uxtb16 r7, r7 @ src[2] | src[0]
smuad r9, r9, r6 @ filter[3][1] -> r9
smuad r12, r10, r6 @ filter[2][1] -> r12
smuad r7, r7, r5 @ filter[0][0] -> r7
smlad r9, r10, r5, r9 @ filter[3][0] -> r9
smuad r10, r11, r5 @ filter[1][0] -> r10
smlad r12, r8, r5, r12 @ filter[2][0] -> r12
smlad r7, r11, r6, r7 @ filter[0][1] -> r7
smlad r10, r8, r6, r10 @ filter[1][1] -> r10
subs r4, r4, #1 @ counter--
add r7, r7, #0x40 @ round_shift_and_clamp[0]
add r10, r10, #0x40 @ round_shift_and_clamp[1]
add r12, r12, #0x40 @ round_shift_and_clamp[2]
add r9, r9, #0x40 @ round_shift_and_clamp[3]
usat r7, #8, r7, asr #7
usat r10, #8, r10, asr #7
usat r12, #8, r12, asr #7
usat r9, #8, r9, asr #7
strb r7, [r0], #1 @ store res[0]
strb r10,[r0], #1 @ store res[1]
strb r12,[r0], #1 @ store res[2]
strb r9, [r0], #1 @ store res[3]
bne 1b
subs lr, lr, #1
T it ne
ldrne r4, [sp, #36] @ 4-in-parallel loop counter
add r2, r2, r3 @ move to next input/output lines
add r0, r0, r1
bne 1b
pop {r4 - r11, pc}
endfunc
@ void put_vp8_epel_v4(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int my)
function ff_put_vp8_epel_v4_armv6, export=1
push {r4 - r11, lr}
movrel lr, fourtap_filters_1324 - 4
ldr r12,[sp, #44] @ vp8_filter index
ldr r4, [sp, #36] @ width
add lr, lr, r12, lsl #2
sub r1, r1, r4 @ dst_stride - block_width
asr r4, #2
ldr r5, [lr]
ldr r6, [lr, #4]
str r4, [sp, #36] @ "4-in-parallel" loop counter @40
str r3, [sp, #44] @ src_stride @48
push {r1} @ dst_stride - block_width @36
@ height @44
1:
ldr lr, [r2, r3, lsl #1] @ load source pixels
ldr r12,[r2, r3]
ldr_dpren r7, r2, r3
ldr r11,[r2], #4
@ byte -> word and "transpose"
uxtb16 r8, lr, ror #8 @ src[3 + stride*3] | src[1 + stride*3]
uxtb16 r9, r12, ror #8 @ src[3 + stride*2] | src[1 + stride*2]
uxtb16 r3, r7, ror #8 @ src[3 + stride*0] | src[1 + stride*0]
uxtb16 r1, r11, ror #8 @ src[3 + stride*1] | src[1 + stride*1]
uxtb16 lr, lr @ src[2 + stride*3] | src[0 + stride*3]
uxtb16 r12, r12 @ src[2 + stride*2] | src[0 + stride*2]
uxtb16 r7, r7 @ src[2 + stride*0] | src[0 + stride*0]
uxtb16 r11, r11 @ src[2 + stride*1] | src[0 + stride*1]
pkhbt r10, r1, r8, lsl #16 @ src[1 + stride*3] | src[1 + stride*1]
pkhtb r1, r8, r1, asr #16 @ src[3 + stride*3] | src[3 + stride*1]
pkhbt r8, r3, r9, lsl #16 @ src[1 + stride*2] | src[1 + stride*0]
pkhtb r3, r9, r3, asr #16 @ src[3 + stride*2] | src[3 + stride*0]
pkhbt r9, r11, lr, lsl #16 @ src[0 + stride*3] | src[0 + stride*1]
pkhtb r11, lr, r11, asr #16 @ src[2 + stride*3] | src[2 + stride*1]
pkhbt lr, r7, r12, lsl #16 @ src[0 + stride*2] | src[0 + stride*0]
pkhtb r7, r12, r7, asr #16 @ src[2 + stride*2] | src[2 + stride*0]
smuad r9, r9, r6 @ filter[0][1]
smuad r10, r10, r6 @ filter[1][1]
smuad r11, r11, r6 @ filter[2][1]
smuad r1, r1, r6 @ filter[3][1]
smlad r9, lr, r5, r9 @ filter[0][0]
smlad r10, r8, r5, r10 @ filter[1][0]
smlad r11, r7, r5, r11 @ filter[2][0]
smlad r1, r3, r5, r1 @ filter[3][0]
subs r4, r4, #1 @ counter--
ldr r3, [sp, #48] @ FIXME prevent clobber of r3 above?
add r9, r9, #0x40 @ round_shift_and_clamp[0]
add r10, r10, #0x40 @ round_shift_and_clamp[1]
add r11, r11, #0x40 @ round_shift_and_clamp[2]
add r1, r1, #0x40 @ round_shift_and_clamp[3]
usat r9, #8, r9, asr #7
usat r10, #8, r10, asr #7
usat r11, #8, r11, asr #7
usat r1, #8, r1, asr #7
strb r9, [r0], #1 @ store result
strb r10,[r0], #1
strb r11,[r0], #1
strb r1, [r0], #1
bne 1b
ldr r12,[sp, #44] @ height = outer-loop counter
subs r12, r12, #1
T ittt ne
ldrne r4, [sp, #40] @ 4-in-parallel loop counter
ldrne r9, [sp, #0]
strne r12,[sp, #44]
sub r2, r2, r4, lsl #2
add r0, r0, r9
add r2, r2, r3 @ move to next input/output lines
bne 1b
add sp, sp, #4 @ restore stack after push{r1} above
pop {r4 - r11, pc}
endfunc
@ void put_vp8_bilin_h(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int mx)
function ff_put_vp8_bilin_h_armv6, export=1
push {r4 - r9, lr}
ldr r8, [sp, #36] @ vp8_filter index
ldr r12,[sp, #32] @ height = outer-loop counter
ldr r4, [sp, #28] @ width
lsl r5, r8, #16 @ mx << 16
sub r3, r3, r4 @ src_stride - block_width
sub r1, r1, r4 @ dst_stride - block_width
asr r4, #2
sub r5, r5, r8 @ (mx << 16) | (-mx)
str r4, [sp, #28] @ "4-in-parallel" loop counter
add r5, r5, #8 @ (8 - mx) | (mx << 16) = filter coefficients
1:
ldrb r6, [r2], #1 @ load source data
ldrb r7, [r2], #1
ldrb r8, [r2], #1
ldrb r9, [r2], #1
ldrb lr, [r2]
pkhbt r6, r6, r7, lsl #16 @ src[1] | src[0]
pkhbt r7, r7, r8, lsl #16 @ src[2] | src[1]
pkhbt r8, r8, r9, lsl #16 @ src[3] | src[2]
pkhbt r9, r9, lr, lsl #16 @ src[4] | src[3]
smuad r6, r6, r5 @ apply the filter
smuad r7, r7, r5
smuad r8, r8, r5
smuad r9, r9, r5
subs r4, r4, #1 @ counter--
add r6, r6, #0x4 @ round_shift_and_clamp
add r7, r7, #0x4
add r8, r8, #0x4
add r9, r9, #0x4
asr r6, #3
asr r7, #3
pkhbt r6, r6, r8, lsl #13
pkhbt r7, r7, r9, lsl #13
orr r6, r6, r7, lsl #8
str r6, [r0], #4 @ store result
bne 1b
ldr r4, [sp, #28] @ 4-in-parallel loop counter
subs r12, r12, #1
add r2, r2, r3 @ move to next input/output lines
add r0, r0, r1
bne 1b
pop {r4 - r9, pc}
endfunc
@ void put_vp8_bilin_v(uint8_t *dst, int dststride, uint8_t *src,
@ int srcstride, int w, int h, int my)
function ff_put_vp8_bilin_v_armv6, export=1
push {r4 - r11, lr}
ldr r11,[sp, #44] @ vp8_filter index
ldr r4, [sp, #36] @ width
mov r5, r11, lsl #16 @ mx << 16
ldr r12,[sp, #40] @ height = outer-loop counter
sub r1, r1, r4
sub r5, r5, r11 @ (mx << 16) | (-mx)
asr r4, #2
add r5, r5, #8 @ (8 - mx) | (mx << 16) = filter coefficients
str r4, [sp, #36] @ "4-in-parallel" loop counter
1:
ldrb r10,[r2, r3] @ load the data
ldrb r6, [r2], #1
ldrb r11,[r2, r3]
ldrb r7, [r2], #1
ldrb lr, [r2, r3]
ldrb r8, [r2], #1
ldrb r9, [r2, r3]
pkhbt r6, r6, r10, lsl #16
ldrb r10,[r2], #1
pkhbt r7, r7, r11, lsl #16
pkhbt r8, r8, lr, lsl #16
pkhbt r9, r10, r9, lsl #16
smuad r6, r6, r5 @ apply the filter
smuad r7, r7, r5
smuad r8, r8, r5
smuad r9, r9, r5
subs r4, r4, #1 @ counter--
add r6, r6, #0x4 @ round_shift_and_clamp
add r7, r7, #0x4
add r8, r8, #0x4
add r9, r9, #0x4
asr r6, #3
asr r7, #3
pkhbt r6, r6, r8, lsl #13
pkhbt r7, r7, r9, lsl #13
orr r6, r6, r7, lsl #8
str r6, [r0], #4 @ store result
bne 1b
ldr r4, [sp, #36] @ 4-in-parallel loop counter
subs r12, r12, #1
add r2, r2, r3 @ move to next input/output lines
add r0, r0, r1
sub r2, r2, r4, lsl #2
bne 1b
pop {r4 - r11, pc}
endfunc
|