306 Commits

Author SHA1 Message Date
Mohd Zaid c150ba6c9b riscv64/filmgrain: Implemented generate_grain_y for 8bpc in RVV 2026-06-28 08:32:12 +02:00
Mikołaj Zalewski b62f72fc26 riscv: mc: remove some failed experiments/debug code 2026-06-27 06:36:58 +00:00
Mikołaj Zalewski 7de554e025 riscv: mc: make profiles more detailed 2026-06-27 06:36:58 +00:00
Mikołaj Zalewski 29c80ca095 riscv: mc: faster 8tap implementation for mx==0 && my==0 2026-06-27 06:36:58 +00:00
Mikołaj Zalewski f009daed89 riscv: mc: add 6tap optimization for non-sharp filters 2026-06-27 06:36:58 +00:00
Mikołaj Zalewski 97c431bddb Implement prep_8tap_c and put_8tap_c in RISC-V assembly
mct_8tap_* (i.e. prep_8tap) on Spacemit K1:
  name                                         ticks +/- stddev         time (nanoseconds) (vs ref)
  nop:                                          13.7 +/- 0.5             7.4 ns +/- 0.6
  mct_8tap_regular_w4_0_8bpc_c:                247.1 +/- 25.3          133.6 ns +/- 16.6
  mct_8tap_regular_w4_0_8bpc_rvv:              183.7 +/- 20.7           99.3 ns +/- 13.2   ( 1.31x)
  mct_8tap_regular_w4_h_8bpc_c:               1210.2 +/- 65.5          654.4 ns +/- 57.5
  mct_8tap_regular_w4_h_8bpc_rvv:              395.5 +/- 31.6          213.9 ns +/- 22.7   ( 3.02x)
  mct_8tap_regular_w4_hv_8bpc_c:              3156.1 +/- 110.0        1706.6 ns +/- 131.6
  mct_8tap_regular_w4_hv_8bpc_rvv:            1019.4 +/- 55.8          551.2 ns +/- 48.6   ( 3.08x)
  mct_8tap_regular_w4_v_8bpc_c:               1242.1 +/- 59.2          671.7 ns +/- 56.4
  mct_8tap_regular_w4_v_8bpc_rvv:              683.4 +/- 47.3          369.6 ns +/- 36.3   ( 1.80x)
  mct_8tap_regular_w8_0_8bpc_c:                511.9 +/- 30.9          276.8 ns +/- 25.4
  mct_8tap_regular_w8_0_8bpc_rvv:              220.9 +/- 19.3          119.4 ns +/- 13.4   ( 2.28x)
  mct_8tap_regular_w8_h_8bpc_c:               3189.3 +/- 105.6        1724.6 ns +/- 131.6
  mct_8tap_regular_w8_h_8bpc_rvv:              810.5 +/- 45.7          438.3 ns +/- 39.2   ( 3.91x)
  mct_8tap_regular_w8_hv_8bpc_c:              7545.8 +/- 165.9        4080.3 ns +/- 294.0
  mct_8tap_regular_w8_hv_8bpc_rvv:            1811.2 +/- 76.1          979.4 ns +/- 79.1   ( 4.15x)
  mct_8tap_regular_w8_v_8bpc_c:               3236.9 +/- 100.5        1750.3 ns +/- 132.0
  mct_8tap_regular_w8_v_8bpc_rvv:              929.4 +/- 45.5          502.6 ns +/- 42.6   ( 3.47x)
  mct_8tap_regular_w16_0_8bpc_c:              1216.4 +/- 49.1          657.7 ns +/- 52.5
  mct_8tap_regular_w16_0_8bpc_rvv:             298.3 +/- 21.2          161.3 ns +/- 16.1   ( 4.04x)
  mct_8tap_regular_w16_h_8bpc_c:              8650.9 +/- 169.5        4677.9 ns +/- 333.7
  mct_8tap_regular_w16_h_8bpc_rvv:            1121.2 +/- 48.5          606.3 ns +/- 49.4   ( 7.69x)
  mct_8tap_regular_w16_hv_8bpc_c:            19245.5 +/- 252.9       10406.8 ns +/- 726.4
  mct_8tap_regular_w16_hv_8bpc_rvv:           2462.2 +/- 78.2         1331.4 ns +/- 100.8  ( 7.80x)
  mct_8tap_regular_w16_v_8bpc_c:              8734.8 +/- 184.2        4723.3 ns +/- 339.1
  mct_8tap_regular_w16_v_8bpc_rvv:            1304.2 +/- 57.9          705.2 ns +/- 57.8   ( 6.67x)
  mct_8tap_regular_w32_0_8bpc_c:              4306.2 +/- 115.5        2328.5 ns +/- 171.7
  mct_8tap_regular_w32_0_8bpc_rvv:            1005.3 +/- 46.7          543.6 ns +/- 45.2   ( 4.27x)
  mct_8tap_regular_w32_h_8bpc_c:             33608.6 +/- 431.1       18173.5 ns +/- 1267.4
  mct_8tap_regular_w32_h_8bpc_rvv:            4139.9 +/- 108.9        2238.6 ns +/- 164.6  ( 8.11x)
  mct_8tap_regular_w32_hv_8bpc_c:            67451.1 +/- 529.1       36473.5 ns +/- 2515.7
  mct_8tap_regular_w32_hv_8bpc_rvv:           9176.4 +/- 188.4        4962.1 ns +/- 355.4  ( 7.34x)
  mct_8tap_regular_w32_v_8bpc_c:             33667.8 +/- 343.0       18205.5 ns +/- 1261.4
  mct_8tap_regular_w32_v_8bpc_rvv:            5104.6 +/- 133.5        2760.3 ns +/- 202.8  ( 6.59x)
  mct_8tap_regular_w64_0_8bpc_c:             11674.5 +/- 263.6        6312.9 ns +/- 456.1
  mct_8tap_regular_w64_0_8bpc_rvv:            2743.7 +/- 114.5        1483.6 ns +/- 119.6  ( 4.24x)
  mct_8tap_regular_w64_h_8bpc_c:             93827.9 +/- 462.2       50736.5 ns +/- 3485.3
  mct_8tap_regular_w64_h_8bpc_rvv:           11476.6 +/- 255.9        6205.8 ns +/- 447.8  ( 8.17x)
  mct_8tap_regular_w64_hv_8bpc_c:           180208.3 +/- 898.7       97445.8 ns +/- 6694.4
  mct_8tap_regular_w64_hv_8bpc_rvv:          24336.9 +/- 339.9       13159.9 ns +/- 920.7  ( 7.40x)
  mct_8tap_regular_w64_v_8bpc_c:             94153.0 +/- 625.3       50912.3 ns +/- 3504.9
  mct_8tap_regular_w64_v_8bpc_rvv:           13947.6 +/- 255.4        7542.0 ns +/- 535.4  ( 6.75x)
  mct_8tap_regular_w128_0_8bpc_c:            32774.8 +/- 1011.1      17722.6 ns +/- 1335.3
  mct_8tap_regular_w128_0_8bpc_rvv:           9312.7 +/- 298.8        5035.8 ns +/- 382.1  ( 3.51x)
  mct_8tap_regular_w128_h_8bpc_c:           266659.9 +/- 1728.1     144193.6 ns +/- 9924.4
  mct_8tap_regular_w128_h_8bpc_rvv:          34046.5 +/- 465.2       18410.3 ns +/- 1287.0 ( 7.83x)
  mct_8tap_regular_w128_hv_8bpc_c:          496508.0 +/- 3682.8     268481.7 ns +/- 18505.0
  mct_8tap_regular_w128_hv_8bpc_rvv:         68054.4 +/- 661.6       36799.7 ns +/- 2547.3 ( 7.29x)
  mct_8tap_regular_w128_v_8bpc_c:           266312.9 +/- 1310.6     144006.0 ns +/- 9892.3
  mct_8tap_regular_w128_v_8bpc_rvv:          40538.4 +/- 594.7       21920.7 ns +/- 1537.0 ( 6.57x)
  mct_8tap_sharp_w4_0_8bpc_c:                  241.9 +/- 24.6          130.8 ns +/- 16.2
  mct_8tap_sharp_w4_0_8bpc_rvv:                183.3 +/- 20.4           99.1 ns +/- 13.1   ( 1.29x)
  mct_8tap_sharp_w4_h_8bpc_c:                 1217.3 +/- 79.8          658.3 ns +/- 62.9
  mct_8tap_sharp_w4_h_8bpc_rvv:                396.5 +/- 30.6          214.4 ns +/- 22.3   ( 3.03x)
  mct_8tap_sharp_w4_hv_8bpc_c:                3190.5 +/- 200.2        1725.2 ns +/- 161.5
  mct_8tap_sharp_w4_hv_8bpc_rvv:              1019.7 +/- 58.1          551.4 ns +/- 49.5   ( 3.11x)
  mct_8tap_sharp_w4_v_8bpc_c:                 1243.8 +/- 71.3          672.6 ns +/- 60.5
  mct_8tap_sharp_w4_v_8bpc_rvv:                679.1 +/- 42.7          367.2 ns +/- 34.4   ( 1.82x)
  mct_8tap_sharp_w8_0_8bpc_c:                  517.0 +/- 32.8          279.6 ns +/- 26.3
  mct_8tap_sharp_w8_0_8bpc_rvv:                219.9 +/- 18.4          118.9 ns +/- 13.0   ( 2.32x)
  mct_8tap_sharp_w8_h_8bpc_c:                 3196.0 +/- 111.6        1728.2 ns +/- 133.3
  mct_8tap_sharp_w8_h_8bpc_rvv:                807.2 +/- 41.7          436.5 ns +/- 37.7   ( 3.94x)
  mct_8tap_sharp_w8_hv_8bpc_c:                7597.1 +/- 251.6        4108.1 ns +/- 313.6
  mct_8tap_sharp_w8_hv_8bpc_rvv:              1816.4 +/- 89.9          982.2 ns +/- 83.5   ( 4.16x)
  mct_8tap_sharp_w8_v_8bpc_c:                 3248.5 +/- 128.5        1756.6 ns +/- 139.5
  mct_8tap_sharp_w8_v_8bpc_rvv:                930.1 +/- 47.4          503.0 ns +/- 43.2   ( 3.47x)
  mct_8tap_sharp_w16_0_8bpc_c:                1215.6 +/- 49.8          657.3 ns +/- 52.7
  mct_8tap_sharp_w16_0_8bpc_rvv:               298.7 +/- 21.0          161.5 ns +/- 16.0   ( 4.03x)
  mct_8tap_sharp_w16_h_8bpc_c:                8654.4 +/- 180.4        4679.8 ns +/- 335.6
  mct_8tap_sharp_w16_h_8bpc_rvv:              1120.7 +/- 50.2          606.0 ns +/- 49.8   ( 7.69x)
  mct_8tap_sharp_w16_hv_8bpc_c:              19230.0 +/- 266.5       10398.4 ns +/- 727.3
  mct_8tap_sharp_w16_hv_8bpc_rvv:             2461.3 +/- 84.1         1330.9 ns +/- 102.2  ( 7.79x)
  mct_8tap_sharp_w16_v_8bpc_c:                8716.5 +/- 174.6        4713.4 ns +/- 336.9
  mct_8tap_sharp_w16_v_8bpc_rvv:              1298.1 +/- 56.9          701.9 ns +/- 57.4   ( 6.69x)
  mct_8tap_sharp_w32_0_8bpc_c:                4337.5 +/- 124.4        2345.5 ns +/- 174.6
  mct_8tap_sharp_w32_0_8bpc_rvv:              1005.5 +/- 47.6          543.7 ns +/- 45.5   ( 4.29x)
  mct_8tap_sharp_w32_h_8bpc_c:               33641.5 +/- 430.1       18191.3 ns +/- 1268.5
  mct_8tap_sharp_w32_h_8bpc_rvv:              4144.4 +/- 115.9        2241.1 ns +/- 166.2  ( 8.10x)
  mct_8tap_sharp_w32_hv_8bpc_c:              67427.0 +/- 454.2       36460.5 ns +/- 2510.4
  mct_8tap_sharp_w32_hv_8bpc_rvv:             9148.1 +/- 168.5        4946.7 ns +/- 351.3  ( 7.37x)
  mct_8tap_sharp_w32_v_8bpc_c:               33694.0 +/- 379.3       18219.7 ns +/- 1265.5
  mct_8tap_sharp_w32_v_8bpc_rvv:              5112.8 +/- 138.7        2764.7 ns +/- 204.2  ( 6.58x)
  mct_8tap_sharp_w64_0_8bpc_c:               11731.5 +/- 439.7        6343.7 ns +/- 497.3
  mct_8tap_sharp_w64_0_8bpc_rvv:              2745.6 +/- 118.5        1484.6 ns +/- 120.8  ( 4.26x)
  mct_8tap_sharp_w64_h_8bpc_c:               93834.9 +/- 499.9       50740.3 ns +/- 3487.1
  mct_8tap_sharp_w64_h_8bpc_rvv:             11464.3 +/- 230.3        6199.2 ns +/- 443.2  ( 8.18x)
  mct_8tap_sharp_w64_hv_8bpc_c:             179581.4 +/- 721.3       97106.8 ns +/- 6664.7
  mct_8tap_sharp_w64_hv_8bpc_rvv:            24274.0 +/- 291.4       13125.9 ns +/- 913.4  ( 7.40x)
  mct_8tap_sharp_w64_v_8bpc_c:               94130.9 +/- 594.7       50900.3 ns +/- 3502.5
  mct_8tap_sharp_w64_v_8bpc_rvv:             13973.8 +/- 314.0        7556.2 ns +/- 545.7  ( 6.73x)
  mct_8tap_sharp_w128_0_8bpc_c:              32477.9 +/- 519.4       17562.1 ns +/- 1236.6
  mct_8tap_sharp_w128_0_8bpc_rvv:             9491.2 +/- 405.8        5132.3 ns +/- 416.4  ( 3.41x)
  mct_8tap_sharp_w128_h_8bpc_c:             264537.8 +/- 979.2      143046.1 ns +/- 9815.0
  mct_8tap_sharp_w128_h_8bpc_rvv:            34011.1 +/- 499.9       18391.2 ns +/- 1289.6 ( 7.77x)
  mct_8tap_sharp_w128_hv_8bpc_c:            491981.0 +/- 1432.9     266033.7 ns +/- 18243.3
  mct_8tap_sharp_w128_hv_8bpc_rvv:           67976.9 +/- 761.5       36757.8 ns +/- 2552.9 ( 7.24x)
  mct_8tap_sharp_w128_v_8bpc_c:             265775.7 +/- 945.2      143715.5 ns +/- 9859.8
  mct_8tap_sharp_w128_v_8bpc_rvv:            40519.1 +/- 717.7       21910.3 ns +/- 1552.0 ( 6.56x)

mc_8tap_* (i.e. put_8tap) on Spacemit K1:
  name                                        ticks +/- stddev         time (nanoseconds) (vs ref)
  nop:                                         17.4 +/- 0.6             7.8 ns +/- 0.5
  mc_8tap_regular_w2_0_8bpc_c:                502.4 +/- 23.5          224.2 ns +/- 15.1
  mc_8tap_regular_w2_0_8bpc_rvv:              247.8 +/- 15.4          110.6 ns +/- 8.7    ( 2.01x)
  mc_8tap_regular_w2_h_8bpc_c:                905.8 +/- 39.7          404.3 ns +/- 26.4
  mc_8tap_regular_w2_h_8bpc_rvv:              500.5 +/- 23.5          223.4 ns +/- 15.1   ( 1.80x)
  mc_8tap_regular_w2_hv_8bpc_c:              2243.3 +/- 60.2         1001.2 ns +/- 55.2
  mc_8tap_regular_w2_hv_8bpc_rvv:            1271.5 +/- 42.0          567.5 ns +/- 33.2   ( 1.76x)
  mc_8tap_regular_w2_v_8bpc_c
2026-06-27 06:36:58 +00:00
Jean-Baptiste Kempf 77ef66354d On the road to 1.5.4 2026-06-24 13:01:36 +02:00
Matthias Dressel 953c7139a5 CI: Update image
* Adds xxhash so building with it is tested in CI
* Updates qemu to 11.0.1 to catch some illegal instructions in RVV
  See: https://code.videolan.org/videolan/dav1d/-/merge_requests/1894#note_555609
2026-06-24 12:02:48 +02:00
Mohd Zaid ee0255b3ce riscv64/ipred: Optimize pal_pred 8 and 16 bpc variant on RVV
removed redundant instructions from cpu to vector co-processor
2026-06-23 12:11:08 +00:00
Mohd Zaid a717c62dc3 riscv/ipred: Optimized ipred_v & ipred_h for 16bpc on RVV
First implementation of `ipred_v_16bpc_rvv` used explicit m8 grouping
changed it to m1 and m2 depending upon what fits the use case. Used four
write instruction per loop instead of one to utilize available load
store units to their maximum.

Optimizaion involves using multiple vector registers independently for
the rows and iteration on rows for larger dimensions (32x32) & (64x64).
2026-06-22 05:59:10 +00:00
Ronald S. Bultje 14c73c7db3 cdef: re-add comments accidentally removed in previous commit
(See c9897943.)
2026-06-17 07:30:52 -04:00
Herman Semenoff c98979434b cdef: move out of loop constant-calculated expressions 2026-06-17 11:21:07 +00:00
Herman Semenoff 6b30911e2d refmvs: move out of loop constant-calculated expressions
Signed-off-by: Herman Semenoff <GermanAizek@yandex.ru>
2026-06-17 10:56:15 +00:00
Mikołaj Zalewski bd95380139 ipred_dc/dc_left/dc_top/dc_128 implementation in RISC-V assembly
Results on Spacemit K1:

Benchmark results:
  name                                ticks +/- stddev         time (nanoseconds) (vs ref)
  nop:                                 12.1 +/- 0.5             6.2 ns +/- 0.4
  intra_pred_dc_128_w4_8bpc_c:         41.0 +/- 8.8            20.9 ns +/- 4.7
  intra_pred_dc_128_w4_8bpc_rvv:       31.6 +/- 7.8            16.1 ns +/- 4.1    ( 1.17x)
  intra_pred_dc_128_w4_16bpc_c:        90.1 +/- 13.9           46.0 ns +/- 7.7
  intra_pred_dc_128_w8_8bpc_c:         77.1 +/- 10.7           39.4 ns +/- 6.0
  intra_pred_dc_128_w8_8bpc_rvv:       42.0 +/- 7.7            21.5 ns +/- 4.2    ( 1.73x)
  intra_pred_dc_128_w8_16bpc_c:       200.2 +/- 18.8          102.3 ns +/- 11.4
  intra_pred_dc_128_w16_8bpc_c:       170.7 +/- 15.8           87.2 ns +/- 9.6
  intra_pred_dc_128_w16_8bpc_rvv:      58.3 +/- 8.3            29.8 ns +/- 4.6    ( 2.82x)
  intra_pred_dc_128_w16_16bpc_c:      468.1 +/- 28.8          239.1 ns +/- 20.3
  intra_pred_dc_128_w32_8bpc_c:       397.1 +/- 31.8          202.9 ns +/- 20.2
  intra_pred_dc_128_w32_8bpc_rvv:      75.2 +/- 10.7           38.4 ns +/- 5.9    ( 5.09x)
  intra_pred_dc_128_w32_16bpc_c:      932.1 +/- 51.2          476.2 ns +/- 38.1
  intra_pred_dc_128_w64_8bpc_c:       814.2 +/- 55.7          416.0 ns +/- 37.5
  intra_pred_dc_128_w64_8bpc_rvv:     191.3 +/- 21.1           97.7 ns +/- 12.3   ( 4.16x)
  intra_pred_dc_128_w64_16bpc_c:     2088.5 +/- 85.6         1067.0 ns +/- 75.8
  intra_pred_dc_left_w4_8bpc_c:       141.6 +/- 17.5           72.3 ns +/- 10.0
  intra_pred_dc_left_w4_8bpc_rvv:      96.7 +/- 13.7           49.4 ns +/- 7.6    ( 1.41x)
  intra_pred_dc_left_w4_16bpc_c:      197.3 +/- 20.7          100.8 ns +/- 12.2
  intra_pred_dc_left_w8_8bpc_c:       194.0 +/- 17.8           99.1 ns +/- 10.8
  intra_pred_dc_left_w8_8bpc_rvv:     110.6 +/- 13.0           56.5 ns +/- 7.5    ( 1.71x)
  intra_pred_dc_left_w8_16bpc_c:      358.6 +/- 27.8          183.2 ns +/- 17.8
  intra_pred_dc_left_w16_8bpc_c:      310.1 +/- 22.4          158.4 ns +/- 14.7
  intra_pred_dc_left_w16_8bpc_rvv:    130.1 +/- 12.8           66.5 ns +/- 7.6    ( 2.34x)
  intra_pred_dc_left_w16_16bpc_c:     614.8 +/- 34.3          314.1 ns +/- 25.4
  intra_pred_dc_left_w32_8bpc_c:      543.6 +/- 36.0          277.7 ns +/- 24.5
  intra_pred_dc_left_w32_8bpc_rvv:    144.6 +/- 15.1           73.9 ns +/- 8.9    ( 3.68x)
  intra_pred_dc_left_w32_16bpc_c:    1101.4 +/- 57.5          562.7 ns +/- 44.0
  intra_pred_dc_left_w64_8bpc_c:      979.7 +/- 54.1          500.5 ns +/- 40.2
  intra_pred_dc_left_w64_8bpc_rvv:    257.9 +/- 24.1          131.8 ns +/- 14.6   ( 3.74x)
  intra_pred_dc_left_w64_16bpc_c:    2288.0 +/- 114.4        1168.9 ns +/- 89.7
  intra_pred_dc_top_w4_8bpc_c:        124.6 +/- 16.3           63.7 ns +/- 9.2
  intra_pred_dc_top_w4_8bpc_rvv:       89.8 +/- 13.3           45.9 ns +/- 7.4    ( 1.33x)
  intra_pred_dc_top_w4_16bpc_c:       180.8 +/- 20.8           92.3 ns +/- 12.0
  intra_pred_dc_top_w8_8bpc_c:        189.2 +/- 17.7           96.7 ns +/- 10.7
  intra_pred_dc_top_w8_8bpc_rvv:      103.3 +/- 12.4           52.8 ns +/- 7.1    ( 1.78x)
  intra_pred_dc_top_w8_16bpc_c:       319.4 +/- 24.6          163.2 ns +/- 15.8
  intra_pred_dc_top_w16_8bpc_c:       326.4 +/- 22.3          166.7 ns +/- 15.0
  intra_pred_dc_top_w16_8bpc_rvv:     122.8 +/- 12.1           62.7 ns +/- 7.2    ( 2.61x)
  intra_pred_dc_top_w16_16bpc_c:      633.4 +/- 34.2          323.6 ns +/- 25.7
  intra_pred_dc_top_w32_8bpc_c:       621.5 +/- 37.2          317.5 ns +/- 26.6
  intra_pred_dc_top_w32_8bpc_rvv:     137.7 +/- 14.8           70.4 ns +/- 8.6    ( 4.41x)
  intra_pred_dc_top_w32_16bpc_c:     1158.1 +/- 52.6          591.7 ns +/- 43.7
  intra_pred_dc_top_w64_8bpc_c:      1157.5 +/- 59.6          591.4 ns +/- 46.0
  intra_pred_dc_top_w64_8bpc_rvv:     250.4 +/- 25.0          128.0 ns +/- 14.9   ( 4.53x)
  intra_pred_dc_top_w64_16bpc_c:     2428.9 +/- 115.8        1240.9 ns +/- 93.3
  intra_pred_dc_w4_8bpc_c:            198.1 +/- 28.6          101.2 ns +/- 15.9
  intra_pred_dc_w4_8bpc_rvv:          143.8 +/- 20.3           73.5 ns +/- 11.3   ( 1.33x)
  intra_pred_dc_w4_16bpc_c:           238.4 +/- 24.1          121.8 ns +/- 14.3
  intra_pred_dc_w8_8bpc_c:            285.3 +/- 28.8          145.7 ns +/- 17.1
  intra_pred_dc_w8_8bpc_rvv:          157.9 +/- 16.2           80.7 ns +/- 9.6    ( 1.77x)
  intra_pred_dc_w8_16bpc_c:           422.4 +/- 29.7          215.8 ns +/- 19.8
  intra_pred_dc_w16_8bpc_c:           450.9 +/- 31.7          230.3 ns +/- 21.1
  intra_pred_dc_w16_8bpc_rvv:         179.0 +/- 15.3           91.5 ns +/- 9.5    ( 2.48x)
  intra_pred_dc_w16_16bpc_c:          747.0 +/- 37.7          381.7 ns +/- 29.4
  intra_pred_dc_w32_8bpc_c:           774.5 +/- 44.7          395.7 ns +/- 32.5
  intra_pred_dc_w32_8bpc_rvv:         192.7 +/- 17.4           98.5 ns +/- 10.6   ( 3.96x)
  intra_pred_dc_w32_16bpc_c:         1309.4 +/- 58.3          669.0 ns +/- 49.0
  intra_pred_dc_w64_8bpc_c:          1385.0 +/- 77.7          707.6 ns +/- 57.3
  intra_pred_dc_w64_8bpc_rvv:         305.8 +/- 26.4          156.3 ns +/- 16.3   ( 4.46x)
  intra_pred_dc_w64_16bpc_c:         2636.9 +/- 105.3        1347.2 ns +/- 94.9
2026-06-17 00:14:17 +02:00
Chris Davis e9c5800ace Precompute dav1d quantization matrix tables at build time to eliminate CoW costs 2026-06-11 18:52:56 +00:00
Cameron Cawley 6d681d5144 Replace platform-specific APIs for getting the program name in getopt fallback 2026-06-10 10:59:12 +00:00
Matthias Dressel 46e9017355 subprojects: Update checkasm to v1.2.0
Among various fixes it no longer installs the checkasm library, header
files and pkgconfig when installing dav1d.
2026-06-07 23:15:02 +02:00
Martin Storsjö 720adf9b5b ci: Add -Dtrim_dsp=false in a couple of aarch64/arm configurations
For the "release" build configurations, trim_dsp defaults to true,
while it defaults to false for "debugoptimized". This means that
the configurations with release mode, without -Dtrim_dsp=false
actually run checkasm before.

In practice, checkasm is covered by later, full-test configurations,
but this ensures that we do test it at this stage as well, as
intended.
2026-06-07 22:36:10 +02:00
Nathan E. Egge beda1b3cda riscv64/itx: Match stack allocation of 16x16 itx 2026-06-07 02:52:33 -04:00
Arpad Panyik 62501cc7db AArch64: Optimize ipred_smooth_8bpc_neon
Optimize ipred_smooth_8bpc_neon using simpler arithmetic operations and
the removal of jump table.

Relative runtime after this patch on some Cortex CPUs:

ipred_smooth:   w4      w8      w16     w32     w64
Cortex-A55:   1.041x  0.839x  0.705x  0.765x  0.802x
Cortex-A510:  1.055x  0.880x  0.669x  0.694x  0.729x
Cortex-A520:  1.113x  0.922x  0.659x  0.737x  0.783x
Cortex-A76:   0.763x  0.733x  0.608x  0.707x  0.791x
Cortex-A78:   0.840x  0.712x  0.704x  0.748x  0.786x
Cortex-A715:  0.814x  0.655x  0.798x  0.837x  0.858x
Cortex-A725:  0.813x  0.653x  0.791x  0.830x  0.854x
Cortex-X1:    0.825x  0.686x  0.667x  0.729x  0.756x
Cortex-X3:    0.865x  0.617x  0.649x  0.674x  0.688x
Cortex-X925:  0.825x  0.677x  0.641x  0.686x  0.700x
2026-05-26 12:30:26 +00:00
Arpad Panyik dbed372b70 AArch64: Optimize ipred_smooth_v_8bpc_neon further
Optimize ipred_smooth_h_8bpc_neon even further using vertical inner
loop for w >= 16 cases.

Relative runtime after this patch on some Cortex CPUs:

ipred_smooth_v:    w4      w8      w16     w32     w64
Cortex-A55:      0.985x  0.981x  0.810x  0.873x  0.907x
Cortex-A510:     0.966x  0.951x  0.950x  1.013x  1.047x
Cortex-A520:     0.924x  0.924x  0.890x  0.984x  1.030x
Cortex-A76:      0.978x  1.036x  0.899x  0.919x  0.918x
Cortex-A78:      0.997x  0.993x  0.986x  0.972x  0.983x
Cortex-A710:     1.002x  0.973x  0.984x  0.958x  1.002x
Cortex-A715:     1.073x  1.049x  1.005x  1.018x  1.012x
Cortex-A720:     1.001x  1.004x  0.990x  1.007x  1.008x
Cortex-A725:     1.002x  1.001x  0.985x  1.007x  1.006x
Cortex-X1:       0.996x  1.077x  0.927x  0.962x  0.970x
Cortex-X2:       1.012x  0.989x  0.881x  0.971x  0.981x
Cortex-X3:       1.006x  1.034x  0.841x  0.966x  0.962x
Cortex-X4:       1.020x  1.022x  0.915x  0.964x  0.985x
Cortex-X925:     1.000x  0.947x  0.936x  0.982x  0.996x
2026-05-20 13:48:18 +02:00
Arpad Panyik a38236491a AArch64: Optimize ipred_smooth_h_8bpc_neon further
Optimize ipred_smooth_h_8bpc_neon even further using vertical inner
loop for w >= 16 cases. Reorder instructions in the w = 4 handler for
Small CPUs.

Relative runtime after this patch on some Cortex CPUs:

ipred_smooth_h:    w4      w8      w16     w32     w64
Cortex-A55:      0.964x  1.003x  0.891x  0.979x  1.030x
Cortex-A510:     0.952x  0.936x  0.928x  1.004x  1.050x
Cortex-A520:     0.921x  0.925x  0.921x  0.995x  1.032x
Cortex-A76:      0.993x  1.005x  0.977x  0.995x  0.996x
Cortex-A78:      0.991x  0.998x  1.042x  0.978x  1.015x
Cortex-A710:     1.020x  0.966x  1.015x  1.015x  1.008x
Cortex-A715:     1.026x  1.051x  1.039x  1.007x  1.024x
Cortex-A720:     0.954x  0.999x  1.018x  0.999x  1.020x
Cortex-A725:     0.962x  1.000x  1.018x  1.000x  1.021x
Cortex-X1:       1.019x  0.993x  0.924x  0.983x  0.989x
Cortex-X2:       1.013x  0.991x  0.872x  0.964x  1.023x
Cortex-X3:       1.030x  0.996x  0.840x  0.953x  1.024x
Cortex-X4:       1.026x  1.005x  0.952x  0.970x  0.986x
Cortex-X925:     1.000x  0.980x  0.865x  0.899x  0.892x
2026-05-20 13:44:22 +02:00
Najmus Sakib Afsan 1718ff9ade riscv64/ipred_h: Implement ipred_h in RISC-V asm 2026-05-15 15:40:14 +00:00
Martin Storsjö c85856e360 aarch64: Fix a name mismatch in a macro error message
For the 64 bit assembly, the macro is just named "sub_sp", while it
was named "sub_sp_align" in the 32 bit form.
2026-05-15 14:24:57 +03:00
Najmus Sakib Afsan 1cfad6dbca riscv64/ipred_v: Remove redundent vxrm set instr
In function ipred_v_8bpc_rvv, rvv instructions vsetvli, vle8.v,
vse8.v do not use vxrm.

Kendryte K230                     Before            After         Delta

intra_pred_v_w4_8bpc_c:       419.2 ( 1.00x)    405.2 ( 1.00x)   -3.34%
intra_pred_v_w4_8bpc_rvv:      56.7 ( 6.88x)     48.5 ( 7.73x)  -14.46%
intra_pred_v_w8_8bpc_c:       772.9 ( 1.00x)    753.3 ( 1.00x)   -2.54%
intra_pred_v_w8_8bpc_rvv:      69.9 (10.54x)     61.5 (11.67x)  -12.02%
intra_pred_v_w16_8bpc_c:     1209.7 ( 1.00x)   1221.9 ( 1.00x)    1.01%
intra_pred_v_w16_8bpc_rvv:     88.5 (13.25x)     79.4 (14.93x)  -10.28%
intra_pred_v_w32_8bpc_c:     1898.5 ( 1.00x)   1888.9 ( 1.00x)   -0.51%
intra_pred_v_w32_8bpc_rvv:    104.9 (17.49x)     95.3 (19.18x)   -9.15%
intra_pred_v_w64_8bpc_c:     3266.0 ( 1.00x)   3138.6 ( 1.00x)   -3.90%
intra_pred_v_w64_8bpc_rvv:    196.1 (16.24x)    184.6 (16.59x)   -5.86%

SpacemiT K1                       Before            After         Delta

intra_pred_v_w4_8bpc_c:       419.2 ( 1.00x)    403.5 ( 1.00x)   -3.75%
intra_pred_v_w4_8bpc_rvv:      56.7 ( 6.88x)     31.9 (11.57x)  -43.74%
intra_pred_v_w8_8bpc_c:       772.9 ( 1.00x)    756.8 ( 1.00x)   -2.08%
intra_pred_v_w8_8bpc_rvv:      69.9 (10.54x)     43.9 (16.39x)  -37.20%
intra_pred_v_w16_8bpc_c:     1209.7 ( 1.00x)   1136.5 ( 1.00x)   -6.05%
intra_pred_v_w16_8bpc_rvv:     88.5 (13.25x)     61.1 (18.00x)  -30.96%
intra_pred_v_w32_8bpc_c:     1898.5 ( 1.00x)   1837.0 ( 1.00x)   -3.24%
intra_pred_v_w32_8bpc_rvv:    104.9 (17.49x)     77.5 (22.93x)  -26.12%
intra_pred_v_w64_8bpc_c:     3266.0 ( 1.00x)   3110.6 ( 1.00x)   -4.76%
intra_pred_v_w64_8bpc_rvv:    196.1 (16.24x)    166.2 (18.28x)  -15.25%

Blackhole p100a                  Before             After         Delta

intra_pred_v_w4_8bpc_c:       368.5 ( 1.00x)    370.1 ( 1.00x)    0.43%
intra_pred_v_w4_8bpc_rvv:      36.7 ( 9.37x)     23.7 (13.99x)  -35.42%
intra_pred_v_w8_8bpc_c:       666.6 ( 1.00x)    670.2 ( 1.00x)    0.54%
intra_pred_v_w8_8bpc_rvv:      44.4 (14.34x)     33.2 (18.92x)  -25.23%
intra_pred_v_w16_8bpc_c:      970.4 ( 1.00x)    971.9 ( 1.00x)    0.15%
intra_pred_v_w16_8bpc_rvv:     58.5 (16.07x)     48.5 (19.28x)  -17.09%
intra_pred_v_w32_8bpc_c:     1577.3 ( 1.00x)   1575.8 ( 1.00x)   -0.10%
intra_pred_v_w32_8bpc_rvv:     81.5 (18.79x)     65.9 (23.11x)  -19.14%
intra_pred_v_w64_8bpc_c:     2720.1 ( 1.00x)   2724.9 ( 1.00x)    0.18%
intra_pred_v_w64_8bpc_rvv:    134.9 (19.65x)     91.6 (28.67x)  -32.10%

Benchmark results provided by Sungjoon Moon.
2026-05-12 11:26:56 +00:00
Najmus Sakib Afsan de223ad6ab riscv64/cdef: Fix up code style
The functions of cdef_filter did not use the conventional names and
the macros for declarations.

This commit matches the style used for other archs and adjusts the
following:

 - decl_cdef_fn() macro for declaration
 - dav1d_cdef_filter_wxh as the name
2026-05-10 19:58:55 +06:00
Arpad Panyik 51b67010e2 AArch64: Optimize ipred_smooth_v_8bpc_neon
Optimize ipred_smooth_v_8bpc_neon using simpler arithmetic operations
and the removal of jump table.

Relative runtime after this patch on some Cortex CPUs:

ipred_smooth_v:    w4      w8     w16     w32     w64
Cortex-A55:     1.025x  0.847x  0.821x  0.830x  0.852x
Cortex-A510:    1.017x  0.923x  0.915x  0.883x  0.840x
Cortex-A520:    1.080x  0.972x  0.999x  0.934x  0.876x
Cortex-A76:     0.818x  0.575x  0.599x  0.723x  0.744x
Cortex-A78:     0.782x  0.571x  0.595x  0.641x  0.685x
Cortex-A715:    0.801x  0.586x  0.593x  0.651x  0.694x
Cortex-A725:    0.801x  0.579x  0.596x  0.649x  0.692x
Cortex-X1:      0.782x  0.560x  0.553x  0.623x  0.682x
Cortex-X3:      0.792x  0.594x  0.526x  0.526x  0.604x
Cortex-X925:    0.757x  0.678x  0.525x  0.554x  0.577x
2026-05-06 20:18:03 +00:00
Arpad Panyik 4db1a05aad AArch64: Optimize ipred_smooth_h_8bpc_neon
Optimize ipred_smooth_h_8bpc_neon using simpler arithmetic operations.

Relative runtime after this patch on some Cortex CPUs:

ipred_smooth_h:    w4      w8     w16     w32     w64
Cortex-A55:     1.015x  0.857x  0.819x  0.835x  0.862x
Cortex-A510:    0.988x  0.860x  0.915x  0.879x  0.837x
Cortex-A520:    0.999x  0.883x  0.967x  0.929x  0.873x
Cortex-A76:     0.804x  0.637x  0.517x  0.573x  0.613x
Cortex-A78:     0.800x  0.586x  0.548x  0.639x  0.640x
Cortex-A715:    0.722x  0.642x  0.563x  0.627x  0.646x
Cortex-A725:    0.710x  0.639x  0.567x  0.622x  0.645x
Cortex-X1:      0.758x  0.570x  0.565x  0.548x  0.557x
Cortex-X3:      0.789x  0.589x  0.528x  0.563x  0.571x
Cortex-X925:    0.855x  0.739x  0.541x  0.551x  0.567x
2026-05-06 20:18:03 +00:00
Martin Storsjö 037430193a arm: Fix up code style slightly
The existing code has been written striving to align columns so
that the largest register names can be typed, e.g. r10 on ARM
(and similarly for x10 or q10 on AArch64), or v31.16b for AArch64
vectors.

Fix some cases, where the current forms were clearly
inconsistent/wrong. Not all cases have been fixed up to match this
norm, but some individual ones that were clearly wrong have been
fixed.
2026-05-06 15:32:26 +00:00
Martin Storsjö 7b9ab8373e ci: Update the main CI image
This version includes llvm-symbolizer, which should improve
backtraces in sanitizer builds with Clang.
2026-05-06 15:11:16 +00:00
Martin Storsjö ac5dfb0a85 examples: Treat SDL2 headers as system headers
This makes those headers included with -isystem rather than -I,
which makes the compiler skip producing any warnings about them
(as they're expected to be out of the user code's control).

This avoids warnings with newer versions of the
dav1d-debian-unstable CI image, warnings (treated as errors in CI)
like this:

    In file included from /usr/include/SDL2/SDL_config.h:51,
                     from /usr/include/SDL2/SDL_stdinc.h:33,
                     from /usr/include/SDL2/SDL_main.h:25,
                     from /usr/include/SDL2/SDL.h:31,
                     from ../examples/dav1dplay.c:33:
    /usr/include/SDL2/SDL_config_unix.h:186:9: error: 'HAVE_GETAUXVAL' redefined [-Werror]
      186 | #define HAVE_GETAUXVAL 1
          |         ^~~~~~~~~~~~~~
    In file included from ../examples/dav1dplay.c:27:
    ./config.h:66:9: note: this is the location of the previous definition
       66 | #define HAVE_GETAUXVAL 0
          |         ^~~~~~~~~~~~~~

Recently, Debian Unstable has switched from providing the
actual SDL 2 to providing the SDL 2 API through the sdl2-compat
package on top of SDL 3.

The SDL 2 headers expose their full config.h as part of their
installed headers (that the user code ends up including). This
includes unnamespaced defines, such as "#define HAVE_GETAUXVAL 1".

This issue hasn't shown up with the original SDL 2 package in
Debian, due to a Debian packaging detail. While most SDL 2
headers are installed in /usr/include/SDL2 (and user code
includes it as <SDL.h>, requiring the build system to include
/usr/include/SDL2), the Debian packaging has replaced
/usr/include/SDL2/SDL_config.h with a header that includes
<SDL2/_real_SDL_config.h>, which then gets resolved in
/usr/include/x86_64-linux-gnu/SDL2. Due to this being included
from a compiler default system include path
(/usr/include/x86_64-linux-gnu), no warnings about the header
was printed, even though that one also produced the same kind
of conflicting redefinitions. (We could also avoid the same issue
by attempting to include <SDL2/SDL.h> instead of <SDL.h>,
avoiding the use of the build system provided include directory,
resolving that from /usr/include, and having the compiler consider
it a system header.)

The sdl2-compat package in Debian doesn't redirect that header
in the same way, but includes SDL_config_unix.h in the same
directory in /usr/include/SDL2. Due to this being included
from a user specified -I (as long as it is included as <SDL.h>,
not <SDL2/SDL.h>), it's considered a user header, and warnings
are printed for it.

It seems like SDL 3 no longer exposes their config.h headers as
part of the installed headers.

The conflict between SDL 2's config.h's HAVE_GETAUXVAL and
our stems from the fact that we only try to detect GETAUXVAL
on architectures where we want to use it (arm/aarch64, loongarch,
ppc or riscv). On x86, where we don't need it, we don't try
to detect it, and set "#define HAVE_GETAUXVAL 0" in our
config.h.

To avoid warnings due to the conflict, we can declare the
SDL 2 dependency with the argument "include_type: 'system'",
which should silence any warnings in the SDL headers. This
Meson feature is available since Meson 0.52.0 (and we currently
require Meson 0.54.0).

An alternative way to avoid the redefinition conflict would be
to always try to detect getauxval on all architectures, to make
our config.h agree with SDL 2's config headers.

A third (and much more hacky way) around the conflict would be
to avoid the public SDL headers including the SDL_config header
by defining "SDL_config_h_" before including SDL.h. Doing this
also requires manually including a couple more standard headers
before SDL.h (stdint.h, stdio.h, stddef.h).
2026-05-06 14:00:31 +03:00
Martin Storsjö 556c5202b4 ci: Add testing on macOS on Apple Silicon too 2026-05-03 22:39:01 +03:00
Martin Storsjö e1bd6f76c2 checkasm: Readd a dependency on threads
3a2a874994, which switched to using
the checkasm core from the separate checkasm project, removed the
thread dependency from the checkasm executable, as the checkasm
library itself has a thread dependency.

However, checkasm doesn't always include that thread dependency,
it only does that when pthread_setaffinity_np is detected.

The dav1d object files themselves use pthreads as well, causing
undefined symbols if checkasm doesn't link in pthreads.

This should fix linking on OpenBSD after
3a2a874994, fixing issue #467.
2026-05-03 12:42:39 +03:00
Martin Storsjö 5cfc383268 arm: mc: Optimize prep_neon for the w4/w8 cases
Use alternating registers for immediately sequential loads/stores,
pack two 4 pixel rows into one register.

Before:                           Cortex A7      A8     A53     A55     A72     A73     A76
mct_8tap_regular_w4_0_8bpc_neon:      112.0    68.6    79.7    82.9    45.3    39.4    24.4
mct_8tap_regular_w8_0_8bpc_neon:      158.2    89.5   108.4   113.4    55.4    53.0    30.0
After:
mct_8tap_regular_w4_0_8bpc_neon:       89.7    69.9    76.3    85.1    36.2    35.2    25.0
mct_8tap_regular_w8_0_8bpc_neon:      149.0    92.7   102.6   115.8    56.6    52.8    31.4

The numbers aren't entirely consistent, but this is mostly favourable.
2026-04-29 15:56:01 +03:00
Martin Storsjö 727d0f984b arm: mc: Fix a comment typo
This seems to be right in all the other similar places
(arm/64/mc.S, arm/32/mc16.S and arm/64/mc16.S).
2026-04-29 15:56:01 +03:00
Victorien Le Couviour--Tuffet f995e1fbf9 threading: Schedule TILE tasks for all passes at once
Closes #465.
2026-04-27 21:09:28 +02:00
Henrik Gramner c0f2fe3135 build: Update meson version requirement to 0.54.0
Use of the meson 'fallback arg in dependency' feature was introduced
by the switch to external checkasm in 3a2a874.
2026-04-22 21:02:05 +02:00
Arpad Panyik c5726277ff AArch64: Optimize ipred_h_8bpc_neon
Optimize ipred_h_8bpc_neon using simpler stores and simpler indexing.

Relative runtime after this patch on some Cortex CPUs:

ipred_h:        w4      w8      w16     w32     w64
Cortex-A55:   1.054x  1.054x  0.978x  1.149x  1.097x
Cortex-A510:  0.455x  0.970x  0.973x  1.010x  1.002x
Cortex-A520:  0.973x  0.975x  0.979x  1.002x  1.000x
Cortex-A76:   0.791x  0.934x  0.912x  1.010x  0.999x
Cortex-A78:   0.771x  0.933x  0.957x  0.519x  0.510x
Cortex-A715:  0.838x  0.860x  0.893x  0.585x  0.661x
Cortex-A720:  0.839x  0.860x  0.892x  0.580x  0.659x
Cortex-A725:  0.809x  0.837x  0.871x  0.580x  0.660x
Cortex-X1:    0.973x  0.982x  0.989x  0.498x  0.660x
Cortex-X3:    0.971x  0.992x  0.987x  0.495x  0.661x
Cortex-X925:  0.950x  1.000x  1.000x  0.474x  0.655x
2026-04-16 16:02:28 +02:00
Arpad Panyik 47e2607e6c AArch64: Optimize ipred_v_8bpc_neon
Optimize the width = 4 case of ipred_v_8bpc_neon by using simple stores
instead of the lane stores which can improve performance on some CPUs.

Relative runtime after this patch on some Cortex CPUs:

 ipred_v:       w4
Cortex-A55:   1.041x
Cortex-A510:  0.297x
Cortex-A520:  0.748x
Cortex-A76:   0.866x
Cortex-A78:   0.856x
Cortex-A715:  0.874x
Cortex-A720:  0.875x
Cortex-A725:  0.868x
Cortex-X1:    1.013x
Cortex-X3:    1.000x
Cortex-X925:  1.000x
2026-04-15 17:37:46 +02:00
Martin Storsjö aa4504729c arm: Fix a typo in a URL
This was added in a00289b6d8.
2026-03-31 13:48:43 +03:00
Matthias Dressel d69235dd80 CI: Use shortform QEMU_CPU for loongarch64
Since qemu commit 979bf44af8483cedc00c63b3e79407de08e75a30 the cpu
argument accepts just 'max' as a shorthand.
2026-03-17 22:00:03 +01:00
Matthias Dressel bfbd7d4677 CI: loongarch64: Move QEMU_LD_PREFIX to crossfile
Simplifies developement builds on local machines.
2026-03-17 22:00:03 +01:00
Matthias Dressel afcdb781cb CI: riscv64: Move QEMU_LD_PREFIX to crossfile
Simplifies developement builds on local machines.
2026-03-17 22:00:03 +01:00
Matthias Dressel 42ac98706a CI: aarch64: Move QEMU_LD_PREFIX to crossfile
Simplifies developement builds on local machines.
2026-03-17 22:00:03 +01:00
Matthias Dressel 8feb8526bb CI: Remove outdated version suffix from job name 2026-03-17 22:00:03 +01:00
Martin Storsjö 594d1601ff arm: Add Armv9.3-A GCS (Guarded Control Stack) support
Signal that our assembly is compliant with the GCS feature, if
the GCS feature is enabled in the compiler (available since Clang
18 and GCC 15) - this is enabled by -mbranch-protection=standard
with a new enough compiler.

GCS doesn't require any specific modifications to the assembly
code, but requires that all functions return to the expected call
address (checked through a shadow stack).
2026-03-17 20:40:05 +00:00
Henrik Gramner 6894b7f2d0 Improve the memory pool API
Return a void pointer directly to the usable memory region,
abstracting away implementation details.
2026-03-17 18:28:57 +01:00
Henrik Gramner 241a6b236a x86: Fix warp8x8 gamma/delta naming mixup
For whatever reason the names of the gamma and delta parameters
have been switched in a few of the warp8x8 asm implementations.

This is a bit confusing, so fix things by switching them back.

This change is purely cosmetical, the output binary is identical.
2026-03-05 15:50:40 +01:00
Martin Storsjö 4fd22e97d8 arm: Switch to a more correct Windows flag for detecting I8MM
Newer revisions of WinSDK 10.0.26100.0 have exposed more flags for
IsProcessorFeaturePresent; now there is a separate one for
detecting specifically I8MM and not just SVE-I8MM. Switch to using
this flag instead.
2026-03-04 15:16:37 +02:00
Matthias Dressel 1dcfc90757 CI: Update images 2026-02-28 16:27:35 +01:00
Matthias Dressel daef396277 CI: Switch to loongarch64 Debian toolchain
loong64 was recently promoted to an official Debian architecture. [0]

[0] https://lists.debian.org/debian-devel-announce/2025/12/msg00004.html
2026-02-09 02:33:29 +01:00
Martin Storsjö de4ce4f32d arm: mc: Add missing # for some immediate constants, for consistency
The assembler doesn't require the # here, but we use that everywhere
else, so add it here as well for consistency.
2026-02-06 16:01:57 +02:00
Martin Storsjö 9c13b5fbd0 subprojects: Update checkasm to v1.1.0
This version, together with the previous commit
574e7f4727, fixes issue #460.

Due to checkasm internal restructuring, one may run into build
issues if rebuilding in an old build directory after updating
the checkasm subproject, without getting rid of older meson
generated headers in the build directory.
2026-02-03 09:27:22 +00:00
Cameron Cawley 60507bffc0 Fix compiler warning on platforms without cfi-icall 2026-01-30 23:46:42 +00:00
Cameron Cawley 4264096b72 Allow falling back to standard C signal on non-POSIX systems 2026-01-30 19:59:24 +00:00
Henrik Gramner 2272a19ab0 x86: Update x86inc.asm 2026-01-26 23:32:17 +01:00
KO Myung-Hun b29c5782e7 Export DAV1D APIs correctly on OS/2 2026-01-22 00:58:15 +01:00
KO Myung-Hun 8674770e4b Add asm support on OS/2 2026-01-22 00:58:15 +01:00
Cameron Cawley f0b233fd09 Replace use of sprintf with snprintf 2026-01-21 14:41:57 +00:00
Steve Lhomme 50015c2ec9 CI: switch debian-llvm-mingw to UCRT
The msvcrt and ucrt are almost identical except
- C runtime is either msvcrt or UCRT (Universal C Runtime from Vista+ [^1])
- The default target OS is Windows 10 instead of Windows 7 (0x601)

[^1]: https://support.microsoft.com/en-us/topic/update-for-universal-c-runtime-in-windows-c0514201-7fe6-95a3-b0a5-287930f3560c
2026-01-21 13:43:37 +00:00
Cameron Cawley 2bb7e63266 Fix reversed parameters when TRACK_HEAP_ALLOCATIONS is enabled
This fixes a regression from commit d268788467
2026-01-21 13:25:49 +00:00
Martin Storsjö a44b589872 Silence a new MSVC warning
This silences the following warnings in MSVC 2026 18.0 (and
2022 17.14):

    ../tools/dav1d_cli_parse.c(213): warning C5287: operands are different enum types 'CpuFlags' and 'CpuMask'; use an explicit cast to silence this warning
    ../tools/dav1d_cli_parse.c(214): warning C5287: operands are different enum types 'CpuFlags' and 'CpuMask'; use an explicit cast to silence this warning
    ../tools/dav1d_cli_parse.c(215): warning C5287: operands are different enum types 'CpuFlags' and 'CpuMask'; use an explicit cast to silence this warning
    ../tools/dav1d_cli_parse.c(216): warning C5287: operands are different enum types 'CpuFlags' and 'CpuMask'; use an explicit cast to silence this warning

This warning flag was new in MSVC 2022 17.14, but it was buggy
in that version - it produced spurious warnings for other cases
as well (and using an explicit cast to silence it didn't work
as advertised), see [1] and [2].

The bugs were fixed in 18.0, and the remaining construct that it
warns about is something that is somewhat reasonable to warn about:

    enum CpuFlags {
        DAV1D_X86_CPU_FLAG_SSE2        = 1 << 0,
        DAV1D_X86_CPU_FLAG_SSSE3       = 1 << 1,
    };
    enum CpuMask {
        X86_CPU_MASK_SSE2      = DAV1D_X86_CPU_FLAG_SSE2,
        X86_CPU_MASK_SSSE3     = DAV1D_X86_CPU_FLAG_SSSE3     | X86_CPU_MASK_SSE2,
    };

Instead of adding explicit casts on the constants from the foreign
enum, just disable this warning.

[1] https://developercommunity.visualstudio.com/t/False-positive-C5287:-operands-are-diff/10915265
[2] https://developercommunity.visualstudio.com/t/warning-C5287:-operands-are-different-e/10877942
2026-01-20 12:00:29 +02:00
Martin Storsjö 04b69f93e5 checkasm: Reinstate check for TRIM_DSP_FUNCTIONS
This was lost in 3a2a874994.

Without this, checkasm ends up printing a quite confusing output
consisting only of the functions that have two or more assembly
implementations, if trim_dsp happens to be enabled.
2026-01-14 22:29:38 +02:00
Martin Storsjö afd13d8906 arm: Fix a few misindented lines 2026-01-09 14:00:39 +02:00
Martin Storsjö 574e7f4727 checkasm: Pass HAVE_C11_GENERIC to checkasm as -DCHECKASM_HAVE_GENERIC=1/0
For this to have an effect, it requires using a newer version of
the wrapped checkasm subproject; including checkasm commit
be05a7972e47c658a7c5c186294d27caa5735db2 or newer.
2026-01-07 16:22:18 +02:00
Martin Storsjö b2f9c10670 checkasm: Fix building with MSVC
The glue code in our headers, for integrating with the external
checkasm, was incompatible with MSVC.

MSVC has a nonstandard handling of __VA_ARGS__ with macros; when
one macro invokes another macro, __VA_ARGS__ gets treated as one
single parameter and can't map to more than one parameter in the
invoked macro. (In other words, when calling another macro,
__VA_ARGS__ must map in its entirety to a ... parameter of the
other macro.)

Modern versions of MSVC do implement the correct mode as well,
but defaults to the old one for backwards compatibility. To
choose the new mode, we'd have to build our code with
-Zc:preprocessor. That's certainly doable, but it's fairly easy to
avoid the issue as well.

To avoid this issue, change the variadic PIXEL_RECT(...) to explicitly
names its arguments. There's actually no variability in the arguments
involved here. (Alternatively, we could force the preprocessor to expand
the arguments one extra time, avoiding the issue, with e.g.
"#define EXPAND(x) x" and wrapping PIXEL_RECT with it, e.g.
"#define PIXEL_RECT(...) EXPAND(BUF_RECT(pixel, __VA_ARGS__))".)

See [1], [2] and [3] for more discussion on the matter.

[1] https://stackoverflow.com/a/5134656/3115956
[2] https://stackoverflow.com/a/7459803/3115956
[2] https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-160
2026-01-07 11:57:09 +02:00
Niklas Haas 3a2a874994 tests/checkasm: switch to external checkasm
There are a number of benefits tied to the upstream / third-party checkasm
version, including:

- Improved long-term maintainability, code reuse with other projects, etc.

- Vastly improved overall performance / runtime for benchmarking, due
  primarily to the ability to scale the runtime of each test to that test's
  complexity.

- Much more robust statistical analysis of benchmarking results; including
  robust outlier rejection, an estimation of the histogram, and the ability
  to report the variance / stddev in addition to the (trimmed) mean.

- Interactive HTML and JSON output formats in addition to CSV/TSV.

- More readable and user-friendly output across the board, especially for
  failures and data dumps (e.g. also showing errors inside padding bytes).

- Better cross-platform support, including dynamic fallback of timer
  implementations on ARM platforms, a better RISC-V harness, and more.

There are multiple approaches to how we can solve the problem of integrating
this third party checkasm into dav1d, but I think the hybrid approach of
loading it as an external dependency, falling back to a meson wrap file,
provides the best overall compromise. This avoids the messiness of git e.g.
git submodules, while still allowing us to pin individual tags.
2026-01-01 17:33:55 +01:00
Niklas Haas 3374404179 tests/checkasm/loopfilter: avoid printf format warning
Upstream checkasm adds a printf format attribute to report(), so we should
avoid directly passing the name string to silence a warning.
2026-01-01 12:29:02 +01:00
Jean-Baptiste Kempf b546257f77 NEWS for 1.5.3 2025-12-31 15:50:45 +01:00
Nathan E. Egge 844510cdb4 Add argon bitstream conformance test instructions 2025-12-30 14:56:50 +01:00
Nathan E. Egge 5e8c380e4b riscv64/mc16: Keep blend_v RVV operations in 16-bits
Kendryte K230                Before             After         Delta

blend_v_w2_16bpc_c:       240.9 ( 1.00x)    240.9 ( 1.00x)    0.00%
blend_v_w2_16bpc_rvv:     149.7 ( 1.61x)    155.4 ( 1.55x)    3.81%
blend_v_w4_16bpc_c:      1072.4 ( 1.00x)   1072.5 ( 1.00x)    0.01%
blend_v_w4_16bpc_rvv:     307.2 ( 3.49x)    299.9 ( 3.58x)   -2.38%
blend_v_w8_16bpc_c:      2004.7 ( 1.00x)   2010.2 ( 1.00x)    0.27%
blend_v_w8_16bpc_rvv:     436.1 ( 4.60x)    381.0 ( 5.28x)  -12.63%
blend_v_w16_16bpc_c:     3859.4 ( 1.00x)   3853.7 ( 1.00x)   -0.15%
blend_v_w16_16bpc_rvv:    761.1 ( 5.07x)    554.0 ( 6.96x)  -27.21%
blend_v_w32_16bpc_c:     7509.7 ( 1.00x)   7505.3 ( 1.00x)   -0.06%
blend_v_w32_16bpc_rvv:   1427.1 ( 5.26x)   1005.5 ( 7.46x)  -29.54%

SpacemiT K1                  Before             After         Delta

blend_v_w2_16bpc_c:       220.1 ( 1.00x)    222.0 ( 1.00x)    0.86%
blend_v_w2_16bpc_rvv:     146.6 ( 1.50x)    151.1 ( 1.47x)    3.07%
blend_v_w4_16bpc_c:       968.3 ( 1.00x)    969.6 ( 1.00x)    0.13%
blend_v_w4_16bpc_rvv:     281.2 ( 3.44x)    290.2 ( 3.34x)    3.20%
blend_v_w8_16bpc_c:      1809.5 ( 1.00x)   1812.1 ( 1.00x)    0.14%
blend_v_w8_16bpc_rvv:     374.2 ( 4.84x)    375.3 ( 4.83x)    0.29%
blend_v_w16_16bpc_c:     3479.7 ( 1.00x)   3480.9 ( 1.00x)    0.03%
blend_v_w16_16bpc_rvv:    521.5 ( 6.67x)    465.9 ( 7.47x)  -10.66%
blend_v_w32_16bpc_c:     6767.9 ( 1.00x)   6773.7 ( 1.00x)    0.09%
blend_v_w32_16bpc_rvv:    852.1 ( 7.94x)    727.4 ( 9.31x)  -14.63%

Blackhole p100a              Before             After         Delta

blend_v_w2_16bpc_c:       205.6 ( 1.00x)    206.0 ( 1.00x)    0.19%
blend_v_w2_16bpc_rvv:     176.5 ( 1.16x)    143.6 ( 1.44x)  -18.64%
blend_v_w4_16bpc_c:       901.0 ( 1.00x)    891.8 ( 1.00x)   -1.02%
blend_v_w4_16bpc_rvv:     298.8 ( 3.02x)    235.2 ( 3.79x)  -21.29%
blend_v_w8_16bpc_c:      1663.3 ( 1.00x)   1656.5 ( 1.00x)   -0.41%
blend_v_w8_16bpc_rvv:     300.1 ( 5.54x)    236.4 ( 7.01x)  -21.23%
blend_v_w16_16bpc_c:     3192.1 ( 1.00x)   3182.3 ( 1.00x)   -0.31%
blend_v_w16_16bpc_rvv:    349.2 ( 9.14x)    311.4 (10.22x)  -10.82%
blend_v_w32_16bpc_c:     6259.2 ( 1.00x)   6257.8 ( 1.00x)   -0.02%
blend_v_w32_16bpc_rvv:    350.2 (17.88x)    321.8 (19.44x)   -8.11%
2025-12-30 13:47:49 +00:00
Nathan E. Egge d2fa9466be riscv64/mc16: Keep blend RVV operations in 16-bits
Kendryte K230                Before             After         Delta

blend_w4_16bpc_c:         227.0 ( 1.00x)    227.1 ( 1.00x)    0.04%
blend_w4_16bpc_rvv:        71.1 ( 3.19x)     73.2 ( 3.10x)    2.95%
blend_w8_16bpc_c:         662.5 ( 1.00x)    662.7 ( 1.00x)    0.03%
blend_w8_16bpc_rvv:       132.4 ( 5.00x)    115.0 ( 5.76x)  -13.14%
blend_w16_16bpc_c:       2559.3 ( 1.00x)   2559.8 ( 1.00x)    0.02%
blend_w16_16bpc_rvv:      416.1 ( 6.15x)    326.7 ( 7.83x)  -21.49%
blend_w32_16bpc_c:       6483.9 ( 1.00x)   6484.5 ( 1.00x)    0.01%
blend_w32_16bpc_rvv:     1029.1 ( 6.30x)    774.7 ( 8.37x)  -24.72%

SpacemiT K1                  Before             After         Delta

blend_w4_16bpc_c:         206.1 ( 1.00x)    207.0 ( 1.00x)    0.44%
blend_w4_16bpc_rvv:        64.4 ( 3.20x)     69.5 ( 2.98x)    7.92%
blend_w8_16bpc_c:         600.2 ( 1.00x)    600.9 ( 1.00x)    0.12%
blend_w8_16bpc_rvv:       101.6 ( 5.91x)    106.9 ( 5.62x)    5.22%
blend_w16_16bpc_c:       2316.0 ( 1.00x)   2316.4 ( 1.00x)    0.02%
blend_w16_16bpc_rvv:      261.8 ( 8.85x)    229.1 (10.11x)  -12.49%
blend_w32_16bpc_c:       5861.1 ( 1.00x)   5860.4 ( 1.00x)   -0.01%
blend_w32_16bpc_rvv:      602.9 ( 9.72x)    475.3 (12.33x)  -21.16%

Blackhole p100a              Before             After         Delta

blend_w4_16bpc_c:         193.3 ( 1.00x)    191.3 ( 1.00x)   -1.03%
blend_w4_16bpc_rvv:        66.3 ( 2.91x)     65.4 ( 2.92x)   -1.36%
blend_w8_16bpc_c:         552.0 ( 1.00x)    549.8 ( 1.00x)   -0.40%
blend_w8_16bpc_rvv:       100.5 ( 5.49x)     96.2 ( 5.71x)   -4.28%
blend_w16_16bpc_c:       2112.5 ( 1.00x)   2111.8 ( 1.00x)   -0.03%
blend_w16_16bpc_rvv:      190.3 (11.10x)    185.9 (11.36x)   -2.31%
blend_w32_16bpc_c:       5417.5 ( 1.00x)   5416.2 ( 1.00x)   -0.02%
blend_w32_16bpc_rvv:      290.3 (18.66x)    304.0 (17.82x)    4.72%
2025-12-30 13:47:49 +00:00
Kyle Siefring 5f7f8ff5b6 cdef: consolidate left edge backup state 2025-12-28 22:48:27 -05:00
Nathan E. Egge a31e4bd757 riscv64/mc16: Add VLEN=512 16bpc RVV blend_{,v} functions
Blackhole p100a               Before             After         Delta

blend_w4_16bpc_c:         193.1 ( 1.00x)     186.8 ( 1.00x)   -3.26%
blend_w4_16bpc_rvv:        64.8 ( 2.98x)      62.8 ( 2.97x)   -3.09%
blend_w8_16bpc_c:         551.0 ( 1.00x)     546.0 ( 1.00x)   -0.91%
blend_w8_16bpc_rvv:        96.2 ( 5.73x)      93.4 ( 5.85x)   -2.91%
blend_w16_16bpc_c:       2111.6 ( 1.00x)    2107.0 ( 1.00x)   -0.22%
blend_w16_16bpc_rvv:      189.9 (11.12x)     189.6 (11.11x)   -0.16%
blend_w32_16bpc_c:       5403.9 ( 1.00x)    5398.5 ( 1.00x)   -0.10%
blend_w32_16bpc_rvv:      292.4 (18.48x)     291.5 (18.52x)   -0.31%

blend_v_w2_16bpc_c:       209.1 ( 1.00x)     208.7 ( 1.00x)   -0.19%
blend_v_w2_16bpc_rvv:     180.3 ( 1.16x)     180.4 ( 1.16x)    0.06%
blend_v_w4_16bpc_c:       896.9 ( 1.00x)     898.5 ( 1.00x)    0.18%
blend_v_w4_16bpc_rvv:     303.0 ( 2.96x)     302.5 ( 2.97x)   -0.17%
blend_v_w8_16bpc_c:      1658.9 ( 1.00x)    1663.1 ( 1.00x)    0.25%
blend_v_w8_16bpc_rvv:     303.0 ( 5.47x)     302.6 ( 5.50x)   -0.13%
blend_v_w16_16bpc_c:     3186.0 ( 1.00x)    3182.7 ( 1.00x)   -0.10%
blend_v_w16_16bpc_rvv:    313.1 (10.17x)     312.1 (10.20x)   -0.32%
blend_v_w32_16bpc_c:     6253.9 ( 1.00x)    6257.0 ( 1.00x)    0.05%
blend_v_w32_16bpc_rvv:    355.4 (17.60x)     353.2 (17.72x)   -0.62%
2025-12-24 01:08:19 +00:00
Marvin Scholz bf82cfa74e meson: clarify xxhash error message
We do not need to mention the details of the check in the message
as those are already logged by meson when doing the check. Instead
mention why this is an error to make it more clear it is related to
the xxhash_muxer option.

Fix #397
2025-12-23 10:12:58 +01:00
Marvin Scholz 549a6a0983 meson: leave tools subdir early when tools are disabled
Only dav1d_input_objs are needed by dav1dplay, so we can leave this
directory early and avoid looking for xxhash when it is actually
never used.
2025-12-23 10:12:58 +01:00
Nathan E. Egge 38dd16e108 riscv64/mc: Add VLEN=512 8bpc RVV blend_{,h,v} functions
Blackhole p100a               Before             After         Delta

blend_w4_8bpc_c:          190.7 ( 1.00x)     189.3 ( 1.00x)   -0.73%
blend_w4_8bpc_rvv:         61.2 ( 3.12x)      59.7 ( 3.17x)   -2.45%
blend_w8_8bpc_c:          550.7 ( 1.00x)     547.0 ( 1.00x)   -0.67%
blend_w8_8bpc_rvv:         91.0 ( 6.05x)      89.4 ( 6.12x)   -1.76%
blend_w16_8bpc_c:        2112.4 ( 1.00x)    2106.8 ( 1.00x)   -0.27%
blend_w16_8bpc_rvv:       177.1 (11.92x)     174.8 (12.05x)   -1.30%
blend_w32_8bpc_c:        5423.8 ( 1.00x)    5393.8 ( 1.00x)   -0.55%
blend_w32_8bpc_rvv:       233.5 (23.23x)     230.7 (23.38x)   -1.20%

blend_h_w2_8bpc_c:        126.4 ( 1.00x)     128.0 ( 1.00x)    1.27%
blend_h_w2_8bpc_rvv:       85.0 ( 1.49x)      81.2 ( 1.58x)   -4.47%
blend_h_w4_8bpc_c:        221.2 ( 1.00x)     222.2 ( 1.00x)    0.45%
blend_h_w4_8bpc_rvv:       84.3 ( 2.62x)      81.3 ( 2.73x)   -3.56%
blend_h_w8_8bpc_c:        411.9 ( 1.00x)     413.3 ( 1.00x)    0.34%
blend_h_w8_8bpc_rvv:       84.2 ( 4.89x)      81.0 ( 5.10x)   -3.80%
blend_h_w16_8bpc_c:       792.6 ( 1.00x)     793.5 ( 1.00x)    0.11%
blend_h_w16_8bpc_rvv:      84.5 ( 9.38x)      81.5 ( 9.74x)   -3.55%
blend_h_w32_8bpc_c:      1577.7 ( 1.00x)    1578.8 ( 1.00x)    0.07%
blend_h_w32_8bpc_rvv:      86.6 (18.21x)      83.5 (18.90x)   -3.58%
blend_h_w64_8bpc_c:      3099.5 ( 1.00x)    3101.9 ( 1.00x)    0.08%
blend_h_w64_8bpc_rvv:      98.4 (31.49x)      95.2 (32.58x)   -3.25%
blend_h_w128_8bpc_c:     7496.9 ( 1.00x)    7498.1 ( 1.00x)    0.02%
blend_h_w128_8bpc_rvv:    155.4 (48.24x)     151.5 (49.50x)   -2.51%

blend_v_w2_8bpc_c:        202.9 ( 1.00x)     203.5 ( 1.00x)    0.30%
blend_v_w2_8bpc_rvv:      173.5 ( 1.17x)     176.6 ( 1.15x)    1.79%
blend_v_w4_8bpc_c:        842.3 ( 1.00x)     844.2 ( 1.00x)    0.23%
blend_v_w4_8bpc_rvv:      295.9 ( 2.85x)     299.0 ( 2.82x)    1.05%
blend_v_w8_8bpc_c:       1589.9 ( 1.00x)    1592.1 ( 1.00x)    0.14%
blend_v_w8_8bpc_rvv:      296.2 ( 5.37x)     299.0 ( 5.32x)    0.95%
blend_v_w16_8bpc_c:      3090.3 ( 1.00x)    3088.3 ( 1.00x)   -0.06%
blend_v_w16_8bpc_rvv:     296.0 (10.44x)     299.4 (10.32x)    1.15%
blend_v_w32_8bpc_c:      6080.2 ( 1.00x)    6081.5 ( 1.00x)    0.02%
blend_v_w32_8bpc_rvv:     306.3 (19.85x)     309.3 (19.66x)    0.98%
2025-12-22 23:20:23 +00:00
Henrik Gramner 43f3b8d33b checkasm: Group itx functions by their largest dimension
This reduces the number of itx reports per instruction set from
19 to 5, which avoids excessively flooding the console output.
2025-12-09 22:02:52 +01:00
Henrik Gramner 165e9e251b checkasm: Only run DC-only itx tests for dct_dct 2025-12-09 21:01:10 +01:00
Cameron Cawley 84792e61c8 dav1dplay: Print more error messages when window/context creation fails 2025-11-27 20:49:55 +00:00
Cameron Cawley e60603a9f2 dav1dplay: Ensure a newer OpenGL version is used when creating the context 2025-11-27 20:49:41 +00:00
Tristan Matthews f3a1070f25 input/ivf: handle files with 0 frames
This avoids a subsequent division by zero.
2025-11-25 12:49:05 +00:00
Cameron Cawley 28b165940d Use CLOCK_REALTIME for providing the initial seed value
CLOCK_MONOTONIC is specified as returning time "since an unspecified point in the past". On RISC OS with UnixLib this returns the time since the last hard reset, but with SharedCLibrary this returns the time since the program started - combined with the coarse resolution used internally, this almost always results in a seed of 0.

CLOCK_REALTIME meanwhile is specified as returning time since the epoch, so it should behave consistently across all platforms.
2025-11-22 23:30:02 +00:00
Un1q32 04d588ee94 allow builds on systems without a supported memalign function 2025-11-19 03:15:27 -05:00
Martin Storsjö e7c280e4cd x86: Sync the latest upstream version of x86inc.asm 2025-11-12 23:19:22 +02:00
Martin Storsjö 2eac05d648 checkasm: arm: Use X() instead of inline ifdefs
This works fine when the referenced symbol has the same prefix
as PRIVATE_PREFIX in the same file; otherwise we could also
create a macro like X() that only prepends the extern symbol
prefix but no symbol namespace prefix.
2025-11-12 15:54:40 +02:00
Sungjoon Moon 6deac59d1e riscv64/mc: Add w_mask functions
K230:
checkasm: VLEN=128 bits, using random seed 42
RVV:
 - mc_8bpc.w_mask               [OK]
checkasm: all 18 tests passed
w_mask_420_w4_8bpc_c:        845.1 ( 1.00x)
w_mask_420_w4_8bpc_rvv:      313.1 ( 2.70x)
w_mask_420_w8_8bpc_c:       2589.9 ( 1.00x)
w_mask_420_w8_8bpc_rvv:      549.3 ( 4.72x)
w_mask_420_w16_8bpc_c:      8389.9 ( 1.00x)
w_mask_420_w16_8bpc_rvv:    1250.4 ( 6.71x)
w_mask_420_w32_8bpc_c:     33485.7 ( 1.00x)
w_mask_420_w32_8bpc_rvv:    4276.9 ( 7.83x)
w_mask_420_w64_8bpc_c:     81934.2 ( 1.00x)
w_mask_420_w64_8bpc_rvv:   11243.9 ( 7.29x)
w_mask_420_w128_8bpc_c:   205865.8 ( 1.00x)
w_mask_420_w128_8bpc_rvv:  28098.0 ( 7.33x)
w_mask_422_w4_8bpc_c:        838.6 ( 1.00x)
w_mask_422_w4_8bpc_rvv:      315.9 ( 2.65x)
w_mask_422_w8_8bpc_c:       2576.4 ( 1.00x)
w_mask_422_w8_8bpc_rvv:      564.2 ( 4.57x)
w_mask_422_w16_8bpc_c:      8378.7 ( 1.00x)
w_mask_422_w16_8bpc_rvv:    1305.4 ( 6.42x)
w_mask_422_w32_8bpc_c:     33512.4 ( 1.00x)
w_mask_422_w32_8bpc_rvv:    4487.6 ( 7.47x)
w_mask_422_w64_8bpc_c:     82489.8 ( 1.00x)
w_mask_422_w64_8bpc_rvv:   11895.3 ( 6.93x)
w_mask_422_w128_8bpc_c:   207116.2 ( 1.00x)
w_mask_422_w128_8bpc_rvv:  29541.4 ( 7.01x)
w_mask_444_w4_8bpc_c:        822.7 ( 1.00x)
w_mask_444_w4_8bpc_rvv:      265.3 ( 3.10x)
w_mask_444_w8_8bpc_c:       2542.5 ( 1.00x)
w_mask_444_w8_8bpc_rvv:      429.2 ( 5.92x)
w_mask_444_w16_8bpc_c:      8290.8 ( 1.00x)
w_mask_444_w16_8bpc_rvv:     965.7 ( 8.59x)
w_mask_444_w32_8bpc_c:     33229.6 ( 1.00x)
w_mask_444_w32_8bpc_rvv:    3289.2 (10.10x)
w_mask_444_w64_8bpc_c:     81404.6 ( 1.00x)
w_mask_444_w64_8bpc_rvv:    9126.6 ( 8.92x)
w_mask_444_w128_8bpc_c:   204438.4 ( 1.00x)
w_mask_444_w128_8bpc_rvv:  22424.9 ( 9.12x)

Spacemit K1:
checkasm: VLEN=256 bits, using random seed 42
RVV:
 - mc_8bpc.w_mask               [OK]
checkasm: all 18 tests passed
w_mask_420_w4_8bpc_c:        747.9 ( 1.00x)
w_mask_420_w4_8bpc_rvv:      290.4 ( 2.58x)
w_mask_420_w8_8bpc_c:       2312.3 ( 1.00x)
w_mask_420_w8_8bpc_rvv:      478.9 ( 4.83x)
w_mask_420_w16_8bpc_c:      7509.3 ( 1.00x)
w_mask_420_w16_8bpc_rvv:     885.2 ( 8.48x)
w_mask_420_w32_8bpc_c:     30087.8 ( 1.00x)
w_mask_420_w32_8bpc_rvv:    2595.6 (11.59x)
w_mask_420_w64_8bpc_c:     72313.0 ( 1.00x)
w_mask_420_w64_8bpc_rvv:    6020.9 (12.01x)
w_mask_420_w128_8bpc_c:   179297.0 ( 1.00x)
w_mask_420_w128_8bpc_rvv:  15659.1 (11.45x)
w_mask_422_w4_8bpc_c:        735.0 ( 1.00x)
w_mask_422_w4_8bpc_rvv:      299.0 ( 2.46x)
w_mask_422_w8_8bpc_c:       2285.6 ( 1.00x)
w_mask_422_w8_8bpc_rvv:      488.5 ( 4.68x)
w_mask_422_w16_8bpc_c:      7459.3 ( 1.00x)
w_mask_422_w16_8bpc_rvv:     946.3 ( 7.88x)
w_mask_422_w32_8bpc_c:     29996.7 ( 1.00x)
w_mask_422_w32_8bpc_rvv:    2812.7 (10.66x)
w_mask_422_w64_8bpc_c:     71809.4 ( 1.00x)
w_mask_422_w64_8bpc_rvv:    6253.7 (11.48x)
w_mask_422_w128_8bpc_c:   178081.9 ( 1.00x)
w_mask_422_w128_8bpc_rvv:  16087.8 (11.07x)
w_mask_444_w4_8bpc_c:        726.2 ( 1.00x)
w_mask_444_w4_8bpc_rvv:      255.9 ( 2.84x)
w_mask_444_w8_8bpc_c:       2250.7 ( 1.00x)
w_mask_444_w8_8bpc_rvv:      403.9 ( 5.57x)
w_mask_444_w16_8bpc_c:      7341.4 ( 1.00x)
w_mask_444_w16_8bpc_rvv:     744.7 ( 9.86x)
w_mask_444_w32_8bpc_c:     29658.4 ( 1.00x)
w_mask_444_w32_8bpc_rvv:    2295.9 (12.92x)
w_mask_444_w64_8bpc_c:     70695.9 ( 1.00x)
w_mask_444_w64_8bpc_rvv:    4879.0 (14.49x)
w_mask_444_w128_8bpc_c:   175483.6 ( 1.00x)
w_mask_444_w128_8bpc_rvv:  13021.9 (13.48x)
2025-11-07 00:51:38 +09:00
Sungjoon Moon 7ba6452b09 Unroll only for top copy
Unrolling bottom copy causes error when bottom_ext isn't even number
For center copy, there's no enough register to unroll
2025-11-05 09:13:31 +01:00
Sungjoon Moon 7c04792480 riscv64/mc: Add emu_edge function
K230:
checkasm: VLEN=128 bits, using random seed 42
RVV:
 - mc_8bpc.emu_edge             [OK]
checkasm: all 6 tests passed
emu_edge_w4_8bpc_c:        638.8 ( 1.00x)
emu_edge_w4_8bpc_rvv:      211.9 ( 3.01x)
emu_edge_w8_8bpc_c:        944.4 ( 1.00x)
emu_edge_w8_8bpc_rvv:      230.0 ( 4.11x)
emu_edge_w16_8bpc_c:      1447.9 ( 1.00x)
emu_edge_w16_8bpc_rvv:     287.6 ( 5.03x)
emu_edge_w32_8bpc_c:      3047.0 ( 1.00x)
emu_edge_w32_8bpc_rvv:     775.8 ( 3.93x)
emu_edge_w64_8bpc_c:      5440.1 ( 1.00x)
emu_edge_w64_8bpc_rvv:    1504.2 ( 3.62x)
emu_edge_w128_8bpc_c:    12943.4 ( 1.00x)
emu_edge_w128_8bpc_rvv:   4782.5 ( 2.71x)

Spacemit K1:
checkasm: VLEN=256 bits, using random seed 42
RVV:
 - mc_8bpc.emu_edge             [OK]
checkasm: all 6 tests passed
emu_edge_w4_8bpc_c:        562.4 ( 1.00x)
emu_edge_w4_8bpc_rvv:      202.6 ( 2.78x)
emu_edge_w8_8bpc_c:        695.0 ( 1.00x)
emu_edge_w8_8bpc_rvv:      220.1 ( 3.16x)
emu_edge_w16_8bpc_c:      1271.2 ( 1.00x)
emu_edge_w16_8bpc_rvv:     251.3 ( 5.06x)
emu_edge_w32_8bpc_c:      2772.4 ( 1.00x)
emu_edge_w32_8bpc_rvv:     587.8 ( 4.72x)
emu_edge_w64_8bpc_c:      4917.2 ( 1.00x)
emu_edge_w64_8bpc_rvv:    1115.0 ( 4.41x)
emu_edge_w128_8bpc_c:    12634.6 ( 1.00x)
emu_edge_w128_8bpc_rvv:   3232.6 ( 3.91x)
2025-11-05 09:13:31 +01:00
Mikołaj Zalewski d26f298ce2 ipred_v implementation in RISC-V assembly 2025-11-05 08:55:30 +01:00
Sungjoon Moon f979959367 Small optimization, there's no actual meaningful difference
w_mask_420_w4_8bpc_c:               310.5 ( 1.00x)
w_mask_420_w4_16bpc_c:              325.7 ( 1.00x)
w_mask_420_w8_8bpc_c:               978.7 ( 1.00x)
w_mask_420_w8_16bpc_c:              998.5 ( 1.00x)
w_mask_420_w16_8bpc_c:             3187.6 ( 1.00x)
w_mask_420_w16_16bpc_c:            3233.2 ( 1.00x)
w_mask_420_w32_8bpc_c:            12658.8 ( 1.00x)
w_mask_420_w32_16bpc_c:           12686.1 ( 1.00x)
w_mask_420_w64_8bpc_c:            31036.4 ( 1.00x)
w_mask_420_w64_16bpc_c:           30643.1 ( 1.00x)
w_mask_420_w128_8bpc_c:           76785.7 ( 1.00x)
w_mask_420_w128_16bpc_c:          77490.5 ( 1.00x)
w_mask_422_w4_8bpc_c:               325.2 ( 1.00x)
w_mask_422_w4_16bpc_c:              342.0 ( 1.00x)
w_mask_422_w8_8bpc_c:              1002.3 ( 1.00x)
w_mask_422_w8_16bpc_c:             1032.4 ( 1.00x)
w_mask_422_w16_8bpc_c:             3267.8 ( 1.00x)
w_mask_422_w16_16bpc_c:            3343.7 ( 1.00x)
w_mask_422_w32_8bpc_c:            12865.4 ( 1.00x)
w_mask_422_w32_16bpc_c:           12998.5 ( 1.00x)
w_mask_422_w64_8bpc_c:            31112.7 ( 1.00x)
w_mask_422_w64_16bpc_c:           31455.4 ( 1.00x)
w_mask_422_w128_8bpc_c:           78796.5 ( 1.00x)
w_mask_422_w128_16bpc_c:          78100.7 ( 1.00x)
w_mask_444_w4_8bpc_c:               315.1 ( 1.00x)
w_mask_444_w4_16bpc_c:              336.8 ( 1.00x)
w_mask_444_w8_8bpc_c:               985.1 ( 1.00x)
w_mask_444_w8_16bpc_c:             1014.9 ( 1.00x)
w_mask_444_w16_8bpc_c:             3216.7 ( 1.00x)
w_mask_444_w16_16bpc_c:            3182.6 ( 1.00x)
w_mask_444_w32_8bpc_c:            12733.8 ( 1.00x)
w_mask_444_w32_16bpc_c:           12432.0 ( 1.00x)
w_mask_444_w64_8bpc_c:            31156.2 ( 1.00x)
w_mask_444_w64_16bpc_c:           31615.3 ( 1.00x)
w_mask_444_w128_8bpc_c:           76031.1 ( 1.00x)
w_mask_444_w128_16bpc_c:          76989.2 ( 1.00x)
2025-11-02 01:33:33 +09:00
Sungjoon Moon 43a7ac13a5 mc_tmpl: optimize w_mask with distributive law
Reduced register usages (maybe) and improved speed (~7%)
Tested on AMD HX370

Function                  |       Before |        After |         % |
---------------------------------------------------------------------
w_mask_420_w4_8bpc_c      |        335.3 |        312.6 |      6.78 |
w_mask_420_w4_16bpc_c     |        354.5 |        326.4 |      7.94 |
w_mask_420_w8_8bpc_c      |       1056.4 |        979.3 |      7.30 |
w_mask_420_w8_16bpc_c     |       1068.2 |        996.4 |      6.73 |
w_mask_420_w16_8bpc_c     |       3416.1 |       3169.6 |      7.22 |
w_mask_420_w16_16bpc_c    |       3435.4 |       3218.0 |      6.34 |
w_mask_420_w32_8bpc_c     |      13479.7 |      12550.0 |      6.91 |
w_mask_420_w32_16bpc_c    |      13833.3 |      12632.7 |      8.68 |
w_mask_420_w64_8bpc_c     |      32557.6 |      30166.7 |      7.35 |
w_mask_420_w64_16bpc_c    |      32529.8 |      30407.0 |      6.54 |
w_mask_420_w128_8bpc_c    |      81802.8 |      75856.5 |      7.27 |
w_mask_420_w128_16bpc_c   |      81187.8 |      76133.9 |      6.23 |
w_mask_422_w4_8bpc_c      |        331.3 |        327.1 |      1.27 |
w_mask_422_w4_16bpc_c     |        365.1 |        341.2 |      6.53 |
w_mask_422_w8_8bpc_c      |       1052.7 |       1003.5 |      4.68 |
w_mask_422_w8_16bpc_c     |       1095.9 |       1022.6 |      6.69 |
w_mask_422_w16_8bpc_c     |       3479.8 |       3248.8 |      6.67 |
w_mask_422_w16_16bpc_c    |       3504.2 |       3279.5 |      6.41 |
w_mask_422_w32_8bpc_c     |      13702.5 |      12801.4 |      6.58 |
w_mask_422_w32_16bpc_c    |      13738.9 |      12830.5 |      6.61 |
w_mask_422_w64_8bpc_c     |      32517.9 |      30818.0 |      5.23 |
w_mask_422_w64_16bpc_c    |      33199.4 |      30865.3 |      7.03 |
w_mask_422_w128_8bpc_c    |      82867.1 |      77978.7 |      5.90 |
w_mask_422_w128_16bpc_c   |      84937.9 |      77629.8 |      8.60 |
w_mask_444_w4_8bpc_c      |        340.4 |        315.6 |      7.28 |
w_mask_444_w4_16bpc_c     |        361.6 |        335.0 |      7.35 |
w_mask_444_w8_8bpc_c      |       1057.6 |        988.9 |      6.50 |
w_mask_444_w8_16bpc_c     |       1104.3 |       1030.8 |      6.67 |
w_mask_444_w16_8bpc_c     |       3414.4 |       3180.7 |      6.85 |
w_mask_444_w16_16bpc_c    |       3477.4 |       3182.4 |      8.48 |
w_mask_444_w32_8bpc_c     |      13455.8 |      12469.4 |      7.33 |
w_mask_444_w32_16bpc_c    |      13666.9 |      12378.8 |      9.42 |
w_mask_444_w64_8bpc_c     |      33587.2 |      31239.7 |      7.00 |
w_mask_444_w64_16bpc_c    |      34283.3 |      30969.5 |      9.67 |
w_mask_444_w128_8bpc_c    |      82084.2 |      76206.3 |      7.16 |
w_mask_444_w128_16bpc_c   |      82649.4 |      75166.4 |      8.91 |
---------------------------------------------------------------------
avg                       |            - |            - |      6.95 |
2025-11-02 01:33:33 +09:00
Henrik Gramner c720f4d355 cli: Fix input_open() memory leak on fopen() failure 2025-10-27 20:44:47 +01:00
Niklas Haas fcbc3d1b93 loopfilter: align Av1FilterLUT struct members
Fixes a bug where the Av1FilterLUT instance used in checkasm was not
aligned properly.

In theory, the first ALIGN macro should imply the latter alignments as well,
but I decided to mark all fields as explicitly aligned for clarity; and
because that's the precedent set in other headers.

Allows us to drop the ALIGN macro on the other usage of this struct.
2025-10-20 13:50:43 +00:00
Jean-Baptiste Kempf f6965b7f12 Update NEWS for nasm 3.00 2025-10-20 11:20:53 +02:00
Adam Sampson 0bc6bd9341 x86: put the memory operand first for test
Older versions of nasm allowed the operands in either order, but nasm
3.00 requires the memory operand to be first as per the spec.
2025-10-05 14:03:24 +01:00
Khalid Masum af5cf2b1e7 Readme: improve consitency of compilation steps
Currently compilation steps use two different types of methods, manual
build directory creation and using meson setup build to directly create
the build directory. This potential makes the new user who wants to
build docs or cross compile confused about which step of compilation the
user is in. This patch aims to make these steps clear.
2025-08-24 17:26:19 +00:00
Jean-Baptiste Kempf 0558c332ca On the road to 1.5.2
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
2025-08-12 01:23:20 +02:00
Jean-Baptiste Kempf 04faac6900 Update COPYING years 2025-08-12 01:23:14 +02:00
Henrik Gramner 716164239a obu: Improve short-signaling reference frame index calculation
Reduces code size a fair amount, and with some loop unrolling
by the compiler the code becomes nearly branchless.
2025-07-09 14:24:07 +02:00
Henrik Gramner fa30043ba0 obu: Remove redundant zeroing in frame header parsing
The Dav1dFrameHeader struct is already zero-initialized,
so zeroing individual values a second time is redundant.
2025-07-07 16:00:30 +02:00
Matthias Dressel c3f3a7e567 CI: Check --frametimes with msan
This would have caught 583e8e02eb.
2025-07-01 18:35:31 +02:00
Ronald S. Bultje 583e8e02eb tools/dav1d: initialize elapsed
Based on the following comment on IRC:
"<aconz2> the `elapsed` variable in main() is read uninitialized in
 synchronize and makes the first frametime with --frametime incorrect
 I think. Should be initialized to 0"

Confirmed that after initializing to zero, the first line in the file
generated by --frametime is reasonable.
2025-07-01 08:26:31 -04:00
yuanhecai a86d561b79 loongarch: rename looprestoration_tmpl.c
Rename loongarch/looprestoration_tmpl.c to loongarch/looprestoration_inner.c.
Compiling both src/looprestoration_tmpl.c and loongarch/looprestoration_tmpl.c
produces looprestoration_tmpl.c.o, causing a conflict during linking.
2025-06-25 17:25:27 +08:00
yuanhecai 9eea4fe842 loongarch: Fix Clang compilation errors 2025-06-25 17:25:21 +08:00
Henrik Gramner b3c5848f7f loongarch: Use hidden visibility for asm functions 2025-06-07 22:36:38 +02:00
Henrik Gramner 63bf075aad recon: Fix level index calculation optimization for 2D transforms
Due to a typo this was never actually enabled since being added in
5ef6b24. As a result the slow path was always being used.
2025-06-02 15:54:28 +02:00
Henrik Gramner fe0ab51460 Use exact-width integer min/max defines where appropriate
Improves support for niche systems with uncommon integer sizes.
2025-05-29 19:38:49 +02:00
Henrik Gramner 29efbb9496 refmvs: Shrink mfmv_ref arrays
Includes updates to load_tmvs() asm implementations.
2025-05-28 19:01:45 +02:00
Henrik Gramner 68dc20035b refmvs: Shrink refpoc arrays 2025-05-28 19:01:45 +02:00
Henrik Gramner 7889ac7603 cdf: Remove unused eob_hi_bit entries 2025-05-28 02:06:08 +02:00
Matthias Dressel 8d95618093 CI: Build '-mavx' code as debugoptimized
Workaround a GCC 14 bug where it does not insert `vzeroupper` in C code
built without at least '-O2'.
2025-03-10 16:40:35 +01:00
Matthias Dressel edeac873c4 CI: Update images 2025-03-10 16:40:35 +01:00
Matthias Dressel 1d0cda02a6 CI: Update ppc64le image
Since there seems to be a problem with gcc-14 stay on gcc-13 for now.
2025-03-05 21:58:24 +01:00
Gianni Rosato caef968117 refactor: simplify deltaq bitstream parsing logic 2025-02-28 09:28:46 -05:00
Pranav Kant 7d4b789f55 Mark C globals with small code model
We have new option in clang (https://github.com/llvm/llvm-project/pull/124834)
to mark globals to be allocated in non-large sections. We can mark all globals
that are referenced from hardcoded assembly (which implicitly references globals
assuming they are in non-large sections) with this attribute to avoid running
into problems when dav1d is built with -mcmodel=medium with clang.
2025-02-21 15:55:00 +00:00
Jean-Baptiste Kempf 42b2b24fb8 Update NEWS for 1.5.1 2025-01-19 22:33:54 +01:00
Wan-Teh Chang 40ff2a1251 Include <string.h> for memcpy() 2025-01-10 01:54:41 +00:00
Arpad Panyik edb16889d1 AArch64: Add Neon implementation of load_tmvs
This patch adds a vectorised variant of the mv_projection calculation
and a faster initialisation of motion vectors for load_tmvs_neon.

Checkasm uplifts after this patch on some Neoverse and Cortex CPU cores
compared to the C reference compiled with GCC-13 and Clang-19:

                     GCC    Clang
 AWS Graviton 4:   1.62x    1.59x
 Cortex-X4:        1.45x    1.46x
 Cortex-X3:        1.68x    1.69x
 Cortex-X1:        1.55x    1.52x
 Cortex-A720:      1.54x    1.57x
 Cortex-A715:      1.47x    1.55x
 Cortex-A78:       1.21x    1.18x
 Cortex-A76:       1.38x    1.37x
 Cortex-A72:       1.08x    1.11x
 Cortex-A520:      0.97x    1.18x
 Cortex-A510:      0.99x    1.14x
 Cortex-A55:       1.16x    1.23x

This patch increases the .text by ~660 bytes, but smaller than the
reference implementation by about 0.5 KiB.
2025-01-09 14:59:31 +01:00
Martin Storsjö b129d9f2cb mc: Reduce stack use in {put,prep}_scaled_{bilin,8tap}
For the bilin cases, this seems to make things marginally faster
(measured on x86_64; 7-25% faster with compiler autovectorization).
For 8tap, it doesn't make much of a difference at all.

Before:                                      GCC   Clang
mc_scaled_8tap_regular_w128_8bpc_c:     115155.5   98549.3
mc_scaled_8tap_regular_w128_8bpc_ssse3:  17936.0   18411.1
mc_scaled_bilinear_w128_8bpc_c:          40290.0   51812.9
mc_scaled_bilinear_w128_8bpc_ssse3:      18243.9   18177.0
After:
mc_scaled_8tap_regular_w128_8bpc_c:     116304.3   99453.2
mc_scaled_8tap_regular_w128_8bpc_ssse3:  18387.0   18077.3
mc_scaled_bilinear_w128_8bpc_c:          37381.4   41145.0
mc_scaled_bilinear_w128_8bpc_ssse3:      18423.8   18031.6

(Benchmarked with the seed 0; the total runtime for the scaled
benchmarks are significantly affected by the random seed.)

This reduces the stack usage of these functions from around 65 KB
each, to less than 1 KB for bilin, and around 2 KB for 8tap.

With this in place, the required stack space for dav1d should
be mostly identical across configurations; on x86_64 (both with
and without assembly), it can run with 62 KB of stack, and
on arm and aarch64, it can run with 58 KB of stack.
2025-01-02 15:30:21 +00:00
Brad Smith cd5bfa124a riscv: Fix building on non-Linux OS's
CLOCK_MONOTONIC_RAW is not POSIX/portable.
2024-12-29 18:32:23 +00:00
James Almer 5ea4939a1d obu: don't print warnings for Metadata OBUs of types "Unregistered user private" 2024-12-27 13:48:54 -03:00
Martin Storsjö 2ba57aa535 arm32: looprestoration: Rewrite the wiener functions
Switch to the same cache-friendly algorithm as was done for arm64
in 2e73051c57 and for the reference
C code in 8291a66e50.

Contrary to the arm64 implementation, this uses a main loop in C
(very similar to the one in the main C implementation in
8291a66e50) rather than assembly;
this gives a bit more overhead on the call to each function, but
it shouldn't affect the big picture much.

Performane wise, this doesn't make much of a difference - it makes
things a little bit faster on some cores, and a little bit slower
on others:

Before:                 Cortex A7        A8       A53       A72       A73
wiener_7tap_8bpc_neon:   269384.4  147730.7  140028.5   92662.5   92929.0
wiener_7tap_10bpc_neon:  352690.2  159970.2  169427.8  116614.9  119371.1
After:
wiener_7tap_8bpc_neon:   238328.0  157274.1  134588.6   92200.3   97619.6
wiener_7tap_10bpc_neon:  336369.3  162182.0  161954.4  125521.2  130634.0

This is mostly in line with the results on arm64 in
2e73051c57. On arm64, there was a
bit larger speedup for the 7tap case, mostly attributed to
unrolling the vertical filter (and the new filter_hv function) to
operate on 16 pixels at a time. On arm32, there's not enough
registers to do that, so we can't get such gains from unrolling.
(Reducing the unrolling on the arm64 version to match the case
on arm32 also shows similar performance numbers as on arm32 here.)

In the arm64 version, we also added separate 5tap versions of all
functions; not doing that for arm32 at this point.

This increases the binary size by 2 KB.

This doesn't have any immediate effect on how much stack space
dav1d requires in total, since the largest stack users on arm
currently are the 8tap_scaled functions.
2024-12-20 14:32:32 +02:00
Martin Storsjö 8291a66e50 looprestoration: Use only 6 row buffer for wiener, like NEON/x86
This uses a separate function for combined horizontal and vertical
filtering, without needing to write the intermediate results
back to memory inbetween.

This mostly serves as an example for how to adjust the logic for
that case; unless we actually merge the horizontal and vertical
filtering within the _hv function, we still need space for a
7th row on the stack within that function (which means we use just
as much stack as before), but we also need one extra memcpy to
write it into the right destination.

In a build where the compiler is allowed to vectorize and inline
the wiener functions into each other, this change actually reduces
the final binary size by 4 KB, if the C version of the wiener filter
is retained.

This change makes the vectorized C code as fast as it was before
with Clang 18; on Xcode Clang 16, it's 2x slower than it was before.

Unfortunately, with GCC, this change makes the code a bit slower
again.
2024-12-19 14:19:19 +02:00
Martin Storsjö a149f5c3c0 looprestoration: Make the C wiener h filter more optimizable for the compiler
This increases the binary size by 9 KB, on aarch64 with Xcode Clang 16,
if the C version of the filter is retained (which it isn't
by default).

This makes the vectorized C code roughly as fast as it was before
the rewrite on GCC; on Clang it also becomes 1.3x-2.0x faster,
while still being slower than it was initially.
2024-12-19 14:19:19 +02:00
Martin Storsjö 9da303e989 looprestoration: Rewrite the C version of the wiener filter
This reduces the stack usage of these functions (the C version)
significantly.

These C versions aren't used on architectures that already have
wiener filters implemented in assembly, but they matter both if
running e.g. with assembly disabled (e.g. for sanitizer builds),
and matter as example for how to do a cache efficient SIMD
implementation.

This roughly matches how these functions are implemented in the
aarch64 assembly (although that assembly function uses a mainloop
function written in assembly, and custom calling conventions
between the functions).

With this in place, dav1d can run with around 76 KB of stack
with assembly disabled.

This increases the binary size by around 14 KB (in the case of
aarch64 with Xcode Clang 16), unless built with (the default)
-Dtrim_dsp=true. (By default, the C version of the wiener filter
gets skipped entirely.)

On 32 bit arm, the assembly wiener function implementation still
uses large buffers on the stack though, but due to other functions
using less stack there, dav1d can still run with 72 KB of stack
there.

Unfortunately, this change also makes the functions slower, depending
on how well the compiler was able to optimize the previous version.
On GCC (which didn't manage to vectorize the functions so well before),
it becomes 1.6x-2.0x slower, while it gets 2.5x-5x slower on Clang
(where it was very well vectorized before).

Most of this performance can be gained back with later changes on
top, though.
2024-12-19 14:19:13 +02:00
Luc Trudeau d242c47b43 Replace Av1Block with pal_sz in read_pal_indices 2024-12-02 09:32:33 -05:00
Henrik Gramner 9a75cebc36 Explicitly use uint8_t for the order_palette() scratch buffer
It previously used 'pixel' which is typedefed to uint8_t in files
that aren't bitdepth-templated, but those are indices and not
pixels so that was just confusing and misleading.
2024-12-02 13:47:04 +01:00
victorien 575af25859 flush: Reset f->task_thread.error
f->task_thread.error can be set during flushing, not resetting this can
lead to c->task_thread.first being increased after having already submitted
a frame post flushing. That's fine if it happens on the very first frame,
but if that's the case on any subsequent frame it will incur a wrong frame
ordering.
Now that a non-first frame will be considered as such, its tasks won't be
able to execute (since they depend on a truly previous frame considered as
being after) and c->task_thread.cur will be increased past that frame, with
no way of it being reset, eventually leading to a hang.
2024-11-28 17:56:13 +01:00
Wan-Teh Chang 767efeca06 Fix ClangTidy misc-include-cleaner warnings 2024-11-26 14:26:25 +00:00
Martin Storsjö f8d2620d82 checkasm: looprestoration: Do strict bounds checking of the output
This would allow to immediately detect unintended writes out of
bounds like the ones fixed in
72b5380757 and
1c7433a5eb.

Extend the PIXEL_RECT macro to provide a variable containing the
full, padded height of the buffer, for uses that operate on the
full buffer.

Allow overwriting past the right edge of the target output rectangle,
up to an alignment of 64 pixels, but allow no overwrite past the
bottom.
2024-11-21 09:05:33 +00:00
Brad Smith f15666b703 riscv: Enable FreeBSD / OpenBSD elf_aux_info() support 2024-11-21 08:41:38 +00:00
Martin Storsjö 30c3dd8edd arm32: looprestoration: Rewrite the SGR functions
Switch to the same cache-friendly algorithm as was done for arm64
in c121b831e2.

This uses much less stack memory, and is much more cache friendly.
In this form, most of the individual asm functions only operate on
one single row of data at a time.

Some of the functions used to be unrolled to operate on two rows
at a time, while they now only operate on one at a time. In practice,
this is still a large performance win, as data is accessed in a
much more cache friendly manner.

This gives a 2-37% speedup, and reduces the peak amount of stack
used for these functions from 255 KB to 33 KB.

Before:              Cortex A7         A8        A53        A72        A73
sgr_3x3_8bpc_neon:    873990.7   748341.9   543410.2   383200.4   357502.9
sgr_3x3_10bpc_neon:   909728.0   732594.5   560123.6   392765.5   359377.7
sgr_5x5_8bpc_neon:    591597.9   527353.1   350347.4   263464.9   243098.8
sgr_5x5_10bpc_neon:   637958.2   529462.8   364613.3   280664.6   255164.6
sgr_mix_8bpc_neon:   1458977.4  1185423.2   884017.7   632922.5   587395.2
sgr_mix_10bpc_neon:  1532376.5  1259111.4   918729.3   658787.6   600317.0
After:
sgr_3x3_8bpc_neon:    836138.7   635556.5   530596.1   335794.6   348209.9
sgr_3x3_10bpc_neon:   850835.4   596445.0   534583.2   342713.4   349713.5
sgr_5x5_8bpc_neon:    577039.7   443916.5   341684.8   223374.0   232841.3
sgr_5x5_10bpc_neon:   600975.7   400041.3   347529.8   234759.9   239351.7
sgr_mix_8bpc_neon:   1297988.7   925739.1   830360.7   545476.1   548706.6
sgr_mix_10bpc_neon:  1340112.6   914395.7   873342.4   574815.7   554681.6

With this change in place, dav1d can run with around 72 KB of stack
on arm targets.

Not all functions have been merged in the same way as they were
for arm64 in c121b831e2, so some
minor differences remain; it's possible to incrementally optimize
this, e.g. to fuse box3/5_row_v with calc_row_ab1/2, fuse
finish_filter_row1/2 with sgr_weighted_row1, and make a version of
finish_filter_row1 that produces 2 rows, like is done for arm64.

It's also possible to rewrite the logic for calculating sgr_x_by_x
in the same way as was done for arm64 in
79db162487.
2024-11-19 11:58:25 +02:00
Martin Storsjö 1b7f126361 arm32: looprestoration: Apply simplifications to align with C code
This applies the same simplifications that were done for the C
code and the x86 assembly in 4613d3a530,
and the arm64 assembly in ce80e6daf6,
to the arm32 implementation.

This gives a minor speedup of around a couple percent.

Before:             Cortex A7         A8        A53        A72        A73
sgr_3x3_8bpc_neon:   926600.0   753468.3   553704.1   399379.1   369674.4
sgr_5x5_8bpc_neon:   621722.9   540412.7   357275.9   274474.3   254996.0
sgr_mix_8bpc_neon:  1529715.1  1171282.5   894982.9   659996.6   610407.2
After:
sgr_3x3_8bpc_neon:   899020.3   697278.6   541569.9   382824.3   353891.8
sgr_5x5_8bpc_neon:   602183.2   498322.9   348974.5   264833.9   243837.7
sgr_mix_8bpc_neon:  1497870.8  1182121.3   880470.9   635939.3   590909.3
2024-11-18 16:08:00 +02:00
Martin Storsjö c43debf1b1 arm64: looprestoration: Fix a comment typo 2024-11-18 16:07:40 +02:00
Martin Storsjö 1c7433a5eb arm: looprestoration: Fix the single line loop in sgr_weighted2
After processing one block, this accidentally jumped to the loop
for processing two lines at once.

The same bug was replicated in both 32 and 64 bit versions.
2024-11-18 16:07:40 +02:00
Martin Storsjö f32b314616 looprestoration: Rewrite the C version of the SGR filter
This reduces the stack usage of these functions (the C version)
significantly, and gives them a 15-40% speedup (on an Apple M3,
with Xcode Clang 16).

The C versions of this function does matter; even though we have
assembly implementations of it on x86 and aarch64, those only
covert the 8 and 10 bpc cases, while the C version is used as
fallback for 12 bpc.

This matches how these functions are implemented in the aarch64
assembly; operate over a window of 3 or 5 lines (of 384 pixels
each), instead of doing a full 384 x 64 block.

The individual functions for filtering a line each end up
much simpler, and closer to how this can be implemented in
assembly - but the overall business logic ends up much much
more complex.

The main difference to the aarch64 assembly implementation,
is that any buffer which is of int16_t size in the aarch64
assembly implementation, uses the type "coef" here, which
is 32 bit in the 10/12 bpc cases. (This is required for handling
the 12 bpc cases.)

With this in place, dav1d can run with around 66 KB of stack
on x86_64 with assembly enabled, with around 74 KB of stack on
aarch64 with assembly enabled, and with 118 KB of stack with
assembly disabled.

This increases the binary size by around 14 KB (in the case of
aarch64 with Xcode Clang 16).

On 32 bit arm, dav1d still requires around 270 KB of stack, as
that assembly implementation of the SGR filter uses a different
algorithm.
2024-11-18 15:57:19 +02:00
Martin Storsjö 01d417c2fa arm: looprestoration: Give symbols and defines unique names
As the machine specific init file is included in the common
template, give symbols and defines unique names that won't
clash with similar ones in the main template.
2024-11-18 15:39:28 +02:00
Martin Storsjö 847eece170 arm: looprestoration: Add spacing around operators 2024-11-18 15:39:28 +02:00
Martin Storsjö 56a55933b3 arm: looprestoration: Get rid of unnecessary rotate_ab_N intermediate functions 2024-11-18 15:39:28 +02:00
Martin Storsjö 9db59d8904 arm: looprestoration: Apply 'const' more consistently on parameters 2024-11-18 15:39:28 +02:00
Marvin Scholz c8fdaa8611 checkasm: add loongarch GAS file to checkasm_asm_sources
This is not an object so putting it in the objects variable seems wrong
and would also break using gaspp for that file.
2024-11-16 14:51:35 +01:00
Maryla Ustarroz f772f3e678 Fix comments on Dav1dMasteringDisplay
The '///<' syntax is used to document a field after the field.
Mistakenly using it before the field results in the documentation
going to the wrong field, see:
https://videolan.videolan.me/dav1d/structDav1dMasteringDisplay.html
2024-11-15 16:55:27 +01:00
Martin Storsjö 72b5380757 arm64: looprestoration: Fix use of the wrong register
When renumbering argument registers in
1648c232ee, this one register
reference was missed.

The missed register was meant to compare h with 2, but accidentally
ended up comparing bitdepth_max to 2. In the case of 8 bpc, there's
actually no bitdepth_max parameter, so it ended up comparing an
uninitialized value.
2024-11-15 12:23:11 +02:00
Martin Storsjö bed3a34365 arm: Use /proc/cpuinfo on linux if getauxval is unavailable
On really old libc versions, getauxval isn't available. Fall back
on /proc/cpuinfo in those cases, just like we do on android too.
2024-11-14 14:44:21 +00:00
Martin Storsjö 718b62c8cd ci: Raise the timeout multipliers for jobs that run in QEMU
For individual tests in dav1d-test-data, the default timeout
is 30 seconds (which is the Meson default if nothing is
specified). Previously it ran with a multiplier of 4, resulting
in a total timeout of 120 seconds.

When running tests in QEMU, exceeding this 120 second timeout
could happen occasionally. Raise the multiplier to 10, allowing
each individual job to run for up to 5 minutes.

This should hopefully reduce the amount of stray failures in the
CI.

For tests that already have a higher default timeout set, such
as checkasm which has got a 180 second default timeout, this results
in a much longer timeout period. However as long as we don't
frequently see issues where these actually hang, it should be
beneficial to just let them run to completion, rather than
aborting early due to a tight timeout.
2024-11-14 13:38:18 +00:00
Martin Storsjö 1648c232ee arm64: looprestoration: Remove an unnecessary duplicate parameter in dav1d_sgr_weighted2_Xbpc_neon
Also fix one case where the 32 bit input parameter w (which was in
x6, now in x4) was used without zero extension, by referencing to
it as w4 instead.
2024-11-14 11:53:50 +02:00
Martin Storsjö ce80e6daf6 arm64: looprestoration: Apply simplifications to align with C code
This applies the same simplifications that were done for the C
code and the x86 assembly in 4613d3a530,
to the arm64 implementation.

This gives a minor speedup of around a couple percent.

Before:            Cortex A53        A55        A72        A73       A76  Apple
M3
sgr_3x3_8bpc_neon:   368583.2   363654.2   279958.1   272065.1  169353.3  354.6
sgr_5x5_8bpc_neon:   258570.7   255018.5   200410.6   199478.3  117968.3  260.9
sgr_mix_8bpc_neon:   603698.1   577383.3   482468.3   436540.4  256632.9  541.8
After:
sgr_3x3_8bpc_neon:   367873.2   357884.1   275462.4   268363.9  165909.8  346.0
sgr_5x5_8bpc_neon:   254988.4   248184.2   190875.1   196939.1  120517.2  252.1
sgr_mix_8bpc_neon:   589204.7   563565.8   414025.6   427702.2  251651.2  533.4
2024-11-13 23:39:04 +02:00
Martin Storsjö 8bd31a92a5 arm: looprestoration: Split an overly long line 2024-11-13 15:38:20 +02:00
Luca Barbato 330e20672e x86: Use the decl and init macros for put_8tap and prep_8tap 2024-11-10 14:18:23 +01:00
Luca Barbato f966172feb loongarch: Use the decl and init macros for put_8tap and prep_8tap 2024-11-10 14:01:36 +01:00
Luca Barbato a403b575b1 mc: Factor out the decl and init macros
They can be used across arches.
2024-11-10 14:00:19 +01:00
Luca Barbato ac1fa6cbca ppc: use a jumptable for the blends
It makes the code tidier and the runtime is not slow.
2024-11-10 12:35:04 +01:00
Luca Barbato 4f088e42cb ppc: blend_h pwr9 implementation
blend_h_w2_8bpc_pwr9:       18.4 ( 1.20x)
blend_h_w4_8bpc_pwr9:       27.2 ( 1.26x)
blend_h_w8_8bpc_pwr9:       27.9 ( 2.22x)
blend_h_w16_8bpc_pwr9:      35.1 ( 3.28x)
blend_h_w32_8bpc_pwr9:      57.4 ( 3.88x)
blend_h_w64_8bpc_pwr9:      97.9 ( 4.70x)
blend_h_w128_8bpc_pwr9:    207.6 ( 5.18x)
2024-11-10 12:35:04 +01:00
Luca Barbato 423cf6e2bf ppc: blend_v pwr9 implementation
blend_v_w2_8bpc_pwr9:      25.0 ( 1.12x)
blend_v_w4_8bpc_pwr9:      79.3 ( 1.35x)
blend_v_w8_8bpc_pwr9:      79.5 ( 2.43x)
blend_v_w16_8bpc_pwr9:    108.0 ( 3.58x)
blend_v_w32_8bpc_pwr9:    153.5 ( 4.69x)
2024-11-10 12:35:04 +01:00
Luca Barbato 08681fdf13 ppc: blend pwr9 implementation
blend_w4_8bpc_pwr9:      14.4 ( 1.90x)
blend_w8_8bpc_pwr9:      19.9 ( 3.62x)
blend_w16_8bpc_pwr9:     50.6 ( 5.17x)
blend_w32_8bpc_pwr9:    125.8 ( 5.33x)
2024-11-10 12:35:04 +01:00
Brad Smith 93f12c117a Provide dav1d_getauxval() wrapper for getauxvaul() and elf_aux_info() 2024-11-05 13:10:58 +00:00
Nathan E. Egge a17c862576 riscv64/mc: Only process w*3/4 elements in blend_v
Setting VL for this function only impacts the 16bpc performance and only
 on the SpacemiT K1 which has two vector units of length 128b each.

Kendryte K230                Before             After         Delta

blend_v_w2_8bpc_c:        220.0 ( 1.00x)    221.3 ( 1.00x)    0.59%
blend_v_w2_8bpc_rvv:      145.7 ( 1.51x)    148.2 ( 1.49x)    1.72%
blend_v_w4_8bpc_c:        942.1 ( 1.00x)    943.7 ( 1.00x)    0.17%
blend_v_w4_8bpc_rvv:      240.4 ( 3.92x)    242.9 ( 3.89x)    1.04%
blend_v_w8_8bpc_c:       1782.3 ( 1.00x)   1783.8 ( 1.00x)    0.08%
blend_v_w8_8bpc_rvv:      252.6 ( 7.06x)    254.9 ( 7.00x)    0.91%
blend_v_w16_8bpc_c:      3650.9 ( 1.00x)   3647.0 ( 1.00x)   -0.11%
blend_v_w16_8bpc_rvv:     495.5 ( 7.37x)    494.4 ( 7.38x)   -0.22%
blend_v_w32_8bpc_c:      7013.0 ( 1.00x)   7018.2 ( 1.00x)    0.07%
blend_v_w32_8bpc_rvv:     807.9 ( 8.68x)    802.0 ( 8.75x)   -0.73%

blend_v_w2_16bpc_c:       226.1 ( 1.00x)    225.5 ( 1.00x)   -0.27%
blend_v_w2_16bpc_rvv:     148.6 ( 1.52x)    148.9 ( 1.51x)    0.20%
blend_v_w4_16bpc_c:      1010.7 ( 1.00x)   1006.7 ( 1.00x)   -0.40%
blend_v_w4_16bpc_rvv:     306.7 ( 3.30x)    307.4 ( 3.27x)    0.23%
blend_v_w8_16bpc_c:      1990.2 ( 1.00x)   1996.1 ( 1.00x)    0.30%
blend_v_w8_16bpc_rvv:     519.5 ( 3.83x)    523.4 ( 3.81x)    0.75%
blend_v_w16_16bpc_c:     3744.5 ( 1.00x)   3742.4 ( 1.00x)   -0.06%
blend_v_w16_16bpc_rvv:    899.6 ( 4.16x)    906.4 ( 4.13x)    0.76%
blend_v_w32_16bpc_c:     7047.5 ( 1.00x)   7079.3 ( 1.00x)    0.45%
blend_v_w32_16bpc_rvv:   1475.5 ( 4.78x)   1483.3 ( 4.77x)    0.53%

SpacemiT K1                  Before             After         Delta

blend_v_w2_8bpc_c:        216.3 ( 1.00x)    214.4 ( 1.00x)   -0.88%
blend_v_w2_8bpc_rvv:      144.0 ( 1.50x)    143.6 ( 1.49x)   -0.28%
blend_v_w4_8bpc_c:        919.8 ( 1.00x)    918.1 ( 1.00x)   -0.18%
blend_v_w4_8bpc_rvv:      236.6 ( 3.89x)    236.4 ( 3.88x)   -0.08%
blend_v_w8_8bpc_c:       1739.3 ( 1.00x)   1736.8 ( 1.00x)   -0.14%
blend_v_w8_8bpc_rvv:      236.8 ( 7.34x)    236.3 ( 7.35x)   -0.21%
blend_v_w16_8bpc_c:      3374.7 ( 1.00x)   3374.9 ( 1.00x)    0.01%
blend_v_w16_8bpc_rvv:     297.0 (11.36x)    296.8 (11.37x)   -0.07%
blend_v_w32_8bpc_c:      6647.5 ( 1.00x)   6645.5 ( 1.00x)   -0.03%
blend_v_w32_8bpc_rvv:     403.3 (16.48x)    402.4 (16.51x)   -0.22%

blend_v_w2_16bpc_c:       221.4 ( 1.00x)    220.1 ( 1.00x)   -0.59%
blend_v_w2_16bpc_rvv:     146.3 ( 1.51x)    147.3 ( 1.49x)    0.68%
blend_v_w4_16bpc_c:       973.3 ( 1.00x)    972.7 ( 1.00x)   -0.06%
blend_v_w4_16bpc_rvv:     280.3 ( 3.47x)    282.1 ( 3.45x)    0.64%
blend_v_w8_16bpc_c:      1814.8 ( 1.00x)   1816.2 ( 1.00x)    0.08%
blend_v_w8_16bpc_rvv:     376.6 ( 4.82x)    376.9 ( 4.82x)    0.08%
blend_v_w16_16bpc_c:     3485.5 ( 1.00x)   3485.5 ( 1.00x)    0.00%
blend_v_w16_16bpc_rvv:    531.1 ( 6.56x)    525.6 ( 6.63x)   -1.04%
blend_v_w32_16bpc_c:     6788.3 ( 1.00x)   6778.8 ( 1.00x)   -0.14%
blend_v_w32_16bpc_rvv:    904.5 ( 7.51x)    854.6 ( 7.93x)   -5.52%
2024-11-05 04:11:55 +00:00
Nathan E. Egge 907dd87191 riscv64/mc16: Unroll 16bpc RVV blend_v 2x
Kendryte K230                Before             After         Delta

blend_v_w2_16bpc_c:       225.8 ( 1.00x)    225.7 ( 1.00x)   -0.04%
blend_v_w2_16bpc_rvv:     194.7 ( 1.16x)    148.6 ( 1.52x)  -23.68%
blend_v_w4_16bpc_c:      1011.3 ( 1.00x)   1005.8 ( 1.00x)   -0.54%
blend_v_w4_16bpc_rvv:     387.2 ( 2.61x)    305.4 ( 3.29x)  -21.13%
blend_v_w8_16bpc_c:      1878.5 ( 1.00x)   1872.7 ( 1.00x)   -0.31%
blend_v_w8_16bpc_rvv:     475.3 ( 3.95x)    435.6 ( 4.30x)   -8.35%
blend_v_w16_16bpc_c:     3601.9 ( 1.00x)   3601.6 ( 1.00x)   -0.01%
blend_v_w16_16bpc_rvv:    891.2 ( 4.04x)    892.7 ( 4.03x)    0.17%
blend_v_w32_16bpc_c:     7043.7 ( 1.00x)   7058.8 ( 1.00x)    0.21%
blend_v_w32_16bpc_rvv:   1384.5 ( 5.09x)   1478.0 ( 4.78x)    6.75%

SpacemiT K1                  Before             After         Delta

blend_v_w2_16bpc_c:       222.6 ( 1.00x)    220.5 ( 1.00x)   -0.94%
blend_v_w2_16bpc_rvv:     195.7 ( 1.14x)    146.6 ( 1.50x)  -25.09%
blend_v_w4_16bpc_c:       972.3 ( 1.00x)    972.0 ( 1.00x)   -0.03%
blend_v_w4_16bpc_rvv:     349.1 ( 2.79x)    281.9 ( 3.45x)  -19.25%
blend_v_w8_16bpc_c:      1812.1 ( 1.00x)   1813.0 ( 1.00x)    0.05%
blend_v_w8_16bpc_rvv:     481.5 ( 3.76x)    376.0 ( 4.82x)  -21.91%
blend_v_w16_16bpc_c:     3488.4 ( 1.00x)   3484.6 ( 1.00x)   -0.11%
blend_v_w16_16bpc_rvv:    608.7 ( 5.73x)    523.4 ( 6.66x)  -14.01%
blend_v_w32_16bpc_c:     6795.3 ( 1.00x)   6792.4 ( 1.00x)   -0.04%
blend_v_w32_16bpc_rvv:    934.8 ( 7.27x)    907.3 ( 7.49x)   -2.94%
2024-11-04 20:20:37 +00:00
Nathan E. Egge 9710e7de9c riscv64/mc16: Branchless vsetvl in blend_v function
Kendryte K230                Before             After         Delta

blend_v_w2_16bpc_c:       226.0 ( 1.00x)    226.1 ( 1.00x)    0.04%
blend_v_w2_16bpc_rvv:     194.0 ( 1.16x)    193.9 ( 1.17x)   -0.05%
blend_v_w4_16bpc_c:      1011.8 ( 1.00x)   1009.4 ( 1.00x)   -0.24%
blend_v_w4_16bpc_rvv:     392.7 ( 2.58x)    390.8 ( 2.58x)   -0.48%
blend_v_w8_16bpc_c:      1987.9 ( 1.00x)   1988.0 ( 1.00x)    0.01%
blend_v_w8_16bpc_rvv:     561.5 ( 3.54x)    560.2 ( 3.55x)   -0.23%
blend_v_w16_16bpc_c:     3738.1 ( 1.00x)   3739.1 ( 1.00x)    0.03%
blend_v_w16_16bpc_rvv:    934.1 ( 4.00x)    932.2 ( 4.01x)   -0.20%
blend_v_w32_16bpc_c:     7031.0 ( 1.00x)   7030.1 ( 1.00x)   -0.01%
blend_v_w32_16bpc_rvv:   1403.3 ( 5.01x)   1395.8 ( 5.04x)   -0.53%

SpacemiT K1                  Before             After         Delta

blend_v_w2_16bpc_c:       221.0 ( 1.00x)    221.2 ( 1.00x)    0.09%
blend_v_w2_16bpc_rvv:     195.2 ( 1.13x)    196.0 ( 1.13x)    0.41%
blend_v_w4_16bpc_c:       969.8 ( 1.00x)    971.9 ( 1.00x)    0.22%
blend_v_w4_16bpc_rvv:     348.8 ( 2.78x)    349.1 ( 2.78x)    0.09%
blend_v_w8_16bpc_c:      1812.6 ( 1.00x)   1814.9 ( 1.00x)    0.13%
blend_v_w8_16bpc_rvv:     486.1 ( 3.73x)    484.3 ( 3.75x)   -0.37%
blend_v_w16_16bpc_c:     3483.0 ( 1.00x)   3485.1 ( 1.00x)    0.06%
blend_v_w16_16bpc_rvv:    608.7 ( 5.72x)    607.4 ( 5.74x)   -0.21%
blend_v_w32_16bpc_c:     6791.8 ( 1.00x)   6794.2 ( 1.00x)    0.04%
blend_v_w32_16bpc_rvv:    940.6 ( 7.22x)    942.1 ( 7.21x)    0.16%
2024-11-04 19:46:26 +00:00
Nathan E. Egge 28d1c21779 riscv64/mc16: Add VLEN=256 8bpc RVV blend_v function
SpacemiT K1                  Before             After         Delta

blend_v_w2_16bpc_c:       221.5 ( 1.00x)    220.3 ( 1.00x)   -0.54%
blend_v_w2_16bpc_rvv:     193.5 ( 1.14x)    194.3 ( 1.13x)    0.41%
blend_v_w4_16bpc_c:       968.8 ( 1.00x)    967.2 ( 1.00x)   -0.17%
blend_v_w4_16bpc_rvv:     442.2 ( 2.19x)    347.4 ( 2.78x)  -21.44%
blend_v_w8_16bpc_c:      1809.4 ( 1.00x)   1811.2 ( 1.00x)    0.10%
blend_v_w8_16bpc_rvv:     557.4 ( 3.25x)    483.2 ( 3.75x)  -13.31%
blend_v_w16_16bpc_c:     3481.4 ( 1.00x)   3473.4 ( 1.00x)   -0.23%
blend_v_w16_16bpc_rvv:    844.3 ( 4.12x)    603.1 ( 5.76x)  -28.57%
blend_v_w32_16bpc_c:     6783.1 ( 1.00x)   6749.8 ( 1.00x)   -0.49%
blend_v_w32_16bpc_rvv:   1406.1 ( 4.82x)    919.4 ( 7.34x)  -34.61%
2024-11-04 18:52:32 +00:00
Nathan E. Egge aa2deb898e riscv64/mc16: Add 16bpc RVV blend_v function
Kendryte K230

blend_v_w2_16bpc_c:       226.5 ( 1.00x)
blend_v_w2_16bpc_rvv:     192.2 ( 1.18x)
blend_v_w4_16bpc_c:      1010.3 ( 1.00x)
blend_v_w4_16bpc_rvv:     390.5 ( 2.59x)
blend_v_w8_16bpc_c:      1994.2 ( 1.00x)
blend_v_w8_16bpc_rvv:     561.7 ( 3.55x)
blend_v_w16_16bpc_c:     3737.9 ( 1.00x)
blend_v_w16_16bpc_rvv:    928.0 ( 4.03x)
blend_v_w32_16bpc_c:     7064.7 ( 1.00x)
blend_v_w32_16bpc_rvv:   1428.9 ( 4.94x)

SpacemiT K1

blend_v_w2_16bpc_c:       220.8 ( 1.00x)
blend_v_w2_16bpc_rvv:     193.5 ( 1.14x)
blend_v_w4_16bpc_c:       967.3 ( 1.00x)
blend_v_w4_16bpc_rvv:     439.5 ( 2.20x)
blend_v_w8_16bpc_c:      1810.2 ( 1.00x)
blend_v_w8_16bpc_rvv:     555.3 ( 3.26x)
blend_v_w16_16bpc_c:     3476.4 ( 1.00x)
blend_v_w16_16bpc_rvv:    830.9 ( 4.18x)
blend_v_w32_16bpc_c:     6772.9 ( 1.00x)
blend_v_w32_16bpc_rvv:   1356.3 ( 4.99x)
2024-11-04 18:52:30 +00:00
Nathan E. Egge c783088fe7 riscv64/mc16: Unroll 16bpc RVV blend 2x
Kendryte K230              Before               After         Delta

blend_w4_16bpc_c:       210.0 ( 1.00x)      208.9 ( 1.00x)   -0.52%
blend_w4_16bpc_rvv:      88.5 ( 2.37x)       66.2 ( 3.15x)  -25.20%
blend_w8_16bpc_c:       614.1 ( 1.00x)      613.5 ( 1.00x)   -0.10%
blend_w8_16bpc_rvv:     143.1 ( 4.29x)      126.9 ( 4.83x)  -11.32%
blend_w16_16bpc_c:     2371.2 ( 1.00x)     2371.3 ( 1.00x)    0.00%
blend_w16_16bpc_rvv:    461.1 ( 5.14x)      413.2 ( 5.74x)  -10.39%
blend_w32_16bpc_c:     5998.4 ( 1.00x)     5998.4 ( 1.00x)    0.00%
blend_w32_16bpc_rvv:    978.4 ( 6.13x)     1013.1 ( 5.92x)    3.55%

SpacemiT K1                Before               After         Delta

blend_w4_16bpc_c:       205.8 ( 1.00x)      205.9 ( 1.00x)    0.05%
blend_w4_16bpc_rvv:      80.9 ( 2.54x)       64.9 ( 3.17x)  -19.78%
blend_w8_16bpc_c:       599.9 ( 1.00x)      599.9 ( 1.00x)    0.00%
blend_w8_16bpc_rvv:     134.4 ( 4.46x)      101.9 ( 5.89x)  -24.18%
blend_w16_16bpc_c:     2316.5 ( 1.00x)     2316.5 ( 1.00x)    0.00%
blend_w16_16bpc_rvv:    302.0 ( 7.67x)      262.8 ( 8.81x)  -12.98%
blend_w32_16bpc_c:     5861.9 ( 1.00x)     5861.4 ( 1.00x)   -0.01%
blend_w32_16bpc_rvv:    589.6 ( 9.94x)      602.2 ( 9.73x)    2.14%
2024-10-31 07:11:35 +00:00
Nathan E. Egge 67c60d76e1 riscv64/mc16: Branchless vsetvl in blend function
Kendryte K230              Before               After         Delta

blend_w4_16bpc_c:       208.8 ( 1.00x)      209.9 ( 1.00x)    0.53%
blend_w4_16bpc_rvv:      85.9 ( 2.43x)       88.6 ( 2.37x)    3.14%
blend_w8_16bpc_c:       613.2 ( 1.00x)      614.3 ( 1.00x)    0.18%
blend_w8_16bpc_rvv:     145.4 ( 4.22x)      143.1 ( 4.29x)   -1.58%
blend_w16_16bpc_c:     2371.9 ( 1.00x)     2373.6 ( 1.00x)    0.07%
blend_w16_16bpc_rvv:    464.0 ( 5.11x)      461.2 ( 5.15x)   -0.60%
blend_w32_16bpc_c:     6005.6 ( 1.00x)     6007.7 ( 1.00x)    0.03%
blend_w32_16bpc_rvv:    981.6 ( 6.12x)      979.4 ( 6.13x)   -0.22%

SpacemiT K1                Before               After         Delta

blend_w4_16bpc_c:       206.4 ( 1.00x)      205.7 ( 1.00x)   -0.34%
blend_w4_16bpc_rvv:      79.5 ( 2.60x)       81.0 ( 2.54x)    1.89%
blend_w8_16bpc_c:       600.7 ( 1.00x)      599.7 ( 1.00x)   -0.17%
blend_w8_16bpc_rvv:     133.3 ( 4.51x)      134.1 ( 4.47x)    0.60%
blend_w16_16bpc_c:     2315.9 ( 1.00x)     2315.2 ( 1.00x)   -0.03%
blend_w16_16bpc_rvv:    305.2 ( 7.59x)      300.7 ( 7.70x)   -1.47%
blend_w32_16bpc_c:     5861.1 ( 1.00x)     5860.2 ( 1.00x)   -0.02%
blend_w32_16bpc_rvv:    592.5 ( 9.89x)      589.5 ( 9.94x)   -0.51%
2024-10-31 07:11:35 +00:00
Nathan E. Egge 3437a26b3d riscv64/mc16: Add VLEN=256 8bpc RVV blend function
SpacemiT K1                Before               After         Delta

blend_w4_16bpc_c:       206.8 ( 1.00x)      206.0 ( 1.00x)   -0.39%
blend_w4_16bpc_rvv:      95.8 ( 2.16x)       77.8 ( 2.65x)  -18.79%
blend_w8_16bpc_c:       600.4 ( 1.00x)      600.1 ( 1.00x)   -0.05%
blend_w8_16bpc_rvv:     161.7 ( 3.71x)      131.3 ( 4.57x)  -18.80%
blend_w16_16bpc_c:     2317.6 ( 1.00x)     2316.5 ( 1.00x)   -0.05%
blend_w16_16bpc_rvv:    459.6 ( 5.04x)      302.9 ( 7.65x)  -34.09%
blend_w32_16bpc_c:     5863.0 ( 1.00x)     5863.3 ( 1.00x)    0.01%
blend_w32_16bpc_rvv:    992.7 ( 5.91x)      578.1 (10.14x)  -41.76%
2024-10-31 07:11:35 +00:00
Nathan E. Egge e542f661d0 meson: Move riscv64 8bpc only files into bitdepth sources
The cdef.S, itx.S and mc.S files contain only 8bpc implementations and
 should be compiled only when building with -Dbitdepths=8 configuration.
2024-10-29 12:17:14 +00:00
Nathan E. Egge ca489d8aab riscv64/mc16: Add 16bpc RVV blend function
Kendryte K230

blend_w4_16bpc_c:        214.4 ( 1.00x)
blend_w4_16bpc_rvv:       90.2 ( 2.38x)
blend_w8_16bpc_c:        618.9 ( 1.00x)
blend_w8_16bpc_rvv:      147.4 ( 4.20x)
blend_w16_16bpc_c:      2376.5 ( 1.00x)
blend_w16_16bpc_rvv:     466.0 ( 5.10x)
blend_w32_16bpc_c:      6008.6 ( 1.00x)
blend_w32_16bpc_rvv:     985.0 ( 6.10x)

SpacemiT K1

blend_w4_16bpc_c:        204.9 ( 1.00x)
blend_w4_16bpc_rvv:       88.3 ( 2.32x)
blend_w8_16bpc_c:        598.5 ( 1.00x)
blend_w8_16bpc_rvv:      155.3 ( 3.85x)
blend_w16_16bpc_c:      2315.4 ( 1.00x)
blend_w16_16bpc_rvv:     444.4 ( 5.21x)
blend_w32_16bpc_c:      5860.1 ( 1.00x)
blend_w32_16bpc_rvv:     993.0 ( 5.90x)
2024-10-29 08:21:53 +00:00
Nathan E. Egge 22e9c0fee3 riscv64/ipred16: Fix build error with -Dbitdepths=16
When configuring and building dav1d with just the 16bp code paths using
 meson setup .. -Dbitdepths=16 there is an undefined reference to
 dav1d_dc_gen_8bpc_rvv due to a typo in src/riscv/64/ipred16.S.
2024-10-28 23:30:46 +00:00
Henrik Gramner ef4aff75b0 x86: Improve SSSE3 SGR asm
* Use the same approach as AVX2 of using floating-point reciprocal
   instructions to replace dav1d_sgr_x_by_x[] table lookups.

 * Optimize clipping of p-values in the 10bpc code.

 * Rename some macros to clarify their functionality.

 * Implement various minor tweaks.
2024-10-22 00:00:32 +02:00
Martin Storsjö 55fb9433b7 checkasm: Remove leftover comment
This comment no longer is relevant after
9278a14cf4.
2024-10-18 14:37:28 +00:00
Martin Storsjö 23f2769266 meson: Test support for aarch64 extensions with gas-preprocessor too 2024-10-18 10:55:59 +00:00
Martin Storsjö b13d1bc2bb meson: Move checks for gas-preprocessor earlier
Locate the assembler tools before checking for support for various
assembler features.
2024-10-18 10:55:59 +00:00
Jean-Baptiste Kempf 32cf02af50 NEWS for 1.5.0 2024-10-18 01:02:57 +02:00
Nathan E. Egge c3fa1db301 NEWS: add itx to riscv list 2024-10-16 18:06:00 +00:00
Nathan E. Egge 789a1f652b riscv64/itx: Replace vwadd+vnsra with vnclip
The vnclip instruction does a fixed-point saturating add then shift and
 can replace vwadd followed by vnsra in idct_4, idct_8, idct_16, iadst_8
 and iadst_16.
Including 572c5a6 (which applies the same change to iadst_4) these
 commits give the following average improvements across all modified 2D
 transform functions:

          Kendryte K230     SpacemiT K1

   4x4       -5.50%           -4.44%
   8x8       -9.78%           -7.62%
  16x16      -9.70%           -9.04%
   4x8       -8.39%           -7.54%
   8x4       -8.10%           -4.66%
   4x16      -8.16%           -7.74%
  16x4       -8.07%           -6.96%
   8x16      -9.11%           -7.43%
  16x8       -9.87%           -7.81%

Kendryte K230                                      Old     New     Delta

inv_txfm_add_4x4_adst_adst_0_8bpc_rvv              99.0    93.4   -5.66%
inv_txfm_add_4x4_adst_adst_1_8bpc_rvv              99.0    93.4   -5.66%
inv_txfm_add_4x4_adst_dct_0_8bpc_rvv               93.4    87.2   -6.64%
inv_txfm_add_4x4_adst_dct_1_8bpc_rvv               93.5    87.2   -6.74%
inv_txfm_add_4x4_adst_flipadst_0_8bpc_rvv         100.3    94.9   -5.38%
inv_txfm_add_4x4_adst_flipadst_1_8bpc_rvv         100.3    94.9   -5.38%
inv_txfm_add_4x4_adst_identity_0_8bpc_rvv          80.5    77.2   -4.10%
inv_txfm_add_4x4_adst_identity_1_8bpc_rvv          80.5    77.2   -4.10%
inv_txfm_add_4x4_dct_adst_0_8bpc_rvv               94.1    88.5   -5.95%
inv_txfm_add_4x4_dct_adst_1_8bpc_rvv               94.1    88.5   -5.95%
inv_txfm_add_4x4_dct_dct_0_8bpc_rvv                40.3    40.3    0.00%
inv_txfm_add_4x4_dct_dct_1_8bpc_rvv                92.2    82.1  -10.95%
inv_txfm_add_4x4_dct_flipadst_0_8bpc_rvv           95.3    89.9   -5.67%
inv_txfm_add_4x4_dct_flipadst_1_8bpc_rvv           95.3    89.9   -5.67%
inv_txfm_add_4x4_dct_identity_0_8bpc_rvv           75.5    73.3   -2.91%
inv_txfm_add_4x4_dct_identity_1_8bpc_rvv           75.5    73.3   -2.91%
inv_txfm_add_4x4_flipadst_adst_0_8bpc_rvv         100.3    94.7   -5.58%
inv_txfm_add_4x4_flipadst_adst_1_8bpc_rvv         100.3    94.7   -5.58%
inv_txfm_add_4x4_flipadst_dct_0_8bpc_rvv           94.8    88.4   -6.75%
inv_txfm_add_4x4_flipadst_dct_1_8bpc_rvv           94.8    88.5   -6.65%
inv_txfm_add_4x4_flipadst_flipadst_0_8bpc_rvv     105.0    96.0   -8.57%
inv_txfm_add_4x4_flipadst_flipadst_1_8bpc_rvv     105.0    95.9   -8.67%
inv_txfm_add_4x4_flipadst_identity_0_8bpc_rvv      81.6    78.5   -3.80%
inv_txfm_add_4x4_flipadst_identity_1_8bpc_rvv      81.6    78.4   -3.92%
inv_txfm_add_4x4_identity_adst_0_8bpc_rvv          80.3    77.8   -3.11%
inv_txfm_add_4x4_identity_adst_1_8bpc_rvv          80.3    77.8   -3.11%
inv_txfm_add_4x4_identity_dct_0_8bpc_rvv           77.2    71.7   -7.12%
inv_txfm_add_4x4_identity_dct_1_8bpc_rvv           77.2    71.7   -7.12%
inv_txfm_add_4x4_identity_flipadst_0_8bpc_rvv      81.5    79.2   -2.82%
inv_txfm_add_4x4_identity_flipadst_1_8bpc_rvv      81.6    79.2   -2.94%
inv_txfm_add_4x4_identity_identity_0_8bpc_rvv      62.8    61.6   -1.91%
inv_txfm_add_4x4_identity_identity_1_8bpc_rvv      62.8    61.6   -1.91%
inv_txfm_add_4x4_wht_wht_0_8bpc_rvv                67.8    67.8    0.00%
inv_txfm_add_4x4_wht_wht_1_8bpc_rvv                67.8    67.8    0.00%

inv_txfm_add_8x8_adst_adst_0_8bpc_rvv             403.1   356.1  -11.66%
inv_txfm_add_8x8_adst_adst_1_8bpc_rvv             403.1   356.0  -11.68%
inv_txfm_add_8x8_adst_dct_0_8bpc_rvv              360.2   323.2  -10.27%
inv_txfm_add_8x8_adst_dct_1_8bpc_rvv              360.2   323.2  -10.27%
inv_txfm_add_8x8_adst_flipadst_0_8bpc_rvv         405.2   358.4  -11.55%
inv_txfm_add_8x8_adst_flipadst_1_8bpc_rvv         405.2   358.4  -11.55%
inv_txfm_add_8x8_adst_identity_0_8bpc_rvv         284.3   261.0   -8.20%
inv_txfm_add_8x8_adst_identity_1_8bpc_rvv         284.4   260.9   -8.26%
inv_txfm_add_8x8_dct_adst_0_8bpc_rvv              360.2   322.0  -10.61%
inv_txfm_add_8x8_dct_adst_1_8bpc_rvv              360.0   321.9  -10.58%
inv_txfm_add_8x8_dct_dct_0_8bpc_rvv                76.6    77.0    0.52%
inv_txfm_add_8x8_dct_dct_1_8bpc_rvv               317.2   289.0   -8.89%
inv_txfm_add_8x8_dct_flipadst_0_8bpc_rvv          363.7   324.3  -10.83%
inv_txfm_add_8x8_dct_flipadst_1_8bpc_rvv          363.8   324.3  -10.86%
inv_txfm_add_8x8_dct_identity_0_8bpc_rvv          241.2   226.9   -5.93%
inv_txfm_add_8x8_dct_identity_1_8bpc_rvv          241.3   227.0   -5.93%
inv_txfm_add_8x8_flipadst_adst_0_8bpc_rvv         404.9   358.0  -11.58%
inv_txfm_add_8x8_flipadst_adst_1_8bpc_rvv         405.0   358.1  -11.58%
inv_txfm_add_8x8_flipadst_dct_0_8bpc_rvv          365.1   323.8  -11.31%
inv_txfm_add_8x8_flipadst_dct_1_8bpc_rvv          365.2   323.9  -11.31%
inv_txfm_add_8x8_flipadst_flipadst_0_8bpc_rvv     407.2   359.6  -11.69%
inv_txfm_add_8x8_flipadst_flipadst_1_8bpc_rvv     406.4   359.5  -11.54%
inv_txfm_add_8x8_flipadst_identity_0_8bpc_rvv     285.8   261.9   -8.36%
inv_txfm_add_8x8_flipadst_identity_1_8bpc_rvv     285.9   261.8   -8.43%
inv_txfm_add_8x8_identity_adst_0_8bpc_rvv         269.9   244.5   -9.41%
inv_txfm_add_8x8_identity_adst_1_8bpc_rvv         269.8   244.5   -9.38%
inv_txfm_add_8x8_identity_dct_0_8bpc_rvv          225.5   209.6   -7.05%
inv_txfm_add_8x8_identity_dct_1_8bpc_rvv          225.6   209.5   -7.14%
inv_txfm_add_8x8_identity_flipadst_0_8bpc_rvv     270.5   246.5   -8.87%
inv_txfm_add_8x8_identity_flipadst_1_8bpc_rvv     270.5   246.5   -8.87%
inv_txfm_add_8x8_identity_identity_0_8bpc_rvv     146.5   145.4   -0.75%
inv_txfm_add_8x8_identity_identity_1_8bpc_rvv     146.4   145.4   -0.68%

inv_txfm_add_16x16_adst_adst_0_8bpc_rvv          1363.4  1212.0  -11.10%
inv_txfm_add_16x16_adst_adst_1_8bpc_rvv          1363.6  1212.2  -11.10%
inv_txfm_add_16x16_adst_adst_2_8bpc_rvv          1813.7  1601.4  -11.71%
inv_txfm_add_16x16_adst_dct_0_8bpc_rvv           1185.9  1074.6   -9.39%
inv_txfm_add_16x16_adst_dct_1_8bpc_rvv           1186.0  1074.7   -9.38%
inv_txfm_add_16x16_adst_dct_2_8bpc_rvv           1639.5  1468.9  -10.41%
inv_txfm_add_16x16_adst_flipadst_0_8bpc_rvv      1374.8  1214.8  -11.64%
inv_txfm_add_16x16_adst_flipadst_1_8bpc_rvv      1374.7  1214.6  -11.65%
inv_txfm_add_16x16_adst_flipadst_2_8bpc_rvv      1819.3  1610.9  -11.45%
inv_txfm_add_16x16_dct_adst_0_8bpc_rvv           1283.3  1139.1  -11.24%
inv_txfm_add_16x16_dct_adst_1_8bpc_rvv           1283.2  1139.2  -11.22%
inv_txfm_add_16x16_dct_adst_2_8bpc_rvv           1632.4  1471.9   -9.83%
inv_txfm_add_16x16_dct_dct_0_8bpc_rvv             160.9   158.7   -1.37%
inv_txfm_add_16x16_dct_dct_1_8bpc_rvv            1099.5   997.1   -9.31%
inv_txfm_add_16x16_dct_dct_2_8bpc_rvv            1465.3  1335.2   -8.88%
inv_txfm_add_16x16_dct_flipadst_0_8bpc_rvv       1286.8  1143.2  -11.16%
inv_txfm_add_16x16_dct_flipadst_1_8bpc_rvv       1286.8  1143.3  -11.15%
inv_txfm_add_16x16_dct_flipadst_2_8bpc_rvv       1638.6  1473.5  -10.08%
inv_txfm_add_16x16_dct_identity_0_8bpc_rvv        806.6   783.3   -2.89%
inv_txfm_add_16x16_dct_identity_1_8bpc_rvv        806.7   783.4   -2.89%
inv_txfm_add_16x16_dct_identity_2_8bpc_rvv       1163.1  1105.3   -4.97%
inv_txfm_add_16x16_flipadst_adst_0_8bpc_rvv      1374.3  1216.0  -11.52%
inv_txfm_add_16x16_flipadst_adst_1_8bpc_rvv      1374.3  1216.2  -11.50%
inv_txfm_add_16x16_flipadst_adst_2_8bpc_rvv      1817.5  1609.7  -11.43%
inv_txfm_add_16x16_flipadst_dct_0_8bpc_rvv       1190.4  1073.8   -9.80%
inv_txfm_add_16x16_flipadst_dct_1_8bpc_rvv       1190.4  1073.9   -9.79%
inv_txfm_add_16x16_flipadst_dct_2_8bpc_rvv       1640.4  1472.6  -10.23%
inv_txfm_add_16x16_flipadst_flipadst_0_8bpc_rvv  1376.0  1224.2  -11.03%
inv_txfm_add_16x16_flipadst_flipadst_1_8bpc_rvv  1376.0  1224.1  -11.04%
inv_txfm_add_16x16_flipadst_flipadst_2_8bpc_rvv  1829.3  1616.6  -11.63%
inv_txfm_add_16x16_identity_dct_0_8bpc_rvv        952.9   882.0   -7.44%
inv_txfm_add_16x16_identity_dct_1_8bpc_rvv        952.8   881.9   -7.44%
inv_txfm_add_16x16_identity_dct_2_8bpc_rvv       1172.0  1100.1   -6.13%
inv_txfm_add_16x16_identity_identity_0_8bpc_rvv   657.6   659.8    0.33%
inv_txfm_add_16x16_identity_identity_1_8bpc_rvv   657.6   659.7    0.32%
inv_txfm_add_16x16_identity_identity_2_8bpc_rvv   876.2   878.1    0.22%

inv_txfm_add_4x8_adst_adst_0_8bpc_rvv             197.3   178.0   -9.78%
inv_txfm_add_4x8_adst_adst_1_8bpc_rvv             197.4   178.0   -9.83%
inv_txfm_add_4x8_adst_dct_0_8bpc_rvv              174.9   159.9   -8.58%
inv_txfm_add_4x8_adst_dct_1_8bpc_rvv              174.9   159.9   -8.58%
inv_txfm_add_4x8_adst_flipadst_0_8bpc_rvv         199.2   180.2   -9.54%
inv_txfm_add_4x8_adst_flipadst_1_8bpc_rvv         199.2   180.2   -9.54%
inv_txfm_add_4x8_adst_identity_0_8bpc_rvv         123.3   118.0   -4.30%
inv_txfm_add_4x8_adst_identity_1_8bpc_rvv         123.3   118.0   -4.30%
inv_txfm_add_4x8_dct_adst_0_8bpc_rvv              191.1   171.8  -10.10%
inv_txfm_add_4x8_dct_adst_1_8bpc_rvv              191.1   171.7  -10.15%
inv_txfm_add_4x8_dct_dct_0_8bpc_rvv               168.9   153.6   -9.06%
inv_txfm_add_4x8_dct_dct_1_8bpc_rvv               169.0   153.6   -9.11%
inv_txfm_add_4x8_dct_flipadst_0_8bpc_rvv          193.0   173.9   -9.90%
inv_txfm_add_4x8_dct_flipadst_1_8bpc_rvv          193.0   173.9   -9.90%
inv_txfm_add_4x8_dct_identity_0_8bpc_rvv          117.0   111.7   -4.53%
inv_txfm_add_4x8_dct_identity_1_8bpc_rvv          117.0   111.7   -4.53%
inv_txfm_add_4x8_flipadst_adst_0_8bpc_rvv         198.0   178.6   -9.80%
inv_txfm_add_4x8_flipadst_adst_1_8bpc_rvv         198.0   178.6   -9.80%
inv_txfm_add_4x8_flipadst_dct_0_8bpc_rvv          175.8   160.5   -8.70%
inv_txfm_add_4x8_flipadst_dct_1_8bpc_rvv          175.8   160.5   -8.70%
inv_txfm_add_4x8_flipadst_flipadst_0_8bpc_rvv     199.9   180.5   -9.70%
inv_txfm_add_4x8_flipadst_flipadst_1_8bpc_rvv     199.9   180.5   -9.70%
inv_txfm_add_4x8_flipadst_identity_0_8bpc_rvv     123.6   118.6   -4.05%
inv_txfm_add_4x8_flipadst_identity_1_8bpc_rvv     123.6   118.6   -4.05%
inv_txfm_add_4x8_identity_adst_0_8bpc_rvv         171.3   154.2   -9.98%
inv_txfm_add_4x8_identity_adst_1_8bpc_rvv         171.3   154.2   -9.98%
inv_txfm_add_4x8_identity_dct_0_8bpc_rvv          148.6   136.5   -8.14%
inv_txfm_add_4x8_identity_dct_1_8bpc_rvv          148.6   136.5   -8.14%
inv_txfm_add_4x8_identity_flipadst_0_8bpc_rvv     173.1   156.4   -9.65%
inv_txfm_add_4x8_identity_flipadst_1_8bpc_rvv     173.2   156.4   -9.70%
inv_txfm_add_4x8_identity_identity_0_8bpc_rvv      94.3    94.2   -0.11%
inv_txfm_add_4x8_identity_identity_1_8bpc_rvv      94.2    94.2    0.00%

inv_txfm_add_8x4_adst_adst_0_8bpc_rvv             201.2   188.4   -6.36%
inv_txfm_add_8x4_adst_adst_1_8bpc_rvv             201.2   188.4   -6.36%
inv_txfm_add_8x4_adst_dct_0_8bpc_rvv              194.9   175.7   -9.85%
inv_txfm_add_8x4_adst_dct_1_8bpc_rvv              194.9   175.7   -9.85%
inv_txfm_add_8x4_adst_flipadst_0_8bpc_rvv         202.4   182.3   -9.93%
inv_txfm_add_8x4_adst_flipadst_1_8bpc_rvv         202.4   182.3   -9.93%
inv_txfm_add_8x4_adst_identity_0_8bpc_rvv         170.1   155.7   -8.47%
inv_txfm_add_8x4_adst_identity_1_8bpc_rvv         170.1   155.7   -8.47%
inv_txfm_add_8x4_dct_adst_0_8bpc_rvv              178.0   162.1   -8.93%
inv_txfm_add_8x4_dct_adst_1_8bpc_rvv              178.0   162.1   -8.93%
inv_txfm_add_8x4_dct_dct_0_8bpc_rvv               172.8   157.0   -9.14%
inv_txfm_add_8x4_dct_dct_1_8bpc_rvv               172.9   157.0   -9.20%
inv_txfm_add_8x4_dct_flipadst_0_8bpc_rvv          180.3   163.7   -9.21%
inv_txfm_add_8x4_dct_flipadst_1_8bpc_rvv          180.3   163.7   -9.21%
inv_txfm_add_8x4_dct_identity_0_8bpc_rvv          147.9   137.9   -6.76%
inv_txfm_add_8x4_dct_identity_1_8bpc_rvv          147.9   137.9   -6.76%
inv_txfm_add_8x4_flipadst_adst_0_8bpc_rvv         202.4   182.3   -9.93%
inv_txfm_add_8x4_flipadst_adst_1_8bpc_rvv         202.4   182.3   -9.93%
inv_txfm_add_8x4_flipadst_dct_0_8bpc_rvv          196.3   175.9  -10.39%
inv_txfm_add_8x4_flipadst_dct_1_8bpc_rvv          196.3   175.9  -10.39%
inv_txfm_add_8x4_flipadst_flipadst_0_8bpc_rvv     203.7   183.4   -9.97%
inv_txfm_add_8x4_flipadst_flipadst_1_8bpc_rvv     203.7   183.4   -9.97%
inv_txfm_add_8x4_flipadst_identity_0_8bpc_rvv     171.1   155.9   -8.88%
inv_txfm_add_8x4_flipadst_identity_1_8bpc_rvv     171.1   155.9   -8.88%
inv_txfm_add_8x4_identity_adst_0_8bpc_rvv         126.8   120.9   -4.65%
inv_txfm_add_8x4_identity_adst_1_8bpc_rvv         126.8   120.9   -4.65%
inv_txfm_add_8x4_identity_dct_0_8bpc_rvv          121.5   117.0   -3.70%
inv_txfm_add_8x4_identity_dct_1_8bpc_rvv          121.6   117.0   -3.78%
inv_txfm_add_8x4_identity_flipadst_0_8bpc_rvv     129.1   122.3   -5.27%
inv_txfm_add_8x4_identity_flipadst_1_8bpc_rvv     129.1   122.3   -5.27%
inv_txfm_add_8x4_identity_identity_0_8bpc_rvv      98.5    95.7   -2.84%
inv_txfm_add_8x4_identity_identity_1_8bpc_rvv      98.5    95.7   -2.84%

inv_txfm_add_4x16_adst_adst_0_8bpc_rvv            384.4   344.6  -10.35%
inv_txfm_add_4x16_adst_adst_1_8bpc_rvv            384.5   344.6  -10.38%
inv_txfm_add_4x16_adst_adst_2_8bpc_rvv            429.3   387.3   -9.78%
inv_txfm_add_4x16_adst_dct_0_8bpc_rvv             333.7   304.3   -8.81%
inv_txfm_add_4x16_adst_dct_1_8bpc_rvv             333.7   304.2   -8.84%
inv_txfm_add_4x16_adst_dct_2_8bpc_rvv             381.2   354.2   -7.08%
inv_txfm_add_4x16_adst_flipadst_0_8bpc_rvv        385.7   349.1   -9.49%
inv_txfm_add_4x16_adst_flipadst_1_8bpc_rvv        385.7   349.1   -9.49%
inv_txfm_add_4x16_adst_flipadst_2_8bpc_rvv        433.0   389.3  -10.09%
inv_txfm_add_4x16_adst_identity_0_8bpc_rvv        251.6   244.2   -2.94%
inv_txfm_add_4x16_adst_identity_1_8bpc_rvv        251.5   244.1   -2.94%
inv_txfm_add_4x16_adst_identity_2_8bpc_rvv        300.4   289.6   -3.60%
inv_txfm_add_4x16_dct_adst_0_8bpc_rvv             378.5   335.6  -11.33%
inv_txfm_add_4x16_dct_adst_1_8bpc_rvv             378.5   335.5  -11.36%
inv_txfm_add_4x16_dct_adst_2_8bpc_rvv             420.6   369.5  -12.15%
inv_txfm_add_4x16_dct_dct_0_8bpc_rvv              323.5   295.3   -8.72%
inv_txfm_add_4x16_dct_dct_1_8bpc_rvv              323.2   295.2   -8.66%
inv_txfm_add_4x16_dct_dct_2_8bpc_rvv              362.9   333.0   -8.24%
inv_txfm_add_4x16_dct_flipadst_0_8bpc_rvv         375.3   339.4   -9.57%
inv_txfm_add_4x16_dct_flipadst_1_8bpc_rvv         375.4   339.0   -9.70%
inv_txfm_add_4x16_dct_flipadst_2_8bpc_rvv         414.8   372.2  -10.27%
inv_txfm_add_4x16_dct_identity_0_8bpc_rvv         240.8   234.7   -2.53%
inv_txfm_add_4x16_dct_identity_1_8bpc_rvv         240.7   234.7   -2.49%
inv_txfm_add_4x16_dct_identity_2_8bpc_rvv         283.2   268.0   -5.37%
inv_txfm_add_4x16_flipadst_adst_0_8bpc_rvv        384.2   345.8   -9.99%
inv_txfm_add_4x16_flipadst_adst_1_8bpc_rvv        384.1   345.8   -9.97%
inv_txfm_add_4x16_flipadst_adst_2_8bpc_rvv        432.5   387.7  -10.36%
inv_txfm_add_4x16_flipadst_dct_0_8bpc_rvv         334.9   307.0   -8.33%
inv_txfm_add_4x16_flipadst_dct_1_8bpc_rvv         335.0   307.1   -8.33%
inv_txfm_add_4x16_flipadst_dct_2_8bpc_rvv         386.1   347.2  -10.08%
inv_txfm_add_4x16_flipadst_flipadst_0_8bpc_rvv    386.7   349.4   -9.65%
inv_txfm_add_4x16_flipadst_flipadst_1_8bpc_rvv    386.8   349.5   -9.64%
inv_txfm_add_4x16_flipadst_flipadst_2_8bpc_rvv    436.6   392.9  -10.01%
inv_txfm_add_4x16_flipadst_identity_0_8bpc_rvv    252.4   247.4   -1.98%
inv_txfm_add_4x16_flipadst_identity_1_8bpc_rvv    252.4   247.5   -1.94%
inv_txfm_add_4x16_flipadst_identity_2_8bpc_rvv    302.1   286.7   -5.10%
inv_txfm_add_4x16_identity_adst_0_8bpc_rvv        348.3   317.4   -8.87%
inv_txfm_add_4x16_identity_adst_1_8bpc_rvv        348.4   317.5   -8.87%
inv_txfm_add_4x16_identity_adst_2_8bpc_rvv        361.4   329.0   -8.97%
inv_txfm_add_4x16_identity_dct_0_8bpc_rvv         301.8   275.8   -8.61%
inv_txfm_add_4x16_identity_dct_1_8bpc_rvv         301.8   275.8   -8.61%
inv_txfm_add_4x16_identity_dct_2_8bpc_rvv         312.0   287.4   -7.88%
inv_txfm_add_4x16_identity_flipadst_0_8bpc_rvv    352.2   321.9   -8.60%
inv_txfm_add_4x16_identity_flipadst_1_8bpc_rvv    352.2   322.0   -8.57%
inv_txfm_add_4x16_identity_flipadst_2_8bpc_rvv    363.7   332.5   -8.58%
inv_txfm_add_4x16_identity_identity_0_8bpc_rvv    215.8   215.0   -0.37%
inv_txfm_add_4x16_identity_identity_1_8bpc_rvv    215.8   215.1   -0.32%
inv_txfm_add_4x16_identity_identity_2_8bpc_rvv    228.0   227.0   -0.44%

inv_txfm_add_16x4_adst_adst_0_8bpc_rvv            430.3   388.5   -9.71%
inv_txfm_add_16x4_adst_adst_1_8bpc_rvv            430.3   388.5   -9.71%
inv_txfm_add_16x4_adst_adst_2_8bpc_rvv            430.2   388.5   -9.69%
inv_txfm_add_16x4_adst_dct_0_8bpc_rvv             412.1   374.1   -9.22%
inv_txfm_add_16x4_adst_dct_1_8bpc_rvv             412.0   374.3   -9.15%
inv_txfm_add_16x4_adst_dct_2_8bpc_rvv             412.1   374.2   -9.20%
inv_txfm_add_16x4_adst_flipadst_0_8bpc_rvv        432.9   391.0   -9.68%
inv_txfm_add_16x4_adst_flipadst_1_8bpc_rvv        432.8   391.1   -9.63%
inv_txfm_add_16x4_adst_flipadst_2_8bpc_rvv        432.4   391.0   -9.57%
inv_txfm_add_16x4_adst_identity_0_8bpc_rvv        358.4   332.1   -7.34%
inv_txfm_add_16x4_adst_identity_1_8bpc_rvv        358.4   332.3   -7.28%
inv_txfm_add_16x4_adst_identity_2_8bpc_rvv        358.5   332.5   -7.25%
inv_txfm_add_16x4_dct_adst_0_8bpc_rvv             386.9   347.1  -10.29%
inv_txfm_add_16x4_dct_adst_1_8bpc_rvv             386.8   347.1  -10.26%
inv_txfm_add_16x4_dct_adst_2_8bpc_rvv             387.0   346.8  -10.39%
inv_txfm_add_16x4_dct_dct_0_8bpc_rvv              363.3   330.9   -8.92%
inv_txfm_add_16x4_dct_dct_1_8bpc_rvv              363.3   330.9   -8.92%
inv_txfm_add_16x4_dct_dct_2_8bpc_rvv              363.2   331.0   -8.87%
inv_txfm_add_16x4_dct_flipadst_0_8bpc_rvv         383.7   349.8   -8.84%
inv_txfm_add_16x4_dct_flipadst_1_8bpc_rvv         384.3   349.8   -8.98%
inv_txfm_add_16x4_dct_flipadst_2_8bpc_rvv         384.3   349.7   -9.00%
inv_txfm_add_16x4_dct_identity_0_8bpc_rvv         310.2   288.4   -7.03%
inv_txfm_add_16x4_dct_identity_1_8bpc_rvv         310.2   288.4   -7.03%
inv_txfm_add_16x4_dct_identity_2_8bpc_rvv         310.3   288.5   -7.03%
inv_txfm_add_16x4_flipadst_adst_0_8bpc_rvv        434.1   391.5   -9.81%
inv_txfm_add_16x4_flipadst_adst_1_8bpc_rvv        434.1   392.0   -9.70%
inv_txfm_add_16x4_flipadst_adst_2_8bpc_rvv        434.1   392.0   -9.70%
inv_txfm_add_16x4_flipadst_dct_0_8bpc_rvv         423.5   375.5  -11.33%
inv_txfm_add_16x4_flipadst_dct_1_8bpc_rvv         423.5   375.4  -11.36%
inv_txfm_add_16x4_flipadst_dct_2_8bpc_rvv         423.5   375.5  -11.33%
inv_txfm_add_16x4_flipadst_flipadst_0_8bpc_rvv    438.0   396.1   -9.57%
inv_txfm_add_16x4_flipadst_flipadst_1_8bpc_rvv    438.1   396.0   -9.61%
inv_txfm_add_16x4_flipadst_flipadst_2_8bpc_rvv    438.0   395.8   -9.63%
inv_txfm_add_16x4_flipadst_identity_0_8bpc_rvv    361.9   333.0   -7.99%
inv_txfm_add_16x4_flipadst_identity_1_8bpc_rvv    362.4   333.0   -8.11%
inv_txfm_add_16x4_flipadst_identity_2_8bpc_rvv    362.4   333.0   -8.11%
inv_txfm_add_16x4_identity_adst_0_8bpc_rvv        308.3   296.3   -3.89%
inv_txfm_add_16x4_identity_adst_1_8bpc_rvv        308.4   296.4   -3.89%
inv_txfm_add_16x4_identity_adst_2_8bpc_rvv        308.4   296.4   -3.89%
inv_txfm_add_16x4_identity_dct_0_8bpc_rvv         289.9   279.9   -3.45%
inv_txfm_add_16x4_identity_dct_1_8bpc_rvv         289.9   280.0   -3.41%
inv_txfm_add_16x4_identity_dct_2_8bpc_rvv         290.0   279.9   -3.48%
inv_txfm_add_16x4_identity_flipadst_0_8bpc_rvv    311.2   298.9   -3.95%
inv_txfm_add_16x4_identity_flipadst_1_8bpc_rvv    311.1   298.9   -3.92%
inv_txfm_add_16x4_identity_flipadst_2_8bpc_rvv    310.9   298.9   -3.86%
inv_txfm_add_16x4_identity_identity_0_8bpc_rvv    238.4   243.2    2.01%
inv_txfm_add_16x4_identity_identity_1_8bpc_rvv    238.4   243.2    2.01%
inv_txfm_add_16x4_identity_identity_2_8bpc_rvv    238.5   243.2    1.97%

inv_txfm_add_8x16_adst_adst_0_8bpc_rvv            701.5   624.2  -11.02%
inv_txfm_add_8x16_adst_adst_1_8bpc_rvv            701.6   624.2  -11.03%
inv_txfm_add_8x16_adst_adst_2_8bpc_rvv            853.5   755.2  -11.52%
inv_txfm_add_8x16_adst_dct_0_8bpc_rvv             611.1   551.6   -9.74%
inv_txfm_add_8x16_adst_dct_1_8bpc_rvv             611.2   551.7   -9.73%
inv_txfm_add_8x16_adst_dct_2_8bpc_rvv             765.0   682.8  -10.75%
inv_txfm_add_8x16_adst_flipadst_0_8bpc_rvv        703.4   629.3  -10.53%
inv_txfm_add_8x16_adst_flipadst_1_8bpc_rvv        703.4   629.5  -10.51%
inv_txfm_add_8x16_adst_flipadst_2_8bpc_rvv        858.1   763.9  -10.98%
inv_txfm_add_8x16_adst_identity_0_8bpc_rvv        463.7   440.2   -5.07%
inv_txfm_add_8x16_adst_identity_1_8bpc_rvv        464.3   440.2   -5.19%
inv_txfm_add_8x16_adst_identity_2_8bpc_rvv        618.6   571.7   -7.58%
inv_txfm_add_8x16_dct_adst_0_8bpc_rvv             660.3   590.5  -10.57%
inv_txfm_add_8x16_dct_adst_1_8bpc_rvv             660.2   590.3  -10.59%
inv_txfm_add_8x16_dct_adst_2_8bpc_rvv             776.2   687.9  -11.38%
inv_txfm_add_8x16_dct_dct_0_8bpc_rvv              566.9   516.3   -8.93%
inv_txfm_add_8x16_dct_dct_1_8bpc_rvv              567.1   516.4   -8.94%
inv_txfm_add_8x16_dct_dct_2_8bpc_rvv              685.9   616.6  -10.10%
inv_txfm_add_8x16_dct_flipadst_0_8bpc_rvv         663.3   593.5  -10.52%
inv_txfm_add_8x16_dct_flipadst_1_8bpc_rvv         663.2   593.5  -10.51%
inv_txfm_add_8x16_dct_flipadst_2_8bpc_rvv         771.7   690.5  -10.52%
inv_txfm_add_8x16_dct_identity_0_8bpc_rvv         421.3   406.1   -3.61%
inv_txfm_add_8x16_dct_identity_1_8bpc_rvv         421.3   406.1   -3.61%
inv_txfm_add_8x16_dct_identity_2_8bpc_rvv         536.6   503.6   -6.15%
inv_txfm_add_8x16_flipadst_adst_0_8bpc_rvv        703.3   627.1  -10.83%
inv_txfm_add_8x16_flipadst_adst_1_8bpc_rvv        703.4   627.2  -10.83%
inv_txfm_add_8x16_flipadst_adst_2_8bpc_rvv        857.7   763.7  -10.96%
inv_txfm_add_8x16_flipadst_dct_0_8bpc_rvv         613.5   552.8   -9.89%
inv_txfm_add_8x16_flipadst_dct_1_8bpc_rvv         613.4   552.7   -9.90%
inv_txfm_add_8x16_flipadst_dct_2_8bpc_rvv         771.0   693.1  -10.10%
inv_txfm_add_8x16_flipadst_flipadst_0_8bpc_rvv    706.3   631.4  -10.60%
inv_txfm_add_8x16_flipadst_flipadst_1_8bpc_rvv    706.5   631.7  -10.59%
inv_txfm_add_8x16_flipadst_flipadst_2_8bpc_rvv    861.1    76.9  -11.17%
inv_txfm_add_8x16_flipadst_identity_0_8bpc_rvv    467.0   443.0   -5.14%
inv_txfm_add_8x16_flipadst_identity_1_8bpc_rvv    467.0   443.0   -5.14%
inv_txfm_add_8x16_flipadst_identity_2_8bpc_rvv    623.7   575.1   -7.79%
inv_txfm_add_8x16_identity_adst_0_8bpc_rvv        565.6   512.0   -9.48%
inv_txfm_add_8x16_identity_adst_1_8bpc_rvv        565.6   512.9   -9.32%
inv_txfm_add_8x16_identity_adst_2_8bpc_rvv        585.6   532.8   -9.02%
inv_txfm_add_8x16_identity_dct_0_8bpc_rvv         476.4   439.9   -7.66%
inv_txfm_add_8x16_identity_dct_1_8bpc_rvv         476.4   440.0   -7.64%
inv_txfm_add_8x16_identity_dct_2_8bpc_rvv         496.3   459.5   -7.41%
inv_txfm_add_8x16_identity_flipadst_0_8bpc_rvv    570.7   516.4   -9.51%
inv_txfm_add_8x16_identity_flipadst_1_8bpc_rvv    570.6   516.3   -9.52%
inv_txfm_add_8x16_identity_flipadst_2_8bpc_rvv    590.2   540.0   -8.51%
inv_txfm_add_8x16_identity_identity_0_8bpc_rvv    330.9   329.9   -0.30%
inv_txfm_add_8x16_identity_identity_1_8bpc_rvv    330.9   329.9   -0.30%
inv_txfm_add_8x16_identity_identity_2_8bpc_rvv    350.8   349.7   -0.31%

inv_txfm_add_16x8_adst_adst_0_8bpc_rvv            855.5   752.1  -12.09%
inv_txfm_add_16x8_adst_adst_1_8bpc_rvv            855.5   751.9  -12.11%
inv_txfm_add_16x8_adst_adst_2_8bpc_rvv            855.4   752.1  -12.08%
inv_txfm_add_16x8_adst_dct_0_8bpc_rvv             765.4   685.5  -10.44%
inv_txfm_add_16x8_adst_dct_1_8bpc_rvv             765.5   685.3  -10.48%
inv_txfm_add_16x8_adst_dct_2_8bpc_rvv             765.5   685.5  -10.45%
inv_txfm_add_16x8_adst_flipadst_0_8bpc_rvv        859.2   755.8  -12.03%
inv_txfm_add_16x8_adst_flipadst_1_8bpc_rvv        859.1   756.0  -12.00%
inv_txfm_add_16x8_adst_flipadst_2_8bpc_rvv        859.1   755.9  -12.01%
inv_txfm_add_16x8_adst_identity_0_8bpc_rvv        612.8   561.9   -8.31%
inv_txfm_add_16x8_adst_identity_1_8bpc_rvv        612.9   561.9   -8.32%
inv_txfm_add_16x8_adst_identity_2_8bpc_rvv        612.8   561.9   -8.31%
inv_txfm_add_16x8_dct_adst_0_8bpc_rvv             765.1   676.0  -11.65%
inv_txfm_add_16x8_dct_adst_1_8bpc_rvv             765.0   676.2  -11.61%
inv_txfm_add_16x8_dct_adst_2_8bpc_rvv             765.0   676.2  -11.61%
inv_txfm_add_16x8_dct_dct_0_8bpc_rvv              674.5   612.0   -9.27%
inv_txfm_add_16x8_dct_dct_1_8bpc_rvv              674.5   612.1   -9.25%
inv_txfm_add_16x8_dct_dct_2_8bpc_rvv              674.6   612.0   -9.28%
inv_txfm_add_16x8_dct_flipadst_0_8bpc_rvv         777.2   679.9  -12.52%
inv_txfm_add_16x8_dct_flipadst_1_8bpc_rvv         777.1   680.1  -12.48%
inv_txfm_add_16x8_dct_flipadst_2_8bpc_rvv         777.1   680.0  -12.50%
inv_txfm_add_16x8_dct_identity_0_8bpc_rvv         522.2   488.2   -6.51%
inv_txfm_add_16x8_dct_identity_1_8bpc_rvv         522.1   488.2   -6.49%
inv_txfm_add_16x8_dct_identity_2_8bpc_rvv         522.1   487.5   -6.63%
inv_txfm_add_16x8_flipadst_adst_0_8bpc_rvv        859.2   753.5  -12.30%
inv_txfm_add_16x8_flipadst_adst_1_8bpc_rvv        859.2   753.6  -12.29%
inv_txfm_add_16x8_flipadst_adst_2_8bpc_rvv        859.2   753.5  -12.30%
inv_txfm_add_16x8_flipadst_dct_0_8bpc_rvv         768.9   689.0  -10.39%
inv_txfm_add_16x8_flipadst_dct_1_8bpc_rvv         768.9   689.2  -10.37%
inv_txfm_add_16x8_flipadst_dct_2_8bpc_rvv         768.8   689.2  -10.35%
inv_txfm_add_16x8_flipadst_flipadst_0_8bpc_rvv    863.0   758.7  -12.09%
inv_txfm_add_16x8_flipadst_flipadst_1_8bpc_rvv    862.9   758.7  -12.08%
inv_txfm_add_16x8_flipadst_flipadst_2_8bpc_rvv    863.0   758.6  -12.10%
inv_txfm_add_16x8_flipadst_identity_0_8bpc_rvv    616.5   566.7   -8.08%
inv_txfm_add_16x8_flipadst_identity_1_8bpc_rvv    616.6   566.6   -8.11%
inv_txfm_add_16x8_flipadst_identity_2_8bpc_rvv    616.3   567.0   -8.00%
inv_txfm_add_16x8_identity_adst_0_8bpc_rvv        618.1   564.5   -8.67%
inv_txfm_add_16x8_identity_adst_1_8bpc_rvv        618.0   564.5   -8.66%
inv_txfm_add_16x8_identity_adst_2_8bpc_rvv        617.7   564.6   -8.60%
inv_txfm_add_16x8_identity_dct_0_8bpc_rvv         527.9   500.6   -5.17%
inv_txfm_add_16x8_identity_dct_1_8bpc_rvv         527.8   500.7   -5.13%
inv_txfm_add_16x8_identity_dct_2_8bpc_rvv         527.7   500.7   -5.12%
inv_txfm_add_16x8_identity_flipadst_0_8bpc_rvv    622.3   568.5   -8.65%
inv_txfm_add_16x8_identity_flipadst_1_8bpc_rvv    622.2   568.5   -8.63%
inv_txfm_add_16x8_identity_flipadst_2_8bpc_rvv    622.3   568.4   -8.66%
inv_txfm_add_16x8_identity_identity_0_8bpc_rvv    373.4   374.4    0.27%
inv_txfm_add_16x8_identity_identity_1_8bpc_rvv    373.4   374.5    0.29%
inv_txfm_add_16x8_identity_identity_2_8bpc_rvv    373.4   374.4    0.27%

SpacemiT K1                                        Old     New     Delta

inv_txfm_add_4x4_adst_adst_0_8bpc_rvv             101.0    96.8   -4.16%
inv_txfm_add_4x4_adst_adst_1_8bpc_rvv             101.1    96.8   -4.25%
inv_txfm_add_4x4_adst_dct_0_8bpc_rvv               96.8    91.7   -5.27%
inv_txfm_add_4x4_adst_dct_1_8bpc_rvv               95.9    91.8   -4.28%
inv_txfm_add_4x4_adst_flipadst_0_8bpc_rvv         102.2    97.9   -4.21%
inv_txfm_add_4x4_adst_flipadst_1_8bpc_rvv         102.2    97.9   -4.21%
inv_txfm_add_4x4_adst_identity_0_8bpc_rvv          82.4    80.4   -2.43%
inv_txfm_add_4x4_adst_identity_1_8bpc_rvv          82.4    80.5   -2.31%
inv_txfm_add_4x4_dct_adst_0_8bpc_rvv               97.3    92.6   -4.83%
inv_txfm_add_4x4_dct_adst_1_8bpc_rvv               97.2    92.3   -5.04%
inv_txfm_add_4x4_dct_dct_0_8bpc_rvv                41.2    41.3    0.24%
inv_txfm_add_4x4_dct_dct_1_8bpc_rvv                96.0    87.5   -8.85%
inv_txfm_add_4x4_dct_flipadst_0_8bpc_rvv           98.5    94.5   -4.06%
inv_txfm_add_4x4_dct_flipadst_1_8bpc_rvv           98.6    94.7   -3.96%
inv_txfm_add_4x4_dct_identity_0_8bpc_rvv           78.6    76.1   -3.18%
inv_txfm_add_4x4_dct_identity_1_8bpc_rvv           78.6    76.0   -3.31%
inv_txfm_add_4x4_flipadst_adst_0_8bpc_rvv         104.3    99.1   -4.99%
inv_txfm_add_4x4_flipadst_adst_1_8bpc_rvv         104.4    99.1   -5.08%
inv_txfm_add_4x4_flipadst_dct_0_8bpc_rvv           98.0    94.6   -3.47%
inv_txfm_add_4x4_flipadst_dct_1_8bpc_rvv           98.1    94.4   -3.77%
inv_txfm_add_4x4_flipadst_flipadst_0_8bpc_rvv     104.2    99.2   -4.80%
inv_txfm_add_4x4_flipadst_flipadst_1_8bpc_rvv     104.3    99.2   -4.89%
inv_txfm_add_4x4_flipadst_identity_0_8bpc_rvv      86.9    81.8   -5.87%
inv_txfm_add_4x4_flipadst_identity_1_8bpc_rvv      87.0    81.9   -5.86%
inv_txfm_add_4x4_identity_adst_0_8bpc_rvv          86.0    80.8   -6.05%
inv_txfm_add_4x4_identity_adst_1_8bpc_rvv          85.9    81.4   -5.24%
inv_txfm_add_4x4_identity_dct_0_8bpc_rvv           78.5    76.1   -3.06%
inv_txfm_add_4x4_identity_dct_1_8bpc_rvv           78.6    76.1   -3.18%
inv_txfm_add_4x4_identity_flipadst_0_8bpc_rvv      85.9    82.5   -3.96%
inv_txfm_add_4x4_identity_flipadst_1_8bpc_rvv      85.9    82.3   -4.19%
inv_txfm_add_4x4_identity_identity_0_8bpc_rvv      65.9    64.9   -1.52%
inv_txfm_add_4x4_identity_identity_1_8bpc_rvv      65.9    64.8   -1.67%
inv_txfm_add_4x4_wht_wht_0_8bpc_rvv                71.2    71.3    0.14%
inv_txfm_add_4x4_wht_wht_1_8bpc_rvv                71.2    71.3    0.14%

inv_txfm_add_8x8_adst_adst_0_8bpc_rvv             440.6   399.3   -9.37%
inv_txfm_add_8x8_adst_adst_1_8bpc_rvv             440.6   399.3   -9.37%
inv_txfm_add_8x8_adst_dct_0_8bpc_rvv              401.7   368.4   -8.29%
inv_txfm_add_8x8_adst_dct_1_8bpc_rvv              401.8   368.4   -8.31%
inv_txfm_add_8x8_adst_flipadst_0_8bpc_rvv         442.4   401.2   -9.31%
inv_txfm_add_8x8_adst_flipadst_1_8bpc_rvv         442.4   401.1   -9.34%
inv_txfm_add_8x8_adst_identity_0_8bpc_rvv         329.7   310.1   -5.94%
inv_txfm_add_8x8_adst_identity_1_8bpc_rvv         329.7   310.1   -5.94%
inv_txfm_add_8x8_dct_adst_0_8bpc_rvv              401.8   367.4   -8.56%
inv_txfm_add_8x8_dct_adst_1_8bpc_rvv              401.7   367.3   -8.56%
inv_txfm_add_8x8_dct_dct_0_8bpc_rvv                79.5    80.2    0.88%
inv_txfm_add_8x8_dct_dct_1_8bpc_rvv               362.1   335.8   -7.26%
inv_txfm_add_8x8_dct_flipadst_0_8bpc_rvv          405.0   369.2   -8.84%
inv_txfm_add_8x8_dct_flipadst_1_8bpc_rvv          405.1   369.2   -8.86%
inv_txfm_add_8x8_dct_identity_0_8bpc_rvv          290.9   278.2   -4.37%
inv_txfm_add_8x8_dct_identity_1_8bpc_rvv          290.8   278.2   -4.33%
inv_txfm_add_8x8_flipadst_adst_0_8bpc_rvv         442.5   401.1   -9.36%
inv_txfm_add_8x8_flipadst_adst_1_8bpc_rvv         442.5   401.2   -9.33%
inv_txfm_add_8x8_flipadst_dct_0_8bpc_rvv          405.8   369.2   -9.02%
inv_txfm_add_8x8_flipadst_dct_1_8bpc_rvv          405.8   369.1   -9.04%
inv_txfm_add_8x8_flipadst_flipadst_0_8bpc_rvv     444.3   403.0   -9.30%
inv_txfm_add_8x8_flipadst_flipadst_1_8bpc_rvv     444.3   403.1   -9.27%
inv_txfm_add_8x8_flipadst_identity_0_8bpc_rvv     331.6   310.9   -6.24%
inv_txfm_add_8x8_flipadst_identity_1_8bpc_rvv     331.6   310.9   -6.24%
inv_txfm_add_8x8_identity_adst_0_8bpc_rvv         313.3   292.6   -6.61%
inv_txfm_add_8x8_identity_adst_1_8bpc_rvv         313.1   292.6   -6.55%
inv_txfm_add_8x8_identity_dct_0_8bpc_rvv          274.5   260.6   -5.06%
inv_txfm_add_8x8_identity_dct_1_8bpc_rvv          274.4   260.7   -4.99%
inv_txfm_add_8x8_identity_flipadst_0_8bpc_rvv     315.3   294.4   -6.63%
inv_txfm_add_8x8_identity_flipadst_1_8bpc_rvv     315.3   294.4   -6.63%
inv_txfm_add_8x8_identity_identity_0_8bpc_rvv     202.5   202.5    0.00%
inv_txfm_add_8x8_identity_identity_1_8bpc_rvv     202.6   202.5   -0.05%

inv_txfm_add_16x16_adst_adst_0_8bpc_rvv          1418.8  1268.2  -10.61%
inv_txfm_add_16x16_adst_adst_1_8bpc_rvv          1418.9  1268.3  -10.61%
inv_txfm_add_16x16_adst_adst_2_8bpc_rvv          1943.3  1733.6  -10.79%
inv_txfm_add_16x16_adst_dct_0_8bpc_rvv           1241.7  1134.6   -8.63%
inv_txfm_add_16x16_adst_dct_1_8bpc_rvv           1241.5  1134.5   -8.62%
inv_txfm_add_16x16_adst_dct_2_8bpc_rvv           1772.5  1599.8   -9.74%
inv_txfm_add_16x16_adst_flipadst_0_8bpc_rvv      1429.8  1270.3  -11.16%
inv_txfm_add_16x16_adst_flipadst_1_8bpc_rvv      1429.7  1270.1  -11.16%
inv_txfm_add_16x16_adst_flipadst_2_8bpc_rvv      1951.1  1741.4  -10.75%
inv_txfm_add_16x16_dct_adst_0_8bpc_rvv           1337.8  1195.8  -10.61%
inv_txfm_add_16x16_dct_adst_1_8bpc_rvv           1337.5  1196.0  -10.58%
inv_txfm_add_16x16_dct_adst_2_8bpc_rvv           1763.2  1604.6   -9.00%
inv_txfm_add_16x16_dct_dct_0_8bpc_rvv             179.3   181.1    1.00%
inv_txfm_add_16x16_dct_dct_1_8bpc_rvv            1153.8  1060.7   -8.07%
inv_txfm_add_16x16_dct_dct_2_8bpc_rvv            1601.6  1470.6   -8.18%
inv_txfm_add_16x16_dct_flipadst_0_8bpc_rvv       1340.7  1199.8  -10.51%
inv_txfm_add_16x16_dct_flipadst_1_8bpc_rvv       1340.4  1199.8  -10.49%
inv_txfm_add_16x16_dct_flipadst_2_8bpc_rvv       1771.2  1606.6   -9.29%
inv_txfm_add_16x16_dct_identity_0_8bpc_rvv        877.9   854.9   -2.62%
inv_txfm_add_16x16_dct_identity_1_8bpc_rvv        877.7   855.2   -2.56%
inv_txfm_add_16x16_dct_identity_2_8bpc_rvv       1311.6  1254.1   -4.38%
inv_txfm_add_16x16_flipadst_adst_0_8bpc_rvv      1428.2  1270.5  -11.04%
inv_txfm_add_16x16_flipadst_adst_1_8bpc_rvv      1428.3  1270.6  -11.04%
inv_txfm_add_16x16_flipadst_adst_2_8bpc_rvv      1947.3  1737.3  -10.78%
inv_txfm_add_16x16_flipadst_dct_0_8bpc_rvv       1245.8  1133.5   -9.01%
inv_txfm_add_16x16_flipadst_dct_1_8bpc_rvv       1246.0  1133.7   -9.01%
inv_txfm_add_16x16_flipadst_dct_2_8bpc_rvv       1769.9  1603.9   -9.38%
inv_txfm_add_16x16_flipadst_flipadst_0_8bpc_rvv  1428.7  1279.7  -10.43%
inv_txfm_add_16x16_flipadst_flipadst_1_8bpc_rvv  1428.8  1279.5  -10.45%
inv_txfm_add_16x16_flipadst_flipadst_2_8bpc_rvv  1960.8  1745.8  -10.96%
inv_txfm_add_16x16_identity_dct_0_8bpc_rvv       1016.6   948.8   -6.67%
inv_txfm_add_16x16_identity_dct_1_8bpc_rvv       1016.7   948.8   -6.68%
inv_txfm_add_16x16_identity_dct_2_8bpc_rvv       1319.8  1247.7   -5.46%
inv_txfm_add_16x16_identity_identity_0_8bpc_rvv   735.4   736.6    0.16%
inv_txfm_add_16x16_identity_identity_1_8bpc_rvv   735.3   736.4    0.15%
inv_txfm_add_16x16_identity_identity_2_8bpc_rvv  1037.8  1036.7   -0.11%

inv_txfm_add_4x8_adst_adst_0_8bpc_rvv             197.2   179.9   -8.77%
inv_txfm_add_4x8_adst_adst_1_8bpc_rvv             197.1   180.0   -8.68%
inv_txfm_add_4x8_adst_dct_0_8bpc_rvv              177.5   164.2   -7.49%
inv_txfm_add_4x8_adst_dct_1_8bpc_rvv              177.5   164.3   -7.44%
inv_txfm_add_4x8_adst_flipadst_0_8bpc_rvv         199.3   181.8   -8.78%
inv_txfm_add_4x8_adst_flipadst_1_8bpc_rvv         199.0   181.8   -8.64%
inv_txfm_add_4x8_adst_identity_0_8bpc_rvv         126.7   121.8   -3.87%
inv_txfm_add_4x8_adst_identity_1_8bpc_rvv         126.7   121.9   -3.79%
inv_txfm_add_4x8_dct_adst_0_8bpc_rvv              189.8   172.4   -9.17%
inv_txfm_add_4x8_dct_adst_1_8bpc_rvv              189.8   172.4   -9.17%
inv_txfm_add_4x8_dct_dct_0_8bpc_rvv               170.2   156.8   -7.87%
inv_txfm_add_4x8_dct_dct_1_8bpc_rvv               170.2   156.9   -7.81%
inv_txfm_add_4x8_dct_flipadst_0_8bpc_rvv          192.6   174.2   -9.55%
inv_txfm_add_4x8_dct_flipadst_1_8bpc_rvv          192.6   174.2   -9.55%
inv_txfm_add_4x8_dct_identity_0_8bpc_rvv          119.4   114.3   -4.27%
inv_txfm_add_4x8_dct_identity_1_8bpc_rvv          119.6   114.2   -4.52%
inv_txfm_add_4x8_flipadst_adst_0_8bpc_rvv         197.7   180.5   -8.70%
inv_txfm_add_4x8_flipadst_adst_1_8bpc_rvv         197.8   180.6   -8.70%
inv_txfm_add_4x8_flipadst_dct_0_8bpc_rvv          178.3   165.0   -7.46%
inv_txfm_add_4x8_flipadst_dct_1_8bpc_rvv          178.3   164.9   -7.52%
inv_txfm_add_4x8_flipadst_flipadst_0_8bpc_rvv     199.7   182.5   -8.61%
inv_txfm_add_4x8_flipadst_flipadst_1_8bpc_rvv     200.0   182.4   -8.80%
inv_txfm_add_4x8_flipadst_identity_0_8bpc_rvv     127.2   122.3   -3.85%
inv_txfm_add_4x8_flipadst_identity_1_8bpc_rvv     127.3   122.5   -3.77%
inv_txfm_add_4x8_identity_adst_0_8bpc_rvv         172.1   155.0   -9.94%
inv_txfm_add_4x8_identity_adst_1_8bpc_rvv         172.1   155.0   -9.94%
inv_txfm_add_4x8_identity_dct_0_8bpc_rvv          148.7   139.4   -6.25%
inv_txfm_add_4x8_identity_dct_1_8bpc_rvv          148.7   139.5   -6.19%
inv_txfm_add_4x8_identity_flipadst_0_8bpc_rvv     171.7   156.8   -8.68%
inv_txfm_add_4x8_identity_flipadst_1_8bpc_rvv     171.6   156.9   -8.57%
inv_txfm_add_4x8_identity_identity_0_8bpc_rvv      96.8    96.8    0.00%
inv_txfm_add_4x8_identity_identity_1_8bpc_rvv      96.7    96.7    0.00%

inv_txfm_add_8x4_adst_adst_0_8bpc_rvv             228.1   220.0   -3.55%
inv_txfm_add_8x4_adst_adst_1_8bpc_rvv             227.9   219.9   -3.51%
inv_txfm_add_8x4_adst_dct_0_8bpc_rvv              219.4   206.4   -5.93%
inv_txfm_add_8x4_adst_dct_1_8bpc_rvv              219.4   206.4   -5.93%
inv_txfm_add_8x4_adst_flipadst_0_8bpc_rvv         229.4   214.7   -6.41%
inv_txfm_add_8x4_adst_flipadst_1_8bpc_rvv         229.4   214.8   -6.36%
inv_txfm_add_8x4_adst_identity_0_8bpc_rvv         195.6   187.6   -4.09%
inv_txfm_add_8x4_adst_identity_1_8bpc_rvv         195.8   187.6   -4.19%
inv_txfm_add_8x4_dct_adst_0_8bpc_rvv              207.0   195.2   -5.70%
inv_txfm_add_8x4_dct_adst_1_8bpc_rvv              206.9   195.2   -5.65%
inv_txfm_add_8x4_dct_dct_0_8bpc_rvv               199.4   188.2   -5.62%
inv_txfm_add_8x4_dct_dct_1_8bpc_rvv               199.4   188.5   -5.47%
inv_txfm_add_8x4_dct_flipadst_0_8bpc_rvv          209.5   196.5   -6.21%
inv_txfm_add_8x4_dct_flipadst_1_8bpc_rvv          209.7   196.6   -6.25%
inv_txfm_add_8x4_dct_identity_0_8bpc_rvv          175.7   169.5   -3.53%
inv_txfm_add_8x4_dct_identity_1_8bpc_rvv          175.9   169.6   -3.58%
inv_txfm_add_8x4_flipadst_adst_0_8bpc_rvv         229.0   214.7   -6.24%
inv_txfm_add_8x4_flipadst_adst_1_8bpc_rvv         229.3   214.5   -6.45%
inv_txfm_add_8x4_flipadst_dct_0_8bpc_rvv          220.9   206.7   -6.43%
inv_txfm_add_8x4_flipadst_dct_1_8bpc_rvv          220.6   206.5   -6.39%
inv_txfm_add_8x4_flipadst_flipadst_0_8bpc_rvv     230.6   215.9   -6.37%
inv_txfm_add_8x4_flipadst_flipadst_1_8bpc_rvv     230.7   215.9   -6.42%
inv_txfm_add_8x4_flipadst_identity_0_8bpc_rvv     196.9   188.9   -4.06%
inv_txfm_add_8x4_flipadst_identity_1_8bpc_rvv     196.9   188.9   -4.06%
inv_txfm_add_8x4_identity_adst_0_8bpc_rvv         157.6   154.7   -1.84%
inv_txfm_add_8x4_identity_adst_1_8bpc_rvv         157.5   154.9   -1.65%
inv_txfm_add_8x4_identity_dct_0_8bpc_rvv          150.0   147.9   -1.40%
inv_txfm_add_8x4_identity_dct_1_8bpc_rvv          150.0   147.7   -1.53%
inv_txfm_add_8x4_identity_flipadst_0_8bpc_rvv     159.6   155.9   -2.32%
inv_txfm_add_8x4_identity_flipadst_1_8bpc_rvv     159.8   155.6   -2.63%
inv_txfm_add_8x4_identity_identity_0_8bpc_rvv     128.6   128.8    0.16%
inv_txfm_add_8x4_identity_identity_1_8bpc_rvv     128.4   129.3    0.70%

inv_txfm_add_4x16_adst_adst_0_8bpc_rvv            373.8   335.9  -10.14%
inv_txfm_add_4x16_adst_adst_1_8bpc_rvv            373.8   335.7  -10.19%
inv_txfm_add_4x16_adst_adst_2_8bpc_rvv            417.4   380.0   -8.96%
inv_txfm_add_4x16_adst_dct_0_8bpc_rvv             328.3   301.7   -8.10%
inv_txfm_add_4x16_adst_dct_1_8bpc_rvv             328.0   302.0   -7.93%
inv_txfm_add_4x16_adst_dct_2_8bpc_rvv             374.3   351.3   -6.14%
inv_txfm_add_4x16_adst_flipadst_0_8bpc_rvv        374.5   339.8   -9.27%
inv_txfm_add_4x16_adst_flipadst_1_8bpc_rvv        374.3   339.4   -9.32%
inv_txfm_add_4x16_adst_flipadst_2_8bpc_rvv        422.0   383.8   -9.05%
inv_txfm_add_4x16_adst_identity_0_8bpc_rvv        248.0   242.9   -2.06%
inv_txfm_add_4x16_adst_identity_1_8bpc_rvv        248.0   242.2   -2.34%
inv_txfm_add_4x16_adst_identity_2_8bpc_rvv        298.6   290.3   -2.78%
inv_txfm_add_4x16_dct_adst_0_8bpc_rvv             370.5   329.4  -11.09%
inv_txfm_add_4x16_dct_adst_1_8bpc_rvv             370.8   329.0  -11.27%
inv_txfm_add_4x16_dct_adst_2_8bpc_rvv             409.1   360.9  -11.78%
inv_txfm_add_4x16_dct_dct_0_8bpc_rvv              321.1   293.7   -8.53%
inv_txfm_add_4x16_dct_dct_1_8bpc_rvv              321.0   294.3   -8.32%
inv_txfm_add_4x16_dct_dct_2_8bpc_rvv              357.8   329.8   -7.83%
inv_txfm_add_4x16_dct_flipadst_0_8bpc_rvv         369.7   332.9   -9.95%
inv_txfm_add_4x16_dct_flipadst_1_8bpc_rvv         370.4   333.0  -10.10%
inv_txfm_add_4x16_dct_flipadst_2_8bpc_rvv         405.5   364.9  -10.01%
inv_txfm_add_4x16_dct_identity_0_8bpc_rvv         241.6   236.6   -2.07%
inv_txfm_add_4x16_dct_identity_1_8bpc_rvv         241.8   235.6   -2.56%
inv_txfm_add_4x16_dct_identity_2_8bpc_rvv         281.9   266.9   -5.32%
inv_txfm_add_4x16_flipadst_adst_0_8bpc_rvv        371.9   337.3   -9.30%
inv_txfm_add_4x16_flipadst_adst_1_8bpc_rvv        372.2   337.1   -9.43%
inv_txfm_add_4x16_flipadst_adst_2_8bpc_rvv        419.8   381.5   -9.12%
inv_txfm_add_4x16_flipadst_dct_0_8bpc_rvv         328.3   302.9   -7.74%
inv_txfm_add_4x16_flipadst_dct_1_8bpc_rvv         328.4   303.3   -7.64%
inv_txfm_add_4x16_flipadst_dct_2_8bpc_rvv         380.6   343.7   -9.70%
inv_txfm_add_4x16_flipadst_flipadst_0_8bpc_rvv    377.7   341.1   -9.69%
inv_txfm_add_4x16_flipadst_flipadst_1_8bpc_rvv    377.6   341.5   -9.56%
inv_txfm_add_4x16_flipadst_flipadst_2_8bpc_rvv    423.6   386.7   -8.71%
inv_txfm_add_4x16_flipadst_identity_0_8bpc_rvv    250.0   245.7   -1.72%
inv_txfm_add_4x16_flipadst_identity_1_8bpc_rvv    249.3   246.0   -1.32%
inv_txfm_add_4x16_flipadst_identity_2_8bpc_rvv    296.4   284.7   -3.95%
inv_txfm_add_4x16_identity_adst_0_8bpc_rvv        343.0   311.2   -9.27%
inv_txfm_add_4x16_identity_adst_1_8bpc_rvv        342.9   311.0   -9.30%
inv_txfm_add_4x16_identity_adst_2_8bpc_rvv        354.8   325.0   -8.40%
inv_txfm_add_4x16_identity_dct_0_8bpc_rvv         298.9   274.9   -8.03%
inv_txfm_add_4x16_identity_dct_1_8bpc_rvv         298.8   275.0   -7.97%
inv_txfm_add_4x16_identity_dct_2_8bpc_rvv         310.3   289.1   -6.83%
inv_txfm_add_4x16_identity_flipadst_0_8bpc_rvv    344.7   314.9   -8.65%
inv_txfm_add_4x16_identity_flipadst_1_8bpc_rvv    344.5   314.8   -8.62%
inv_txfm_add_4x16_identity_flipadst_2_8bpc_rvv    358.3   328.6   -8.29%
inv_txfm_add_4x16_identity_identity_0_8bpc_rvv    219.6   216.1   -1.59%
inv_txfm_add_4x16_identity_identity_1_8bpc_rvv    218.3   216.3   -0.92%
inv_txfm_add_4x16_identity_identity_2_8bpc_rvv    231.3   229.6   -0.73%

inv_txfm_add_16x4_adst_adst_0_8bpc_rvv            468.5   428.8   -8.47%
inv_txfm_add_16x4_adst_adst_1_8bpc_rvv            468.5   428.9   -8.45%
inv_txfm_add_16x4_adst_adst_2_8bpc_rvv            468.5   428.9   -8.45%
inv_txfm_add_16x4_adst_dct_0_8bpc_rvv             453.8   414.5   -8.66%
inv_txfm_add_16x4_adst_dct_1_8bpc_rvv             453.8   414.5   -8.66%
inv_txfm_add_16x4_adst_dct_2_8bpc_rvv             453.9   414.4   -8.70%
inv_txfm_add_16x4_adst_flipadst_0_8bpc_rvv        471.0   431.5   -8.39%
inv_txfm_add_16x4_adst_flipadst_1_8bpc_rvv        471.0   431.3   -8.43%
inv_txfm_add_16x4_adst_flipadst_2_8bpc_rvv        471.0   431.5   -8.39%
inv_txfm_add_16x4_adst_identity_0_8bpc_rvv        402.2   375.0   -6.76%
inv_txfm_add_16x4_adst_identity_1_8bpc_rvv        402.1   375.0   -6.74%
inv_txfm_add_16x4_adst_identity_2_8bpc_rvv        402.0   375.3   -6.64%
inv_txfm_add_16x4_dct_adst_0_8bpc_rvv             432.8   392.5   -9.31%
inv_txfm_add_16x4_dct_adst_1_8bpc_rvv             432.8   392.5   -9.31%
inv_txfm_add_16x4_dct_adst_2_8bpc_rvv             432.8   392.5   -9.31%
inv_txfm_add_16x4_dct_dct_0_8bpc_rvv              407.9   378.3   -7.26%
inv_txfm_add_16x4_dct_dct_1_8bpc_rvv              407.8   378.1   -7.28%
inv_txfm_add_16x4_dct_dct_2_8bpc_rvv              407.8   378.1   -7.28%
inv_txfm_add_16x4_dct_flipadst_0_8bpc_rvv         426.0   395.1   -7.25%
inv_txfm_add_16x4_dct_flipadst_1_8bpc_rvv         425.9   395.0   -7.26%
inv_txfm_add_16x4_dct_flipadst_2_8bpc_rvv         426.0   395.1   -7.25%
inv_txfm_add_16x4_dct_identity_0_8bpc_rvv         357.1   338.7   -5.15%
inv_txfm_add_16x4_dct_identity_1_8bpc_rvv         357.1   338.7   -5.15%
inv_txfm_add_16x4_dct_identity_2_8bpc_rvv         357.2   338.7   -5.18%
inv_txfm_add_16x4_flipadst_adst_0_8bpc_rvv        472.4   432.6   -8.43%
inv_txfm_add_16x4_flipadst_adst_1_8bpc_rvv        472.2   432.6   -8.39%
inv_txfm_add_16x4_flipadst_adst_2_8bpc_rvv        472.3   432.7   -8.38%
inv_txfm_add_16x4_flipadst_dct_0_8bpc_rvv         464.3   418.2   -9.93%
inv_txfm_add_16x4_flipadst_dct_1_8bpc_rvv         464.2   418.2   -9.91%
inv_txfm_add_16x4_flipadst_dct_2_8bpc_rvv         464.2   418.2   -9.91%
inv_txfm_add_16x4_flipadst_flipadst_0_8bpc_rvv    474.7   435.1   -8.34%
inv_txfm_add_16x4_flipadst_flipadst_1_8bpc_rvv    474.8   435.1   -8.36%
inv_txfm_add_16x4_flipadst_flipadst_2_8bpc_rvv    474.7   435.1   -8.34%
inv_txfm_add_16x4_flipadst_identity_0_8bpc_rvv    405.9   378.8   -6.68%
inv_txfm_add_16x4_flipadst_identity_1_8bpc_rvv    406.0   378.8   -6.70%
inv_txfm_add_16x4_flipadst_identity_2_8bpc_rvv    406.0   378.8   -6.70%
inv_txfm_add_16x4_identity_adst_0_8bpc_rvv        353.7   342.2   -3.25%
inv_txfm_add_16x4_identity_adst_1_8bpc_rvv        353.8   342.3   -3.25%
inv_txfm_add_16x4_identity_adst_2_8bpc_rvv        353.7   342.4   -3.19%
inv_txfm_add_16x4_identity_dct_0_8bpc_rvv         338.1   327.9   -3.02%
inv_txfm_add_16x4_identity_dct_1_8bpc_rvv         338.1   327.9   -3.02%
inv_txfm_add_16x4_identity_dct_2_8bpc_rvv         338.2   327.9   -3.05%
inv_txfm_add_16x4_identity_flipadst_0_8bpc_rvv    357.5   344.8   -3.55%
inv_txfm_add_16x4_identity_flipadst_1_8bpc_rvv    357.5   344.9   -3.52%
inv_txfm_add_16x4_identity_flipadst_2_8bpc_rvv    357.5   344.7   -3.58%
inv_txfm_add_16x4_identity_identity_0_8bpc_rvv    287.1   297.0    3.45%
inv_txfm_add_16x4_identity_identity_1_8bpc_rvv    287.2   297.0    3.41%
inv_txfm_add_16x4_identity_identity_2_8bpc_rvv    287.2   297.0    3.41%

inv_txfm_add_8x16_adst_adst_0_8bpc_rvv            774.3   704.8   -8.98%
inv_txfm_add_8x16_adst_adst_1_8bpc_rvv            774.4   704.8   -8.99%
inv_txfm_add_8x16_adst_adst_2_8bpc_rvv            929.5   839.9   -9.64%
inv_txfm_add_8x16_adst_dct_0_8bpc_rvv             687.9   634.9   -7.70%
inv_txfm_add_8x16_adst_dct_1_8bpc_rvv             688.0   634.8   -7.73%
inv_txfm_add_8x16_adst_dct_2_8bpc_rvv             845.5   768.4   -9.12%
inv_txfm_add_8x16_adst_flipadst_0_8bpc_rvv        779.5   708.5   -9.11%
inv_txfm_add_8x16_adst_flipadst_1_8bpc_rvv        779.5   708.5   -9.11%
inv_txfm_add_8x16_adst_flipadst_2_8bpc_rvv        933.3   849.9   -8.94%
inv_txfm_add_8x16_adst_identity_0_8bpc_rvv        546.5   529.0   -3.20%
inv_txfm_add_8x16_adst_identity_1_8bpc_rvv        546.5   529.0   -3.20%
inv_txfm_add_8x16_adst_identity_2_8bpc_rvv        702.5   664.1   -5.47%
inv_txfm_add_8x16_dct_adst_0_8bpc_rvv             739.9   672.7   -9.08%
inv_txfm_add_8x16_dct_adst_1_8bpc_rvv             739.9   672.7   -9.08%
inv_txfm_add_8x16_dct_adst_2_8bpc_rvv             863.1   776.1  -10.08%
inv_txfm_add_8x16_dct_dct_0_8bpc_rvv              651.2   601.9   -7.57%
inv_txfm_add_8x16_dct_dct_1_8bpc_rvv              651.2   601.8   -7.59%
inv_txfm_add_8x16_dct_dct_2_8bpc_rvv              777.6   706.5   -9.14%
inv_txfm_add_8x16_dct_flipadst_0_8bpc_rvv         742.4   678.9   -8.55%
inv_txfm_add_8x16_dct_flipadst_1_8bpc_rvv         742.5   678.9   -8.57%
inv_txfm_add_8x16_dct_flipadst_2_8bpc_rvv         858.8   779.3   -9.26%
inv_txfm_add_8x16_dct_identity_0_8bpc_rvv         510.8   496.4   -2.82%
inv_txfm_add_8x16_dct_identity_1_8bpc_rvv         510.6   496.5   -2.76%
inv_txfm_add_8x16_dct_identity_2_8bpc_rvv         630.0   599.7   -4.81%
inv_txfm_add_8x16_flipadst_adst_0_8bpc_rvv        778.3   707.2   -9.14%
inv_txfm_add_8x16_flipadst_adst_1_8bpc_rvv        778.3   707.1   -9.15%
inv_txfm_add_8x16_flipadst_adst_2_8bpc_rvv        934.4   843.5   -9.73%
inv_txfm_add_8x16_flipadst_dct_0_8bpc_rvv         689.3   634.7   -7.92%
inv_txfm_add_8x16_flipadst_dct_1_8bpc_rvv         689.2   634.8   -7.89%
inv_txfm_add_8x16_flipadst_dct_2_8bpc_rvv         845.8   774.4   -8.44%
inv_txfm_add_8x16_flipadst_flipadst_0_8bpc_rvv    779.9   710.5   -8.90%
inv_txfm_add_8x16_flipadst_flipadst_1_8bpc_rvv    780.0   710.4   -8.92%
inv_txfm_add_8x16_flipadst_flipadst_2_8bpc_rvv    936.4   848.1   -9.43%
inv_txfm_add_8x16_flipadst_identity_0_8bpc_rvv    550.4   531.3   -3.47%
inv_txfm_add_8x16_flipadst_identity_1_8bpc_rvv    550.4   531.3   -3.47%
inv_txfm_add_8x16_flipadst_identity_2_8bpc_rvv    705.3   669.4   -5.09%
inv_txfm_add_8x16_identity_adst_0_8bpc_rvv        649.0   599.7   -7.60%
inv_txfm_add_8x16_identity_adst_1_8bpc_rvv        649.0   599.7   -7.60%
inv_txfm_add_8x16_identity_adst_2_8bpc_rvv        682.8   633.4   -7.23%
inv_txfm_add_8x16_identity_dct_0_8bpc_rvv         562.1   527.9   -6.08%
inv_txfm_add_8x16_identity_dct_1_8bpc_rvv         562.0   527.9   -6.07%
inv_txfm_add_8x16_identity_dct_2_8bpc_rvv         597.4   561.5   -6.01%
inv_txfm_add_8x16_identity_flipadst_0_8bpc_rvv    652.7   603.6   -7.52%
inv_txfm_add_8x16_identity_flipadst_1_8bpc_rvv    652.8   603.6   -7.54%
inv_txfm_add_8x16_identity_flipadst_2_8bpc_rvv    686.6   640.5   -6.71%
inv_txfm_add_8x16_identity_identity_0_8bpc_rvv    421.6   424.4    0.66%
inv_txfm_add_8x16_identity_identity_1_8bpc_rvv    421.7   424.4    0.64%
inv_txfm_add_8x16_identity_identity_2_8bpc_rvv    455.5   458.1    0.57%

inv_txfm_add_16x8_adst_adst_0_8bpc_rvv            935.2   843.2   -9.84%
inv_txfm_add_16x8_adst_adst_1_8bpc_rvv            935.2   843.3   -9.83%
inv_txfm_add_16x8_adst_adst_2_8bpc_rvv            935.2   843.1   -9.85%
inv_txfm_add_16x8_adst_dct_0_8bpc_rvv             857.0   781.1   -8.86%
inv_txfm_add_16x8_adst_dct_1_8bpc_rvv             856.9   781.1   -8.85%
inv_txfm_add_16x8_adst_dct_2_8bpc_rvv             856.9   781.0   -8.86%
inv_txfm_add_16x8_adst_flipadst_0_8bpc_rvv        938.9   846.8   -9.81%
inv_txfm_add_16x8_adst_flipadst_1_8bpc_rvv        938.8   847.0   -9.78%
inv_txfm_add_16x8_adst_flipadst_2_8bpc_rvv        938.9   847.0   -9.79%
inv_txfm_add_16x8_adst_identity_0_8bpc_rvv        711.2   661.6   -6.97%
inv_txfm_add_16x8_adst_identity_1_8bpc_rvv        711.2   661.6   -6.97%
inv_txfm_add_16x8_adst_identity_2_8bpc_rvv        711.2   661.6   -6.97%
inv_txfm_add_16x8_dct_adst_0_8bpc_rvv             846.1   771.5   -8.82%
inv_txfm_add_16x8_dct_adst_1_8bpc_rvv             845.9   771.5   -8.80%
inv_txfm_add_16x8_dct_adst_2_8bpc_rvv             846.2   772.1   -8.76%
inv_txfm_add_16x8_dct_dct_0_8bpc_rvv              767.8   710.3   -7.49%
inv_txfm_add_16x8_dct_dct_1_8bpc_rvv              767.8   710.4   -7.48%
inv_txfm_add_16x8_dct_dct_2_8bpc_rvv              767.4   710.4   -7.43%
inv_txfm_add_16x8_dct_flipadst_0_8bpc_rvv         856.6   775.6   -9.46%
inv_txfm_add_16x8_dct_flipadst_1_8bpc_rvv         856.5   775.1   -9.50%
inv_txfm_add_16x8_dct_flipadst_2_8bpc_rvv         856.6   775.2   -9.50%
inv_txfm_add_16x8_dct_identity_0_8bpc_rvv         623.3   589.9   -5.36%
inv_txfm_add_16x8_dct_identity_1_8bpc_rvv         623.3   590.0   -5.34%
inv_txfm_add_16x8_dct_identity_2_8bpc_rvv         623.3   589.7   -5.39%
inv_txfm_add_16x8_flipadst_adst_0_8bpc_rvv        939.8   846.9   -9.89%
inv_txfm_add_16x8_flipadst_adst_1_8bpc_rvv        939.8   847.0   -9.87%
inv_txfm_add_16x8_flipadst_adst_2_8bpc_rvv        939.9   846.9   -9.89%
inv_txfm_add_16x8_flipadst_dct_0_8bpc_rvv         860.8   784.9   -8.82%
inv_txfm_add_16x8_flipadst_dct_1_8bpc_rvv         860.7   784.8   -8.82%
inv_txfm_add_16x8_flipadst_dct_2_8bpc_rvv         860.8   784.9   -8.82%
inv_txfm_add_16x8_flipadst_flipadst_0_8bpc_rvv    942.7   852.2   -9.60%
inv_txfm_add_16x8_flipadst_flipadst_1_8bpc_rvv    942.7   852.1   -9.61%
inv_txfm_add_16x8_flipadst_flipadst_2_8bpc_rvv    942.8   852.1   -9.62%
inv_txfm_add_16x8_flipadst_identity_0_8bpc_rvv    714.9   667.0   -6.70%
inv_txfm_add_16x8_flipadst_identity_1_8bpc_rvv    715.0   666.9   -6.73%
inv_txfm_add_16x8_flipadst_identity_2_8bpc_rvv    715.0   666.9   -6.73%
inv_txfm_add_16x8_identity_adst_0_8bpc_rvv        707.9   667.2   -5.75%
inv_txfm_add_16x8_identity_adst_1_8bpc_rvv        707.9   667.3   -5.74%
inv_txfm_add_16x8_identity_adst_2_8bpc_rvv        707.9   667.2   -5.75%
inv_txfm_add_16x8_identity_dct_0_8bpc_rvv         630.6   604.8   -4.09%
inv_txfm_add_16x8_identity_dct_1_8bpc_rvv         630.7   604.9   -4.09%
inv_txfm_add_16x8_identity_dct_2_8bpc_rvv         630.6   604.8   -4.09%
inv_txfm_add_16x8_identity_flipadst_0_8bpc_rvv    711.7   671.1   -5.70%
inv_txfm_add_16x8_identity_flipadst_1_8bpc_rvv    711.9   671.1   -5.73%
inv_txfm_add_16x8_identity_flipadst_2_8bpc_rvv    711.8   671.2   -5.70%
inv_txfm_add_16x8_identity_identity_0_8bpc_rvv    485.2   486.2    0.21%
inv_txfm_add_16x8_identity_identity_1_8bpc_rvv    485.2   486.3    0.23%
inv_txfm_add_16x8_identity_identity_2_8bpc_rvv    485.2   486.3    0.23%
2024-10-16 11:04:14 +00:00
Jean-Baptiste Kempf 389450f61e NEWS: last updates about optimizations 2024-10-14 19:21:07 +02:00
Luca Barbato 79f7188c25 NEWS: add an entry for the Power9 optimization 2024-10-13 21:51:36 +02:00
Nathan E. Egge 572c5a669d riscv: Fix argon test failure
This fixes md5sum mismatch in profile0_core/streams/test11168_11073.obu.
2024-10-13 18:11:27 +00:00
yuanhecai 257b04f91c loongarch: fix argon tests failure 2024-10-12 15:19:57 +08:00
Bogdan Gligorijević b2e7f06c72 riscv64/mc: warp_8x8 and warp_8x8t 8bpc
Benchmarks:
- Kendryte K230:
warp_8x8_8bpc_c:      4549.7 ( 1.00x)
warp_8x8_8bpc_rvv:    2504.7 ( 1.82x)
warp_8x8t_8bpc_c:     4414.7 ( 1.00x)
warp_8x8t_8bpc_rvv:   2465.7 ( 1.79x)

- Banana Pi BPI-F3:
warp_8x8_8bpc_c:      4431.2 ( 1.00x)
warp_8x8_8bpc_rvv:    3297.4 ( 1.34x)
warp_8x8t_8bpc_c:     4299.3 ( 1.00x)
warp_8x8t_8bpc_rvv:   3255.7 ( 1.32x)
2024-10-09 21:00:08 +02:00
Niklas Haas 56f6d16602 riscv64/mc: Re-order instructions
To avoid read-after-write. Speedup is about 1% for width=4 on a K230.
2024-10-09 16:18:42 +02:00
Niklas Haas 3d12677c54 riscv64/mc: Add bidir functions
This code compromises between the performance of a dedicated kernel per
VLEN/width pair, and the flexibility of a fully VLEN-dynamic loop, by
using a single special case for w=4, and subdividing the rest into the
unrolled four line fast path, and the general-purpose slow path (for
large width on small VLEN).

Kendryte K230

avg_w4_8bpc_c:          346.8 ( 1.00x)
avg_w4_8bpc_rvv:         50.3 ( 6.90x)
avg_w8_8bpc_c:         1054.9 ( 1.00x)
avg_w8_8bpc_rvv:        139.1 ( 7.58x)
avg_w16_8bpc_c:        3396.3 ( 1.00x)
avg_w16_8bpc_rvv:       350.6 ( 9.69x)
avg_w32_8bpc_c:       13734.3 ( 1.00x)
avg_w32_8bpc_rvv:      1226.3 (11.20x)
avg_w64_8bpc_c:       33260.9 ( 1.00x)
avg_w64_8bpc_rvv:      3869.4 ( 8.60x)
avg_w128_8bpc_c:      83441.3 ( 1.00x)
avg_w128_8bpc_rvv:     9765.1 ( 8.54x)

w_avg_w4_8bpc_c:        444.3 ( 1.00x)
w_avg_w4_8bpc_rvv:       75.8 ( 5.86x)
w_avg_w8_8bpc_c:       1365.6 ( 1.00x)
w_avg_w8_8bpc_rvv:      208.8 ( 6.54x)
w_avg_w16_8bpc_c:      4420.8 ( 1.00x)
w_avg_w16_8bpc_rvv:     570.7 ( 7.75x)
w_avg_w32_8bpc_c:     18010.9 ( 1.00x)
w_avg_w32_8bpc_rvv:    2074.4 ( 8.68x)
w_avg_w64_8bpc_c:     43050.4 ( 1.00x)
w_avg_w64_8bpc_rvv:    5799.5 ( 7.42x)
w_avg_w128_8bpc_c:   107153.6 ( 1.00x)
w_avg_w128_8bpc_rvv:  14272.0 ( 7.51x)

mask_w4_8bpc_c:        497.6 ( 1.00x)
mask_w4_8bpc_rvv:       88.5 ( 5.63x)
mask_w8_8bpc_c:       1528.5 ( 1.00x)
mask_w8_8bpc_rvv:      253.1 ( 6.04x)
mask_w16_8bpc_c:      4953.8 ( 1.00x)
mask_w16_8bpc_rvv:     679.0 ( 7.30x)
mask_w32_8bpc_c:     20298.3 ( 1.00x)
mask_w32_8bpc_rvv:    3012.9 ( 6.74x)
mask_w64_8bpc_c:     49718.8 ( 1.00x)
mask_w64_8bpc_rvv:    7291.7 ( 6.82x)
mask_w128_8bpc_c:   126740.3 ( 1.00x)
mask_w128_8bpc_rvv:  18351.1 ( 6.91x)
2024-10-09 16:18:42 +02:00
Niklas Haas 50ac82603a riscv: Add $vtype helper definitions 2024-10-09 16:18:42 +02:00
Nathan E. Egge cc7d8773ee riscv64/mc: Branchless vsetvl in blend_v function
Kendryte K230

blend_v_w2_8bpc_c:       221.4 ( 1.00x)
blend_v_w2_8bpc_rvv:     147.7 ( 1.50x)
blend_v_w4_8bpc_c:       945.3 ( 1.00x)
blend_v_w4_8bpc_rvv:     243.3 ( 3.89x)
blend_v_w8_8bpc_c:      1786.9 ( 1.00x)
blend_v_w8_8bpc_rvv:     256.1 ( 6.98x)
blend_v_w16_8bpc_c:     3472.1 ( 1.00x)
blend_v_w16_8bpc_rvv:    351.1 ( 9.89x)
blend_v_w32_8bpc_c:     6832.1 ( 1.00x)
blend_v_w32_8bpc_rvv:    635.4 (10.75x)

SpacemiT K1

blend_v_w2_8bpc_c:       218.0 ( 1.00x)
blend_v_w2_8bpc_rvv:     144.3 ( 1.51x)
blend_v_w4_8bpc_c:       921.7 ( 1.00x)
blend_v_w4_8bpc_rvv:     237.1 ( 3.89x)
blend_v_w8_8bpc_c:      1739.8 ( 1.00x)
blend_v_w8_8bpc_rvv:     237.4 ( 7.33x)
blend_v_w16_8bpc_c:     3376.6 ( 1.00x)
blend_v_w16_8bpc_rvv:    296.3 (11.40x)
blend_v_w32_8bpc_c:     6647.2 ( 1.00x)
blend_v_w32_8bpc_rvv:    408.1 (16.29x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge 2da8107ec1 riscv64/mc: Branchless vsetvl in blend_h function
Kendryte K230

blend_h_w2_8bpc_c:        165.9 ( 1.00x)
blend_h_w2_8bpc_rvv:       83.8 ( 1.98x)
blend_h_w4_8bpc_c:        295.2 ( 1.00x)
blend_h_w4_8bpc_rvv:       83.8 ( 3.52x)
blend_h_w8_8bpc_c:        557.9 ( 1.00x)
blend_h_w8_8bpc_rvv:       92.5 ( 6.03x)
blend_h_w16_8bpc_c:      1078.8 ( 1.00x)
blend_h_w16_8bpc_rvv:     117.3 ( 9.19x)
blend_h_w32_8bpc_c:      2117.8 ( 1.00x)
blend_h_w32_8bpc_rvv:     200.5 (10.57x)
blend_h_w64_8bpc_c:      4194.7 ( 1.00x)
blend_h_w64_8bpc_rvv:     363.2 (11.55x)
blend_h_w128_8bpc_c:    10271.4 ( 1.00x)
blend_h_w128_8bpc_rvv:    844.5 (12.16x)

SpacemiT K1

blend_h_w2_8bpc_c:        162.5 ( 1.00x)
blend_h_w2_8bpc_rvv:       83.9 ( 1.94x)
blend_h_w4_8bpc_c:        288.6 ( 1.00x)
blend_h_w4_8bpc_rvv:       83.7 ( 3.45x)
blend_h_w8_8bpc_c:        544.7 ( 1.00x)
blend_h_w8_8bpc_rvv:       84.0 ( 6.48x)
blend_h_w16_8bpc_c:      1052.8 ( 1.00x)
blend_h_w16_8bpc_rvv:     102.9 (10.23x)
blend_h_w32_8bpc_c:      2068.0 ( 1.00x)
blend_h_w32_8bpc_rvv:     131.4 (15.73x)
blend_h_w64_8bpc_c:      4093.7 ( 1.00x)
blend_h_w64_8bpc_rvv:     220.3 (18.58x)
blend_h_w128_8bpc_c:    10023.1 ( 1.00x)
blend_h_w128_8bpc_rvv:    467.3 (21.45x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge b374b24c0f riscv64/mc: Branchless vsetvl in blend function
Kendryte K230

blend_w4_8bpc_c:       204.8 ( 1.00x)
blend_w4_8bpc_rvv:      59.8 ( 3.42x)
blend_w8_8bpc_c:       608.9 ( 1.00x)
blend_w8_8bpc_rvv:      87.2 ( 6.98x)
blend_w16_8bpc_c:     2362.4 ( 1.00x)
blend_w16_8bpc_rvv:    225.2 (10.49x)
blend_w32_8bpc_c:     5990.4 ( 1.00x)
blend_w32_8bpc_rvv:    518.3 (11.56x)

SpacemiT K1

blend_w4_8bpc_c:       201.6 ( 1.00x)
blend_w4_8bpc_rvv:      58.0 ( 3.48x)
blend_w8_8bpc_c:       595.1 ( 1.00x)
blend_w8_8bpc_rvv:      82.1 ( 7.25x)
blend_w16_8bpc_c:     2308.8 ( 1.00x)
blend_w16_8bpc_rvv:    189.0 (12.22x)
blend_w32_8bpc_c:     5853.1 ( 1.00x)
blend_w32_8bpc_rvv:    339.5 (17.24x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge 0e3f70e898 riscv64/mc: Add VLEN=256 8bpc RVV blend_v function
SpacemiT K1

blend_v_w2_8bpc_c:       217.0 ( 1.00x)
blend_v_w2_8bpc_rvv:     143.3 ( 1.51x)
blend_v_w4_8bpc_c:       921.6 ( 1.00x)
blend_v_w4_8bpc_rvv:     236.3 ( 3.90x)
blend_v_w8_8bpc_c:      1738.2 ( 1.00x)
blend_v_w8_8bpc_rvv:     238.1 ( 7.30x)
blend_v_w16_8bpc_c:     3376.1 ( 1.00x)
blend_v_w16_8bpc_rvv:    298.0 (11.33x)
blend_v_w32_8bpc_c:     6648.0 ( 1.00x)
blend_v_w32_8bpc_rvv:    409.5 (16.24x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge a5b9544866 riscv64/mc: Add VLEN=256 8bpc RVV blend_h function
SpacemiT K1

blend_h_w2_8bpc_c:        161.8 ( 1.00x)
blend_h_w2_8bpc_rvv:       83.5 ( 1.94x)
blend_h_w4_8bpc_c:        288.4 ( 1.00x)
blend_h_w4_8bpc_rvv:       83.7 ( 3.45x)
blend_h_w8_8bpc_c:        543.9 ( 1.00x)
blend_h_w8_8bpc_rvv:       84.5 ( 6.44x)
blend_h_w16_8bpc_c:      1051.6 ( 1.00x)
blend_h_w16_8bpc_rvv:     103.8 (10.13x)
blend_h_w32_8bpc_c:      2066.0 ( 1.00x)
blend_h_w32_8bpc_rvv:     133.8 (15.44x)
blend_h_w64_8bpc_c:      4092.7 ( 1.00x)
blend_h_w64_8bpc_rvv:     225.2 (18.18x)
blend_h_w128_8bpc_c:    10011.3 ( 1.00x)
blend_h_w128_8bpc_rvv:    474.7 (21.09x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge 83485c5092 riscv64/mc: Add VLEN=256 8bpc RVV blend function
SpacemiT K1

blend_w4_8bpc_c:       201.3 ( 1.00x)
blend_w4_8bpc_rvv:      59.3 ( 3.40x)
blend_w8_8bpc_c:       595.1 ( 1.00x)
blend_w8_8bpc_rvv:      84.1 ( 7.07x)
blend_w16_8bpc_c:     2309.0 ( 1.00x)
blend_w16_8bpc_rvv:    190.5 (12.12x)
blend_w32_8bpc_c:     5854.7 ( 1.00x)
blend_w32_8bpc_rvv:    341.6 (17.14x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge 7f2bb2fbc9 riscv: Move get_vlenb() from checkasm_ to dav1d_ 2024-10-09 16:18:42 +02:00
Nathan E. Egge 01da36ebdf riscv64/mc: Add 8bpc RVV blend_v function
Kendryte K230

blend_v_w2_8bpc_c:       219.6 ( 1.00x)
blend_v_w2_8bpc_rvv:     141.8 ( 1.55x)
blend_v_w4_8bpc_c:       942.9 ( 1.00x)
blend_v_w4_8bpc_rvv:     240.9 ( 3.91x)
blend_v_w8_8bpc_c:      1783.5 ( 1.00x)
blend_v_w8_8bpc_rvv:     254.7 ( 7.00x)
blend_v_w16_8bpc_c:     3466.5 ( 1.00x)
blend_v_w16_8bpc_rvv:    350.5 ( 9.89x)
blend_v_w32_8bpc_c:     6825.2 ( 1.00x)
blend_v_w32_8bpc_rvv:    635.1 (10.75x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge d3a94f1194 riscv64/mc: Add 8bpc RVV blend_h function
Kendryte K230

blend_h_w2_8bpc_c:        165.4 ( 1.00x)
blend_h_w2_8bpc_rvv:       79.4 ( 2.08x)
blend_h_w4_8bpc_c:        294.6 ( 1.00x)
blend_h_w4_8bpc_rvv:       81.5 ( 3.61x)
blend_h_w8_8bpc_c:        556.9 ( 1.00x)
blend_h_w8_8bpc_rvv:       90.2 ( 6.17x)
blend_h_w16_8bpc_c:      1077.6 ( 1.00x)
blend_h_w16_8bpc_rvv:     116.1 ( 9.29x)
blend_h_w32_8bpc_c:      2116.2 ( 1.00x)
blend_h_w32_8bpc_rvv:     200.5 (10.55x)
blend_h_w64_8bpc_c:      4191.8 ( 1.00x)
blend_h_w64_8bpc_rvv:     363.3 (11.54x)
blend_h_w128_8bpc_c:    10264.6 ( 1.00x)
blend_h_w128_8bpc_rvv:    844.1 (12.16x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge f851fcd0b4 riscv64/mc: Add 8bpc RVV blend function
Kendryte K230

blend_w4_8bpc_c:       204.5 ( 1.00x)
blend_w4_8bpc_rvv:      56.4 ( 3.62x)
blend_w8_8bpc_c:       608.6 ( 1.00x)
blend_w8_8bpc_rvv:      87.3 ( 6.97x)
blend_w16_8bpc_c:     2363.8 ( 1.00x)
blend_w16_8bpc_rvv:    225.1 (10.50x)
blend_w32_8bpc_c:     5990.3 ( 1.00x)
blend_w32_8bpc_rvv:    518.8 (11.55x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević 848c5a2dbb Tone down loop to only 2 iterations
Benchmark pending
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević a0a08d8543 Scalar dc calculation
Current benchmark:

- Kendryte K230:
inv_txfm_add_16x16_dct_dct_0_8bpc_c:     1729.4 ( 1.00x)
inv_txfm_add_16x16_dct_dct_0_8bpc_rvv:    153.2 (11.29x)

- spacemiT K1:
inv_txfm_add_16x16_dct_dct_0_8bpc_c:     1533.4 ( 1.00x)
inv_txfm_add_16x16_dct_dct_0_8bpc_rvv:    176.8 ( 8.67x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević c8749f06e5 riscv64/itx: Special case 16x16 8bpc dct_dct eob=0
Performance comparison:

- SpacemiT K1:                             Master branch:       itx_16x16:
  inv_txfm_add_16x16_dct_dct_0_8bpc_c:     1534.1 ( 1.00x)      1534.9 ( 1.00x)
  inv_txfm_add_16x16_dct_dct_0_8bpc_rvv:   1173.6 ( 1.31x)       173.1 ( 8.87x)

- Kendryte K230:                           Master branch:       itx_16x16:
  inv_txfm_add_16x16_dct_dct_0_8bpc_c:     1576.0 ( 1.00x)      1579.1 ( 1.00x)
  inv_txfm_add_16x16_dct_dct_0_8bpc_rvv:   1095.5 ( 1.44x)       146.8 (10.75x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević 0cdf1b4be5 ipred_paeth
Benchmarks:
- Kendryte K230:
intra_pred_paeth_w4_8bpc_c:       412.9 ( 1.00x)
intra_pred_paeth_w4_8bpc_rvv:     688.0 ( 0.60x)
intra_pred_paeth_w8_8bpc_c:      1206.6 ( 1.00x)
intra_pred_paeth_w8_8bpc_rvv:    1094.3 ( 1.10x)
intra_pred_paeth_w16_8bpc_c:     3889.7 ( 1.00x)
intra_pred_paeth_w16_8bpc_rvv:   1796.7 ( 2.16x)
intra_pred_paeth_w32_8bpc_c:     9797.2 ( 1.00x)
intra_pred_paeth_w32_8bpc_rvv:   4323.9 ( 2.27x)
intra_pred_paeth_w64_8bpc_c:    24242.5 ( 1.00x)
intra_pred_paeth_w64_8bpc_rvv:  10739.8 ( 2.26x)

- Banana Pi BPI-F3
intra_pred_paeth_w4_8bpc_c:       395.1 ( 1.00x)
intra_pred_paeth_w4_8bpc_rvv:     705.4 ( 0.56x)
intra_pred_paeth_w8_8bpc_c:      1184.9 ( 1.00x)
intra_pred_paeth_w8_8bpc_rvv:    1125.3 ( 1.05x)
intra_pred_paeth_w16_8bpc_c:     3807.8 ( 1.00x)
intra_pred_paeth_w16_8bpc_rvv:   1850.8 ( 2.06x)
intra_pred_paeth_w32_8bpc_c:     9985.1 ( 1.00x)
intra_pred_paeth_w32_8bpc_rvv:   2235.5 ( 4.47x)
intra_pred_paeth_w64_8bpc_c:    24040.4 ( 1.00x)
intra_pred_paeth_w64_8bpc_rvv:   5450.0 ( 4.41x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević b830ac82bb pal_pred
Benchmarks:

- Kendryte K230:
pal_pred_w4_8bpc_c:        115.6 ( 1.00x)
pal_pred_w4_8bpc_rvv:      331.4 ( 0.35x)
pal_pred_w4_16bpc_c:       140.8 ( 1.00x)
pal_pred_w4_16bpc_rvv:     247.9 ( 0.57x)
pal_pred_w8_8bpc_c:        334.9 ( 1.00x)
pal_pred_w8_8bpc_rvv:      520.8 ( 0.64x)
pal_pred_w8_16bpc_c:       412.7 ( 1.00x)
pal_pred_w8_16bpc_rvv:     386.2 ( 1.07x)
pal_pred_w16_8bpc_c:      1044.4 ( 1.00x)
pal_pred_w16_8bpc_rvv:     842.8 ( 1.24x)
pal_pred_w16_16bpc_c:     1300.3 ( 1.00x)
pal_pred_w16_16bpc_rvv:    619.9 ( 2.10x)
pal_pred_w32_8bpc_c:      2452.8 ( 1.00x)
pal_pred_w32_8bpc_rvv:    1016.1 ( 2.41x)
pal_pred_w32_16bpc_c:     3072.1 ( 1.00x)
pal_pred_w32_16bpc_rvv:   1440.5 ( 2.13x)
pal_pred_w64_8bpc_c:      6015.8 ( 1.00x)
pal_pred_w64_8bpc_rvv:    2505.5 ( 2.40x)
pal_pred_w64_16bpc_c:     7552.4 ( 1.00x)
pal_pred_w64_16bpc_rvv:   3512.7 ( 2.15x)

- Banana Pi BPI-F3:
pal_pred_w4_8bpc_c:        102.2 ( 1.00x)
pal_pred_w4_8bpc_rvv:      511.2 ( 0.20x)
pal_pred_w4_16bpc_c:       137.7 ( 1.00x)
pal_pred_w4_16bpc_rvv:     330.9 ( 0.42x)
pal_pred_w8_8bpc_c:        289.2 ( 1.00x)
pal_pred_w8_8bpc_rvv:      819.6 ( 0.35x)
pal_pred_w8_16bpc_c:       402.6 ( 1.00x)
pal_pred_w8_16bpc_rvv:     520.7 ( 0.77x)
pal_pred_w16_8bpc_c:       894.5 ( 1.00x)
pal_pred_w16_8bpc_rvv:    1326.6 ( 0.67x)
pal_pred_w16_16bpc_c:     1268.6 ( 1.00x)
pal_pred_w16_16bpc_rvv:    845.8 ( 1.50x)
pal_pred_w32_8bpc_c:      2094.5 ( 1.00x)
pal_pred_w32_8bpc_rvv:    1610.9 ( 1.30x)
pal_pred_w32_16bpc_c:     2999.4 ( 1.00x)
pal_pred_w32_16bpc_rvv:   1029.8 ( 2.91x)
pal_pred_w64_8bpc_c:      5128.0 ( 1.00x)
pal_pred_w64_8bpc_rvv:    2000.8 ( 2.56x)
pal_pred_w64_16bpc_c:     7375.0 ( 1.00x)
pal_pred_w64_16bpc_rvv:   2518.2 ( 2.93x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević 44541dfa6b ipred_smooth
Benchmarks:
- Kendryte K230:
intra_pred_smooth_w4_8bpc_c:        392.6 ( 1.00x)
intra_pred_smooth_w4_8bpc_rvv:      311.3 ( 1.26x)
intra_pred_smooth_w8_8bpc_c:       1204.1 ( 1.00x)
intra_pred_smooth_w8_8bpc_rvv:      488.9 ( 2.46x)
intra_pred_smooth_w16_8bpc_c:      3885.9 ( 1.00x)
intra_pred_smooth_w16_8bpc_rvv:     796.6 ( 4.88x)
intra_pred_smooth_w32_8bpc_c:      9305.7 ( 1.00x)
intra_pred_smooth_w32_8bpc_rvv:    1806.7 ( 5.15x)
intra_pred_smooth_w64_8bpc_c:     23043.0 ( 1.00x)
intra_pred_smooth_w64_8bpc_rvv:    4344.3 ( 5.30x)

- spacemiT K1:
intra_pred_smooth_w4_8bpc_c:        384.1 ( 1.00x)
intra_pred_smooth_w4_8bpc_rvv:      322.2 ( 1.19x)
intra_pred_smooth_w8_8bpc_c:       1177.6 ( 1.00x)
intra_pred_smooth_w8_8bpc_rvv:      507.1 ( 2.32x)
intra_pred_smooth_w16_8bpc_c:      3801.2 ( 1.00x)
intra_pred_smooth_w16_8bpc_rvv:     814.4 ( 4.67x)
intra_pred_smooth_w32_8bpc_c:      9103.1 ( 1.00x)
intra_pred_smooth_w32_8bpc_rvv:     980.8 ( 9.28x)
intra_pred_smooth_w64_8bpc_c:     22540.1 ( 1.00x)
intra_pred_smooth_w64_8bpc_rvv:    2319.3 ( 9.72x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević d711f974eb ipred cfl functions
Benchmarks:

- Kendryte K230:
cfl_pred_cfl_128_w4_8bpc_c:         497.3 ( 1.00x)
cfl_pred_cfl_128_w4_8bpc_rvv:       369.6 ( 1.35x)
cfl_pred_cfl_128_w4_16bpc_c:        425.2 ( 1.00x)
cfl_pred_cfl_128_w4_16bpc_rvv:      385.5 ( 1.10x)
cfl_pred_cfl_128_w8_8bpc_c:        1544.2 ( 1.00x)
cfl_pred_cfl_128_w8_8bpc_rvv:       584.2 ( 2.64x)
cfl_pred_cfl_128_w8_16bpc_c:       1306.2 ( 1.00x)
cfl_pred_cfl_128_w8_16bpc_rvv:      608.8 ( 2.15x)
cfl_pred_cfl_128_w16_8bpc_c:       3085.6 ( 1.00x)
cfl_pred_cfl_128_w16_8bpc_rvv:      584.2 ( 5.28x)
cfl_pred_cfl_128_w16_16bpc_c:      2657.1 ( 1.00x)
cfl_pred_cfl_128_w16_16bpc_rvv:     608.9 ( 4.36x)
cfl_pred_cfl_128_w32_8bpc_c:       8405.6 ( 1.00x)
cfl_pred_cfl_128_w32_8bpc_rvv:     1416.1 ( 5.94x)
cfl_pred_cfl_128_w32_16bpc_c:      7199.9 ( 1.00x)
cfl_pred_cfl_128_w32_16bpc_rvv:    1479.8 ( 4.87x)
cfl_pred_cfl_left_w4_8bpc_c:        553.1 ( 1.00x)
cfl_pred_cfl_left_w4_8bpc_rvv:      395.6 ( 1.40x)
cfl_pred_cfl_left_w4_16bpc_c:       486.7 ( 1.00x)
cfl_pred_cfl_left_w4_16bpc_rvv:     409.1 ( 1.19x)
cfl_pred_cfl_left_w8_8bpc_c:       1610.8 ( 1.00x)
cfl_pred_cfl_left_w8_8bpc_rvv:      610.4 ( 2.64x)
cfl_pred_cfl_left_w8_16bpc_c:      1378.0 ( 1.00x)
cfl_pred_cfl_left_w8_16bpc_rvv:     636.2 ( 2.17x)
cfl_pred_cfl_left_w16_8bpc_c:      3154.4 ( 1.00x)
cfl_pred_cfl_left_w16_8bpc_rvv:     610.4 ( 5.17x)
cfl_pred_cfl_left_w16_16bpc_c:     2733.2 ( 1.00x)
cfl_pred_cfl_left_w16_16bpc_rvv:    636.3 ( 4.30x)
cfl_pred_cfl_left_w32_8bpc_c:      8451.7 ( 1.00x)
cfl_pred_cfl_left_w32_8bpc_rvv:    1442.5 ( 5.86x)
cfl_pred_cfl_left_w32_16bpc_c:     7267.2 ( 1.00x)
cfl_pred_cfl_left_w32_16bpc_rvv:   1509.4 ( 4.81x)
cfl_pred_cfl_top_w4_8bpc_c:         544.7 ( 1.00x)
cfl_pred_cfl_top_w4_8bpc_rvv:       395.8 ( 1.38x)
cfl_pred_cfl_top_w4_16bpc_c:        475.1 ( 1.00x)
cfl_pred_cfl_top_w4_16bpc_rvv:      406.7 ( 1.17x)
cfl_pred_cfl_top_w8_8bpc_c:        1599.3 ( 1.00x)
cfl_pred_cfl_top_w8_8bpc_rvv:       610.4 ( 2.62x)
cfl_pred_cfl_top_w8_16bpc_c:       1363.8 ( 1.00x)
cfl_pred_cfl_top_w8_16bpc_rvv:      630.3 ( 2.16x)
cfl_pred_cfl_top_w16_8bpc_c:       3161.0 ( 1.00x)
cfl_pred_cfl_top_w16_8bpc_rvv:      610.5 ( 5.18x)
cfl_pred_cfl_top_w16_16bpc_c:      2735.9 ( 1.00x)
cfl_pred_cfl_top_w16_16bpc_rvv:     634.3 ( 4.31x)
cfl_pred_cfl_top_w32_8bpc_c:       8564.4 ( 1.00x)
cfl_pred_cfl_top_w32_8bpc_rvv:     1442.8 ( 5.94x)
cfl_pred_cfl_top_w32_16bpc_c:      7294.9 ( 1.00x)
cfl_pred_cfl_top_w32_16bpc_rvv:    1511.5 ( 4.83x)
cfl_pred_cfl_w4_8bpc_c:             571.5 ( 1.00x)
cfl_pred_cfl_w4_8bpc_rvv:           421.0 ( 1.36x)
cfl_pred_cfl_w4_16bpc_c:            499.1 ( 1.00x)
cfl_pred_cfl_w4_16bpc_rvv:          462.8 ( 1.08x)
cfl_pred_cfl_w8_8bpc_c:            1642.0 ( 1.00x)
cfl_pred_cfl_w8_8bpc_rvv:           635.8 ( 2.58x)
cfl_pred_cfl_w8_16bpc_c:           1401.4 ( 1.00x)
cfl_pred_cfl_w8_16bpc_rvv:          686.1 ( 2.04x)
cfl_pred_cfl_w16_8bpc_c:           3204.3 ( 1.00x)
cfl_pred_cfl_w16_8bpc_rvv:          635.8 ( 5.04x)
cfl_pred_cfl_w16_16bpc_c:          2784.8 ( 1.00x)
cfl_pred_cfl_w16_16bpc_rvv:         686.1 ( 4.06x)
cfl_pred_cfl_w32_8bpc_c:           8623.9 ( 1.00x)
cfl_pred_cfl_w32_8bpc_rvv:         1465.9 ( 5.88x)
cfl_pred_cfl_w32_16bpc_c:          7357.8 ( 1.00x)
cfl_pred_cfl_w32_16bpc_rvv:        1556.3 ( 4.73x)

- Banana Pi BPI-F3:
cfl_pred_cfl_128_w4_8bpc_c:         485.5 ( 1.00x)
cfl_pred_cfl_128_w4_8bpc_rvv:       366.4 ( 1.33x)
cfl_pred_cfl_128_w4_16bpc_c:        393.5 ( 1.00x)
cfl_pred_cfl_128_w4_16bpc_rvv:      378.7 ( 1.04x)
cfl_pred_cfl_128_w8_8bpc_c:        1507.9 ( 1.00x)
cfl_pred_cfl_128_w8_8bpc_rvv:       577.4 ( 2.61x)
cfl_pred_cfl_128_w8_16bpc_c:       1205.7 ( 1.00x)
cfl_pred_cfl_128_w8_16bpc_rvv:      605.1 ( 1.99x)
cfl_pred_cfl_128_w16_8bpc_c:       3019.3 ( 1.00x)
cfl_pred_cfl_128_w16_8bpc_rvv:      577.4 ( 5.23x)
cfl_pred_cfl_128_w16_16bpc_c:      2506.5 ( 1.00x)
cfl_pred_cfl_128_w16_16bpc_rvv:     605.1 ( 4.14x)
cfl_pred_cfl_128_w32_8bpc_c:       8170.0 ( 1.00x)
cfl_pred_cfl_128_w32_8bpc_rvv:      715.6 (11.42x)
cfl_pred_cfl_128_w32_16bpc_c:      6686.7 ( 1.00x)
cfl_pred_cfl_128_w32_16bpc_rvv:     749.7 ( 8.92x)
cfl_pred_cfl_left_w4_8bpc_c:        539.4 ( 1.00x)
cfl_pred_cfl_left_w4_8bpc_rvv:      393.2 ( 1.37x)
cfl_pred_cfl_left_w4_16bpc_c:       452.0 ( 1.00x)
cfl_pred_cfl_left_w4_16bpc_rvv:     401.2 ( 1.13x)
cfl_pred_cfl_left_w8_8bpc_c:       1572.4 ( 1.00x)
cfl_pred_cfl_left_w8_8bpc_rvv:      604.1 ( 2.60x)
cfl_pred_cfl_left_w8_16bpc_c:      1274.5 ( 1.00x)
cfl_pred_cfl_left_w8_16bpc_rvv:     629.0 ( 2.03x)
cfl_pred_cfl_left_w16_8bpc_c:      3096.0 ( 1.00x)
cfl_pred_cfl_left_w16_8bpc_rvv:     604.1 ( 5.13x)
cfl_pred_cfl_left_w16_16bpc_c:     2591.4 ( 1.00x)
cfl_pred_cfl_left_w16_16bpc_rvv:    629.0 ( 4.12x)
cfl_pred_cfl_left_w32_8bpc_c:      8266.0 ( 1.00x)
cfl_pred_cfl_left_w32_8bpc_rvv:     742.4 (11.13x)
cfl_pred_cfl_left_w32_16bpc_c:     6758.0 ( 1.00x)
cfl_pred_cfl_left_w32_16bpc_rvv:    773.9 ( 8.73x)
cfl_pred_cfl_top_w4_8bpc_c:         532.3 ( 1.00x)
cfl_pred_cfl_top_w4_8bpc_rvv:       392.6 ( 1.36x)
cfl_pred_cfl_top_w4_16bpc_c:        440.4 ( 1.00x)
cfl_pred_cfl_top_w4_16bpc_rvv:      399.6 ( 1.10x)
cfl_pred_cfl_top_w8_8bpc_c:        1563.3 ( 1.00x)
cfl_pred_cfl_top_w8_8bpc_rvv:       603.6 ( 2.59x)
cfl_pred_cfl_top_w8_16bpc_c:       1271.6 ( 1.00x)
cfl_pred_cfl_top_w8_16bpc_rvv:      626.1 ( 2.03x)
cfl_pred_cfl_top_w16_8bpc_c:       3098.6 ( 1.00x)
cfl_pred_cfl_top_w16_8bpc_rvv:      603.6 ( 5.13x)
cfl_pred_cfl_top_w16_16bpc_c:      2562.8 ( 1.00x)
cfl_pred_cfl_top_w16_16bpc_rvv:     626.0 ( 4.09x)
cfl_pred_cfl_top_w32_8bpc_c:       8278.1 ( 1.00x)
cfl_pred_cfl_top_w32_8bpc_rvv:      741.8 (11.16x)
cfl_pred_cfl_top_w32_16bpc_c:      6799.1 ( 1.00x)
cfl_pred_cfl_top_w32_16bpc_rvv:     775.0 ( 8.77x)
cfl_pred_cfl_w4_8bpc_c:             559.8 ( 1.00x)
cfl_pred_cfl_w4_8bpc_rvv:           421.7 ( 1.33x)
cfl_pred_cfl_w4_16bpc_c:            470.2 ( 1.00x)
cfl_pred_cfl_w4_16bpc_rvv:          451.3 ( 1.04x)
cfl_pred_cfl_w8_8bpc_c:            1605.5 ( 1.00x)
cfl_pred_cfl_w8_8bpc_rvv:           632.8 ( 2.54x)
cfl_pred_cfl_w8_16bpc_c:           1308.5 ( 1.00x)
cfl_pred_cfl_w8_16bpc_rvv:          677.9 ( 1.93x)
cfl_pred_cfl_w16_8bpc_c:           3135.0 ( 1.00x)
cfl_pred_cfl_w16_8bpc_rvv:          632.9 ( 4.95x)
cfl_pred_cfl_w16_16bpc_c:          2625.9 ( 1.00x)
cfl_pred_cfl_w16_16bpc_rvv:         677.9 ( 3.87x)
cfl_pred_cfl_w32_8bpc_c:           8376.6 ( 1.00x)
cfl_pred_cfl_w32_8bpc_rvv:          770.4 (10.87x)
cfl_pred_cfl_w32_16bpc_c:          6866.4 ( 1.00x)
cfl_pred_cfl_w32_16bpc_rvv:         822.7 ( 8.35x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević 2f5bfc37b0 riscv64/cdef: filter functions
Benchmarks:
- Kendryte K230:
cdef_filter_4x4_01_8bpc_c:       1339.4 ( 1.00x)
cdef_filter_4x4_01_8bpc_rvv:      836.2 ( 1.60x)
cdef_filter_4x4_01_16bpc_c:      1369.1 ( 1.00x)
cdef_filter_4x4_01_16bpc_rvv:     824.7 ( 1.66x)
cdef_filter_4x4_10_8bpc_c:        872.8 ( 1.00x)
cdef_filter_4x4_10_8bpc_rvv:      523.9 ( 1.67x)
cdef_filter_4x4_10_16bpc_c:       938.2 ( 1.00x)
cdef_filter_4x4_10_16bpc_rvv:     517.1 ( 1.81x)
cdef_filter_4x4_11_8bpc_c:       2668.3 ( 1.00x)
cdef_filter_4x4_11_8bpc_rvv:     1285.0 ( 2.08x)
cdef_filter_4x4_11_16bpc_c:      2922.1 ( 1.00x)
cdef_filter_4x4_11_16bpc_rvv:    1291.0 ( 2.26x)
cdef_filter_4x8_01_8bpc_c:       2489.1 ( 1.00x)
cdef_filter_4x8_01_8bpc_rvv:     1594.3 ( 1.56x)
cdef_filter_4x8_01_16bpc_c:      2528.1 ( 1.00x)
cdef_filter_4x8_01_16bpc_rvv:    1566.6 ( 1.61x)
cdef_filter_4x8_10_8bpc_c:       1576.9 ( 1.00x)
cdef_filter_4x8_10_8bpc_rvv:      967.1 ( 1.63x)
cdef_filter_4x8_10_16bpc_c:      1641.3 ( 1.00x)
cdef_filter_4x8_10_16bpc_rvv:     947.1 ( 1.73x)
cdef_filter_4x8_11_8bpc_c:       5164.0 ( 1.00x)
cdef_filter_4x8_11_8bpc_rvv:     2490.7 ( 2.07x)
cdef_filter_4x8_11_16bpc_c:      5732.3 ( 1.00x)
cdef_filter_4x8_11_16bpc_rvv:    2499.2 ( 2.29x)
cdef_filter_8x8_01_8bpc_c:       4742.3 ( 1.00x)
cdef_filter_8x8_01_8bpc_rvv:     1628.6 ( 2.91x)
cdef_filter_8x8_01_16bpc_c:      4785.0 ( 1.00x)
cdef_filter_8x8_01_16bpc_rvv:    1595.5 ( 3.00x)
cdef_filter_8x8_10_8bpc_c:       2962.4 ( 1.00x)
cdef_filter_8x8_10_8bpc_rvv:     1000.8 ( 2.96x)
cdef_filter_8x8_10_16bpc_c:      3022.4 ( 1.00x)
cdef_filter_8x8_10_16bpc_rvv:     975.7 ( 3.10x)
cdef_filter_8x8_11_8bpc_c:      12623.9 ( 1.00x)
cdef_filter_8x8_11_8bpc_rvv:     2525.4 ( 5.00x)
cdef_filter_8x8_11_16bpc_c:     12470.7 ( 1.00x)
cdef_filter_8x8_11_16bpc_rvv:    2528.2 ( 4.93x)

- Banana Pi BPI-F3:
cdef_filter_4x4_01_8bpc_c:       1281.2 ( 1.00x)
cdef_filter_4x4_01_8bpc_rvv:      813.0 ( 1.58x)
cdef_filter_4x4_01_16bpc_c:      1300.8 ( 1.00x)
cdef_filter_4x4_01_16bpc_rvv:     808.9 ( 1.61x)
cdef_filter_4x4_10_8bpc_c:        843.0 ( 1.00x)
cdef_filter_4x4_10_8bpc_rvv:      498.4 ( 1.69x)
cdef_filter_4x4_10_16bpc_c:       903.6 ( 1.00x)
cdef_filter_4x4_10_16bpc_rvv:     497.9 ( 1.81x)
cdef_filter_4x4_11_8bpc_c:       2614.1 ( 1.00x)
cdef_filter_4x4_11_8bpc_rvv:     1219.6 ( 2.14x)
cdef_filter_4x4_11_16bpc_c:      2795.6 ( 1.00x)
cdef_filter_4x4_11_16bpc_rvv:    1243.1 ( 2.25x)
cdef_filter_4x8_01_8bpc_c:       2405.4 ( 1.00x)
cdef_filter_4x8_01_8bpc_rvv:     1548.5 ( 1.55x)
cdef_filter_4x8_01_16bpc_c:      2402.7 ( 1.00x)
cdef_filter_4x8_01_16bpc_rvv:    1542.7 ( 1.56x)
cdef_filter_4x8_10_8bpc_c:       1522.0 ( 1.00x)
cdef_filter_4x8_10_8bpc_rvv:      917.4 ( 1.66x)
cdef_filter_4x8_10_16bpc_c:      1589.2 ( 1.00x)
cdef_filter_4x8_10_16bpc_rvv:     915.9 ( 1.74x)
cdef_filter_4x8_11_8bpc_c:       5050.7 ( 1.00x)
cdef_filter_4x8_11_8bpc_rvv:     2358.7 ( 2.14x)
cdef_filter_4x8_11_16bpc_c:      5510.5 ( 1.00x)
cdef_filter_4x8_11_16bpc_rvv:    2411.6 ( 2.28x)
cdef_filter_8x8_01_8bpc_c:       4558.3 ( 1.00x)
cdef_filter_8x8_01_8bpc_rvv:     1579.7 ( 2.89x)
cdef_filter_8x8_01_16bpc_c:      4551.1 ( 1.00x)
cdef_filter_8x8_01_16bpc_rvv:    1571.1 ( 2.90x)
cdef_filter_8x8_10_8bpc_c:       2869.3 ( 1.00x)
cdef_filter_8x8_10_8bpc_rvv:      948.4 ( 3.03x)
cdef_filter_8x8_10_16bpc_c:      2928.6 ( 1.00x)
cdef_filter_8x8_10_16bpc_rvv:     944.2 ( 3.10x)
cdef_filter_8x8_11_8bpc_c:      12317.5 ( 1.00x)
cdef_filter_8x8_11_8bpc_rvv:     2389.7 ( 5.15x)
cdef_filter_8x8_11_16bpc_c:     11950.6 ( 1.00x)
cdef_filter_8x8_11_16bpc_rvv:    2440.1 ( 4.90x)
2024-10-09 16:18:42 +02:00
Bogdan Gligorijević f223436bb6 pal_idx_finish
Benchmarks:

- Kendryte K230:
pal_idx_finish_w4_c:       122.5 ( 1.00x)
pal_idx_finish_w4_rvv:     107.2 ( 1.14x)
pal_idx_finish_w8_c:       302.8 ( 1.00x)
pal_idx_finish_w8_rvv:     197.9 ( 1.53x)
pal_idx_finish_w16_c:      868.2 ( 1.00x)
pal_idx_finish_w16_rvv:    438.5 ( 1.98x)
pal_idx_finish_w32_c:     1966.5 ( 1.00x)
pal_idx_finish_w32_rvv:    833.0 ( 2.36x)
pal_idx_finish_w64_c:     4737.5 ( 1.00x)
pal_idx_finish_w64_rvv:   1818.3 ( 2.61x)

- Banana Pi BPI-F3:
pal_idx_finish_w4_c:       122.4 ( 1.00x)
pal_idx_finish_w4_rvv:     132.0 ( 0.93x)
pal_idx_finish_w8_c:       289.4 ( 1.00x)
pal_idx_finish_w8_rvv:     195.8 ( 1.48x)
pal_idx_finish_w16_c:      788.0 ( 1.00x)
pal_idx_finish_w16_rvv:    430.6 ( 1.83x)
pal_idx_finish_w32_c:     1699.2 ( 1.00x)
pal_idx_finish_w32_rvv:    816.3 ( 2.08x)
pal_idx_finish_w64_c:     3977.7 ( 1.00x)
pal_idx_finish_w64_rvv:   1779.4 ( 2.24x)
2024-10-09 16:18:42 +02:00
Nathan E. Egge 38f74bdc46 riscv: Allow multiple .option arch with vararg ext 2024-10-09 16:18:42 +02:00
Henrik Gramner 7072e79faa x86: Make AVX2 SGR gatherless
Instead of using gathers we can calculate the value of
sgr_x_by_x[min(z, 255)] by doing 256 / (z + 1) in floating-point
with some clipping for z == 0 and z >= 255.

As the required precision of the division is fairly small it can be
performed using an approximate reciprocal, which is significantly
faster than a regular division.

Gather instructions are slow on all AMD CPU:s, and on most Intel
CPU:s ever since µcode updates were issued as a workaround for
the Gather Data Sampling side channel vulnerability.
2024-10-07 13:04:34 +02:00
Luca Barbato 21d9f29d38 tests: Add a fail fast option 2024-10-02 13:00:26 +02:00
jinbo ed004fe95d loongarch: minor improvement on decode_symbol_adapt
Change-Id: I78fe788113ff2487ba1ce2e7d0c7d7c78c5a8c58
2024-09-30 06:37:00 +00:00
yuanhecai 62a51df14e loongarch: rewrite optimization functions in loongarch/itx.S
Change-Id: I1566e8145d36296f2c76107cf15fc2cc7ac0ecc7
2024-09-30 06:37:00 +00:00
guxiwei 757f294a49 LoongArch: Add save_tmvs_lsx
The performance data is as follows:
save_tmvs_c:        3938.6 ( 1.00x)
save_tmvs_lsx:      1355.3 ( 2.91x)
2024-09-30 06:37:00 +00:00
jinbo 3d96175df2 loongarch: refactor loopfilter
bench performance before:
lpf_h_sb_y_w16_8bpc_c:      117.0 ( 1.00x)
lpf_h_sb_y_w16_8bpc_lsx:     33.9 ( 3.46x)
lpf_v_sb_y_w16_8bpc_c:      132.1 ( 1.00x)
lpf_v_sb_y_w16_8bpc_lsx:     59.7 ( 2.21x)

bench performance after:
lpf_h_sb_y_w16_8bpc_c:      114.9 ( 1.00x)
lpf_h_sb_y_w16_8bpc_lsx:     32.0 ( 3.59x)
lpf_v_sb_y_w16_8bpc_c:      132.5 ( 1.00x)
lpf_v_sb_y_w16_8bpc_lsx:     28.1 ( 4.72x)

Change-Id: Ie64e164a9416c438f6b3881ce18fb42e2ddd073d
2024-09-30 06:37:00 +00:00
yuanhecai 70582027e7 loongarch: add lasx implementation of sgr_3x3 for 8 bpc
sgr_3x3_8bpc_c:                                   27233.1 ( 1.00x)
sgr_3x3_8bpc_lsx:                                 12874.7 ( 2.12x)
sgr_3x3_8bpc_lasx:                                10183.7 ( 2.67x)

Change-Id: I2aa469e8560733d6191396186bf776a12ad6e4a3
2024-09-30 06:37:00 +00:00
yuanhecai 96d6e472ad loongarch: rewirte warp_8x8/8x8t_lsx for 8 bpc
before:
warp_8x8_8bpc_c:                                    109.8 ( 1.00x)
warp_8x8_8bpc_lsx:                                   44.6 ( 2.46x)
warp_8x8t_8bpc_c:                                    97.5 ( 1.00x)
warp_8x8t_8bpc_lsx:                                  43.7 ( 2.23x)

after:
warp_8x8_8bpc_c:                                    109.8 ( 1.00x)
warp_8x8_8bpc_lsx:                                   39.2 ( 2.80x)
warp_8x8t_8bpc_c:                                    97.5 ( 1.00x)
warp_8x8t_8bpc_lsx:                                  37.9 ( 2.57x)

Change-Id: I11728c2c30821b8e2b1c85208710dfe5d1c1269c
2024-09-30 06:37:00 +00:00
jinbo b9e9a0ef79 loongarch: Refine prep_8tap_8bpc_lasx
mct_8tap_regular_w8_h_8bpc_c:                  47.1 ( 1.00x)
mct_8tap_regular_w8_h_8bpc_lsx:                 6.3 ( 7.46x)
mct_8tap_regular_w8_h_8bpc_lasx:                4.4 (10.80x)
mct_8tap_regular_w8_hv_8bpc_c:                118.9 ( 1.00x)
mct_8tap_regular_w8_hv_8bpc_lsx:               19.2 ( 6.20x)
mct_8tap_regular_w8_hv_8bpc_lasx:              13.7 ( 8.69x)
mct_8tap_regular_w8_v_8bpc_c:                  60.3 ( 1.00x)
mct_8tap_regular_w8_v_8bpc_lsx:                 5.4 (11.08x)
mct_8tap_regular_w8_v_8bpc_lasx:                3.3 (18.33x)

Change-Id: I1140f6ffbd738166f2581bc9111ebbdf6f9fa72c
2024-09-30 06:37:00 +00:00
yuanhecai af11a10a4b loongarch: add lasx implementation of wiener filter for 8 bpc
wiener_5tap_8bpc_c:                               18382.0 ( 1.00x)
wiener_5tap_8bpc_lsx:                              4166.9 ( 4.41x)
wiener_5tap_8bpc_lasx:                             2832.2 ( 6.49x)
wiener_7tap_8bpc_c:                               18339.6 ( 1.00x)
wiener_7tap_8bpc_lsx:                              4168.3 ( 4.40x)
wiener_7tap_8bpc_lasx:                             2832.5 ( 6.47x)

Change-Id: I183a8cb008203fb61683b0543d9409d58d141a2e
2024-09-30 06:37:00 +00:00
zhoupeng 90a9549b4e Loongarch: Optimized load_tmvs_c function by LSX
load_tmvs_c:     9702.0 ( 1.00x)
load_tmvs_lsx:   7857.0 ( 1.23x)
2024-09-30 06:37:00 +00:00
pengxu 411fc219a7 Loongarch: Optimized ipred_z1 8bpc functions by LSX
intra_pred_z1_w4_8bpc_c:        16.5 ( 1.00x)
intra_pred_z1_w4_8bpc_lsx:       7.1 ( 2.31x)
intra_pred_z1_w8_8bpc_c:        31.9 ( 1.00x)
intra_pred_z1_w8_8bpc_lsx:      10.0 ( 3.20x)
intra_pred_z1_w16_8bpc_c:       80.1 ( 1.00x)
intra_pred_z1_w16_8bpc_lsx:     20.2 ( 3.96x)
intra_pred_z1_w32_8bpc_c:      185.8 ( 1.00x)
intra_pred_z1_w32_8bpc_lsx:     40.8 ( 4.55x)
intra_pred_z1_w64_8bpc_c:      511.1 ( 1.00x)
intra_pred_z1_w64_8bpc_lsx:     99.0 ( 5.16x)

Change-Id: Id7591e9b87e5b4d7fc3f438397e25dc6ca8e7f91
2024-09-30 06:37:00 +00:00
zhoupeng 7c63bb1b6e Loongarch: Optimized emu_edge_c function by LSX
emu_edge_w4_8bpc_c:        9.0 ( 1.00x)
emu_edge_w4_8bpc_lsx:      6.7 ( 1.34x)
emu_edge_w8_8bpc_c:       12.9 ( 1.00x)
emu_edge_w8_8bpc_lsx:      9.2 ( 1.40x)
emu_edge_w16_8bpc_c:       20.0 ( 1.00x)
emu_edge_w16_8bpc_lsx:     16.3 ( 1.23x)
emu_edge_w32_8bpc_c:       44.6 ( 1.00x)
emu_edge_w32_8bpc_lsx:     33.3 ( 1.34x)
emu_edge_w64_8bpc_c:       79.9 ( 1.00x)
emu_edge_w64_8bpc_lsx:     66.2 ( 1.21x)
emu_edge_w128_8bpc_c:      193.9 ( 1.00x)
emu_edge_w128_8bpc_lsx:    197.8 ( 0.98x)

Change-Id: I180c94d311509740b03793419d5790a931532980
2024-09-30 06:37:00 +00:00
guxiwei e3101ddc8b LoongArch64: Implement checked_call()
Now checkasm calls the test function 'func_new' through
the wrapper 'checked_call' instead of calling it directly.
The purpose of the wrapper is to check if 'func_new' correctly
saves and restores static registers. The wrapper writes dirty
values to the static registers, and after calling 'func_new',
it checks if the dirty values in the static registers remain consistent.

Change-Id: Ia9290b55ab0f2dd87801f6fd175813d3f717d851
2024-09-30 06:37:00 +00:00
pengxu 7f891597bf Loongarch: Optimized ipred_filter 8bpc functions by LSX
intra_pred_filter_w4_8bpc_c:          17.9 ( 1.00x)
intra_pred_filter_w4_8bpc_lsx:         8.9 ( 2.00x)
intra_pred_filter_w8_8bpc_c:          55.3 ( 1.00x)
intra_pred_filter_w8_8bpc_lsx:        23.8 ( 2.33x)
intra_pred_filter_w16_8bpc_c:        109.4 ( 1.00x)
intra_pred_filter_w16_8bpc_lsx:       49.1 ( 2.23x)
intra_pred_filter_w32_8bpc_c:        270.2 ( 1.00x)
intra_pred_filter_w32_8bpc_lsx:      126.1 ( 2.14x)

Change-Id: Ic4c23cb1d54d5f8557c31cdfbbd54f8beaaa32c2
2024-09-30 06:37:00 +00:00
yuanhecai f398bf968c loongarch: Add the some optimization function about itx for 8bpc
1. inv_txfm_add_dct_dct_32x16_8bpc_lsx
2. inv_txfm_add_dct_dct_32x8_8bpc_lsx
3. inv_txfm_add_dct_dct_64x32_8bpc_lsx
4. inv_txfm_add_adst_flipadst_16x16_8bpc_lsx
5. inv_txfm_add_flipadst_adst_16x16_8bpc_lsx
6. inv_txfm_add_adst_adst_16x16_8bpc_lasx

Relative speedup over C code:

inv_txfm_add_32x16_dct_dct_0_8bpc_c:                 78.4 ( 1.00x)
inv_txfm_add_32x16_dct_dct_0_8bpc_lsx:                5.7 (13.81x)
inv_txfm_add_32x16_dct_dct_1_8bpc_c:                710.1 ( 1.00x)
inv_txfm_add_32x16_dct_dct_1_8bpc_lsx:              102.9 ( 6.90x)
inv_txfm_add_32x16_dct_dct_2_8bpc_c:                918.0 ( 1.00x)
inv_txfm_add_32x16_dct_dct_2_8bpc_lsx:              103.2 ( 8.90x)
inv_txfm_add_32x16_dct_dct_3_8bpc_c:                914.3 ( 1.00x)
inv_txfm_add_32x16_dct_dct_3_8bpc_lsx:              103.2 ( 8.86x)
inv_txfm_add_32x16_dct_dct_4_8bpc_c:                929.8 ( 1.00x)
inv_txfm_add_32x16_dct_dct_4_8bpc_lsx:              102.9 ( 9.03x)

inv_txfm_add_32x8_dct_dct_0_8bpc_c:                  39.6 ( 1.00x)
inv_txfm_add_32x8_dct_dct_0_8bpc_lsx:                 3.0 (13.10x)
inv_txfm_add_32x8_dct_dct_1_8bpc_c:                 431.6 ( 1.00x)
inv_txfm_add_32x8_dct_dct_1_8bpc_lsx:                42.6 (10.13x)
inv_txfm_add_32x8_dct_dct_2_8bpc_c:                 431.5 ( 1.00x)
inv_txfm_add_32x8_dct_dct_2_8bpc_lsx:                42.6 (10.13x)
inv_txfm_add_32x8_dct_dct_3_8bpc_c:                 432.0 ( 1.00x)
inv_txfm_add_32x8_dct_dct_3_8bpc_lsx:                42.6 (10.14x)
inv_txfm_add_32x8_dct_dct_4_8bpc_c:                 431.3 ( 1.00x)
inv_txfm_add_32x8_dct_dct_4_8bpc_lsx:                42.6 (10.13x)

inv_txfm_add_64x32_dct_dct_0_8bpc_c:                304.3 ( 1.00x)
inv_txfm_add_64x32_dct_dct_0_8bpc_lsx:               20.3 (15.01x)
inv_txfm_add_64x32_dct_dct_1_8bpc_c:               2743.1 ( 1.00x)
inv_txfm_add_64x32_dct_dct_1_8bpc_lsx:              270.9 (10.13x)
inv_txfm_add_64x32_dct_dct_2_8bpc_c:               3197.1 ( 1.00x)
inv_txfm_add_64x32_dct_dct_2_8bpc_lsx:              327.7 ( 9.76x)
inv_txfm_add_64x32_dct_dct_3_8bpc_c:               3638.3 ( 1.00x)
inv_txfm_add_64x32_dct_dct_3_8bpc_lsx:              383.7 ( 9.48x)
inv_txfm_add_64x32_dct_dct_4_8bpc_c:               4084.5 ( 1.00x)
inv_txfm_add_64x32_dct_dct_4_8bpc_lsx:              441.7 ( 9.25x)

inv_txfm_add_16x16_adst_flipadst_0_8bpc_c:          277.3 ( 1.00x)
inv_txfm_add_16x16_adst_flipadst_0_8bpc_lsx:         58.7 ( 4.72x)
inv_txfm_add_16x16_adst_flipadst_1_8bpc_c:          358.1 ( 1.00x)
inv_txfm_add_16x16_adst_flipadst_1_8bpc_lsx:         58.7 ( 6.10x)
inv_txfm_add_16x16_adst_flipadst_2_8bpc_c:          449.3 ( 1.00x)
inv_txfm_add_16x16_adst_flipadst_2_8bpc_lsx:         58.7 ( 7.65x)

inv_txfm_add_16x16_flipadst_adst_0_8bpc_c:          277.2 ( 1.00x)
inv_txfm_add_16x16_flipadst_adst_0_8bpc_lsx:         58.7 ( 4.72x)
inv_txfm_add_16x16_flipadst_adst_1_8bpc_c:          358.7 ( 1.00x)
inv_txfm_add_16x16_flipadst_adst_1_8bpc_lsx:         58.7 ( 6.11x)
inv_txfm_add_16x16_flipadst_adst_2_8bpc_c:          450.4 ( 1.00x)
inv_txfm_add_16x16_flipadst_adst_2_8bpc_lsx:         58.7 ( 7.67x)

inv_txfm_add_16x16_adst_adst_0_8bpc_c:              253.4 ( 1.00x)
inv_txfm_add_16x16_adst_adst_0_8bpc_lasx:            23.1 (10.98x)
inv_txfm_add_16x16_adst_adst_1_8bpc_c:              325.2 ( 1.00x)
inv_txfm_add_16x16_adst_adst_1_8bpc_lasx:            23.1 (14.08x)
inv_txfm_add_16x16_adst_adst_2_8bpc_c:              405.9 ( 1.00x)
inv_txfm_add_16x16_adst_adst_2_8bpc_lasx:            23.1 (17.56x)

Change-Id: Iaa5419a830c3308e2c4c9ac5b3699c3a971301ed
2024-09-30 06:37:00 +00:00
yuanhecai 13a857d056 loongarch: add lsx implementation of itx_8bpc.add_16x8 series function for 8 bpc
Relative speedup over C code:

inv_txfm_add_16x8_adst_adst_0_8bpc_c:               127.7 ( 1.00x)
inv_txfm_add_16x8_adst_adst_0_8bpc_lsx:              29.6 ( 4.32x)
inv_txfm_add_16x8_adst_adst_1_8bpc_c:               206.6 ( 1.00x)
inv_txfm_add_16x8_adst_adst_1_8bpc_lsx:              29.6 ( 6.98x)
inv_txfm_add_16x8_adst_adst_2_8bpc_c:               206.6 ( 1.00x)
inv_txfm_add_16x8_adst_adst_2_8bpc_lsx:              29.6 ( 6.99x)
inv_txfm_add_16x8_adst_dct_0_8bpc_c:                126.7 ( 1.00x)
inv_txfm_add_16x8_adst_dct_0_8bpc_lsx:               25.8 ( 4.91x)
inv_txfm_add_16x8_adst_dct_1_8bpc_c:                205.1 ( 1.00x)
inv_txfm_add_16x8_adst_dct_1_8bpc_lsx:               25.8 ( 7.94x)
inv_txfm_add_16x8_adst_dct_2_8bpc_c:                205.2 ( 1.00x)
inv_txfm_add_16x8_adst_dct_2_8bpc_lsx:               25.8 ( 7.94x)
inv_txfm_add_16x8_adst_flipadst_0_8bpc_c:           128.3 ( 1.00x)
inv_txfm_add_16x8_adst_flipadst_0_8bpc_lsx:          29.8 ( 4.30x)
inv_txfm_add_16x8_adst_flipadst_1_8bpc_c:           207.2 ( 1.00x)
inv_txfm_add_16x8_adst_flipadst_1_8bpc_lsx:          29.9 ( 6.94x)
inv_txfm_add_16x8_adst_flipadst_2_8bpc_c:           207.1 ( 1.00x)
inv_txfm_add_16x8_adst_flipadst_2_8bpc_lsx:          29.8 ( 6.94x)
inv_txfm_add_16x8_adst_identity_0_8bpc_c:            78.3 ( 1.00x)
inv_txfm_add_16x8_adst_identity_0_8bpc_lsx:          18.6 ( 4.21x)
inv_txfm_add_16x8_adst_identity_1_8bpc_c:           157.1 ( 1.00x)
inv_txfm_add_16x8_adst_identity_1_8bpc_lsx:          18.6 ( 8.45x)
inv_txfm_add_16x8_adst_identity_2_8bpc_c:           157.2 ( 1.00x)
inv_txfm_add_16x8_adst_identity_2_8bpc_lsx:          18.6 ( 8.46x)
inv_txfm_add_16x8_dct_adst_0_8bpc_c:                127.4 ( 1.00x)
inv_txfm_add_16x8_dct_adst_0_8bpc_lsx:               25.4 ( 5.02x)
inv_txfm_add_16x8_dct_adst_1_8bpc_c:                201.2 ( 1.00x)
inv_txfm_add_16x8_dct_adst_1_8bpc_lsx:               25.4 ( 7.93x)
inv_txfm_add_16x8_dct_adst_2_8bpc_c:                201.2 ( 1.00x)
inv_txfm_add_16x8_dct_adst_2_8bpc_lsx:               25.4 ( 7.93x)
inv_txfm_add_16x8_dct_dct_0_8bpc_c:                  21.8 ( 1.00x)
inv_txfm_add_16x8_dct_dct_0_8bpc_lsx:                 2.1 (10.52x)
inv_txfm_add_16x8_dct_dct_1_8bpc_c:                 200.2 ( 1.00x)
inv_txfm_add_16x8_dct_dct_1_8bpc_lsx:                21.6 ( 9.28x)
inv_txfm_add_16x8_dct_dct_2_8bpc_c:                 200.2 ( 1.00x)
inv_txfm_add_16x8_dct_dct_2_8bpc_lsx:                21.6 ( 9.28x)
inv_txfm_add_16x8_dct_flipadst_0_8bpc_c:            127.2 ( 1.00x)
inv_txfm_add_16x8_dct_flipadst_0_8bpc_lsx:           25.6 ( 4.96x)
inv_txfm_add_16x8_dct_flipadst_1_8bpc_c:            201.2 ( 1.00x)
inv_txfm_add_16x8_dct_flipadst_1_8bpc_lsx:           25.7 ( 7.84x)
inv_txfm_add_16x8_dct_flipadst_2_8bpc_c:            201.7 ( 1.00x)
inv_txfm_add_16x8_dct_flipadst_2_8bpc_lsx:           25.7 ( 7.86x)
inv_txfm_add_16x8_dct_identity_0_8bpc_c:             77.3 ( 1.00x)
inv_txfm_add_16x8_dct_identity_0_8bpc_lsx:           14.5 ( 5.35x)
inv_txfm_add_16x8_dct_identity_1_8bpc_c:            151.2 ( 1.00x)
inv_txfm_add_16x8_dct_identity_1_8bpc_lsx:           14.5 (10.46x)
inv_txfm_add_16x8_dct_identity_2_8bpc_c:            151.5 ( 1.00x)
inv_txfm_add_16x8_dct_identity_2_8bpc_lsx:           14.5 (10.48x)
inv_txfm_add_16x8_flipadst_adst_0_8bpc_c:           128.5 ( 1.00x)
inv_txfm_add_16x8_flipadst_adst_0_8bpc_lsx:          29.7 ( 4.32x)
inv_txfm_add_16x8_flipadst_adst_1_8bpc_c:           207.3 ( 1.00x)
inv_txfm_add_16x8_flipadst_adst_1_8bpc_lsx:          29.7 ( 6.97x)
inv_txfm_add_16x8_flipadst_adst_2_8bpc_c:           207.4 ( 1.00x)
inv_txfm_add_16x8_flipadst_adst_2_8bpc_lsx:          29.7 ( 6.98x)
inv_txfm_add_16x8_flipadst_dct_0_8bpc_c:            126.8 ( 1.00x)
inv_txfm_add_16x8_flipadst_dct_0_8bpc_lsx:           25.9 ( 4.90x)
inv_txfm_add_16x8_flipadst_dct_1_8bpc_c:            204.8 ( 1.00x)
inv_txfm_add_16x8_flipadst_dct_1_8bpc_lsx:           25.9 ( 7.92x)
inv_txfm_add_16x8_flipadst_dct_2_8bpc_c:            205.4 ( 1.00x)
inv_txfm_add_16x8_flipadst_dct_2_8bpc_lsx:           25.9 ( 7.94x)
inv_txfm_add_16x8_flipadst_flipadst_0_8bpc_c:       128.6 ( 1.00x)
inv_txfm_add_16x8_flipadst_flipadst_0_8bpc_lsx:      30.0 ( 4.29x)
inv_txfm_add_16x8_flipadst_flipadst_1_8bpc_c:       206.6 ( 1.00x)
inv_txfm_add_16x8_flipadst_flipadst_1_8bpc_lsx:      29.9 ( 6.90x)
inv_txfm_add_16x8_flipadst_flipadst_2_8bpc_c:       206.5 ( 1.00x)
inv_txfm_add_16x8_flipadst_flipadst_2_8bpc_lsx:      29.9 ( 6.90x)
inv_txfm_add_16x8_flipadst_identity_0_8bpc_c:        77.8 ( 1.00x)
inv_txfm_add_16x8_flipadst_identity_0_8bpc_lsx:      18.6 ( 4.18x)
inv_txfm_add_16x8_flipadst_identity_1_8bpc_c:       156.3 ( 1.00x)
inv_txfm_add_16x8_flipadst_identity_1_8bpc_lsx:      18.6 ( 8.40x)
inv_txfm_add_16x8_flipadst_identity_2_8bpc_c:       156.6 ( 1.00x)
inv_txfm_add_16x8_flipadst_identity_2_8bpc_lsx:      18.6 ( 8.42x)
inv_txfm_add_16x8_identity_adst_0_8bpc_c:           120.7 ( 1.00x)
inv_txfm_add_16x8_identity_adst_0_8bpc_lsx:          21.1 ( 5.71x)
inv_txfm_add_16x8_identity_adst_1_8bpc_c:           120.8 ( 1.00x)
inv_txfm_add_16x8_identity_adst_1_8bpc_lsx:          21.1 ( 5.71x)
inv_txfm_add_16x8_identity_adst_2_8bpc_c:           145.5 ( 1.00x)
inv_txfm_add_16x8_identity_adst_2_8bpc_lsx:          21.2 ( 6.88x)
inv_txfm_add_16x8_identity_dct_0_8bpc_c:            119.1 ( 1.00x)
inv_txfm_add_16x8_identity_dct_0_8bpc_lsx:           17.9 ( 6.67x)
inv_txfm_add_16x8_identity_dct_1_8bpc_c:            119.1 ( 1.00x)
inv_txfm_add_16x8_identity_dct_1_8bpc_lsx:           17.9 ( 6.67x)
inv_txfm_add_16x8_identity_dct_2_8bpc_c:            143.8 ( 1.00x)
inv_txfm_add_16x8_identity_dct_2_8bpc_lsx:           17.9 ( 8.06x)
inv_txfm_add_16x8_identity_flipadst_0_8bpc_c:       120.7 ( 1.00x)
inv_txfm_add_16x8_identity_flipadst_0_8bpc_lsx:      21.3 ( 5.66x)
inv_txfm_add_16x8_identity_flipadst_1_8bpc_c:       120.4 ( 1.00x)
inv_txfm_add_16x8_identity_flipadst_1_8bpc_lsx:      21.3 ( 5.65x)
inv_txfm_add_16x8_identity_flipadst_2_8bpc_c:       144.9 ( 1.00x)
inv_txfm_add_16x8_identity_flipadst_2_8bpc_lsx:      21.3 ( 6.80x)
inv_txfm_add_16x8_identity_identity_0_8bpc_c:        70.2 ( 1.00x)
inv_txfm_add_16x8_identity_identity_0_8bpc_lsx:       9.5 ( 7.38x)
inv_txfm_add_16x8_identity_identity_1_8bpc_c:        95.6 ( 1.00x)
inv_txfm_add_16x8_identity_identity_1_8bpc_lsx:       9.5 (10.06x)
inv_txfm_add_16x8_identity_identity_2_8bpc_c:        95.6 ( 1.00x)
inv_txfm_add_16x8_identity_identity_2_8bpc_lsx:       9.5 (10.06x)

Change-Id: If1e274cab0e8441297a1eb44bd86be580f4c8f62
2024-09-30 06:37:00 +00:00
yuanhecai 843f00e531 loongarch: opt inv_txfm_add_adst_dct/dct_dct/identity_identity_16x4_8bpc_lsx
Relative speedup over C code:

inv_txfm_add_16x4_adst_dct_0_8bpc_c:                 61.7 ( 1.00x)
inv_txfm_add_16x4_adst_dct_0_8bpc_lsx:               17.8 ( 3.46x)
inv_txfm_add_16x4_adst_dct_1_8bpc_c:                 96.2 ( 1.00x)
inv_txfm_add_16x4_adst_dct_1_8bpc_lsx:               17.8 ( 5.39x)
inv_txfm_add_16x4_adst_dct_2_8bpc_c:                 96.2 ( 1.00x)
inv_txfm_add_16x4_adst_dct_2_8bpc_lsx:               17.8 ( 5.39x)
inv_txfm_add_16x4_dct_dct_0_8bpc_c:                  10.8 ( 1.00x)
inv_txfm_add_16x4_dct_dct_0_8bpc_lsx:                 0.9 (12.23x)
inv_txfm_add_16x4_dct_dct_1_8bpc_c:                  94.5 ( 1.00x)
inv_txfm_add_16x4_dct_dct_1_8bpc_lsx:                13.6 ( 6.94x)
inv_txfm_add_16x4_dct_dct_2_8bpc_c:                  94.7 ( 1.00x)
inv_txfm_add_16x4_dct_dct_2_8bpc_lsx:                13.6 ( 6.95x)
inv_txfm_add_16x4_identity_identity_0_8bpc_c:        42.1 ( 1.00x)
inv_txfm_add_16x4_identity_identity_0_8bpc_lsx:       5.1 ( 8.21x)
inv_txfm_add_16x4_identity_identity_1_8bpc_c:        53.0 ( 1.00x)
inv_txfm_add_16x4_identity_identity_1_8bpc_lsx:       5.1 (10.35x)
inv_txfm_add_16x4_identity_identity_2_8bpc_c:        53.0 ( 1.00x)
inv_txfm_add_16x4_identity_identity_2_8bpc_lsx:       5.1 (10.35x)

Change-Id: I0be4f77e381da390e300070337fff404dcdcb862
2024-09-30 06:37:00 +00:00
pengxu 083cf424ff Loongarch: Optimized cfl_pred_cfl, cfl_pred_cfl_128, cfl_pred_cfl_top and cfl_pred_cfl_left 8bpc functions by LSX
cfl_pred_cfl_128_w4_8bpc_c:         19.4 ( 1.00x)
cfl_pred_cfl_128_w4_8bpc_lsx:        4.2 ( 4.63x)
cfl_pred_cfl_128_w8_8bpc_c:         66.3 ( 1.00x)
cfl_pred_cfl_128_w8_8bpc_lsx:        7.3 ( 9.11x)
cfl_pred_cfl_128_w16_8bpc_c:       150.1 ( 1.00x)
cfl_pred_cfl_128_w16_8bpc_lsx:      14.4 (10.45x)
cfl_pred_cfl_128_w32_8bpc_c:       403.6 ( 1.00x)
cfl_pred_cfl_128_w32_8bpc_lsx:      34.7 (11.65x)
cfl_pred_cfl_left_w4_8bpc_c:        20.5 ( 1.00x)
cfl_pred_cfl_left_w4_8bpc_lsx:       4.4 ( 4.63x)
cfl_pred_cfl_left_w8_8bpc_c:        67.9 ( 1.00x)
cfl_pred_cfl_left_w8_8bpc_lsx:       7.6 ( 8.94x)
cfl_pred_cfl_left_w16_8bpc_c:      152.0 ( 1.00x)
cfl_pred_cfl_left_w16_8bpc_lsx:     14.6 (10.38x)
cfl_pred_cfl_left_w32_8bpc_c:      405.8 ( 1.00x)
cfl_pred_cfl_left_w32_8bpc_lsx:     35.0 (11.58x)
cfl_pred_cfl_top_w4_8bpc_c:         20.0 ( 1.00x)
cfl_pred_cfl_top_w4_8bpc_lsx:        4.4 ( 4.51x)
cfl_pred_cfl_top_w8_8bpc_c:         67.6 ( 1.00x)
cfl_pred_cfl_top_w8_8bpc_lsx:        7.5 ( 8.99x)
cfl_pred_cfl_top_w16_8bpc_c:       152.5 ( 1.00x)
cfl_pred_cfl_top_w16_8bpc_lsx:      14.6 (10.41x)
cfl_pred_cfl_top_w32_8bpc_c:       408.0 ( 1.00x)
cfl_pred_cfl_top_w32_8bpc_lsx:      35.2 (11.58x)
cfl_pred_cfl_w4_8bpc_c:             21.1 ( 1.00x)
cfl_pred_cfl_w4_8bpc_lsx:            4.8 ( 4.43x)
cfl_pred_cfl_w8_8bpc_c:             68.6 ( 1.00x)
cfl_pred_cfl_w8_8bpc_lsx:            7.9 ( 8.73x)
cfl_pred_cfl_w16_8bpc_c:           154.4 ( 1.00x)
cfl_pred_cfl_w16_8bpc_lsx:          15.0 (10.29x)
cfl_pred_cfl_w32_8bpc_c:           410.3 ( 1.00x)
cfl_pred_cfl_w32_8bpc_lsx:          35.6 (11.54x)

Change-Id: I4ec7cc71483298d28379bfbd824e97a0d74d0c23
2024-09-30 06:37:00 +00:00
pengxu 3f6c845d81 Loongarch: Optimized pal_pred 8bpc functions by LSX
pal_pred_w4_8bpc_c:         3.0 ( 1.00x)
pal_pred_w4_8bpc_lsx:       0.6 ( 5.46x)
pal_pred_w8_8bpc_c:         8.8 ( 1.00x)
pal_pred_w8_8bpc_lsx:       0.9 ( 9.49x)
pal_pred_w16_8bpc_c:       26.0 ( 1.00x)
pal_pred_w16_8bpc_lsx:      1.9 (13.70x)
pal_pred_w32_8bpc_c:       60.6 ( 1.00x)
pal_pred_w32_8bpc_lsx:      4.0 (15.10x)
pal_pred_w64_8bpc_c:      146.9 ( 1.00x)
pal_pred_w64_8bpc_lsx:      9.2 (15.97x)

Change-Id: I5414f096a23b09c3a512e727b93fa22104d141f9
2024-09-30 06:37:00 +00:00
jinbo b26f315d00 loongarch: Add prep_8tap_8bpc_lsx
mct_8tap_regular_w4_0_8bpc_c:                        3.7 ( 1.00x)
mct_8tap_regular_w4_0_8bpc_lsx:                      0.9 ( 4.21x)
mct_8tap_regular_w4_h_8bpc_c:                       15.7 ( 1.00x)
mct_8tap_regular_w4_h_8bpc_lsx:                      1.7 ( 9.24x)
mct_8tap_regular_w4_hv_8bpc_c:                      44.1 ( 1.00x)
mct_8tap_regular_w4_hv_8bpc_lsx:                     6.3 ( 6.96x)
mct_8tap_regular_w4_v_8bpc_c:                       19.8 ( 1.00x)
mct_8tap_regular_w4_v_8bpc_lsx:                      2.4 ( 8.21x)
mct_8tap_regular_w8_0_8bpc_c:                       10.5 ( 1.00x)
mct_8tap_regular_w8_0_8bpc_lsx:                      1.3 ( 8.27x)
mct_8tap_regular_w8_h_8bpc_c:                       47.2 ( 1.00x)
mct_8tap_regular_w8_h_8bpc_lsx:                      6.2 ( 7.61x)
mct_8tap_regular_w8_hv_8bpc_c:                     119.5 ( 1.00x)
mct_8tap_regular_w8_hv_8bpc_lsx:                    18.9 ( 6.32x)
mct_8tap_regular_w8_v_8bpc_c:                       60.5 ( 1.00x)
mct_8tap_regular_w8_v_8bpc_lsx:                      5.4 (11.12x)
mct_8tap_regular_w16_0_8bpc_c:                      28.8 ( 1.00x)
mct_8tap_regular_w16_0_8bpc_lsx:                     2.8 (10.32x)
mct_8tap_regular_w16_h_8bpc_c:                     151.9 ( 1.00x)
mct_8tap_regular_w16_h_8bpc_lsx:                    19.8 ( 7.67x)
mct_8tap_regular_w16_hv_8bpc_c:                    357.5 ( 1.00x)
mct_8tap_regular_w16_hv_8bpc_lsx:                   57.6 ( 6.21x)
mct_8tap_regular_w16_v_8bpc_c:                     195.6 ( 1.00x)
mct_8tap_regular_w16_v_8bpc_lsx:                    16.9 (11.61x)
mct_8tap_regular_w32_0_8bpc_c:                     104.6 ( 1.00x)
mct_8tap_regular_w32_0_8bpc_lsx:                    11.6 ( 9.03x)
mct_8tap_regular_w32_h_8bpc_c:                     596.3 ( 1.00x)
mct_8tap_regular_w32_h_8bpc_lsx:                    77.8 ( 7.67x)
mct_8tap_regular_w32_hv_8bpc_c:                   1329.0 ( 1.00x)
mct_8tap_regular_w32_hv_8bpc_lsx:                  217.9 ( 6.10x)
mct_8tap_regular_w32_v_8bpc_c:                     771.0 ( 1.00x)
mct_8tap_regular_w32_v_8bpc_lsx:                    65.7 (11.73x)
mct_8tap_regular_w64_0_8bpc_c:                     242.0 ( 1.00x)
mct_8tap_regular_w64_0_8bpc_lsx:                    27.0 ( 8.95x)
mct_8tap_regular_w64_h_8bpc_c:                    1455.9 ( 1.00x)
mct_8tap_regular_w64_h_8bpc_lsx:                   186.9 ( 7.79x)
mct_8tap_regular_w64_hv_8bpc_c:                   3221.7 ( 1.00x)
mct_8tap_regular_w64_hv_8bpc_lsx:                  521.8 ( 6.17x)
mct_8tap_regular_w64_v_8bpc_c:                    1836.1 ( 1.00x)
mct_8tap_regular_w64_v_8bpc_lsx:                   158.2 (11.61x)
mct_8tap_regular_w128_0_8bpc_c:                    629.0 ( 1.00x)
mct_8tap_regular_w128_0_8bpc_lsx:                   66.3 ( 9.49x)
mct_8tap_regular_w128_h_8bpc_c:                   3617.5 ( 1.00x)
mct_8tap_regular_w128_h_8bpc_lsx:                  463.6 ( 7.80x)
mct_8tap_regular_w128_hv_8bpc_c:                  7881.7 ( 1.00x)
mct_8tap_regular_w128_hv_8bpc_lsx:                1290.3 ( 6.11x)
mct_8tap_regular_w128_v_8bpc_c:                   4552.9 ( 1.00x)
mct_8tap_regular_w128_v_8bpc_lsx:                  391.1 (11.64x)

Change-Id: I8c6046e4bd6c1fb19d5712234abece0355fb77fa
2024-09-30 06:37:00 +00:00
zhoupeng ce45ebdef4 Loongarch: Optimized blenc_h_c function by LSX/LASX
blend_h_w2_8bpc_c:                                   3.8 ( 1.00x)
blend_h_w2_8bpc_lsx:                                 1.9 ( 1.98x)
blend_h_w2_8bpc_lasx:                                1.9 ( 1.98x)
blend_h_w4_8bpc_c:                                   6.4 ( 1.00x)
blend_h_w4_8bpc_lsx:                                 1.8 ( 3.49x)
blend_h_w4_8bpc_lasx:                                1.8 ( 3.49x)
blend_h_w8_8bpc_c:                                  11.6 ( 1.00x)
blend_h_w8_8bpc_lsx:                                 1.8 ( 6.45x)
blend_h_w8_8bpc_lasx:                                1.8 ( 6.48x)
blend_h_w16_8bpc_c:                                 21.5 ( 1.00x)
blend_h_w16_8bpc_lsx:                                2.1 (10.47x)
blend_h_w16_8bpc_lasx:                               2.1 (10.48x)
blend_h_w32_8bpc_c:                                 41.9 ( 1.00x)
blend_h_w32_8bpc_lsx:                                3.8 (11.08x)
blend_h_w32_8bpc_lasx:                               3.9 (10.67x)
blend_h_w64_8bpc_c:                                 82.0 ( 1.00x)
blend_h_w64_8bpc_lsx:                                6.9 (11.89x)
blend_h_w64_8bpc_lasx:                               4.6 (17.93x)
blend_h_w128_8bpc_c:                               202.3 ( 1.00x)
blend_h_w128_8bpc_lsx:                              16.4 (12.30x)
blend_h_w128_8bpc_lasx:                             11.4 (17.77x)

Change-Id: I6d6599ccbaba8a62a629c4a52254b2369dba60f6
2024-09-30 06:37:00 +00:00
zhoupeng 5319278dbe Loongarch: Optimized blend_c/blenc_v_c function by LSX
blend_v_w2_8bpc_c:                                   5.7 ( 1.00x)
blend_v_w2_8bpc_lsx:                                 3.6 ( 1.60x)
blend_v_w4_8bpc_c:                                  22.8 ( 1.00x)
blend_v_w4_8bpc_lsx:                                 7.1 ( 3.20x)
blend_v_w8_8bpc_c:                                  40.2 ( 1.00x)
blend_v_w8_8bpc_lsx:                                 7.1 ( 5.63x)
blend_v_w16_8bpc_c:                                 74.6 ( 1.00x)
blend_v_w16_8bpc_lsx:                                8.1 ( 9.26x)
blend_v_w32_8bpc_c:                                144.0 ( 1.00x)
blend_v_w32_8bpc_lsx:                               13.3 (10.83x)
blend_w4_8bpc_c:                                     4.9 ( 1.00x)
blend_w4_8bpc_lsx:                                   1.9 ( 2.49x)
blend_w8_8bpc_c:                                    14.1 ( 1.00x)
blend_w8_8bpc_lsx:                                   3.2 ( 4.37x)
blend_w16_8bpc_c:                                   51.5 ( 1.00x)
blend_w16_8bpc_lsx:                                  7.9 ( 6.51x)
blend_w32_8bpc_c:                                  127.5 ( 1.00x)
blend_w32_8bpc_lsx:                                 19.6 ( 6.52x)

Change-Id: I95e2dbc1f0735688f5473687f1a7e8d37ffbe417
2024-09-30 06:37:00 +00:00
pengxu 0b9c756f42 Loongarch: Optimized ipred_smooth, ipred_smooth_h and ipred_smooth_v 8bpc functions by LSX
intra_pred_smooth_h_w4_8bpc_c:         7.3 ( 1.00x)
intra_pred_smooth_h_w4_8bpc_lsx:       3.1 ( 2.36x)
intra_pred_smooth_h_w8_8bpc_c:        21.3 ( 1.00x)
intra_pred_smooth_h_w8_8bpc_lsx:       4.5 ( 4.71x)
intra_pred_smooth_h_w16_8bpc_c:       66.3 ( 1.00x)
intra_pred_smooth_h_w16_8bpc_lsx:     13.4 ( 4.96x)
intra_pred_smooth_h_w32_8bpc_c:      160.0 ( 1.00x)
intra_pred_smooth_h_w32_8bpc_lsx:     29.3 ( 5.46x)
intra_pred_smooth_h_w64_8bpc_c:      400.2 ( 1.00x)
intra_pred_smooth_h_w64_8bpc_lsx:     68.3 ( 5.86x)
intra_pred_smooth_v_w4_8bpc_c:         6.6 ( 1.00x)
intra_pred_smooth_v_w4_8bpc_lsx:       3.1 ( 2.10x)
intra_pred_smooth_v_w8_8bpc_c:        19.3 ( 1.00x)
intra_pred_smooth_v_w8_8bpc_lsx:       4.9 ( 3.95x)
intra_pred_smooth_v_w16_8bpc_c:       58.6 ( 1.00x)
intra_pred_smooth_v_w16_8bpc_lsx:     24.0 ( 2.44x)
intra_pred_smooth_v_w32_8bpc_c:      139.4 ( 1.00x)
intra_pred_smooth_v_w32_8bpc_lsx:     27.0 ( 5.17x)
intra_pred_smooth_v_w64_8bpc_c:      344.8 ( 1.00x)
intra_pred_smooth_v_w64_8bpc_lsx:     70.8 ( 4.87x)
intra_pred_smooth_w4_8bpc_c:          10.2 ( 1.00x)
intra_pred_smooth_w4_8bpc_lsx:         7.9 ( 1.30x)
intra_pred_smooth_w8_8bpc_c:          30.3 ( 1.00x)
intra_pred_smooth_w8_8bpc_lsx:        20.0 ( 1.51x)
intra_pred_smooth_w16_8bpc_c:         96.3 ( 1.00x)
intra_pred_smooth_w16_8bpc_lsx:       58.3 ( 1.65x)
intra_pred_smooth_w32_8bpc_c:        231.1 ( 1.00x)
intra_pred_smooth_w32_8bpc_lsx:      134.3 ( 1.72x)
intra_pred_smooth_w64_8bpc_c:        571.5 ( 1.00x)
intra_pred_smooth_w64_8bpc_lsx:      326.5 ( 1.75x)

Change-Id: I22b6c2dcf27c5393bba374b4fbe8879c0463f828
2024-09-30 06:37:00 +00:00
pengxu 7463c2af64 Loongarch: Optimized ipred_paeth 8bpc function by LSX
intra_pred_paeth_w4_8bpc_c:          12.3 ( 1.00x)
intra_pred_paeth_w4_8bpc_lsx:         3.9 ( 3.12x)
intra_pred_paeth_w8_8bpc_c:          39.7 ( 1.00x)
intra_pred_paeth_w8_8bpc_lsx:         6.4 ( 6.20x)
intra_pred_paeth_w16_8bpc_c:        133.6 ( 1.00x)
intra_pred_paeth_w16_8bpc_lsx:       17.0 ( 7.85x)
intra_pred_paeth_w32_8bpc_c:        342.8 ( 1.00x)
intra_pred_paeth_w32_8bpc_lsx:       52.7 ( 6.50x)
intra_pred_paeth_w64_8bpc_c:        903.8 ( 1.00x)
intra_pred_paeth_w64_8bpc_lsx:      107.3 ( 8.42x)

Change-Id: I457bdb24fdd6b5400ec030bffbdd40c79d8165c1
2024-09-30 06:37:00 +00:00
pengxu 3e9d80d831 Loongarch: Optimized ipred_h and ipred_v 8bpc function by LSX
intra_pred_h_w4_8bpc_c:               4.3 ( 1.00x)
intra_pred_h_w4_8bpc_lsx:             3.5 ( 1.21x)
intra_pred_h_w8_8bpc_c:               5.7 ( 1.00x)
intra_pred_h_w8_8bpc_lsx:             5.1 ( 1.11x)
intra_pred_h_w16_8bpc_c:             13.2 ( 1.00x)
intra_pred_h_w16_8bpc_lsx:            7.1 ( 1.86x)
intra_pred_h_w32_8bpc_c:             12.4 ( 1.00x)
intra_pred_h_w32_8bpc_lsx:            6.3 ( 1.96x)
intra_pred_h_w64_8bpc_c:             25.9 ( 1.00x)
intra_pred_h_w64_8bpc_lsx:            5.8 ( 4.44x)
intra_pred_v_w4_8bpc_c:               4.6 ( 1.00x)
intra_pred_v_w4_8bpc_lsx:             2.5 ( 1.85x)
intra_pred_v_w8_8bpc_c:               6.9 ( 1.00x)
intra_pred_v_w8_8bpc_lsx:             4.5 ( 1.53x)
intra_pred_v_w16_8bpc_c:             13.3 ( 1.00x)
intra_pred_v_w16_8bpc_lsx:            5.2 ( 2.56x)
intra_pred_v_w32_8bpc_c:             16.1 ( 1.00x)
intra_pred_v_w32_8bpc_lsx:            5.1 ( 3.13x)
intra_pred_v_w64_8bpc_c:             21.7 ( 1.00x)
intra_pred_v_w64_8bpc_lsx:            7.7 ( 2.80x)

Change-Id: I51b3dd13877315b9c1c64590c19f1ad38bfc4bdf
2024-09-30 06:37:00 +00:00
pengxu 2a9cbcc2f3 Loongarch: Optimized ipred_dc,ipred_dc_128 8bpc,ipred_dc_left and ipred_dc_top functions by LSX
intra_pred_dc_w4_8bpc_c:              2.1 ( 1.00x)
intra_pred_dc_w4_8bpc_lsx:            1.3 ( 1.54x)
intra_pred_dc_w8_8bpc_c:              3.6 ( 1.00x)
intra_pred_dc_w8_8bpc_lsx:            3.7 ( 0.97x)
intra_pred_dc_w16_8bpc_c:             6.9 ( 1.00x)
intra_pred_dc_w16_8bpc_lsx:           7.8 ( 0.88x)
intra_pred_dc_w32_8bpc_c:            14.1 ( 1.00x)
intra_pred_dc_w32_8bpc_lsx:           7.1 ( 1.97x)
intra_pred_dc_w64_8bpc_c:            25.3 ( 1.00x)
intra_pred_dc_w64_8bpc_lsx:           7.4 ( 3.41x)
intra_pred_dc_128_w4_8bpc_c:          0.6 ( 1.00x)
intra_pred_dc_128_w4_8bpc_lsx:        0.8 ( 0.76x)
intra_pred_dc_128_w8_8bpc_c:          1.4 ( 1.00x)
intra_pred_dc_128_w8_8bpc_lsx:        3.2 ( 0.45x)
intra_pred_dc_128_w16_8bpc_c:         3.4 ( 1.00x)
intra_pred_dc_128_w16_8bpc_lsx:       7.3 ( 0.47x)
intra_pred_dc_128_w32_8bpc_c:         8.8 ( 1.00x)
intra_pred_dc_128_w32_8bpc_lsx:       6.4 ( 1.38x)
intra_pred_dc_128_w64_8bpc_c:        17.0 ( 1.00x)
intra_pred_dc_128_w64_8bpc_lsx:       6.2 ( 2.74x)
intra_pred_dc_left_w4_8bpc_c:         1.1 ( 1.00x)
intra_pred_dc_left_w4_8bpc_lsx:       1.1 ( 1.00x)
intra_pred_dc_left_w8_8bpc_c:         2.1 ( 1.00x)
intra_pred_dc_left_w8_8bpc_lsx:       3.4 ( 0.64x)
intra_pred_dc_left_w16_8bpc_c:        4.6 ( 1.00x)
intra_pred_dc_left_w16_8bpc_lsx:      7.5 ( 0.62x)
intra_pred_dc_left_w32_8bpc_c:       10.3 ( 1.00x)
intra_pred_dc_left_w32_8bpc_lsx:      7.8 ( 1.32x)
intra_pred_dc_left_w64_8bpc_c:       18.7 ( 1.00x)
intra_pred_dc_left_w64_8bpc_lsx:      6.6 ( 2.83x)
intra_pred_dc_top_w4_8bpc_c:          0.9 ( 1.00x)
intra_pred_dc_top_w4_8bpc_lsx:        0.8 ( 1.10x)
intra_pred_dc_top_w8_8bpc_c:          1.9 ( 1.00x)
intra_pred_dc_top_w8_8bpc_lsx:        2.8 ( 0.67x)
intra_pred_dc_top_w16_8bpc_c:         4.2 ( 1.00x)
intra_pred_dc_top_w16_8bpc_lsx:       5.5 ( 0.77x)
intra_pred_dc_top_w32_8bpc_c:        10.4 ( 1.00x)
intra_pred_dc_top_w32_8bpc_lsx:       6.7 ( 1.54x)
intra_pred_dc_top_w64_8bpc_c:        19.9 ( 1.00x)
intra_pred_dc_top_w64_8bpc_lsx:       6.9 ( 2.87x)

Change-Id: Ib5349e2430302da0424a474ce0fedc457439c761
2024-09-30 06:37:00 +00:00
pengxu 62c47f3558 Loongarch: Optimized cdef_filter_block 4x4,4x8,8x8 8bpc function by LSX
cdef_filter_4x4_01_8bpc_c:      420.8 ( 1.00x)
cdef_filter_4x4_01_8bpc_lsx:    117.2 ( 3.59x)
cdef_filter_4x4_10_8bpc_c:      265.8 ( 1.00x)
cdef_filter_4x4_10_8bpc_lsx:     98.9 ( 2.69x)
cdef_filter_4x4_11_8bpc_c:     1036.2 ( 1.00x)
cdef_filter_4x4_11_8bpc_lsx:    169.6 ( 6.11x)
cdef_filter_4x8_01_8bpc_c:      802.6 ( 1.00x)
cdef_filter_4x8_01_8bpc_lsx:    206.1 ( 3.89x)
cdef_filter_4x8_10_8bpc_c:      489.1 ( 1.00x)
cdef_filter_4x8_10_8bpc_lsx:    167.4 ( 2.92x)
cdef_filter_4x8_11_8bpc_c:     2028.9 ( 1.00x)
cdef_filter_4x8_11_8bpc_lsx:    309.4 ( 6.56x)
cdef_filter_8x8_01_8bpc_c:     1562.2 ( 1.00x)
cdef_filter_8x8_01_8bpc_lsx:    295.3 ( 5.29x)
cdef_filter_8x8_10_8bpc_c:      949.4 ( 1.00x)
cdef_filter_8x8_10_8bpc_lsx:    207.6 ( 4.57x)
cdef_filter_8x8_11_8bpc_c:     4009.6 ( 1.00x)
cdef_filter_8x8_11_8bpc_lsx:    466.8 ( 8.59x)

Change-Id: I8cd43426a27055e18c44a7701fa50f8835c712be
2024-09-30 06:37:00 +00:00
jinbo fa7b72d082 Refine mc_put_8tap
Performance speedup over lsx is around 68%~156%.

Change-Id: I0b39cd0e05e3cbd84fded121d29a91ea2a620f03
2024-09-30 06:37:00 +00:00
guxiwei 02309b9f60 msac: Add msac_decode_bool_equia_lsx and msac_decode_hi_tok_lsx
The performance data is as follows:
msac_decode_bool_equi_c:             0.4 ( 1.00x)
msac_decode_bool_equi_lsx:           0.3 ( 1.07x)
msac_decode_hi_tok_c:                1.8 ( 1.00x)
msac_decode_hi_tok_lsx:              1.4 ( 1.27x)

Change-Id: Ic2f2678cf699bb22c579424af71ae2603e228482
2024-09-30 06:37:00 +00:00
pengxu 2154425f70 Loongarch: Optimized cdef_find_dir_8bpc function by LSX
cdef_dir_8bpc_c:                 28.8 ( 1.00x)
cdef_dir_8bpc_lsx:               19.1 ( 1.51x)

Change-Id: Ic7c1f32c5b1733b011f4c448cffc93f745b564f5
2024-09-30 06:37:00 +00:00
yuanhecai f6ffdc90b3 loongarch: opt inv_txfm_add_identity_identity_8x32_8bpc_lsx
Relative speedup over C code:

inv_txfm_add_8x32_identity_identity_0_8bpc_c:       126.1 ( 1.00x)
inv_txfm_add_8x32_identity_identity_0_8bpc_lsx:       1.6 (78.59x)
inv_txfm_add_8x32_identity_identity_1_8bpc_c:       136.9 ( 1.00x)
inv_txfm_add_8x32_identity_identity_1_8bpc_lsx:       1.6 (85.31x)
inv_txfm_add_8x32_identity_identity_2_8bpc_c:       148.0 ( 1.00x)
inv_txfm_add_8x32_identity_identity_2_8bpc_lsx:       3.3 (45.47x)
inv_txfm_add_8x32_identity_identity_3_8bpc_c:       159.4 ( 1.00x)
inv_txfm_add_8x32_identity_identity_3_8bpc_lsx:       4.9 (32.78x)
inv_txfm_add_8x32_identity_identity_4_8bpc_c:       170.2 ( 1.00x)
inv_txfm_add_8x32_identity_identity_4_8bpc_lsx:       6.5 (26.17x)

Change-Id: Iabda6efcd8a17d26a205f90757dfea85af48848f
2024-09-30 06:37:00 +00:00
yuanhecai 5de878a4e1 loongarch: Minor improvement on identity4*, identity8* and dct32*
1. remove the code about identity8 in the 4x8/8x8/8x16 series
2. modify the code of the function dct_dct_8x32/32x32/64x64
3. modify the code about identity4 in the 4x4/4x8/8x4 series

After the modification, function performance has been improved by 20%

Change-Id: I1bc2e0fb25e508faf9fc220333460a99be3f5e49
2024-09-30 06:37:00 +00:00
yuanhecai 2fc656604b loongarch: add lsx implementation of itx_8bpc.add_8x16 series function for 8 bpc
Relative speedup over C code:

inv_txfm_add_8x16_adst_adst_0_8bpc_c: 208.1
inv_txfm_add_8x16_adst_adst_0_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_adst_1_8bpc_c: 208.4
inv_txfm_add_8x16_adst_adst_1_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_adst_2_8bpc_c: 208.1
inv_txfm_add_8x16_adst_adst_2_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_dct_0_8bpc_c: 204.0
inv_txfm_add_8x16_adst_dct_0_8bpc_lsx: 27.2
inv_txfm_add_8x16_adst_dct_1_8bpc_c: 204.0
inv_txfm_add_8x16_adst_dct_1_8bpc_lsx: 27.2
inv_txfm_add_8x16_adst_dct_2_8bpc_c: 204.0
inv_txfm_add_8x16_adst_dct_2_8bpc_lsx: 27.2
inv_txfm_add_8x16_adst_flipadst_0_8bpc_c: 207.9
inv_txfm_add_8x16_adst_flipadst_0_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_flipadst_1_8bpc_c: 208.3
inv_txfm_add_8x16_adst_flipadst_1_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_flipadst_2_8bpc_c: 208.6
inv_txfm_add_8x16_adst_flipadst_2_8bpc_lsx: 31.3
inv_txfm_add_8x16_adst_identity_0_8bpc_c: 146.6
inv_txfm_add_8x16_adst_identity_0_8bpc_lsx: 21.8
inv_txfm_add_8x16_adst_identity_1_8bpc_c: 146.6
inv_txfm_add_8x16_adst_identity_1_8bpc_lsx: 21.8
inv_txfm_add_8x16_adst_identity_2_8bpc_c: 146.6
inv_txfm_add_8x16_adst_identity_2_8bpc_lsx: 21.8
inv_txfm_add_8x16_dct_adst_0_8bpc_c: 204.8
inv_txfm_add_8x16_dct_adst_0_8bpc_lsx: 26.2
inv_txfm_add_8x16_dct_adst_1_8bpc_c: 204.8
inv_txfm_add_8x16_dct_adst_1_8bpc_lsx: 26.1
inv_txfm_add_8x16_dct_adst_2_8bpc_c: 204.8
inv_txfm_add_8x16_dct_adst_2_8bpc_lsx: 26.2
inv_txfm_add_8x16_dct_dct_0_8bpc_c: 23.1
inv_txfm_add_8x16_dct_dct_0_8bpc_lsx: 2.3
inv_txfm_add_8x16_dct_dct_1_8bpc_c: 200.8
inv_txfm_add_8x16_dct_dct_1_8bpc_lsx: 21.9
inv_txfm_add_8x16_dct_dct_2_8bpc_c: 200.7
inv_txfm_add_8x16_dct_dct_2_8bpc_lsx: 21.9
inv_txfm_add_8x16_dct_flipadst_0_8bpc_c: 204.6
inv_txfm_add_8x16_dct_flipadst_0_8bpc_lsx: 26.3
inv_txfm_add_8x16_dct_flipadst_1_8bpc_c: 204.6
inv_txfm_add_8x16_dct_flipadst_1_8bpc_lsx: 26.3
inv_txfm_add_8x16_dct_flipadst_2_8bpc_c: 204.6
inv_txfm_add_8x16_dct_flipadst_2_8bpc_lsx: 26.3
inv_txfm_add_8x16_dct_identity_0_8bpc_c: 143.2
inv_txfm_add_8x16_dct_identity_0_8bpc_lsx: 16.7
inv_txfm_add_8x16_dct_identity_1_8bpc_c: 142.9
inv_txfm_add_8x16_dct_identity_1_8bpc_lsx: 16.7
inv_txfm_add_8x16_dct_identity_2_8bpc_c: 143.5
inv_txfm_add_8x16_dct_identity_2_8bpc_lsx: 16.7
inv_txfm_add_8x16_flipadst_adst_0_8bpc_c: 206.5
inv_txfm_add_8x16_flipadst_adst_0_8bpc_lsx: 31.3
inv_txfm_add_8x16_flipadst_adst_1_8bpc_c: 206.5
inv_txfm_add_8x16_flipadst_adst_1_8bpc_lsx: 31.3
inv_txfm_add_8x16_flipadst_adst_2_8bpc_c: 206.5
inv_txfm_add_8x16_flipadst_adst_2_8bpc_lsx: 31.3
inv_txfm_add_8x16_flipadst_dct_0_8bpc_c: 202.5
inv_txfm_add_8x16_flipadst_dct_0_8bpc_lsx: 26.8
inv_txfm_add_8x16_flipadst_dct_1_8bpc_c: 202.3
inv_txfm_add_8x16_flipadst_dct_1_8bpc_lsx: 26.8
inv_txfm_add_8x16_flipadst_dct_2_8bpc_c: 202.3
inv_txfm_add_8x16_flipadst_dct_2_8bpc_lsx: 26.8
inv_txfm_add_8x16_flipadst_flipadst_0_8bpc_c: 206.3
inv_txfm_add_8x16_flipadst_flipadst_0_8bpc_lsx: 31.3
inv_txfm_add_8x16_flipadst_flipadst_1_8bpc_c: 206.3
inv_txfm_add_8x16_flipadst_flipadst_1_8bpc_lsx: 31.3
inv_txfm_add_8x16_flipadst_flipadst_2_8bpc_c: 206.3
inv_txfm_add_8x16_flipadst_flipadst_2_8bpc_lsx: 31.3
inv_txfm_add_8x16_identity_adst_0_8bpc_c: 160.7
inv_txfm_add_8x16_identity_adst_0_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_adst_1_8bpc_c: 160.4
inv_txfm_add_8x16_identity_adst_1_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_adst_2_8bpc_c: 160.1
inv_txfm_add_8x16_identity_adst_2_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_dct_0_8bpc_c: 157.9
inv_txfm_add_8x16_identity_dct_0_8bpc_lsx: 17.7
inv_txfm_add_8x16_identity_dct_1_8bpc_c: 156.5
inv_txfm_add_8x16_identity_dct_1_8bpc_lsx: 17.7
inv_txfm_add_8x16_identity_dct_2_8bpc_c: 156.8
inv_txfm_add_8x16_identity_dct_2_8bpc_lsx: 17.7
inv_txfm_add_8x16_identity_flipadst_0_8bpc_c: 159.9
inv_txfm_add_8x16_identity_flipadst_0_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_flipadst_1_8bpc_c: 159.9
inv_txfm_add_8x16_identity_flipadst_1_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_flipadst_2_8bpc_c: 160.0
inv_txfm_add_8x16_identity_flipadst_2_8bpc_lsx: 21.8
inv_txfm_add_8x16_identity_identity_0_8bpc_c: 98.3
inv_txfm_add_8x16_identity_identity_0_8bpc_lsx: 12.3
inv_txfm_add_8x16_identity_identity_1_8bpc_c: 98.0
inv_txfm_add_8x16_identity_identity_1_8bpc_lsx: 12.3
inv_txfm_add_8x16_identity_identity_2_8bpc_c: 98.1
inv_txfm_add_8x16_identity_identity_2_8bpc_lsx: 12.3

Change-Id: Ida8d71e4eff782b9f81e0ad426eaa078b68528cf
2024-09-30 06:37:00 +00:00
yuanhecai 643ae52baa loongarch: add lsx implementation of itx_8bpc.add_4x16 series function for 8 bpc
Relative speedup over C code:

inv_txfm_add_4x16_adst_adst_0_8bpc_c: 91.1
inv_txfm_add_4x16_adst_adst_0_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_adst_1_8bpc_c: 91.1
inv_txfm_add_4x16_adst_adst_1_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_adst_2_8bpc_c: 91.1
inv_txfm_add_4x16_adst_adst_2_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_dct_0_8bpc_c: 89.5
inv_txfm_add_4x16_adst_dct_0_8bpc_lsx: 14.3
inv_txfm_add_4x16_adst_dct_1_8bpc_c: 89.5
inv_txfm_add_4x16_adst_dct_1_8bpc_lsx: 14.3
inv_txfm_add_4x16_adst_dct_2_8bpc_c: 89.5
inv_txfm_add_4x16_adst_dct_2_8bpc_lsx: 14.3
inv_txfm_add_4x16_adst_flipadst_0_8bpc_c: 91.8
inv_txfm_add_4x16_adst_flipadst_0_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_flipadst_1_8bpc_c: 91.7
inv_txfm_add_4x16_adst_flipadst_1_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_flipadst_2_8bpc_c: 91.8
inv_txfm_add_4x16_adst_flipadst_2_8bpc_lsx: 18.2
inv_txfm_add_4x16_adst_identity_0_8bpc_c: 60.5
inv_txfm_add_4x16_adst_identity_0_8bpc_lsx: 6.3
inv_txfm_add_4x16_adst_identity_1_8bpc_c: 60.5
inv_txfm_add_4x16_adst_identity_1_8bpc_lsx: 6.3
inv_txfm_add_4x16_adst_identity_2_8bpc_c: 60.5
inv_txfm_add_4x16_adst_identity_2_8bpc_lsx: 6.3
inv_txfm_add_4x16_dct_adst_0_8bpc_c: 92.7
inv_txfm_add_4x16_dct_adst_0_8bpc_lsx: 18.4
inv_txfm_add_4x16_dct_adst_1_8bpc_c: 92.7
inv_txfm_add_4x16_dct_adst_1_8bpc_lsx: 18.4
inv_txfm_add_4x16_dct_adst_2_8bpc_c: 92.7
inv_txfm_add_4x16_dct_adst_2_8bpc_lsx: 18.4
inv_txfm_add_4x16_dct_dct_0_8bpc_c: 13.7
inv_txfm_add_4x16_dct_dct_0_8bpc_lsx: 1.9
inv_txfm_add_4x16_dct_dct_1_8bpc_c: 90.6
inv_txfm_add_4x16_dct_dct_1_8bpc_lsx: 14.5
inv_txfm_add_4x16_dct_dct_2_8bpc_c: 90.6
inv_txfm_add_4x16_dct_dct_2_8bpc_lsx: 14.5
inv_txfm_add_4x16_dct_flipadst_0_8bpc_c: 93.3
inv_txfm_add_4x16_dct_flipadst_0_8bpc_lsx: 18.6
inv_txfm_add_4x16_dct_flipadst_1_8bpc_c: 93.4
inv_txfm_add_4x16_dct_flipadst_1_8bpc_lsx: 18.6
inv_txfm_add_4x16_dct_flipadst_2_8bpc_c: 93.4
inv_txfm_add_4x16_dct_flipadst_2_8bpc_lsx: 18.6
inv_txfm_add_4x16_dct_identity_0_8bpc_c: 62.1
inv_txfm_add_4x16_dct_identity_0_8bpc_lsx: 6.5
inv_txfm_add_4x16_dct_identity_1_8bpc_c: 62.1
inv_txfm_add_4x16_dct_identity_1_8bpc_lsx: 6.5
inv_txfm_add_4x16_dct_identity_2_8bpc_c: 62.1
inv_txfm_add_4x16_dct_identity_2_8bpc_lsx: 6.5
inv_txfm_add_4x16_flipadst_adst_0_8bpc_c: 92.2
inv_txfm_add_4x16_flipadst_adst_0_8bpc_lsx: 18.1
inv_txfm_add_4x16_flipadst_adst_1_8bpc_c: 92.3
inv_txfm_add_4x16_flipadst_adst_1_8bpc_lsx: 18.1
inv_txfm_add_4x16_flipadst_adst_2_8bpc_c: 92.2
inv_txfm_add_4x16_flipadst_adst_2_8bpc_lsx: 18.1
inv_txfm_add_4x16_flipadst_dct_0_8bpc_c: 90.6
inv_txfm_add_4x16_flipadst_dct_0_8bpc_lsx: 14.3
inv_txfm_add_4x16_flipadst_dct_1_8bpc_c: 90.6
inv_txfm_add_4x16_flipadst_dct_1_8bpc_lsx: 14.3
inv_txfm_add_4x16_flipadst_dct_2_8bpc_c: 90.6
inv_txfm_add_4x16_flipadst_dct_2_8bpc_lsx: 14.3
inv_txfm_add_4x16_flipadst_flipadst_0_8bpc_c: 92.9
inv_txfm_add_4x16_flipadst_flipadst_0_8bpc_lsx: 18.2
inv_txfm_add_4x16_flipadst_flipadst_1_8bpc_c: 92.9
inv_txfm_add_4x16_flipadst_flipadst_1_8bpc_lsx: 18.2
inv_txfm_add_4x16_flipadst_flipadst_2_8bpc_c: 92.9
inv_txfm_add_4x16_flipadst_flipadst_2_8bpc_lsx: 18.2
inv_txfm_add_4x16_flipadst_identity_0_8bpc_c: 61.8
inv_txfm_add_4x16_flipadst_identity_0_8bpc_lsx: 6.3
inv_txfm_add_4x16_flipadst_identity_1_8bpc_c: 61.8
inv_txfm_add_4x16_flipadst_identity_1_8bpc_lsx: 6.3
inv_txfm_add_4x16_flipadst_identity_2_8bpc_c: 61.8
inv_txfm_add_4x16_flipadst_identity_2_8bpc_lsx: 6.3
inv_txfm_add_4x16_identity_adst_0_8bpc_c: 83.1
inv_txfm_add_4x16_identity_adst_0_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_adst_1_8bpc_c: 83.0
inv_txfm_add_4x16_identity_adst_1_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_adst_2_8bpc_c: 83.0
inv_txfm_add_4x16_identity_adst_2_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_dct_0_8bpc_c: 81.4
inv_txfm_add_4x16_identity_dct_0_8bpc_lsx: 13.9
inv_txfm_add_4x16_identity_dct_1_8bpc_c: 81.4
inv_txfm_add_4x16_identity_dct_1_8bpc_lsx: 13.9
inv_txfm_add_4x16_identity_dct_2_8bpc_c: 81.4
inv_txfm_add_4x16_identity_dct_2_8bpc_lsx: 13.9
inv_txfm_add_4x16_identity_flipadst_0_8bpc_c: 84.1
inv_txfm_add_4x16_identity_flipadst_0_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_flipadst_1_8bpc_c: 84.0
inv_txfm_add_4x16_identity_flipadst_1_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_flipadst_2_8bpc_c: 83.9
inv_txfm_add_4x16_identity_flipadst_2_8bpc_lsx: 17.8
inv_txfm_add_4x16_identity_identity_0_8bpc_c: 52.4
inv_txfm_add_4x16_identity_identity_0_8bpc_lsx: 5.5
inv_txfm_add_4x16_identity_identity_1_8bpc_c: 52.4
inv_txfm_add_4x16_identity_identity_1_8bpc_lsx: 5.5
inv_txfm_add_4x16_identity_identity_2_8bpc_c: 52.4
inv_txfm_add_4x16_identity_identity_2_8bpc_lsx: 5.5

Change-Id: I36322071eeea45df9289f2b1d533ee937904aec2
2024-09-30 06:37:00 +00:00
yuanhecai d60d93a55c loongarch: add lsx implementation of itx_8bpc.add_4x8 series function for 8 bpc
Relative speedup over C code:

inv_txfm_add_4x8_adst_adst_0_8bpc_c: 43.8
inv_txfm_add_4x8_adst_adst_0_8bpc_lsx: 8.6
inv_txfm_add_4x8_adst_adst_1_8bpc_c: 43.8
inv_txfm_add_4x8_adst_adst_1_8bpc_lsx: 8.6
inv_txfm_add_4x8_adst_dct_0_8bpc_c: 43.0
inv_txfm_add_4x8_adst_dct_0_8bpc_lsx: 6.5
inv_txfm_add_4x8_adst_dct_1_8bpc_c: 43.0
inv_txfm_add_4x8_adst_dct_1_8bpc_lsx: 6.5
inv_txfm_add_4x8_adst_flipadst_0_8bpc_c: 44.1
inv_txfm_add_4x8_adst_flipadst_0_8bpc_lsx: 8.8
inv_txfm_add_4x8_adst_flipadst_1_8bpc_c: 44.1
inv_txfm_add_4x8_adst_flipadst_1_8bpc_lsx: 8.8
inv_txfm_add_4x8_adst_identity_0_8bpc_c: 31.3
inv_txfm_add_4x8_adst_identity_0_8bpc_lsx: 2.9
inv_txfm_add_4x8_adst_identity_1_8bpc_c: 31.3
inv_txfm_add_4x8_adst_identity_1_8bpc_lsx: 2.9
inv_txfm_add_4x8_dct_adst_0_8bpc_c: 46.3
inv_txfm_add_4x8_dct_adst_0_8bpc_lsx: 8.8
inv_txfm_add_4x8_dct_adst_1_8bpc_c: 46.3
inv_txfm_add_4x8_dct_adst_1_8bpc_lsx: 8.8
inv_txfm_add_4x8_dct_dct_0_8bpc_c: 7.3
inv_txfm_add_4x8_dct_dct_0_8bpc_lsx: 1.5
inv_txfm_add_4x8_dct_dct_1_8bpc_c: 45.7
inv_txfm_add_4x8_dct_dct_1_8bpc_lsx: 6.7
inv_txfm_add_4x8_dct_flipadst_0_8bpc_c: 46.7
inv_txfm_add_4x8_dct_flipadst_0_8bpc_lsx: 8.8
inv_txfm_add_4x8_dct_flipadst_1_8bpc_c: 46.7
inv_txfm_add_4x8_dct_flipadst_1_8bpc_lsx: 8.8
inv_txfm_add_4x8_dct_identity_0_8bpc_c: 33.8
inv_txfm_add_4x8_dct_identity_0_8bpc_lsx: 2.9
inv_txfm_add_4x8_dct_identity_1_8bpc_c: 33.8
inv_txfm_add_4x8_dct_identity_1_8bpc_lsx: 2.9
inv_txfm_add_4x8_flipadst_adst_0_8bpc_c: 44.0
inv_txfm_add_4x8_flipadst_adst_0_8bpc_lsx: 8.6
inv_txfm_add_4x8_flipadst_adst_1_8bpc_c: 43.9
inv_txfm_add_4x8_flipadst_adst_1_8bpc_lsx: 8.6
inv_txfm_add_4x8_flipadst_dct_0_8bpc_c: 43.3
inv_txfm_add_4x8_flipadst_dct_0_8bpc_lsx: 6.5
inv_txfm_add_4x8_flipadst_dct_1_8bpc_c: 43.4
inv_txfm_add_4x8_flipadst_dct_1_8bpc_lsx: 6.5
inv_txfm_add_4x8_flipadst_flipadst_0_8bpc_c: 44.4
inv_txfm_add_4x8_flipadst_flipadst_0_8bpc_lsx: 8.8
inv_txfm_add_4x8_flipadst_flipadst_1_8bpc_c: 44.4
inv_txfm_add_4x8_flipadst_flipadst_1_8bpc_lsx: 8.8
inv_txfm_add_4x8_flipadst_identity_0_8bpc_c: 31.5
inv_txfm_add_4x8_flipadst_identity_0_8bpc_lsx: 2.9
inv_txfm_add_4x8_flipadst_identity_1_8bpc_c: 31.5
inv_txfm_add_4x8_flipadst_identity_1_8bpc_lsx: 2.9
inv_txfm_add_4x8_identity_adst_0_8bpc_c: 38.9
inv_txfm_add_4x8_identity_adst_0_8bpc_lsx: 8.2
inv_txfm_add_4x8_identity_adst_1_8bpc_c: 38.9
inv_txfm_add_4x8_identity_adst_1_8bpc_lsx: 8.2
inv_txfm_add_4x8_identity_dct_0_8bpc_c: 38.1
inv_txfm_add_4x8_identity_dct_0_8bpc_lsx: 6.1
inv_txfm_add_4x8_identity_dct_1_8bpc_c: 38.1
inv_txfm_add_4x8_identity_dct_1_8bpc_lsx: 6.1
inv_txfm_add_4x8_identity_flipadst_0_8bpc_c: 39.2
inv_txfm_add_4x8_identity_flipadst_0_8bpc_lsx: 8.3
inv_txfm_add_4x8_identity_flipadst_1_8bpc_c: 39.2
inv_txfm_add_4x8_identity_flipadst_1_8bpc_lsx: 8.3
inv_txfm_add_4x8_identity_identity_0_8bpc_c: 26.4
inv_txfm_add_4x8_identity_identity_0_8bpc_lsx: 2.4
inv_txfm_add_4x8_identity_identity_1_8bpc_c: 26.4
inv_txfm_add_4x8_identity_identity_1_8bpc_lsx: 2.4

Change-Id: Ibbaeca98118774a261cf55afd581196d93ac2004
2024-09-30 06:37:00 +00:00
yuanhecai 74e0eeb5ec loongarch: Opt one functions of itx_8bpc.add_16x32 series
1. inv_txfm_add_dct_dct_16x32

Relative speedup over C code:

inv_txfm_add_16x32_dct_dct_0_8bpc_c: 63.4
inv_txfm_add_16x32_dct_dct_0_8bpc_lsx: 3.3
inv_txfm_add_16x32_dct_dct_1_8bpc_c: 687.0
inv_txfm_add_16x32_dct_dct_1_8bpc_lsx: 55.7
inv_txfm_add_16x32_dct_dct_2_8bpc_c: 686.4
inv_txfm_add_16x32_dct_dct_2_8bpc_lsx: 55.6
inv_txfm_add_16x32_dct_dct_3_8bpc_c: 686.4
inv_txfm_add_16x32_dct_dct_3_8bpc_lsx: 55.5
inv_txfm_add_16x32_dct_dct_4_8bpc_c: 686.4
inv_txfm_add_16x32_dct_dct_4_8bpc_lsx: 55.6

Change-Id: I9d22b8b3534b7ba17f6e85e42d08eb3165e2e8cb
2024-09-30 06:37:00 +00:00
MARBEAN f2c3ccd6a6 meson: supports the iOS platform 2024-09-21 07:10:06 +00:00
Cameron Cawley a7a40a3fde Define __ARM_ARCH with older compilers
This is needed for GCC 4.7 and earlier, as well as Visual Studio 2022 version 17.9 and earlier.
2024-09-18 18:29:36 +00:00
Cameron Cawley 8e993f4d0b Support older ARM versions with checkasm 2024-09-18 18:29:36 +00:00
Luca Barbato 8d9b1e26b3 ppc: Factor out dc_only itx 2024-09-17 12:34:37 +00:00
Luca Barbato 75d3ad14f2 ppc: itx 16x4 pwr9 2024-09-17 12:34:37 +00:00
Luca Barbato 0bf331a1bb ppc: itx 4x16 pwr9
Initial i32x4 version, can be used as base for high bitdept.
2024-09-17 12:34:37 +00:00
Luca Barbato 19e122ee38 ppc: Remove high bitdepth macros from the 8bit-only code 2024-09-17 12:34:37 +00:00
Luca Barbato b1d847beb5 ppc: itx 8x8 pwr9 2024-09-17 12:34:37 +00:00
Luca Barbato da51b12322 ppc: itx 4x8 and 8x4 pwr9 2024-09-17 12:34:37 +00:00
Luca Barbato 33b9d5141f ppc: itx 4x4 pwr9 2024-09-17 12:34:37 +00:00
Jean-Baptiste Kempf 212359662d NEWS: get ready for 1.5.0 2024-09-17 12:11:45 +00:00
Jean-Baptiste Kempf bd875480a9 Update NEWS for 1.4.3 2024-09-17 12:11:45 +00:00
Michael Bradshaw dd32cd5027 Use #if HAVE_* instead of #ifdef HAVE_* 2024-09-12 20:40:08 +00:00
Arpad Panyik 82e9155c75 AArch64: Trim Armv8.0 Neon path of 6-tap and 8-tap MC functions
There are some instruction sequences we could merge after the lane
load/store patch (ec5c3052cf).

This change will simplify the loading of filter weights to save 288
bytes in the Armv8.0 Neon path of 6-tap and 8-tap MC functions.
2024-09-12 11:31:07 +00:00
Kacper Michajłow f4a0d7cb70 Remove dav1d/ prefix from dav1d.h
This is possible, because we no longer generate version.h at compile
time.

Reverts header change from 7629402bbd to
preserve the same behaviour as before.
2024-09-11 02:43:02 +02:00
Kacper Michajłow 74ccc93687 meson: don't generate version.h
Instead of generating version.h, move the so version there and parse it
in meson.
2024-09-10 23:25:16 +02:00
Kyle Siefring 4385e7e161 Improve density of group context setting macros
Shared object binary size reduction:
x84_64           : 16112 bytes
ARM64            : 16008 bytes
ARM64(+Os)       : 21592 bytes
ARMv7(+Os+mthumb): 18480 bytes

Size reduction of symbols:
x84_64           : 15712 bytes
ARM64            : 18688 bytes
ARM64(+Os)       : 18404 bytes
ARMv7(+Os+mthumb): 17322 bytes

Compiles were done with clang version 18.1.8 and symbol sizes were
obtained using nm on the shared object.

Provides speed ups on older ARM64 cpus with very little impact on other
cpus.

Speedup:

c7i (skylake)
 Nature1080p      : x0.999
 Chimera          : x0.998

odroid C4
 Nature1080p      : x1.007
 Chimera          : x1.016
 Models1080p      : x1.005
 MountainBike1080p: x1.009
 Balloons1080p    : x1.008

Raspberry Pi 4
 Nature1080p      : x1.005
 Chimera          : x0.999
 Models1080p      : x0.999
 MountainBike1080p: x1.004
 Balloons1080p    : x1.003

Raspberry Pi 2 (Cortex-A7):
 (using size optimized build)
 Nature1080p      : x1.003
 Models1080p      : x0.997
2024-09-06 22:12:56 +00:00
Martin Storsjö 166e1df543 tests: Add an option to dav1d_argon.bash for using a wrapper tool
This allows executing all the tools within e.g. valgrind.

This matches the "meson test --wrap <tool>" feature.
2024-09-06 20:32:45 +00:00
Kyle Siefring 79db162487 AArch64: New method for calculating sgr table
For the 3x3 part, double the width of the vertical loop. This is done to
provide more latency in the new sgr calculation.

Initial (master):  Cortex A53        A55        A72        A73       A76   Apple M1
sgr_3x3_8bpc_neon:   387702.8   383154.2   295742.4   302100.1  185420.7   472.2
sgr_5x5_8bpc_neon:   261725.1   256919.8   194205.1   197585.6  128311.3   332.9
sgr_mix_8bpc_neon:   628085.0   593664.2   453551.8   450553.8  281956.0   711.2

Current:
sgr_3x3_8bpc_neon:   368331.4   363949.7   275499.0   272056.3  169614.4   432.7
sgr_5x5_8bpc_neon:   257866.7   255265.5   195962.5   199557.8  120481.3   319.2
sgr_mix_8bpc_neon:   598234.1   572896.4   418500.4   438910.7  258977.7   659.3

Include a minor improvement that gets rid of a dup instruction.
2024-09-06 09:04:24 +00:00
Arpad Panyik ec5c3052cf AArch64: Optimize lane load/store in MC functions
Partial register writes can create long dependency chains, which can
reduce performance on out-of-order CPUs. This patch removes most of
these kinds of problems in MC functions by filling the full register
before other lane loading instructions.

Most lane extracting stores can also be optimized using FP scalar
stores when the 0th lane would be extracted.

Relative runtime of micro benchmarks after this patch on some Neoverse
and Cortex CPU cores:

8bpc neon                V2      V1      X3      X1    A715     A78     A76
 avg        w8:       0.942x  1.030x  0.936x  0.935x  1.000x  0.877x  0.976x
 w_avg      w8:       0.908x  0.913x  0.919x  0.914x  0.999x  0.905x  0.910x
 mask       w8:       0.937x  0.905x  0.929x  0.907x  1.009x  0.921x  0.868x
 w_mask 420 w4:       0.969x  0.968x  0.951x  0.962x  0.995x  0.976x  0.958x
 w_mask 420 w8:       0.979x  0.935x  0.936x  0.935x  0.996x  0.948x  0.959x
 blend      w4:       0.721x  0.841x  0.764x  0.822x  0.772x  0.826x  0.883x
 blend      w8:       0.692x  0.733x  0.686x  0.730x  0.828x  0.723x  0.762x
 blend    h w2:       0.738x  0.776x  0.746x  0.775x  0.683x  0.827x  0.851x
 blend    h w4:       0.858x  0.942x  0.880x  0.933x  0.784x  0.924x  0.965x
 blend    h w8:       0.804x  0.807x  0.806x  0.805x  0.814x  0.810x  0.748x
 blend    v w2:       0.898x  0.931x  0.903x  0.949x  0.784x  0.867x  0.875x
 blend    v w4:       0.935x  0.905x  0.933x  0.922x  0.763x  0.777x  0.807x
 blend    v w8:       0.803x  0.802x  0.804x  0.815x  0.674x  0.677x  0.678x

16bpc neon               V2      V1      X3      X1    A715     A78     A76
 avg        w4:       0.899x  0.967x  0.897x  0.948x  1.002x  0.901x  0.884x
 w_avg      w4:       0.952x  0.951x  0.936x  0.946x  0.997x  0.937x  0.925x
 mask       w4:       0.893x  0.958x  0.887x  0.948x  1.003x  0.938x  0.934x
 w_mask 420 w4:       0.933x  0.932x  0.932x  0.939x  1.000x  0.910x  0.955x
 w_mask 420 w8:       0.966x  0.962x  0.967x  0.961x  1.000x  0.990x  1.010x
 blend      w4:       0.367x  0.361x  0.370x  0.352x  0.418x  0.394x  0.476x
 blend    h w2:       0.365x  0.445x  0.369x  0.437x  0.416x  0.576x  0.699x
 blend    h w4:       0.343x  0.402x  0.342x  0.398x  0.418x  0.525x  0.603x
 blend    v w2:       0.464x  0.460x  0.460x  0.447x  0.494x  0.446x  0.503x
 blend    v w4:       0.432x  0.424x  0.437x  0.416x  0.433x  0.427x  0.534x
 blend    v w8:       0.936x  0.847x  0.949x  0.848x  1.007x  0.811x  0.785x

bilinear 8bpc neon       V2      V1      X3      X1    A715     A78     A76
 mct     w4  0:       0.982x  0.983x  0.955x  1.029x  0.784x  0.817x  0.814x
 mc      w2  h:       0.277x  0.333x  0.275x  0.325x  0.299x  0.435x  0.518x
 mct     w4  h:       0.835x  0.862x  0.814x  0.887x  1.074x  0.899x  0.884x
 mc      w2  v:       0.887x  0.966x  0.894x  0.945x  0.808x  0.953x  0.997x
 mc      w4  v:       0.762x  0.899x  0.766x  0.867x  0.695x  0.915x  1.017x
 mct     w4  v:       0.700x  0.812x  0.740x  0.777x  0.777x  0.824x  0.853x
 mc      w2 hv:       0.928x  0.985x  0.929x  0.978x  0.789x  0.969x  1.010x
 mct     w4 hv:       0.887x  0.913x  0.912x  0.920x  1.001x  0.922x  0.937x

bilinear 16bpc neon      V2      V1      X3      X1    A715     A78     A76
 mc      w2  0:       0.991x  1.032x  0.993x  0.970x  0.878x  0.925x  0.999x
 mct     w4  0:       0.811x  0.730x  0.797x  0.680x  0.808x  0.711x  0.805x
 mc      w4  h:       0.885x  0.901x  0.895x  0.905x  1.003x  0.909x  0.910x
 mct     w4  h:       0.902x  0.914x  0.898x  0.896x  1.000x  0.897x  0.934x
 mc      w2  v:       0.888x  0.966x  0.913x  0.955x  0.824x  0.958x  1.005x
 mc      w4  v:       0.897x  0.894x  0.903x  0.902x  1.001x  0.895x  0.895x
 mct     w4  v:       0.924x  0.908x  0.921x  0.901x  1.001x  0.904x  0.918x
 mc      w4 hv:       0.927x  0.925x  0.924x  0.933x  1.000x  0.936x  0.959x
 mct     w4 hv:       0.923x  0.944x  0.923x  0.944x  0.999x  0.931x  0.956x

8tap 8bpc neon           V2      V1      X3      X1    A715     A78     A76
 mct regular w4  0:   0.829x  0.854x  0.735x  0.861x  0.769x  0.766x  0.840x
 mc  regular w2  h:   0.984x  1.008x  0.983x  1.012x  0.986x  0.989x  0.995x
 mc  sharp   w2  h:   0.987x  1.008x  0.986x  1.011x  0.985x  0.989x  0.995x
 mc  regular w4  h:   0.907x  0.911x  0.916x  0.908x  0.997x  0.936x  0.932x
 mc  sharp   w4  h:   0.916x  0.914x  0.918x  0.913x  0.999x  0.939x  0.905x
 mct regular w4  h:   0.992x  0.979x  0.993x  0.971x  1.000x  0.986x  0.976x
 mct sharp   w4  h:   0.991x  0.979x  0.989x  0.984x  1.001x  0.979x  0.983x
 mc  regular w2  v:   1.002x  1.001x  1.005x  1.000x  1.000x  0.998x  0.983x
 mc  sharp   w2  v:   1.005x  1.001x  1.009x  0.998x  0.994x  0.997x  0.989x
 mc  regular w4  v:   0.985x  0.998x  0.991x  0.998x  1.000x  1.000x  0.983x
 mc  sharp   w4  v:   1.005x  1.002x  1.006x  1.002x  0.998x  0.991x  0.999x
 mct regular w4  v:   0.966x  0.967x  0.961x  0.974x  0.996x  0.954x  0.982x
 mct sharp   w4  v:   0.970x  0.944x  0.967x  0.944x  0.997x  0.951x  0.966x
 mc  regular w2 hv:   0.993x  0.993x  0.994x  0.987x  0.993x  0.985x  0.999x
 mc  sharp   w2 hv:   0.994x  0.996x  0.992x  0.998x  0.997x  0.999x  0.999x
 mc  regular w4 hv:   0.964x  0.958x  0.964x  0.960x  0.982x  0.938x  0.958x
 mc  sharp   w4 hv:   0.982x  0.981x  0.980x  0.982x  0.995x  0.986x  0.941x
 mct regular w4 hv:   0.993x  0.994x  0.992x  0.994x  0.996x  0.992x  0.988x
 mct sharp   w4 hv:   0.993x  0.996x  0.991x  0.996x  0.954x  0.992x  1.011x

8tap 16bpc neon          V2      V1      X3      X1    A715     A78     A76
 mc  regular w2  0:   0.869x  1.059x  0.874x  0.956x  0.883x  0.932x  1.000x
 mct regular w4  0:   0.348x  0.369x  0.354x  0.377x  0.560x  0.409x  0.648x
 mc  regular w2  h:   0.996x  0.988x  0.992x  0.985x  0.989x  0.991x  1.006x
 mc  sharp   w2  h:   0.996x  0.989x  0.979x  0.991x  0.987x  0.988x  0.997x
 mc  regular w4  h:   0.957x  0.937x  0.957x  0.948x  0.961x  0.927x  0.994x
 mc  sharp   w4  h:   0.966x  0.940x  0.962x  0.954x  0.985x  0.929x  0.970x
 mct regular w4  h:   0.922x  0.942x  0.932x  0.933x  1.007x  0.938x  0.905x
 mct sharp   w4  h:   0.919x  0.943x  0.919x  0.931x  0.971x  0.943x  0.929x
 mc  regular w2  v:   1.000x  0.997x  1.001x  1.003x  1.001x  0.999x  0.984x
 mc  sharp   w2  v:   1.000x  0.999x  1.000x  0.999x  1.000x  1.000x  0.993x
 mc  regular w4  v:   0.936x  0.941x  0.936x  0.939x  0.999x  0.928x  0.981x
 mc  sharp   w4  v:   0.955x  0.961x  0.949x  0.956x  0.999x  0.947x  0.953x
 mct regular w4  v:   0.977x  0.966x  0.979x  0.968x  0.990x  0.972x  0.972x
 mct sharp   w4  v:   0.973x  0.965x  0.981x  0.963x  0.994x  0.977x  0.974x
 mc  regular w2 hv:   0.995x  1.001x  0.995x  0.995x  0.995x  1.000x  0.981x
 mc  sharp   w2 hv:   0.993x  1.012x  0.993x  0.988x  0.996x  0.992x  1.008x
 mc  regular w4 hv:   0.938x  0.943x  0.939x  0.943x  0.986x  0.943x  0.997x
 mc  sharp   w4 hv:   0.969x  0.959x  0.970x  0.974x  0.986x  0.993x  0.997x
 mct regular w4 hv:   0.942x  0.970x  0.951x  0.960x  0.977x  0.958x  1.018x
 mct sharp   w4 hv:   0.923x  0.958x  0.934x  0.955x  0.973x  0.946x  0.986x
2024-09-06 11:40:46 +03:00
Arpad Panyik a992a9bede AArch64: Optimize Armv8.0 Neon path of SBD H/HV 6-tap filters
The 6-tap horizontal and the horizontal parts of 6-tap HV subpel
filters can be further improved by some pointer arithmetic and saving
some instructions (EXTs) in their data rearrangement codes.

Relative runtime of micro benchmarks after this patch on Cortex CPU
cores:

SBD mct h         X1     A78     A76     A72     A55
 regular  w8:  0.878x  0.894x  0.990x  0.923x  0.944x
 regular w16:  0.962x  0.931x  0.943x  0.949x  0.949x
 regular w32:  0.937x  0.937x  0.972x  0.938x  0.947x
 regular w64:  0.920x  0.965x  0.992x  0.936x  0.944x

SBD mct hv        X1     A78     A76     A72     A55
 regular  w8:  0.931x  0.970x  0.951x  0.950x  0.971x
 regular w16:  0.940x  0.971x  0.941x  0.952x  0.967x
 regular w32:  0.943x  0.972x  0.946x  0.961x  0.974x
 regular w64:  0.943x  0.973x  0.952x  0.944x  0.975x
2024-09-06 08:08:08 +00:00
Arpad Panyik 2d808de191 AArch64: Optimize Armv8.0 Neon path of HBD HV 6-tap filters
The horizontal parts of 6-tap HV subpel filters can be further
improved by some pointer arithmetic and saving some instructions
(EXTs) in their data rearrangement codes.

Relative runtime of micro benchmarks after this patch on Cortex CPU
cores:

HBD mct hv        X1     A78     A76     A72     A55
 regular  w8:  0.952x  0.989x  0.924x  0.973x  0.976x
 regular w16:  0.961x  0.993x  0.928x  0.952x  0.971x
 regular w32:  0.964x  0.996x  0.930x  0.973x  0.972x
 regular w64:  0.963x  0.997x  0.930x  0.969x  0.974x
2024-09-06 07:50:38 +00:00
Arpad Panyik 93339ce857 AArch64: Optimize Armv8.0 Neon path of HBD horizontal 6-tap filters
The 6-tap horizontal subpel filters can be further improved by some
pointer arithmetic and saving some instructions (EXTs) in their data
rearrangement codes.

Relative runtime of micro benchmarks after this patch on some Cortex
CPU cores:

regular:     X1      A78      A76      A55
 mc  w8:  0.915x   0.937x   0.900x   0.982x
 mc w16:  0.917x   0.947x   0.911x   0.971x
 mc w32:  0.914x   0.938x   0.873x   0.961x
 mc w64:  0.918x   0.932x   0.882x   0.964x
2024-09-06 07:38:18 +00:00
Arpad Panyik 109b24277b AArch64: Optimize Armv8.0 Neon path of HBD horizontal filters
The reduction parts of the horizontal HBD MC filters use SRSHL+SQXTUN+
SRSHL instruction sequences. In the horizontal case this can be
rewritten using a single SQSHRUN instruction with an additional
rounding value (34 for 10-bit and 40 for 12-bit).

Relative runtime of micro benchmarks after this patch on some Cortex
CPU cores:

regular:     X1      A78      A76      A55
 mc  w2:  0.847x   0.864x   0.822x   0.859x
 mc  w4:  0.889x   0.994x   0.868x   0.917x
 mc  w8:  0.857x   0.911x   0.915x   0.978x
 mc w16:  0.890x   0.982x   0.868x   0.974x
 mc w32:  0.904x   0.991x   0.873x   0.967x
 mc w64:  0.919x   1.003x   0.860x   0.970x
2024-09-06 07:38:18 +00:00
Cameron Cawley d268788467 Support using C11 aligned_alloc for dav1d_alloc_aligned 2024-09-05 12:36:00 +00:00
Kacper Michajłow 7629402bbd meson: fix include directories when building as subproject
This makes `#include <dav1d/dav1d.h>` work correctly as we point to the
parent include directory, same as in the normal installation.

Also fixes conflict of including "version.h" which may already exist in
parent project or another subproject. Be more specific about the
headers. Normally it works, but when building as subproject version.h is
generated in build directory, so it no longer is prioritized when
including from dav1d.h and other header with the same name may be
included.
2024-09-05 11:10:46 +00:00
Cameron Cawley 507b697ec0 Allow software renderers with placebo-gl 2024-09-04 18:29:59 +00:00
Cameron Cawley 312972d69b Disable the mouse cursor in dav1dplay 2024-09-04 12:15:11 +00:00
Cameron Cawley b9cc27d5ff Allow quitting dav1dplay with the escape key 2024-09-04 12:15:11 +00:00
Cameron Cawley 2f9fc727e1 Allow playing videos in full-screen mode 2024-09-04 12:15:11 +00:00
Cameron Cawley 4e1a8b4510 dav1dplay: Ensure that SDL is shut down when the application quits 2024-09-04 11:24:47 +00:00
Cameron Cawley cc6eb3d53d Allow getopt fallback to compile on non-Windows platforms 2024-09-01 22:54:56 +01:00
Cosmin Stejerean bdef29970a picture: copy HDR10+ and T35 metadata only to visible frames 2024-08-30 13:14:50 +00:00
Cameron Cawley 6b3c489a2e Check for sys/types.h before using it 2024-08-29 21:15:22 +00:00
Cameron Cawley 7490d98654 Only include unistd.h and pthread.h when necessary 2024-08-29 21:15:22 +00:00
Cameron Cawley a796f66e0a Remove unused sys/stat.h includes 2024-08-29 21:15:22 +00:00
Cameron Cawley 4104018949 Allow compile time CPU detection to be used when trim_dsp is disabled 2024-08-29 20:58:31 +00:00
Martin Storsjö 41511bf12e aarch64: Split the jump tables to a separate const section
This should allow executing in environments where the executable
memory isn't readable.

Use 4 byte entries instead of 2; most object file formats support
relocations for a 4 byte symbol difference across sections, which
allows keeping the rest of the table lookup code similar to what
it was before.

Referencing a symbol in an arbitrary location in the executable
requires a two instruction sequence (adrp+add, via the movrel
macro).

Thus, the cost of this rewrite is doubling the size of the jump
tables (which were quite small so far), and adding one instruction
in each jump table setup prologue. On an ELF build, the .text section
shrinks by 1176 bytes, and the .rodata section grows by 3136 bytes,
i.e. a 1960 byte increase.

While refactoring, prefer doing sign extension during the load
(using ldrsw rather than ldr, to avoid using the "sxtw" modifier on
the add instruction), as extending ALU arithmetics have a higher
latency.

MS armasm64 doesn't seem to support calculating symbol differences
across sections (see [1]), so keep the jump tables in the text
section there, to let the assembler calculate it at assembly time
instead. (Keeping the condition as _WIN32 for simplicity, as we don't
interact directly with armasm64, but it is wrapped in gas-preprocessor.)

[1] https://developercommunity.visualstudio.com/t/armasm64-unable-to-create-cross-section/10722340
2024-08-29 20:43:57 +00:00
Martin Storsjö 0d8abee540 Fix the macro parameter name for the CHECK_SIZE macro 2024-08-29 23:29:30 +03:00
Cameron Cawley 0255c2b227 Ensure that the refmvs_refpair union is packed 2024-08-29 20:17:51 +00:00
Cameron Cawley 033a090923 Detect availability of pthread_setname_np and pthread_set_name_np 2024-08-29 20:07:30 +00:00
Martin Storsjö ccb02ddf8d aarch64: Enable detection of SVE/SVE2 on Windows
WinSDK 10.0.26100 added these processor feature constants.

Unfortunately, no constant was added for I8MM, but if SVE_I8MM
is available, we can at least be sure that regular I8MM is
available too.
2024-08-26 14:04:37 +03:00
Martin Storsjö 27491dd953 aarch64: Fix a label typo
Apparently, this case isn't actually ever executed, at least in most
checkasm runs, but some tools could complain about the relocation
against 160b, which pointed elsewhere than intended.
2024-08-24 10:08:00 +03:00
Martin Storsjö e560d2ba08 aarch64: Avoid looping through the BTI instructions
This does the same optimizations as
3329f8d139 and
1790e1329d on the rest of the
code.
2024-08-23 16:15:45 +03:00
Martin Storsjö 5a33c5c628 aarch64: ipred: Use the right fill width loop in ipred_z3_fill_padding_neon
This makes the code behave as intended, when filling a rectangle
with arbitrary width (filling with the largest power of two width
until filled); previously, it accidentally fell back on writing 4
pixel wide stripes immediately.

No measurable effect on checkasm benchmarks though.
2024-08-23 12:10:35 +03:00
Arpad Panyik 472b31f838 AArch64: SVE MS armasm64 fix of HBD subpel filters
MS armasm64 cannot compile some SVE instructions with immediate
operands, e.g.:
  sub  z0.h, z0.h, #8192

The proper form is:
  sub  z0.h, z0.h, #32, lsl #8

This patch contains the needed fixes.
2024-08-22 19:33:06 +00:00
Martin Storsjö 3329f8d139 aarch64: mc16: Optimize the BTI landing pads in put/prep_neon
Don't include the BTI landing pad instruction in the loops.

If built with BTI enabled, AARCH64_VALID_JUMP_TARGET expands to
a no-op instruction that indicates that indirect jumps can land
there. But there's no need for the loops to include that instruction.
2024-08-22 16:34:39 +03:00
Arpad Panyik 01558f3f66 AArch64: Add HBD subpel filters using 128-bit SVE2
Add an Armv9.0-A SVE2 code path for high bitdepth convolutions. Only
2D convolutions have 6-tap specialisations of their vertical passes.
All other convolutions are 4- or 8-tap filters which fit well with
the 4-element 16-bit SDOT instruction of SVE2.

This patch renames HBD prep/put_neon to prep/put_16bpc_neon and
exports put_16bpc_neon.

Benchmarks show up-to 17% FPS increase depending on the input video
and the CPU used.

This patch will increase the .text by around 8 KiB.

Relative performance to the C reference on some Cortex-A/X CPUs:

    regular     A715    A720      X3      X4    A510    A520
 w4 hv neon:    3.93x   4.10x   5.21x   5.17x   3.57x   5.27x
 w4 hv sve2:    4.99x   5.14x   6.00x   6.05x   4.33x   3.99x
 w8 hv neon:    1.72x   1.67x   1.98x   2.18x   2.95x   2.94x
 w8 hv sve2:    2.12x   2.29x   2.52x   2.62x   2.60x   2.60x
w16 hv neon:    1.59x   1.53x   1.83x   1.89x   2.35x   2.24x
w16 hv sve2:    1.94x   2.12x   2.33x   2.18x   2.06x   2.06x
w32 hv neon:    1.49x   1.50x   1.66x   1.76x   2.10x   2.16x
w32 hv sve2:    1.81x   2.09x   2.11x   2.09x   1.84x   1.87x
w64 hv neon:    1.52x   1.50x   1.55x   1.71x   1.95x   2.05x
w64 hv sve2:    1.84x   2.08x   1.97x   1.98x   1.74x   1.77x

 w4 h neon:     5.35x   5.47x   7.39x   5.78x   3.92x   5.19x
 w4 h sve2:     7.91x   8.35x  11.95x  10.33x   5.81x   5.42x
 w8 h neon:     4.49x   4.43x   6.50x   4.87x   7.18x   6.17x
 w8 h sve2:     6.09x   6.22x   9.59x   7.70x   7.89x   6.83x
w16 h neon:     2.53x   2.52x   2.34x   1.86x   2.71x   2.75x
w16 h sve2:     3.41x   3.47x   3.53x   3.25x   2.89x   2.96x
w32 h neon:     2.07x   2.08x   1.97x   1.56x   2.17x   2.21x
w32 h sve2:     2.76x   2.84x   2.94x   2.75x   2.24x   2.29x
w64 h neon:     1.86x   1.86x   1.76x   1.41x   1.87x   1.88x
w64 h sve2:     2.47x   2.54x   2.65x   2.46x   1.94x   1.94x

 w4 v neon:     5.22x   5.17x   6.36x   5.60x   4.23x   7.30x
 w4 v sve2:     5.86x   5.90x   7.81x   7.16x   4.86x   4.15x
 w8 v neon:     4.83x   4.79x   6.96x   6.45x   4.74x   8.40x
 w8 v sve2:     5.25x   5.23x   7.76x   6.79x   4.84x   4.13x
w16 v neon:     2.59x   2.60x   2.93x   2.47x   1.80x   4.16x
w16 v sve2:     2.85x   2.88x   3.36x   2.73x   1.86x   2.00x
w32 v neon:     2.12x   2.13x   2.33x   2.03x   1.34x   3.11x
w32 v sve2:     2.36x   2.40x   2.73x   2.32x   1.41x   1.48x
w64 v neon:     1.94x   1.92x   2.02x   1.78x   1.12x   2.59x
w64 v sve2:     2.16x   2.15x   2.37x   2.03x   1.17x   1.22x

 w4 0 neon:     1.75x   1.71x   1.44x   1.56x   3.18x   2.87x
 w4 0 sve2:     4.28x   4.39x   5.72x   6.42x   5.50x   4.68x
 w8 0 neon:     3.05x   3.04x   4.44x   4.64x   3.84x   3.52x
 w8 0 sve2:     3.85x   3.80x   5.45x   6.01x   4.92x   4.26x
w16 0 neon:     2.92x   2.93x   3.82x   3.23x   4.58x   4.44x
w16 0 sve2:     4.29x   4.27x   4.25x   4.15x   5.58x   5.29x
w32 0 neon:     2.73x   2.76x   3.50x   2.67x   4.44x   4.26x
w32 0 sve2:     4.09x   4.10x   3.75x   3.39x   5.67x   5.22x
w64 0 neon:     2.73x   2.70x   3.27x   3.14x   4.57x   4.68x
w64 0 sve2:     4.06x   3.97x   3.54x   3.18x   6.36x   6.25x

      sharp     A715    A720      X3      X4    A510    A520
 w4 hv neon:    3.54x   3.64x   4.43x   4.45x   3.03x   4.72x
 w4 hv sve2:    4.30x   4.55x   5.38x   5.26x   4.04x   3.76x
 w8 hv neon:    1.30x   1.25x   1.51x   1.60x   2.44x   2.43x
 w8 hv sve2:    1.86x   2.06x   2.09x   2.18x   2.37x   2.39x
w16 hv neon:    1.19x   1.16x   1.43x   1.36x   1.95x   1.98x
w16 hv sve2:    1.68x   1.91x   1.94x   1.84x   1.89x   1.94x
w32 hv neon:    1.13x   1.12x   1.30x   1.29x   1.75x   1.81x
w32 hv sve2:    1.58x   1.84x   1.75x   1.74x   1.70x   1.76x
w64 hv neon:    1.13x   1.13x   1.21x   1.25x   1.65x   1.69x
w64 hv sve2:    1.57x   1.84x   1.62x   1.67x   1.62x   1.65x

 w4 h neon:     5.38x   5.49x   7.46x   5.74x   3.93x   5.23x
 w4 h sve2:     7.86x   8.37x  11.99x  10.38x   5.81x   5.40x
 w8 h neon:     3.46x   3.49x   5.36x   4.64x   6.40x   5.62x
 w8 h sve2:     5.95x   6.23x   9.61x   7.76x   7.86x   6.89x
w16 h neon:     1.99x   1.97x   2.07x   1.91x   2.43x   2.51x
w16 h sve2:     3.42x   3.46x   3.75x   3.23x   2.89x   2.98x
w32 h neon:     1.67x   1.62x   1.66x   1.63x   1.95x   2.01x
w32 h sve2:     2.86x   2.84x   2.94x   2.72x   2.21x   2.29x
w64 h neon:     1.45x   1.45x   1.51x   1.48x   1.69x   1.70x
w64 h sve2:     2.47x   2.54x   2.64x   2.46x   1.93x   1.95x

 w4 v neon:     4.07x   4.01x   5.15x   4.74x   3.38x   6.56x
 w4 v sve2:     5.88x   5.86x   7.81x   7.15x   4.85x   4.39x
 w8 v neon:     3.64x   3.59x   5.38x   4.92x   3.59x   7.23x
 w8 v sve2:     5.23x   5.19x   7.77x   6.66x   4.81x   4.13x
w16 v neon:     1.93x   1.95x   2.25x   1.92x   1.35x   3.46x
w16 v sve2:     2.85x   2.88x   3.36x   2.71x   1.86x   1.94x
w32 v neon:     1.57x   1.58x   1.78x   1.60x   1.01x   2.67x
w32 v sve2:     2.36x   2.39x   2.73x   2.35x   1.41x   1.50x
w64 v neon:     1.44x   1.42x   1.54x   1.43x   0.85x   2.19x
w64 v sve2:     2.17x   2.15x   2.37x   2.06x   1.18x   1.25x
2024-08-22 12:52:56 +00:00
Arpad Panyik 713c076d80 AArch64: Add USMMLA impl. for SBD 6-tap H/HV filters
Add 6-tap variant of standard bit-depth horizontal subpel filters
using the Armv8.6 I8MM USMMLA matrix multiply instruction. This patch
also extends the HV filter with 6-tap horizontal pass using USMMLA.

Benchmarks show up-to 6-7% FPS increase depending on the input video
and the CPU used.

This patch will increase the .text by around 1.2 KiB.

Relative runtime of micro benchmarks after this patch on Neoverse
and Cortex CPU cores:

regular      V2      V1      X3    A720    A715    A520    A510
  w8 hv:  0.860x  0.895x  0.870x  0.896x  0.896x  0.938x  0.936x
 w16 hv:  0.829x  0.886x  0.865x  0.908x  0.906x  0.946x  0.944x
 w32 hv:  0.837x  0.883x  0.862x  0.914x  0.915x  0.953x  0.949x
 w64 hv:  0.840x  0.883x  0.862x  0.914x  0.914x  0.955x  0.952x

  w8 h:   0.746x  0.754x  0.747x  0.723x  0.724x  0.874x  0.866x
 w16 h:   0.749x  0.764x  0.745x  0.731x  0.731x  0.858x  0.852x
 w32 h:   0.739x  0.754x  0.738x  0.729x  0.729x  0.839x  0.837x
 w64 h:   0.736x  0.749x  0.733x  0.725x  0.726x  0.847x  0.836x
2024-08-21 23:41:48 +02:00
Arpad Panyik 287e90a3a6 AArch64: Fix typo in SBD 6-tap 2D/HV subpel filter
The macro parameter \xmy of filter_8tap_fn was used incorrectly as a
pointer instead of \lsrc. They refer to the same register but in
different context.
2024-08-12 19:41:45 +02:00
Kyle Siefring 5ef6b241f0 decode_coefs: Optimize index offset calculations
Performance Impact on Sapphire Rapids:

Chimera: 0.46% Faster
2024-08-04 17:55:20 -04:00
Arpad Panyik 2355eeb8f2 AArch64: Move constants of DotProd subpel filters to .rodata
The constants used for the subpel filters were placed in the .text
section for simplicity and peak performance, but this does not work on
systems with execute only .text sections (e.g.: OpenBSD).

The performance cost of moving the constants to the .rodata section
is small and mostly within the measurable noise.
2024-06-26 11:20:43 +02:00
Martin Storsjö 7fbcdc6d04 aarch64: Explicitly use the ldur instruction where relevant in mc_dotprod.S
The ldr instruction only can handle offsets that are a multiple
of the element size; most assemblers implicitly produce the ldur
instruction when a non-aligned offset is provided.

Older versions of MS armasm64, however, error out on this. Since
MSVC 2022 17.8, armasm64 implicitly can produce ldur, but 2022 17.7
and earlier require explicitly writing the instruction as ldur.

Despite this, even older versions still fail to build the mc_dotprod.S
sources, with errors like this:

    src\libdav1d.a.p\mc_dotprod.obj.asm(556) : error A2513: operand 2: Constant value out of range
        mov             x10, (((0*15-1)<<7)|(3*15-1))

This happens on MSVC 2022 17.1 and older, while 17.2 and newer
accept the negative value expression here.

In practice, HAVE_DOTPROD doesn't get enabled by the Meson configure
script at the moment, as it uses inline assembly to test for external
assembler features.
2024-06-25 19:10:59 +00:00
Brad Smith 431f4fb242 Add Arm OpenBSD run-time CPU feature detection support
Add run-time CPU feature detection for DotProd and i8mm on AArch64.
2024-06-25 18:18:19 +00:00
Henrik Gramner 32bf6cde06 x86: Add 6-tap variants of high bit-depth mc SSSE3 functions 2024-06-25 13:56:11 +02:00
Ronald S. Bultje ca83ee6d9d itx: restrict number of columns iterated over based on EOB 2024-06-17 12:44:34 -04:00
Nathan E. Egge 01b94cc33b cli: Prevent buffer over-read 2024-06-10 14:45:27 -04:00
Arpad Panyik 92f592ed10 AArch64: Fix potential out of bounds access in DotProd H/HV filters
The DotProd/I8MM horizontal and HV/2D subpel filters use -4 offset
for sampling instead of -3 to be better aligned in some cases. This
resulted in an out of bounds access, which led to crashes.

This patch fixes it.
2024-06-05 23:22:36 +02:00
Henrik Gramner da2cc7817c x86: Eliminate hardcoded struct offsets in refmvs load_tmvs() asm 2024-05-27 17:39:10 +02:00
Henrik Gramner 26a2744eae refmvs: Consolidate r and rp_proj allocations
The conditions for when to (re)allocate those buffers are identical,
so they can be merged into a single branch.

The allocation of the buffers themselves can also be combined to
reduce the number of allocation calls.
2024-05-27 17:39:09 +02:00
Henrik Gramner 54801d0734 refmvs: Remove dav1d_refmvs_init()
It's only ever called on data which has already been zero-initialized.
2024-05-27 17:39:08 +02:00
Henrik Gramner 89a200c82e refmvs: Simplify 2-pass logic
n_tc is always >= n_fc, so we only need to check the latter.
2024-05-27 17:39:06 +02:00
Henrik Gramner ca156d90b8 x86: Add 6-tap variants of 8bpc mc SSSE3 functions 2024-05-27 15:45:17 +02:00
Henrik Gramner 8afbd4f68a x86: Add minor 8bpc mc SSE improvements 2024-05-27 15:45:17 +02:00
Henrik Gramner 85c1639170 x86: Remove 8bpc mc SSE2 asm
The amount of nested macros caused by having to support SSE2 makes
the code very difficult to maintain and modify. It is also of
questionable value considering most other asm requires SSSE3.
2024-05-27 15:45:17 +02:00
Henrik Gramner d3997acbeb x86: Remove unused macro in mc16_avx512.asm 2024-05-27 15:45:17 +02:00
194 changed files with 42143 additions and 22240 deletions
+41 -30
View File
@@ -4,56 +4,56 @@ stages:
- test
.debian-amd64-common:
image: registry.videolan.org/dav1d-debian-unstable:20240406142551
image: registry.videolan.org/dav1d-debian-unstable:20260622120900
stage: build
tags:
- docker
- amd64
.debian-amd64-minimum:
image: registry.videolan.org/dav1d-debian-minimum:20240406142551
image: registry.videolan.org/dav1d-debian-minimum:20260422185248
stage: build
tags:
- docker
- amd64
.debian-llvm-mingw-common:
image: registry.videolan.org/vlc-debian-llvm-msvcrt:20240415145055
image: registry.videolan.org/vlc-debian-llvm-ucrt:20260121170706
stage: build
tags:
- docker
- amd64
.debian-aarch64-common:
image: registry.videolan.org/dav1d-debian-bookworm-aarch64:20240401050239
image: registry.videolan.org/dav1d-debian-bookworm-aarch64:20260228141555
stage: build
tags:
- docker
- aarch64
.debian-armv7-common:
image: registry.videolan.org/dav1d-debian-bookworm-armv7:20240401050040
image: registry.videolan.org/dav1d-debian-bookworm-armv7:20260217211228
stage: build
tags:
- docker
- armv7
.debian-ppc64le-common:
image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20240401050321
image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20260210052452
stage: build
tags:
- docker
- ppc64le
.android-common:
image: registry.videolan.org/vlc-debian-android:20240406142551
image: registry.videolan.org/vlc-debian-android:20260120134731
stage: build
tags:
- docker
- amd64
.debian-wasm-emscripten-common:
image: registry.videolan.org/vlc-debian-wasm-emscripten:20240313095757
image: registry.videolan.org/vlc-debian-wasm-emscripten:20260120134731
stage: build
tags:
- docker
@@ -192,7 +192,7 @@ build-debian-avx:
variables:
CFLAGS: '-mavx'
script:
- meson setup build --buildtype debug
- meson setup build --buildtype debugoptimized
--werror
- ninja -C build
- cd build
@@ -215,7 +215,7 @@ build-debian-avx512:
variables:
CFLAGS: '-mavx'
script:
- meson setup build --buildtype debug
- meson setup build --buildtype debugoptimized
--werror
- ninja -C build
- cd build
@@ -342,6 +342,7 @@ build-debian-aarch64:
extends: .debian-aarch64-common
script:
- meson setup build --buildtype debugoptimized
-Dtrim_dsp=false
--werror
- ninja -C build
- cd build && meson test -v
@@ -353,13 +354,12 @@ build-debian-aarch64-clang-5:
CFLAGS: '-integrated-as'
script:
- meson setup build --buildtype release
-Dtrim_dsp=false
- ninja -C build
- cd build && meson test -v
build-debian-aarch64-clang-18:
build-debian-aarch64-clang:
extends: .debian-amd64-common
variables:
QEMU_LD_PREFIX: /usr/aarch64-linux-gnu/
script:
- meson setup build --buildtype release
-Dtrim_dsp=false
@@ -368,11 +368,8 @@ build-debian-aarch64-clang-18:
- ninja -C build
- cd build && meson test -v
build-macos:
.build-macos-common:
stage: build
tags:
- amd64
- macos
script:
- meson setup build --buildtype release
-Ddefault_library=both
@@ -381,6 +378,17 @@ build-macos:
- ninja -C build
- cd build && meson test -v
build-macos-x86_64:
extends: .build-macos-common
tags:
- amd64
- macos
build-macos-arm64:
extends: .build-macos-common
tags:
- macos-xcode26
build-debian-werror:
extends: .debian-aarch64-common
variables:
@@ -394,6 +402,7 @@ build-debian-armv7:
extends: .debian-armv7-common
script:
- linux32 meson setup build --buildtype debugoptimized
-Dtrim_dsp=false
--werror
- ninja -C build
- cd build && meson test -v
@@ -405,11 +414,14 @@ build-debian-armv7-clang-5:
CFLAGS: '-integrated-as'
script:
- linux32 meson setup build --buildtype release
-Dtrim_dsp=false
- ninja -C build
- cd build && meson test -v
build-debian-ppc64le:
extends: .debian-ppc64le-common
variables:
CC: gcc-13
script:
- meson setup build --buildtype release
-Dtrim_dsp=false
@@ -435,7 +447,6 @@ build-debian-riscv64:
extends: .debian-amd64-common
variables:
QEMU_CPU: rv64,v=true,vext_spec=v1.0,vlen=256,elen=64
QEMU_LD_PREFIX: /usr/riscv64-linux-gnu/
script:
- meson setup build --buildtype release
-Dtrim_dsp=false
@@ -450,8 +461,7 @@ build-debian-riscv64:
build-debian-loongarch64:
extends: .debian-amd64-common
variables:
QEMU_CPU: max-loongarch-cpu
QEMU_LD_PREFIX: /opt/cross-tools/target/
QEMU_CPU: max
script:
- meson setup build --buildtype release
-Dtrim_dsp=false
@@ -636,7 +646,11 @@ test-debian-msan:
-Db_lundef=false
-Denable_asm=false
- ninja -C build
- cd build && time meson test -v --setup=sanitizer
- cd build
- exit_code=0
- time meson test -v --setup=sanitizer || exit_code=$((exit_code + $?))
- time meson test -v --setup=sanitizer --suite testdata --test-args "--frametimes /dev/null" || exit_code=$((exit_code + $?))
- if [ $exit_code -ne 0 ]; then exit $exit_code; fi
test-debian-ubsan:
extends:
@@ -719,6 +733,8 @@ test-debian-ppc64le:
extends:
- .debian-ppc64le-common
- .test-common
variables:
CC: gcc-13
needs: ["build-debian-ppc64le"]
script:
- meson setup build --buildtype release
@@ -740,9 +756,7 @@ test-debian-riscv64:
-Dtrim_dsp=false
--cross-file package/crossfiles/riscv64-linux.meson
- ninja -C build
- cd build && time meson test -v --timeout-multiplier 4
variables:
QEMU_LD_PREFIX: /usr/riscv64-linux-gnu/
- cd build && time meson test -v --timeout-multiplier 10
parallel:
matrix:
- QEMU_CPU: [ "rv64,v=true,vext_spec=v1.0,vlen=128,elen=64",
@@ -762,9 +776,7 @@ test-debian-aarch64-qemu:
-Dtrim_dsp=false
--cross-file package/crossfiles/aarch64-linux.meson
- ninja -C build
- cd build && time meson test -v --timeout-multiplier 4
variables:
QEMU_LD_PREFIX: /usr/aarch64-linux-gnu/
- cd build && time meson test -v --timeout-multiplier 10
parallel:
matrix:
# sve-default-vector-length sets the max vector length in bytes;
@@ -799,8 +811,7 @@ test-debian-loongarch64:
- .test-common
needs: ["build-debian-loongarch64"]
variables:
QEMU_CPU: max-loongarch-cpu
QEMU_LD_PREFIX: /opt/cross-tools/target/
QEMU_CPU: max
script:
- meson setup build --buildtype release
-Dtestdata_tests=true
@@ -808,7 +819,7 @@ test-debian-loongarch64:
-Dtrim_dsp=false
--cross-file package/crossfiles/loongarch64-linux.meson
- ninja -C build
- cd build && time meson test -v --timeout-multiplier 4
- cd build && time meson test -v --timeout-multiplier 10
.test-argon-script: &test-argon-script
- meson setup build --buildtype release
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright © 2018-2019, VideoLAN and dav1d authors
Copyright © 2018-2025, VideoLAN and dav1d authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
+81
View File
@@ -1,3 +1,84 @@
Changes for 1.5.4 'Sonic':
--------------------------
1.5.4 is a minor release of dav1d, focused maintenance:
- Support for OS/2
- Switch to external checkasm
- Add Armv9.3-A GCS support
- AArch64: optimize ipred_*_8bpc & ipred_smooth_*_8bpc functions
- ARM32: optimize prep_neon
- RISC-V: add ipred_v,_h,_pal,_dc optimizations
Changes for 1.5.3 'Sonic':
--------------------------
1.5.3 is a minor release of dav1d, focused on RISC-V and maintenance:
- Misc small optimizations
- RISC-V assembly optimizations for ipred, emu_edge and w_mask,
and VLEN 512 for blend functions
- Fix issue with ivf files with 0 frames in tools
Changes for 1.5.2 'Sonic':
--------------------------
1.5.2 is a minor release of dav1d, focused on maintenance:
- minor speed improvement in recon
- improvements on loongarch symboles visibility and asm
- mark C globals with small code model
- reduce the code size of the frame header parsing (OBU)
- minor fixes on tools and CI
- fix compilation with nasm 3.00
Changes for 1.5.1 'Sonic':
--------------------------
1.5.1 is a minor release of dav1d, focusing on optimizations and stack reduction:
- Rewrite of the looprestoration (SGR, wiener) to reduce stack usage
- Rewrite of {put,prep}_scaled functions
Now, the required stack space for dav1d should be: 62 KB on x86_64 and
58KB on arm and aarch64.
- Improvements on the SSSE3 SGR
- Improvements on ARM32/ARM64 looprestoration optimizations
- RISC-V: blend optimizations for high bitdepth
- Power9: blend optimizations for 8bpc
- Port RISC-V to POSIX/non-Linux OS
- AArch64: Add Neon implementation of load_tmvs
- Fix a rare, but possible deadlock, in flush()
Changes for 1.5.0 'Sonic':
--------------------------
1.5.0 is a major release of dav1d, that:
- WARNING: we removed some of the SSE2 optimizations, so if you care about
systems without SSSE3, you should be careful when updating!
- Add Arm OpenBSD run-time CPU feature
- Optimize index offset calculations for decode_coefs
- picture: copy HDR10+ and T35 metadata only to visible frames
- SSSE3 new optimizations for 6-tap (8bit and hbd)
- AArch64/SVE: Add HBD subpel filters using 128-bit SVE2
- AArch64: Add USMMLA Implementation for 6-tap H/HV
- AArch64: Optimize Armv8.0 NEON for HBD horizontal filters and 6-tap filters
- Power9: Optimized ITX till 16x4.
- Loongarch: numerous optimizations
- RISC-V optimizations for pal, cdef_filter, ipred, mc_blend, mc_bdir, itx
- Allow playing videos in full-screen mode in dav1dplay
Changes for 1.4.3 'Road Runner':
--------------------------------
1.4.3 is a small release focused on security issues
- AArch64: Fix potential out of bounds access in DotProd H/HV filters
- cli: Prevent buffer over-read
Changes for 1.4.2 'Road Runner':
--------------------------------
+18 -8
View File
@@ -79,24 +79,27 @@ VideoLAN will only have the collective work rights.
The [VideoLAN Code of Conduct](https://wiki.videolan.org/CoC) applies to this project.
# Compile
## General compilation steps
1. Install [Meson](https://mesonbuild.com/) (0.49 or higher), [Ninja](https://ninja-build.org/), and, for x86\* targets, [nasm](https://nasm.us/) (2.14 or higher)
1. Install [Meson](https://mesonbuild.com/) (0.54 or higher), [Ninja](https://ninja-build.org/), and, for x86\* targets, [nasm](https://nasm.us/) (2.14 or higher)
2. Run `mkdir build && cd build` to create a build directory and enter it
3. Run `meson setup ..` to configure meson, add `--default-library=static` if static linking is desired
4. Run `ninja` to compile
Following are modification of step 3 and 4, for specific purpose.
## Cross-Compilation for 32- or 64-bit Windows, 32-bit Linux
If you're on a linux build machine trying to compile .exe for a Windows target/host machine, run
If you're on a linux build machine trying to compile .exe for a Windows target/host machine, configure meson like this
```
meson setup build --cross-file=package/crossfiles/x86_64-w64-mingw32.meson
meson setup .. --cross-file=../package/crossfiles/x86_64-w64-mingw32.meson
```
or, for 32-bit:
```
meson setup build --cross-file=package/crossfiles/i686-w64-mingw32.meson
meson setup .. --cross-file=../package/crossfiles/i686-w64-mingw32.meson
```
`mingw-w64` is a pre-requisite and should be installed on your linux machine via your preferred method or package manager. Note the binary name formats may differ between distributions. Verify the names, and use `alias` if certain binaries cannot be found.
@@ -104,14 +107,14 @@ meson setup build --cross-file=package/crossfiles/i686-w64-mingw32.meson
For 32-bit linux, run
```
meson setup build --cross-file=package/crossfiles/i686-linux32.meson
meson setup .. --cross-file=../package/crossfiles/i686-linux32.meson
```
## Build documentation
1. Install [doxygen](https://www.doxygen.nl/) and [graphviz](https://www.graphviz.org/)
2. Run `meson setup build -Denable_docs=true` to create the build directory
3. Run `ninja -C build doc/html` to build the docs
1. Make sure [doxygen](https://www.doxygen.nl/) and [graphviz](https://www.graphviz.org/) are installed.
2. Run `meson setup .. -Denable_docs=true` to configure meson to generate docs from the build directory.
3. Run `ninja doc/html` to build the docs
The result can be found in `build/doc/html/`. An online version built from master can be found [here](https://videolan.videolan.me/dav1d/).
@@ -121,6 +124,13 @@ The result can be found in `build/doc/html/`. An online version built from maste
2. During meson configuration, specify `-Dtestdata_tests=true`
3. Run `meson test -v` after compiling
## Decoder conformance tests (optional but encouraged)
1. Download the argon conformance bitstreams from https://streams.videolan.org/argon/
2. Extract into dav1d directory by running `tar -xvf argon.tar.zst`
3. Execute tests with `tests/dav1d_argon.bash -d build/tools/dav1d -a argon`
4. Expected outcome is `2763 files successfully verified in XXmYYs (dav1d 1.x.y-zz-gHHHHHHH filmgrain=1 cpumask=-1)`
# Support
This project is partially funded by the *Alliance for Open Media*/**AOM** and is supported by TwoOrioles and VideoLabs.
+37 -25
View File
@@ -120,6 +120,7 @@ static void dp_settings_print_usage(const char *const app,
" --highquality: enable high quality rendering\n"
" --zerocopy/-z: enable zero copy upload path\n"
" --gpugrain/-g: enable GPU grain synthesis\n"
" --fullscreen/-f: enable full screen mode\n"
" --version/-v: print version and exit\n"
" --renderer/-r: select renderer backend (default: auto)\n");
exit(1);
@@ -144,7 +145,7 @@ static void dp_rd_ctx_parse_args(Dav1dPlayRenderContext *rd_ctx,
Dav1dSettings *lib_settings = &rd_ctx->lib_settings;
// Short options
static const char short_opts[] = "i:vuzgr:";
static const char short_opts[] = "i:vuzgfr:";
enum {
ARG_THREADS = 256,
@@ -162,6 +163,7 @@ static void dp_rd_ctx_parse_args(Dav1dPlayRenderContext *rd_ctx,
{ "highquality", 0, NULL, ARG_HIGH_QUALITY },
{ "zerocopy", 0, NULL, 'z' },
{ "gpugrain", 0, NULL, 'g' },
{ "fullscreen", 0, NULL, 'f'},
{ "renderer", 0, NULL, 'r'},
{ NULL, 0, NULL, 0 },
};
@@ -186,6 +188,9 @@ static void dp_rd_ctx_parse_args(Dav1dPlayRenderContext *rd_ctx,
case 'g':
settings->gpugrain = true;
break;
case 'f':
settings->fullscreen = true;
break;
case 'r':
settings->renderer_name = optarg;
break;
@@ -240,35 +245,37 @@ static Dav1dPlayRenderContext *dp_rd_ctx_create(int argc, char **argv)
return NULL;
}
// Parse and validate arguments
dav1d_default_settings(&rd_ctx->lib_settings);
memset(&rd_ctx->settings, 0, sizeof(rd_ctx->settings));
dp_rd_ctx_parse_args(rd_ctx, argc, argv);
// Init SDL2 library
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
goto fail;
}
// Register a custom event to notify our SDL main thread
// about new frames
rd_ctx->event_types = SDL_RegisterEvents(3);
if (rd_ctx->event_types == UINT32_MAX) {
fprintf(stderr, "Failure to create custom SDL event types!\n");
free(rd_ctx);
return NULL;
goto fail;
}
rd_ctx->fifo = dp_fifo_create(5);
if (rd_ctx->fifo == NULL) {
fprintf(stderr, "Failed to create FIFO for output pictures!\n");
free(rd_ctx);
return NULL;
goto fail;
}
rd_ctx->lock = SDL_CreateMutex();
if (rd_ctx->lock == NULL) {
fprintf(stderr, "SDL_CreateMutex failed: %s\n", SDL_GetError());
dp_fifo_destroy(rd_ctx->fifo);
free(rd_ctx);
return NULL;
goto fail;
}
// Parse and validate arguments
dav1d_default_settings(&rd_ctx->lib_settings);
memset(&rd_ctx->settings, 0, sizeof(rd_ctx->settings));
dp_rd_ctx_parse_args(rd_ctx, argc, argv);
// Select renderer
renderer_info = dp_get_renderer(rd_ctx->settings.renderer_name);
@@ -279,15 +286,21 @@ static Dav1dPlayRenderContext *dp_rd_ctx_create(int argc, char **argv)
printf("Using %s renderer\n", renderer_info->name);
}
rd_ctx->rd_priv = (renderer_info) ? renderer_info->create_renderer() : NULL;
rd_ctx->rd_priv = (renderer_info) ? renderer_info->create_renderer(&rd_ctx->settings) : NULL;
if (rd_ctx->rd_priv == NULL) {
SDL_DestroyMutex(rd_ctx->lock);
dp_fifo_destroy(rd_ctx->fifo);
free(rd_ctx);
return NULL;
goto fail;
}
return rd_ctx;
fail:
if (rd_ctx->lock)
SDL_DestroyMutex(rd_ctx->lock);
if (rd_ctx->fifo)
dp_fifo_destroy(rd_ctx->fifo);
free(rd_ctx);
SDL_Quit();
return NULL;
}
/**
@@ -662,10 +675,6 @@ int main(int argc, char **argv)
return 1;
}
// Init SDL2 library
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
return 10;
// Create render context
Dav1dPlayRenderContext *rd_ctx = dp_rd_ctx_create(argc, argv);
if (rd_ctx == NULL) {
@@ -711,9 +720,7 @@ int main(int argc, char **argv)
if (e->type == SDL_QUIT) {
dp_rd_ctx_request_shutdown(rd_ctx);
dp_fifo_flush(rd_ctx->fifo, destroy_pic);
SDL_FlushEvent(rd_ctx->event_types + DAV1D_EVENT_NEW_FRAME);
SDL_FlushEvent(rd_ctx->event_types + DAV1D_EVENT_SEEK_FRAME);
num_frame_events = 0;
goto out;
} else if (e->type == SDL_WINDOWEVENT) {
if (e->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
// TODO: Handle window resizes
@@ -724,6 +731,10 @@ int main(int argc, char **argv)
SDL_KeyboardEvent *kbde = (SDL_KeyboardEvent *)e;
if (kbde->keysym.sym == SDLK_SPACE) {
dp_rd_ctx_toggle_pause(rd_ctx);
} else if (kbde->keysym.sym == SDLK_ESCAPE) {
dp_rd_ctx_request_shutdown(rd_ctx);
dp_fifo_flush(rd_ctx->fifo, destroy_pic);
goto out;
} else if (kbde->keysym.sym == SDLK_LEFT ||
kbde->keysym.sym == SDLK_RIGHT)
{
@@ -776,5 +787,6 @@ out:;
int decoder_ret = 0;
SDL_WaitThread(decoder_thread, &decoder_ret);
dp_rd_ctx_destroy(rd_ctx);
SDL_Quit();
return decoder_ret;
}
+21 -7
View File
@@ -30,22 +30,32 @@
#include "dav1d/dav1d.h"
#include <SDL.h>
#ifdef HAVE_PLACEBO
#if HAVE_PLACEBO
# include <libplacebo/config.h>
#endif
// Check libplacebo Vulkan rendering
#if defined(HAVE_VULKAN) && defined(SDL_VIDEO_VULKAN)
#if HAVE_VULKAN && defined(SDL_VIDEO_VULKAN)
# if defined(PL_HAVE_VULKAN) && PL_HAVE_VULKAN
# define HAVE_RENDERER_PLACEBO
# define HAVE_PLACEBO_VULKAN
# define HAVE_RENDERER_PLACEBO 1
# define HAVE_PLACEBO_VULKAN 1
# endif
#endif
// Check libplacebo OpenGL rendering
#if defined(PL_HAVE_OPENGL) && PL_HAVE_OPENGL
# define HAVE_RENDERER_PLACEBO
# define HAVE_PLACEBO_OPENGL
# define HAVE_RENDERER_PLACEBO 1
# define HAVE_PLACEBO_OPENGL 1
#endif
#ifndef HAVE_RENDERER_PLACEBO
#define HAVE_RENDERER_PLACEBO 0
#endif
#ifndef HAVE_PLACEBO_VULKAN
#define HAVE_PLACEBO_VULKAN 0
#endif
#ifndef HAVE_PLACEBO_OPENGL
#define HAVE_PLACEBO_OPENGL 0
#endif
/**
@@ -61,6 +71,7 @@ typedef struct {
int untimed;
int zerocopy;
int gpugrain;
int fullscreen;
} Dav1dPlaySettings;
#define WINDOW_WIDTH 910
@@ -82,7 +93,7 @@ typedef struct rdr_info
// Cookie passed to the renderer implementation callbacks
void *cookie;
// Callback to create the renderer
void* (*create_renderer)(void);
void* (*create_renderer)(const Dav1dPlaySettings *settings);
// Callback to destroy the renderer
void (*destroy_renderer)(void *cookie);
// Callback to the render function that renders a prevously sent frame
@@ -129,6 +140,9 @@ static inline SDL_Window *dp_create_sdl_window(int window_flags)
win = SDL_CreateWindow("Dav1dPlay", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
WINDOW_WIDTH, WINDOW_HEIGHT, window_flags);
if (!win)
return NULL;
SDL_SetWindowResizable(win, SDL_TRUE);
return win;
+42 -21
View File
@@ -26,17 +26,17 @@
#include "dp_renderer.h"
#ifdef HAVE_RENDERER_PLACEBO
#if HAVE_RENDERER_PLACEBO
#include <assert.h>
#include <libplacebo/renderer.h>
#include <libplacebo/utils/dav1d.h>
#ifdef HAVE_PLACEBO_VULKAN
#if HAVE_PLACEBO_VULKAN
# include <libplacebo/vulkan.h>
# include <SDL_vulkan.h>
#endif
#ifdef HAVE_PLACEBO_OPENGL
#if HAVE_PLACEBO_OPENGL
# include <libplacebo/opengl.h>
# include <SDL_opengl.h>
#endif
@@ -53,7 +53,7 @@ typedef struct renderer_priv_ctx
pl_log log;
// Placebo renderer
pl_renderer renderer;
#ifdef HAVE_PLACEBO_VULKAN
#if HAVE_PLACEBO_VULKAN
// Placebo Vulkan handle
pl_vulkan vk;
// Placebo Vulkan instance
@@ -61,9 +61,11 @@ typedef struct renderer_priv_ctx
// Vulkan surface
VkSurfaceKHR surf;
#endif
#ifdef HAVE_PLACEBO_OPENGL
#if HAVE_PLACEBO_OPENGL
// Placebo OpenGL handle
pl_opengl gl;
// SDL OpenGL context
SDL_GLContext gl_context;
#endif
// Placebo GPU
pl_gpu gpu;
@@ -77,19 +79,27 @@ typedef struct renderer_priv_ctx
} Dav1dPlayRendererPrivateContext;
static Dav1dPlayRendererPrivateContext*
placebo_renderer_create_common(int window_flags)
placebo_renderer_create_common(const Dav1dPlaySettings *settings, int window_flags)
{
if (settings->fullscreen)
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
// Create Window
SDL_Window *sdlwin = dp_create_sdl_window(window_flags | SDL_WINDOW_RESIZABLE);
if (sdlwin == NULL)
if (sdlwin == NULL) {
fprintf(stderr, "Creating SDL window failed: %s\n", SDL_GetError());
return NULL;
}
SDL_ShowCursor(0);
// Alloc
Dav1dPlayRendererPrivateContext *const rd_priv_ctx =
calloc(1, sizeof(Dav1dPlayRendererPrivateContext));
if (rd_priv_ctx == NULL)
if (rd_priv_ctx == NULL) {
fprintf(stderr, "Out of memory!\n");
return NULL;
}
rd_priv_ctx->win = sdlwin;
// Init libplacebo
@@ -102,6 +112,7 @@ static Dav1dPlayRendererPrivateContext*
#endif
));
if (rd_priv_ctx->log == NULL) {
fprintf(stderr, "pl_log_create failed!\n");
free(rd_priv_ctx);
return NULL;
}
@@ -118,24 +129,32 @@ static Dav1dPlayRendererPrivateContext*
return rd_priv_ctx;
}
#ifdef HAVE_PLACEBO_OPENGL
static void *placebo_renderer_create_gl(void)
#if HAVE_PLACEBO_OPENGL
static void *placebo_renderer_create_gl(const Dav1dPlaySettings *settings)
{
SDL_Window *sdlwin = NULL;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
// Common init
Dav1dPlayRendererPrivateContext *rd_priv_ctx =
placebo_renderer_create_common(SDL_WINDOW_OPENGL);
placebo_renderer_create_common(settings, SDL_WINDOW_OPENGL);
if (rd_priv_ctx == NULL)
return NULL;
sdlwin = rd_priv_ctx->win;
SDL_GLContext glcontext = SDL_GL_CreateContext(sdlwin);
SDL_GL_MakeCurrent(sdlwin, glcontext);
rd_priv_ctx->gl_context = SDL_GL_CreateContext(sdlwin);
if (!rd_priv_ctx->gl_context) {
fprintf(stderr, "Failed creating opengl context: %s\n", SDL_GetError());
exit(2);
}
SDL_GL_MakeCurrent(sdlwin, rd_priv_ctx->gl_context);
rd_priv_ctx->gl = pl_opengl_create(rd_priv_ctx->log, pl_opengl_params(
.allow_software = true,
#ifndef NDEBUG
.debug = true,
#endif
@@ -173,14 +192,14 @@ static void *placebo_renderer_create_gl(void)
}
#endif
#ifdef HAVE_PLACEBO_VULKAN
static void *placebo_renderer_create_vk(void)
#if HAVE_PLACEBO_VULKAN
static void *placebo_renderer_create_vk(const Dav1dPlaySettings *settings)
{
SDL_Window *sdlwin = NULL;
// Common init
Dav1dPlayRendererPrivateContext *rd_priv_ctx =
placebo_renderer_create_common(SDL_WINDOW_VULKAN);
placebo_renderer_create_common(settings, SDL_WINDOW_VULKAN);
if (rd_priv_ctx == NULL)
return NULL;
@@ -270,16 +289,18 @@ static void placebo_renderer_destroy(void *cookie)
for (int i = 0; i < 3; i++)
pl_tex_destroy(rd_priv_ctx->gpu, &(rd_priv_ctx->plane_tex[i]));
#ifdef HAVE_PLACEBO_VULKAN
#if HAVE_PLACEBO_VULKAN
if (rd_priv_ctx->vk) {
pl_vulkan_destroy(&(rd_priv_ctx->vk));
vkDestroySurfaceKHR(rd_priv_ctx->vk_inst->instance, rd_priv_ctx->surf, NULL);
pl_vk_inst_destroy(&(rd_priv_ctx->vk_inst));
}
#endif
#ifdef HAVE_PLACEBO_OPENGL
#if HAVE_PLACEBO_OPENGL
if (rd_priv_ctx->gl)
pl_opengl_destroy(&(rd_priv_ctx->gl));
if (rd_priv_ctx->gl_context)
SDL_GL_DeleteContext(rd_priv_ctx->gl_context);
#endif
SDL_DestroyWindow(rd_priv_ctx->win);
@@ -382,7 +403,7 @@ static void placebo_release_pic(Dav1dPicture *pic, void *cookie)
SDL_UnlockMutex(rd_priv_ctx->lock);
}
#ifdef HAVE_PLACEBO_VULKAN
#if HAVE_PLACEBO_VULKAN
const Dav1dPlayRenderInfo rdr_placebo_vk = {
.name = "placebo-vk",
.create_renderer = placebo_renderer_create_vk,
@@ -397,7 +418,7 @@ const Dav1dPlayRenderInfo rdr_placebo_vk = {
const Dav1dPlayRenderInfo rdr_placebo_vk = { NULL };
#endif
#ifdef HAVE_PLACEBO_OPENGL
#if HAVE_PLACEBO_OPENGL
const Dav1dPlayRenderInfo rdr_placebo_gl = {
.name = "placebo-gl",
.create_renderer = placebo_renderer_create_gl,
+14 -3
View File
@@ -43,15 +43,23 @@ typedef struct renderer_priv_ctx
SDL_Texture *tex;
} Dav1dPlayRendererPrivateContext;
static void *sdl_renderer_create(void)
static void *sdl_renderer_create(const Dav1dPlaySettings *settings)
{
SDL_Window *win = dp_create_sdl_window(0);
if (win == NULL)
int window_flags = 0;
if (settings->fullscreen)
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_Window *win = dp_create_sdl_window(window_flags);
if (win == NULL) {
fprintf(stderr, "Creating SDL window failed: %s\n", SDL_GetError());
return NULL;
}
SDL_ShowCursor(0);
// Alloc
Dav1dPlayRendererPrivateContext *rd_priv_ctx = malloc(sizeof(Dav1dPlayRendererPrivateContext));
if (rd_priv_ctx == NULL) {
fprintf(stderr, "Out of memory!\n");
return NULL;
}
rd_priv_ctx->win = win;
@@ -79,7 +87,9 @@ static void sdl_renderer_destroy(void *cookie)
Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
assert(rd_priv_ctx != NULL);
SDL_DestroyTexture(rd_priv_ctx->tex);
SDL_DestroyRenderer(rd_priv_ctx->renderer);
SDL_DestroyWindow(rd_priv_ctx->win);
SDL_DestroyMutex(rd_priv_ctx->lock);
free(rd_priv_ctx);
}
@@ -142,6 +152,7 @@ static int sdl_update_texture(void *cookie, Dav1dPicture *dav1d_pic,
if (texture == NULL) {
texture = SDL_CreateTexture(rd_priv_ctx->renderer, SDL_PIXELFORMAT_IYUV,
SDL_TEXTUREACCESS_STREAMING, width, height);
SDL_RenderSetLogicalSize(rd_priv_ctx->renderer, width, height);
}
SDL_UpdateYUVTexture(texture, NULL,
+8 -4
View File
@@ -40,7 +40,7 @@ dav1dplay_sources = files(
'dp_renderer_sdl.c',
)
sdl2_dependency = dependency('sdl2', version: '>= 2.0.1', required: true)
sdl2_dependency = dependency('sdl2', version: '>= 2.0.1', required: true, include_type: 'system')
if sdl2_dependency.found()
dav1dplay_deps = [sdl2_dependency, libm_dependency]
@@ -48,19 +48,23 @@ if sdl2_dependency.found()
placebo_dependency = dependency('libplacebo', version: '>= 4.160.0', required: false)
if placebo_dependency.found()
have_vulkan = false
have_placebo = placebo_dependency.found()
if have_placebo
dav1dplay_deps += placebo_dependency
dav1dplay_cflags += '-DHAVE_PLACEBO'
# If libplacebo is found, we might be able to use Vulkan
# with it, in which case we need the Vulkan library too.
vulkan_dependency = dependency('vulkan', required: false)
if vulkan_dependency.found()
dav1dplay_deps += vulkan_dependency
dav1dplay_cflags += '-DHAVE_VULKAN'
have_vulkan = true
endif
endif
dav1dplay_cflags += '-DHAVE_PLACEBO=' + (have_placebo ? '1' : '0')
dav1dplay_cflags += '-DHAVE_VULKAN=' + (have_vulkan ? '1' : '0')
dav1dplay = executable('dav1dplay',
dav1dplay_sources,
rev_target,
+10
View File
@@ -123,6 +123,12 @@
#define EXTERN extern
#endif
#if ARCH_X86_64 && __has_attribute(model)
#define ATTR_MCMODEL_SMALL __attribute__((model("small")))
#else
#define ATTR_MCMODEL_SMALL
#endif
#ifdef __clang__
#define NO_SANITIZE(x) __attribute__((no_sanitize(x)))
#else
@@ -189,9 +195,13 @@ static inline int clzll(const unsigned long long mask) {
#ifndef static_assert
#define CHECK_OFFSET(type, field, name) \
struct check_##type##_##field { int x[(name == offsetof(type, field)) ? 1 : -1]; }
#define CHECK_SIZE(type, size) \
struct check_##type##_size { int x[(size == sizeof(type)) ? 1 : -1]; }
#else
#define CHECK_OFFSET(type, field, name) \
static_assert(name == offsetof(type, field), #field)
#define CHECK_SIZE(type, size) \
static_assert(size == sizeof(type), #type)
#endif
#ifdef _MSC_VER
+2 -2
View File
@@ -65,11 +65,11 @@ static inline int apply_sign64(const int v, const int64_t s) {
}
static inline int ulog2(const unsigned v) {
return 31 - clz(v);
return 31 ^ clz(v);
}
static inline int u64log2(const uint64_t v) {
return 63 - clzll(v);
return 63 ^ clzll(v);
}
static inline unsigned inv_recenter(const unsigned r, const unsigned v) {
-3
View File
@@ -12,9 +12,6 @@
#define __GETOPT_H__
/* All the headers include this file. */
#include <crtdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
+2
View File
@@ -43,6 +43,8 @@ extern "C" {
#else
#define DAV1D_API
#endif
#elif defined __OS2__
#define DAV1D_API __declspec(dllexport)
#else
#if __GNUC__ >= 4
#define DAV1D_API __attribute__ ((visibility ("default")))
+4 -8
View File
@@ -187,14 +187,10 @@ typedef struct Dav1dContentLightLevel {
} Dav1dContentLightLevel;
typedef struct Dav1dMasteringDisplay {
///< 0.16 fixed point
uint16_t primaries[3][2];
///< 0.16 fixed point
uint16_t white_point[2];
///< 24.8 fixed point
uint32_t max_luminance;
///< 18.14 fixed point
uint32_t min_luminance;
uint16_t primaries[3][2]; ///< 0.16 fixed point
uint16_t white_point[2]; ///< 0.16 fixed point
uint32_t max_luminance; ///< 24.8 fixed point
uint32_t min_luminance; ///< 18.14 fixed point
} Dav1dMasteringDisplay;
typedef struct Dav1dITUTT35 {
+1 -10
View File
@@ -22,24 +22,15 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# installed version.h header generation
version_h_data = configuration_data()
version_h_data.set('DAV1D_API_VERSION_MAJOR', dav1d_api_version_major)
version_h_data.set('DAV1D_API_VERSION_MINOR', dav1d_api_version_minor)
version_h_data.set('DAV1D_API_VERSION_PATCH', dav1d_api_version_revision)
version_h_target = configure_file(input: 'version.h.in',
output: 'version.h',
configuration: version_h_data)
dav1d_api_headers = [
'common.h',
'data.h',
'dav1d.h',
'headers.h',
'picture.h',
'version.h',
]
# install headers
install_headers(dav1d_api_headers,
version_h_target,
subdir : 'dav1d')
@@ -1,5 +1,5 @@
/*
* Copyright © 2019, VideoLAN and dav1d authors
* Copyright © 2019-2024, VideoLAN and dav1d authors
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,9 +31,9 @@
extern "C" {
#endif
#define DAV1D_API_VERSION_MAJOR @DAV1D_API_VERSION_MAJOR@
#define DAV1D_API_VERSION_MINOR @DAV1D_API_VERSION_MINOR@
#define DAV1D_API_VERSION_PATCH @DAV1D_API_VERSION_PATCH@
#define DAV1D_API_VERSION_MAJOR 7
#define DAV1D_API_VERSION_MINOR 0
#define DAV1D_API_VERSION_PATCH 0
/**
* Extract version components from the value returned by
+147 -105
View File
@@ -1,4 +1,4 @@
# Copyright © 2018-2022, VideoLAN and dav1d authors
# Copyright © 2018-2026, VideoLAN and dav1d authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -23,18 +23,12 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
project('dav1d', ['c'],
version: '1.4.2',
version: '1.5.4',
default_options: ['c_std=c99',
'warning_level=2',
'buildtype=release',
'b_ndebug=if-release'],
meson_version: '>= 0.49.0')
dav1d_soname_version = '7.0.0'
dav1d_api_version_array = dav1d_soname_version.split('.')
dav1d_api_version_major = dav1d_api_version_array[0]
dav1d_api_version_minor = dav1d_api_version_array[1]
dav1d_api_version_revision = dav1d_api_version_array[2]
meson_version: '>= 0.54.0')
dav1d_src_root = meson.current_source_dir()
cc = meson.get_compiler('c')
@@ -48,7 +42,18 @@ cdata_asm = configuration_data()
# Include directories
dav1d_inc_dirs = include_directories(['.', 'include/dav1d', 'include'])
dav1d_api_version_major = cc.get_define('DAV1D_API_VERSION_MAJOR',
prefix: '#include "dav1d/version.h"',
include_directories: dav1d_inc_dirs).strip()
dav1d_api_version_minor = cc.get_define('DAV1D_API_VERSION_MINOR',
prefix: '#include "dav1d/version.h"',
include_directories: dav1d_inc_dirs).strip()
dav1d_api_version_revision = cc.get_define('DAV1D_API_VERSION_PATCH',
prefix: '#include "dav1d/version.h"',
include_directories: dav1d_inc_dirs).strip()
dav1d_soname_version = '@0@.@1@.@2@'.format(dav1d_api_version_major,
dav1d_api_version_minor,
dav1d_api_version_revision)
#
# Option handling
@@ -81,8 +86,6 @@ cdata.set10('TRIM_DSP_FUNCTIONS', get_option('trim_dsp') == 'true' or
# Logging option
cdata.set10('CONFIG_LOG', get_option('logging'))
cdata.set10('CONFIG_MACOS_KPERF', get_option('macos_kperf'))
#
# OS/Compiler checks and defines
#
@@ -98,6 +101,11 @@ if host_machine.system() in ['linux', 'gnu', 'emscripten']
add_project_arguments('-D_GNU_SOURCE', language: 'c')
endif
have_clock_gettime = false
have_sigaction = false
have_posix_memalign = false
have_memalign = false
have_aligned_alloc = false
if host_machine.system() == 'windows'
cdata.set('_WIN32_WINNT', '0x0601')
cdata.set('UNICODE', 1) # Define to 1 for Unicode (Wide Chars) APIs
@@ -138,27 +146,34 @@ if host_machine.system() == 'windows'
rc_data.set('API_VERSION_MAJOR', dav1d_api_version_major)
rc_data.set('API_VERSION_MINOR', dav1d_api_version_minor)
rc_data.set('API_VERSION_REVISION', dav1d_api_version_revision)
rc_data.set('COPYRIGHT_YEARS', '2018-2024')
rc_data.set('COPYRIGHT_YEARS', '2018-2026')
else
thread_dependency = dependency('threads')
thread_compat_dep = []
rt_dependency = []
if cc.has_function('clock_gettime', prefix : '#include <time.h>', args : test_args)
cdata.set('HAVE_CLOCK_GETTIME', 1)
have_clock_gettime = true
elif host_machine.system() not in ['darwin', 'ios', 'tvos']
rt_dependency = cc.find_library('rt', required: false)
if not cc.has_function('clock_gettime', prefix : '#include <time.h>', args : test_args, dependencies : rt_dependency)
error('clock_gettime not found')
endif
cdata.set('HAVE_CLOCK_GETTIME', 1)
have_clock_gettime = true
endif
if cc.has_function('posix_memalign', prefix : '#include <stdlib.h>', args : test_args)
cdata.set('HAVE_POSIX_MEMALIGN', 1)
endif
have_sigaction = cc.has_function('sigaction', prefix : '#include <signal.h>', args : test_args)
have_posix_memalign = cc.has_function('posix_memalign', prefix : '#include <stdlib.h>', args : test_args)
have_memalign = cc.has_function('memalign', prefix : '#include <malloc.h>', args : test_args)
have_aligned_alloc = cc.has_function('aligned_alloc', prefix : '#include <stdlib.h>', args : test_args)
endif
cdata.set10('HAVE_CLOCK_GETTIME', have_clock_gettime)
cdata.set10('HAVE_SIGACTION', have_sigaction)
cdata.set10('HAVE_POSIX_MEMALIGN', have_posix_memalign)
cdata.set10('HAVE_MEMALIGN', have_memalign)
cdata.set10('HAVE_ALIGNED_ALLOC', have_aligned_alloc)
# check for fseeko on android. It is not always available if _FILE_OFFSET_BITS is defined to 64
have_fseeko = true
if host_machine.system() == 'android'
@@ -175,12 +190,12 @@ if host_machine.system() == 'android'
endif
libdl_dependency = []
have_dlsym = false
if host_machine.system() == 'linux'
libdl_dependency = cc.find_library('dl', required : false)
if cc.has_function('dlsym', prefix : '#include <dlfcn.h>', args : test_args, dependencies : libdl_dependency)
cdata.set('HAVE_DLSYM', 1)
endif
have_dlsym = cc.has_function('dlsym', prefix : '#include <dlfcn.h>', args : test_args, dependencies : libdl_dependency)
endif
cdata.set10('HAVE_DLSYM', have_dlsym)
libm_dependency = cc.find_library('m', required: false)
@@ -209,19 +224,13 @@ if host_machine.cpu_family().startswith('wasm')
stdatomic_dependencies += thread_dependency.partial_dependency(compile_args: true)
endif
if cc.check_header('unistd.h')
cdata.set('HAVE_UNISTD_H', 1)
endif
if cc.check_header('io.h')
cdata.set('HAVE_IO_H', 1)
endif
if cc.check_header('pthread_np.h')
cdata.set('HAVE_PTHREAD_NP_H', 1)
test_args += '-DHAVE_PTHREAD_NP_H'
endif
cdata.set10('HAVE_SYS_TYPES_H', cc.check_header('sys/types.h'))
cdata.set10('HAVE_UNISTD_H', cc.check_header('unistd.h'))
cdata.set10('HAVE_IO_H', cc.check_header('io.h'))
have_pthread_np = cc.check_header('pthread_np.h')
cdata.set10('HAVE_PTHREAD_NP_H', have_pthread_np)
test_args += '-DHAVE_PTHREAD_NP_H=' + (have_pthread_np ? '1' : '0')
# Function checks
@@ -234,35 +243,32 @@ else
getopt_dependency = []
endif
have_getauxval = false
have_elf_aux_info = false
if (host_machine.cpu_family() == 'aarch64' or
host_machine.cpu_family().startswith('arm') or
host_machine.cpu_family().startswith('loongarch') or
host_machine.cpu() == 'ppc64le' or
host_machine.cpu_family().startswith('riscv'))
if cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_GETAUXVAL', 1)
endif
if cc.has_function('elf_aux_info', prefix : '#include <sys/auxv.h>', args : test_args)
cdata.set('HAVE_ELF_AUX_INFO', 1)
endif
have_getauxval = cc.has_function('getauxval', prefix : '#include <sys/auxv.h>', args : test_args)
have_elf_aux_info = cc.has_function('elf_aux_info', prefix : '#include <sys/auxv.h>', args : test_args)
endif
cdata.set10('HAVE_GETAUXVAL', have_getauxval)
cdata.set10('HAVE_ELF_AUX_INFO', have_elf_aux_info)
pthread_np_prefix = '''
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
#if HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
'''
if cc.has_function('pthread_getaffinity_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency)
cdata.set('HAVE_PTHREAD_GETAFFINITY_NP', 1)
endif
if cc.has_function('pthread_setaffinity_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency)
cdata.set('HAVE_PTHREAD_SETAFFINITY_NP', 1)
endif
cdata.set10('HAVE_PTHREAD_GETAFFINITY_NP', cc.has_function('pthread_getaffinity_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency))
cdata.set10('HAVE_PTHREAD_SETAFFINITY_NP', cc.has_function('pthread_setaffinity_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency))
cdata.set10('HAVE_PTHREAD_SETNAME_NP', cc.has_function('pthread_setname_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency))
cdata.set10('HAVE_PTHREAD_SET_NAME_NP', cc.has_function('pthread_set_name_np', prefix : pthread_np_prefix, args : test_args, dependencies : thread_dependency))
if cc.compiles('int x = _Generic(0, default: 0);', name: '_Generic', args: test_args)
cdata.set('HAVE_C11_GENERIC', 1)
endif
cdata.set10('HAVE_C11_GENERIC', cc.compiles('int x = _Generic(0, default: 0);', name: '_Generic', args: test_args))
# Compiler flag tests
@@ -296,7 +302,8 @@ else
optional_arguments += [
'-wd4028', # parameter different from declaration
'-wd4090', # broken with arrays of pointers
'-wd4996' # use of POSIX functions
'-wd4996', # use of POSIX functions
'-wd5287', # operands are different enum types
]
endif
@@ -341,8 +348,49 @@ if host_machine.cpu_family().startswith('x86')
cdata_asm.set('STACK_ALIGNMENT', stack_alignment)
endif
#
# ASM specific stuff
#
use_gaspp = false
if (is_asm_enabled and
(host_machine.cpu_family() == 'aarch64' or
host_machine.cpu_family().startswith('arm')) and
cc.get_argument_syntax() == 'msvc' and
(cc.get_id() != 'clang-cl' or meson.version().version_compare('<0.58.0')))
gaspp = find_program('gas-preprocessor.pl')
use_gaspp = true
gaspp_args = [
'-as-type', 'armasm',
'-arch', host_machine.cpu_family(),
'--',
host_machine.cpu_family() == 'aarch64' ? 'armasm64' : 'armasm',
'-nologo',
'-I@0@'.format(dav1d_src_root),
'-I@0@/'.format(meson.current_build_dir()),
]
gaspp_gen = generator(gaspp,
output: '@BASENAME@.obj',
arguments: gaspp_args + [
'@INPUT@',
'-c',
'-o', '@OUTPUT@'
])
endif
cdata.set10('ARCH_AARCH64', host_machine.cpu_family() == 'aarch64' or host_machine.cpu() == 'arm64')
cdata.set10('ARCH_ARM', host_machine.cpu_family().startswith('arm') and host_machine.cpu() != 'arm64')
have_as_func = false
have_as_arch = false
aarch64_extensions = {
'dotprod': 'udot v0.4s, v0.16b, v0.16b',
'i8mm': 'usdot v0.4s, v0.16b, v0.16b',
'sve': 'whilelt p0.s, x0, x1',
'sve2': 'sqrdmulh z0.s, z0.s, z0.s',
}
supported_aarch64_archexts = []
supported_aarch64_instructions = []
if (is_asm_enabled and
(host_machine.cpu_family() == 'aarch64' or
host_machine.cpu_family().startswith('arm')))
@@ -353,7 +401,6 @@ if (is_asm_enabled and
);
'''
have_as_func = cc.compiles(as_func_code)
cdata.set10('HAVE_AS_FUNC', have_as_func)
# fedora package build infrastructure uses a gcc specs file to enable
# '-fPIE' by default. The chosen way only adds '-fPIE' to the C compiler
@@ -374,7 +421,6 @@ if (is_asm_enabled and
if host_machine.cpu_family() == 'aarch64'
have_as_arch = cc.compiles('''__asm__ (".arch armv8-a");''')
cdata.set10('HAVE_AS_ARCH_DIRECTIVE', have_as_arch)
as_arch_str = ''
if have_as_arch
as_arch_level = 'armv8-a'
@@ -403,36 +449,53 @@ if (is_asm_enabled and
cdata.set('AS_ARCH_LEVEL', as_arch_level)
as_arch_str = '".arch ' + as_arch_level + '\\n"'
endif
extensions = {
'dotprod': 'udot v0.4s, v0.16b, v0.16b',
'i8mm': 'usdot v0.4s, v0.16b, v0.16b',
'sve': 'whilelt p0.s, x0, x1',
'sve2': 'sqrdmulh z0.s, z0.s, z0.s',
}
foreach name, instr : extensions
# Test for support for the various extensions. First test if
# the assembler supports the .arch_extension directive for
# enabling/disabling the extension, then separately check whether
# the instructions themselves are supported. Even if .arch_extension
# isn't supported, we may be able to assemble the instructions
# if the .arch level includes support for them.
code = '__asm__ (' + as_arch_str
code += '".arch_extension ' + name + '\\n"'
code += ');'
supports_archext = cc.compiles(code)
cdata.set10('HAVE_AS_ARCHEXT_' + name.to_upper() + '_DIRECTIVE', supports_archext)
code = '__asm__ (' + as_arch_str
if supports_archext
if use_gaspp
python3 = import('python').find_installation()
endif
foreach name, instr : aarch64_extensions
if use_gaspp
f = configure_file(
command: [python3, '-c', 'import sys; print(sys.argv[1])', '@0@'.format(instr)],
output: 'test-@0@.S'.format(name),
capture: true)
r = run_command(gaspp, gaspp_args, f, '-c', '-o', meson.current_build_dir() / 'test-' + name + '.obj', check: false)
message('Checking for gaspp/armasm64 ' + name.to_upper() + ': ' + (r.returncode() == 0 ? 'YES' : 'NO'))
if r.returncode() == 0
supported_aarch64_instructions += name
endif
else
# Test for support for the various extensions. First test if
# the assembler supports the .arch_extension directive for
# enabling/disabling the extension, then separately check whether
# the instructions themselves are supported. Even if .arch_extension
# isn't supported, we may be able to assemble the instructions
# if the .arch level includes support for them.
code = '__asm__ (' + as_arch_str
code += '".arch_extension ' + name + '\\n"'
code += ');'
supports_archext = cc.compiles(code)
code = '__asm__ (' + as_arch_str
if supports_archext
supported_aarch64_archexts += name
code += '".arch_extension ' + name + '\\n"'
endif
code += '"' + instr + '\\n"'
code += ');'
if cc.compiles(code, name: name.to_upper())
supported_aarch64_instructions += name
endif
endif
code += '"' + instr + '\\n"'
code += ');'
supports_instr = cc.compiles(code, name: name.to_upper())
cdata.set10('HAVE_' + name.to_upper(), supports_instr)
endforeach
endif
endif
cdata.set10('HAVE_AS_FUNC', have_as_func)
cdata.set10('HAVE_AS_ARCH_DIRECTIVE', have_as_arch)
foreach name, _ : aarch64_extensions
cdata.set10('HAVE_AS_ARCHEXT_' + name.to_upper() + '_DIRECTIVE', name in supported_aarch64_archexts)
cdata.set10('HAVE_' + name.to_upper(), name in supported_aarch64_instructions)
endforeach
cdata.set10('ARCH_X86', host_machine.cpu_family().startswith('x86'))
cdata.set10('ARCH_X86_64', host_machine.cpu_family() == 'x86_64')
cdata.set10('ARCH_X86_32', host_machine.cpu_family() == 'x86')
@@ -460,15 +523,12 @@ cdata.set10('ARCH_LOONGARCH64', host_machine.cpu_family() == 'loongarch64')
# meson's cc.symbols_have_underscore_prefix() is unfortunately unrelieably
# when additional flags like '-fprofile-instr-generate' are passed via CFLAGS
# see following meson issue https://github.com/mesonbuild/meson/issues/5482
if (host_machine.system() in ['darwin', 'ios', 'tvos'] or
if (host_machine.system() in ['darwin', 'ios', 'tvos', 'os/2'] or
(host_machine.system() == 'windows' and host_machine.cpu_family() == 'x86'))
cdata.set10('PREFIX', true)
cdata_asm.set10('PREFIX', true)
endif
#
# ASM specific stuff
#
if is_asm_enabled and host_machine.cpu_family().startswith('x86')
# NASM compiler support
@@ -499,7 +559,13 @@ if is_asm_enabled and host_machine.cpu_family().startswith('x86')
else
nasm_format = 'elf'
endif
if host_machine.cpu_family() == 'x86_64'
if host_machine.system() == 'os/2'
if get_option('os2_emxomf')
nasm_format = 'obj2'
else
nasm_format = 'aout'
endif
elif host_machine.cpu_family() == 'x86_64'
nasm_format += '64'
else
nasm_format += '32'
@@ -519,30 +585,6 @@ if is_asm_enabled and host_machine.cpu_family().startswith('x86')
])
endif
use_gaspp = false
if (is_asm_enabled and
(host_machine.cpu_family() == 'aarch64' or
host_machine.cpu_family().startswith('arm')) and
cc.get_argument_syntax() == 'msvc' and
(cc.get_id() != 'clang-cl' or meson.version().version_compare('<0.58.0')))
gaspp = find_program('gas-preprocessor.pl')
use_gaspp = true
gaspp_gen = generator(gaspp,
output: '@BASENAME@.obj',
arguments: [
'-as-type', 'armasm',
'-arch', host_machine.cpu_family(),
'--',
host_machine.cpu_family() == 'aarch64' ? 'armasm64' : 'armasm',
'-nologo',
'-I@0@'.format(dav1d_src_root),
'-I@0@/'.format(meson.current_build_dir()),
'@INPUT@',
'-c',
'-o', '@OUTPUT@'
])
endif
if is_asm_enabled and host_machine.cpu_family().startswith('riscv')
as_option_code = '''__asm__ (
".option arch, +v\n"
-5
View File
@@ -68,8 +68,3 @@ option('trim_dsp',
choices: ['true', 'false', 'if-release'],
value: 'if-release',
description: 'Eliminate redundant DSP functions where possible')
option('macos_kperf',
type: 'boolean',
value: false,
description: 'Use the private macOS kperf API for benchmarking')
+1 -1
View File
@@ -3,7 +3,7 @@ c = 'clang'
cpp = 'clang++'
ar = 'aarch64-linux-gnu-ar'
strip = 'aarch64-linux-gnu-strip'
exe_wrapper = 'qemu-aarch64'
exe_wrapper = ['qemu-aarch64', '-L', '/usr/aarch64-linux-gnu/']
[properties]
c_args = '-target aarch64-linux-gnu'
+1 -1
View File
@@ -3,7 +3,7 @@ c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-g++'
ar = 'aarch64-linux-gnu-ar'
strip = 'aarch64-linux-gnu-strip'
exe_wrapper = 'qemu-aarch64'
exe_wrapper = ['qemu-aarch64', '-L', '/usr/aarch64-linux-gnu/']
[host_machine]
system = 'linux'
+27
View File
@@ -0,0 +1,27 @@
[binaries]
c = ['clang', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk']
cpp = ['clang++', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk']
objc = ['clang', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk']
objcpp = ['clang++', '-arch', 'arm64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk']
ar = 'ar'
strip = 'strip'
[built-in options]
c_args = ['-miphoneos-version-min=11.0']
cpp_args = ['-miphoneos-version-min=11.0']
c_link_args = ['-miphoneos-version-min=11.0']
cpp_link_args = ['-miphoneos-version-min=11.0']
objc_args = ['-miphoneos-version-min=11.0']
objcpp_args = ['-miphoneos-version-min=11.0']
[properties]
root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer'
needs_exe_wrapper = true
[host_machine]
system = 'darwin'
subsystem = 'ios'
kernel = 'xnu'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'
+5 -5
View File
@@ -1,10 +1,10 @@
[binaries]
c = 'loongarch64-unknown-linux-gnu-gcc'
cpp = 'loongarch64-unknown-linux-gnu-c++'
ar = 'loongarch64-unknown-linux-gnu-ar'
strip = 'loongarch64-unknown-linux-gnu-strip'
c = 'loongarch64-linux-gnu-gcc'
cpp = 'loongarch64-linux-gnu-c++'
ar = 'loongarch64-linux-gnu-ar'
strip = 'loongarch64-linux-gnu-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'qemu-loongarch64'
exe_wrapper = ['qemu-loongarch64', '-L', '/usr/loongarch64-linux-gnu/']
[host_machine]
system = 'linux'
+1 -1
View File
@@ -3,7 +3,7 @@ c = 'clang'
cpp = 'clang++'
ar = 'riscv64-linux-gnu-ar'
strip = 'riscv64-linux-gnu-strip'
exe_wrapper = 'qemu-riscv64'
exe_wrapper = ['qemu-riscv64', '-L', '/usr/riscv64-linux-gnu/']
[properties]
c_args = '-target riscv64-linux-gnu'
+1 -1
View File
@@ -3,7 +3,7 @@ c = 'riscv64-linux-gnu-gcc'
cpp = 'riscv64-linux-gnu-g++'
ar = 'riscv64-linux-gnu-ar'
strip = 'riscv64-linux-gnu-strip'
exe_wrapper = 'qemu-riscv64'
exe_wrapper = ['qemu-riscv64', '-L', '/usr/riscv64-linux-gnu/']
[host_machine]
system = 'linux'
@@ -0,0 +1,27 @@
[binaries]
c = ['clang', '-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk']
cpp = ['clang++', '-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk']
objc = ['clang', '-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk']
objcpp = ['clang++', '-arch', 'x86_64', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk']
ar = 'ar'
strip = 'strip'
[built-in options]
c_args = ['-miphoneos-version-min=11.0']
cpp_args = ['-miphoneos-version-min=11.0']
c_link_args = ['-miphoneos-version-min=11.0']
cpp_link_args = ['-miphoneos-version-min=11.0']
objc_args = ['-miphoneos-version-min=11.0']
objcpp_args = ['-miphoneos-version-min=11.0']
[properties]
root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer'
needs_exe_wrapper = true
[host_machine]
system = 'darwin'
subsystem = 'ios-simulator'
kernel = 'xnu'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
+2 -2
View File
@@ -540,7 +540,7 @@ L(ipred_dc_left_w64):
vst1.8 {d0, d1, d2, d3}, [r12, :128]!
vst1.8 {d0, d1, d2, d3}, [r0, :128], r1
vst1.8 {d0, d1, d2, d3}, [r12, :128], r1
subs r4, r4, #4
subs r4, r4, #4
vst1.8 {d0, d1, d2, d3}, [r0, :128]!
vst1.8 {d0, d1, d2, d3}, [r12, :128]!
vst1.8 {d0, d1, d2, d3}, [r0, :128], r1
@@ -692,7 +692,7 @@ L(ipred_dc_w16):
2:
vst1.8 {d0, d1}, [r0, :128], r1
vst1.8 {d0, d1}, [r12, :128], r1
subs r4, r4, #4
subs r4, r4, #4
vst1.8 {d0, d1}, [r0, :128], r1
vst1.8 {d0, d1}, [r12, :128], r1
bgt 2b
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+87 -324
View File
@@ -28,341 +28,119 @@
#include "src/arm/asm.S"
#include "util.S"
#define SUM_STRIDE (384+16)
// void dav1d_sgr_box3_v_neon(int32_t *sumsq, int16_t *sum,
// const int w, const int h,
// const enum LrEdgeFlags edges);
function sgr_box3_v_neon, export=1
// void dav1d_sgr_box3_row_v_neon(int32_t **sumsq, int16_t **sum,
// int32_t *sumsq_out, int16_t *sum_out,
// const int w);
function sgr_box3_row_v_neon, export=1
push {r4-r9,lr}
ldr r4, [sp, #28]
add r12, r3, #2 // Number of output rows to move back
mov lr, r3 // Number of input rows to move back
add r2, r2, #2 // Actual summed width
mov r7, #(4*SUM_STRIDE) // sumsq stride
mov r8, #(2*SUM_STRIDE) // sum stride
sub r0, r0, #(4*SUM_STRIDE) // sumsq -= stride
sub r1, r1, #(2*SUM_STRIDE) // sum -= stride
tst r4, #4 // LR_HAVE_TOP
beq 0f
// If have top, read from row -2.
sub r5, r0, #(4*SUM_STRIDE)
sub r6, r1, #(2*SUM_STRIDE)
add lr, lr, #2
b 1f
0:
// !LR_HAVE_TOP
// If we don't have top, read from row 0 even if
// we start writing to row -1.
add r5, r0, #(4*SUM_STRIDE)
add r6, r1, #(2*SUM_STRIDE)
1:
tst r4, #8 // LR_HAVE_BOTTOM
beq 1f
// LR_HAVE_BOTTOM
add r3, r3, #2 // Sum all h+2 lines with the main loop
add lr, lr, #2
1:
mov r9, r3 // Backup of h for next loops
ldrd r6, r7, [r0]
ldr r0, [r0, #8]
add r4, r4, #2
ldrd r8, r9, [r1]
ldr r1, [r1, #8]
1:
// Start of horizontal loop; start one vertical filter slice.
// Start loading rows into q8-q13 and q0-q2 taking top
// padding into consideration.
tst r4, #4 // LR_HAVE_TOP
vld1.32 {q8, q9}, [r5, :128], r7
vld1.16 {q0}, [r6, :128], r8
beq 2f
// LR_HAVE_TOP
vld1.32 {q10, q11}, [r5, :128], r7
vld1.16 {q1}, [r6, :128], r8
vld1.32 {q12, q13}, [r5, :128], r7
vld1.16 {q2}, [r6, :128], r8
b 3f
2: // !LR_HAVE_TOP
vmov q10, q8
vmov q11, q9
vmov q1, q0
vmov q12, q8
vmov q13, q9
vmov q2, q0
vld1.32 {q8, q9}, [r6]!
vld1.32 {q10, q11}, [r7]!
vld1.16 {q14}, [r8]!
vld1.16 {q15}, [r9]!
subs r4, r4, #8
3:
subs r3, r3, #1
.macro add3
vadd.i32 q8, q8, q10
vadd.i32 q9, q9, q11
vld1.32 {q12, q13}, [r0]!
vadd.i16 q14, q14, q15
vld1.16 {q15}, [r1]!
vadd.i32 q8, q8, q12
vadd.i32 q9, q9, q13
vadd.i16 q14, q14, q15
vst1.32 {q8, q9}, [r2]!
vst1.16 {q14}, [r3]!
bgt 1b
pop {r4-r9,pc}
endfunc
// void dav1d_sgr_box5_row_v_neon(int32_t **sumsq, int16_t **sum,
// int32_t *sumsq_out, int16_t *sum_out,
// const int w);
function sgr_box5_row_v_neon, export=1
push {r4-r11,lr}
ldr lr, [sp, #36]
ldrd r4, r5, [r0]
ldrd r6, r7, [r0, #8]
ldr r0, [r0, #16]
add lr, lr, #2
ldrd r8, r9, [r1]
ldrd r10, r11, [r1, #8]
ldr r1, [r1, #16]
1:
vld1.32 {q8, q9}, [r4]!
vld1.32 {q10, q11}, [r5]!
vld1.32 {q12, q13}, [r6]!
vld1.32 {q14, q15}, [r7]!
vld1.16 {q0}, [r8]!
vld1.16 {q1}, [r9]!
vld1.16 {q2}, [r10]!
vld1.16 {q3}, [r11]!
subs lr, lr, #8
vadd.i32 q8, q8, q10
vadd.i32 q9, q9, q11
vadd.i32 q12, q12, q14
vadd.i32 q13, q13, q15
vld1.32 {q14, q15}, [r0]!
vadd.i16 q0, q0, q1
vadd.i16 q2, q2, q3
vld1.16 {q3}, [r1]!
vadd.i32 q8, q8, q12
vadd.i32 q9, q9, q13
vadd.i16 q0, q0, q2
vst1.32 {q8, q9}, [r0, :128], r7
vst1.16 {q0}, [r1, :128], r8
.endm
add3
vmov q8, q10
vmov q9, q11
vmov q0, q1
vmov q10, q12
vmov q11, q13
vmov q1, q2
ble 4f
vld1.32 {q12, q13}, [r5, :128], r7
vld1.16 {q2}, [r6, :128], r8
b 3b
4:
tst r4, #8 // LR_HAVE_BOTTOM
bne 5f
// !LR_HAVE_BOTTOM
// Produce two more rows, extending the already loaded rows.
add3
vmov q8, q10
vmov q9, q11
vmov q0, q1
add3
5: // End of one vertical slice.
subs r2, r2, #8
ble 0f
// Move pointers back up to the top and loop horizontally.
// Input pointers
mls r5, r7, lr, r5
mls r6, r8, lr, r6
// Output pointers
mls r0, r7, r12, r0
mls r1, r8, r12, r1
add r0, r0, #32
add r1, r1, #16
add r5, r5, #32
add r6, r6, #16
mov r3, r9
b 1b
0:
pop {r4-r9,pc}
.purgem add3
endfunc
// void dav1d_sgr_box5_v_neon(int32_t *sumsq, int16_t *sum,
// const int w, const int h,
// const enum LrEdgeFlags edges);
function sgr_box5_v_neon, export=1
push {r4-r9,lr}
vpush {q5-q7}
ldr r4, [sp, #76]
add r12, r3, #2 // Number of output rows to move back
mov lr, r3 // Number of input rows to move back
add r2, r2, #8 // Actual summed width
mov r7, #(4*SUM_STRIDE) // sumsq stride
mov r8, #(2*SUM_STRIDE) // sum stride
sub r0, r0, #(4*SUM_STRIDE) // sumsq -= stride
sub r1, r1, #(2*SUM_STRIDE) // sum -= stride
tst r4, #4 // LR_HAVE_TOP
beq 0f
// If have top, read from row -2.
sub r5, r0, #(4*SUM_STRIDE)
sub r6, r1, #(2*SUM_STRIDE)
add lr, lr, #2
b 1f
0:
// !LR_HAVE_TOP
// If we don't have top, read from row 0 even if
// we start writing to row -1.
add r5, r0, #(4*SUM_STRIDE)
add r6, r1, #(2*SUM_STRIDE)
1:
tst r4, #8 // LR_HAVE_BOTTOM
beq 0f
// LR_HAVE_BOTTOM
add r3, r3, #2 // Handle h+2 lines with the main loop
add lr, lr, #2
b 1f
0:
// !LR_HAVE_BOTTOM
sub r3, r3, #1 // Handle h-1 lines with the main loop
1:
mov r9, r3 // Backup of h for next loops
1:
// Start of horizontal loop; start one vertical filter slice.
// Start loading rows into q6-q15 and q0-q3,q5 taking top
// padding into consideration.
tst r4, #4 // LR_HAVE_TOP
vld1.32 {q6, q7}, [r5, :128], r7
vld1.16 {q0}, [r6, :128], r8
beq 2f
// LR_HAVE_TOP
vld1.32 {q10, q11}, [r5, :128], r7
vld1.16 {q2}, [r6, :128], r8
vmov q8, q6
vmov q9, q7
vmov q1, q0
vld1.32 {q12, q13}, [r5, :128], r7
vld1.16 {q3}, [r6, :128], r8
b 3f
2: // !LR_HAVE_TOP
vmov q8, q6
vmov q9, q7
vmov q1, q0
vmov q10, q6
vmov q11, q7
vmov q2, q0
vmov q12, q6
vmov q13, q7
vmov q3, q0
3:
cmp r3, #0
beq 4f
vld1.32 {q14, q15}, [r5, :128], r7
vld1.16 {q5}, [r6, :128], r8
3:
// Start of vertical loop
subs r3, r3, #2
.macro add5
vadd.i32 q6, q6, q8
vadd.i32 q7, q7, q9
vadd.i16 q0, q0, q1
vadd.i32 q6, q6, q10
vadd.i32 q7, q7, q11
vadd.i16 q0, q0, q2
vadd.i32 q6, q6, q12
vadd.i32 q7, q7, q13
vadd.i32 q8, q8, q14
vadd.i32 q9, q9, q15
vadd.i16 q0, q0, q3
vadd.i32 q6, q6, q14
vadd.i32 q7, q7, q15
vadd.i16 q0, q0, q5
vst1.32 {q6, q7}, [r0, :128], r7
vst1.16 {q0}, [r1, :128], r8
.endm
add5
.macro shift2
vmov q6, q10
vmov q7, q11
vmov q0, q2
vmov q8, q12
vmov q9, q13
vmov q1, q3
vmov q10, q14
vmov q11, q15
vmov q2, q5
.endm
shift2
add r0, r0, r7
add r1, r1, r8
ble 5f
vld1.32 {q12, q13}, [r5, :128], r7
vld1.16 {q3}, [r6, :128], r8
vld1.32 {q14, q15}, [r5, :128], r7
vld1.16 {q5}, [r6, :128], r8
b 3b
4:
// h == 1, !LR_HAVE_BOTTOM.
// Pad the last row with the only content row, and add.
vmov q14, q12
vmov q15, q13
vmov q5, q3
add5
shift2
add r0, r0, r7
add r1, r1, r8
add5
b 6f
vst1.32 {q8, q9}, [r2]!
vst1.16 {q0}, [r3]!
5:
tst r4, #8 // LR_HAVE_BOTTOM
bne 6f
// !LR_HAVE_BOTTOM
cmp r3, #0
bne 5f
// The intended three edge rows left; output the one at h-2 and
// the past edge one at h.
vld1.32 {q12, q13}, [r5, :128], r7
vld1.16 {q3}, [r6, :128], r8
// Pad the past-edge row from the last content row.
vmov q14, q12
vmov q15, q13
vmov q5, q3
add5
shift2
add r0, r0, r7
add r1, r1, r8
// The last two rows are already padded properly here.
add5
b 6f
5:
// r3 == -1, two rows left, output one.
// Pad the last two rows from the mid one.
vmov q12, q10
vmov q13, q11
vmov q3, q2
vmov q14, q10
vmov q15, q11
vmov q5, q2
add5
add r0, r0, r7
add r1, r1, r8
b 6f
6: // End of one vertical slice.
subs r2, r2, #8
ble 0f
// Move pointers back up to the top and loop horizontally.
// Input pointers
mls r5, r7, lr, r5
mls r6, r8, lr, r6
// Output pointers
mls r0, r7, r12, r0
mls r1, r8, r12, r1
add r0, r0, #32
add r1, r1, #16
add r5, r5, #32
add r6, r6, #16
mov r3, r9
b 1b
0:
vpop {q5-q7}
pop {r4-r9,pc}
.purgem add5
bgt 1b
pop {r4-r11,pc}
endfunc
// void dav1d_sgr_calc_ab1_neon(int32_t *a, int16_t *b,
// const int w, const int h, const int strength,
// const int bitdepth_max);
// void dav1d_sgr_calc_ab2_neon(int32_t *a, int16_t *b,
// const int w, const int h, const int strength,
// const int bitdepth_max);
function sgr_calc_ab1_neon, export=1
// void dav1d_sgr_calc_row_ab1_neon(int32_t *a, int16_t *b,
// const int w, const int strength,
// const int bitdepth_max);
// void dav1d_sgr_calc_row_ab2_neon(int32_t *a, int16_t *b,
// const int w, const int strength,
// const int bitdepth_max);
function sgr_calc_row_ab1_neon, export=1
push {r4-r7,lr}
vpush {q4-q7}
ldrd r4, r5, [sp, #84]
add r3, r3, #2 // h += 2
clz r6, r5
ldr r4, [sp, #84]
clz r6, r4
vmov.i32 q15, #9 // n
movw r5, #455
mov lr, #SUM_STRIDE
b sgr_calc_ab_neon
endfunc
function sgr_calc_ab2_neon, export=1
function sgr_calc_row_ab2_neon, export=1
push {r4-r7,lr}
vpush {q4-q7}
ldrd r4, r5, [sp, #84]
add r3, r3, #3 // h += 3
clz r6, r5
asr r3, r3, #1 // h /= 2
ldr r4, [sp, #84]
clz r6, r4
vmov.i32 q15, #25 // n
mov r5, #164
mov lr, #(2*SUM_STRIDE)
endfunc
function sgr_calc_ab_neon
@@ -379,20 +157,14 @@ function sgr_calc_ab_neon
vmov.i8 d14, #254 // idx of last 1
vmov.i8 d15, #32 // elements consumed in first vtbl
add r2, r2, #2 // w += 2
add r12, r2, #7
bic r12, r12, #7 // aligned w
sub r12, lr, r12 // increment between rows
vdup.32 q12, r4
sub r0, r0, #(4*(SUM_STRIDE))
sub r1, r1, #(2*(SUM_STRIDE))
mov r4, r2 // backup of w
vdup.32 q12, r3
vsub.i8 q8, q8, q11
vsub.i8 q9, q9, q11
vsub.i8 q10, q10, q11
vdup.32 q13, r7 // -2*bitdepth_min_8
1:
vld1.32 {q0, q1}, [r0, :128] // a
vld1.16 {q2}, [r1, :128] // b
vdup.32 q13, r7 // -2*bitdepth_min_8
vdup.16 q14, r6 // -bitdepth_min_8
subs r2, r2, #8
vrshl.s32 q0, q0, q13
@@ -426,7 +198,6 @@ function sgr_calc_ab_neon
vadd.i8 d1, d1, d2
vmovl.u8 q0, d1 // x
vmov.i16 q13, #256
vdup.32 q14, r5 // one_by_x
vmull.u16 q1, d0, d4 // x * BB[i]
@@ -435,19 +206,11 @@ function sgr_calc_ab_neon
vmul.i32 q2, q2, q14 // x * BB[i] * sgr_one_by_x
vrshr.s32 q1, q1, #12 // AA[i]
vrshr.s32 q2, q2, #12 // AA[i]
vsub.i16 q0, q13, q0 // 256 - x
vst1.32 {q1, q2}, [r0, :128]!
vst1.16 {q0}, [r1, :128]!
bgt 1b
subs r3, r3, #1
ble 0f
add r0, r0, r12, lsl #2
add r1, r1, r12, lsl #1
mov r2, r4
b 1b
0:
vpop {q4-q7}
pop {r4-r7,pc}
endfunc
+133 -323
View File
@@ -30,44 +30,30 @@
#define FILTER_OUT_STRIDE 384
.macro sgr_funcs bpc
// void dav1d_sgr_finish_filter1_Xbpc_neon(int16_t *tmp,
// const pixel *src, const ptrdiff_t stride,
// const int32_t *a, const int16_t *b,
// const int w, const int h);
function sgr_finish_filter1_\bpc\()bpc_neon, export=1
// void dav1d_sgr_finish_filter_row1_Xbpc_neon(int16_t *tmp,
// const pixel *src,
// const int32_t **a, const int16_t **b,
// const int w);
function sgr_finish_filter_row1_\bpc\()bpc_neon, export=1
push {r4-r11,lr}
vpush {q4-q7}
ldrd r4, r5, [sp, #100]
ldr r6, [sp, #108]
sub r7, r3, #(4*SUM_STRIDE)
add r8, r3, #(4*SUM_STRIDE)
sub r9, r4, #(2*SUM_STRIDE)
add r10, r4, #(2*SUM_STRIDE)
mov r11, #SUM_STRIDE
mov r12, #FILTER_OUT_STRIDE
add lr, r5, #3
bic lr, lr, #3 // Aligned width
.if \bpc == 8
sub r2, r2, lr
.else
sub r2, r2, lr, lsl #1
.endif
sub r12, r12, lr
sub r11, r11, lr
sub r11, r11, #4 // We read 4 extra elements from both a and b
mov lr, r5
ldr r4, [sp, #100]
ldrd r6, r7, [r2]
ldr r2, [r2, #8]
ldrd r8, r9, [r3]
ldr r3, [r3, #8]
vmov.i16 q14, #3
vmov.i32 q15, #3
1:
vld1.16 {q0}, [r9, :128]!
vld1.16 {q1}, [r4, :128]!
vld1.16 {q2}, [r10, :128]!
vld1.32 {q8, q9}, [r7, :128]!
vld1.32 {q10, q11}, [r3, :128]!
vld1.32 {q12, q13}, [r8, :128]!
vld1.16 {q0}, [r8, :128]!
vld1.16 {q1}, [r9, :128]!
vld1.16 {q2}, [r3, :128]!
vld1.32 {q8, q9}, [r6, :128]!
vld1.32 {q10, q11}, [r7, :128]!
vld1.32 {q12, q13}, [r2, :128]!
2:
subs r5, r5, #4
subs r4, r4, #4
vext.8 d6, d0, d1, #2 // -stride
vext.8 d7, d2, d3, #2 // 0
vext.8 d8, d4, d5, #2 // +stride
@@ -108,7 +94,7 @@ function sgr_finish_filter1_\bpc\()bpc_neon, export=1
vmovl.u8 q12, d24 // src
.endif
vmov d0, d1
vmlal.u16 q3, d2, d24 // b + a * src
vmlsl.u16 q3, d2, d24 // b - a * src
vmov d2, d3
vrshrn.i32 d6, q3, #9
vmov d4, d5
@@ -118,67 +104,42 @@ function sgr_finish_filter1_\bpc\()bpc_neon, export=1
vmov q8, q9
vmov q10, q11
vmov q12, q13
vld1.16 {d1}, [r9, :64]!
vld1.16 {d3}, [r4, :64]!
vld1.16 {d5}, [r10, :64]!
vld1.32 {q9}, [r7, :128]!
vld1.32 {q11}, [r3, :128]!
vld1.32 {q13}, [r8, :128]!
vld1.16 {d1}, [r8, :64]!
vld1.16 {d3}, [r9, :64]!
vld1.16 {d5}, [r3, :64]!
vld1.32 {q9}, [r6, :128]!
vld1.32 {q11}, [r7, :128]!
vld1.32 {q13}, [r2, :128]!
b 2b
3:
subs r6, r6, #1
ble 0f
mov r5, lr
add r0, r0, r12, lsl #1
add r1, r1, r2
add r3, r3, r11, lsl #2
add r7, r7, r11, lsl #2
add r8, r8, r11, lsl #2
add r4, r4, r11, lsl #1
add r9, r9, r11, lsl #1
add r10, r10, r11, lsl #1
b 1b
0:
vpop {q4-q7}
pop {r4-r11,pc}
endfunc
// void dav1d_sgr_finish_filter2_Xbpc_neon(int16_t *tmp,
// const pixel *src, const ptrdiff_t stride,
// const int32_t *a, const int16_t *b,
// const int w, const int h);
function sgr_finish_filter2_\bpc\()bpc_neon, export=1
// void dav1d_sgr_finish_filter2_2rows_Xbpc_neon(int16_t *tmp,
// const pixel *src, const ptrdiff_t stride,
// const int32_t **a, const int16_t **b,
// const int w, const int h);
function sgr_finish_filter2_2rows_\bpc\()bpc_neon, export=1
push {r4-r11,lr}
vpush {q4-q7}
ldrd r4, r5, [sp, #100]
ldr r6, [sp, #108]
add r7, r3, #(4*(SUM_STRIDE))
sub r3, r3, #(4*(SUM_STRIDE))
add r8, r4, #(2*(SUM_STRIDE))
sub r4, r4, #(2*(SUM_STRIDE))
mov r9, #(2*SUM_STRIDE)
mov r10, #FILTER_OUT_STRIDE
add r11, r5, #7
bic r11, r11, #7 // Aligned width
.if \bpc == 8
sub r2, r2, r11
.else
sub r2, r2, r11, lsl #1
.endif
sub r10, r10, r11
sub r9, r9, r11
sub r9, r9, #4 // We read 4 extra elements from a
sub r12, r9, #4 // We read 8 extra elements from b
ldrd r8, r9, [r3]
ldrd r10, r11, [r4]
mov r7, #2*FILTER_OUT_STRIDE
add r2, r1, r2
add r7, r7, r0
mov lr, r5
1:
vld1.16 {q0, q1}, [r4, :128]!
vld1.16 {q2, q3}, [r8, :128]!
vld1.32 {q8, q9}, [r3, :128]!
vld1.32 {q11, q12}, [r7, :128]!
vld1.32 {q10}, [r3, :128]!
vld1.32 {q13}, [r7, :128]!
vld1.16 {q0, q1}, [r10, :128]!
vld1.16 {q2, q3}, [r11, :128]!
vld1.32 {q8, q9}, [r8, :128]!
vld1.32 {q11, q12}, [r9, :128]!
vld1.32 {q10}, [r8, :128]!
vld1.32 {q13}, [r9, :128]!
2:
vmov.i16 q14, #5
@@ -229,8 +190,8 @@ function sgr_finish_filter2_\bpc\()bpc_neon, export=1
.if \bpc == 8
vmovl.u8 q2, d4
.endif
vmlal.u16 q4, d0, d4 // b + a * src
vmlal.u16 q5, d1, d5 // b + a * src
vmlsl.u16 q4, d0, d4 // b - a * src
vmlsl.u16 q5, d1, d5 // b - a * src
vmov q0, q1
vrshrn.i32 d8, q4, #9
vrshrn.i32 d9, q5, #9
@@ -240,26 +201,24 @@ function sgr_finish_filter2_\bpc\()bpc_neon, export=1
ble 3f
vmov q8, q10
vmov q11, q13
vld1.16 {q1}, [r4, :128]!
vld1.16 {q3}, [r8, :128]!
vld1.32 {q9, q10}, [r3, :128]!
vld1.32 {q12, q13}, [r7, :128]!
vld1.16 {q1}, [r10, :128]!
vld1.16 {q3}, [r11, :128]!
vld1.32 {q9, q10}, [r8, :128]!
vld1.32 {q12, q13}, [r9, :128]!
b 2b
3:
subs r6, r6, #1
ble 0f
mov r5, lr
add r0, r0, r10, lsl #1
add r1, r1, r2
add r3, r3, r9, lsl #2
add r7, r7, r9, lsl #2
add r4, r4, r12, lsl #1
add r8, r8, r12, lsl #1
ldrd r8, r9, [r3]
ldrd r10, r11, [r4]
mov r0, r7
mov r1, r2
vld1.32 {q8, q9}, [r3, :128]!
vld1.16 {q0, q1}, [r4, :128]!
vld1.32 {q10}, [r3, :128]!
vld1.32 {q8, q9}, [r9, :128]!
vld1.16 {q0, q1}, [r11, :128]!
vld1.32 {q10}, [r9, :128]!
vmov.i16 q12, #5
vmov.i16 q13, #6
@@ -291,8 +250,8 @@ function sgr_finish_filter2_\bpc\()bpc_neon, export=1
vmul.i32 q5, q5, q15 // * 6
vmla.i32 q5, q9, q14 // * 5 -> b
vmlal.u16 q4, d4, d22 // b + a * src
vmlal.u16 q5, d5, d23
vmlsl.u16 q4, d4, d22 // b - a * src
vmlsl.u16 q5, d5, d23
vmov q0, q1
vrshrn.i32 d8, q4, #8
vrshrn.i32 d9, q5, #8
@@ -300,301 +259,152 @@ function sgr_finish_filter2_\bpc\()bpc_neon, export=1
vst1.16 {q4}, [r0, :128]!
ble 5f
vld1.16 {q1}, [r4, :128]!
vld1.32 {q9, q10}, [r3, :128]!
vld1.16 {q1}, [r11, :128]!
vld1.32 {q9, q10}, [r9, :128]!
b 4b
5:
subs r6, r6, #1
ble 0f
mov r5, lr
sub r3, r3, r11, lsl #2 // Rewind r3/r4 to where they started
sub r4, r4, r11, lsl #1
add r0, r0, r10, lsl #1
add r1, r1, r2
sub r3, r3, #16
sub r4, r4, #16
b 1b
0:
vpop {q4-q7}
pop {r4-r11,pc}
endfunc
// void dav1d_sgr_weighted1_Xbpc_neon(pixel *dst, const ptrdiff_t dst_stride,
// const pixel *src, const ptrdiff_t src_stride,
// const int16_t *t1, const int w, const int h,
// const int wt, const int bitdepth_max);
function sgr_weighted1_\bpc\()bpc_neon, export=1
push {r4-r9,lr}
ldrd r4, r5, [sp, #28]
ldrd r6, r7, [sp, #36]
// void dav1d_sgr_weighted_row1_Xbpc_neon(pixel *dst,
// const int16_t *t1, const int w,
// const int w1, const int bitdepth_max);
function sgr_weighted_row1_\bpc\()bpc_neon, export=1
push {lr}
.if \bpc == 16
ldr r8, [sp, #44]
ldr lr, [sp, #4]
.endif
vdup.16 d31, r7
cmp r6, #2
vdup.16 d31, r3
.if \bpc == 16
vdup.16 q14, r8
vmov.i16 q13, #0
vdup.16 q14, lr
.endif
add r9, r0, r1
add r12, r2, r3
add lr, r4, #2*FILTER_OUT_STRIDE
mov r7, #(4*FILTER_OUT_STRIDE)
lsl r1, r1, #1
lsl r3, r3, #1
add r8, r5, #7
bic r8, r8, #7 // Aligned width
.if \bpc == 8
sub r1, r1, r8
sub r3, r3, r8
.else
sub r1, r1, r8, lsl #1
sub r3, r3, r8, lsl #1
.endif
sub r7, r7, r8, lsl #1
mov r8, r5
blt 2f
1:
.if \bpc == 8
vld1.8 {d0}, [r2, :64]!
vld1.8 {d16}, [r12, :64]!
vld1.8 {d0}, [r0, :64]
.else
vld1.16 {q0}, [r2, :128]!
vld1.16 {q8}, [r12, :128]!
vld1.16 {q0}, [r0, :128]
.endif
vld1.16 {q1}, [r4, :128]!
vld1.16 {q9}, [lr, :128]!
subs r5, r5, #8
.if \bpc == 8
vshll.u8 q0, d0, #4 // u
vshll.u8 q8, d16, #4 // u
.else
vshl.i16 q0, q0, #4 // u
vshl.i16 q8, q8, #4 // u
.endif
vsub.i16 q1, q1, q0 // t1 - u
vsub.i16 q9, q9, q8 // t1 - u
vshll.u16 q2, d0, #7 // u << 7
vshll.u16 q3, d1, #7 // u << 7
vshll.u16 q10, d16, #7 // u << 7
vshll.u16 q11, d17, #7 // u << 7
vmlal.s16 q2, d2, d31 // v
vmlal.s16 q3, d3, d31 // v
vmlal.s16 q10, d18, d31 // v
vmlal.s16 q11, d19, d31 // v
.if \bpc == 8
vld1.16 {q1}, [r1, :128]!
subs r2, r2, #8
vmull.s16 q2, d2, d31 // v
vmull.s16 q3, d3, d31 // v
vrshrn.i32 d4, q2, #11
vrshrn.i32 d5, q3, #11
vrshrn.i32 d20, q10, #11
vrshrn.i32 d21, q11, #11
vqmovun.s16 d4, q2
vqmovun.s16 d20, q10
vst1.8 {d4}, [r0, :64]!
vst1.8 {d20}, [r9, :64]!
.else
vqrshrun.s32 d4, q2, #11
vqrshrun.s32 d5, q3, #11
vqrshrun.s32 d20, q10, #11
vqrshrun.s32 d21, q11, #11
vmin.u16 q2, q2, q14
vmin.u16 q10, q10, q14
vst1.16 {q2}, [r0, :128]!
vst1.16 {q10}, [r9, :128]!
.endif
bgt 1b
sub r6, r6, #2
cmp r6, #1
blt 0f
mov r5, r8
add r0, r0, r1
add r9, r9, r1
add r2, r2, r3
add r12, r12, r3
add r4, r4, r7
add lr, lr, r7
beq 2f
b 1b
2:
.if \bpc == 8
vld1.8 {d0}, [r2, :64]!
.else
vld1.16 {q0}, [r2, :128]!
.endif
vld1.16 {q1}, [r4, :128]!
subs r5, r5, #8
.if \bpc == 8
vshll.u8 q0, d0, #4 // u
.else
vshl.i16 q0, q0, #4 // u
.endif
vsub.i16 q1, q1, q0 // t1 - u
vshll.u16 q2, d0, #7 // u << 7
vshll.u16 q3, d1, #7 // u << 7
vmlal.s16 q2, d2, d31 // v
vmlal.s16 q3, d3, d31 // v
.if \bpc == 8
vrshrn.i32 d4, q2, #11
vrshrn.i32 d5, q3, #11
vaddw.u8 q2, q2, d0
vqmovun.s16 d2, q2
vst1.8 {d2}, [r0, :64]!
.else
vqrshrun.s32 d4, q2, #11
vqrshrun.s32 d5, q3, #11
vadd.i16 q2, q2, q0
vmax.s16 q2, q2, q13
vmin.u16 q2, q2, q14
vst1.16 {q2}, [r0, :128]!
.endif
bgt 2b
bgt 1b
0:
pop {r4-r9,pc}
pop {pc}
endfunc
// void dav1d_sgr_weighted2_Xbpc_neon(pixel *dst, const ptrdiff_t stride,
// const pixel *src, const ptrdiff_t src_stride,
// const int16_t *t1, const int16_t *t2,
// const int w, const int h,
// const int16_t wt[2], const int bitdepth_max);
function sgr_weighted2_\bpc\()bpc_neon, export=1
push {r4-r11,lr}
ldrd r4, r5, [sp, #36]
ldrd r6, r7, [sp, #44]
push {r4-r8,lr}
ldrd r4, r5, [sp, #24]
.if \bpc == 8
ldr r8, [sp, #52]
ldr r6, [sp, #32]
.else
ldrd r8, r9, [sp, #52]
ldrd r6, r7, [sp, #32]
.endif
cmp r7, #2
add r10, r0, r1
add r11, r2, r3
add r12, r4, #2*FILTER_OUT_STRIDE
add lr, r5, #2*FILTER_OUT_STRIDE
vld2.16 {d30[], d31[]}, [r8] // wt[0], wt[1]
cmp r5, #2
add r8, r0, r1
add r12, r2, #2*FILTER_OUT_STRIDE
add lr, r3, #2*FILTER_OUT_STRIDE
vld2.16 {d30[], d31[]}, [r6] // wt[0], wt[1]
.if \bpc == 16
vdup.16 q14, r9
vdup.16 q14, r7
.endif
mov r8, #4*FILTER_OUT_STRIDE
lsl r1, r1, #1
lsl r3, r3, #1
add r9, r6, #7
bic r9, r9, #7 // Aligned width
.if \bpc == 8
sub r1, r1, r9
sub r3, r3, r9
.else
sub r1, r1, r9, lsl #1
sub r3, r3, r9, lsl #1
.endif
sub r8, r8, r9, lsl #1
mov r9, r6
blt 2f
1:
.if \bpc == 8
vld1.8 {d0}, [r2, :64]!
vld1.8 {d16}, [r11, :64]!
vld1.8 {d0}, [r0, :64]
vld1.8 {d16}, [r8, :64]
.else
vld1.16 {q0}, [r2, :128]!
vld1.16 {q8}, [r11, :128]!
vld1.16 {q0}, [r0, :128]
vld1.16 {q8}, [r8, :128]
.endif
vld1.16 {q1}, [r4, :128]!
vld1.16 {q1}, [r2, :128]!
vld1.16 {q9}, [r12, :128]!
vld1.16 {q2}, [r5, :128]!
vld1.16 {q2}, [r3, :128]!
vld1.16 {q10}, [lr, :128]!
subs r6, r6, #8
.if \bpc == 8
vshll.u8 q0, d0, #4 // u
vshll.u8 q8, d16, #4 // u
.else
vshl.i16 q0, q0, #4 // u
vshl.i16 q8, q8, #4 // u
.endif
vsub.i16 q1, q1, q0 // t1 - u
vsub.i16 q2, q2, q0 // t2 - u
vsub.i16 q9, q9, q8 // t1 - u
vsub.i16 q10, q10, q8 // t2 - u
vshll.u16 q3, d0, #7 // u << 7
vshll.u16 q0, d1, #7 // u << 7
vshll.u16 q11, d16, #7 // u << 7
vshll.u16 q8, d17, #7 // u << 7
vmlal.s16 q3, d2, d30 // wt[0] * (t1 - u)
vmlal.s16 q3, d4, d31 // wt[1] * (t2 - u)
vmlal.s16 q0, d3, d30 // wt[0] * (t1 - u)
vmlal.s16 q0, d5, d31 // wt[1] * (t2 - u)
vmlal.s16 q11, d18, d30 // wt[0] * (t1 - u)
vmlal.s16 q11, d20, d31 // wt[1] * (t2 - u)
vmlal.s16 q8, d19, d30 // wt[0] * (t1 - u)
vmlal.s16 q8, d21, d31 // wt[1] * (t2 - u)
.if \bpc == 8
subs r4, r4, #8
vmull.s16 q3, d2, d30 // wt[0] * t1
vmlal.s16 q3, d4, d31 // wt[1] * t2
vmull.s16 q12, d3, d30 // wt[0] * t1
vmlal.s16 q12, d5, d31 // wt[1] * t2
vmull.s16 q11, d18, d30 // wt[0] * t1
vmlal.s16 q11, d20, d31 // wt[1] * t2
vmull.s16 q13, d19, d30 // wt[0] * t1
vmlal.s16 q13, d21, d31 // wt[1] * t2
vrshrn.i32 d6, q3, #11
vrshrn.i32 d7, q0, #11
vrshrn.i32 d7, q12, #11
vrshrn.i32 d22, q11, #11
vrshrn.i32 d23, q8, #11
vrshrn.i32 d23, q13, #11
.if \bpc == 8
vaddw.u8 q3, q3, d0
vaddw.u8 q11, q11, d16
vqmovun.s16 d6, q3
vqmovun.s16 d22, q11
vst1.8 {d6}, [r0, :64]!
vst1.8 {d22}, [r10, :64]!
vst1.8 {d22}, [r8, :64]!
.else
vqrshrun.s32 d6, q3, #11
vqrshrun.s32 d7, q0, #11
vqrshrun.s32 d22, q11, #11
vqrshrun.s32 d23, q8, #11
vmov.i16 q13, #0
vadd.i16 q3, q3, q0
vadd.i16 q11, q11, q8
vmax.s16 q3, q3, q13
vmax.s16 q11, q11, q13
vmin.u16 q3, q3, q14
vmin.u16 q11, q11, q14
vst1.16 {q3}, [r0, :128]!
vst1.16 {q11}, [r10, :128]!
vst1.16 {q11}, [r8, :128]!
.endif
bgt 1b
subs r7, r7, #2
cmp r7, #1
blt 0f
mov r6, r9
add r0, r0, r1
add r10, r10, r1
add r2, r2, r3
add r11, r11, r3
add r4, r4, r8
add r12, r12, r8
add r5, r5, r8
add lr, lr, r8
beq 2f
b 1b
b 0f
2:
.if \bpc == 8
vld1.8 {d0}, [r2, :64]!
vld1.8 {d0}, [r0, :64]
.else
vld1.16 {q0}, [r2, :128]!
vld1.16 {q0}, [r0, :128]
.endif
vld1.16 {q1}, [r4, :128]!
vld1.16 {q2}, [r5, :128]!
subs r6, r6, #8
.if \bpc == 8
vshll.u8 q0, d0, #4 // u
.else
vshl.i16 q0, q0, #4 // u
.endif
vsub.i16 q1, q1, q0 // t1 - u
vsub.i16 q2, q2, q0 // t2 - u
vshll.u16 q3, d0, #7 // u << 7
vshll.u16 q0, d1, #7 // u << 7
vmlal.s16 q3, d2, d30 // wt[0] * (t1 - u)
vmlal.s16 q3, d4, d31 // wt[1] * (t2 - u)
vmlal.s16 q0, d3, d30 // wt[0] * (t1 - u)
vmlal.s16 q0, d5, d31 // wt[1] * (t2 - u)
.if \bpc == 8
vld1.16 {q1}, [r2, :128]!
vld1.16 {q2}, [r3, :128]!
subs r4, r4, #8
vmull.s16 q3, d2, d30 // wt[0] * t1
vmlal.s16 q3, d4, d31 // wt[1] * t2
vmull.s16 q11, d3, d30 // wt[0] * t1
vmlal.s16 q11, d5, d31 // wt[1] * t2
vrshrn.i32 d6, q3, #11
vrshrn.i32 d7, q0, #11
vrshrn.i32 d7, q11, #11
.if \bpc == 8
vaddw.u8 q3, q3, d0
vqmovun.s16 d6, q3
vst1.8 {d6}, [r0, :64]!
.else
vqrshrun.s32 d6, q3, #11
vqrshrun.s32 d7, q0, #11
vmov.i16 q13, #0
vadd.i16 q3, q3, q0
vmax.s16 q3, q3, q13
vmin.u16 q3, q3, q14
vst1.16 {q3}, [r0, :128]!
.endif
bgt 1b
bgt 2b
0:
pop {r4-r11,pc}
pop {r4-r8,pc}
endfunc
.endm
+47 -42
View File
@@ -109,7 +109,7 @@ L(\type\()_tbl):
vst1.32 {d17[0]}, [r0, :32], r1
vst1.32 {d17[1]}, [r6, :32], r1
beq 0f
\type d18, d19, q0, q1, q2, q3
\type d18, d19, q0, q1, q2, q3
cmp r5, #8
vst1.32 {d18[0]}, [r0, :32], r1
vst1.32 {d18[1]}, [r6, :32], r1
@@ -119,7 +119,7 @@ L(\type\()_tbl):
\type d16, d17, q0, q1, q2, q3
vst1.32 {d16[0]}, [r0, :32], r1
vst1.32 {d16[1]}, [r6, :32], r1
\type d18, d19, q0, q1, q2, q3
\type d18, d19, q0, q1, q2, q3
vst1.32 {d17[0]}, [r0, :32], r1
vst1.32 {d17[1]}, [r6, :32], r1
vst1.32 {d18[0]}, [r0, :32], r1
@@ -288,7 +288,7 @@ L(w_mask_\type\()_tbl):
vadd.s16 d21, d22, d23
vpadd.s16 d20, d20, d21 // (128 - m) + (128 - n) (column wise addition)
vsub.s16 d20, d30, d20 // (256 - sign) - ((128 - m) + (128 - n))
vrshrn.u16 d20, q10, #2 // ((256 - sign) - ((128 - m) + (128 - n)) + 2) >> 2
vrshrn.u16 d20, q10, #2 // ((256 - sign) - ((128 - m) + (128 - n)) + 2) >> 2
vst1.32 {d20[0]}, [r6, :32]!
.endif
vst1.32 {d24[0]}, [r0, :32], r1
@@ -611,7 +611,7 @@ L(blend_h_tbl):
vld2.u8 {d2[], d3[]}, [r5, :16]!
vld1.u8 {d1}, [r2, :64]!
subs r4, r4, #2
vext.u8 d2, d2, d3, #4
vext.u8 d2, d2, d3, #4
vld1.32 {d0[]}, [r0, :32]
vsub.i8 d6, d22, d2
vld1.32 {d0[1]}, [r12, :32]
@@ -623,7 +623,7 @@ L(blend_h_tbl):
bgt 4b
pop {r4-r5,pc}
80:
vmov.i8 q8, #64
vmov.i8 q8, #64
add r12, r0, r1
lsl r1, r1, #1
8:
@@ -933,7 +933,7 @@ L(put_tbl):
endfunc
// This has got the same signature as the put_8tap functions,
// This has got the same signature as the prep_8tap functions,
// assumes that the caller has loaded the h argument into r4,
// and assumes that r8 is set to (clz(w)-24), and r7 to w*2.
function prep_neon
@@ -948,21 +948,26 @@ L(prep_tbl):
.word 640f - L(prep_tbl) + CONFIG_THUMB
.word 320f - L(prep_tbl) + CONFIG_THUMB
.word 160f - L(prep_tbl) + CONFIG_THUMB
.word 8f - L(prep_tbl) + CONFIG_THUMB
.word 4f - L(prep_tbl) + CONFIG_THUMB
.word 80f - L(prep_tbl) + CONFIG_THUMB
.word 40f - L(prep_tbl) + CONFIG_THUMB
40:
add r9, r1, r2
lsl r2, r2, #1
4:
vld1.32 {d0[]}, [r1], r2
vld1.32 {d2[]}, [r1], r2
vld1.32 {d0[]}, [r1], r2
vld1.32 {d0[1]}, [r9], r2
subs r4, r4, #2
vshll.u8 q0, d0, #4
vshll.u8 q1, d2, #4
vst1.16 {d1, d2}, [r0, :64]!
vst1.16 {d0, d1}, [r0, :64]!
bgt 4b
pop {r4-r11,pc}
80:
add r9, r1, r2
lsl r2, r2, #1
8:
vld1.8 {d0}, [r1], r2
vld1.8 {d2}, [r1], r2
vld1.8 {d2}, [r9], r2
subs r4, r4, #2
vshll.u8 q0, d0, #4
vshll.u8 q1, d2, #4
@@ -1671,7 +1676,7 @@ L(\type\()_8tap_v_tbl):
.endif
40:
bgt 480f
bgt 480f
// 4x2, 4x4 v
cmp \h, #2
@@ -2493,8 +2498,8 @@ L(\type\()_bilin_h_tbl):
2:
vld1.32 {d4[]}, [\src], \s_strd
vld1.32 {d6[]}, [\sr2], \s_strd
vext.8 d5, d4, d4, #1
vext.8 d7, d6, d6, #1
vext.8 d5, d4, d4, #1
vext.8 d7, d6, d6, #1
vtrn.16 q2, q3
subs \h, \h, #2
vmull.u8 q3, d4, d0
@@ -2514,8 +2519,8 @@ L(\type\()_bilin_h_tbl):
4:
vld1.8 {d4}, [\src], \s_strd
vld1.8 {d6}, [\sr2], \s_strd
vext.8 d5, d4, d4, #1
vext.8 d7, d6, d6, #1
vext.8 d5, d4, d4, #1
vext.8 d7, d6, d6, #1
vtrn.32 q2, q3
subs \h, \h, #2
vmull.u8 q3, d4, d0
@@ -2547,8 +2552,8 @@ L(\type\()_bilin_h_tbl):
vmlal.u8 q8, d18, d1
vmlal.u8 q10, d22, d1
.ifc \type, put
vqrshrn.u16 d16, q8, #4
vqrshrn.u16 d18, q10, #4
vqrshrn.u16 d16, q8, #4
vqrshrn.u16 d18, q10, #4
vst1.8 {d16}, [\dst, :64], \d_strd
vst1.8 {d18}, [\ds2, :64], \d_strd
.else
@@ -2707,7 +2712,7 @@ L(\type\()_bilin_v_tbl):
vst1.16 {d5}, [\ds2, :64], \d_strd
.endif
ble 0f
vmov d16, d18
vmov d16, d18
b 4b
0:
pop {r4-r11,pc}
@@ -2876,8 +2881,8 @@ L(\type\()_bilin_hv_tbl):
vmov d17, d18
vmul.u16 q10, q8, q2
vmla.u16 q10, q9, q3
vmul.u16 q10, q8, q2
vmla.u16 q10, q9, q3
subs \h, \h, #2
.ifc \type, put
vqrshrn.u16 d20, q10, #8
@@ -3049,8 +3054,8 @@ function warp_affine_8x8\t\()_8bpc_neon, export=1
ldr r6, [sp, #108]
ldrd r8, r9, [r4]
sxth r7, r8
asr r8, r8, #16
asr r4, r9, #16
asr r8, r8, #16
asr r4, r9, #16
sxth r9, r9
mov r10, #8
sub r2, r2, r3, lsl #1
@@ -3102,26 +3107,26 @@ function warp_affine_8x8\t\()_8bpc_neon, export=1
// This ordering of vmull/vmlal is highly beneficial for
// Cortex A8/A9/A53 here, but harmful for Cortex A7.
vmull.s16 q0, d16, d2
vmlal.s16 q0, d18, d4
vmlal.s16 q0, d20, d6
vmlal.s16 q0, d22, d8
vmlal.s16 q0, d24, d10
vmlal.s16 q0, d26, d12
vmull.s16 q1, d17, d3
vmlal.s16 q1, d19, d5
vmlal.s16 q1, d21, d7
vmlal.s16 q1, d23, d9
vmlal.s16 q1, d25, d11
vmlal.s16 q1, d27, d13
vmull.s16 q0, d16, d2
vmlal.s16 q0, d18, d4
vmlal.s16 q0, d20, d6
vmlal.s16 q0, d22, d8
vmlal.s16 q0, d24, d10
vmlal.s16 q0, d26, d12
vmull.s16 q1, d17, d3
vmlal.s16 q1, d19, d5
vmlal.s16 q1, d21, d7
vmlal.s16 q1, d23, d9
vmlal.s16 q1, d25, d11
vmlal.s16 q1, d27, d13
vmovl.s8 q2, d14
vmovl.s8 q3, d15
vmlal.s16 q0, d28, d4
vmlal.s16 q0, d30, d6
vmlal.s16 q1, d29, d5
vmlal.s16 q1, d31, d7
vmlal.s16 q0, d28, d4
vmlal.s16 q0, d30, d6
vmlal.s16 q1, d29, d5
vmlal.s16 q1, d31, d7
.ifb \t
vmov.i16 q7, #128
@@ -3313,7 +3318,7 @@ function emu_edge_8bpc_neon, export=1
subs r3, r3, #1
vst1.8 {q0, q1}, [r6, :128], r7
bgt 2b
mls r6, r7, r10, r6 // dst -= bottom_ext * stride
mls r6, r7, r10, r6 // dst -= bottom_ext * stride
subs r4, r4, #32 // bw -= 32
add r6, r6, #32 // dst += 32
bgt 1b
+1 -1
View File
@@ -366,7 +366,7 @@ function msac_decode_hi_tok_neon, export=1
add r5, r0, #DIF + 2
vld1.16 {q8}, [r4, :128]
mov r2, #-24
vand d20, d0, d30 // cdf & 0xffc0
vand d20, d0, d30 // cdf & 0xffc0
ldr r10, [r0, #ALLOW_UPDATE_CDF]
vld1.16 {d2[]}, [r5, :16] // dif >> (EC_WIN_SIZE - 16)
sub sp, sp, #48
+5 -5
View File
@@ -133,10 +133,10 @@ function save_tmvs_neon, export=1
and r9, r7, #30 // (y & 15) * 2
ldr r9, [r2, r9, lsl #2] // b = rr[(y & 15) * 2]
add r9, r9, #12 // &b[... + 1]
mla r10, r4, r11, r9 // end_cand_b = &b[col_end8*2 + 1]
mla r9, r6, r11, r9 // cand_b = &b[x*2 + 1]
mla r10, r4, r11, r9 // end_cand_b = &b[col_end8*2 + 1]
mla r9, r6, r11, r9 // cand_b = &b[x*2 + 1]
mla r3, r6, r3, r0 // &rp[x]
mla r3, r6, r3, r0 // &rp[x]
push {r2,r4,r6}
@@ -175,8 +175,8 @@ function save_tmvs_neon, export=1
vmov.u16 r6, d2[1]
ldr r11, [r11, #4] // Fetch jump table entry
ldr r2, [r2, #4]
add r4, r12, r4, lsl #4
add r6, r12, r6, lsl #4
add r4, r12, r4, lsl #4
add r6, r12, r6, lsl #4
vld1.8 {d2, d3}, [r4] // Load permutation table base on case
vld1.8 {d4, d5}, [r6]
add r11, r8, r11 // Find jump table target
+22 -4
View File
@@ -31,18 +31,36 @@
#include "config.h"
#include "src/arm/asm.S"
#include "src/arm/arm-arch.h"
.macro v4bx rd
#if __ARM_ARCH >= 5 || defined(__ARM_ARCH_4T__)
bx \rd
#else
mov pc, \rd
#endif
.endm
.macro v4blx rd
#if __ARM_ARCH >= 5
blx \rd
#else
mov lr, pc
v4bx \rd
#endif
.endm
.macro movrel_local rd, val, offset=0
#if defined(PIC)
#if (__ARM_ARCH >= 7 || defined(__ARM_ARCH_6T2__)) && !defined(PIC)
movw \rd, #:lower16:\val+\offset
movt \rd, #:upper16:\val+\offset
#else
ldr \rd, 90001f
b 90002f
90001:
.word \val + \offset - (90002f + 8 - 4 * CONFIG_THUMB)
90002:
add \rd, \rd, pc
#else
movw \rd, #:lower16:\val+\offset
movt \rd, #:upper16:\val+\offset
#endif
.endm
+55 -50
View File
@@ -884,12 +884,12 @@ function generate_grain_\type\()_8bpc_neon, export=1
.else
add x4, x1, #FGD_AR_COEFFS_UV
.endif
adr x16, L(gen_grain_\type\()_tbl)
movrel x16, gen_grain_\type\()_tbl
ldr w17, [x1, #FGD_AR_COEFF_LAG]
add w9, w9, #4
ldrh w17, [x16, w17, uxtw #1]
ldrsw x17, [x16, w17, uxtw #2]
dup v31.8h, w9 // 4 + data->grain_scale_shift
sub x16, x16, w17, uxtw
add x16, x16, x17
neg v31.8h, v31.8h
.ifc \type, uv_444
@@ -1075,13 +1075,14 @@ L(generate_grain_\type\()_lag3):
ldp x30, x19, [sp], #96
AARCH64_VALIDATE_LINK_REGISTER
ret
L(gen_grain_\type\()_tbl):
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag0)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag1)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag2)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag3)
endfunc
jumptable gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag0) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag1) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag2) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag3) - gen_grain_\type\()_tbl
endjumptable
.endm
gen_grain_82 y
@@ -1118,12 +1119,12 @@ function generate_grain_\type\()_8bpc_neon, export=1
ldr w2, [x1, #FGD_SEED]
ldr w9, [x1, #FGD_GRAIN_SCALE_SHIFT]
add x4, x1, #FGD_AR_COEFFS_UV
adr x16, L(gen_grain_\type\()_tbl)
movrel x16, gen_grain_\type\()_tbl
ldr w17, [x1, #FGD_AR_COEFF_LAG]
add w9, w9, #4
ldrh w17, [x16, w17, uxtw #1]
ldrsw x17, [x16, w17, uxtw #2]
dup v31.8h, w9 // 4 + data->grain_scale_shift
sub x16, x16, w17, uxtw
add x16, x16, x17
neg v31.8h, v31.8h
cmp w13, #0
@@ -1272,13 +1273,14 @@ L(generate_grain_\type\()_lag3):
ldp x30, x19, [sp], #96
AARCH64_VALIDATE_LINK_REGISTER
ret
L(gen_grain_\type\()_tbl):
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag0)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag1)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag2)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag3)
endfunc
jumptable gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag0) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag1) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag2) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag3) - gen_grain_\type\()_tbl
endjumptable
.endm
gen_grain_44 uv_420
@@ -1407,18 +1409,18 @@ function fgy_32x32_8bpc_neon, export=1
add_offset x5, w6, x10, x5, x9
ldr w11, [sp, #24] // type
adr x13, L(fgy_loop_tbl)
movrel x13, fgy_loop_tbl
add x4, x12, #32 // grain_lut += FG_BLOCK_SIZE * bx
add x6, x14, x9, lsl #5 // grain_lut += grain_stride * FG_BLOCK_SIZE * by
tst w11, #1
ldrh w11, [x13, w11, uxtw #1]
ldrsw x11, [x13, w11, uxtw #2]
add x8, x16, x9, lsl #5 // grain_lut += grain_stride * FG_BLOCK_SIZE * by
add x8, x8, #32 // grain_lut += FG_BLOCK_SIZE * bx
sub x11, x13, w11, uxtw
add x11, x13, x11
b.eq 1f
// y overlap
@@ -1555,14 +1557,15 @@ L(loop_\ox\oy):
fgy 0, 1
fgy 1, 0
fgy 1, 1
L(fgy_loop_tbl):
.hword L(fgy_loop_tbl) - L(loop_00)
.hword L(fgy_loop_tbl) - L(loop_01)
.hword L(fgy_loop_tbl) - L(loop_10)
.hword L(fgy_loop_tbl) - L(loop_11)
endfunc
jumptable fgy_loop_tbl
.word L(loop_00) - fgy_loop_tbl
.word L(loop_01) - fgy_loop_tbl
.word L(loop_10) - fgy_loop_tbl
.word L(loop_11) - fgy_loop_tbl
endjumptable
// void dav1d_fguv_32x32_420_8bpc_neon(pixel *const dst,
// const pixel *const src,
// const ptrdiff_t stride,
@@ -1646,11 +1649,11 @@ function fguv_32x32_\layout\()_8bpc_neon, export=1
ldr w13, [sp, #64] // type
movrel x16, overlap_coeffs_\sx
adr x14, L(fguv_loop_sx\sx\()_tbl)
movrel x14, fguv_loop_sx\sx\()_tbl
ld1 {v27.8b, v28.8b}, [x16] // overlap_coeffs
tst w13, #1
ldrh w13, [x14, w13, uxtw #1]
ldrsw x13, [x14, w13, uxtw #2]
b.eq 1f
// y overlap
@@ -1658,7 +1661,7 @@ function fguv_32x32_\layout\()_8bpc_neon, export=1
mov w9, #(2 >> \sy)
1:
sub x13, x14, w13, uxtw
add x13, x14, x13
.if \sy
movi v25.16b, #23
@@ -1848,18 +1851,19 @@ L(fguv_loop_sx0_csfl\csfl\()_\ox\oy):
ldr x30, [sp], #32
AARCH64_VALIDATE_LINK_REGISTER
ret
L(fguv_loop_sx0_tbl):
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_00)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_01)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_10)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_11)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_00)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_01)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_10)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_11)
endfunc
jumptable fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_00) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_01) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_10) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_11) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_00) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_01) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_10) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_11) - fguv_loop_sx0_tbl
endjumptable
function fguv_loop_sx1_neon
.macro fguv_loop_sx1 csfl, ox, oy
L(fguv_loop_sx1_csfl\csfl\()_\ox\oy):
@@ -1997,14 +2001,15 @@ L(fguv_loop_sx1_csfl\csfl\()_\ox\oy):
ldr x30, [sp], #32
AARCH64_VALIDATE_LINK_REGISTER
ret
L(fguv_loop_sx1_tbl):
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_00)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_01)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_10)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_11)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_00)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_01)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_10)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_11)
endfunc
jumptable fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_00) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_01) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_10) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_11) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_00) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_01) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_10) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_11) - fguv_loop_sx1_tbl
endjumptable
+57 -52
View File
@@ -695,7 +695,7 @@ function gen_grain_uv_420_lag0_4_neon
str x30, [sp, #-16]!
ld1 {v16.4h, v17.4h}, [x19]
ld1 {v18.4h, v19.4h}, [x12]
add x19, x19, #32
add x19, x19, #32
addp v16.4h, v16.4h, v17.4h
addp v17.4h, v18.4h, v19.4h
add v16.4h, v16.4h, v17.4h
@@ -708,7 +708,7 @@ function gen_grain_uv_422_lag0_4_neon
AARCH64_SIGN_LINK_REGISTER
str x30, [sp, #-16]!
ld1 {v16.4h, v17.4h}, [x19]
add x19, x19, #32
add x19, x19, #32
addp v16.4h, v16.4h, v17.4h
srshr v4.4h, v16.4h, #1
get_grain_4 v0
@@ -740,12 +740,12 @@ function generate_grain_\type\()_16bpc_neon, export=1
add x4, x1, #FGD_AR_COEFFS_UV
.endif
add w9, w9, w15 // grain_scale_shift - bitdepth_min_8
adr x16, L(gen_grain_\type\()_tbl)
movrel x16, gen_grain_\type\()_tbl
ldr w17, [x1, #FGD_AR_COEFF_LAG]
add w9, w9, #4
ldrh w17, [x16, w17, uxtw #1]
ldrsw x17, [x16, w17, uxtw #2]
dup v31.8h, w9 // 4 - bitdepth_min_8 + data->grain_scale_shift
sub x16, x16, w17, uxtw
add x16, x16, x17
neg v31.8h, v31.8h
.ifc \type, uv_444
@@ -945,13 +945,14 @@ L(generate_grain_\type\()_lag3):
ldp x30, x19, [sp], #96
AARCH64_VALIDATE_LINK_REGISTER
ret
L(gen_grain_\type\()_tbl):
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag0)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag1)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag2)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag3)
endfunc
jumptable gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag0) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag1) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag2) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag3) - gen_grain_\type\()_tbl
endjumptable
.endm
gen_grain_82 y
@@ -991,12 +992,12 @@ function generate_grain_\type\()_16bpc_neon, export=1
ldr w9, [x1, #FGD_GRAIN_SCALE_SHIFT]
add x4, x1, #FGD_AR_COEFFS_UV
add w9, w9, w15 // grain_scale_shift - bitdepth_min_8
adr x16, L(gen_grain_\type\()_tbl)
movrel x16, gen_grain_\type\()_tbl
ldr w17, [x1, #FGD_AR_COEFF_LAG]
add w9, w9, #4
ldrh w17, [x16, w17, uxtw #1]
ldrsw x17, [x16, w17, uxtw #2]
dup v31.8h, w9 // 4 - bitdepth_min_8 + data->grain_scale_shift
sub x16, x16, w17, uxtw
add x16, x16, x17
neg v31.8h, v31.8h
cmp w13, #0
@@ -1155,13 +1156,14 @@ L(generate_grain_\type\()_lag3):
ldp x30, x19, [sp], #96
AARCH64_VALIDATE_LINK_REGISTER
ret
L(gen_grain_\type\()_tbl):
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag0)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag1)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag2)
.hword L(gen_grain_\type\()_tbl) - L(generate_grain_\type\()_lag3)
endfunc
jumptable gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag0) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag1) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag2) - gen_grain_\type\()_tbl
.word L(generate_grain_\type\()_lag3) - gen_grain_\type\()_tbl
endjumptable
.endm
gen_grain_44 uv_420
@@ -1306,18 +1308,18 @@ function fgy_32x32_16bpc_neon, export=1
add_offset x5, w6, x10, x5, x9
ldr w11, [sp, #88] // type
adr x13, L(fgy_loop_tbl)
movrel x13, fgy_loop_tbl
add x4, x12, #32*2 // grain_lut += FG_BLOCK_SIZE * bx
add x6, x14, x9, lsl #5 // grain_lut += grain_stride * FG_BLOCK_SIZE * by
tst w11, #1
ldrh w11, [x13, w11, uxtw #1]
ldrsw x11, [x13, w11, uxtw #2]
add x8, x16, x9, lsl #5 // grain_lut += grain_stride * FG_BLOCK_SIZE * by
add x8, x8, #32*2 // grain_lut += FG_BLOCK_SIZE * bx
sub x11, x13, w11, uxtw
add x11, x13, x11
b.eq 1f
// y overlap
@@ -1480,14 +1482,15 @@ L(loop_\ox\oy):
fgy 0, 1
fgy 1, 0
fgy 1, 1
L(fgy_loop_tbl):
.hword L(fgy_loop_tbl) - L(loop_00)
.hword L(fgy_loop_tbl) - L(loop_01)
.hword L(fgy_loop_tbl) - L(loop_10)
.hword L(fgy_loop_tbl) - L(loop_11)
endfunc
jumptable fgy_loop_tbl
.word L(loop_00) - fgy_loop_tbl
.word L(loop_01) - fgy_loop_tbl
.word L(loop_10) - fgy_loop_tbl
.word L(loop_11) - fgy_loop_tbl
endjumptable
// void dav1d_fguv_32x32_420_16bpc_neon(pixel *const dst,
// const pixel *const src,
// const ptrdiff_t stride,
@@ -1589,11 +1592,11 @@ function fguv_32x32_\layout\()_16bpc_neon, export=1
ldr w13, [sp, #112] // type
movrel x16, overlap_coeffs_\sx
adr x14, L(fguv_loop_sx\sx\()_tbl)
movrel x14, fguv_loop_sx\sx\()_tbl
ld1 {v27.4h, v28.4h}, [x16] // overlap_coeffs
tst w13, #1
ldrh w13, [x14, w13, uxtw #1]
ldrsw x13, [x14, w13, uxtw #2]
b.eq 1f
// y overlap
@@ -1601,7 +1604,7 @@ function fguv_32x32_\layout\()_16bpc_neon, export=1
mov w9, #(2 >> \sy)
1:
sub x13, x14, w13, uxtw
add x13, x14, x13
.if \sy
movi v25.8h, #23
@@ -1818,18 +1821,19 @@ L(fguv_loop_sx0_csfl\csfl\()_\ox\oy):
ldr x30, [sp], #80
AARCH64_VALIDATE_LINK_REGISTER
ret
L(fguv_loop_sx0_tbl):
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_00)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_01)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_10)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl0_11)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_00)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_01)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_10)
.hword L(fguv_loop_sx0_tbl) - L(fguv_loop_sx0_csfl1_11)
endfunc
jumptable fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_00) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_01) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_10) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl0_11) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_00) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_01) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_10) - fguv_loop_sx0_tbl
.word L(fguv_loop_sx0_csfl1_11) - fguv_loop_sx0_tbl
endjumptable
function fguv_loop_sx1_neon
.macro fguv_loop_sx1 csfl, ox, oy
L(fguv_loop_sx1_csfl\csfl\()_\ox\oy):
@@ -1984,14 +1988,15 @@ L(fguv_loop_sx1_csfl\csfl\()_\ox\oy):
ldr x30, [sp], #80
AARCH64_VALIDATE_LINK_REGISTER
ret
L(fguv_loop_sx1_tbl):
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_00)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_01)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_10)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl0_11)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_00)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_01)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_10)
.hword L(fguv_loop_sx1_tbl) - L(fguv_loop_sx1_csfl1_11)
endfunc
jumptable fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_00) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_01) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_10) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl0_11) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_00) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_01) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_10) - fguv_loop_sx1_tbl
.word L(fguv_loop_sx1_csfl1_11) - fguv_loop_sx1_tbl
endjumptable
+631 -685
View File
File diff suppressed because it is too large Load Diff
+333 -293
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -545,7 +545,7 @@ endfunc
sqrshrn2 \o0\().8h, v17.4s, #12
.ifc \o2, v17
mov v17.16b, v18.16b
mov v17.16b, v18.16b
.endif
sqrshrn \o1\().4h, v6.4s, #12
@@ -1993,7 +1993,7 @@ function inv_dct32_odd_8h_x16_neon, export=1
smull_smlal v4, v5, v25, v27, v0.h[0], v0.h[0], .8h // -> t26a
smull_smlsl v6, v7, v25, v27, v0.h[0], v0.h[0], .8h // -> t21a
mov v27.16b, v22.16b // t27
mov v27.16b, v22.16b // t27
sqrshrn_sz v26, v4, v5, #12, .8h // t26a
smull_smlsl v24, v25, v21, v23, v0.h[0], v0.h[0], .8h // -> t22
+4 -4
View File
@@ -305,7 +305,7 @@ function lpf_16_wd\wd\()_neon
rshrn2 v0.16b, v9.8h, #3
add v8.8h, v8.8h, v2.8h
add v9.8h , v9.8h, v3.8h
add v9.8h, v9.8h, v3.8h
bit v21.16b, v10.16b, v14.16b
bit v22.16b, v11.16b, v14.16b
@@ -696,7 +696,7 @@ function lpf_v_8_16_neon
lpf_16_wd8
sub x16, x0, x1, lsl #1
sub x16, x16, x1
sub x16, x16, x1
st1 {v21.16b}, [x16], x1 // p2
st1 {v24.16b}, [x0], x1 // q0
st1 {v22.16b}, [x16], x1 // p1
@@ -817,7 +817,7 @@ function lpf_v_16_16_neon
lpf_16_wd16
sub x16, x0, x1, lsl #2
sub x16, x16, x1, lsl #1
sub x16, x16, x1, lsl #1
st1 {v0.16b}, [x16], x1 // p5
st1 {v6.16b}, [x0], x1 // q0
st1 {v1.16b}, [x16], x1 // p4
@@ -1051,7 +1051,7 @@ function lpf_\dir\()_sb_\type\()_8bpc_neon, export=1
adds x16, x16, x17
b.eq 7f // if (!L) continue;
neg v5.16b, v5.16b // -sharp[0]
movrel x16, word_1248
movrel x16, word_1248
ushr v12.16b, v1.16b, #4 // H
ld1 {v16.4s}, [x16]
sshl v3.16b, v1.16b, v5.16b // L >> sharp[0]
+3 -3
View File
@@ -550,7 +550,7 @@ function lpf_v_8_8_neon
lpf_8_wd8
sub x16, x0, x1, lsl #1
sub x16, x16, x1
sub x16, x16, x1
st1 {v21.8h}, [x16], x1 // p2
st1 {v24.8h}, [x0], x1 // q0
st1 {v22.8h}, [x16], x1 // p1
@@ -781,7 +781,7 @@ function lpf_\dir\()_sb_\type\()_16bpc_neon, export=1
mov w8, w7 // bitdepth_max
clz w9, w8
mov w10, #24
sub w9, w10, w9 // bitdepth_min_8
sub w9, w10, w9 // bitdepth_min_8
stp d8, d9, [sp, #-0x40]!
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
@@ -836,7 +836,7 @@ function lpf_\dir\()_sb_\type\()_16bpc_neon, export=1
cmp x16, #0
b.eq 7f // if (!L) continue;
neg v5.8b, v5.8b // -sharp[0]
movrel x16, word_12
movrel x16, word_12
ushr v12.8b, v1.8b, #4 // H
ld1 {v16.2s}, [x16]
sshl v3.8b, v1.8b, v5.8b // L >> sharp[0]
+2 -2
View File
@@ -1129,7 +1129,7 @@ function sgr_box3_row_h_16bpc_neon, export=1
// again; it's not strictly needed in those cases (we pad enough here),
// but keeping the code as simple as possible.
// Insert padding in v0.b[w] onwards
// Insert padding in v0.h[w] onwards
movrel x13, right_ext_mask
sub x13, x13, w4, uxtw #1
ld1 {v28.16b, v29.16b}, [x13]
@@ -1224,7 +1224,7 @@ function sgr_box5_row_h_16bpc_neon, export=1
// this ends up called again; it's not strictly needed in those
// cases (we pad enough here), but keeping the code as simple as possible.
// Insert padding in v0.b[w+1] onwards; fuse the +1 into the
// Insert padding in v0.h[w+1] onwards; fuse the +1 into the
// buffer pointer.
movrel x13, right_ext_mask, -1
sub x13, x13, w4, uxtw #1
+170 -108
View File
@@ -28,14 +28,77 @@
#include "src/arm/asm.S"
#include "util.S"
// Series of LUTs for efficiently computing sgr's 1 - x/(x+1) table.
// In the comments, let RefTable denote the original, reference table.
const x_by_x_tables
// RangeMins
//
// Min(RefTable[i*8:i*8+8])
// First two values are zeroed.
//
// Lookup using RangeMins[(x >> 3)]
.byte 0, 0, 11, 8, 6, 5, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2
.byte 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
// DiffMasks
//
// This contains a bit pattern, indicating at which index positions the value of RefTable changes. For each range
// in the RangeMins table (covering 8 RefTable entries), we have one byte; each bit indicates whether the value of
// RefTable changes at that particular index.
// Using popcount, we can integrate the diff bit field. By shifting away bits in a byte, we can refine the range of
// the integral. Finally, adding the integral to RangeMins[(x>>3)] reconstructs RefTable (for x > 15).
//
// Lookup using DiffMasks[(x >> 3)]
.byte 0x00, 0x00, 0xD4, 0x44
.byte 0x42, 0x04, 0x00, 0x00
.byte 0x00, 0x80, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x40, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x02
// Binary form:
// 0b00000000, 0b00000000, 0b11010100, 0b01000100
// 0b01000010, 0b00000100, 0b00000000, 0b00000000
// 0b00000000, 0b10000000, 0b00000000, 0b00000000
// 0b00000100, 0b00000000, 0b00000000, 0b00000000
// 0b00000000, 0b00000000, 0b00000000, 0b00000000
// 0b00000000, 0b01000000, 0b00000000, 0b00000000
// 0b00000000, 0b00000000, 0b00000000, 0b00000000
// 0b00000000, 0b00000000, 0b00000000, 0b00000010
// RefLo
//
// RefTable[0:16]
// i.e. First 16 elements of the original table.
// Add to the sum obtained in the rest of the other lut logic to include the first 16 bytes of RefTable.
//
// Lookup using RangeMins[x] (tbl will replace x > 15 with 0)
.byte 255, 128, 85, 64, 51, 43, 37, 32, 28, 26, 23, 21, 20, 18, 17, 16
// Pseudo assembly
//
// hi_bits = x >> 3
// tbl ref, {RefLo}, x
// tbl diffs, {DiffMasks[0:16], DiffMasks[16:32]}, hi_bits
// tbl min, {RangeMins[0:16], RangeMins[16:32]}, hi_bits
// lo_bits = x & 0x7
// diffs = diffs << lo_bits
// ref = ref + min
// integral = popcnt(diffs)
// ref = ref + integral
// return ref
endconst
// void dav1d_sgr_box3_vert_neon(int32_t **sumsq, int16_t **sum,
// int32_t *AA, int16_t *BB,
// const int w, const int s,
// const int bitdepth_max);
function sgr_box3_vert_neon, export=1
stp d8, d9, [sp, #-0x30]!
stp d8, d9, [sp, #-0x40]!
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
add w4, w4, #2
clz w9, w6 // bitdepth_max
@@ -49,93 +112,109 @@ function sgr_box3_vert_neon, export=1
movi v31.4s, #9 // n
sub w9, w9, #24 // -bitdepth_min_8
movrel x12, X(sgr_x_by_x)
movrel x12, x_by_x_tables
mov w13, #455 // one_by_x
ld1 {v16.16b, v17.16b, v18.16b}, [x12]
ld1 {v24.16b, v25.16b, v26.16b, v27.16b}, [x12] // RangeMins, DiffMasks
movi v22.16b, #0x7
ldr q23, [x12, #64] //RefLo
dup v6.8h, w9 // -bitdepth_min_8
movi v19.16b, #5
movi v20.8b, #55 // idx of last 5
movi v21.8b, #72 // idx of last 4
movi v22.8b, #101 // idx of last 3
movi v23.8b, #169 // idx of last 2
movi v24.8b, #254 // idx of last 1
saddl v7.4s, v6.4h, v6.4h // -2*bitdepth_min_8
movi v29.8h, #1, lsl #8
dup v30.4s, w13 // one_by_x
sub v16.16b, v16.16b, v19.16b
sub v17.16b, v17.16b, v19.16b
sub v18.16b, v18.16b, v19.16b
ld1 {v8.4s, v9.4s}, [x5], #32
ld1 {v10.4s, v11.4s}, [x6], #32
ld1 {v12.8h}, [x7], #16
ld1 {v13.8h}, [x8], #16
ld1 {v0.4s, v1.4s}, [x0], #32
ld1 {v2.8h}, [x1], #16
ld1 {v8.4s, v9.4s, v10.4s, v11.4s}, [x5], #64
ld1 {v12.4s, v13.4s, v14.4s, v15.4s}, [x6], #64
ld1 {v16.4s, v17.4s, v18.4s, v19.4s}, [x0], #64
ld1 {v20.8h, v21.8h}, [x8], #32
ld1 {v0.8h, v1.8h}, [x7], #32
1:
ld1 {v2.8h, v3.8h}, [x1], #32
add v8.4s, v8.4s, v12.4s
add v9.4s, v9.4s, v13.4s
add v10.4s, v10.4s, v14.4s
add v11.4s, v11.4s, v15.4s
add v0.8h, v0.8h, v20.8h
add v1.8h, v1.8h, v21.8h
add v8.4s, v8.4s, v10.4s
add v9.4s, v9.4s, v11.4s
add v16.4s, v16.4s, v8.4s
add v17.4s, v17.4s, v9.4s
add v18.4s, v18.4s, v10.4s
add v19.4s, v19.4s, v11.4s
add v4.8h, v2.8h, v0.8h
add v5.8h, v3.8h, v1.8h
add v12.8h, v12.8h, v13.8h
srshl v16.4s, v16.4s, v7.4s
srshl v17.4s, v17.4s, v7.4s
srshl v18.4s, v18.4s, v7.4s
srshl v19.4s, v19.4s, v7.4s
srshl v9.8h, v4.8h, v6.8h
srshl v13.8h, v5.8h, v6.8h
mul v16.4s, v16.4s, v31.4s // a * n
mul v17.4s, v17.4s, v31.4s // a * n
mul v18.4s, v18.4s, v31.4s // a * n
mul v19.4s, v19.4s, v31.4s // a * n
umull v8.4s, v9.4h, v9.4h // b * b
umull2 v9.4s, v9.8h, v9.8h // b * b
umull v12.4s, v13.4h, v13.4h // b * b
umull2 v13.4s, v13.8h, v13.8h // b * b
uqsub v16.4s, v16.4s, v8.4s // imax(a * n - b * b, 0)
uqsub v17.4s, v17.4s, v9.4s // imax(a * n - b * b, 0)
uqsub v18.4s, v18.4s, v12.4s // imax(a * n - b * b, 0)
uqsub v19.4s, v19.4s, v13.4s // imax(a * n - b * b, 0)
mul v16.4s, v16.4s, v28.4s // p * s
mul v17.4s, v17.4s, v28.4s // p * s
mul v18.4s, v18.4s, v28.4s // p * s
mul v19.4s, v19.4s, v28.4s // p * s
uqshrn v16.4h, v16.4s, #16
uqshrn2 v16.8h, v17.4s, #16
uqshrn v18.4h, v18.4s, #16
uqshrn2 v18.8h, v19.4s, #16
uqrshrn v1.8b, v16.8h, #4 // imin(z, 255)
uqrshrn2 v1.16b, v18.8h, #4 // imin(z, 255)
subs w4, w4, #8
add v0.4s, v0.4s, v8.4s
add v1.4s, v1.4s, v9.4s
add v2.8h, v2.8h, v12.8h
ld1 {v16.4s, v17.4s}, [x0], #32
subs w4, w4, #16
srshl v0.4s, v0.4s, v7.4s
srshl v1.4s, v1.4s, v7.4s
srshl v4.8h, v2.8h, v6.8h
mul v0.4s, v0.4s, v31.4s // a * n
mul v1.4s, v1.4s, v31.4s // a * n
umull v3.4s, v4.4h, v4.4h // b * b
umull2 v4.4s, v4.8h, v4.8h // b * b
uqsub v0.4s, v0.4s, v3.4s // imax(a * n - b * b, 0)
uqsub v1.4s, v1.4s, v4.4s // imax(a * n - b * b, 0)
mul v0.4s, v0.4s, v28.4s // p * s
mul v1.4s, v1.4s, v28.4s // p * s
ld1 {v8.4s, v9.4s}, [x5], #32
uqshrn v0.4h, v0.4s, #16
uqshrn2 v0.8h, v1.4s, #16
ld1 {v10.4s, v11.4s}, [x6], #32
uqrshrn v0.8b, v0.8h, #4 // imin(z, 255)
ushr v0.16b, v1.16b, #3
ld1 {v8.4s, v9.4s}, [x5], #32
tbl v2.16b, {v26.16b, v27.16b}, v0.16b // RangeMins
tbl v0.16b, {v24.16b, v25.16b}, v0.16b // DiffMasks
tbl v3.16b, {v23.16b}, v1.16b // RefLo
and v1.16b, v1.16b, v22.16b
ld1 {v12.4s, v13.4s}, [x6], #32
ushl v1.16b, v2.16b, v1.16b
ld1 {v20.8h, v21.8h}, [x8], #32
add v3.16b, v3.16b, v0.16b
cnt v1.16b, v1.16b
ld1 {v18.4s, v19.4s}, [x0], #32
add v3.16b, v3.16b, v1.16b
ld1 {v10.4s, v11.4s}, [x5], #32
uxtl v0.8h, v3.8b // x
uxtl2 v1.8h, v3.16b // x
ld1 {v12.8h}, [x7], #16
ld1 {v14.4s, v15.4s}, [x6], #32
cmhi v25.8b, v0.8b, v20.8b // = -1 if sgr_x_by_x[v0] < 5
cmhi v26.8b, v0.8b, v21.8b // = -1 if sgr_x_by_x[v0] < 4
tbl v1.8b, {v16.16b, v17.16b, v18.16b}, v0.8b
cmhi v27.8b, v0.8b, v22.8b // = -1 if sgr_x_by_x[v0] < 3
cmhi v4.8b, v0.8b, v23.8b // = -1 if sgr_x_by_x[v0] < 2
add v25.8b, v25.8b, v26.8b
cmhi v5.8b, v0.8b, v24.8b // = -1 if sgr_x_by_x[v0] < 1
add v27.8b, v27.8b, v4.8b
add v5.8b, v5.8b, v19.8b
add v25.8b, v25.8b, v27.8b
add v5.8b, v1.8b, v5.8b
ld1 {v13.8h}, [x8], #16
add v5.8b, v5.8b, v25.8b
ld1 {v0.4s, v1.4s}, [x0], #32
uxtl v5.8h, v5.8b // x
umull v2.4s, v0.4h, v4.4h // x * BB[i]
umull2 v3.4s, v0.8h, v4.8h // x * BB[i]
umull v4.4s, v1.4h, v5.4h // x * BB[i]
umull2 v5.4s, v1.8h, v5.8h // x * BB[i]
mul v2.4s, v2.4s, v30.4s // x * BB[i] * sgr_one_by_x
mul v3.4s, v3.4s, v30.4s // x * BB[i] * sgr_one_by_x
mul v4.4s, v4.4s, v30.4s // x * BB[i] * sgr_one_by_x
mul v5.4s, v5.4s, v30.4s // x * BB[i] * sgr_one_by_x
st1 {v0.8h, v1.8h}, [x3], #32
ld1 {v0.8h, v1.8h}, [x7], #32
srshr v2.4s, v2.4s, #12 // AA[i]
srshr v3.4s, v3.4s, #12 // AA[i]
srshr v4.4s, v4.4s, #12 // AA[i]
srshr v5.4s, v5.4s, #12 // AA[i]
umull v3.4s, v5.4h, v2.4h // x * BB[i]
umull2 v4.4s, v5.8h, v2.8h // x * BB[i]
mul v3.4s, v3.4s, v30.4s // x * BB[i] * sgr_one_by_x
mul v4.4s, v4.4s, v30.4s // x * BB[i] * sgr_one_by_x
srshr v3.4s, v3.4s, #12 // AA[i]
srshr v4.4s, v4.4s, #12 // AA[i]
sub v5.8h, v29.8h, v5.8h // 256 - x
ld1 {v2.8h}, [x1], #16
st1 {v3.4s, v4.4s}, [x2], #32
st1 {v5.8h}, [x3], #16
st1 {v2.4s, v3.4s, v4.4s, v5.4s}, [x2], #64
b.gt 1b
ldp d14, d15, [sp, #0x30]
ldp d12, d13, [sp, #0x20]
ldp d10, d11, [sp, #0x10]
ldp d8, d9, [sp], 0x30
ldp d8, d9, [sp], 0x40
ret
endfunc
@@ -144,10 +223,9 @@ endfunc
// const int w, const int s,
// const int bitdepth_max);
function sgr_box5_vert_neon, export=1
stp d8, d9, [sp, #-0x40]!
stp d8, d9, [sp, #-0x30]!
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
add w4, w4, #2
clz w15, w6 // bitdepth_max
@@ -163,24 +241,18 @@ function sgr_box5_vert_neon, export=1
movi v31.4s, #25 // n
sub w15, w15, #24 // -bitdepth_min_8
movrel x13, X(sgr_x_by_x)
mov w14, #164 // one_by_x
ld1 {v16.16b, v17.16b, v18.16b}, [x13]
movrel x13, x_by_x_tables
movi v30.4s, #164
ld1 {v24.16b, v25.16b, v26.16b, v27.16b}, [x13] // RangeMins, DiffMasks
dup v6.8h, w15 // -bitdepth_min_8
movi v19.16b, #5
movi v24.8b, #254 // idx of last 1
movi v19.8b, #0x7
ldr q18, [x13, #64] // RefLo
saddl v7.4s, v6.4h, v6.4h // -2*bitdepth_min_8
movi v29.8h, #1, lsl #8
dup v30.4s, w14 // one_by_x
sub v16.16b, v16.16b, v19.16b
sub v17.16b, v17.16b, v19.16b
sub v18.16b, v18.16b, v19.16b
ld1 {v8.4s, v9.4s}, [x5], #32
ld1 {v10.4s, v11.4s}, [x6], #32
ld1 {v12.4s, v13.4s}, [x7], #32
ld1 {v14.4s, v15.4s}, [x8], #32
ld1 {v16.4s, v17.4s}, [x8], #32
ld1 {v20.8h}, [x9], #16
ld1 {v21.8h}, [x10], #16
ld1 {v22.8h}, [x11], #16
@@ -191,8 +263,8 @@ function sgr_box5_vert_neon, export=1
1:
add v8.4s, v8.4s, v10.4s
add v9.4s, v9.4s, v11.4s
add v12.4s, v12.4s, v14.4s
add v13.4s, v13.4s, v15.4s
add v12.4s, v12.4s, v16.4s
add v13.4s, v13.4s, v17.4s
add v20.8h, v20.8h, v21.8h
add v22.8h, v22.8h, v23.8h
@@ -207,11 +279,6 @@ function sgr_box5_vert_neon, export=1
subs w4, w4, #8
movi v20.8b, #55 // idx of last 5
movi v21.8b, #72 // idx of last 4
movi v22.8b, #101 // idx of last 3
movi v23.8b, #169 // idx of last 2
srshl v0.4s, v0.4s, v7.4s
srshl v1.4s, v1.4s, v7.4s
srshl v4.8h, v2.8h, v6.8h
@@ -231,22 +298,19 @@ function sgr_box5_vert_neon, export=1
ld1 {v12.4s, v13.4s}, [x7], #32
cmhi v25.8b, v0.8b, v20.8b // = -1 if sgr_x_by_x[v0] < 5
cmhi v26.8b, v0.8b, v21.8b // = -1 if sgr_x_by_x[v0] < 4
tbl v1.8b, {v16.16b, v17.16b, v18.16b}, v0.8b
cmhi v27.8b, v0.8b, v22.8b // = -1 if sgr_x_by_x[v0] < 3
cmhi v4.8b, v0.8b, v23.8b // = -1 if sgr_x_by_x[v0] < 2
ld1 {v14.4s, v15.4s}, [x8], #32
add v25.8b, v25.8b, v26.8b
cmhi v5.8b, v0.8b, v24.8b // = -1 if sgr_x_by_x[v0] < 1
add v27.8b, v27.8b, v4.8b
ushr v1.8b, v0.8b, #3
ld1 {v16.4s, v17.4s}, [x8], #32
tbl v5.8b, {v26.16b, v27.16b}, v1.8b // RangeMins
tbl v1.8b, {v24.16b, v25.16b}, v1.8b // DiffMasks
tbl v4.8b, {v18.16b}, v0.8b // RefLo
and v0.8b, v0.8b, v19.8b
ld1 {v20.8h}, [x9], #16
add v5.8b, v5.8b, v19.8b
add v25.8b, v25.8b, v27.8b
ushl v5.8b, v5.8b, v0.8b
add v4.8b, v4.8b, v1.8b
ld1 {v21.8h}, [x10], #16
add v5.8b, v1.8b, v5.8b
cnt v5.8b, v5.8b
ld1 {v22.8h}, [x11], #16
add v5.8b, v5.8b, v25.8b
add v5.8b, v4.8b, v5.8b
ld1 {v23.8h}, [x12], #16
uxtl v5.8h, v5.8b // x
@@ -257,16 +321,14 @@ function sgr_box5_vert_neon, export=1
mul v4.4s, v4.4s, v30.4s // x * BB[i] * sgr_one_by_x
srshr v3.4s, v3.4s, #12 // AA[i]
srshr v4.4s, v4.4s, #12 // AA[i]
sub v5.8h, v29.8h, v5.8h // 256 - x
ld1 {v2.8h}, [x1], #16
st1 {v3.4s, v4.4s}, [x2], #32
st1 {v5.8h}, [x3], #16
b.gt 1b
ldp d14, d15, [sp, #0x30]
ldp d12, d13, [sp, #0x20]
ldp d10, d11, [sp, #0x10]
ldp d8, d9, [sp], 0x40
ldp d8, d9, [sp], 0x30
ret
endfunc
+82 -129
View File
@@ -174,10 +174,10 @@ function sgr_finish_filter1_2rows_\bpc\()bpc_neon, export=1
mla v14.4s, v19.4s, v31.4s // * 3 -> b
mla v15.4s, v20.4s, v31.4s
umlal v8.4s, v4.4h, v25.4h // b + a * src
umlal2 v9.4s, v4.8h, v25.8h
umlal v14.4s, v0.4h, v26.4h // b + a * src
umlal2 v15.4s, v0.8h, v26.8h
umlsl v8.4s, v4.4h, v25.4h // b - a * src
umlsl2 v9.4s, v4.8h, v25.8h
umlsl v14.4s, v0.4h, v26.4h // b - a * src
umlsl2 v15.4s, v0.8h, v26.8h
mov v0.16b, v1.16b
rshrn v8.4h, v8.4s, #9
rshrn2 v8.8h, v9.4s, #9
@@ -292,8 +292,8 @@ function sgr_finish_weighted1_\bpc\()bpc_neon, export=1
uxtl v19.8h, v19.8b // src
.endif
mov v0.16b, v1.16b
umlal v25.4s, v2.4h, v19.4h // b + a * src
umlal2 v26.4s, v2.8h, v19.8h
umlsl v25.4s, v2.4h, v19.4h // b - a * src
umlsl2 v26.4s, v2.8h, v19.8h
mov v2.16b, v3.16b
rshrn v25.4h, v25.4s, #9
rshrn2 v25.8h, v26.4s, #9
@@ -301,30 +301,25 @@ function sgr_finish_weighted1_\bpc\()bpc_neon, export=1
subs w3, w3, #8
// weighted1
shl v19.8h, v19.8h, #4 // u
mov v4.16b, v5.16b
sub v25.8h, v25.8h, v19.8h // t1 - u
ld1 {v1.8h}, [x9], #16
ushll v26.4s, v19.4h, #7 // u << 7
ushll2 v27.4s, v19.8h, #7 // u << 7
ld1 {v3.8h}, [x10], #16
smlal v26.4s, v25.4h, v31.4h // v
smlal2 v27.4s, v25.8h, v31.8h // v
smull v26.4s, v25.4h, v31.4h // v = t1 * w1
smull2 v27.4s, v25.8h, v31.8h
ld1 {v5.8h}, [x2], #16
.if \bpc == 8
rshrn v26.4h, v26.4s, #11
rshrn2 v26.8h, v27.4s, #11
usqadd v19.8h, v26.8h
.if \bpc == 8
mov v16.16b, v18.16b
sqxtun v26.8b, v26.8h
sqxtun v26.8b, v19.8h
mov v19.16b, v21.16b
mov v22.16b, v24.16b
st1 {v26.8b}, [x0], #8
.else
sqrshrun v26.4h, v26.4s, #11
sqrshrun2 v26.8h, v27.4s, #11
mov v16.16b, v18.16b
umin v26.8h, v26.8h, v30.8h
umin v26.8h, v19.8h, v30.8h
mov v19.16b, v21.16b
mov v22.16b, v24.16b
st1 {v26.8h}, [x0], #16
@@ -424,10 +419,10 @@ function sgr_finish_filter2_2rows_\bpc\()bpc_neon, export=1
uxtl v31.8h, v31.8b
uxtl v30.8h, v30.8b
.endif
umlal v16.4s, v0.4h, v31.4h // b + a * src
umlal2 v17.4s, v0.8h, v31.8h
umlal v9.4s, v8.4h, v30.4h // b + a * src
umlal2 v10.4s, v8.8h, v30.8h
umlsl v16.4s, v0.4h, v31.4h // b - a * src
umlsl2 v17.4s, v0.8h, v31.8h
umlsl v9.4s, v8.4h, v30.4h // b - a * src
umlsl2 v10.4s, v8.8h, v30.8h
mov v0.16b, v1.16b
rshrn v16.4h, v16.4s, #9
rshrn2 v16.8h, v17.4s, #9
@@ -541,10 +536,10 @@ function sgr_finish_weighted2_\bpc\()bpc_neon, export=1
uxtl v31.8h, v31.8b
uxtl v30.8h, v30.8b
.endif
umlal v16.4s, v0.4h, v31.4h // b + a * src
umlal2 v17.4s, v0.8h, v31.8h
umlal v9.4s, v8.4h, v30.4h // b + a * src
umlal2 v10.4s, v8.8h, v30.8h
umlsl v16.4s, v0.4h, v31.4h // b - a * src
umlsl2 v17.4s, v0.8h, v31.8h
umlsl v9.4s, v8.4h, v30.4h // b - a * src
umlsl2 v10.4s, v8.8h, v30.8h
mov v0.16b, v1.16b
rshrn v16.4h, v16.4s, #9
rshrn2 v16.8h, v17.4s, #9
@@ -554,40 +549,30 @@ function sgr_finish_weighted2_\bpc\()bpc_neon, export=1
subs w4, w4, #8
// weighted1
shl v31.8h, v31.8h, #4 // u
shl v30.8h, v30.8h, #4
mov v2.16b, v3.16b
sub v16.8h, v16.8h, v31.8h // t1 - u
sub v9.8h, v9.8h, v30.8h
ld1 {v1.8h}, [x3], #16
ushll v22.4s, v31.4h, #7 // u << 7
ushll2 v23.4s, v31.8h, #7
ushll v24.4s, v30.4h, #7
ushll2 v25.4s, v30.8h, #7
ld1 {v3.8h}, [x8], #16
smlal v22.4s, v16.4h, v14.4h // v
smlal2 v23.4s, v16.8h, v14.8h
smull v22.4s, v16.4h, v14.4h // v
smull2 v23.4s, v16.8h, v14.8h
mov v16.16b, v18.16b
smlal v24.4s, v9.4h, v14.4h
smlal2 v25.4s, v9.8h, v14.8h
smull v24.4s, v9.4h, v14.4h
smull2 v25.4s, v9.8h, v14.8h
mov v19.16b, v21.16b
.if \bpc == 8
rshrn v22.4h, v22.4s, #11
rshrn2 v22.8h, v23.4s, #11
rshrn v23.4h, v24.4s, #11
rshrn2 v23.8h, v25.4s, #11
sqxtun v22.8b, v22.8h
sqxtun v23.8b, v23.8h
usqadd v31.8h, v22.8h
usqadd v30.8h, v23.8h
.if \bpc == 8
sqxtun v22.8b, v31.8h
sqxtun v23.8b, v30.8h
st1 {v22.8b}, [x0], #8
st1 {v23.8b}, [x1], #8
.else
sqrshrun v22.4h, v22.4s, #11
sqrshrun2 v22.8h, v23.4s, #11
sqrshrun v23.4h, v24.4s, #11
sqrshrun2 v23.8h, v25.4s, #11
umin v22.8h, v22.8h, v15.8h
umin v23.8h, v23.8h, v15.8h
umin v22.8h, v31.8h, v15.8h
umin v23.8h, v30.8h, v15.8h
st1 {v22.8h}, [x0], #16
st1 {v23.8h}, [x1], #16
.endif
@@ -605,146 +590,114 @@ function sgr_finish_weighted2_\bpc\()bpc_neon, export=1
endfunc
// void dav1d_sgr_weighted2_Xbpc_neon(pixel *dst, const ptrdiff_t stride,
// const pixel *src, const ptrdiff_t src_stride,
// const int16_t *t1, const int16_t *t2,
// const int w, const int h,
// const int16_t wt[2], const int bitdepth_max);
function sgr_weighted2_\bpc\()bpc_neon, export=1
.if \bpc == 8
ldr x8, [sp]
.else
ldp x8, x9, [sp]
.endif
cmp w7, #2
cmp w5, #2
add x10, x0, x1
add x11, x2, x3
add x12, x4, #2*FILTER_OUT_STRIDE
add x13, x5, #2*FILTER_OUT_STRIDE
ld2r {v30.8h, v31.8h}, [x8] // wt[0], wt[1]
add x12, x2, #2*FILTER_OUT_STRIDE
add x13, x3, #2*FILTER_OUT_STRIDE
ld2r {v30.8h, v31.8h}, [x6] // wt[0], wt[1]
.if \bpc == 16
dup v29.8h, w9
dup v29.8h, w7
.endif
mov x8, #4*FILTER_OUT_STRIDE
lsl x1, x1, #1
lsl x3, x3, #1
add x9, x6, #7
add w9, w4, #7
bic x9, x9, #7 // Aligned width
.if \bpc == 8
sub x1, x1, x9
sub x3, x3, x9
.else
sub x1, x1, x9, lsl #1
sub x3, x3, x9, lsl #1
.endif
sub x8, x8, x9, lsl #1
mov w9, w6
mov w9, w4
b.lt 2f
1:
.if \bpc == 8
ld1 {v0.8b}, [x2], #8
ld1 {v16.8b}, [x11], #8
ld1 {v0.8b}, [x0]
ld1 {v16.8b}, [x10]
.else
ld1 {v0.8h}, [x2], #16
ld1 {v16.8h}, [x11], #16
ld1 {v0.8h}, [x0]
ld1 {v16.8h}, [x10]
.endif
ld1 {v1.8h}, [x4], #16
ld1 {v1.8h}, [x2], #16
ld1 {v17.8h}, [x12], #16
ld1 {v2.8h}, [x5], #16
ld1 {v2.8h}, [x3], #16
ld1 {v18.8h}, [x13], #16
subs w6, w6, #8
subs w4, w4, #8
.if \bpc == 8
ushll v0.8h, v0.8b, #4 // u
ushll v16.8h, v16.8b, #4 // u
.else
shl v0.8h, v0.8h, #4 // u
shl v16.8h, v16.8h, #4 // u
uxtl v0.8h, v0.8b
uxtl v16.8h, v16.8b
.endif
sub v1.8h, v1.8h, v0.8h // t1 - u
sub v2.8h, v2.8h, v0.8h // t2 - u
sub v17.8h, v17.8h, v16.8h // t1 - u
sub v18.8h, v18.8h, v16.8h // t2 - u
ushll v3.4s, v0.4h, #7 // u << 7
ushll2 v4.4s, v0.8h, #7 // u << 7
ushll v19.4s, v16.4h, #7 // u << 7
ushll2 v20.4s, v16.8h, #7 // u << 7
smlal v3.4s, v1.4h, v30.4h // wt[0] * (t1 - u)
smlal v3.4s, v2.4h, v31.4h // wt[1] * (t2 - u)
smlal2 v4.4s, v1.8h, v30.8h // wt[0] * (t1 - u)
smlal2 v4.4s, v2.8h, v31.8h // wt[1] * (t2 - u)
smlal v19.4s, v17.4h, v30.4h // wt[0] * (t1 - u)
smlal v19.4s, v18.4h, v31.4h // wt[1] * (t2 - u)
smlal2 v20.4s, v17.8h, v30.8h // wt[0] * (t1 - u)
smlal2 v20.4s, v18.8h, v31.8h // wt[1] * (t2 - u)
.if \bpc == 8
smull v3.4s, v1.4h, v30.4h // wt[0] * t1
smlal v3.4s, v2.4h, v31.4h // wt[1] * t2
smull2 v4.4s, v1.8h, v30.8h // wt[0] * t1
smlal2 v4.4s, v2.8h, v31.8h // wt[1] * t2
smull v19.4s, v17.4h, v30.4h // wt[0] * t1
smlal v19.4s, v18.4h, v31.4h // wt[1] * t2
smull2 v20.4s, v17.8h, v30.8h // wt[0] * t1
smlal2 v20.4s, v18.8h, v31.8h // wt[1] * t2
rshrn v3.4h, v3.4s, #11
rshrn2 v3.8h, v4.4s, #11
rshrn v19.4h, v19.4s, #11
rshrn2 v19.8h, v20.4s, #11
sqxtun v3.8b, v3.8h
sqxtun v19.8b, v19.8h
usqadd v0.8h, v3.8h
usqadd v16.8h, v19.8h
.if \bpc == 8
sqxtun v3.8b, v0.8h
sqxtun v19.8b, v16.8h
st1 {v3.8b}, [x0], #8
st1 {v19.8b}, [x10], #8
.else
sqrshrun v3.4h, v3.4s, #11
sqrshrun2 v3.8h, v4.4s, #11
sqrshrun v19.4h, v19.4s, #11
sqrshrun2 v19.8h, v20.4s, #11
umin v3.8h, v3.8h, v29.8h
umin v19.8h, v19.8h, v29.8h
umin v3.8h, v0.8h, v29.8h
umin v19.8h, v16.8h, v29.8h
st1 {v3.8h}, [x0], #16
st1 {v19.8h}, [x10], #16
.endif
b.gt 1b
subs w7, w7, #2
cmp w7, #1
subs w5, w5, #2
cmp w5, #1
b.lt 0f
mov w6, w9
mov w4, w9
add x0, x0, x1
add x10, x10, x1
add x2, x2, x3
add x11, x11, x3
add x4, x4, x8
add x2, x2, x8
add x12, x12, x8
add x5, x5, x8
add x3, x3, x8
add x13, x13, x8
b.eq 2f
b 1b
2:
.if \bpc == 8
ld1 {v0.8b}, [x2], #8
ld1 {v0.8b}, [x0]
.else
ld1 {v0.8h}, [x2], #16
ld1 {v0.8h}, [x0]
.endif
ld1 {v1.8h}, [x4], #16
ld1 {v2.8h}, [x5], #16
subs w6, w6, #8
ld1 {v1.8h}, [x2], #16
ld1 {v2.8h}, [x3], #16
subs w4, w4, #8
.if \bpc == 8
ushll v0.8h, v0.8b, #4 // u
.else
shl v0.8h, v0.8h, #4 // u
uxtl v0.8h, v0.8b
.endif
sub v1.8h, v1.8h, v0.8h // t1 - u
sub v2.8h, v2.8h, v0.8h // t2 - u
ushll v3.4s, v0.4h, #7 // u << 7
ushll2 v4.4s, v0.8h, #7 // u << 7
smlal v3.4s, v1.4h, v30.4h // wt[0] * (t1 - u)
smlal v3.4s, v2.4h, v31.4h // wt[1] * (t2 - u)
smlal2 v4.4s, v1.8h, v30.8h // wt[0] * (t1 - u)
smlal2 v4.4s, v2.8h, v31.8h // wt[1] * (t2 - u)
.if \bpc == 8
smull v3.4s, v1.4h, v30.4h // wt[0] * t1
smlal v3.4s, v2.4h, v31.4h // wt[1] * t2
smull2 v4.4s, v1.8h, v30.8h // wt[0] * t1
smlal2 v4.4s, v2.8h, v31.8h // wt[1] * t2
rshrn v3.4h, v3.4s, #11
rshrn2 v3.8h, v4.4s, #11
sqxtun v3.8b, v3.8h
usqadd v0.8h, v3.8h
.if \bpc == 8
sqxtun v3.8b, v0.8h
st1 {v3.8b}, [x0], #8
.else
sqrshrun v3.4h, v3.4s, #11
sqrshrun2 v3.8h, v4.4s, #11
umin v3.8h, v3.8h, v29.8h
umin v3.8h, v0.8h, v29.8h
st1 {v3.8h}, [x0], #16
.endif
b.gt 1b
b.gt 2b
0:
ret
endfunc
+328 -298
View File
File diff suppressed because it is too large Load Diff
+376 -307
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+338 -74
View File
@@ -45,34 +45,39 @@ ENABLE_DOTPROD
#define LOOP_ALIGN 2
// Lookup table used to help conversion of shifted 32-bit values to 8-bit.
.align 4
L(hv_tbl_neon_dotprod):
const h_tbl_neon_dotprod, align=4
// Shuffle indices to permute horizontal samples in preparation for
// input to SDOT instructions. The 8-tap horizontal convolution uses
// sample indices in the interval of [-3, 4] relative to the current
// sample position.
.byte 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6
.byte 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10
.byte 8, 9, 10, 11, 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 13, 14
// Shuffle indices to permute horizontal samples in preparation for
// input to USMMLA instructions.
#define OFFSET_USMMLA 48
.byte 0, 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8, 9
.byte 4, 5, 6, 7, 8, 9, 10, 11, 6, 7, 8, 9, 10, 11, 12, 13
// Lookup table used to help conversion of shifted 32-bit values to 8-bit.
#define OFFSET_CVT_32_8 80
.byte 1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30
endconst
// Shuffle indices to permute horizontal samples in preparation for input to
// SDOT instructions. The 8-tap horizontal convolution uses sample indices in the
// interval of [-3, 4] relative to the current sample position. We load samples
// from index value -4 to keep loads word aligned, so the shuffle bytes are
// translated by 1 to handle this.
.align 4
L(h_tbl_neon_dotprod):
.byte 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7
.byte 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 8, 9, 10, 11
.byte 9, 10, 11, 12, 10, 11, 12, 13, 11, 12, 13, 14, 12, 13, 14, 15
// Vertical convolutions are also using SDOT instructions, where a 128-bit
// register contains a transposed 4x4 matrix of values. Subsequent iterations of
// the vertical convolution can reuse the 3x4 sub-matrix from the previous loop
// iteration. These shuffle indices shift and merge this 4x4 matrix with the
// values of a new line.
.align 4
L(v_tbl_neon_dotprod):
const v_tbl_neon_dotprod, align=4
// Vertical convolutions are also using SDOT instructions, where a
// 128-bit register contains a transposed 4x4 matrix of values.
// Subsequent iterations of the vertical convolution can reuse the
// 3x4 sub-matrix from the previous loop iteration. These shuffle
// indices shift and merge this 4x4 matrix with the values of a new
// line.
.byte 1, 2, 3, 16, 5, 6, 7, 20, 9, 10, 11, 24, 13, 14, 15, 28
.byte 1, 2, 3, 16, 5, 6, 7, 17, 9, 10, 11, 18, 13, 14, 15, 19
.byte 1, 2, 3, 20, 5, 6, 7, 21, 9, 10, 11, 22, 13, 14, 15, 23
.byte 1, 2, 3, 24, 5, 6, 7, 25, 9, 10, 11, 26, 13, 14, 15, 27
.byte 1, 2, 3, 28, 5, 6, 7, 29, 9, 10, 11, 30, 13, 14, 15, 31
endconst
.macro make_8tap_fn op, type, type_h, type_v, isa, jump=1
@@ -111,24 +116,24 @@ function \type\()_8tap_\isa, align=FUNC_ALIGN
.align JUMP_ALIGN
L(\type\()_8tap_v_\isa):
madd \my, \my, w11, w10
ldr q6, L(v_tbl_neon_dotprod)
movrel x13, v_tbl_neon_dotprod
sub \src, \src, \s_strd
.ifc \isa, neon_dotprod
.ifc \type, prep
mov w8, 0x2002 // FILTER_WEIGHT * 128 + rounding
mov w8, #0x2002 // FILTER_WEIGHT * 128 + rounding
dup v4.4s, w8
.else
movi v4.4s, #32, lsl 8 // FILTER_WEIGHT * 128, bias for SDOT
movi v4.4s, #32, lsl #8 // FILTER_WEIGHT * 128, bias for SDOT
.endif
.endif
ubfx w11, \my, #7, #7
and \my, \my, #0x7F
ldr q28, L(v_tbl_neon_dotprod) + 16
ldp q6, q28, [x13]
cmp \h, #4
csel \my, \my, w11, le
sub \src, \src, \s_strd, lsl #1 // src - s_strd * 3
add \xmy, x12, \xmy, lsl #3 // subpel V filter address
ldr q29, L(v_tbl_neon_dotprod) + 32
ldr q29, [x13, #32]
.ifc \isa, neon_dotprod
movi v5.16b, #128
.endif
@@ -139,8 +144,7 @@ L(\type\()_8tap_v_\isa):
// .align JUMP_ALIGN // fallthrough
160: // V - 16xN+
ldr q30, L(v_tbl_neon_dotprod) + 48
ldr q31, L(v_tbl_neon_dotprod) + 64
ldp q30, q31, [x13, #48]
.ifc \type, prep
add \wd_strd, \w, \w
.endif
@@ -678,18 +682,19 @@ L(\type\()_8tap_v_\isa):
L(\type\()_8tap_h_hv_\isa):
madd \mx, \mx, w11, w9
madd w14, \my, w11, w10 // for HV
ldr q28, L(h_tbl_neon_dotprod)
.ifc \isa, neon_dotprod
mov w13, 0x2002 // FILTER_WEIGHT * 128 + rounding
mov w13, #0x2002 // FILTER_WEIGHT * 128 + rounding
dup v27.4s, w13 // put H overrides this
.endif
sub \src, \src, #4 // src - 4
ubfx w9, \mx, #7, #7
movrel x13, h_tbl_neon_dotprod
sub \src, \src, #3 // src - 3
ldr q28, [x13] // for 4-tap & 8-tap H filters
ubfx w15, \mx, #7, #7
and \mx, \mx, #0x7F
ubfx w11, w14, #7, #7 // for HV
and w14, w14, #0x7F // for HV
cmp \w, #4
csel \mx, \mx, w9, le
csel \mx, \mx, w15, le
add \xmx, x12, \xmx, lsl #3 // subpel H filter address
.ifc \isa, neon_dotprod
movi v24.16b, #128
@@ -699,19 +704,19 @@ L(\type\()_8tap_h_hv_\isa):
// HV cases
cmp \h, #4
csel w14, w14, w11, le
sub \src, \src, \s_strd, lsl #1 // src - s_strd * 2 - 4
sub \src, \src, \s_strd, lsl #1 // src - s_strd * 2 - 3
add \xmy, x12, x14, lsl #3 // subpel V filter address
mov x15, x30
ldr d7, [\xmy]
.ifc \type, put
ldr q25, L(hv_tbl_neon_dotprod)
.endif
ldr q25, [x13, #(OFFSET_CVT_32_8)] // LUT to help conversion
.endif // of 32b values to 8b
sxtl v7.8h, v7.8b
cmp w10, SHARP1
cmp w10, #SHARP1
b.ne L(\type\()_6tap_hv_\isa) // vertical != SHARP1
// HV 8-tap cases
sub \src, \src, \s_strd // src - s_strd * 3 - 4
sub \src, \src, \s_strd // src - s_strd * 3 - 3
cmp \w, #4
b.eq 40f
.ifc \type, put
@@ -720,8 +725,7 @@ L(\type\()_8tap_h_hv_\isa):
// .align JUMP_ALIGN // fallthrough
80: // HV8 - 8xN+
ldr q29, L(h_tbl_neon_dotprod) + 16
ldr q30, L(h_tbl_neon_dotprod) + 32
ldp q29, q30, [x13, #16]
ldr d26, [\xmx]
.ifc \type, prep
add \wd_strd, \w, \w
@@ -862,7 +866,7 @@ L(\type\()_8tap_h_hv_\isa):
.align JUMP_ALIGN
40: // HV8 - 4xN
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
add \src, \src, #2
bl L(\type\()_hv_filter4_\isa)
@@ -932,7 +936,7 @@ L(\type\()_8tap_h_hv_\isa):
.ifc \type, put
.align JUMP_ALIGN
20: // HV8 - 2xN
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
add \src, \src, #2
bl L(\type\()_hv_filter4_\isa)
@@ -1007,12 +1011,91 @@ L(\type\()_6tap_hv_\isa):
// .align JUMP_ALIGN // fallthrough
80: // HV6 - 8xN+
ldr q29, L(h_tbl_neon_dotprod) + 16
ldr q30, L(h_tbl_neon_dotprod) + 32
ldr d26, [\xmx]
.ifc \type, prep
add \wd_strd, \w, \w
.endif
.ifc \isa, neon_i8mm
cmp w9, #SHARP1
b.eq 88f // horizontal == SHARP1
ldp q29, q30, [x13, #(OFFSET_USMMLA)]
ext v0.8b, v26.8b, v26.8b, #7
ins v26.d[1], v0.d[0]
.align LOOP_ALIGN
81:
mov \lsrc, \src
mov \ldst, \dst
mov w8, \h
bl L(\type\()_hv_filter6_neon_i8mm)
srshr v16.8h, v22.8h, #2
bl L(\type\()_hv_filter6_neon_i8mm)
srshr v17.8h, v22.8h, #2
bl L(\type\()_hv_filter6_neon_i8mm)
srshr v18.8h, v22.8h, #2
bl L(\type\()_hv_filter6_neon_i8mm)
srshr v19.8h, v22.8h, #2
bl L(\type\()_hv_filter6_neon_i8mm)
srshr v20.8h, v22.8h, #2
.align LOOP_ALIGN
8:
ld1 {v23.16b}, [\lsrc], \s_strd
smull v0.4s, v16.4h, v7.h[1]
smull2 v1.4s, v16.8h, v7.h[1]
mov v16.16b, v17.16b
movi v5.4s, #0
movi v6.4s, #0
tbl v2.16b, {v23.16b}, v29.16b
tbl v3.16b, {v23.16b}, v30.16b
smlal v0.4s, v17.4h, v7.h[2]
smlal2 v1.4s, v17.8h, v7.h[2]
mov v17.16b, v18.16b
usmmla v5.4s, v2.16b, v26.16b
usmmla v6.4s, v3.16b, v26.16b
smlal v0.4s, v18.4h, v7.h[3]
smlal2 v1.4s, v18.8h, v7.h[3]
mov v18.16b, v19.16b
subs w8, w8, #1
smlal v0.4s, v19.4h, v7.h[4]
smlal2 v1.4s, v19.8h, v7.h[4]
uzp1 v23.8h, v5.8h, v6.8h
mov v19.16b, v20.16b
smlal v0.4s, v20.4h, v7.h[5]
smlal2 v1.4s, v20.8h, v7.h[5]
srshr v20.8h, v23.8h, #2
smlal v0.4s, v20.4h, v7.h[6]
smlal2 v1.4s, v20.8h, v7.h[6]
.ifc \type, prep
rshrn v0.4h, v0.4s, #6
rshrn2 v0.8h, v1.4s, #6
st1 {v0.8h}, [\ldst], \d_strd
b.gt 8b
add \dst, \dst, #16
.else
tbl v0.16b, {v0.16b, v1.16b}, v25.16b
sqrshrun v0.8b, v0.8h, #2
st1 {v0.8b}, [\ldst], \d_strd
b.gt 8b
add \dst, \dst, #8
.endif
add \src, \src, #8
subs \w, \w, #8
b.gt 81b
ret x15
.align JUMP_ALIGN
88:
.endif // neon_i8mm
ldp q29, q30, [x13, #16]
.align LOOP_ALIGN
81:
@@ -1044,8 +1127,8 @@ L(\type\()_6tap_hv_\isa):
.endif
.align LOOP_ALIGN
8:
ldr q23, [\xmy]
add \xmy, \xmy, \s_strd
ldr q23, [\lsrc]
add \lsrc, \lsrc, \s_strd
smull v0.4s, v16.4h, v7.h[1]
smull2 v1.4s, v16.8h, v7.h[1]
@@ -1132,6 +1215,20 @@ L(\type\()_hv_filter8_\isa):
uzp1 v22.8h, v22.8h, v23.8h
ret
.ifc \isa, neon_i8mm
.align FUNC_ALIGN
L(\type\()_hv_filter6_neon_i8mm):
ld1 {v4.16b}, [\lsrc], \s_strd
movi v22.4s, #0
movi v23.4s, #0
tbl v2.16b, {v4.16b}, v29.16b
tbl v3.16b, {v4.16b}, v30.16b
usmmla v22.4s, v2.16b, v26.16b
usmmla v23.4s, v3.16b, v26.16b
uzp1 v22.8h, v22.8h, v23.8h
ret
.endif
.align FUNC_ALIGN
L(\type\()_hv_filter4_\isa):
ld1 {v4.8b}, [\src], \s_strd
@@ -1147,7 +1244,7 @@ L(\type\()_hv_filter4_\isa):
.align JUMP_ALIGN
40: // HV6 - 4xN
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
add \src, \src, #2
bl L(\type\()_hv_filter4_\isa)
@@ -1208,7 +1305,7 @@ L(\type\()_hv_filter4_\isa):
.ifc \type, put
.align JUMP_ALIGN
20: // HV6 - 2xN
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
add \src, \src, #2
bl L(\type\()_hv_filter4_\isa)
@@ -1268,8 +1365,8 @@ L(\type\()_hv_filter4_\isa):
.align JUMP_ALIGN
L(\type\()_8tap_h_\isa):
adr x9, L(\type\()_8tap_h_\isa\()_tbl)
ldrh w8, [x9, x8, lsl #1]
movrel x11, \type\()_8tap_h_\isa\()_tbl
ldrsw x8, [x11, x8, lsl #2]
.ifc \type, put
.ifc \isa, neon_i8mm
movi v27.4s, #34 // special rounding
@@ -1278,15 +1375,15 @@ L(\type\()_8tap_h_\isa):
dup v27.4s, w10
.endif
.endif
sub x9, x9, x8
br x9
add x11, x11, x8
br x11
.ifc \type, put
.align JUMP_ALIGN
20: // H - 2xN
AARCH64_VALID_JUMP_TARGET
add \src, \src, #2
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
.align LOOP_ALIGN
2:
@@ -1323,7 +1420,7 @@ L(\type\()_8tap_h_\isa):
40: // H - 4xN
AARCH64_VALID_JUMP_TARGET
add \src, \src, #2
ldr s26, [\xmx, #2]
ldur s26, [\xmx, #2]
.align LOOP_ALIGN
4:
@@ -1372,9 +1469,63 @@ L(\type\()_8tap_h_\isa):
.align JUMP_ALIGN
80: // H - 8xN
AARCH64_VALID_JUMP_TARGET
ldr q29, L(h_tbl_neon_dotprod) + 16
ldr q30, L(h_tbl_neon_dotprod) + 32
ldr d26, [\xmx]
.ifc \isa, neon_i8mm
cmp w9, #SHARP1
b.eq 88f // horizontal == SHARP1
ldp q29, q30, [x13, #(OFFSET_USMMLA)]
ext v0.8b, v26.8b, v26.8b, #7
ins v26.d[1], v0.d[0]
.align LOOP_ALIGN
8:
ldr q0, [\src]
ldr q16, [\src, \s_strd]
add \src, \src, \s_strd, lsl #1
.ifc \type, prep
movi v4.4s, #0
movi v5.4s, #0
movi v20.4s, #0
movi v21.4s, #0
.else
mov v4.16b, v27.16b
mov v5.16b, v27.16b
mov v20.16b, v27.16b
mov v21.16b, v27.16b
.endif
tbl v1.16b, {v0.16b}, v29.16b
tbl v2.16b, {v0.16b}, v30.16b
tbl v17.16b, {v16.16b}, v29.16b
tbl v18.16b, {v16.16b}, v30.16b
usmmla v4.4s, v1.16b, v26.16b
usmmla v5.4s, v2.16b, v26.16b
usmmla v20.4s, v17.16b, v26.16b
usmmla v21.4s, v18.16b, v26.16b
uzp1 v4.8h, v4.8h, v5.8h
uzp1 v20.8h, v20.8h, v21.8h
.ifc \type, prep
srshr v4.8h, v4.8h, #2
srshr v20.8h, v20.8h, #2
subs \h, \h, #2
stp q4, q20, [\dst], #32
.else // put
sqshrun v4.8b, v4.8h, #6
sqshrun v20.8b, v20.8h, #6
subs \h, \h, #2
str d4, [\dst]
str d20, [\dst, \d_strd]
add \dst, \dst, \d_strd, lsl #1
.endif
b.gt 8b
ret
.align JUMP_ALIGN
88:
.endif // neon_i8mm
ldp q29, q30, [x13, #16]
.align LOOP_ALIGN
8:
@@ -1438,14 +1589,66 @@ L(\type\()_8tap_h_\isa):
.align JUMP_ALIGN
160: // H - 16xN
AARCH64_VALID_JUMP_TARGET
ldr q29, L(h_tbl_neon_dotprod) + 16
ldr q30, L(h_tbl_neon_dotprod) + 32
ldr d26, [\xmx]
.ifc \isa, neon_i8mm
cmp w9, #SHARP1
b.eq 168f // horizontal == SHARP1
ldp q29, q30, [x13, #(OFFSET_USMMLA)]
ext v0.8b, v26.8b, v26.8b, #7
ins v26.d[1], v0.d[0]
.align LOOP_ALIGN
16:
ldr q16, [\src]
ldr q17, [\src, #12] // avoid 2 register TBL for small cores
ldur q17, [\src, #8] // avoid 2 register TBL for small cores
add \src, \src, \s_strd
.ifc \type, prep
movi v6.4s, #0
movi v7.4s, #0
movi v22.4s, #0
movi v23.4s, #0
.else
mov v6.16b, v27.16b
mov v7.16b, v27.16b
mov v22.16b, v27.16b
mov v23.16b, v27.16b
.endif
tbl v0.16b, {v16.16b}, v29.16b
tbl v1.16b, {v16.16b}, v30.16b
tbl v2.16b, {v17.16b}, v29.16b
tbl v3.16b, {v17.16b}, v30.16b
usmmla v6.4s, v0.16b, v26.16b
usmmla v7.4s, v1.16b, v26.16b
usmmla v22.4s, v2.16b, v26.16b
usmmla v23.4s, v3.16b, v26.16b
uzp1 v6.8h, v6.8h, v7.8h
uzp1 v22.8h, v22.8h, v23.8h
.ifc \type, prep
srshr v6.8h, v6.8h, #2
srshr v22.8h, v22.8h, #2
subs \h, \h, #1
stp q6, q22, [\dst], #32
.else // put
sqshrun v6.8b, v6.8h, #6
sqshrun2 v6.16b, v22.8h, #6
subs \h, \h, #1
st1 {v6.16b}, [\dst], \d_strd
.endif
b.gt 16b
ret
.align JUMP_ALIGN
168:
.endif // neon_i8mm
ldp q29, q30, [x13, #16]
.align LOOP_ALIGN
16:
ldr q16, [\src]
ldur q17, [\src, #12] // avoid 2 register TBL for small cores
add \src, \src, \s_strd
.ifc \type\()_\isa, prep_neon_i8mm
movi v6.4s, #0
@@ -1503,8 +1706,6 @@ L(\type\()_8tap_h_\isa):
640:
1280:
AARCH64_VALID_JUMP_TARGET
ldr q29, L(h_tbl_neon_dotprod) + 16
ldr q30, L(h_tbl_neon_dotprod) + 32
ldr d26, [\xmx]
.ifc \type, put
sub \d_strd, \d_strd, \w, uxtw
@@ -1512,10 +1713,73 @@ L(\type\()_8tap_h_\isa):
sub \s_strd, \s_strd, \w, uxtw
mov w8, \w
.ifc \isa, neon_i8mm
cmp w9, #SHARP1
b.eq 328f // horizontal == SHARP1
ldp q29, q30, [x13, #(OFFSET_USMMLA)]
ext v0.8b, v26.8b, v26.8b, #7
ins v26.d[1], v0.d[0]
.align LOOP_ALIGN
32:
ldr q16, [\src]
ldr q17, [\src, #12] // avoid 2 register TBL for small cores
ldur q17, [\src, #8] // avoid 2 register TBL for small cores
add \src, \src, #16
.ifc \type, prep
movi v6.4s, #0
movi v7.4s, #0
movi v22.4s, #0
movi v23.4s, #0
.else
mov v6.16b, v27.16b
mov v7.16b, v27.16b
mov v22.16b, v27.16b
mov v23.16b, v27.16b
.endif
tbl v0.16b, {v16.16b}, v29.16b
tbl v1.16b, {v16.16b}, v30.16b
tbl v2.16b, {v17.16b}, v29.16b
tbl v3.16b, {v17.16b}, v30.16b
usmmla v6.4s, v0.16b, v26.16b
usmmla v7.4s, v1.16b, v26.16b
usmmla v22.4s, v2.16b, v26.16b
usmmla v23.4s, v3.16b, v26.16b
uzp1 v6.8h, v6.8h, v7.8h
uzp1 v22.8h, v22.8h, v23.8h
.ifc \type, prep
srshr v6.8h, v6.8h, #2
srshr v22.8h, v22.8h, #2
subs w8, w8, #16
stp q6, q22, [\dst], #32
.else // put
sqshrun v6.8b, v6.8h, #6
sqshrun2 v6.16b, v22.8h, #6
subs w8, w8, #16
str q6, [\dst], #16
.endif
b.gt 32b
add \src, \src, \s_strd
.ifc \type, put
add \dst, \dst, \d_strd
.endif
mov w8, \w
subs \h, \h, #1
b.gt 32b
ret
.align JUMP_ALIGN
328:
.endif // neon_i8mm
ldp q29, q30, [x13, #16]
.align LOOP_ALIGN
32:
ldr q16, [\src]
ldur q17, [\src, #12] // avoid 2 register TBL for small cores
add \src, \src, #16
.ifc \type\()_\isa, prep_neon_i8mm
movi v6.4s, #0
@@ -1575,19 +1839,19 @@ L(\type\()_8tap_h_\isa):
subs \h, \h, #1
b.gt 32b
ret
L(\type\()_8tap_h_\isa\()_tbl):
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 1280b)
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 640b)
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 320b)
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 160b)
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 80b)
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 40b)
.ifc \type, put
.hword (L(\type\()_8tap_h_\isa\()_tbl) - 20b)
.hword 0
.endif
endfunc
jumptable \type\()_8tap_h_\isa\()_tbl
.word 1280b - \type\()_8tap_h_\isa\()_tbl
.word 640b - \type\()_8tap_h_\isa\()_tbl
.word 320b - \type\()_8tap_h_\isa\()_tbl
.word 160b - \type\()_8tap_h_\isa\()_tbl
.word 80b - \type\()_8tap_h_\isa\()_tbl
.word 40b - \type\()_8tap_h_\isa\()_tbl
.ifc \type, put
.word 20b - \type\()_8tap_h_\isa\()_tbl
.endif
endjumptable
.endm
// dst(x0), d_strd(x7), src(x1), s_strd(x2), w(w3), h(w4), mx(w5), my(w6)
+3 -3
View File
@@ -250,7 +250,7 @@ function msac_decode_symbol_adapt4_neon, export=1
ret
1:
lsr w15, w15, #4
b L(refill)
b L(refill)
.elseif \n == 8
ldr w6, [x0, #CNT]
tbl v30.8b, {v30.16b}, v31.8b
@@ -275,7 +275,7 @@ function msac_decode_symbol_adapt4_neon, export=1
1:
lsr w15, w15, #1 // ret
mov x7, v28.d[0]
b L(refill)
b L(refill)
.elseif \n == 16
add x8, sp, w15, sxtw #1
ldrh w3, [x8, #48] // v
@@ -298,7 +298,7 @@ function msac_decode_symbol_adapt4_neon, export=1
ret
1:
add w15, w15, #\n // ret
b L(refill)
b L(refill)
.endif
.endm
+323 -69
View File
@@ -25,22 +25,25 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "src/arm/asm-offsets.h"
#include "src/arm/asm.S"
#include "util.S"
#define INVALID_MV 0x80008000
// void dav1d_splat_mv_neon(refmvs_block **rr, const refmvs_block *rmv,
// int bx4, int bw4, int bh4)
function splat_mv_neon, export=1
ld1 {v3.16b}, [x1]
clz w3, w3
adr x5, L(splat_tbl)
movrel x5, splat_tbl
sub w3, w3, #26
ext v2.16b, v3.16b, v3.16b, #12
ldrh w3, [x5, w3, uxtw #1]
ldrsw x3, [x5, w3, uxtw #2]
add w2, w2, w2, lsl #1
ext v0.16b, v2.16b, v3.16b, #4
sub x3, x5, w3, uxtw
add x3, x5, x3
ext v1.16b, v2.16b, v3.16b, #8
lsl w2, w2, #2
ext v2.16b, v2.16b, v3.16b, #12
@@ -80,16 +83,17 @@ function splat_mv_neon, export=1
st1 {v0.16b, v1.16b, v2.16b}, [x1]
b.gt 1b
ret
L(splat_tbl):
.hword L(splat_tbl) - 320b
.hword L(splat_tbl) - 160b
.hword L(splat_tbl) - 80b
.hword L(splat_tbl) - 40b
.hword L(splat_tbl) - 20b
.hword L(splat_tbl) - 10b
endfunc
jumptable splat_tbl
.word 320b - splat_tbl
.word 160b - splat_tbl
.word 80b - splat_tbl
.word 40b - splat_tbl
.word 20b - splat_tbl
.word 10b - splat_tbl
endjumptable
const mv_tbls, align=4
.byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
.byte 0, 1, 2, 3, 8, 0, 1, 2, 3, 8, 0, 1, 2, 3, 8, 0
@@ -112,7 +116,7 @@ function save_tmvs_neon, export=1
movi v30.8b, #0
ld1 {v31.8b}, [x3]
adr x8, L(save_tmvs_tbl)
movrel x8, save_tmvs_tbl
movrel x16, mask_mult
movrel x13, mv_tbls
ld1 {v29.8b}, [x16]
@@ -129,17 +133,17 @@ function save_tmvs_neon, export=1
and w9, w7, #30 // (y & 15) * 2
ldr x9, [x2, w9, uxtw #3] // b = rr[(y & 15) * 2]
add x9, x9, #12 // &b[... + 1]
madd x10, x4, x14, x9 // end_cand_b = &b[col_end8*2 + 1]
madd x9, x6, x14, x9 // cand_b = &b[x*2 + 1]
madd x10, x4, x14, x9 // end_cand_b = &b[col_end8*2 + 1]
madd x9, x6, x14, x9 // cand_b = &b[x*2 + 1]
madd x3, x6, x15, x0 // &rp[x]
madd x3, x6, x15, x0 // &rp[x]
2:
ldrb w11, [x9, #10] // cand_b->bs
ld1 {v0.16b}, [x9] // cand_b->mv
add x11, x8, w11, uxtw #2
add x11, x8, w11, uxtw #3
ldr h1, [x9, #8] // cand_b->ref
ldrh w12, [x11] // bw8
ldr w12, [x11] // bw8
mov x15, x8
add x9, x9, w12, uxtw #1 // cand_b += bw8*2
cmp x9, x10
@@ -149,9 +153,9 @@ function save_tmvs_neon, export=1
ldrb w15, [x9, #10] // cand_b->bs
add x16, x9, #8
ld1 {v4.16b}, [x9] // cand_b->mv
add x15, x8, w15, uxtw #2
add x15, x8, w15, uxtw #3
ld1 {v1.h}[1], [x16] // cand_b->ref
ldrh w12, [x15] // bw8
ldr w12, [x15] // bw8
add x9, x9, w12, uxtw #1 // cand_b += bw8*2
trn1 v2.2d, v0.2d, v4.2d
@@ -166,12 +170,12 @@ function save_tmvs_neon, export=1
addp v1.4h, v1.4h, v1.4h // Combine condition for [1] and [0]
umov w16, v1.h[0] // Extract case for first block
umov w17, v1.h[1]
ldrh w11, [x11, #2] // Fetch jump table entry
ldrh w15, [x15, #2]
ldrsw x11, [x11, #4] // Fetch jump table entry
ldrsw x15, [x15, #4]
ldr q1, [x13, w16, uxtw #4] // Load permutation table base on case
ldr q5, [x13, w17, uxtw #4]
sub x11, x8, w11, uxtw // Find jump table target
sub x15, x8, w15, uxtw
add x11, x8, x11 // Find jump table target
add x15, x8, x15
tbl v0.16b, {v0.16b}, v1.16b // Permute cand_b to output refmvs_temporal_block
tbl v4.16b, {v4.16b}, v5.16b
@@ -243,50 +247,300 @@ function save_tmvs_neon, export=1
str q2, [x3, #(16*5-16)]
add x3, x3, #16*5
ret
L(save_tmvs_tbl):
.hword 16 * 12
.hword L(save_tmvs_tbl) - 160b
.hword 16 * 12
.hword L(save_tmvs_tbl) - 160b
.hword 8 * 12
.hword L(save_tmvs_tbl) - 80b
.hword 8 * 12
.hword L(save_tmvs_tbl) - 80b
.hword 8 * 12
.hword L(save_tmvs_tbl) - 80b
.hword 8 * 12
.hword L(save_tmvs_tbl) - 80b
.hword 4 * 12
.hword L(save_tmvs_tbl) - 40b
.hword 4 * 12
.hword L(save_tmvs_tbl) - 40b
.hword 4 * 12
.hword L(save_tmvs_tbl) - 40b
.hword 4 * 12
.hword L(save_tmvs_tbl) - 40b
.hword 2 * 12
.hword L(save_tmvs_tbl) - 20b
.hword 2 * 12
.hword L(save_tmvs_tbl) - 20b
.hword 2 * 12
.hword L(save_tmvs_tbl) - 20b
.hword 2 * 12
.hword L(save_tmvs_tbl) - 20b
.hword 2 * 12
.hword L(save_tmvs_tbl) - 20b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
.hword 1 * 12
.hword L(save_tmvs_tbl) - 10b
endfunc
jumptable save_tmvs_tbl
.word 16 * 12
.word 160b - save_tmvs_tbl
.word 16 * 12
.word 160b - save_tmvs_tbl
.word 8 * 12
.word 80b - save_tmvs_tbl
.word 8 * 12
.word 80b - save_tmvs_tbl
.word 8 * 12
.word 80b - save_tmvs_tbl
.word 8 * 12
.word 80b - save_tmvs_tbl
.word 4 * 12
.word 40b - save_tmvs_tbl
.word 4 * 12
.word 40b - save_tmvs_tbl
.word 4 * 12
.word 40b - save_tmvs_tbl
.word 4 * 12
.word 40b - save_tmvs_tbl
.word 2 * 12
.word 20b - save_tmvs_tbl
.word 2 * 12
.word 20b - save_tmvs_tbl
.word 2 * 12
.word 20b - save_tmvs_tbl
.word 2 * 12
.word 20b - save_tmvs_tbl
.word 2 * 12
.word 20b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
.word 1 * 12
.word 10b - save_tmvs_tbl
endjumptable
// void dav1d_load_tmvs_neon(const refmvs_frame *const rf, int tile_row_idx,
// const int col_start8, const int col_end8,
// const int row_start8, int row_end8)
function load_tmvs_neon, export=1
rf .req x0
tile_row_idx .req w1
col_start8 .req w2
col_end8 .req w3
row_start8 .req w4
row_end8 .req w5
col_start8i .req w6
col_end8i .req w7
rp_proj .req x8
stride5 .req x9
wstride5 .req w9
stp x28, x27, [sp, #-96]!
stp x26, x25, [sp, #16]
stp x24, x23, [sp, #32]
stp x22, x21, [sp, #48]
stp x20, x19, [sp, #64]
stp x29, x30, [sp, #80]
ldr w15, [rf, #RMVSF_N_TILE_THREADS]
ldp w16, w17, [rf, #RMVSF_IW8] // include rf->ih8 too
sub col_start8i, col_start8, #8 // col_start8 - 8
add col_end8i, col_end8, #8 // col_end8 + 8
ldr wstride5, [rf, #RMVSF_RP_STRIDE]
ldr rp_proj, [rf, #RMVSF_RP_PROJ]
cmp w15, #1
csel tile_row_idx, wzr, tile_row_idx, eq // if (rf->n_tile_threads == 1) tile_row_idx = 0
bic col_start8i, col_start8i, col_start8i, asr #31 // imax(col_start8 - 8, 0)
cmp col_end8i, w16
csel col_end8i, col_end8i, w16, lt // imin(col_end8 + 8, rf->iw8)
lsl tile_row_idx, tile_row_idx, #4 // 16 * tile_row_idx
cmp row_end8, w17
csel row_end8, row_end8, w17, lt // imin(row_end8, rf->ih8)
add wstride5, wstride5, wstride5, lsl #2 // stride * sizeof(refmvs_temporal_block)
and w15, row_start8, #15 // row_start8 & 15
add w10, col_start8, col_start8, lsl #2 // col_start8 * sizeof(refmvs_temporal_block)
smaddl rp_proj, tile_row_idx, wstride5, rp_proj // &rf->rp_proj[16 * stride * tile_row_idx]
smaddl x10, w15, wstride5, x10 // ((row_start8 & 15) * stride + col_start8) * sizeof(refmvs_temporal_block)
mov w15, #INVALID_MV
sub w11, col_end8, col_start8 // xfill loop count
add x10, x10, rp_proj // &rf->rp_proj[16 * stride * tile_row_idx + (row_start8 & 15) * stride + col_start8]
add x15, x15, x15, lsl #40 // first 64b of 4 [INVALID_MV, 0]... patterns
mov w17, #(INVALID_MV >> 8) // last 32b of 4 patterns
sub w12, row_end8, row_start8 // yfill loop count
ror x16, x15, #48 // second 64b of 4 patterns
ldr w19, [rf, #RMVSF_N_MFMVS]
5: // yfill loop
and w13, w11, #-4 // xfill 4x count by patterns
mov x14, x10 // fill_ptr = row_ptr
add x10, x10, stride5 // row_ptr += stride
sub w12, w12, #1 // y--
cbz w13, 3f
4: // xfill loop 4x
sub w13, w13, #4 // xfill 4x count -= 4
stp x15, x16, [x14]
str w17, [x14, #16]
add x14, x14, #20 // fill_ptr += 4 * sizeof(refmvs_temporal_block)
cbnz w13, 4b
3: // up to 3 residuals
tbz w11, #1, 1f
str x15, [x14]
strh w16, [x14, #8]
add x14, x14, #10 // fill_ptr += 2 * sizeof(refmvs_temporal_block)
1: // up to 1 residual
tbz w11, #0, 2f
str w15, [x14]
2:
cbnz w12, 5b // yfill loop
cbz w19, 11f // if (!rf->n_mfmvs) skip nloop
add x29, rf, #RMVSF_MFMV_REF2CUR
mov w10, #0 // n = 0
movi v3.2s, #255 // 0x3FFF >> 6, for MV clamp
movrel x1, div_mult_tbl
10: // nloop
ldrsb w16, [x29, x10] // ref2cur = rf->mfmv_ref2cur[n]
cmp w16, #-32
b.eq 9f // if (ref2cur == INVALID_REF2CUR) continue
add x17, x10, #(RMVSF_MFMV_REF - RMVSF_MFMV_REF2CUR) // n - (&rf->mfmv_ref - &rf->mfmv_ref2cur)
mov x20, #4
ldrb w17, [x29, x17] // ref = rf->mfmv_ref[n]
ldr x13, [x29, #(RMVSF_RP_REF - RMVSF_MFMV_REF2CUR)]
sub x21, x10, x10, lsl #3 // -(n * 7)
smaddl x20, row_start8, wstride5, x20 // row_start8 * stride * sizeof(refmvs_temporal_block) + 4
mov w12, row_start8 // y = row_start8
add x28, x29, #(RMVSF_MFMV_REF2REF - RMVSF_MFMV_REF2CUR - 1) // &rf->mfmv_ref2ref - 1
ldr x13, [x13, x17, lsl #3] // rf->rp_ref[ref]
sub x28, x28, x21 // rf->mfmv_ref2ref[n] - 1
sub w17, w17, #4 // ref_sign = ref - 4
add x13, x13, x20 // r = &rf->rp_ref[ref][row_start8 * stride].ref
dup v0.2s, w17 // ref_sign
5: // yloop
and w14, w12, #-8 // y_sb_align = y & ~7
mov w11, col_start8i // x = col_start8i
add w15, w14, #8 // y_sb_align + 8
cmp w14, row_start8
csel w14, w14, row_start8, gt // imax(y_sb_align, row_start8)
cmp w15, row_end8
csel w15, w15, row_end8, lt // imin(y_sb_align + 8, row_end8)
4: // xloop
add x23, x13, x11, lsl #2 // partial &r[x] address
ldrb w22, [x23, x11] // b_ref = rb->ref
cbz w22, 6f // if (!b_ref) continue
ldrb w24, [x28, x22] // ref2ref = rf->mfmv_ref2ref[n][b_ref - 1]
cbz w24, 6f // if (!ref2ref) continue
ldrh w20, [x1, x24, lsl #1] // div_mult[ref2ref]
add x23, x23, x11 // &r[x]
mul w20, w20, w16 // frac = ref2cur * div_mult[ref2ref]
ldur s1, [x23, #-4] // mv{y, x} = rb->mv
fmov s2, w20 // frac
sxtl v1.4s, v1.4h
mul v1.2s, v1.2s, v2.s[0] // offset{y, x} = frac * mv{y, x}
ssra v1.2s, v1.2s, #31 // offset{y, x} + (offset{y, x} >> 31)
ldur w25, [x23, #-4] // b_mv = rb->mv
srshr v1.2s, v1.2s, #14 // (offset{y, x} + (offset{y, x} >> 31) + 8192) >> 14
abs v2.2s, v1.2s // abs(offset{y, x})
eor v1.8b, v1.8b, v0.8b // offset{y, x} ^ ref_sign
sshr v2.2s, v2.2s, #6 // abs(offset{y, x}) >> 6
cmlt v1.2s, v1.2s, #0 // sign(offset{y, x} ^ ref_sign): -1 or 0
umin v2.2s, v2.2s, v3.2s // iclip(abs(offset{y, x}) >> 6, 0, 0x3FFF >> 6)
neg v4.2s, v2.2s
bsl v1.8b, v4.8b, v2.8b // apply_sign(iclip(abs(offset{y, x}) >> 6, 0, 0x3FFF >> 6))
fmov x20, d1 // offset{y, x}
add w21, w12, w20 // pos_y = y + offset.y
cmp w21, w14 // pos_y >= y_proj_start
b.lt 1f
cmp w21, w15 // pos_y < y_proj_end
b.ge 1f
add x26, x11, x20, asr #32 // pos_x = x + offset.x
and w27, w21, #15 // pos_y & 15
add x21, x26, x26, lsl #2 // pos_x * sizeof(refmvs_temporal_block)
umaddl x27, w27, wstride5, rp_proj // &rp_proj[(pos_y & 15) * stride]
add x27, x27, x21 // &rp_proj[(pos_y & 15) * stride + pos_x]
3: // copy loop
and w20, w11, #-8 // x_sb_align = x & ~7
sub w21, w20, #8 // x_sb_align - 8
cmp w21, col_start8
csel w21, w21, col_start8, gt // imax(x_sb_align - 8, col_start8)
cmp w26, w21 // pos_x >= imax(x_sb_align - 8, col_start8)
b.lt 2f
add w20, w20, #16 // x_sb_align + 16
cmp w20, col_end8
csel w20, w20, col_end8, lt // imin(x_sb_align + 16, col_end8)
cmp w26, w20 // pos_x < imin(x_sb_align + 16, col_end8)
b.ge 2f
str w25, [x27] // rp_proj[pos + pos_x].mv = rb->mv (b_mv)
strb w24, [x27, #4] // rp_proj[pos + pos_x].ref = ref2ref
2: // search part of copy loop
add w11, w11, #1 // x++
cmp w11, col_end8i // if (++x >= col_end8i) break xloop
b.ge 8f
ldrb w20, [x23, #5]! // rb++; rb->ref
cmp w20, w22 // if (rb->ref != b_ref) break
b.ne 7f
ldur w21, [x23, #-4] // rb->mv.n
cmp w21, w25 // if (rb->mv.n != b_mv.n) break
b.ne 7f
add w26, w26, #1 // pos_x++
add x27, x27, #5 // advance &rp_proj[(pos_y & 15) * stride + pos_x]
b 3b // copy loop
1: // search loop
add w11, w11, #1 // x++
cmp w11, col_end8i // if (++x >= col_end8i) break xloop
b.ge 8f
ldrb w20, [x23, #5]! // rb++; rb->ref
cmp w20, w22 // if (rb->ref != b_ref) break
b.ne 7f
ldur w21, [x23, #-4] // rb->mv.n
cmp w21, w25 // if (rb->mv.n == b_mv.n) continue
b.eq 1b // search loop
7:
cmp w11, col_end8i // x < col_end8i
b.lt 4b // xloop
6: // continue case of xloop
add w11, w11, #1 // x++
cmp w11, col_end8i // x < col_end8i
b.lt 4b // xloop
8:
add w12, w12, #1 // y++
add x13, x13, stride5 // r += stride
cmp w12, row_end8 // y < row_end8
b.lt 5b // yloop
9:
add w10, w10, #1
cmp w10, w19 // n < rf->n_mfmvs
b.lt 10b // nloop
11:
ldp x29, x30, [sp, #80]
ldp x20, x19, [sp, #64]
ldp x22, x21, [sp, #48]
ldp x24, x23, [sp, #32]
ldp x26, x25, [sp, #16]
ldp x28, x27, [sp], #96
ret
.unreq rf
.unreq tile_row_idx
.unreq col_start8
.unreq col_end8
.unreq row_start8
.unreq row_end8
.unreq col_start8i
.unreq col_end8i
.unreq rp_proj
.unreq stride5
.unreq wstride5
endfunc
const div_mult_tbl
.hword 0, 16384, 8192, 5461, 4096, 3276, 2730, 2340
.hword 2048, 1820, 1638, 1489, 1365, 1260, 1170, 1092
.hword 1024, 963, 910, 862, 819, 780, 744, 712
.hword 682, 655, 630, 606, 585, 564, 546, 528
endconst
+1 -1
View File
@@ -72,7 +72,7 @@
.if \space > 8192
// Here, we'd need to touch two (or more) pages while decrementing
// the stack pointer.
.error "sub_sp_align doesn't support values over 8K at the moment"
.error "sub_sp doesn't support values over 8K at the moment"
.elseif \space > 4096
sub x16, sp, #4096
ldr xzr, [x16]
+68
View File
@@ -0,0 +1,68 @@
/*
* Copyright © 2024, VideoLAN and dav1d authors
* 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.
*/
#ifndef ARM_ARM_ARCH_H
#define ARM_ARM_ARCH_H
/* Compatibility header to define __ARM_ARCH with older compilers */
#ifndef __ARM_ARCH
#ifdef _M_ARM
#define __ARM_ARCH _M_ARM
#elif defined(__ARM_ARCH_8A__) || defined(_M_ARM64)
#define __ARM_ARCH 8
#elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \
defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || \
defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
#define __ARM_ARCH 7
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || \
defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
#define __ARM_ARCH 6
#elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \
defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__)
#define __ARM_ARCH 5
#elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
#define __ARM_ARCH 4
#elif defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__)
#define __ARM_ARCH 3
#elif defined(__ARM_ARCH_2__)
#define __ARM_ARCH 2
#else
#error Unknown ARM architecture version
#endif
#endif /* !__ARM_ARCH */
#endif /* ARM_ARM_ARCH_H */
+15
View File
@@ -27,6 +27,8 @@
#ifndef ARM_ASM_OFFSETS_H
#define ARM_ASM_OFFSETS_H
#include "config.h"
#define FGD_SEED 0
#define FGD_AR_COEFF_LAG 92
#define FGD_AR_COEFFS_Y 96
@@ -40,4 +42,17 @@
#define FGD_UV_OFFSET 204
#define FGD_CLIP_TO_RESTRICTED_RANGE 216
#if ARCH_AARCH64
#define RMVSF_IW8 16
#define RMVSF_IH8 20
#define RMVSF_MFMV_REF 53
#define RMVSF_MFMV_REF2CUR 56
#define RMVSF_MFMV_REF2REF 59
#define RMVSF_N_MFMVS 80
#define RMVSF_RP_REF 96
#define RMVSF_RP_PROJ 104
#define RMVSF_RP_STRIDE 112
#define RMVSF_N_TILE_THREADS 128
#endif
#endif /* ARM_ASM_OFFSETS_H */
+36 -4
View File
@@ -147,7 +147,7 @@ DISABLE_SVE2
*
* References:
* - "ELF for the Arm® 64-bit Architecture"
* https: *github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst
* https://github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst
* - "Providing protection for complex software"
* https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software
*/
@@ -193,8 +193,14 @@ DISABLE_SVE2
#endif /* !__ARM_FEATURE_PAC_DEFAULT */
#if defined(__ARM_FEATURE_GCS_DEFAULT) && __ARM_FEATURE_GCS_DEFAULT == 1
#define GNU_PROPERTY_AARCH64_GCS (1 << 2)
#else
#define GNU_PROPERTY_AARCH64_GCS 0 /* No GCS */
#endif
#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0) && defined(__ELF__)
#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0 || GNU_PROPERTY_AARCH64_GCS != 0) && defined(__ELF__)
.pushsection .note.gnu.property, "a"
.balign 8
.long 4
@@ -203,10 +209,10 @@ DISABLE_SVE2
.asciz "GNU"
.long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
.long 4
.long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC)
.long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC | GNU_PROPERTY_AARCH64_GCS)
.long 0
.popsection
#endif /* (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0) && defined(__ELF__) */
#endif /* (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0 || GNU_PROPERTY_AARCH64_GCS != 0) && defined(__ELF__) */
#endif /* ARCH_AARCH64 */
#if ARCH_ARM
@@ -323,6 +329,32 @@ EXTERN\name:
\name:
.endm
.macro jumptable name
#ifdef _WIN32
// MS armasm64 doesn't seem to be able to create relocations for subtraction
// of labels in different sections; for armasm64 (and all of Windows for
// simplicity), write the jump table in the text section, to allow calculating
// differences at assembly time. See
// https://developercommunity.visualstudio.com/t/armasm64-unable-to-create-cross-section/10722340
// for reference. (LLVM can create such relocations, but checking for _WIN32
// for simplicity, as execute-only memory isn't relevant on Windows at the
// moment.)
function \name
#else
// For other platforms, write jump tables in a const data section, to allow
// working in environments where executable memory isn't readable.
const \name
#endif
.endm
.macro endjumptable
#ifdef _WIN32
endfunc
#else
endconst
#endif
.endm
#ifdef __APPLE__
#define L(x) L ## x
#else
+63 -25
View File
@@ -29,9 +29,10 @@
#include "common/attributes.h"
#include "src/cpu.h"
#include "src/arm/cpu.h"
#if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
#include <sys/auxv.h>
#if ARCH_AARCH64
@@ -42,17 +43,10 @@
#define HWCAP2_AARCH64_I8MM (1 << 13)
COLD unsigned dav1d_get_cpu_flags_arm(void) {
#ifdef HAVE_GETAUXVAL
unsigned long hw_cap = getauxval(AT_HWCAP);
unsigned long hw_cap2 = getauxval(AT_HWCAP2);
#else
unsigned long hw_cap = 0;
unsigned long hw_cap2 = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
elf_aux_info(AT_HWCAP2, &hw_cap2, sizeof(hw_cap2));
#endif
unsigned long hw_cap = dav1d_getauxval(AT_HWCAP);
unsigned long hw_cap2 = dav1d_getauxval(AT_HWCAP2);
unsigned flags = DAV1D_ARM_CPU_FLAG_NEON;
unsigned flags = dav1d_get_default_cpu_flags();
flags |= (hw_cap & HWCAP_AARCH64_ASIMDDP) ? DAV1D_ARM_CPU_FLAG_DOTPROD : 0;
flags |= (hw_cap2 & HWCAP2_AARCH64_I8MM) ? DAV1D_ARM_CPU_FLAG_I8MM : 0;
flags |= (hw_cap & HWCAP_AARCH64_SVE) ? DAV1D_ARM_CPU_FLAG_SVE : 0;
@@ -68,14 +62,10 @@ COLD unsigned dav1d_get_cpu_flags_arm(void) {
#define HWCAP_ARM_I8MM (1 << 27)
COLD unsigned dav1d_get_cpu_flags_arm(void) {
#ifdef HAVE_GETAUXVAL
unsigned long hw_cap = getauxval(AT_HWCAP);
#else
unsigned long hw_cap = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
#endif
unsigned long hw_cap = dav1d_getauxval(AT_HWCAP);
unsigned flags = (hw_cap & HWCAP_ARM_NEON) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
unsigned flags = dav1d_get_default_cpu_flags();
flags |= (hw_cap & HWCAP_ARM_NEON) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
flags |= (hw_cap & HWCAP_ARM_ASIMDDP) ? DAV1D_ARM_CPU_FLAG_DOTPROD : 0;
flags |= (hw_cap & HWCAP_ARM_I8MM) ? DAV1D_ARM_CPU_FLAG_I8MM : 0;
return flags;
@@ -95,7 +85,7 @@ static int have_feature(const char *feature) {
}
COLD unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = DAV1D_ARM_CPU_FLAG_NEON;
unsigned flags = dav1d_get_default_cpu_flags();
if (have_feature("hw.optional.arm.FEAT_DotProd"))
flags |= DAV1D_ARM_CPU_FLAG_DOTPROD;
if (have_feature("hw.optional.arm.FEAT_I8MM"))
@@ -104,21 +94,68 @@ COLD unsigned dav1d_get_cpu_flags_arm(void) {
return flags;
}
#elif defined(__OpenBSD__) && ARCH_AARCH64
#include <machine/armreg.h>
#include <machine/cpu.h>
#include <sys/types.h>
#include <sys/sysctl.h>
COLD unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = dav1d_get_default_cpu_flags();
#ifdef CPU_ID_AA64ISAR0
int mib[2];
uint64_t isar0;
uint64_t isar1;
size_t len;
mib[0] = CTL_MACHDEP;
mib[1] = CPU_ID_AA64ISAR0;
len = sizeof(isar0);
if (sysctl(mib, 2, &isar0, &len, NULL, 0) != -1) {
if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL)
flags |= DAV1D_ARM_CPU_FLAG_DOTPROD;
}
mib[0] = CTL_MACHDEP;
mib[1] = CPU_ID_AA64ISAR1;
len = sizeof(isar1);
if (sysctl(mib, 2, &isar1, &len, NULL, 0) != -1) {
#ifdef ID_AA64ISAR1_I8MM_IMPL
if (ID_AA64ISAR1_I8MM(isar1) >= ID_AA64ISAR1_I8MM_IMPL)
flags |= DAV1D_ARM_CPU_FLAG_I8MM;
#endif
}
#endif
return flags;
}
#elif defined(_WIN32)
#include <windows.h>
COLD unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = DAV1D_ARM_CPU_FLAG_NEON;
unsigned flags = dav1d_get_default_cpu_flags();
#ifdef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE))
flags |= DAV1D_ARM_CPU_FLAG_DOTPROD;
#endif
/* No I8MM or SVE feature detection available on Windows at the time of
* writing. */
#ifdef PF_ARM_SVE_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_SVE_INSTRUCTIONS_AVAILABLE))
flags |= DAV1D_ARM_CPU_FLAG_SVE;
#endif
#ifdef PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE))
flags |= DAV1D_ARM_CPU_FLAG_SVE2;
#endif
#ifdef PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE
if (IsProcessorFeaturePresent(PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE))
flags |= DAV1D_ARM_CPU_FLAG_I8MM;
#endif
return flags;
}
#elif defined(__ANDROID__)
#elif defined(__ANDROID__) || defined(__linux__)
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -160,7 +197,8 @@ static unsigned parse_proc_cpuinfo(const char *flag) {
}
COLD unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
unsigned flags = dav1d_get_default_cpu_flags();
flags |= parse_proc_cpuinfo("neon") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
flags |= parse_proc_cpuinfo("asimd") ? DAV1D_ARM_CPU_FLAG_NEON : 0;
flags |= parse_proc_cpuinfo("asimddp") ? DAV1D_ARM_CPU_FLAG_DOTPROD : 0;
flags |= parse_proc_cpuinfo("i8mm") ? DAV1D_ARM_CPU_FLAG_I8MM : 0;
@@ -174,7 +212,7 @@ COLD unsigned dav1d_get_cpu_flags_arm(void) {
#else /* Unsupported OS */
COLD unsigned dav1d_get_cpu_flags_arm(void) {
return 0;
return dav1d_get_default_cpu_flags();
}
#endif
+4 -1
View File
@@ -49,7 +49,9 @@ decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_64x16, neon));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_64x32, neon));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_64x64, neon));
static ALWAYS_INLINE void itx_dsp_init_arm(Dav1dInvTxfmDSPContext *const c, int bpc) {
static ALWAYS_INLINE void itx_dsp_init_arm(Dav1dInvTxfmDSPContext *const c, int bpc,
int *const all_simd)
{
const unsigned flags = dav1d_get_cpu_flags();
if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return;
@@ -77,4 +79,5 @@ static ALWAYS_INLINE void itx_dsp_init_arm(Dav1dInvTxfmDSPContext *const c, int
assign_itx1_fn (R, 64, 16, neon);
assign_itx1_fn (R, 64, 32, neon);
assign_itx1_fn ( , 64, 64, neon);
*all_simd = 1;
}
+276 -258
View File
@@ -58,9 +58,8 @@ void BF(dav1d_wiener_filter5, neon)(pixel *p, const ptrdiff_t stride,
// reference C version, but with the end result subtracted by
// 1 << (bitdepth + 6 - round_bits_h).
void BF(dav1d_wiener_filter_h, neon)(int16_t *dst, const pixel (*left)[4],
const pixel *src, ptrdiff_t stride,
const int16_t fh[8], intptr_t w,
int h, enum LrEdgeFlags edges
const pixel *src, const int16_t fh[8],
const int w, const enum LrEdgeFlags edges
HIGHBD_DECL_SUFFIX);
// This calculates things slightly differently than the reference C version.
// This version calculates roughly this:
@@ -69,196 +68,173 @@ void BF(dav1d_wiener_filter_h, neon)(int16_t *dst, const pixel (*left)[4],
// sum += mid[idx] * fv[i];
// sum = (sum + rounding_off_v) >> round_bits_v;
// This function assumes that the width is a multiple of 8.
void BF(dav1d_wiener_filter_v, neon)(pixel *dst, ptrdiff_t stride,
const int16_t *mid, int w, int h,
const int16_t fv[8], enum LrEdgeFlags edges,
ptrdiff_t mid_stride HIGHBD_DECL_SUFFIX);
void BF(dav1d_wiener_filter_v, neon)(pixel *dst, int16_t **ptrs,
const int16_t fv[8], const int w
HIGHBD_DECL_SUFFIX);
static void wiener_filter_neon(pixel *const dst, const ptrdiff_t stride,
const pixel (*const left)[4], const pixel *lpf,
const int w, const int h,
void BF(dav1d_wiener_filter_hv, neon)(pixel *dst, const pixel (*left)[4],
const pixel *src,
const int16_t filter[2][8],
const int w, const enum LrEdgeFlags edges,
int16_t **ptrs
HIGHBD_DECL_SUFFIX);
static void wiener_filter_neon(pixel *p, const ptrdiff_t stride,
const pixel (*left)[4], const pixel *lpf,
const int w, int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int16_t, hor, 6 * 384,);
int16_t *ptrs[7], *rows[6];
for (int i = 0; i < 6; i++)
rows[i] = &hor[i * 384];
const int16_t (*const filter)[8] = params->filter;
ALIGN_STK_16(int16_t, mid, 68 * 384,);
int mid_stride = (w + 7) & ~7;
const int16_t *fh = params->filter[0];
const int16_t *fv = params->filter[1];
const pixel *lpf_bottom = lpf + 6*PXSTRIDE(stride);
// Horizontal filter
BF(dav1d_wiener_filter_h, neon)(&mid[2 * mid_stride], left, dst, stride,
filter[0], w, h, edges HIGHBD_TAIL_SUFFIX);
if (edges & LR_HAVE_TOP)
BF(dav1d_wiener_filter_h, neon)(mid, NULL, lpf, stride,
filter[0], w, 2, edges
const pixel *src = p;
if (edges & LR_HAVE_TOP) {
ptrs[0] = rows[0];
ptrs[1] = rows[0];
ptrs[2] = rows[1];
ptrs[3] = rows[2];
ptrs[4] = rows[2];
ptrs[5] = rows[2];
BF(dav1d_wiener_filter_h, neon)(rows[0], NULL, lpf, fh, w, edges
HIGHBD_TAIL_SUFFIX);
if (edges & LR_HAVE_BOTTOM)
BF(dav1d_wiener_filter_h, neon)(&mid[(2 + h) * mid_stride], NULL,
lpf + 6 * PXSTRIDE(stride),
stride, filter[0], w, 2, edges
lpf += PXSTRIDE(stride);
BF(dav1d_wiener_filter_h, neon)(rows[1], NULL, lpf, fh, w, edges
HIGHBD_TAIL_SUFFIX);
// Vertical filter
BF(dav1d_wiener_filter_v, neon)(dst, stride, &mid[2*mid_stride],
w, h, filter[1], edges,
mid_stride * sizeof(*mid)
HIGHBD_TAIL_SUFFIX);
BF(dav1d_wiener_filter_h, neon)(rows[2], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v1;
ptrs[4] = ptrs[5] = rows[3];
BF(dav1d_wiener_filter_h, neon)(rows[3], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v2;
ptrs[5] = rows[4];
BF(dav1d_wiener_filter_h, neon)(rows[4], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v3;
} else {
ptrs[0] = rows[0];
ptrs[1] = rows[0];
ptrs[2] = rows[0];
ptrs[3] = rows[0];
ptrs[4] = rows[0];
ptrs[5] = rows[0];
BF(dav1d_wiener_filter_h, neon)(rows[0], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v1;
ptrs[4] = ptrs[5] = rows[1];
BF(dav1d_wiener_filter_h, neon)(rows[1], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v2;
ptrs[5] = rows[2];
BF(dav1d_wiener_filter_h, neon)(rows[2], left, src, fh, w, edges
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
if (--h <= 0)
goto v3;
ptrs[6] = rows[3];
BF(dav1d_wiener_filter_hv, neon)(p, left, src, filter, w, edges, ptrs
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
p += PXSTRIDE(stride);
if (--h <= 0)
goto v3;
ptrs[6] = rows[4];
BF(dav1d_wiener_filter_hv, neon)(p, left, src, filter, w, edges, ptrs
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
p += PXSTRIDE(stride);
if (--h <= 0)
goto v3;
}
ptrs[6] = ptrs[5] + 384;
do {
BF(dav1d_wiener_filter_hv, neon)(p, left, src, filter, w, edges, ptrs
HIGHBD_TAIL_SUFFIX);
left++;
src += PXSTRIDE(stride);
p += PXSTRIDE(stride);
} while (--h > 0);
if (!(edges & LR_HAVE_BOTTOM))
goto v3;
BF(dav1d_wiener_filter_hv, neon)(p, NULL, lpf_bottom, filter, w, edges, ptrs
HIGHBD_TAIL_SUFFIX);
lpf_bottom += PXSTRIDE(stride);
p += PXSTRIDE(stride);
BF(dav1d_wiener_filter_hv, neon)(p, NULL, lpf_bottom, filter, w, edges, ptrs
HIGHBD_TAIL_SUFFIX);
p += PXSTRIDE(stride);
v1:
BF(dav1d_wiener_filter_v, neon)(p, ptrs, fv, w HIGHBD_TAIL_SUFFIX);
return;
v3:
BF(dav1d_wiener_filter_v, neon)(p, ptrs, fv, w HIGHBD_TAIL_SUFFIX);
p += PXSTRIDE(stride);
v2:
BF(dav1d_wiener_filter_v, neon)(p, ptrs, fv, w HIGHBD_TAIL_SUFFIX);
p += PXSTRIDE(stride);
goto v1;
}
#endif
#if ARCH_ARM
void BF(dav1d_sgr_box3_h, neon)(int32_t *sumsq, int16_t *sum,
const pixel (*left)[4],
const pixel *src, const ptrdiff_t stride,
const int w, const int h,
const enum LrEdgeFlags edges);
void dav1d_sgr_box3_v_neon(int32_t *sumsq, int16_t *sum,
const int w, const int h,
const enum LrEdgeFlags edges);
void dav1d_sgr_calc_ab1_neon(int32_t *a, int16_t *b,
const int w, const int h, const int strength,
const int bitdepth_max);
void BF(dav1d_sgr_finish_filter1, neon)(int16_t *tmp,
const pixel *src, const ptrdiff_t stride,
const int32_t *a, const int16_t *b,
const int w, const int h);
/* filter with a 3x3 box (radius=1) */
static void dav1d_sgr_filter1_neon(int16_t *tmp,
const pixel *src, const ptrdiff_t stride,
const pixel (*left)[4], const pixel *lpf,
const int w, const int h, const int strength,
const enum LrEdgeFlags edges
HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int32_t, sumsq_mem, (384 + 16) * 68 + 8,);
int32_t *const sumsq = &sumsq_mem[(384 + 16) * 2 + 8], *const a = sumsq;
ALIGN_STK_16(int16_t, sum_mem, (384 + 16) * 68 + 16,);
int16_t *const sum = &sum_mem[(384 + 16) * 2 + 16], *const b = sum;
BF(dav1d_sgr_box3_h, neon)(sumsq, sum, left, src, stride, w, h, edges);
if (edges & LR_HAVE_TOP)
BF(dav1d_sgr_box3_h, neon)(&sumsq[-2 * (384 + 16)], &sum[-2 * (384 + 16)],
NULL, lpf, stride, w, 2, edges);
if (edges & LR_HAVE_BOTTOM)
BF(dav1d_sgr_box3_h, neon)(&sumsq[h * (384 + 16)], &sum[h * (384 + 16)],
NULL, lpf + 6 * PXSTRIDE(stride),
stride, w, 2, edges);
dav1d_sgr_box3_v_neon(sumsq, sum, w, h, edges);
dav1d_sgr_calc_ab1_neon(a, b, w, h, strength, BITDEPTH_MAX);
BF(dav1d_sgr_finish_filter1, neon)(tmp, src, stride, a, b, w, h);
}
void BF(dav1d_sgr_box5_h, neon)(int32_t *sumsq, int16_t *sum,
const pixel (*left)[4],
const pixel *src, const ptrdiff_t stride,
const int w, const int h,
const enum LrEdgeFlags edges);
void dav1d_sgr_box5_v_neon(int32_t *sumsq, int16_t *sum,
const int w, const int h,
const enum LrEdgeFlags edges);
void dav1d_sgr_calc_ab2_neon(int32_t *a, int16_t *b,
const int w, const int h, const int strength,
const int bitdepth_max);
void BF(dav1d_sgr_finish_filter2, neon)(int16_t *tmp,
const pixel *src, const ptrdiff_t stride,
const int32_t *a, const int16_t *b,
const int w, const int h);
/* filter with a 5x5 box (radius=2) */
static void dav1d_sgr_filter2_neon(int16_t *tmp,
const pixel *src, const ptrdiff_t stride,
const pixel (*left)[4], const pixel *lpf,
const int w, const int h, const int strength,
const enum LrEdgeFlags edges
HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int32_t, sumsq_mem, (384 + 16) * 68 + 8,);
int32_t *const sumsq = &sumsq_mem[(384 + 16) * 2 + 8], *const a = sumsq;
ALIGN_STK_16(int16_t, sum_mem, (384 + 16) * 68 + 16,);
int16_t *const sum = &sum_mem[(384 + 16) * 2 + 16], *const b = sum;
BF(dav1d_sgr_box5_h, neon)(sumsq, sum, left, src, stride, w, h, edges);
if (edges & LR_HAVE_TOP)
BF(dav1d_sgr_box5_h, neon)(&sumsq[-2 * (384 + 16)], &sum[-2 * (384 + 16)],
NULL, lpf, stride, w, 2, edges);
if (edges & LR_HAVE_BOTTOM)
BF(dav1d_sgr_box5_h, neon)(&sumsq[h * (384 + 16)], &sum[h * (384 + 16)],
NULL, lpf + 6 * PXSTRIDE(stride),
stride, w, 2, edges);
dav1d_sgr_box5_v_neon(sumsq, sum, w, h, edges);
dav1d_sgr_calc_ab2_neon(a, b, w, h, strength, BITDEPTH_MAX);
BF(dav1d_sgr_finish_filter2, neon)(tmp, src, stride, a, b, w, h);
}
void BF(dav1d_sgr_weighted1, neon)(pixel *dst, const ptrdiff_t dst_stride,
const pixel *src, const ptrdiff_t src_stride,
const int16_t *t1, const int w, const int h,
const int wt HIGHBD_DECL_SUFFIX);
void BF(dav1d_sgr_weighted2, neon)(pixel *dst, const ptrdiff_t dst_stride,
const pixel *src, const ptrdiff_t src_stride,
const int16_t *t1, const int16_t *t2,
const int w, const int h,
const int16_t wt[2] HIGHBD_DECL_SUFFIX);
static void sgr_filter_5x5_neon(pixel *const dst, const ptrdiff_t stride,
const pixel (*const left)[4], const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int16_t, tmp, 64 * 384,);
dav1d_sgr_filter2_neon(tmp, dst, stride, left, lpf,
w, h, params->sgr.s0, edges HIGHBD_TAIL_SUFFIX);
BF(dav1d_sgr_weighted1, neon)(dst, stride, dst, stride,
tmp, w, h, params->sgr.w0 HIGHBD_TAIL_SUFFIX);
}
static void sgr_filter_3x3_neon(pixel *const dst, const ptrdiff_t stride,
const pixel (*const left)[4], const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int16_t, tmp, 64 * 384,);
dav1d_sgr_filter1_neon(tmp, dst, stride, left, lpf,
w, h, params->sgr.s1, edges HIGHBD_TAIL_SUFFIX);
BF(dav1d_sgr_weighted1, neon)(dst, stride, dst, stride,
tmp, w, h, params->sgr.w1 HIGHBD_TAIL_SUFFIX);
}
static void sgr_filter_mix_neon(pixel *const dst, const ptrdiff_t stride,
const pixel (*const left)[4], const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int16_t, tmp1, 64 * 384,);
ALIGN_STK_16(int16_t, tmp2, 64 * 384,);
dav1d_sgr_filter2_neon(tmp1, dst, stride, left, lpf,
w, h, params->sgr.s0, edges HIGHBD_TAIL_SUFFIX);
dav1d_sgr_filter1_neon(tmp2, dst, stride, left, lpf,
w, h, params->sgr.s1, edges HIGHBD_TAIL_SUFFIX);
const int16_t wt[2] = { params->sgr.w0, params->sgr.w1 };
BF(dav1d_sgr_weighted2, neon)(dst, stride, dst, stride,
tmp1, tmp2, w, h, wt HIGHBD_TAIL_SUFFIX);
}
#else
static void rotate(int32_t **sumsq_ptrs, int16_t **sum_ptrs, int n) {
static void rotate_neon(int32_t **sumsq_ptrs, int16_t **sum_ptrs, int n) {
int32_t *tmp32 = sumsq_ptrs[0];
int16_t *tmp16 = sum_ptrs[0];
for (int i = 0; i < n - 1; i++) {
sumsq_ptrs[i] = sumsq_ptrs[i+1];
sum_ptrs[i] = sum_ptrs[i+1];
sumsq_ptrs[i] = sumsq_ptrs[i + 1];
sum_ptrs[i] = sum_ptrs[i + 1];
}
sumsq_ptrs[n - 1] = tmp32;
sum_ptrs[n - 1] = tmp16;
}
static void rotate5_x2(int32_t **sumsq_ptrs, int16_t **sum_ptrs) {
static void rotate5_x2_neon(int32_t **sumsq_ptrs, int16_t **sum_ptrs) {
int32_t *tmp32[2];
int16_t *tmp16[2];
for (int i = 0; i < 2; i++) {
@@ -266,8 +242,8 @@ static void rotate5_x2(int32_t **sumsq_ptrs, int16_t **sum_ptrs) {
tmp16[i] = sum_ptrs[i];
}
for (int i = 0; i < 3; i++) {
sumsq_ptrs[i] = sumsq_ptrs[i+2];
sum_ptrs[i] = sum_ptrs[i+2];
sumsq_ptrs[i] = sumsq_ptrs[i + 2];
sum_ptrs[i] = sum_ptrs[i + 2];
}
for (int i = 0; i < 2; i++) {
sumsq_ptrs[3 + i] = tmp32[i];
@@ -275,18 +251,6 @@ static void rotate5_x2(int32_t **sumsq_ptrs, int16_t **sum_ptrs) {
}
}
static void rotate_ab_3(int32_t **A_ptrs, int16_t **B_ptrs) {
rotate(A_ptrs, B_ptrs, 3);
}
static void rotate_ab_2(int32_t **A_ptrs, int16_t **B_ptrs) {
rotate(A_ptrs, B_ptrs, 2);
}
static void rotate_ab_4(int32_t **A_ptrs, int16_t **B_ptrs) {
rotate(A_ptrs, B_ptrs, 4);
}
void BF(dav1d_sgr_box3_row_h, neon)(int32_t *sumsq, int16_t *sum,
const pixel (*left)[4],
const pixel *src, const int w,
@@ -301,6 +265,24 @@ void BF(dav1d_sgr_box35_row_h, neon)(int32_t *sumsq3, int16_t *sum3,
const pixel *src, const int w,
const enum LrEdgeFlags edges);
#if ARCH_ARM
void dav1d_sgr_box3_row_v_neon(int32_t **sumsq, int16_t **sum,
int32_t *sumsq_out, int16_t *sum_out,
const int w);
void dav1d_sgr_box5_row_v_neon(int32_t **sumsq, int16_t **sum,
int32_t *sumsq_out, int16_t *sum_out,
const int w);
void dav1d_sgr_calc_row_ab1_neon(int32_t *AA, int16_t *BB, int w, int s,
int bitdepth_max);
void dav1d_sgr_calc_row_ab2_neon(int32_t *AA, int16_t *BB, int w, int s,
int bitdepth_max);
void BF(dav1d_sgr_finish_filter_row1, neon)(int16_t *tmp, const pixel *src,
int32_t **A_ptrs, int16_t **B_ptrs,
const int w);
void BF(dav1d_sgr_weighted_row1, neon)(pixel *dst, const int16_t *t1,
const int w, const int wt
HIGHBD_DECL_SUFFIX);
#else
void dav1d_sgr_box3_vert_neon(int32_t **sumsq, int16_t **sum,
int32_t *AA, int16_t *BB,
const int w, const int s,
@@ -324,30 +306,40 @@ void BF(dav1d_sgr_finish_filter1_2rows, neon)(int16_t *tmp, const pixel *src,
int32_t **A_ptrs,
int16_t **B_ptrs,
const int w, const int h);
#endif
void BF(dav1d_sgr_finish_filter2_2rows, neon)(int16_t *tmp, const pixel *src,
const ptrdiff_t src_stride,
int32_t **A_ptrs, int16_t **B_ptrs,
const int w, const int h);
void BF(dav1d_sgr_weighted2, neon)(pixel *dst, const ptrdiff_t dst_stride,
const pixel *src, const ptrdiff_t src_stride,
const int16_t *t1, const int16_t *t2,
const int w, const int h,
const int16_t wt[2] HIGHBD_DECL_SUFFIX);
static void sgr_box3_vert_neon(int32_t **sumsq, int16_t **sum,
int32_t *sumsq_out, int16_t *sum_out,
const int w, int s, int bitdepth_max) {
const int w, const int s, const int bitdepth_max) {
#if ARCH_ARM
dav1d_sgr_box3_row_v_neon(sumsq, sum, sumsq_out, sum_out, w);
dav1d_sgr_calc_row_ab1_neon(sumsq_out, sum_out, w, s, bitdepth_max);
#else
// box3_v + calc_ab1
dav1d_sgr_box3_vert_neon(sumsq, sum, sumsq_out, sum_out, w, s, bitdepth_max);
rotate(sumsq, sum, 3);
#endif
rotate_neon(sumsq, sum, 3);
}
static void sgr_box5_vert_neon(int32_t **sumsq, int16_t **sum,
int32_t *sumsq_out, int16_t *sum_out,
const int w, int s, int bitdepth_max) {
const int w, const int s, const int bitdepth_max) {
#if ARCH_ARM
dav1d_sgr_box5_row_v_neon(sumsq, sum, sumsq_out, sum_out, w);
dav1d_sgr_calc_row_ab2_neon(sumsq_out, sum_out, w, s, bitdepth_max);
#else
// box5_v + calc_ab2
dav1d_sgr_box5_vert_neon(sumsq, sum, sumsq_out, sum_out, w, s, bitdepth_max);
rotate5_x2(sumsq, sum);
#endif
rotate5_x2_neon(sumsq, sum);
}
static void sgr_box3_hv_neon(int32_t **sumsq, int16_t **sum,
@@ -365,20 +357,41 @@ static void sgr_box3_hv_neon(int32_t **sumsq, int16_t **sum,
static void sgr_finish1_neon(pixel **dst, const ptrdiff_t stride,
int32_t **A_ptrs, int16_t **B_ptrs, const int w,
const int w1 HIGHBD_DECL_SUFFIX) {
#if ARCH_ARM
ALIGN_STK_16(int16_t, tmp, 384,);
BF(dav1d_sgr_finish_filter_row1, neon)(tmp, *dst, A_ptrs, B_ptrs, w);
BF(dav1d_sgr_weighted_row1, neon)(*dst, tmp, w, w1 HIGHBD_TAIL_SUFFIX);
#else
BF(dav1d_sgr_finish_weighted1, neon)(*dst, A_ptrs, B_ptrs,
w, w1 HIGHBD_TAIL_SUFFIX);
#endif
*dst += PXSTRIDE(stride);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
}
#define ARM_FILTER_OUT_STRIDE 384
static void sgr_finish2_neon(pixel **dst, const ptrdiff_t stride,
int32_t **A_ptrs, int16_t **B_ptrs,
const int w, const int h, const int w1
HIGHBD_DECL_SUFFIX) {
#if ARCH_ARM
ALIGN_STK_16(int16_t, tmp, 2*ARM_FILTER_OUT_STRIDE,);
BF(dav1d_sgr_finish_filter2_2rows, neon)(tmp, *dst, stride, A_ptrs, B_ptrs, w, h);
BF(dav1d_sgr_weighted_row1, neon)(*dst, tmp, w, w1 HIGHBD_TAIL_SUFFIX);
*dst += PXSTRIDE(stride);
if (h > 1) {
BF(dav1d_sgr_weighted_row1, neon)(*dst, tmp + FILTER_OUT_STRIDE, w, w1 HIGHBD_TAIL_SUFFIX);
*dst += PXSTRIDE(stride);
}
#else
BF(dav1d_sgr_finish_weighted2, neon)(*dst, stride, A_ptrs, B_ptrs,
w, h, w1 HIGHBD_TAIL_SUFFIX);
*dst += 2*PXSTRIDE(stride);
rotate_ab_2(A_ptrs, B_ptrs);
#endif
rotate_neon(A_ptrs, B_ptrs, 2);
}
static void sgr_finish_mix_neon(pixel **dst, const ptrdiff_t stride,
@@ -386,20 +399,26 @@ static void sgr_finish_mix_neon(pixel **dst, const ptrdiff_t stride,
int32_t **A3_ptrs, int16_t **B3_ptrs,
const int w, const int h,
const int w0, const int w1 HIGHBD_DECL_SUFFIX) {
#define FILTER_OUT_STRIDE 384
ALIGN_STK_16(int16_t, tmp5, 2*FILTER_OUT_STRIDE,);
ALIGN_STK_16(int16_t, tmp3, 2*FILTER_OUT_STRIDE,);
ALIGN_STK_16(int16_t, tmp5, 2*ARM_FILTER_OUT_STRIDE,);
ALIGN_STK_16(int16_t, tmp3, 2*ARM_FILTER_OUT_STRIDE,);
BF(dav1d_sgr_finish_filter2_2rows, neon)(tmp5, *dst, stride,
A5_ptrs, B5_ptrs, w, h);
#if ARCH_ARM
BF(dav1d_sgr_finish_filter_row1, neon)(tmp3, *dst, A3_ptrs, B3_ptrs, w);
BF(dav1d_sgr_finish_filter_row1, neon)(tmp3 + FILTER_OUT_STRIDE,
*dst + PXSTRIDE(stride),
&A3_ptrs[1], &B3_ptrs[1], w);
#else
BF(dav1d_sgr_finish_filter1_2rows, neon)(tmp3, *dst, stride,
A3_ptrs, B3_ptrs, w, h);
#endif
const int16_t wt[2] = { w0, w1 };
BF(dav1d_sgr_weighted2, neon)(*dst, stride, *dst, stride,
BF(dav1d_sgr_weighted2, neon)(*dst, stride,
tmp5, tmp3, w, h, wt HIGHBD_TAIL_SUFFIX);
*dst += h*PXSTRIDE(stride);
rotate_ab_2(A5_ptrs, B5_ptrs);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A5_ptrs, B5_ptrs, 2);
rotate_neon(A3_ptrs, B3_ptrs, 4);
}
@@ -409,23 +428,23 @@ static void sgr_filter_3x3_neon(pixel *dst, const ptrdiff_t stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
#define BUF_STRIDE (384 + 16)
ALIGN_STK_16(int32_t, sumsq_buf, BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, sum_buf, BUF_STRIDE * 3 + 16,);
#define ARM_BUF_STRIDE (384 + 16)
ALIGN_STK_16(int32_t, sumsq_buf, ARM_BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, sum_buf, ARM_BUF_STRIDE * 3 + 16,);
int32_t *sumsq_ptrs[3], *sumsq_rows[3];
int16_t *sum_ptrs[3], *sum_rows[3];
for (int i = 0; i < 3; i++) {
sumsq_rows[i] = &sumsq_buf[i * BUF_STRIDE];
sum_rows[i] = &sum_buf[i * BUF_STRIDE];
sumsq_rows[i] = &sumsq_buf[i * ARM_BUF_STRIDE];
sum_rows[i] = &sum_buf[i * ARM_BUF_STRIDE];
}
ALIGN_STK_16(int32_t, A_buf, BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, B_buf, BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int32_t, A_buf, ARM_BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, B_buf, ARM_BUF_STRIDE * 3 + 16,);
int32_t *A_ptrs[3];
int16_t *B_ptrs[3];
for (int i = 0; i < 3; i++) {
A_ptrs[i] = &A_buf[i * BUF_STRIDE];
B_ptrs[i] = &B_buf[i * BUF_STRIDE];
A_ptrs[i] = &A_buf[i * ARM_BUF_STRIDE];
B_ptrs[i] = &B_buf[i * ARM_BUF_STRIDE];
}
const pixel *src = dst;
const pixel *lpf_bottom = lpf + 6*PXSTRIDE(stride);
@@ -448,15 +467,16 @@ static void sgr_filter_3x3_neon(pixel *dst, const ptrdiff_t stride,
left, src, w, params->sgr.s1, edges, BITDEPTH_MAX);
left++;
src += PXSTRIDE(stride);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
if (--h <= 0)
goto vert_1;
sgr_box3_hv_neon(sumsq_ptrs, sum_ptrs, A_ptrs[2], B_ptrs[2], left, src, w, params->sgr.s1, edges, BITDEPTH_MAX);
sgr_box3_hv_neon(sumsq_ptrs, sum_ptrs, A_ptrs[2], B_ptrs[2],
left, src, w, params->sgr.s1, edges, BITDEPTH_MAX);
left++;
src += PXSTRIDE(stride);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
if (--h <= 0)
goto vert_2;
@@ -475,7 +495,7 @@ static void sgr_filter_3x3_neon(pixel *dst, const ptrdiff_t stride,
sgr_box3_vert_neon(sumsq_ptrs, sum_ptrs, A_ptrs[2], B_ptrs[2],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
if (--h <= 0)
goto vert_1;
@@ -487,7 +507,7 @@ static void sgr_filter_3x3_neon(pixel *dst, const ptrdiff_t stride,
left, src, w, params->sgr.s1, edges, BITDEPTH_MAX);
left++;
src += PXSTRIDE(stride);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
if (--h <= 0)
goto vert_2;
@@ -547,7 +567,7 @@ vert_1:
sum_ptrs[2] = sum_ptrs[1];
sgr_box3_vert_neon(sumsq_ptrs, sum_ptrs, A_ptrs[2], B_ptrs[2],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_3(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 3);
goto output_1;
}
@@ -557,22 +577,22 @@ static void sgr_filter_5x5_neon(pixel *dst, const ptrdiff_t stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int32_t, sumsq_buf, BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int16_t, sum_buf, BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int32_t, sumsq_buf, ARM_BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int16_t, sum_buf, ARM_BUF_STRIDE * 5 + 16,);
int32_t *sumsq_ptrs[5], *sumsq_rows[5];
int16_t *sum_ptrs[5], *sum_rows[5];
for (int i = 0; i < 5; i++) {
sumsq_rows[i] = &sumsq_buf[i * BUF_STRIDE];
sum_rows[i] = &sum_buf[i * BUF_STRIDE];
sumsq_rows[i] = &sumsq_buf[i * ARM_BUF_STRIDE];
sum_rows[i] = &sum_buf[i * ARM_BUF_STRIDE];
}
ALIGN_STK_16(int32_t, A_buf, BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int16_t, B_buf, BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int32_t, A_buf, ARM_BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int16_t, B_buf, ARM_BUF_STRIDE * 2 + 16,);
int32_t *A_ptrs[2];
int16_t *B_ptrs[2];
for (int i = 0; i < 2; i++) {
A_ptrs[i] = &A_buf[i * BUF_STRIDE];
B_ptrs[i] = &B_buf[i * BUF_STRIDE];
A_ptrs[i] = &A_buf[i * ARM_BUF_STRIDE];
B_ptrs[i] = &B_buf[i * ARM_BUF_STRIDE];
}
const pixel *src = dst;
const pixel *lpf_bottom = lpf + 6*PXSTRIDE(stride);
@@ -609,7 +629,7 @@ static void sgr_filter_5x5_neon(pixel *dst, const ptrdiff_t stride,
src += PXSTRIDE(stride);
sgr_box5_vert_neon(sumsq_ptrs, sum_ptrs, A_ptrs[1], B_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 2);
if (--h <= 0)
goto vert_2;
@@ -648,7 +668,7 @@ static void sgr_filter_5x5_neon(pixel *dst, const ptrdiff_t stride,
sgr_box5_vert_neon(sumsq_ptrs, sum_ptrs, A_ptrs[1], B_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 2);
if (--h <= 0)
goto vert_2;
@@ -760,7 +780,7 @@ vert_1:
sgr_box5_vert_neon(sumsq_ptrs, sum_ptrs, A_ptrs[1], B_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A_ptrs, B_ptrs);
rotate_neon(A_ptrs, B_ptrs, 2);
goto output_1;
}
@@ -771,38 +791,38 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(int32_t, sumsq5_buf, BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int16_t, sum5_buf, BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int32_t, sumsq5_buf, ARM_BUF_STRIDE * 5 + 16,);
ALIGN_STK_16(int16_t, sum5_buf, ARM_BUF_STRIDE * 5 + 16,);
int32_t *sumsq5_ptrs[5], *sumsq5_rows[5];
int16_t *sum5_ptrs[5], *sum5_rows[5];
for (int i = 0; i < 5; i++) {
sumsq5_rows[i] = &sumsq5_buf[i * BUF_STRIDE];
sum5_rows[i] = &sum5_buf[i * BUF_STRIDE];
sumsq5_rows[i] = &sumsq5_buf[i * ARM_BUF_STRIDE];
sum5_rows[i] = &sum5_buf[i * ARM_BUF_STRIDE];
}
ALIGN_STK_16(int32_t, sumsq3_buf, BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, sum3_buf, BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int32_t, sumsq3_buf, ARM_BUF_STRIDE * 3 + 16,);
ALIGN_STK_16(int16_t, sum3_buf, ARM_BUF_STRIDE * 3 + 16,);
int32_t *sumsq3_ptrs[3], *sumsq3_rows[3];
int16_t *sum3_ptrs[3], *sum3_rows[3];
for (int i = 0; i < 3; i++) {
sumsq3_rows[i] = &sumsq3_buf[i * BUF_STRIDE];
sum3_rows[i] = &sum3_buf[i * BUF_STRIDE];
sumsq3_rows[i] = &sumsq3_buf[i * ARM_BUF_STRIDE];
sum3_rows[i] = &sum3_buf[i * ARM_BUF_STRIDE];
}
ALIGN_STK_16(int32_t, A5_buf, BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int16_t, B5_buf, BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int32_t, A5_buf, ARM_BUF_STRIDE * 2 + 16,);
ALIGN_STK_16(int16_t, B5_buf, ARM_BUF_STRIDE * 2 + 16,);
int32_t *A5_ptrs[2];
int16_t *B5_ptrs[2];
for (int i = 0; i < 2; i++) {
A5_ptrs[i] = &A5_buf[i * BUF_STRIDE];
B5_ptrs[i] = &B5_buf[i * BUF_STRIDE];
A5_ptrs[i] = &A5_buf[i * ARM_BUF_STRIDE];
B5_ptrs[i] = &B5_buf[i * ARM_BUF_STRIDE];
}
ALIGN_STK_16(int32_t, A3_buf, BUF_STRIDE * 4 + 16,);
ALIGN_STK_16(int16_t, B3_buf, BUF_STRIDE * 4 + 16,);
ALIGN_STK_16(int32_t, A3_buf, ARM_BUF_STRIDE * 4 + 16,);
ALIGN_STK_16(int16_t, B3_buf, ARM_BUF_STRIDE * 4 + 16,);
int32_t *A3_ptrs[4];
int16_t *B3_ptrs[4];
for (int i = 0; i < 4; i++) {
A3_ptrs[i] = &A3_buf[i * BUF_STRIDE];
B3_ptrs[i] = &B3_buf[i * BUF_STRIDE];
A3_ptrs[i] = &A3_buf[i * ARM_BUF_STRIDE];
B3_ptrs[i] = &B3_buf[i * ARM_BUF_STRIDE];
}
const pixel *src = dst;
const pixel *lpf_bottom = lpf + 6*PXSTRIDE(stride);
@@ -842,7 +862,7 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto vert_1;
@@ -854,10 +874,10 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
src += PXSTRIDE(stride);
sgr_box5_vert_neon(sumsq5_ptrs, sum5_ptrs, A5_ptrs[1], B5_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A5_ptrs, B5_ptrs);
rotate_neon(A5_ptrs, B5_ptrs, 2);
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto vert_2;
@@ -893,7 +913,7 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto vert_1;
@@ -912,10 +932,10 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
sgr_box5_vert_neon(sumsq5_ptrs, sum5_ptrs, A5_ptrs[1], B5_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A5_ptrs, B5_ptrs);
rotate_neon(A5_ptrs, B5_ptrs, 2);
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto vert_2;
@@ -936,7 +956,7 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto odd;
@@ -973,7 +993,7 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
if (--h <= 0)
goto odd;
@@ -1002,7 +1022,7 @@ static void sgr_filter_mix_neon(pixel *dst, const ptrdiff_t stride,
lpf_bottom += PXSTRIDE(stride);
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
BF(dav1d_sgr_box35_row_h, neon)(sumsq3_ptrs[2], sum3_ptrs[2],
sumsq5_ptrs[4], sum5_ptrs[4],
@@ -1029,7 +1049,7 @@ vert_2:
sum3_ptrs[2] = sum3_ptrs[1];
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
sumsq3_ptrs[2] = sumsq3_ptrs[1];
sum3_ptrs[2] = sum3_ptrs[1];
@@ -1066,7 +1086,7 @@ output_1:
w, params->sgr.s0, BITDEPTH_MAX);
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
// Output only one row
sgr_finish_mix_neon(&dst, stride, A5_ptrs, B5_ptrs, A3_ptrs, B3_ptrs,
w, 1, params->sgr.w0, params->sgr.w1
@@ -1083,16 +1103,14 @@ vert_1:
sgr_box5_vert_neon(sumsq5_ptrs, sum5_ptrs, A5_ptrs[1], B5_ptrs[1],
w, params->sgr.s0, BITDEPTH_MAX);
rotate_ab_2(A5_ptrs, B5_ptrs);
rotate_neon(A5_ptrs, B5_ptrs, 2);
sgr_box3_vert_neon(sumsq3_ptrs, sum3_ptrs, A3_ptrs[3], B3_ptrs[3],
w, params->sgr.s1, BITDEPTH_MAX);
rotate_ab_4(A3_ptrs, B3_ptrs);
rotate_neon(A3_ptrs, B3_ptrs, 4);
goto output_1;
}
#endif
static ALWAYS_INLINE void loop_restoration_dsp_init_arm(Dav1dLoopRestorationDSPContext *const c, int bpc) {
const unsigned flags = dav1d_get_cpu_flags();
+19 -38
View File
@@ -30,39 +30,10 @@
#include "src/mc.h"
#include "src/cpu.h"
#define decl_8tap_gen(decl_name, fn_name, opt) \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_regular, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_regular_smooth, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_regular_sharp, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_smooth_regular, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_smooth, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_smooth_sharp, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_sharp_regular, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_sharp_smooth, opt)); \
decl_##decl_name##_fn(BF(dav1d_##fn_name##_8tap_sharp, opt))
#define decl_8tap_fns(opt) \
decl_8tap_gen(mc, put, opt); \
decl_8tap_gen(mct, prep, opt)
#define init_8tap_gen(name, opt) \
init_##name##_fn(FILTER_2D_8TAP_REGULAR, 8tap_regular, opt); \
init_##name##_fn(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth, opt); \
init_##name##_fn(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp, opt); \
init_##name##_fn(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular, opt); \
init_##name##_fn(FILTER_2D_8TAP_SMOOTH, 8tap_smooth, opt); \
init_##name##_fn(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp, opt); \
init_##name##_fn(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular, opt); \
init_##name##_fn(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth, opt); \
init_##name##_fn(FILTER_2D_8TAP_SHARP, 8tap_sharp, opt)
#define init_8tap_fns(opt) \
init_8tap_gen(mc, opt); \
init_8tap_gen(mct, opt)
decl_8tap_fns(neon);
decl_8tap_fns(neon_dotprod);
decl_8tap_fns(neon_i8mm);
decl_8tap_fns(sve2);
decl_mc_fn(BF(dav1d_put_bilin, neon));
decl_mct_fn(BF(dav1d_prep_bilin, neon));
@@ -110,17 +81,27 @@ static ALWAYS_INLINE void mc_dsp_init_arm(Dav1dMCDSPContext *const c) {
c->warp8x8t = BF(dav1d_warp_affine_8x8t, neon);
c->emu_edge = BF(dav1d_emu_edge, neon);
#if ARCH_AARCH64 && BITDEPTH == 8
#if ARCH_AARCH64
#if BITDEPTH == 8
#if HAVE_DOTPROD
if (!(flags & DAV1D_ARM_CPU_FLAG_DOTPROD)) return;
init_8tap_fns(neon_dotprod);
if (flags & DAV1D_ARM_CPU_FLAG_DOTPROD) {
init_8tap_fns(neon_dotprod);
}
#endif // HAVE_DOTPROD
#if HAVE_I8MM
if (!(flags & DAV1D_ARM_CPU_FLAG_I8MM)) return;
init_8tap_fns(neon_i8mm);
if (flags & DAV1D_ARM_CPU_FLAG_I8MM) {
init_8tap_fns(neon_i8mm);
}
#endif // HAVE_I8MM
#endif // ARCH_AARCH64 && BITDEPTH == 8
#endif // BITDEPTH == 8
#if BITDEPTH == 16
#if HAVE_SVE2
if (flags & DAV1D_ARM_CPU_FLAG_SVE2) {
init_8tap_fns(sve2);
}
#endif // HAVE_SVE2
#endif // BITDEPTH == 16
#endif // ARCH_AARCH64
}
+18
View File
@@ -25,9 +25,24 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "src/arm/asm-offsets.h"
#include "src/cpu.h"
#include "src/refmvs.h"
#if ARCH_AARCH64
CHECK_OFFSET(refmvs_frame, iw8, RMVSF_IW8);
CHECK_OFFSET(refmvs_frame, ih8, RMVSF_IH8);
CHECK_OFFSET(refmvs_frame, mfmv_ref, RMVSF_MFMV_REF);
CHECK_OFFSET(refmvs_frame, mfmv_ref2cur, RMVSF_MFMV_REF2CUR);
CHECK_OFFSET(refmvs_frame, mfmv_ref2ref, RMVSF_MFMV_REF2REF);
CHECK_OFFSET(refmvs_frame, n_mfmvs, RMVSF_N_MFMVS);
CHECK_OFFSET(refmvs_frame, rp_ref, RMVSF_RP_REF);
CHECK_OFFSET(refmvs_frame, rp_proj, RMVSF_RP_PROJ);
CHECK_OFFSET(refmvs_frame, rp_stride, RMVSF_RP_STRIDE);
CHECK_OFFSET(refmvs_frame, n_tile_threads, RMVSF_N_TILE_THREADS);
#endif
decl_load_tmvs_fn(dav1d_load_tmvs_neon);
decl_save_tmvs_fn(dav1d_save_tmvs_neon);
decl_splat_mv_fn(dav1d_splat_mv_neon);
@@ -36,6 +51,9 @@ static ALWAYS_INLINE void refmvs_dsp_init_arm(Dav1dRefmvsDSPContext *const c) {
if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return;
#if ARCH_AARCH64
c->load_tmvs = dav1d_load_tmvs_neon;
#endif
c->save_tmvs = dav1d_save_tmvs_neon;
c->splat_mv = dav1d_splat_mv_neon;
}
+4 -5
View File
@@ -143,7 +143,7 @@ void bytefn(dav1d_cdef_brow)(Dav1dTaskContext *const tc,
edges &= ~CDEF_HAVE_LEFT;
edges |= CDEF_HAVE_RIGHT;
enum Backup2x8Flags prev_flag = 0;
for (int sbx = 0, last_skip = 1; sbx < sb64w; sbx++, edges |= CDEF_HAVE_LEFT) {
for (int sbx = 0; sbx < sb64w; sbx++, edges |= CDEF_HAVE_LEFT) {
const int sb128x = sbx >> 1;
const int sb64_idx = ((by & sbsz) >> 3) + (sbx & 1);
const int cdef_idx = lflvl[sb128x].cdef_idx[sb64_idx];
@@ -151,7 +151,7 @@ void bytefn(dav1d_cdef_brow)(Dav1dTaskContext *const tc,
(!f->frame_hdr->cdef.y_strength[cdef_idx] &&
!f->frame_hdr->cdef.uv_strength[cdef_idx]))
{
last_skip = 1;
prev_flag = 0;
goto next_sb;
}
@@ -184,10 +184,10 @@ void bytefn(dav1d_cdef_brow)(Dav1dTaskContext *const tc,
// go to the next block
const uint32_t bx_mask = 3U << (bx & 30);
if (!(noskip_mask & bx_mask)) {
last_skip = 1;
prev_flag = 0;
goto next_b;
}
const int do_left = last_skip ? flag : (prev_flag ^ flag) & flag;
const enum Backup2x8Flags do_left = (prev_flag ^ flag) & flag;
prev_flag = flag;
if (do_left && edges & CDEF_HAVE_LEFT) {
// we didn't backup the prefilter data because it wasn't
@@ -287,7 +287,6 @@ void bytefn(dav1d_cdef_brow)(Dav1dTaskContext *const tc,
skip_uv:
bit ^= 1;
last_skip = 0;
next_b:
bptrs[0] += 8;
+15 -6
View File
@@ -113,6 +113,7 @@ cdef_filter_block_c(pixel *dst, const ptrdiff_t dst_stride,
assert((w == 4 || w == 8) && (h == 4 || h == 8));
int16_t tmp_buf[144]; // 12*12 is the maximum value of tmp_stride * (h + 4)
int16_t *tmp = tmp_buf + 2 * tmp_stride + 2;
const int8_t (*const cdef_dirs)[2] = &dav1d_cdef_directions[dir];
padding(tmp, tmp_stride, dst, dst_stride, left, top, bottom, w, h, edges);
@@ -129,7 +130,7 @@ cdef_filter_block_c(pixel *dst, const ptrdiff_t dst_stride,
int max = px, min = px;
int pri_tap_k = pri_tap;
for (int k = 0; k < 2; k++) {
const int off1 = dav1d_cdef_directions[dir + 2][k]; // dir
const int off1 = cdef_dirs[2][k]; // dir
const int p0 = tmp[x + off1];
const int p1 = tmp[x - off1];
sum += pri_tap_k * constrain(p0 - px, pri_strength, pri_shift);
@@ -140,8 +141,8 @@ cdef_filter_block_c(pixel *dst, const ptrdiff_t dst_stride,
max = imax(p0, max);
min = umin(p1, min);
max = imax(p1, max);
const int off2 = dav1d_cdef_directions[dir + 4][k]; // dir + 2
const int off3 = dav1d_cdef_directions[dir + 0][k]; // dir - 2
const int off2 = cdef_dirs[4][k]; // dir + 2
const int off3 = cdef_dirs[0][k]; // dir - 2
const int s0 = tmp[x + off2];
const int s1 = tmp[x - off2];
const int s2 = tmp[x + off3];
@@ -173,7 +174,7 @@ cdef_filter_block_c(pixel *dst, const ptrdiff_t dst_stride,
int sum = 0;
int pri_tap_k = pri_tap;
for (int k = 0; k < 2; k++) {
const int off = dav1d_cdef_directions[dir + 2][k]; // dir
const int off = cdef_dirs[2][k]; // dir
const int p0 = tmp[x + off];
const int p1 = tmp[x - off];
sum += pri_tap_k * constrain(p0 - px, pri_strength, pri_shift);
@@ -194,8 +195,8 @@ cdef_filter_block_c(pixel *dst, const ptrdiff_t dst_stride,
const int px = dst[x];
int sum = 0;
for (int k = 0; k < 2; k++) {
const int off1 = dav1d_cdef_directions[dir + 4][k]; // dir + 2
const int off2 = dav1d_cdef_directions[dir + 0][k]; // dir - 2
const int off1 = cdef_dirs[4][k]; // dir + 2
const int off2 = cdef_dirs[0][k]; // dir - 2
const int s0 = tmp[x + off1];
const int s1 = tmp[x - off1];
const int s2 = tmp[x + off2];
@@ -308,8 +309,12 @@ static int cdef_find_dir_c(const pixel *img, const ptrdiff_t stride,
#include "src/arm/cdef.h"
#elif ARCH_PPC64LE
#include "src/ppc/cdef.h"
#elif ARCH_RISCV
#include "src/riscv/cdef.h"
#elif ARCH_X86
#include "src/x86/cdef.h"
#elif ARCH_LOONGARCH64
#include "src/loongarch/cdef.h"
#endif
#endif
@@ -324,8 +329,12 @@ COLD void bitfn(dav1d_cdef_dsp_init)(Dav1dCdefDSPContext *const c) {
cdef_dsp_init_arm(c);
#elif ARCH_PPC64LE
cdef_dsp_init_ppc(c);
#elif ARCH_RISCV
cdef_dsp_init_riscv(c);
#elif ARCH_X86
cdef_dsp_init_x86(c);
#elif ARCH_LOONGARCH64
cdef_dsp_init_loongarch(c);
#endif
#endif
}
+101 -141
View File
@@ -787,63 +787,53 @@ static const CdfCoefContext default_coef_cdf[4] = {
}, .eob_hi_bit = {
{
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16961) },
{ CDF1(17223) }, { CDF1( 7621) }, { CDF1(16384) },
{ CDF1(16961) }, { CDF1(17223) }, { CDF1( 7621) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(19069) },
{ CDF1(22525) }, { CDF1(13377) }, { CDF1(16384) },
{ CDF1(19069) }, { CDF1(22525) }, { CDF1(13377) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20401) },
{ CDF1(17025) }, { CDF1(12845) }, { CDF1(12873) },
{ CDF1(14094) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20401) }, { CDF1(17025) }, { CDF1(12845) },
{ CDF1(12873) }, { CDF1(14094) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20681) },
{ CDF1(20701) }, { CDF1(15250) }, { CDF1(15017) },
{ CDF1(14928) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20681) }, { CDF1(20701) }, { CDF1(15250) },
{ CDF1(15017) }, { CDF1(14928) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(23905) },
{ CDF1(17194) }, { CDF1(16170) }, { CDF1(17695) },
{ CDF1(13826) }, { CDF1(15810) }, { CDF1(12036) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(23905) }, { CDF1(17194) }, { CDF1(16170) },
{ CDF1(17695) }, { CDF1(13826) }, { CDF1(15810) },
{ CDF1(12036) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(23959) },
{ CDF1(20799) }, { CDF1(19021) }, { CDF1(16203) },
{ CDF1(17886) }, { CDF1(14144) }, { CDF1(12010) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(23959) }, { CDF1(20799) }, { CDF1(19021) },
{ CDF1(16203) }, { CDF1(17886) }, { CDF1(14144) },
{ CDF1(12010) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(27399) },
{ CDF1(16327) }, { CDF1(18071) }, { CDF1(19584) },
{ CDF1(20721) }, { CDF1(18432) }, { CDF1(19560) },
{ CDF1(10150) }, { CDF1( 8805) },
{ CDF1(27399) }, { CDF1(16327) }, { CDF1(18071) },
{ CDF1(19584) }, { CDF1(20721) }, { CDF1(18432) },
{ CDF1(19560) }, { CDF1(10150) }, { CDF1( 8805) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(24932) },
{ CDF1(20833) }, { CDF1(12027) }, { CDF1(16670) },
{ CDF1(19914) }, { CDF1(15106) }, { CDF1(17662) },
{ CDF1(13783) }, { CDF1(28756) },
{ CDF1(24932) }, { CDF1(20833) }, { CDF1(12027) },
{ CDF1(16670) }, { CDF1(19914) }, { CDF1(15106) },
{ CDF1(17662) }, { CDF1(13783) }, { CDF1(28756) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(23406) },
{ CDF1(21845) }, { CDF1(18432) }, { CDF1(16384) },
{ CDF1(17096) }, { CDF1(12561) }, { CDF1(17320) },
{ CDF1(22395) }, { CDF1(21370) },
{ CDF1(23406) }, { CDF1(21845) }, { CDF1(18432) },
{ CDF1(16384) }, { CDF1(17096) }, { CDF1(12561) },
{ CDF1(17320) }, { CDF1(22395) }, { CDF1(21370) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
},
}, .eob_base_tok = {
@@ -1600,63 +1590,53 @@ static const CdfCoefContext default_coef_cdf[4] = {
}, .eob_hi_bit = {
{
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(17471) },
{ CDF1(20223) }, { CDF1(11357) }, { CDF1(16384) },
{ CDF1(17471) }, { CDF1(20223) }, { CDF1(11357) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20335) },
{ CDF1(21667) }, { CDF1(14818) }, { CDF1(16384) },
{ CDF1(20335) }, { CDF1(21667) }, { CDF1(14818) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20430) },
{ CDF1(20662) }, { CDF1(15367) }, { CDF1(16970) },
{ CDF1(14657) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20430) }, { CDF1(20662) }, { CDF1(15367) },
{ CDF1(16970) }, { CDF1(14657) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(22117) },
{ CDF1(22028) }, { CDF1(18650) }, { CDF1(16042) },
{ CDF1(15885) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(22117) }, { CDF1(22028) }, { CDF1(18650) },
{ CDF1(16042) }, { CDF1(15885) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(22409) },
{ CDF1(21012) }, { CDF1(15650) }, { CDF1(17395) },
{ CDF1(15469) }, { CDF1(20205) }, { CDF1(19511) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(22409) }, { CDF1(21012) }, { CDF1(15650) },
{ CDF1(17395) }, { CDF1(15469) }, { CDF1(20205) },
{ CDF1(19511) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(24220) },
{ CDF1(22480) }, { CDF1(17737) }, { CDF1(18916) },
{ CDF1(19268) }, { CDF1(18412) }, { CDF1(18844) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(24220) }, { CDF1(22480) }, { CDF1(17737) },
{ CDF1(18916) }, { CDF1(19268) }, { CDF1(18412) },
{ CDF1(18844) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(25991) },
{ CDF1(20314) }, { CDF1(17731) }, { CDF1(19678) },
{ CDF1(18649) }, { CDF1(17307) }, { CDF1(21798) },
{ CDF1(17549) }, { CDF1(15630) },
{ CDF1(25991) }, { CDF1(20314) }, { CDF1(17731) },
{ CDF1(19678) }, { CDF1(18649) }, { CDF1(17307) },
{ CDF1(21798) }, { CDF1(17549) }, { CDF1(15630) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(26585) },
{ CDF1(21469) }, { CDF1(20432) }, { CDF1(17735) },
{ CDF1(19280) }, { CDF1(15235) }, { CDF1(20297) },
{ CDF1(22471) }, { CDF1(28997) },
{ CDF1(26585) }, { CDF1(21469) }, { CDF1(20432) },
{ CDF1(17735) }, { CDF1(19280) }, { CDF1(15235) },
{ CDF1(20297) }, { CDF1(22471) }, { CDF1(28997) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(26605) },
{ CDF1(11304) }, { CDF1(16726) }, { CDF1(16560) },
{ CDF1(20866) }, { CDF1(23524) }, { CDF1(19878) },
{ CDF1(13469) }, { CDF1(23084) },
{ CDF1(26605) }, { CDF1(11304) }, { CDF1(16726) },
{ CDF1(16560) }, { CDF1(20866) }, { CDF1(23524) },
{ CDF1(19878) }, { CDF1(13469) }, { CDF1(23084) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
},
}, .eob_base_tok = {
@@ -2413,63 +2393,53 @@ static const CdfCoefContext default_coef_cdf[4] = {
}, .eob_hi_bit = {
{
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(18983) },
{ CDF1(20512) }, { CDF1(14885) }, { CDF1(16384) },
{ CDF1(18983) }, { CDF1(20512) }, { CDF1(14885) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20090) },
{ CDF1(19444) }, { CDF1(17286) }, { CDF1(16384) },
{ CDF1(20090) }, { CDF1(19444) }, { CDF1(17286) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(19139) },
{ CDF1(21487) }, { CDF1(18959) }, { CDF1(20910) },
{ CDF1(19089) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(19139) }, { CDF1(21487) }, { CDF1(18959) },
{ CDF1(20910) }, { CDF1(19089) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20536) },
{ CDF1(20664) }, { CDF1(20625) }, { CDF1(19123) },
{ CDF1(14862) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20536) }, { CDF1(20664) }, { CDF1(20625) },
{ CDF1(19123) }, { CDF1(14862) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(19833) },
{ CDF1(21502) }, { CDF1(17485) }, { CDF1(20267) },
{ CDF1(18353) }, { CDF1(23329) }, { CDF1(21478) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(19833) }, { CDF1(21502) }, { CDF1(17485) },
{ CDF1(20267) }, { CDF1(18353) }, { CDF1(23329) },
{ CDF1(21478) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(22041) },
{ CDF1(23434) }, { CDF1(20001) }, { CDF1(20554) },
{ CDF1(20951) }, { CDF1(20145) }, { CDF1(15562) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(22041) }, { CDF1(23434) }, { CDF1(20001) },
{ CDF1(20554) }, { CDF1(20951) }, { CDF1(20145) },
{ CDF1(15562) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(23312) },
{ CDF1(21607) }, { CDF1(16526) }, { CDF1(18957) },
{ CDF1(18034) }, { CDF1(18934) }, { CDF1(24247) },
{ CDF1(16921) }, { CDF1(17080) },
{ CDF1(23312) }, { CDF1(21607) }, { CDF1(16526) },
{ CDF1(18957) }, { CDF1(18034) }, { CDF1(18934) },
{ CDF1(24247) }, { CDF1(16921) }, { CDF1(17080) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(26579) },
{ CDF1(24910) }, { CDF1(18637) }, { CDF1(19800) },
{ CDF1(20388) }, { CDF1( 9887) }, { CDF1(15642) },
{ CDF1(30198) }, { CDF1(24721) },
{ CDF1(26579) }, { CDF1(24910) }, { CDF1(18637) },
{ CDF1(19800) }, { CDF1(20388) }, { CDF1( 9887) },
{ CDF1(15642) }, { CDF1(30198) }, { CDF1(24721) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(26998) },
{ CDF1(16737) }, { CDF1(17838) }, { CDF1(18922) },
{ CDF1(19515) }, { CDF1(18636) }, { CDF1(17333) },
{ CDF1(15776) }, { CDF1(22658) },
{ CDF1(26998) }, { CDF1(16737) }, { CDF1(17838) },
{ CDF1(18922) }, { CDF1(19515) }, { CDF1(18636) },
{ CDF1(17333) }, { CDF1(15776) }, { CDF1(22658) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
},
}, .eob_base_tok = {
@@ -3226,63 +3196,53 @@ static const CdfCoefContext default_coef_cdf[4] = {
}, .eob_hi_bit = {
{
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20177) },
{ CDF1(20789) }, { CDF1(20262) }, { CDF1(16384) },
{ CDF1(20177) }, { CDF1(20789) }, { CDF1(20262) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(21416) },
{ CDF1(20855) }, { CDF1(23410) }, { CDF1(16384) },
{ CDF1(21416) }, { CDF1(20855) }, { CDF1(23410) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20238) },
{ CDF1(21057) }, { CDF1(19159) }, { CDF1(22337) },
{ CDF1(20159) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20238) }, { CDF1(21057) }, { CDF1(19159) },
{ CDF1(22337) }, { CDF1(20159) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(20125) },
{ CDF1(20559) }, { CDF1(21707) }, { CDF1(22296) },
{ CDF1(17333) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(20125) }, { CDF1(20559) }, { CDF1(21707) },
{ CDF1(22296) }, { CDF1(17333) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(19941) },
{ CDF1(20527) }, { CDF1(21470) }, { CDF1(22487) },
{ CDF1(19558) }, { CDF1(22354) }, { CDF1(20331) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(19941) }, { CDF1(20527) }, { CDF1(21470) },
{ CDF1(22487) }, { CDF1(19558) }, { CDF1(22354) },
{ CDF1(20331) }, { CDF1(16384) }, { CDF1(16384) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(22752) },
{ CDF1(25006) }, { CDF1(22075) }, { CDF1(21576) },
{ CDF1(17740) }, { CDF1(21690) }, { CDF1(19211) },
{ CDF1(16384) }, { CDF1(16384) },
{ CDF1(22752) }, { CDF1(25006) }, { CDF1(22075) },
{ CDF1(21576) }, { CDF1(17740) }, { CDF1(21690) },
{ CDF1(19211) }, { CDF1(16384) }, { CDF1(16384) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(21442) },
{ CDF1(22358) }, { CDF1(18503) }, { CDF1(20291) },
{ CDF1(19945) }, { CDF1(21294) }, { CDF1(21178) },
{ CDF1(19400) }, { CDF1(10556) },
{ CDF1(21442) }, { CDF1(22358) }, { CDF1(18503) },
{ CDF1(20291) }, { CDF1(19945) }, { CDF1(21294) },
{ CDF1(21178) }, { CDF1(19400) }, { CDF1(10556) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(24648) },
{ CDF1(24949) }, { CDF1(20708) }, { CDF1(23905) },
{ CDF1(20501) }, { CDF1( 9558) }, { CDF1( 9423) },
{ CDF1(30365) }, { CDF1(19253) },
{ CDF1(24648) }, { CDF1(24949) }, { CDF1(20708) },
{ CDF1(23905) }, { CDF1(20501) }, { CDF1( 9558) },
{ CDF1( 9423) }, { CDF1(30365) }, { CDF1(19253) },
},
}, {
{
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(26064) },
{ CDF1(22098) }, { CDF1(19613) }, { CDF1(20525) },
{ CDF1(17595) }, { CDF1(16618) }, { CDF1(20497) },
{ CDF1(18989) }, { CDF1(15513) },
{ CDF1(26064) }, { CDF1(22098) }, { CDF1(19613) },
{ CDF1(20525) }, { CDF1(17595) }, { CDF1(16618) },
{ CDF1(20497) }, { CDF1(18989) }, { CDF1(15513) },
}, {
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
{ CDF1(16384) }, { CDF1(16384) },
},
},
}, .eob_base_tok = {
@@ -3979,7 +3939,7 @@ void dav1d_cdf_thread_update(const Dav1dFrameHeader *const hdr,
update_cdf_4d(N_TX_SIZES, 2, 4, 2, coef.eob_base_tok);
update_cdf_4d(N_TX_SIZES, 2, 41 /*42*/, 3, coef.base_tok);
update_cdf_4d(4, 2, 21, 3, coef.br_tok);
update_cdf_4d(N_TX_SIZES, 2, 11 /*22*/, 1, coef.eob_hi_bit);
update_cdf_4d(N_TX_SIZES, 2, 9, 1, coef.eob_hi_bit);
update_cdf_3d(N_TX_SIZES, 13, 1, coef.skip);
update_cdf_3d(2, 3, 1, coef.dc_sign);
+1 -1
View File
@@ -105,7 +105,7 @@ typedef struct CdfCoefContext {
ALIGN(uint16_t eob_base_tok[N_TX_SIZES][2][4][4], 8);
ALIGN(uint16_t base_tok[N_TX_SIZES][2][41][4], 8);
ALIGN(uint16_t br_tok[4 /*5*/][2][21][4], 8);
ALIGN(uint16_t eob_hi_bit[N_TX_SIZES][2][11 /*22*/][2], 4);
ALIGN(uint16_t eob_hi_bit[N_TX_SIZES][2][9][2], 4);
ALIGN(uint16_t skip[N_TX_SIZES][13][2], 4);
ALIGN(uint16_t dc_sign[2][3][2], 4);
} CdfCoefContext;
+29 -5
View File
@@ -26,6 +26,7 @@
*/
#include "config.h"
#include <errno.h>
#include <stdint.h>
#include "src/cpu.h"
@@ -33,20 +34,28 @@
#ifdef _WIN32
#include <windows.h>
#elif defined(__APPLE__)
#endif
#ifdef __APPLE__
#include <sys/sysctl.h>
#include <sys/types.h>
#else
#include <pthread.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_PTHREAD_NP_H
#if HAVE_PTHREAD_GETAFFINITY_NP
#include <pthread.h>
#if HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif
#if defined(__FreeBSD__)
#define cpu_set_t cpuset_t
#endif
#endif
#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO
#include <sys/auxv.h>
#endif
unsigned dav1d_cpu_flags = 0U;
unsigned dav1d_cpu_flags_mask = ~0U;
@@ -87,7 +96,7 @@ COLD int dav1d_num_logical_processors(Dav1dContext *const c) {
GetNativeSystemInfo(&system_info);
return system_info.dwNumberOfProcessors;
#endif
#elif defined(HAVE_PTHREAD_GETAFFINITY_NP) && defined(CPU_COUNT)
#elif HAVE_PTHREAD_GETAFFINITY_NP && defined(CPU_COUNT)
cpu_set_t affinity;
if (!pthread_getaffinity_np(pthread_self(), sizeof(affinity), &affinity))
return CPU_COUNT(&affinity);
@@ -103,3 +112,18 @@ COLD int dav1d_num_logical_processors(Dav1dContext *const c) {
dav1d_log(c, "Unable to detect thread count, defaulting to single-threaded mode\n");
return 1;
}
COLD unsigned long dav1d_getauxval(unsigned long type) {
#if HAVE_GETAUXVAL
return getauxval(type);
#elif HAVE_ELF_AUX_INFO
unsigned long aux = 0;
int ret = elf_aux_info(type, &aux, sizeof(aux));
if (ret != 0)
errno = ret;
return aux;
#else
errno = ENOSYS;
return 0;
#endif
}
+14 -5
View File
@@ -53,13 +53,11 @@ EXTERN unsigned dav1d_cpu_flags_mask;
void dav1d_init_cpu(void);
DAV1D_API void dav1d_set_cpu_flags_mask(unsigned mask);
int dav1d_num_logical_processors(Dav1dContext *c);
unsigned long dav1d_getauxval(unsigned long);
static ALWAYS_INLINE unsigned dav1d_get_cpu_flags(void) {
unsigned flags = dav1d_cpu_flags & dav1d_cpu_flags_mask;
static ALWAYS_INLINE unsigned dav1d_get_default_cpu_flags(void) {
unsigned flags = 0;
#if TRIM_DSP_FUNCTIONS
/* Since this function is inlined, unconditionally setting a flag here will
* enable dead code elimination in the calling function. */
#if ARCH_AARCH64 || ARCH_ARM
#if defined(__ARM_NEON) || defined(__APPLE__) || defined(_WIN32) || ARCH_AARCH64
flags |= DAV1D_ARM_CPU_FLAG_NEON;
@@ -119,6 +117,17 @@ static ALWAYS_INLINE unsigned dav1d_get_cpu_flags(void) {
flags |= DAV1D_X86_CPU_FLAG_SSE2;
#endif
#endif
return flags;
}
static ALWAYS_INLINE unsigned dav1d_get_cpu_flags(void) {
unsigned flags = dav1d_cpu_flags & dav1d_cpu_flags_mask;
#if TRIM_DSP_FUNCTIONS
/* Since this function is inlined, unconditionally setting a flag here will
* enable dead code elimination in the calling function. */
flags |= dav1d_get_default_cpu_flags();
#endif
return flags;
+65
View File
@@ -0,0 +1,65 @@
/*
* Copyright © 2024, VideoLAN and dav1d authors
* Copyright © 2024, 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.h"
#include <string.h>
#include "ctx.h"
static void memset_w1(void *const ptr, const int value) {
set_ctx1((uint8_t *) ptr, 0, value);
}
static void memset_w2(void *const ptr, const int value) {
set_ctx2((uint8_t *) ptr, 0, value);
}
static void memset_w4(void *const ptr, const int value) {
set_ctx4((uint8_t *) ptr, 0, value);
}
static void memset_w8(void *const ptr, const int value) {
set_ctx8((uint8_t *) ptr, 0, value);
}
static void memset_w16(void *const ptr, const int value) {
set_ctx16((uint8_t *) ptr, 0, value);
}
static void memset_w32(void *const ptr, const int value) {
set_ctx32((uint8_t *) ptr, 0, value);
}
const dav1d_memset_pow2_fn dav1d_memset_pow2[6] = {
memset_w1,
memset_w2,
memset_w4,
memset_w8,
memset_w16,
memset_w32
};
+42 -44
View File
@@ -31,61 +31,59 @@
#include <stdint.h>
#include "common/attributes.h"
#include "common/intops.h"
union alias64 { uint64_t u64; uint8_t u8[8]; } ATTR_ALIAS;
union alias32 { uint32_t u32; uint8_t u8[4]; } ATTR_ALIAS;
union alias16 { uint16_t u16; uint8_t u8[2]; } ATTR_ALIAS;
union alias8 { uint8_t u8; } ATTR_ALIAS;
#define set_ctx_rep4(type, var, off, val) do { \
const uint64_t const_val = val; \
((union alias64 *) &var[off + 0])->u64 = const_val; \
((union alias64 *) &var[off + 8])->u64 = const_val; \
((union alias64 *) &var[off + 16])->u64 = const_val; \
((union alias64 *) &var[off + 24])->u64 = const_val; \
typedef void (*dav1d_memset_pow2_fn)(void *ptr, int value);
EXTERN const dav1d_memset_pow2_fn dav1d_memset_pow2[6];
static inline void dav1d_memset_likely_pow2(void *const ptr, const int value, const int n) {
assert(n >= 1 && n <= 32);
if ((n&(n-1)) == 0) {
dav1d_memset_pow2[ulog2(n)](ptr, value);
} else {
memset(ptr, value, n);
}
}
// For smaller sizes use multiplication to broadcast bytes. memset misbehaves on the smaller sizes.
// For the larger sizes, we want to use memset to get access to vector operations.
#define set_ctx1(var, off, val) \
((union alias8 *) &(var)[off])->u8 = (val) * 0x01
#define set_ctx2(var, off, val) \
((union alias16 *) &(var)[off])->u16 = (val) * 0x0101
#define set_ctx4(var, off, val) \
((union alias32 *) &(var)[off])->u32 = (val) * 0x01010101U
#define set_ctx8(var, off, val) \
((union alias64 *) &(var)[off])->u64 = (val) * 0x0101010101010101ULL
#define set_ctx16(var, off, val) do { \
memset(&(var)[off], val, 16); \
} while (0)
#define set_ctx_rep2(type, var, off, val) do { \
const uint64_t const_val = val; \
((union alias64 *) &var[off + 0])->u64 = const_val; \
((union alias64 *) &var[off + 8])->u64 = const_val; \
#define set_ctx32(var, off, val) do { \
memset(&(var)[off], val, 32); \
} while (0)
#define set_ctx_rep1(typesz, var, off, val) \
((union alias##typesz *) &var[off])->u##typesz = val
#define case_set(var, dir, diridx, off) \
#define case_set(var) \
switch (var) { \
case 1: set_ctx( 8, dir, diridx, off, 0x01, set_ctx_rep1); break; \
case 2: set_ctx(16, dir, diridx, off, 0x0101, set_ctx_rep1); break; \
case 4: set_ctx(32, dir, diridx, off, 0x01010101U, set_ctx_rep1); break; \
case 8: set_ctx(64, dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep1); break; \
case 16: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep2); break; \
case 32: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep4); break; \
case 0: set_ctx(set_ctx1); break; \
case 1: set_ctx(set_ctx2); break; \
case 2: set_ctx(set_ctx4); break; \
case 3: set_ctx(set_ctx8); break; \
case 4: set_ctx(set_ctx16); break; \
case 5: set_ctx(set_ctx32); break; \
default: assert(0); \
}
#define case_set_upto16(var, dir, diridx, off) \
#define case_set_upto16(var) \
switch (var) { \
case 1: set_ctx( 8, dir, diridx, off, 0x01, set_ctx_rep1); break; \
case 2: set_ctx(16, dir, diridx, off, 0x0101, set_ctx_rep1); break; \
case 4: set_ctx(32, dir, diridx, off, 0x01010101U, set_ctx_rep1); break; \
case 8: set_ctx(64, dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep1); break; \
case 16: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep2); break; \
}
#define case_set_upto32_with_default(var, dir, diridx, off) \
switch (var) { \
case 1: set_ctx( 8, dir, diridx, off, 0x01, set_ctx_rep1); break; \
case 2: set_ctx(16, dir, diridx, off, 0x0101, set_ctx_rep1); break; \
case 4: set_ctx(32, dir, diridx, off, 0x01010101U, set_ctx_rep1); break; \
case 8: set_ctx(64, dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep1); break; \
case 16: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep2); break; \
case 32: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep4); break; \
default: default_memset(dir, diridx, off, var); break; \
}
#define case_set_upto16_with_default(var, dir, diridx, off) \
switch (var) { \
case 1: set_ctx( 8, dir, diridx, off, 0x01, set_ctx_rep1); break; \
case 2: set_ctx(16, dir, diridx, off, 0x0101, set_ctx_rep1); break; \
case 4: set_ctx(32, dir, diridx, off, 0x01010101U, set_ctx_rep1); break; \
case 8: set_ctx(64, dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep1); break; \
case 16: set_ctx( , dir, diridx, off, 0x0101010101010101ULL, set_ctx_rep2); break; \
default: default_memset(dir, diridx, off, var); break; \
case 0: set_ctx(set_ctx1); break; \
case 1: set_ctx(set_ctx2); break; \
case 2: set_ctx(set_ctx4); break; \
case 3: set_ctx(set_ctx8); break; \
case 4: set_ctx(set_ctx16); break; \
default: assert(0); \
}
#endif /* DAV1D_SRC_CTX_H */
+107 -128
View File
@@ -161,14 +161,8 @@ static void read_tx_tree(Dav1dTaskContext *const t,
}
t->by -= txsh;
} else {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, is_split ? TX_4X4 : mul * txh)
case_set_upto16(t_dim->h, l., 1, by4);
#undef set_ctx
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, is_split ? TX_4X4 : mul * txw)
case_set_upto16(t_dim->w, a->, 0, bx4);
#undef set_ctx
dav1d_memset_pow2[t_dim->lw](&t->a->tx[bx4], is_split ? TX_4X4 : txw);
dav1d_memset_pow2[t_dim->lh](&t->l.tx[by4], is_split ? TX_4X4 : txh);
}
}
@@ -419,17 +413,17 @@ static void order_palette(const uint8_t *pal_idx, const ptrdiff_t stride,
static void read_pal_indices(Dav1dTaskContext *const t,
uint8_t *const pal_idx,
const Av1Block *const b, const int pl,
const int pal_sz, const int pl,
const int w4, const int h4,
const int bw4, const int bh4)
{
Dav1dTileState *const ts = t->ts;
const ptrdiff_t stride = bw4 * 4;
assert(pal_idx);
pixel *const pal_tmp = t->scratch.pal_idx_uv;
pal_tmp[0] = dav1d_msac_decode_uniform(&ts->msac, b->pal_sz[pl]);
uint8_t *const pal_tmp = t->scratch.pal_idx_uv;
pal_tmp[0] = dav1d_msac_decode_uniform(&ts->msac, pal_sz);
uint16_t (*const color_map_cdf)[8] =
ts->cdf.m.color_map[pl][b->pal_sz[pl] - 2];
ts->cdf.m.color_map[pl][pal_sz - 2];
uint8_t (*const order)[8] = t->scratch.pal_order;
uint8_t *const ctx = t->scratch.pal_ctx;
for (int i = 1; i < 4 * (w4 + h4) - 1; i++) {
@@ -439,7 +433,7 @@ static void read_pal_indices(Dav1dTaskContext *const t,
order_palette(pal_tmp, stride, i, first, last, order, ctx);
for (int j = first, m = 0; j >= last; j--, m++) {
const int color_idx = dav1d_msac_decode_symbol_adapt8(&ts->msac,
color_map_cdf[ctx[m]], b->pal_sz[pl] - 1);
color_map_cdf[ctx[m]], pal_sz - 1);
pal_tmp[(i - j) * stride + j] = order[m][color_idx];
}
}
@@ -464,19 +458,13 @@ static void read_vartx_tree(Dav1dTaskContext *const t,
{
b->max_ytx = b->uvtx = TX_4X4;
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, TX_4X4)
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#undef set_ctx
dav1d_memset_pow2[b_dim[2]](&t->a->tx[bx4], TX_4X4);
dav1d_memset_pow2[b_dim[3]](&t->l.tx[by4], TX_4X4);
}
} else if (f->frame_hdr->txfm_mode != DAV1D_TX_SWITCHABLE || b->skip) {
if (f->frame_hdr->txfm_mode == DAV1D_TX_SWITCHABLE) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx, off, mul * b_dim[2 + diridx])
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#undef set_ctx
dav1d_memset_pow2[b_dim[2]](&t->a->tx[bx4], b_dim[2 + 0]);
dav1d_memset_pow2[b_dim[3]](&t->l.tx[by4], b_dim[2 + 1]);
}
b->uvtx = dav1d_max_txfm_size_for_bs[bs][f->cur.p.layout];
} else {
@@ -696,8 +684,7 @@ static int decode_b(Dav1dTaskContext *const t,
const enum BlockLevel bl,
const enum BlockSize bs,
const enum BlockPartition bp,
const enum EdgeFlags intra_edge_flags)
{
const enum EdgeFlags intra_edge_flags) {
Dav1dTileState *const ts = t->ts;
const Dav1dFrameContext *const f = t->f;
Av1Block b_mem, *const b = t->frame_thread.pass ?
@@ -722,11 +709,13 @@ static int decode_b(Dav1dTaskContext *const t,
const enum IntraPredMode y_mode_nofilt =
b->y_mode == FILTER_PRED ? DC_PRED : b->y_mode;
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir mode, off, mul * y_mode_nofilt); \
rep_macro(type, t->dir intra, off, mul)
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
#define set_ctx(rep_macro) \
rep_macro(edge->mode, off, y_mode_nofilt); \
rep_macro(edge->intra, off, 1)
BlockContext *edge = t->a;
for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
case_set(b_dim[2 + i]);
}
#undef set_ctx
if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
refmvs_block *const r = &t->rt.r[(t->by & 31) + 5 + bh4 - 1][t->bx];
@@ -742,17 +731,15 @@ static int decode_b(Dav1dTaskContext *const t,
}
if (has_chroma) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir uvmode, off, mul * b->uv_mode)
case_set(cbh4, l., 1, cby4);
case_set(cbw4, a->, 0, cbx4);
#undef set_ctx
uint8_t uv_mode = b->uv_mode;
dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], uv_mode);
dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], uv_mode);
}
} else {
if (IS_INTER_OR_SWITCH(f->frame_hdr) /* not intrabc */ &&
b->comp_type == COMP_INTER_NONE && b->motion_mode == MM_WARP)
{
if (b->matrix[0] == SHRT_MIN) {
if (b->matrix[0] == INT16_MIN) {
t->warpmv.type = DAV1D_WM_TYPE_IDENTITY;
} else {
t->warpmv.type = DAV1D_WM_TYPE_AFFINE;
@@ -784,13 +771,15 @@ static int decode_b(Dav1dTaskContext *const t,
if (f->bd_fn.recon_b_inter(t, bs, b)) return -1;
const uint8_t *const filter = dav1d_filter_dir[b->filter2d];
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir filter[0], off, mul * filter[0]); \
rep_macro(type, t->dir filter[1], off, mul * filter[1]); \
rep_macro(type, t->dir intra, off, 0)
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
BlockContext *edge = t->a;
for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
#define set_ctx(rep_macro) \
rep_macro(edge->filter[0], off, filter[0]); \
rep_macro(edge->filter[1], off, filter[1]); \
rep_macro(edge->intra, off, 0)
case_set(b_dim[2 + i]);
#undef set_ctx
}
if (IS_INTER_OR_SWITCH(f->frame_hdr)) {
refmvs_block *const r = &t->rt.r[(t->by & 31) + 5 + bh4 - 1][t->bx];
@@ -808,11 +797,8 @@ static int decode_b(Dav1dTaskContext *const t,
}
if (has_chroma) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir uvmode, off, mul * DC_PRED)
case_set(cbh4, l., 1, cby4);
case_set(cbw4, a->, 0, cbx4);
#undef set_ctx
dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
}
}
return 0;
@@ -972,9 +958,7 @@ static int decode_b(Dav1dTaskContext *const t,
}
// delta-q/lf
if (!(t->bx & (31 >> !f->seq_hdr->sb128)) &&
!(t->by & (31 >> !f->seq_hdr->sb128)))
{
if (!((t->bx | t->by) & (31 >> !f->seq_hdr->sb128))) {
const int prev_qidx = ts->last_qidx;
const int have_delta_q = f->frame_hdr->delta.q.present &&
(bs != (f->seq_hdr->sb128 ? BS_128x128 : BS_64x64) || !b->skip);
@@ -1179,7 +1163,7 @@ static int decode_b(Dav1dTaskContext *const t,
ts->frame_thread[p].pal_idx += bw4 * bh4 * 8;
} else
pal_idx = t->scratch.pal_idx_y;
read_pal_indices(t, pal_idx, b, 0, w4, h4, bw4, bh4);
read_pal_indices(t, pal_idx, b->pal_sz[0], 0, w4, h4, bw4, bh4);
if (DEBUG_BLOCK_INFO)
printf("Post-y-pal-indices: r=%d\n", ts->msac.rng);
}
@@ -1193,7 +1177,7 @@ static int decode_b(Dav1dTaskContext *const t,
ts->frame_thread[p].pal_idx += cbw4 * cbh4 * 8;
} else
pal_idx = t->scratch.pal_idx_uv;
read_pal_indices(t, pal_idx, b, 1, cw4, ch4, cbw4, cbh4);
read_pal_indices(t, pal_idx, b->pal_sz[1], 1, cw4, ch4, cbw4, cbh4);
if (DEBUG_BLOCK_INFO)
printf("Post-uv-pal-indices: r=%d\n", ts->msac.rng);
}
@@ -1240,39 +1224,39 @@ static int decode_b(Dav1dTaskContext *const t,
has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
}
// update contexts
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx_intra, off, mul * (((uint8_t *) &t_dim->lw)[diridx])); \
rep_macro(type, t->dir tx, off, mul * (((uint8_t *) &t_dim->lw)[diridx])); \
rep_macro(type, t->dir mode, off, mul * y_mode_nofilt); \
rep_macro(type, t->dir pal_sz, off, mul * b->pal_sz[0]); \
rep_macro(type, t->dir seg_pred, off, mul * seg_pred); \
rep_macro(type, t->dir skip_mode, off, 0); \
rep_macro(type, t->dir intra, off, mul); \
rep_macro(type, t->dir skip, off, mul * b->skip); \
/* see aomedia bug 2183 for why we use luma coordinates here */ \
rep_macro(type, t->pal_sz_uv[diridx], off, mul * (has_chroma ? b->pal_sz[1] : 0)); \
if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
rep_macro(type, t->dir comp_type, off, mul * COMP_INTER_NONE); \
rep_macro(type, t->dir ref[0], off, mul * ((uint8_t) -1)); \
rep_macro(type, t->dir ref[1], off, mul * ((uint8_t) -1)); \
rep_macro(type, t->dir filter[0], off, mul * DAV1D_N_SWITCHABLE_FILTERS); \
rep_macro(type, t->dir filter[1], off, mul * DAV1D_N_SWITCHABLE_FILTERS); \
}
const enum IntraPredMode y_mode_nofilt =
b->y_mode == FILTER_PRED ? DC_PRED : b->y_mode;
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
BlockContext *edge = t->a;
for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
int t_lsz = ((uint8_t *) &t_dim->lw)[i]; // lw then lh
#define set_ctx(rep_macro) \
rep_macro(edge->tx_intra, off, t_lsz); \
rep_macro(edge->tx, off, t_lsz); \
rep_macro(edge->mode, off, y_mode_nofilt); \
rep_macro(edge->pal_sz, off, b->pal_sz[0]); \
rep_macro(edge->seg_pred, off, seg_pred); \
rep_macro(edge->skip_mode, off, 0); \
rep_macro(edge->intra, off, 1); \
rep_macro(edge->skip, off, b->skip); \
/* see aomedia bug 2183 for why we use luma coordinates here */ \
rep_macro(t->pal_sz_uv[i], off, (has_chroma ? b->pal_sz[1] : 0)); \
if (IS_INTER_OR_SWITCH(f->frame_hdr)) { \
rep_macro(edge->comp_type, off, COMP_INTER_NONE); \
rep_macro(edge->ref[0], off, ((uint8_t) -1)); \
rep_macro(edge->ref[1], off, ((uint8_t) -1)); \
rep_macro(edge->filter[0], off, DAV1D_N_SWITCHABLE_FILTERS); \
rep_macro(edge->filter[1], off, DAV1D_N_SWITCHABLE_FILTERS); \
}
case_set(b_dim[2 + i]);
#undef set_ctx
}
if (b->pal_sz[0])
f->bd_fn.copy_pal_block_y(t, bx4, by4, bw4, bh4);
if (has_chroma) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir uvmode, off, mul * b->uv_mode)
case_set(cbh4, l., 1, cby4);
case_set(cbw4, a->, 0, cbx4);
#undef set_ctx
uint8_t uv_mode = b->uv_mode;
dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], uv_mode);
dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], uv_mode);
if (b->pal_sz[1])
f->bd_fn.copy_pal_block_uv(t, bx4, by4, bw4, bh4);
}
@@ -1374,26 +1358,24 @@ static int decode_b(Dav1dTaskContext *const t,
}
splat_intrabc_mv(f->c, t, bs, b, bw4, bh4);
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir tx_intra, off, mul * b_dim[2 + diridx]); \
rep_macro(type, t->dir mode, off, mul * DC_PRED); \
rep_macro(type, t->dir pal_sz, off, 0); \
/* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
rep_macro(type, t->pal_sz_uv[diridx], off, 0); \
rep_macro(type, t->dir seg_pred, off, mul * seg_pred); \
rep_macro(type, t->dir skip_mode, off, 0); \
rep_macro(type, t->dir intra, off, 0); \
rep_macro(type, t->dir skip, off, mul * b->skip)
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
BlockContext *edge = t->a;
for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
#define set_ctx(rep_macro) \
rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
rep_macro(edge->mode, off, DC_PRED); \
rep_macro(edge->pal_sz, off, 0); \
/* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
rep_macro(t->pal_sz_uv[i], off, 0); \
rep_macro(edge->seg_pred, off, seg_pred); \
rep_macro(edge->skip_mode, off, 0); \
rep_macro(edge->intra, off, 0); \
rep_macro(edge->skip, off, b->skip)
case_set(b_dim[2 + i]);
#undef set_ctx
}
if (has_chroma) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir uvmode, off, mul * DC_PRED)
case_set(cbh4, l., 1, cby4);
case_set(cbw4, a->, 0, cbx4);
#undef set_ctx
dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
}
} else {
// inter-specific mode/mv coding
@@ -1837,7 +1819,7 @@ static int decode_b(Dav1dTaskContext *const t,
b->matrix[2] = t->warpmv.matrix[4];
b->matrix[3] = t->warpmv.matrix[5] - 0x10000;
} else {
b->matrix[0] = SHRT_MIN;
b->matrix[0] = INT16_MIN;
}
}
}
@@ -1922,32 +1904,29 @@ static int decode_b(Dav1dTaskContext *const t,
splat_tworef_mv(f->c, t, bs, b, bw4, bh4);
else
splat_oneref_mv(f->c, t, bs, b, bw4, bh4);
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir seg_pred, off, mul * seg_pred); \
rep_macro(type, t->dir skip_mode, off, mul * b->skip_mode); \
rep_macro(type, t->dir intra, off, 0); \
rep_macro(type, t->dir skip, off, mul * b->skip); \
rep_macro(type, t->dir pal_sz, off, 0); \
/* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
rep_macro(type, t->pal_sz_uv[diridx], off, 0); \
rep_macro(type, t->dir tx_intra, off, mul * b_dim[2 + diridx]); \
rep_macro(type, t->dir comp_type, off, mul * b->comp_type); \
rep_macro(type, t->dir filter[0], off, mul * filter[0]); \
rep_macro(type, t->dir filter[1], off, mul * filter[1]); \
rep_macro(type, t->dir mode, off, mul * b->inter_mode); \
rep_macro(type, t->dir ref[0], off, mul * b->ref[0]); \
rep_macro(type, t->dir ref[1], off, mul * ((uint8_t) b->ref[1]))
case_set(bh4, l., 1, by4);
case_set(bw4, a->, 0, bx4);
BlockContext *edge = t->a;
for (int i = 0, off = bx4; i < 2; i++, off = by4, edge = &t->l) {
#define set_ctx(rep_macro) \
rep_macro(edge->seg_pred, off, seg_pred); \
rep_macro(edge->skip_mode, off, b->skip_mode); \
rep_macro(edge->intra, off, 0); \
rep_macro(edge->skip, off, b->skip); \
rep_macro(edge->pal_sz, off, 0); \
/* see aomedia bug 2183 for why this is outside if (has_chroma) */ \
rep_macro(t->pal_sz_uv[i], off, 0); \
rep_macro(edge->tx_intra, off, b_dim[2 + i]); \
rep_macro(edge->comp_type, off, b->comp_type); \
rep_macro(edge->filter[0], off, filter[0]); \
rep_macro(edge->filter[1], off, filter[1]); \
rep_macro(edge->mode, off, b->inter_mode); \
rep_macro(edge->ref[0], off, b->ref[0]); \
rep_macro(edge->ref[1], off, ((uint8_t) b->ref[1]))
case_set(b_dim[2 + i]);
#undef set_ctx
}
if (has_chroma) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->dir uvmode, off, mul * DC_PRED)
case_set(cbh4, l., 1, cby4);
case_set(cbw4, a->, 0, cbx4);
#undef set_ctx
dav1d_memset_pow2[ulog2(cbw4)](&t->a->uvmode[cbx4], DC_PRED);
dav1d_memset_pow2[ulog2(cbh4)](&t->l.uvmode[cby4], DC_PRED);
}
}
@@ -1956,12 +1935,12 @@ static int decode_b(Dav1dTaskContext *const t,
f->frame_hdr->segmentation.update_map)
{
uint8_t *seg_ptr = &f->cur_segmap[t->by * f->b4_stride + t->bx];
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
#define set_ctx(rep_macro) \
for (int y = 0; y < bh4; y++) { \
rep_macro(type, seg_ptr, 0, mul * b->seg_id); \
rep_macro(seg_ptr, 0, b->seg_id); \
seg_ptr += f->b4_stride; \
}
case_set(bw4, NULL, 0, 0);
case_set(b_dim[2]);
#undef set_ctx
}
if (!b->skip) {
@@ -2398,10 +2377,10 @@ static int decode_sb(Dav1dTaskContext *const t, const enum BlockLevel bl,
}
if (t->frame_thread.pass != 2 && (bp != PARTITION_SPLIT || bl == BL_8X8)) {
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, t->a->partition, bx8, mul * dav1d_al_part_ctx[0][bl][bp]); \
rep_macro(type, t->l.partition, by8, mul * dav1d_al_part_ctx[1][bl][bp])
case_set_upto16(hsz,,,);
#define set_ctx(rep_macro) \
rep_macro(t->a->partition, bx8, dav1d_al_part_ctx[0][bl][bp]); \
rep_macro(t->l.partition, by8, dav1d_al_part_ctx[1][bl][bp])
case_set_upto16(ulog2(hsz));
#undef set_ctx
}
+4 -5
View File
@@ -243,15 +243,14 @@ static inline int get_poc_diff(const int order_hint_n_bits,
return (diff & (mask - 1)) - (diff & mask);
}
static inline int get_jnt_comp_ctx(const int order_hint_n_bits,
const unsigned poc, const unsigned ref0poc,
const unsigned ref1poc,
static inline int get_jnt_comp_ctx(const int order_hint_n_bits, const int poc,
const int ref0poc, const int ref1poc,
const BlockContext *const a,
const BlockContext *const l,
const int yb4, const int xb4)
{
const unsigned d0 = abs(get_poc_diff(order_hint_n_bits, ref0poc, poc));
const unsigned d1 = abs(get_poc_diff(order_hint_n_bits, poc, ref1poc));
const int d0 = abs(get_poc_diff(order_hint_n_bits, ref0poc, poc));
const int d1 = abs(get_poc_diff(order_hint_n_bits, poc, ref1poc));
const int offset = d0 == d1;
const int a_ctx = a->comp_type[xb4] >= COMP_INTER_AVG ||
a->ref[0][xb4] == 6;
+22
View File
@@ -43,22 +43,31 @@
%endif
%endif
%define WIN32 0
%define WIN64 0
%define UNIX64 0
%if ARCH_X86_64
%ifidn __OUTPUT_FORMAT__,win32
%define WIN32 1
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,win64
%define WIN32 1
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,x64
%define WIN32 1
%define WIN64 1
%else
%define UNIX64 1
%endif
%else
%ifidn __OUTPUT_FORMAT__,win32
%define WIN32 1
%endif
%endif
%define FORMAT_ELF 0
%define FORMAT_MACHO 0
%define FORMAT_OBJ 0
%ifidn __OUTPUT_FORMAT__,elf
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf32
@@ -71,6 +80,10 @@
%define FORMAT_MACHO 1
%elifidn __OUTPUT_FORMAT__,macho64
%define FORMAT_MACHO 1
%elifidn __OUTPUT_FORMAT__,obj
%define FORMAT_OBJ 1
%elifidn __OUTPUT_FORMAT__,obj2
%define FORMAT_OBJ 1
%endif
%ifdef PREFIX
@@ -89,6 +102,8 @@
SECTION .rdata align=%1
%elif WIN64
SECTION .rdata align=%1
%elifidn __OUTPUT_FORMAT__,aout
SECTION .text
%else
SECTION .rodata align=%1
%endif
@@ -837,6 +852,13 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
%else
global %2
%endif
%if WIN32 && !%1
%ifdef BUILDING_DLL
export %2
%endif
%elif FORMAT_OBJ && !%1
export %2
%endif
align function_align
%2:
RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
+4
View File
@@ -417,6 +417,8 @@ fguv_ss_fn(444, 0, 0);
#include "src/arm/filmgrain.h"
#elif ARCH_X86
#include "src/x86/filmgrain.h"
#elif ARCH_RISCV
#include "src/riscv/filmgrain.h"
#endif
#endif
@@ -436,6 +438,8 @@ COLD void bitfn(dav1d_film_grain_dsp_init)(Dav1dFilmGrainDSPContext *const c) {
film_grain_dsp_init_arm(c);
#elif ARCH_X86
film_grain_dsp_init_x86(c);
#elif ARCH_RISCV
film_grain_dsp_init_riscv(c);
#endif
#endif
}
+2 -2
View File
@@ -103,7 +103,7 @@ unsigned dav1d_get_uleb128(GetBits *const c) {
i += 7;
} while (more && i < 56);
if (val > UINT_MAX || more) {
if (val > UINT32_MAX || more) {
c->error = 1;
return 0;
}
@@ -129,7 +129,7 @@ unsigned dav1d_get_vlc(GetBits *const c) {
int n_bits = 0;
do {
if (++n_bits == 32)
return 0xFFFFFFFFU;
return UINT32_MAX;
} while (!dav1d_get_bit(c));
return ((1U << n_bits) - 1) + dav1d_get_bits(c, n_bits);
+3 -3
View File
@@ -169,7 +169,7 @@ struct Dav1dContext {
Dav1dThreadPicture p;
Dav1dRef *segmap;
Dav1dRef *refmvs;
unsigned refpoc[7];
uint8_t refpoc[7];
} refs[8];
Dav1dMemPool *cdf_pool;
CdfThreadContext cdf[8];
@@ -226,7 +226,7 @@ struct Dav1dFrameContext {
Dav1dRef *cur_segmap_ref, *prev_segmap_ref;
uint8_t *cur_segmap;
const uint8_t *prev_segmap;
unsigned refpoc[7], refrefpoc[7][7];
uint8_t refpoc[7], refrefpoc[7][7];
uint8_t gmv_warp_allowed[7];
CdfThreadContext in_cdf, out_cdf;
struct Dav1dTileGroup *tile;
@@ -302,7 +302,7 @@ struct Dav1dFrameContext {
int cdef_buf_sbh;
int lr_buf_plane_sz[2]; /* (stride*sbh*4) << sb128 if n_tc > 1, else stride*4 */
int re_sz /* h */;
ALIGN(Av1FilterLUT lim_lut, 16);
Av1FilterLUT lim_lut;
ALIGN(uint8_t lvl[8 /* seg_id */][4 /* dir */][8 /* ref */][2 /* is_gmv */], 16);
int last_sharpness;
uint8_t *tx_lpf_right_edge[2];
+8
View File
@@ -732,8 +732,12 @@ static void pal_pred_c(pixel *dst, const ptrdiff_t stride,
#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
#include "src/arm/ipred.h"
#elif ARCH_RISCV
#include "src/riscv/ipred.h"
#elif ARCH_X86
#include "src/x86/ipred.h"
#elif ARCH_LOONGARCH64
#include "src/loongarch/ipred.h"
#endif
#endif
@@ -767,8 +771,12 @@ COLD void bitfn(dav1d_intra_pred_dsp_init)(Dav1dIntraPredDSPContext *const c) {
#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
intra_pred_dsp_init_arm(c);
#elif ARCH_RISCV
intra_pred_dsp_init_riscv(c);
#elif ARCH_X86
intra_pred_dsp_init_x86(c);
#elif ARCH_LOONGARCH64
intra_pred_dsp_init_loongarch(c);
#endif
#endif
}
+65 -22
View File
@@ -89,8 +89,8 @@ inv_dct4_1d_internal_c(int32_t *const c, const ptrdiff_t stride,
c[3 * stride] = CLIP(t0 - t3);
}
void dav1d_inv_dct4_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_dct4_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
inv_dct4_1d_internal_c(c, stride, min, max, 0);
}
@@ -142,8 +142,8 @@ inv_dct8_1d_internal_c(int32_t *const c, const ptrdiff_t stride,
c[7 * stride] = CLIP(t0 - t7);
}
void dav1d_inv_dct8_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_dct8_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
inv_dct8_1d_internal_c(c, stride, min, max, 0);
}
@@ -237,8 +237,8 @@ inv_dct16_1d_internal_c(int32_t *const c, const ptrdiff_t stride,
c[15 * stride] = CLIP(t0 - t15a);
}
void dav1d_inv_dct16_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_dct16_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
inv_dct16_1d_internal_c(c, stride, min, max, 0);
}
@@ -427,14 +427,14 @@ inv_dct32_1d_internal_c(int32_t *const c, const ptrdiff_t stride,
c[31 * stride] = CLIP(t0 - t31);
}
void dav1d_inv_dct32_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_dct32_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
inv_dct32_1d_internal_c(c, stride, min, max, 0);
}
void dav1d_inv_dct64_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_dct64_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
assert(stride > 0);
inv_dct32_1d_internal_c(c, stride << 1, min, max, 1);
@@ -962,13 +962,13 @@ inv_adst16_1d_internal_c(const int32_t *const in, const ptrdiff_t in_s,
}
#define inv_adst_1d(sz) \
void dav1d_inv_adst##sz##_1d_c(int32_t *const c, const ptrdiff_t stride, \
const int min, const int max) \
static void inv_adst##sz##_1d_c(int32_t *const c, const ptrdiff_t stride, \
const int min, const int max) \
{ \
inv_adst##sz##_1d_internal_c(c, stride, min, max, c, stride); \
} \
void dav1d_inv_flipadst##sz##_1d_c(int32_t *const c, const ptrdiff_t stride, \
const int min, const int max) \
static void inv_flipadst##sz##_1d_c(int32_t *const c, const ptrdiff_t stride, \
const int min, const int max) \
{ \
inv_adst##sz##_1d_internal_c(c, stride, min, max, \
&c[(sz - 1) * stride], -stride); \
@@ -980,8 +980,8 @@ inv_adst_1d(16)
#undef inv_adst_1d
void dav1d_inv_identity4_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_identity4_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
assert(stride > 0);
for (int i = 0; i < 4; i++) {
@@ -990,16 +990,16 @@ void dav1d_inv_identity4_1d_c(int32_t *const c, const ptrdiff_t stride,
}
}
void dav1d_inv_identity8_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_identity8_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
assert(stride > 0);
for (int i = 0; i < 8; i++)
c[stride * i] *= 2;
}
void dav1d_inv_identity16_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_identity16_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
assert(stride > 0);
for (int i = 0; i < 16; i++) {
@@ -1008,14 +1008,57 @@ void dav1d_inv_identity16_1d_c(int32_t *const c, const ptrdiff_t stride,
}
}
void dav1d_inv_identity32_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
static void inv_identity32_1d_c(int32_t *const c, const ptrdiff_t stride,
const int min, const int max)
{
assert(stride > 0);
for (int i = 0; i < 32; i++)
c[stride * i] *= 4;
}
const itx_1d_fn dav1d_tx1d_fns[N_TX_SIZES][N_TX_1D_TYPES] = {
[TX_4X4] = {
[DCT] = inv_dct4_1d_c,
[ADST] = inv_adst4_1d_c,
[FLIPADST] = inv_flipadst4_1d_c,
[IDENTITY] = inv_identity4_1d_c,
}, [TX_8X8] = {
[DCT] = inv_dct8_1d_c,
[ADST] = inv_adst8_1d_c,
[FLIPADST] = inv_flipadst8_1d_c,
[IDENTITY] = inv_identity8_1d_c,
}, [TX_16X16] = {
[DCT] = inv_dct16_1d_c,
[ADST] = inv_adst16_1d_c,
[FLIPADST] = inv_flipadst16_1d_c,
[IDENTITY] = inv_identity16_1d_c,
}, [TX_32X32] = {
[DCT] = inv_dct32_1d_c,
[IDENTITY] = inv_identity32_1d_c,
}, [TX_64X64] = {
[DCT] = inv_dct64_1d_c,
},
};
const uint8_t /* enum Tx1dType */ dav1d_tx1d_types[N_TX_TYPES][2] = {
[DCT_DCT] = { DCT, DCT },
[ADST_DCT] = { ADST, DCT },
[DCT_ADST] = { DCT, ADST },
[ADST_ADST] = { ADST, ADST },
[FLIPADST_DCT] = { FLIPADST, DCT },
[DCT_FLIPADST] = { DCT, FLIPADST },
[FLIPADST_FLIPADST] = { FLIPADST, FLIPADST },
[ADST_FLIPADST] = { ADST, FLIPADST },
[FLIPADST_ADST] = { FLIPADST, ADST },
[IDTX] = { IDENTITY, IDENTITY },
[V_DCT] = { DCT, IDENTITY },
[H_DCT] = { IDENTITY, DCT },
[V_ADST] = { ADST, IDENTITY },
[H_ADST] = { IDENTITY, ADST },
[V_FLIPADST] = { FLIPADST, IDENTITY },
[H_FLIPADST] = { IDENTITY, FLIPADST },
};
#if !(HAVE_ASM && TRIM_DSP_FUNCTIONS && ( \
ARCH_AARCH64 || \
(ARCH_ARM && (defined(__ARM_NEON) || defined(__APPLE__) || defined(_WIN32))) \
+12 -18
View File
@@ -28,31 +28,25 @@
#include <stddef.h>
#include <stdint.h>
#include "src/levels.h"
#ifndef DAV1D_SRC_ITX_1D_H
#define DAV1D_SRC_ITX_1D_H
enum Tx1dType {
DCT,
ADST,
IDENTITY,
FLIPADST,
N_TX_1D_TYPES,
};
#define decl_itx_1d_fn(name) \
void (name)(int32_t *c, ptrdiff_t stride, int min, int max)
typedef decl_itx_1d_fn(*itx_1d_fn);
decl_itx_1d_fn(dav1d_inv_dct4_1d_c);
decl_itx_1d_fn(dav1d_inv_dct8_1d_c);
decl_itx_1d_fn(dav1d_inv_dct16_1d_c);
decl_itx_1d_fn(dav1d_inv_dct32_1d_c);
decl_itx_1d_fn(dav1d_inv_dct64_1d_c);
decl_itx_1d_fn(dav1d_inv_adst4_1d_c);
decl_itx_1d_fn(dav1d_inv_adst8_1d_c);
decl_itx_1d_fn(dav1d_inv_adst16_1d_c);
decl_itx_1d_fn(dav1d_inv_flipadst4_1d_c);
decl_itx_1d_fn(dav1d_inv_flipadst8_1d_c);
decl_itx_1d_fn(dav1d_inv_flipadst16_1d_c);
decl_itx_1d_fn(dav1d_inv_identity4_1d_c);
decl_itx_1d_fn(dav1d_inv_identity8_1d_c);
decl_itx_1d_fn(dav1d_inv_identity16_1d_c);
decl_itx_1d_fn(dav1d_inv_identity32_1d_c);
EXTERN const itx_1d_fn dav1d_tx1d_fns[N_TX_SIZES][N_TX_1D_TYPES];
EXTERN const uint8_t /* enum Tx1dType */ dav1d_tx1d_types[N_TX_TYPES][2];
void dav1d_inv_wht4_1d_c(int32_t *c, ptrdiff_t stride);
+79 -52
View File
@@ -29,6 +29,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "common/attributes.h"
@@ -36,13 +37,17 @@
#include "src/itx.h"
#include "src/itx_1d.h"
#include "src/scan.h"
#include "src/tables.h"
static NOINLINE void
inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
const int eob, const int w, const int h, const int shift,
const itx_1d_fn first_1d_fn, const itx_1d_fn second_1d_fn,
const int has_dconly HIGHBD_DECL_SUFFIX)
const int eob, const /*enum RectTxfmSize*/ int tx, const int shift,
const enum TxfmType txtp HIGHBD_DECL_SUFFIX)
{
const TxfmInfo *const t_dim = &dav1d_txfm_dimensions[tx];
const int w = 4 * t_dim->w, h = 4 * t_dim->h;
const int has_dconly = txtp == DCT_DCT;
assert(w >= 4 && w <= 64);
assert(h >= 4 && h <= 64);
assert(eob >= 0);
@@ -64,6 +69,9 @@ inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
return;
}
const uint8_t *const txtps = dav1d_tx1d_types[txtp];
const itx_1d_fn first_1d_fn = dav1d_tx1d_fns[t_dim->lw][txtps[0]];
const itx_1d_fn second_1d_fn = dav1d_tx1d_fns[t_dim->lh][txtps[1]];
const int sh = imin(h, 32), sw = imin(w, 32);
#if BITDEPTH == 8
const int row_clip_min = INT16_MIN;
@@ -76,7 +84,16 @@ inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
const int col_clip_max = ~col_clip_min;
int32_t tmp[64 * 64], *c = tmp;
for (int y = 0; y < sh; y++, c += w) {
int last_nonzero_col; // in first 1d itx
if (txtps[1] == IDENTITY && txtps[0] != IDENTITY) {
last_nonzero_col = imin(sh - 1, eob);
} else if (txtps[0] == IDENTITY && txtps[1] != IDENTITY) {
last_nonzero_col = eob >> (t_dim->lw + 2);
} else {
last_nonzero_col = dav1d_last_nonzero_col_from_eob[tx][eob];
}
assert(last_nonzero_col < sh);
for (int y = 0; y <= last_nonzero_col; y++, c += w) {
if (is_rect2)
for (int x = 0; x < sw; x++)
c[x] = (coeff[y + x * sh] * 181 + 128) >> 8;
@@ -85,6 +102,8 @@ inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
c[x] = coeff[y + x * sh];
first_1d_fn(c, 1, row_clip_min, row_clip_max);
}
if (last_nonzero_col + 1 < sh)
memset(c, 0, sizeof(*c) * (sh - last_nonzero_col - 1) * w);
memset(coeff, 0, sizeof(*coeff) * sw * sh);
for (int i = 0; i < w * sh; i++)
@@ -99,7 +118,7 @@ inv_txfm_add_c(pixel *dst, const ptrdiff_t stride, coef *const coeff,
dst[x] = iclip_pixel(dst[x] + ((*c++ + 8) >> 4));
}
#define inv_txfm_fn(type1, type2, w, h, shift, has_dconly) \
#define inv_txfm_fn(type1, type2, type, pfx, w, h, shift) \
static void \
inv_txfm_add_##type1##_##type2##_##w##x##h##_c(pixel *dst, \
const ptrdiff_t stride, \
@@ -107,57 +126,56 @@ inv_txfm_add_##type1##_##type2##_##w##x##h##_c(pixel *dst, \
const int eob \
HIGHBD_DECL_SUFFIX) \
{ \
inv_txfm_add_c(dst, stride, coeff, eob, w, h, shift, \
dav1d_inv_##type1##w##_1d_c, dav1d_inv_##type2##h##_1d_c, \
has_dconly HIGHBD_TAIL_SUFFIX); \
inv_txfm_add_c(dst, stride, coeff, eob, pfx##TX_##w##X##h, shift, type \
HIGHBD_TAIL_SUFFIX); \
}
#define inv_txfm_fn64(w, h, shift) \
inv_txfm_fn(dct, dct, w, h, shift, 1)
#define inv_txfm_fn64(pfx, w, h, shift) \
inv_txfm_fn(dct, dct, DCT_DCT, pfx, w, h, shift)
#define inv_txfm_fn32(w, h, shift) \
inv_txfm_fn64(w, h, shift) \
inv_txfm_fn(identity, identity, w, h, shift, 0)
#define inv_txfm_fn32(pfx, w, h, shift) \
inv_txfm_fn64(pfx, w, h, shift) \
inv_txfm_fn(identity, identity, IDTX, pfx, w, h, shift)
#define inv_txfm_fn16(w, h, shift) \
inv_txfm_fn32(w, h, shift) \
inv_txfm_fn(adst, dct, w, h, shift, 0) \
inv_txfm_fn(dct, adst, w, h, shift, 0) \
inv_txfm_fn(adst, adst, w, h, shift, 0) \
inv_txfm_fn(dct, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, dct, w, h, shift, 0) \
inv_txfm_fn(adst, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, adst, w, h, shift, 0) \
inv_txfm_fn(flipadst, flipadst, w, h, shift, 0) \
inv_txfm_fn(identity, dct, w, h, shift, 0) \
inv_txfm_fn(dct, identity, w, h, shift, 0) \
#define inv_txfm_fn16(pfx, w, h, shift) \
inv_txfm_fn32(pfx, w, h, shift) \
inv_txfm_fn(adst, dct, ADST_DCT, pfx, w, h, shift) \
inv_txfm_fn(dct, adst, DCT_ADST, pfx, w, h, shift) \
inv_txfm_fn(adst, adst, ADST_ADST, pfx, w, h, shift) \
inv_txfm_fn(dct, flipadst, DCT_FLIPADST, pfx, w, h, shift) \
inv_txfm_fn(flipadst, dct, FLIPADST_DCT, pfx, w, h, shift) \
inv_txfm_fn(adst, flipadst, ADST_FLIPADST, pfx, w, h, shift) \
inv_txfm_fn(flipadst, adst, FLIPADST_ADST, pfx, w, h, shift) \
inv_txfm_fn(flipadst, flipadst, FLIPADST_FLIPADST, pfx, w, h, shift) \
inv_txfm_fn(identity, dct, H_DCT, pfx, w, h, shift) \
inv_txfm_fn(dct, identity, V_DCT, pfx, w, h, shift) \
#define inv_txfm_fn84(w, h, shift) \
inv_txfm_fn16(w, h, shift) \
inv_txfm_fn(identity, flipadst, w, h, shift, 0) \
inv_txfm_fn(flipadst, identity, w, h, shift, 0) \
inv_txfm_fn(identity, adst, w, h, shift, 0) \
inv_txfm_fn(adst, identity, w, h, shift, 0) \
#define inv_txfm_fn84(pfx, w, h, shift) \
inv_txfm_fn16(pfx, w, h, shift) \
inv_txfm_fn(identity, flipadst, H_FLIPADST, pfx, w, h, shift) \
inv_txfm_fn(flipadst, identity, V_FLIPADST, pfx, w, h, shift) \
inv_txfm_fn(identity, adst, H_ADST, pfx, w, h, shift) \
inv_txfm_fn(adst, identity, V_ADST, pfx, w, h, shift) \
inv_txfm_fn84( 4, 4, 0)
inv_txfm_fn84( 4, 8, 0)
inv_txfm_fn84( 4, 16, 1)
inv_txfm_fn84( 8, 4, 0)
inv_txfm_fn84( 8, 8, 1)
inv_txfm_fn84( 8, 16, 1)
inv_txfm_fn32( 8, 32, 2)
inv_txfm_fn84(16, 4, 1)
inv_txfm_fn84(16, 8, 1)
inv_txfm_fn16(16, 16, 2)
inv_txfm_fn32(16, 32, 1)
inv_txfm_fn64(16, 64, 2)
inv_txfm_fn32(32, 8, 2)
inv_txfm_fn32(32, 16, 1)
inv_txfm_fn32(32, 32, 2)
inv_txfm_fn64(32, 64, 1)
inv_txfm_fn64(64, 16, 2)
inv_txfm_fn64(64, 32, 1)
inv_txfm_fn64(64, 64, 2)
inv_txfm_fn84( , 4, 4, 0)
inv_txfm_fn84(R, 4, 8, 0)
inv_txfm_fn84(R, 4, 16, 1)
inv_txfm_fn84(R, 8, 4, 0)
inv_txfm_fn84( , 8, 8, 1)
inv_txfm_fn84(R, 8, 16, 1)
inv_txfm_fn32(R, 8, 32, 2)
inv_txfm_fn84(R, 16, 4, 1)
inv_txfm_fn84(R, 16, 8, 1)
inv_txfm_fn16( , 16, 16, 2)
inv_txfm_fn32(R, 16, 32, 1)
inv_txfm_fn64(R, 16, 64, 2)
inv_txfm_fn32(R, 32, 8, 2)
inv_txfm_fn32(R, 32, 16, 1)
inv_txfm_fn32( , 32, 32, 2)
inv_txfm_fn64(R, 32, 64, 1)
inv_txfm_fn64(R, 64, 16, 2)
inv_txfm_fn64(R, 64, 32, 1)
inv_txfm_fn64( , 64, 64, 2)
#if !(HAVE_ASM && TRIM_DSP_FUNCTIONS && ( \
ARCH_AARCH64 || \
@@ -190,6 +208,8 @@ static void inv_txfm_add_wht_wht_4x4_c(pixel *dst, const ptrdiff_t stride,
#include "src/arm/itx.h"
#elif ARCH_LOONGARCH64
#include "src/loongarch/itx.h"
#elif ARCH_PPC64LE
#include "src/ppc/itx.h"
#elif ARCH_RISCV
#include "src/riscv/itx.h"
#elif ARCH_X86
@@ -267,18 +287,25 @@ COLD void bitfn(dav1d_itx_dsp_init)(Dav1dInvTxfmDSPContext *const c, int bpc) {
assign_itx_all_fn64(64, 32, R);
assign_itx_all_fn64(64, 64, );
int all_simd = 0;
#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
itx_dsp_init_arm(c, bpc);
itx_dsp_init_arm(c, bpc, &all_simd);
#endif
#if ARCH_LOONGARCH64
itx_dsp_init_loongarch(c, bpc);
#endif
#if ARCH_PPC64LE
itx_dsp_init_ppc(c, bpc);
#endif
#if ARCH_RISCV
itx_dsp_init_riscv(c, bpc);
#endif
#if ARCH_X86
itx_dsp_init_x86(c, bpc);
itx_dsp_init_x86(c, bpc, &all_simd);
#endif
#endif
if (!all_simd)
dav1d_init_last_nonzero_col_from_eob_tables();
}
+9 -36
View File
@@ -64,18 +64,15 @@ static void decomp_tx(uint8_t (*const txa)[2 /* txsz, step */][32 /* y */][32 /*
} else {
const int lw = imin(2, t_dim->lw), lh = imin(2, t_dim->lh);
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
#define set_ctx(rep_macro) \
for (int y = 0; y < t_dim->h; y++) { \
rep_macro(type, txa[0][0][y], off, mul * lw); \
rep_macro(type, txa[1][0][y], off, mul * lh); \
rep_macro(txa[0][0][y], 0, lw); \
rep_macro(txa[1][0][y], 0, lh); \
txa[0][1][y][0] = t_dim->w; \
}
case_set_upto16(t_dim->w,,, 0);
#undef set_ctx
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, txa[1][1][0], off, mul * t_dim->h)
case_set_upto16(t_dim->w,,, 0);
case_set_upto16(t_dim->lw);
#undef set_ctx
dav1d_memset_pow2[t_dim->lw](txa[1][1][0], t_dim->h);
}
}
@@ -196,20 +193,8 @@ static inline void mask_edges_intra(uint16_t (*const masks)[32][3][2],
if (inner2) masks[1][by4 + y][thl4c][1] |= inner2;
}
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, a, off, mul * thl4c)
#define default_memset(dir, diridx, off, var) \
memset(a, thl4c, var)
case_set_upto32_with_default(w4,,, 0);
#undef default_memset
#undef set_ctx
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, l, off, mul * twl4c)
#define default_memset(dir, diridx, off, var) \
memset(l, twl4c, var)
case_set_upto32_with_default(h4,,, 0);
#undef default_memset
#undef set_ctx
dav1d_memset_likely_pow2(a, thl4c, w4);
dav1d_memset_likely_pow2(l, twl4c, h4);
}
static void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
@@ -267,20 +252,8 @@ static void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
}
}
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, a, off, mul * thl4c)
#define default_memset(dir, diridx, off, var) \
memset(a, thl4c, var)
case_set_upto32_with_default(cw4,,, 0);
#undef default_memset
#undef set_ctx
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
rep_macro(type, l, off, mul * twl4c)
#define default_memset(dir, diridx, off, var) \
memset(l, twl4c, var)
case_set_upto32_with_default(ch4,,, 0);
#undef default_memset
#undef set_ctx
dav1d_memset_likely_pow2(a, thl4c, cw4);
dav1d_memset_likely_pow2(l, twl4c, ch4);
}
void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
+3 -3
View File
@@ -34,9 +34,9 @@
#include "src/levels.h"
typedef struct Av1FilterLUT {
uint8_t e[64];
uint8_t i[64];
uint64_t sharp[2];
ALIGN(uint8_t e[64], 16);
ALIGN(uint8_t i[64], 16);
ALIGN(uint64_t sharp[2], 16);
} Av1FilterLUT;
typedef struct Av1RestorationUnit {
+8 -7
View File
@@ -31,7 +31,7 @@
#include <errno.h>
#include <string.h>
#if defined(__linux__) && defined(HAVE_DLSYM)
#if defined(__linux__) && HAVE_DLSYM
#include <dlfcn.h>
#endif
@@ -88,9 +88,9 @@ COLD void dav1d_default_settings(Dav1dSettings *const s) {
static void close_internal(Dav1dContext **const c_out, int flush);
#if defined(__linux__) && HAVE_DLSYM && defined(__GLIBC__)
NO_SANITIZE("cfi-icall") // CFI is broken with dlsym()
static COLD size_t get_stack_size_internal(const pthread_attr_t *const thread_attr) {
#if defined(__linux__) && defined(HAVE_DLSYM) && defined(__GLIBC__)
/* glibc has an issue where the size of the TLS is subtracted from the stack
* size instead of allocated separately. As a result the specified stack
* size may be insufficient when used in an application with large amounts
@@ -100,9 +100,11 @@ static COLD size_t get_stack_size_internal(const pthread_attr_t *const thread_at
dlsym(RTLD_DEFAULT, "__pthread_get_minstack");
if (get_minstack)
return get_minstack(thread_attr) - PTHREAD_STACK_MIN;
#endif
return 0;
}
#else
#define get_stack_size_internal(attr) (0)
#endif
static COLD void get_num_threads(Dav1dContext *const c, const Dav1dSettings *const s,
unsigned *n_tc, unsigned *n_fc)
@@ -263,7 +265,6 @@ COLD int dav1d_open(Dav1dContext **const c_out, const Dav1dSettings *const s) {
f->c = c;
f->task_thread.ttd = &c->task_thread;
f->lf.last_sharpness = -1;
dav1d_refmvs_init(&f->rf);
}
for (unsigned m = 0; m < c->n_tc; m++) {
@@ -556,9 +557,9 @@ void dav1d_flush(Dav1dContext *const c) {
if (c->n_fc == 1 && c->n_tc == 1) return;
atomic_store(c->flush, 1);
// stop running tasks in worker threads
if (c->n_tc > 1) {
pthread_mutex_lock(&c->task_thread.lock);
// stop running tasks in worker threads
for (unsigned i = 0; i < c->n_tc; i++) {
Dav1dTaskContext *const tc = &c->tc[i];
while (!tc->task_thread.flushed) {
@@ -580,7 +581,6 @@ void dav1d_flush(Dav1dContext *const c) {
pthread_mutex_unlock(&c->task_thread.lock);
}
// wait for threads to complete flushing
if (c->n_fc > 1) {
for (unsigned n = 0, next = c->frame_thread.next; n < c->n_fc; n++, next++) {
if (next == c->n_fc) next = 0;
@@ -588,6 +588,7 @@ void dav1d_flush(Dav1dContext *const c) {
dav1d_decode_frame_exit(f, -1);
f->n_tile_data = 0;
f->task_thread.retval = 0;
f->task_thread.error = 0;
Dav1dThreadPicture *out_delayed = &c->frame_thread.out_delayed[next];
if (out_delayed->p.frame_hdr) {
dav1d_thread_picture_unref(out_delayed);
@@ -664,7 +665,7 @@ static COLD void close_internal(Dav1dContext **const c_out, int flush) {
dav1d_free(f->lf.lr_mask);
dav1d_free(f->lf.tx_lpf_right_edge[0]);
dav1d_free(f->lf.start_of_tile_row);
dav1d_refmvs_clear(&f->rf);
dav1d_free_aligned(f->rf.r);
dav1d_free_aligned(f->lf.cdef_line_buf);
dav1d_free_aligned(f->lf.lr_line_buf);
}
+2249
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
/*
* Copyright © 2024, VideoLAN and dav1d authors
* Copyright © 2024, Loongson Technology Corporation Limited
* 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.
*/
#ifndef DAV1D_SRC_LOONGARCH_CDEF_H
#define DAV1D_SRC_LOONGARCH_CDEF_H
#include "config.h"
#include "src/cdef.h"
#include "src/cpu.h"
decl_cdef_dir_fn(BF(dav1d_cdef_find_dir, lsx));
decl_cdef_fn(BF(dav1d_cdef_filter_block_4x4, lsx));
decl_cdef_fn(BF(dav1d_cdef_filter_block_4x8, lsx));
decl_cdef_fn(BF(dav1d_cdef_filter_block_8x8, lsx));
static ALWAYS_INLINE void cdef_dsp_init_loongarch(Dav1dCdefDSPContext *const c) {
const unsigned flags = dav1d_get_cpu_flags();
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LSX)) return;
#if BITDEPTH == 8
c->dir = BF(dav1d_cdef_find_dir, lsx);
c->fb[0] = BF(dav1d_cdef_filter_block_8x8, lsx);
c->fb[1] = BF(dav1d_cdef_filter_block_4x8, lsx);
c->fb[2] = BF(dav1d_cdef_filter_block_4x4, lsx);
#endif
}
#endif /* DAV1D_SRC_LOONGARCH_CDEF_H */
+6 -4
View File
@@ -26,9 +26,11 @@
#include "config.h"
#include "common/attributes.h"
#include "src/cpu.h"
#include "src/loongarch/cpu.h"
#if defined(HAVE_GETAUXVAL)
#if HAVE_GETAUXVAL
#include <sys/auxv.h>
#define LA_HWCAP_LSX ( 1 << 4 )
@@ -36,9 +38,9 @@
#endif
COLD unsigned dav1d_get_cpu_flags_loongarch(void) {
unsigned flags = 0;
#if defined(HAVE_GETAUXVAL)
unsigned long hw_cap = getauxval(AT_HWCAP);
unsigned flags = dav1d_get_default_cpu_flags();
#if HAVE_GETAUXVAL
unsigned long hw_cap = dav1d_getauxval(AT_HWCAP);
flags |= (hw_cap & LA_HWCAP_LSX) ? DAV1D_LOONGARCH_CPU_FLAG_LSX : 0;
flags |= (hw_cap & LA_HWCAP_LASX) ? DAV1D_LOONGARCH_CPU_FLAG_LASX : 0;
#endif
File diff suppressed because it is too large Load Diff
+96
View File
@@ -0,0 +1,96 @@
/*
* Copyright © 2024, VideoLAN and dav1d authors
* Copyright © 2024, Loongson Technology Corporation Limited
* 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.
*/
#ifndef DAV1D_SRC_LOONGARCH_IPRED_H
#define DAV1D_SRC_LOONGARCH_IPRED_H
#include "config.h"
#include "src/ipred.h"
#include "src/cpu.h"
#include "src/tables.h"
#define MULTIPLIER_1x2 0x5556
#define MULTIPLIER_1x4 0x3334
#define BASE_SHIFT 16
#define init_fn(type0, type1, name, suffix) \
c->type0[type1] = BF(dav1d_##name, suffix)
#define init_angular_ipred_fn(type, name, suffix) \
init_fn(intra_pred, type, name, suffix)
#define init_cfl_pred_fn(type, name, suffix) \
init_fn(cfl_pred, type, name, suffix)
decl_angular_ipred_fn(BF(dav1d_ipred_dc, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_dc_128, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_dc_top, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_dc_left, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_h, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_v, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_paeth, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_smooth, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_smooth_v, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_smooth_h, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_filter, lsx));
decl_angular_ipred_fn(BF(dav1d_ipred_z1, lsx));
decl_cfl_pred_fn(BF(dav1d_ipred_cfl, lsx));
decl_cfl_pred_fn(BF(dav1d_ipred_cfl_128, lsx));
decl_cfl_pred_fn(BF(dav1d_ipred_cfl_top, lsx));
decl_cfl_pred_fn(BF(dav1d_ipred_cfl_left, lsx));
decl_pal_pred_fn(BF(dav1d_pal_pred, lsx));
static ALWAYS_INLINE void intra_pred_dsp_init_loongarch(Dav1dIntraPredDSPContext *const c) {
const unsigned flags = dav1d_get_cpu_flags();
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LSX)) return;
#if BITDEPTH == 8
init_angular_ipred_fn(DC_PRED, ipred_dc, lsx);
init_angular_ipred_fn(DC_128_PRED, ipred_dc_128, lsx);
init_angular_ipred_fn(TOP_DC_PRED, ipred_dc_top, lsx);
init_angular_ipred_fn(LEFT_DC_PRED, ipred_dc_left, lsx);
init_angular_ipred_fn(HOR_PRED, ipred_h, lsx);
init_angular_ipred_fn(VERT_PRED, ipred_v, lsx);
init_angular_ipred_fn(PAETH_PRED, ipred_paeth, lsx);
init_angular_ipred_fn(SMOOTH_PRED, ipred_smooth, lsx);
init_angular_ipred_fn(SMOOTH_V_PRED, ipred_smooth_v, lsx);
init_angular_ipred_fn(SMOOTH_H_PRED, ipred_smooth_h, lsx);
init_angular_ipred_fn(FILTER_PRED, ipred_filter, lsx);
init_angular_ipred_fn(Z1_PRED, ipred_z1, lsx);
init_cfl_pred_fn(DC_PRED, ipred_cfl, lsx);
init_cfl_pred_fn(DC_128_PRED, ipred_cfl_128, lsx);
init_cfl_pred_fn(TOP_DC_PRED, ipred_cfl_top, lsx);
init_cfl_pred_fn(LEFT_DC_PRED, ipred_cfl_left, lsx);
c->pal_pred = BF(dav1d_pal_pred, lsx);
#endif
}
#endif /* DAV1D_SRC_LOONGARCH_IPRED_H */
+3062 -6385
View File
File diff suppressed because it is too large Load Diff
+48 -124
View File
@@ -31,67 +31,18 @@
#include "src/cpu.h"
#include "src/itx.h"
decl_itx_fn(BF(dav1d_inv_txfm_add_wht_wht_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_flipadst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_adst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_flipadst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_dct_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_flipadst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_identity_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_dct_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_identity_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_flipadst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_adst_4x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_identity_4x4, lsx));
decl_itx17_fns( 4, 4, lsx);
decl_itx16_fns( 4, 8, lsx);
decl_itx16_fns( 4, 16, lsx);
decl_itx16_fns( 8, 4, lsx);
decl_itx16_fns( 8, 8, lsx);
decl_itx16_fns( 8, 16, lsx);
decl_itx2_fns ( 8, 32, lsx);
decl_itx16_fns(16, 8, lsx);
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_4x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_adst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_flipadst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_dct_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_flipadst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_flipadst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_identity_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_dct_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_identity_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_flipadst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_identity_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_adst_8x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_adst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_flipadst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_dct_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_flipadst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_adst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_identity_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_identity_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_dct_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_flipadst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_identity_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_flipadst_8x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_8x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_8x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_8x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_8x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_16x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_16x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_16x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_identity_identity_16x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_16x4, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_16x16, lsx));
@@ -99,14 +50,23 @@ decl_itx_fn(BF(dav1d_inv_txfm_add_adst_dct_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_adst_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_dct_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_flipadst_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_flipadst_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_flipadst_adst_16x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_8x32, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_32x32, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_16x32, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_32x8, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_32x16, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_32x32, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_64x32, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_dct_dct_64x64, lsx));
decl_itx_fn(BF(dav1d_inv_txfm_add_adst_adst_16x16, lasx));
static ALWAYS_INLINE void itx_dsp_init_loongarch(Dav1dInvTxfmDSPContext *const c, int bpc) {
#if BITDEPTH == 8
const unsigned flags = dav1d_get_cpu_flags();
@@ -115,67 +75,20 @@ static ALWAYS_INLINE void itx_dsp_init_loongarch(Dav1dInvTxfmDSPContext *const c
if (BITDEPTH != 8 ) return;
c->itxfm_add[TX_4X4][WHT_WHT] = dav1d_inv_txfm_add_wht_wht_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][IDTX] = dav1d_inv_txfm_add_identity_identity_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][ADST_DCT] = dav1d_inv_txfm_add_dct_adst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][ADST_ADST] = dav1d_inv_txfm_add_adst_adst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][FLIPADST_DCT] = dav1d_inv_txfm_add_dct_flipadst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][ADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_adst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][FLIPADST_ADST] = dav1d_inv_txfm_add_adst_flipadst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][DCT_FLIPADST] = dav1d_inv_txfm_add_flipadst_dct_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][FLIPADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_flipadst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][H_DCT] = dav1d_inv_txfm_add_dct_identity_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][V_DCT] = dav1d_inv_txfm_add_identity_dct_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][H_FLIPADST] = dav1d_inv_txfm_add_flipadst_identity_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][V_FLIPADST] = dav1d_inv_txfm_add_identity_flipadst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][V_ADST] = dav1d_inv_txfm_add_identity_adst_4x4_8bpc_lsx;
c->itxfm_add[TX_4X4][H_ADST] = dav1d_inv_txfm_add_adst_identity_4x4_8bpc_lsx;
assign_itx17_fn( , 4, 4, lsx);
assign_itx16_fn(R, 4, 8, lsx);
assign_itx16_fn(R, 4, 16, lsx);
assign_itx16_fn(R, 8, 4, lsx);
assign_itx16_fn( , 8, 8, lsx);
assign_itx16_fn(R, 8, 16, lsx);
assign_itx2_fn (R, 8, 32, lsx);
assign_itx16_fn(R, 16, 8, lsx);
assign_itx1_fn (R, 64, 32, lsx);
assign_itx1_fn ( , 64, 64, lsx);
c->itxfm_add[RTX_4X8][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_4x8_8bpc_lsx;
c->itxfm_add[RTX_8X4][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][IDTX] = dav1d_inv_txfm_add_identity_identity_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][ADST_DCT] = dav1d_inv_txfm_add_dct_adst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][ADST_ADST] = dav1d_inv_txfm_add_adst_adst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][ADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_adst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][FLIPADST_ADST] = dav1d_inv_txfm_add_adst_flipadst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][DCT_FLIPADST] = dav1d_inv_txfm_add_flipadst_dct_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][FLIPADST_DCT] = dav1d_inv_txfm_add_dct_flipadst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][FLIPADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_flipadst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][H_DCT] = dav1d_inv_txfm_add_dct_identity_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][V_DCT] = dav1d_inv_txfm_add_identity_dct_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][H_FLIPADST] = dav1d_inv_txfm_add_flipadst_identity_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][V_FLIPADST] = dav1d_inv_txfm_add_identity_flipadst_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][H_ADST] = dav1d_inv_txfm_add_adst_identity_8x4_8bpc_lsx;
c->itxfm_add[RTX_8X4][V_ADST] = dav1d_inv_txfm_add_identity_adst_8x4_8bpc_lsx;
c->itxfm_add[TX_8X8][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][IDTX] = dav1d_inv_txfm_add_identity_identity_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][ADST_DCT] = dav1d_inv_txfm_add_dct_adst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][ADST_ADST] = dav1d_inv_txfm_add_adst_adst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][ADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_adst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][FLIPADST_ADST] = dav1d_inv_txfm_add_adst_flipadst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][DCT_FLIPADST] = dav1d_inv_txfm_add_flipadst_dct_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][FLIPADST_DCT] = dav1d_inv_txfm_add_dct_flipadst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][FLIPADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_flipadst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][H_DCT] = dav1d_inv_txfm_add_dct_identity_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][V_DCT] = dav1d_inv_txfm_add_identity_dct_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][H_FLIPADST] = dav1d_inv_txfm_add_flipadst_identity_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][V_FLIPADST] = dav1d_inv_txfm_add_identity_flipadst_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][H_ADST] = dav1d_inv_txfm_add_adst_identity_8x8_8bpc_lsx;
c->itxfm_add[TX_8X8][V_ADST] = dav1d_inv_txfm_add_identity_adst_8x8_8bpc_lsx;
c->itxfm_add[RTX_8X16][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_8x16_8bpc_lsx;
c->itxfm_add[RTX_8X16][IDTX] = dav1d_inv_txfm_add_identity_identity_8x16_8bpc_lsx;
c->itxfm_add[RTX_8X16][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_8x16_8bpc_lsx;
c->itxfm_add[RTX_8X16][ADST_DCT] = dav1d_inv_txfm_add_dct_adst_8x16_8bpc_lsx;
c->itxfm_add[RTX_16X8][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_16x8_8bpc_lsx;
c->itxfm_add[RTX_16X8][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_16x8_8bpc_lsx;
c->itxfm_add[RTX_16X4][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_16x4_8bpc_lsx;
c->itxfm_add[RTX_16X4][IDTX] = dav1d_inv_txfm_add_identity_identity_16x4_8bpc_lsx;
c->itxfm_add[RTX_16X4][DCT_ADST] = dav1d_inv_txfm_add_adst_dct_16x4_8bpc_lsx;
c->itxfm_add[TX_16X16][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_16x16_8bpc_lsx;
c->itxfm_add[TX_16X16][ADST_ADST] = dav1d_inv_txfm_add_adst_adst_16x16_8bpc_lsx;
@@ -183,12 +96,23 @@ static ALWAYS_INLINE void itx_dsp_init_loongarch(Dav1dInvTxfmDSPContext *const c
c->itxfm_add[TX_16X16][ADST_DCT] = dav1d_inv_txfm_add_dct_adst_16x16_8bpc_lsx;
c->itxfm_add[TX_16X16][DCT_FLIPADST] = dav1d_inv_txfm_add_flipadst_dct_16x16_8bpc_lsx;
c->itxfm_add[TX_16X16][FLIPADST_DCT] = dav1d_inv_txfm_add_dct_flipadst_16x16_8bpc_lsx;
c->itxfm_add[TX_16X16][FLIPADST_ADST] = dav1d_inv_txfm_add_adst_flipadst_16x16_8bpc_lsx;
c->itxfm_add[TX_16X16][ADST_FLIPADST] = dav1d_inv_txfm_add_flipadst_adst_16x16_8bpc_lsx;
c->itxfm_add[RTX_8X32][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_8x32_8bpc_lsx;
c->itxfm_add[RTX_16X32][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_16x32_8bpc_lsx;
c->itxfm_add[RTX_32X8][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_32x8_8bpc_lsx;
c->itxfm_add[RTX_32X16][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_32x16_8bpc_lsx;
c->itxfm_add[TX_32X32][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_32x32_8bpc_lsx;
c->itxfm_add[TX_64X64][DCT_DCT] = dav1d_inv_txfm_add_dct_dct_64x64_8bpc_lsx;
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LASX)) return;
if (BITDEPTH != 8 ) return;
c->itxfm_add[TX_16X16][ADST_ADST] = dav1d_inv_txfm_add_adst_adst_16x16_8bpc_lasx;
#endif
}
+1
View File
@@ -59,6 +59,7 @@
.text ;
.align \align ;
.globl ASM_PREF\name ;
.hidden ASM_PREF\name ;
.type ASM_PREF\name, @function ;
ASM_PREF\name: ;
.endm
+192
View File
@@ -0,0 +1,192 @@
/******************************************************************************
* Copyright © 2024, VideoLAN and dav1d authors
* Copyright © 2024, Loongson Technology Corporation Limited
* 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.
*****************************************************************************/
#ifndef DAV1D_SRC_LOONGSON_UTIL_S
#define DAV1D_SRC_LOONGSON_UTIL_S
#ifndef DEFAULT_ALIGN
#define DEFAULT_ALIGN 5
#endif
//That l means local defines local functions
.macro functionl name, align=DEFAULT_ALIGN
.macro endfuncl
jirl $r0, $r1, 0x0
.size \name, . - \name
.purgem endfuncl
.endm
.text ;
.align \align ;
.hidden \name ;
.type \name, @function ;
\name: ;
.endm
.macro TRANSPOSE_4x16B in0, in1 ,in2, in3, in4, in5, in6, in7
vpackev.b \in4, \in1, \in0
vpackod.b \in5, \in1, \in0
vpackev.b \in6, \in3, \in2
vpackod.b \in7, \in3, \in2
vpackev.h \in0, \in6, \in4
vpackod.h \in2, \in6, \in4
vpackev.h \in1, \in7, \in5
vpackod.h \in3, \in7, \in5
.endm
.macro TRANSPOSE_8x16B in0, in1, in2, in3, in4, in5, in6, in7, in8, in9
vpackev.b \in8, \in1, \in0
vpackod.b \in9, \in1, \in0
vpackev.b \in1, \in3, \in2
vpackod.b \in3, \in3, \in2
vpackev.b \in0, \in5, \in4
vpackod.b \in5, \in5, \in4
vpackev.b \in2, \in7, \in6
vpackod.b \in7, \in7, \in6
vpackev.h \in4, \in2, \in0
vpackod.h \in2, \in2, \in0
vpackev.h \in6, \in7, \in5
vpackod.h \in7, \in7, \in5
vpackev.h \in5, \in3, \in9
vpackod.h \in9, \in3, \in9
vpackev.h \in3, \in1, \in8
vpackod.h \in8, \in1, \in8
vpackev.w \in0, \in4, \in3
vpackod.w \in4, \in4, \in3
vpackev.w \in1, \in6, \in5
vpackod.w \in5, \in6, \in5
vpackod.w \in6, \in2, \in8
vpackev.w \in2, \in2, \in8
vpackev.w \in3, \in7, \in9
vpackod.w \in7, \in7, \in9
.endm
.macro vld_x8 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7
vld \in0, \src, \start
vld \in1, \src, \start+(\stride*1)
vld \in2, \src, \start+(\stride*2)
vld \in3, \src, \start+(\stride*3)
vld \in4, \src, \start+(\stride*4)
vld \in5, \src, \start+(\stride*5)
vld \in6, \src, \start+(\stride*6)
vld \in7, \src, \start+(\stride*7)
.endm
.macro vst_x8 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7
vst \in0, \src, \start
vst \in1, \src, \start+(\stride*1)
vst \in2, \src, \start+(\stride*2)
vst \in3, \src, \start+(\stride*3)
vst \in4, \src, \start+(\stride*4)
vst \in5, \src, \start+(\stride*5)
vst \in6, \src, \start+(\stride*6)
vst \in7, \src, \start+(\stride*7)
.endm
.macro vld_x16 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7, \
in8, in9, in10, in11, in12, in13, in14, in15
vld_x8 \src, \start, \stride, \in0, \in1, \in2, \in3, \in4, \in5, \in6, \in7
vld \in8, \src, \start+(\stride*8)
vld \in9, \src, \start+(\stride*9)
vld \in10, \src, \start+(\stride*10)
vld \in11, \src, \start+(\stride*11)
vld \in12, \src, \start+(\stride*12)
vld \in13, \src, \start+(\stride*13)
vld \in14, \src, \start+(\stride*14)
vld \in15, \src, \start+(\stride*15)
.endm
.macro vst_x16 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7, \
in8, in9, in10, in11, in12, in13, in14, in15
vst_x8 \src, \start, \stride, \in0, \in1, \in2, \in3, \in4, \in5, \in6, \in7
vst \in8, \src, \start+(\stride*8)
vst \in9, \src, \start+(\stride*9)
vst \in10, \src, \start+(\stride*10)
vst \in11, \src, \start+(\stride*11)
vst \in12, \src, \start+(\stride*12)
vst \in13, \src, \start+(\stride*13)
vst \in14, \src, \start+(\stride*14)
vst \in15, \src, \start+(\stride*15)
.endm
.macro xvld_x8 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7
xvld \in0, \src, \start
xvld \in1, \src, \start+(\stride)
xvld \in2, \src, \start+(\stride<<1)
xvld \in3, \src, \start+(\stride<<1)+(\stride)
xvld \in4, \src, \start+(\stride<<2)
xvld \in5, \src, \start+(\stride<<2)+(\stride)
xvld \in6, \src, \start+(\stride*6)
xvld \in7, \src, \start+(\stride<<3)-(\stride)
.endm
.macro xvst_x8 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7
xvst \in0, \src, \start
xvst \in1, \src, \start+(\stride)
xvst \in2, \src, \start+(\stride<<1)
xvst \in3, \src, \start+(\stride<<1)+(\stride)
xvst \in4, \src, \start+(\stride<<2)
xvst \in5, \src, \start+(\stride<<2)+(\stride)
xvst \in6, \src, \start+(\stride*6)
xvst \in7, \src, \start+(\stride<<3)-(\stride)
.endm
.macro xvld_x16 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7, \
in8, in9, in10, in11, in12, in13, in14, in15
xvld_x8 \src, \start, \stride, \in0, \in1, \in2, \in3, \in4, \in5, \in6, \in7
xvld \in8, \src, \start+(\stride<<3)
xvld \in9, \src, \start+(\stride<<3)+(\stride)
xvld \in10, \src, \start+(\stride*10)
xvld \in11, \src, \start+(\stride*11)
xvld \in12, \src, \start+(\stride*12)
xvld \in13, \src, \start+(\stride*13)
xvld \in14, \src, \start+(\stride*14)
xvld \in15, \src, \start+(\stride<<4)-(\stride)
.endm
.macro xvst_x16 src, start, stride, in0, in1, in2, in3, in4, in5, in6, in7, \
in8, in9, in10, in11, in12, in13, in14, in15
xvst_x8 \src, \start, \stride, \in0, \in1, \in2, \in3, \in4, \in5, \in6, \in7
xvst \in8, \src, \start+(\stride<<3)
xvst \in9, \src, \start+(\stride<<3)+(\stride)
xvst \in10, \src, \start+(\stride*10)
xvst \in11, \src, \start+(\stride*11)
xvst \in12, \src, \start+(\stride*12)
xvst \in13, \src, \start+(\stride*13)
xvst \in14, \src, \start+(\stride*14)
xvst \in15, \src, \start+(\stride<<4)-(\stride)
.endm
#endif /* DAV1D_SRC_LOONGSON_UTIL_S */
+1148 -1041
View File
File diff suppressed because it is too large Load Diff
+595 -46
View File
@@ -92,13 +92,11 @@ function wiener_filter_h_8bpc_lsx
vsllwil.hu.bu vr15, vr8, 0 // 3 4 5 6 7 8 9 10
vexth.hu.bu vr16, vr8 // 11 12 13 14 15 16 17 18
vsllwil.wu.hu vr17, vr15, 0 // 3 4 5 6
vsllwil.wu.hu vr17, vr15, 7 // 3 4 5 6
vexth.wu.hu vr18, vr15 // 7 8 9 10
vsllwil.wu.hu vr19, vr16, 0 // 11 12 13 14
vsllwil.wu.hu vr19, vr16, 7 // 11 12 13 14
vexth.wu.hu vr20, vr16 // 15 16 17 18
vslli.w vr17, vr17, 7
vslli.w vr18, vr18, 7
vslli.w vr19, vr19, 7
vslli.w vr20, vr20, 7
vxor.v vr15, vr15, vr15
vxor.v vr14, vr14, vr14
@@ -315,30 +313,24 @@ function boxsum3_h_8bpc_lsx
vmulwod.h.bu vr10, vr3, vr3
vmulwev.h.bu vr11, vr5, vr5
vmulwod.h.bu vr12, vr5, vr5
vmul.h vr7, vr7, vr7
vmul.h vr8, vr8, vr8
vaddwev.w.hu vr13, vr10, vr9
vaddwod.w.hu vr14, vr10, vr9
vilvl.w vr3, vr14, vr13
vilvh.w vr4, vr14, vr13
vaddwev.w.hu vr13, vr12, vr11
vaddwod.w.hu vr14, vr12, vr11
vilvl.w vr15, vr14, vr13
vilvh.w vr16, vr14, vr13
vsllwil.wu.hu vr9, vr7, 0
vexth.wu.hu vr10, vr7
vsllwil.wu.hu vr11, vr8, 0
vexth.wu.hu vr12, vr8
vadd.w vr9, vr9, vr3
vadd.w vr10, vr10, vr4
vadd.w vr11, vr11, vr15
vadd.w vr12, vr12, vr16
vaddwev.w.hu vr15, vr12, vr11
vaddwod.w.hu vr16, vr12, vr11
vmaddwev.w.hu vr13, vr7, vr7
vmaddwod.w.hu vr14, vr7, vr7
vmaddwev.w.hu vr15, vr8, vr8
vmaddwod.w.hu vr16, vr8, vr8
vilvl.w vr9, vr14, vr13
vilvh.w vr10, vr14, vr13
vilvl.w vr11, vr16, vr15
vilvh.w vr12, vr16, vr15
vst vr9, t2, REST_UNIT_STRIDE<<2
vst vr10, t2, (REST_UNIT_STRIDE<<2)+16
vst vr11, t2, (REST_UNIT_STRIDE<<2)+32
vst vr12, t2, (REST_UNIT_STRIDE<<2)+48
addi.d t2, t2, 64
addi.d t2, t2, 64
addi.w t5, t5, -16
addi.d t3, t3, 16
blt zero, t5, .LBS3_H_W
@@ -348,8 +340,6 @@ function boxsum3_h_8bpc_lsx
addi.d a2, a2, REST_UNIT_STRIDE
addi.d a4, a4, -1
blt zero, a4, .LBS3_H_H
.LBS3_H_END:
endfunc
/*
@@ -379,10 +369,10 @@ function boxsum3_v_8bpc_lsx
vld vr7, t0, 20 // 4 5 6 7
vld vr8, t0, 24 // 5 6 7 8
vadd.h vr9, vr0, vr1
vadd.h vr9, vr9, vr2
vadd.w vr10, vr3, vr4
vadd.w vr10, vr10, vr5
vadd.w vr11, vr6, vr7
vadd.h vr9, vr9, vr2
vadd.w vr10, vr10, vr5
vadd.w vr11, vr11, vr8
vpickve2gr.h t7, vr2, 6
vpickve2gr.w t8, vr8, 2
@@ -395,7 +385,7 @@ function boxsum3_v_8bpc_lsx
addi.d t5, t5, 32
addi.d t6, t6, 16
addi.d t3, t3, -8
ble t3, zero, .LBS3_V_H0
bge zero, t3, .LBS3_V_H0
.LBS3_V_W8:
vld vr0, t1, 0 // a 0 1 2 3 4 5 6 7
@@ -425,15 +415,13 @@ function boxsum3_v_8bpc_lsx
addi.d t0, t0, 32
addi.d t5, t5, 32
addi.d t6, t6, 16
blt zero, t3, .LBS3_V_W8
blt zero, t3, .LBS3_V_W8
.LBS3_V_H0:
addi.d a1, a1, REST_UNIT_STRIDE<<1
addi.d a0, a0, REST_UNIT_STRIDE<<2
addi.w a3, a3, -1
bnez a3, .LBS3_V_H
.LBS3_V_END:
endfunc
/*
@@ -559,14 +547,14 @@ function boxsum3_sgf_v_8bpc_lsx
.LBS3SGF_V_W:
vld vr0, t0, 0 // P[i - REST_UNIT_STRIDE]
vld vr1, t0, 16
vld vr2, t1, -4 // P[i-1]
vld vr3, t1, 12
vld vr2, t1, -4 // P[i-1] -1 0 1 2
vld vr3, t1, 12 // 3 4 5 6
vld vr4, t2, 0 // P[i + REST_UNIT_STRIDE]
vld vr5, t2, 16
vld vr6, t1, 0 // p[i]
vld vr7, t1, 16
vld vr8, t1, 4 // p[i+1]
vld vr9, t1, 20
vld vr6, t1, 0 // p[i] 0 1 2 3
vld vr7, t1, 16 // 4 5 6 7
vld vr8, t1, 4 // p[i+1] 1 2 3 4
vld vr9, t1, 20 // 5 6 7 8
vld vr10, t0, -4 // P[i - 1 - REST_UNIT_STRIDE]
vld vr11, t0, 12
@@ -666,6 +654,144 @@ function boxsum3_sgf_v_8bpc_lsx
bnez a5, .LBS3SGF_V_H
endfunc
function boxsum3_sgf_v_8bpc_lasx
addi.d a1, a1, (3*REST_UNIT_STRIDE+3) // src
addi.d a2, a2, REST_UNIT_STRIDE<<2
addi.d a2, a2, (REST_UNIT_STRIDE<<2)+12
addi.d a3, a3, REST_UNIT_STRIDE<<2
addi.d a3, a3, 6
.LBS3SGF_V_H_LASX:
// A int32_t *sumsq
addi.d t0, a2, -(REST_UNIT_STRIDE<<2) // -stride
addi.d t1, a2, 0 // sumsq
addi.d t2, a2, REST_UNIT_STRIDE<<2 // +stride
addi.d t6, a1, 0
addi.w t7, a4, 0
addi.d t8, a0, 0
// B coef *sum
addi.d t3, a3, -(REST_UNIT_STRIDE<<1) // -stride
addi.d t4, a3, 0
addi.d t5, a3, REST_UNIT_STRIDE<<1
.LBS3SGF_V_W_LASX:
xvld xr0, t0, 0 // P[i - REST_UNIT_STRIDE]
xvld xr1, t0, 32
xvld xr2, t1, -4 // P[i-1] -1 0 1 2
xvld xr3, t1, 28 // 3 4 5 6
xvld xr4, t2, 0 // P[i + REST_UNIT_STRIDE]
xvld xr5, t2, 32
xvld xr6, t1, 0 // p[i] 0 1 2 3
xvld xr7, t1, 32 // 4 5 6 7
xvld xr8, t1, 4 // p[i+1] 1 2 3 4
xvld xr9, t1, 36 // 5 6 7 8
xvld xr10, t0, -4 // P[i - 1 - REST_UNIT_STRIDE]
xvld xr11, t0, 28
xvld xr12, t2, -4 // P[i - 1 + REST_UNIT_STRIDE]
xvld xr13, t2, 28
xvld xr14, t0, 4 // P[i + 1 - REST_UNIT_STRIDE]
xvld xr15, t0, 36
xvld xr16, t2, 4 // P[i + 1 + REST_UNIT_STRIDE]
xvld xr17, t2, 36
xvadd.w xr0, xr2, xr0
xvadd.w xr4, xr6, xr4
xvadd.w xr0, xr0, xr8
xvadd.w xr20, xr0, xr4
xvslli.w xr20, xr20, 2 // 0 1 2 3
xvadd.w xr0, xr1, xr3
xvadd.w xr4, xr5, xr7
xvadd.w xr0, xr0, xr9
xvadd.w xr21, xr0, xr4
xvslli.w xr21, xr21, 2 // 4 5 6 7
xvadd.w xr12, xr10, xr12
xvadd.w xr16, xr14, xr16
xvadd.w xr22, xr12, xr16
xvslli.w xr23, xr22, 1
xvadd.w xr22, xr23, xr22
xvadd.w xr11, xr11, xr13
xvadd.w xr15, xr15, xr17
xvadd.w xr0, xr11, xr15
xvslli.w xr23, xr0, 1
xvadd.w xr23, xr23, xr0
xvadd.w xr20, xr20, xr22 // b
xvadd.w xr21, xr21, xr23
// B coef *sum
xvld xr0, t3, 0 // P[i - REST_UNIT_STRIDE]
xvld xr1, t4, -2 // p[i - 1]
xvld xr2, t4, 0 // p[i]
xvld xr3, t4, 2 // p[i + 1]
xvld xr4, t5, 0 // P[i + REST_UNIT_STRIDE]
xvld xr5, t3, -2 // P[i - 1 - REST_UNIT_STRIDE]
xvld xr6, t5, -2 // P[i - 1 + REST_UNIT_STRIDE]
xvld xr7, t3, 2 // P[i + 1 - REST_UNIT_STRIDE]
xvld xr8, t5, 2 // P[i + 1 + REST_UNIT_STRIDE]
xvaddwev.w.h xr9, xr0, xr1
xvaddwod.w.h xr10, xr0, xr1
xvaddwev.w.h xr11, xr2, xr3
xvaddwod.w.h xr12, xr2, xr3
xvadd.w xr9, xr11, xr9 // 0 2 4 6 8 10 12 14
xvadd.w xr10, xr12, xr10 // 1 3 5 7 9 11 13 15
xvilvl.w xr11, xr10, xr9 // 0 1 2 3 8 9 10 11
xvilvh.w xr12, xr10, xr9 // 4 5 6 7 12 13 14 15
xvsllwil.w.h xr0, xr4, 0 // 0 1 2 3 8 9 10 11
xvexth.w.h xr1, xr4 // 4 5 6 7 12 13 14 15
xvadd.w xr0, xr11, xr0
xvadd.w xr1, xr12, xr1
xvslli.w xr0, xr0, 2
xvslli.w xr1, xr1, 2
xvaddwev.w.h xr9, xr5, xr6
xvaddwod.w.h xr10, xr5, xr6
xvaddwev.w.h xr11, xr7, xr8
xvaddwod.w.h xr12, xr7, xr8
xvadd.w xr9, xr11, xr9
xvadd.w xr10, xr12, xr10
xvilvl.w xr13, xr10, xr9 // 0 1 2 3 8 9 10 11
xvilvh.w xr14, xr10, xr9 // 4 5 6 7 12 13 14 15
xvslli.w xr15, xr13, 1
xvslli.w xr16, xr14, 1
xvadd.w xr15, xr13, xr15 // a
xvadd.w xr16, xr14, xr16
xvadd.w xr22, xr0, xr15 // A B
xvadd.w xr23, xr1, xr16 // C D
vld vr0, t6, 0 // src
vilvh.d vr2, vr0, vr0
vext2xv.wu.bu xr1, xr0
vext2xv.wu.bu xr2, xr2
xvor.v xr15, xr22, xr22 // A B
xvpermi.q xr22, xr23, 0b00000010 // A C
xvpermi.q xr23, xr15, 0b00110001
xvmadd.w xr20, xr22, xr1
xvmadd.w xr21, xr23, xr2
xvssrlrni.h.w xr21, xr20, 9
xvpermi.d xr22, xr21, 0b11011000
xvst xr22, t8, 0
addi.d t8, t8, 32
addi.d t0, t0, 64
addi.d t1, t1, 64
addi.d t2, t2, 64
addi.d t3, t3, 32
addi.d t4, t4, 32
addi.d t5, t5, 32
addi.d t6, t6, 16
addi.w t7, t7, -16
blt zero, t7, .LBS3SGF_V_W_LASX
addi.w a5, a5, -1
addi.d a0, a0, 384*2
addi.d a1, a1, REST_UNIT_STRIDE
addi.d a3, a3, REST_UNIT_STRIDE<<1
addi.d a2, a2, REST_UNIT_STRIDE<<2
bnez a5, .LBS3SGF_V_H_LASX
endfunc
#define FILTER_OUT_STRIDE (384)
/*
@@ -835,20 +961,15 @@ function boxsum5_h_8bpc_lsx
vadd.w vr6, vr6, vr20
vadd.w vr7, vr7, vr21
vadd.w vr8, vr8, vr22
vmaddwev.w.hu vr5, vr11, vr11
vmaddwod.w.hu vr6, vr11, vr11
vmaddwev.w.hu vr7, vr12, vr12
vmaddwod.w.hu vr8, vr12, vr12
vilvl.w vr19, vr6, vr5
vilvh.w vr20, vr6, vr5
vilvl.w vr21, vr8, vr7
vilvh.w vr22, vr8, vr7
vmul.h vr11, vr11, vr11
vmul.h vr12, vr12, vr12
vsllwil.wu.hu vr0, vr11, 0
vexth.wu.hu vr1, vr11
vsllwil.wu.hu vr2, vr12, 0
vexth.wu.hu vr3, vr12
vadd.w vr19, vr19, vr0
vadd.w vr20, vr20, vr1
vadd.w vr21, vr21, vr2
vadd.w vr22, vr22, vr3
vst vr19, t0, 0
vst vr20, t0, 16
vst vr21, t0, 32
@@ -921,7 +1042,7 @@ function boxsum5_v_8bpc_lsx
addi.d t0, t0, 32
addi.d t2, t2, 32
addi.w t4, t4, -8
ble t4, zero, .LBOXSUM5_V_H1
bge zero, t4, .LBOXSUM5_V_H1
.LBOXSUM5_V_W:
vld vr0, t1, 0 // a 0 1 2 3 4 5 6 7
@@ -1405,3 +1526,431 @@ function sgr_mix_finish_8bpc_lsx
.LSGR_MIX_END:
endfunc
.macro MADD_HU_BU_LASX in0, in1, out0, out1
xvsllwil.hu.bu xr12, \in0, 0
xvexth.hu.bu xr13, \in0
xvmadd.h \out0, xr12, \in1
xvmadd.h \out1, xr13, \in1
.endm
const wiener_shuf_lasx
.byte 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
.byte 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
endconst
function wiener_filter_h_8bpc_lasx
addi.d sp, sp, -40
fst.d f24, sp, 0
fst.d f25, sp, 8
fst.d f26, sp, 16
fst.d f27, sp, 24
fst.d f28, sp, 32
li.w t7, 1<<14 // clip_limit
la.local t1, wiener_shuf_lasx
xvld xr4, t1, 0
vld vr27, a2, 0 // filter[0][k]
xvpermi.q xr14, xr27, 0b00000000
xvrepl128vei.h xr21, xr14, 0
xvrepl128vei.h xr22, xr14, 1
xvrepl128vei.h xr23, xr14, 2
xvrepl128vei.h xr24, xr14, 3
xvrepl128vei.h xr25, xr14, 4
xvrepl128vei.h xr26, xr14, 5
xvrepl128vei.h xr27, xr14, 6
xvreplgr2vr.w xr0, t7
.WIENER_FILTER_H_H_LASX:
addi.w a4, a4, -1 // h
addi.w t0, a3, 0 // w
addi.d t1, a1, 0 // tmp_ptr
addi.d t2, a0, 0 // hor_ptr
.WIENER_FILTER_H_W_LASX:
addi.w t0, t0, -32
xvld xr5, t1, 0
xvld xr13, t1, 16
xvsubi.bu xr14, xr4, 2
xvsubi.bu xr15, xr4, 1
xvshuf.b xr6, xr13, xr5, xr14 // 1 ... 8, 9 ... 16
xvshuf.b xr7, xr13, xr5, xr15 // 2 ... 9, 10 ... 17
xvshuf.b xr8, xr13, xr5, xr4 // 3 ... 10, 11 ... 18
xvaddi.bu xr14, xr4, 1
xvaddi.bu xr15, xr4, 2
xvshuf.b xr9, xr13, xr5, xr14 // 4 ... 11, 12 ... 19
xvshuf.b xr10, xr13, xr5, xr15 // 5 ... 12, 13 ... 20
xvaddi.bu xr14, xr4, 3
xvshuf.b xr11, xr13, xr5, xr14 // 6 ... 13, 14 ... 21
xvsllwil.hu.bu xr15, xr8, 0 // 3 4 5 6 7 8 9 10
xvexth.hu.bu xr16, xr8 // 11 12 13 14 15 16 17 18
xvsllwil.wu.hu xr17, xr15, 7 // 3 4 5 6
xvexth.wu.hu xr18, xr15 // 7 8 9 10
xvsllwil.wu.hu xr19, xr16, 7 // 11 12 13 14
xvexth.wu.hu xr20, xr16 // 15 16 17 18
xvslli.w xr18, xr18, 7
xvslli.w xr20, xr20, 7
xvxor.v xr15, xr15, xr15
xvxor.v xr14, xr14, xr14
MADD_HU_BU_LASX xr5, xr21, xr14, xr15
MADD_HU_BU_LASX xr6, xr22, xr14, xr15
MADD_HU_BU_LASX xr7, xr23, xr14, xr15
MADD_HU_BU_LASX xr8, xr24, xr14, xr15
MADD_HU_BU_LASX xr9, xr25, xr14, xr15
MADD_HU_BU_LASX xr10, xr26, xr14, xr15
MADD_HU_BU_LASX xr11, xr27, xr14, xr15
xvsllwil.w.h xr5, xr14, 0 // 0 1 2 3
xvexth.w.h xr6, xr14 // 4 5 6 7
xvsllwil.w.h xr7, xr15, 0 // 8 9 10 11
xvexth.w.h xr8, xr15 // 12 13 14 15
xvadd.w xr17, xr17, xr5
xvadd.w xr18, xr18, xr6
xvadd.w xr19, xr19, xr7
xvadd.w xr20, xr20, xr8
xvadd.w xr17, xr17, xr0
xvadd.w xr18, xr18, xr0
xvadd.w xr19, xr19, xr0
xvadd.w xr20, xr20, xr0
xvsrli.w xr1, xr0, 1
xvsubi.wu xr1, xr1, 1
xvxor.v xr3, xr3, xr3
xvsrari.w xr17, xr17, 3
xvsrari.w xr18, xr18, 3
xvsrari.w xr19, xr19, 3
xvsrari.w xr20, xr20, 3
xvclip.w xr17, xr17, xr3, xr1
xvclip.w xr18, xr18, xr3, xr1
xvclip.w xr19, xr19, xr3, xr1
xvclip.w xr20, xr20, xr3, xr1
xvor.v xr5, xr17, xr17
xvor.v xr6, xr19, xr19
xvpermi.q xr17, xr18, 0b00000010
xvpermi.q xr19, xr20, 0b00000010
xvst xr17, t2, 0
xvst xr19, t2, 32
xvpermi.q xr18, xr5, 0b00110001
xvpermi.q xr20, xr6, 0b00110001
xvst xr18, t2, 64
xvst xr20, t2, 96
addi.d t1, t1, 32
addi.d t2, t2, 128
blt zero, t0, .WIENER_FILTER_H_W_LASX
addi.d a1, a1, REST_UNIT_STRIDE
addi.d a0, a0, (REST_UNIT_STRIDE << 2)
bnez a4, .WIENER_FILTER_H_H_LASX
fld.d f24, sp, 0
fld.d f25, sp, 8
fld.d f26, sp, 16
fld.d f27, sp, 24
fld.d f28, sp, 32
addi.d sp, sp, 40
endfunc
.macro APPLY_FILTER_LASX in0, in1, in2
alsl.d t7, \in0, \in1, 2
xvld xr10, t7, 0
xvld xr12, t7, 32
xvmadd.w xr14, xr10, \in2
xvmadd.w xr16, xr12, \in2
.endm
.macro wiener_filter_v_8bpc_core_lasx
xvreplgr2vr.w xr14, t6
xvreplgr2vr.w xr16, t6
addi.w t7, t2, 0 // j + index k
mul.w t7, t7, t8 // (j + index) * REST_UNIT_STRIDE
add.w t7, t7, t4 // (j + index) * REST_UNIT_STRIDE + i
APPLY_FILTER_LASX t7, a2, xr2
APPLY_FILTER_LASX t8, t7, xr3
APPLY_FILTER_LASX t8, t7, xr4
APPLY_FILTER_LASX t8, t7, xr5
APPLY_FILTER_LASX t8, t7, xr6
APPLY_FILTER_LASX t8, t7, xr7
APPLY_FILTER_LASX t8, t7, xr8
xvssrarni.hu.w xr16, xr14, 11
xvpermi.d xr17, xr16, 0b11011000
xvssrlni.bu.h xr17, xr17, 0
xvpermi.d xr17, xr17, 0b00001000
.endm
function wiener_filter_v_8bpc_lasx
li.w t6, -(1 << 18)
li.w t8, REST_UNIT_STRIDE
ld.h t0, a3, 0
ld.h t1, a3, 2
xvreplgr2vr.w xr2, t0
xvreplgr2vr.w xr3, t1
ld.h t0, a3, 4
ld.h t1, a3, 6
xvreplgr2vr.w xr4, t0
xvreplgr2vr.w xr5, t1
ld.h t0, a3, 8
ld.h t1, a3, 10
xvreplgr2vr.w xr6, t0
xvreplgr2vr.w xr7, t1
ld.h t0, a3, 12
xvreplgr2vr.w xr8, t0
andi t1, a4, 0xf
sub.w t0, a4, t1 // w-w%16
or t2, zero, zero // j
or t4, zero, zero
beqz t0, .WIENER_FILTER_V_W_LT16_LASX
.WIENER_FILTER_V_H_LASX:
andi t1, a4, 0xf
add.d t3, zero, a0 // p
or t4, zero, zero // i
.WIENER_FILTER_V_W_LASX:
wiener_filter_v_8bpc_core_lasx
mul.w t5, t2, a1 // j * stride
add.w t5, t5, t4 // j * stride + i
add.d t3, a0, t5
addi.w t4, t4, 16
vst vr17, t3, 0
bne t0, t4, .WIENER_FILTER_V_W_LASX
beqz t1, .WIENER_FILTER_V_W_EQ16_LASX
wiener_filter_v_8bpc_core_lsx
addi.d t3, t3, 16
andi t1, a4, 0xf
.WIENER_FILTER_V_ST_REM_LASX:
vstelm.b vr17, t3, 0, 0
vbsrl.v vr17, vr17, 1
addi.d t3, t3, 1
addi.w t1, t1, -1
bnez t1, .WIENER_FILTER_V_ST_REM_LASX
.WIENER_FILTER_V_W_EQ16_LASX:
addi.w t2, t2, 1
blt t2, a5, .WIENER_FILTER_V_H_LASX
b .WIENER_FILTER_V_LASX_END
.WIENER_FILTER_V_W_LT16_LASX:
andi t1, a4, 0xf
add.d t3, zero, a0
wiener_filter_v_8bpc_core_lsx
mul.w t5, t2, a1 // j * stride
add.d t3, a0, t5
.WIENER_FILTER_V_ST_REM_1_LASX:
vstelm.b vr17, t3, 0, 0
vbsrl.v vr17, vr17, 1
addi.d t3, t3, 1
addi.w t1, t1, -1
bnez t1, .WIENER_FILTER_V_ST_REM_1_LASX
addi.w t2, t2, 1
blt t2, a5, .WIENER_FILTER_V_W_LT16_LASX
.WIENER_FILTER_V_LASX_END:
endfunc
function boxsum3_sgf_h_8bpc_lasx
addi.d a0, a0, (REST_UNIT_STRIDE<<2)+12 // AA
//addi.d a0, a0, 12 // AA
addi.d a1, a1, (REST_UNIT_STRIDE<<1)+6 // BB
//addi.d a1, a1, 6 // BB
la.local t8, dav1d_sgr_x_by_x
li.w t6, 455
xvreplgr2vr.w xr20, t6
li.w t6, 255
xvreplgr2vr.w xr22, t6
xvaddi.wu xr21, xr22, 1 // 256
xvreplgr2vr.w xr6, a4
xvldi xr19, 0x809
addi.w a2, a2, 2 // w + 2
addi.w a3, a3, 2 // h + 2
.LBS3SGF_H_H_LASX:
addi.w t2, a2, 0
addi.d t0, a0, -4
addi.d t1, a1, -2
.LBS3SGF_H_W_LASX:
addi.w t2, t2, -16
xvld xr0, t0, 0 // AA[i]
xvld xr1, t0, 32
xvld xr2, t1, 0 // BB[i]
xvmul.w xr4, xr0, xr19 // a * n
xvmul.w xr5, xr1, xr19
vext2xv.w.h xr9, xr2
xvpermi.q xr10, xr2, 0b00000001
vext2xv.w.h xr10, xr10
xvmsub.w xr4, xr9, xr9 // p
xvmsub.w xr5, xr10, xr10
xvmaxi.w xr4, xr4, 0
xvmaxi.w xr5, xr5, 0
xvmul.w xr4, xr4, xr6 // p * s
xvmul.w xr5, xr5, xr6
xvsrlri.w xr4, xr4, 20
xvsrlri.w xr5, xr5, 20
xvmin.w xr4, xr4, xr22
xvmin.w xr5, xr5, xr22
vpickve2gr.w t6, vr4, 0
ldx.bu t7, t8, t6
vinsgr2vr.w vr7, t7, 0
vpickve2gr.w t6, vr4, 1
ldx.bu t7, t8, t6
vinsgr2vr.w vr7, t7, 1
vpickve2gr.w t6, vr4, 2
ldx.bu t7, t8, t6
vinsgr2vr.w vr7, t7, 2
vpickve2gr.w t6, vr4, 3
ldx.bu t7, t8, t6
vinsgr2vr.w vr7, t7, 3
xvpickve2gr.w t6, xr4, 4
ldx.bu t7, t8, t6
xvinsgr2vr.w xr7, t7, 4
xvpickve2gr.w t6, xr4, 5
ldx.bu t7, t8, t6
xvinsgr2vr.w xr7, t7, 5
xvpickve2gr.w t6, xr4, 6
ldx.bu t7, t8, t6
xvinsgr2vr.w xr7, t7, 6
xvpickve2gr.w t6, xr4, 7
ldx.bu t7, t8, t6
xvinsgr2vr.w xr7, t7, 7 // x
vpickve2gr.w t6, vr5, 0
ldx.bu t7, t8, t6
vinsgr2vr.w vr8, t7, 0
vpickve2gr.w t6, vr5, 1
ldx.bu t7, t8, t6
vinsgr2vr.w vr8, t7, 1
vpickve2gr.w t6, vr5, 2
ldx.bu t7, t8, t6
vinsgr2vr.w vr8, t7, 2
vpickve2gr.w t6, vr5, 3
ldx.bu t7, t8, t6
vinsgr2vr.w vr8, t7, 3
xvpickve2gr.w t6, xr5, 4
ldx.bu t7, t8, t6
xvinsgr2vr.w xr8, t7, 4
xvpickve2gr.w t6, xr5, 5
ldx.bu t7, t8, t6
xvinsgr2vr.w xr8, t7, 5
xvpickve2gr.w t6, xr5, 6
ldx.bu t7, t8, t6
xvinsgr2vr.w xr8, t7, 6
xvpickve2gr.w t6, xr5, 7
ldx.bu t7, t8, t6
xvinsgr2vr.w xr8, t7, 7 // x
xvmul.w xr9, xr7, xr9 // x * BB[i]
xvmul.w xr10, xr8, xr10
xvmul.w xr9, xr9, xr20 // x * BB[i] * sgr_one_by_x
xvmul.w xr10, xr10, xr20
xvsrlri.w xr9, xr9, 12
xvsrlri.w xr10, xr10, 12
xvsub.w xr7, xr21, xr7
xvsub.w xr8, xr21, xr8
xvpickev.h xr12, xr8, xr7
xvpermi.d xr11, xr12, 0b11011000
xvst xr9, t0, 0
xvst xr10, t0, 32
xvst xr11, t1, 0
addi.d t0, t0, 64
addi.d t1, t1, 32
blt zero, t2, .LBS3SGF_H_W_LASX
addi.d a0, a0, REST_UNIT_STRIDE<<2
addi.d a1, a1, REST_UNIT_STRIDE<<1
addi.w a3, a3, -1
bnez a3, .LBS3SGF_H_H_LASX
endfunc
function boxsum3_h_8bpc_lasx
addi.d a2, a2, REST_UNIT_STRIDE
li.w t0, 1
addi.w a3, a3, -2
addi.w a4, a4, -4
.LBS3_H_H_LASX:
alsl.d t1, t0, a1, 1 // sum_v *sum_v = sum + x
alsl.d t2, t0, a0, 2 // sumsq_v *sumsq_v = sumsq + x
add.d t3, t0, a2 // s
addi.w t5, a3, 0
.LBS3_H_W_LASX:
xvld xr0, t3, 0
xvld xr1, t3, REST_UNIT_STRIDE
xvld xr2, t3, (REST_UNIT_STRIDE<<1)
xvilvl.b xr3, xr1, xr0
xvhaddw.hu.bu xr4, xr3, xr3
xvilvh.b xr5, xr1, xr0
xvhaddw.hu.bu xr6, xr5, xr5
xvsllwil.hu.bu xr7, xr2, 0
xvexth.hu.bu xr8, xr2
// sum_v
xvadd.h xr4, xr4, xr7 // 0 2
xvadd.h xr6, xr6, xr8 // 1 3
xvor.v xr9, xr4, xr4
xvpermi.q xr4, xr6, 0b00000010
xvpermi.q xr6, xr9, 0b00110001
xvst xr4, t1, REST_UNIT_STRIDE<<1
xvst xr6, t1, (REST_UNIT_STRIDE<<1)+32
addi.d t1, t1, 64
// sumsq
xvmulwev.h.bu xr9, xr3, xr3
xvmulwod.h.bu xr10, xr3, xr3
xvmulwev.h.bu xr11, xr5, xr5
xvmulwod.h.bu xr12, xr5, xr5
xvaddwev.w.hu xr13, xr10, xr9
xvaddwod.w.hu xr14, xr10, xr9
xvaddwev.w.hu xr15, xr12, xr11
xvaddwod.w.hu xr16, xr12, xr11
xvmaddwev.w.hu xr13, xr7, xr7
xvmaddwod.w.hu xr14, xr7, xr7
xvmaddwev.w.hu xr15, xr8, xr8
xvmaddwod.w.hu xr16, xr8, xr8
xvilvl.w xr9, xr14, xr13
xvilvh.w xr10, xr14, xr13
xvilvl.w xr11, xr16, xr15
xvilvh.w xr12, xr16, xr15
xvor.v xr7, xr9, xr9
xvor.v xr8, xr11, xr11
xvpermi.q xr9, xr10, 0b00000010
xvpermi.q xr10, xr7, 0b00110001
xvpermi.q xr11, xr12, 0b00000010
xvpermi.q xr12, xr8, 0b00110001
xvst xr9, t2, REST_UNIT_STRIDE<<2
xvst xr11, t2, (REST_UNIT_STRIDE<<2)+32
xvst xr10, t2, (REST_UNIT_STRIDE<<2)+64
xvst xr12, t2, (REST_UNIT_STRIDE<<2)+96
addi.d t2, t2, 128
addi.w t5, t5, -32
addi.d t3, t3, 32
blt zero, t5, .LBS3_H_W_LASX
addi.d a0, a0, REST_UNIT_STRIDE<<2
addi.d a1, a1, REST_UNIT_STRIDE<<1
addi.d a2, a2, REST_UNIT_STRIDE
addi.d a4, a4, -1
blt zero, a4, .LBS3_H_H_LASX
endfunc
+29
View File
@@ -39,6 +39,13 @@ void dav1d_wiener_filter_lsx(uint8_t *p, const ptrdiff_t stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
void dav1d_wiener_filter_lasx(uint8_t *p, const ptrdiff_t stride,
const uint8_t (*const left)[4],
const uint8_t *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
void dav1d_sgr_filter_3x3_lsx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
@@ -46,6 +53,13 @@ void dav1d_sgr_filter_3x3_lsx(pixel *p, const ptrdiff_t p_stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
void dav1d_sgr_filter_3x3_lasx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
void dav1d_sgr_filter_5x5_lsx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
@@ -60,6 +74,13 @@ void dav1d_sgr_filter_mix_lsx(pixel *p, const ptrdiff_t p_stride,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
void dav1d_sgr_filter_mix_lasx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX);
static ALWAYS_INLINE void loop_restoration_dsp_init_loongarch(Dav1dLoopRestorationDSPContext *const c, int bpc)
{
const unsigned flags = dav1d_get_cpu_flags();
@@ -73,6 +94,14 @@ static ALWAYS_INLINE void loop_restoration_dsp_init_loongarch(Dav1dLoopRestorati
c->sgr[1] = dav1d_sgr_filter_3x3_lsx;
c->sgr[2] = dav1d_sgr_filter_mix_lsx;
#endif
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LASX)) return;
#if BITDEPTH == 8
c->wiener[0] = c->wiener[1] = dav1d_wiener_filter_lasx;
c->sgr[1] = dav1d_sgr_filter_3x3_lasx;
#endif
}
#endif /* DAV1D_SRC_LOONGARCH_LOOPRESTORATION_H */
@@ -36,12 +36,23 @@ void BF(dav1d_wiener_filter_h, lsx)(int32_t *hor_ptr,
const int16_t filterh[8],
const int w, const int h);
void BF(dav1d_wiener_filter_h, lasx)(int32_t *hor_ptr,
uint8_t *tmp_ptr,
const int16_t filterh[8],
const int w, const int h);
void BF(dav1d_wiener_filter_v, lsx)(uint8_t *p,
const ptrdiff_t p_stride,
const int32_t *hor,
const int16_t filterv[8],
const int w, const int h);
void BF(dav1d_wiener_filter_v, lasx)(uint8_t *p,
const ptrdiff_t p_stride,
const int32_t *hor,
const int16_t filterv[8],
const int w, const int h);
// This function refers to the function in the ppc/looprestoration_init_tmpl.c.
static inline void padding(uint8_t *dst, const uint8_t *p,
const ptrdiff_t stride, const uint8_t (*left)[4],
@@ -156,20 +167,46 @@ void dav1d_wiener_filter_lsx(uint8_t *p, const ptrdiff_t p_stride,
BF(dav1d_wiener_filter_v, lsx)(p, p_stride, hor, filter[1], w, h);
}
void dav1d_wiener_filter_lasx(uint8_t *p, const ptrdiff_t p_stride,
const uint8_t (*const left)[4],
const uint8_t *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
const int16_t (*const filter)[8] = params->filter;
// Wiener filtering is applied to a maximum stripe height of 64 + 3 pixels
// of padding above and below
ALIGN_STK_16(uint8_t, tmp, 70 /*(64 + 3 + 3)*/ * REST_UNIT_STRIDE,);
padding(tmp, p, p_stride, left, lpf, w, h, edges);
ALIGN_STK_16(int32_t, hor, 70 /*(64 + 3 + 3)*/ * REST_UNIT_STRIDE + 64,);
BF(dav1d_wiener_filter_h, lasx)(hor, tmp, filter[0], w, h + 6);
BF(dav1d_wiener_filter_v, lasx)(p, p_stride, hor, filter[1], w, h);
}
void BF(dav1d_boxsum3_h, lsx)(int32_t *sumsq, int16_t *sum, pixel *src,
const int w, const int h);
void BF(dav1d_boxsum3_v, lsx)(int32_t *sumsq, int16_t *sum,
const int w, const int h);
void BF(dav1d_boxsum3_sgf_h, lsx)(int32_t *sumsq, int16_t *sum,
const int w, const int h, const int w1);
const int w, const int h, const int w1);
void BF(dav1d_boxsum3_sgf_v, lsx)(int16_t *dst, uint8_t *tmp,
int32_t *sumsq, int16_t *sum,
const int w, const int h);
int32_t *sumsq, int16_t *sum,
const int w, const int h);
void BF(dav1d_sgr_3x3_finish, lsx)(pixel *p, const ptrdiff_t p_stride,
int16_t *dst, int w1,
const int w, const int h);
int16_t *dst, int w1,
const int w, const int h);
void BF(dav1d_boxsum3_h, lasx)(int32_t *sumsq, int16_t *sum, pixel *src,
const int w, const int h);
void BF(dav1d_boxsum3_sgf_h, lasx)(int32_t *sumsq, int16_t *sum,
const int w, const int h, const int w1);
void BF(dav1d_boxsum3_sgf_v, lasx)(int16_t *dst, uint8_t *tmp,
int32_t *sumsq, int16_t *sum,
const int w, const int h);
static inline void boxsum3_lsx(int32_t *sumsq, coef *sum, pixel *src,
const int w, const int h)
@@ -178,6 +215,13 @@ static inline void boxsum3_lsx(int32_t *sumsq, coef *sum, pixel *src,
BF(dav1d_boxsum3_v, lsx)(sumsq, sum, w + 6, h + 6);
}
static inline void boxsum3_lasx(int32_t *sumsq, coef *sum, pixel *src,
const int w, const int h)
{
BF(dav1d_boxsum3_h, lasx)(sumsq, sum, src, w + 6, h + 6);
BF(dav1d_boxsum3_v, lsx)(sumsq, sum, w + 6, h + 6);
}
void dav1d_sgr_filter_3x3_lsx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
@@ -198,6 +242,26 @@ void dav1d_sgr_filter_3x3_lsx(pixel *p, const ptrdiff_t p_stride,
BF(dav1d_sgr_3x3_finish, lsx)(p, p_stride, dst, params->sgr.w1, w, h);
}
void dav1d_sgr_filter_3x3_lasx(pixel *p, const ptrdiff_t p_stride,
const pixel (*const left)[4],
const pixel *lpf,
const int w, const int h,
const LooprestorationParams *const params,
const enum LrEdgeFlags edges HIGHBD_DECL_SUFFIX)
{
ALIGN_STK_16(uint8_t, tmp, 70 /*(64 + 3 + 3)*/ * REST_UNIT_STRIDE,);
padding(tmp, p, p_stride, left, lpf, w, h, edges);
coef dst[64 * 384];
ALIGN_STK_16(int32_t, sumsq, 68 * REST_UNIT_STRIDE + 8, );
ALIGN_STK_16(int16_t, sum, 68 * REST_UNIT_STRIDE + 16, );
boxsum3_lasx(sumsq, sum, tmp, w, h);
BF(dav1d_boxsum3_sgf_h, lasx)(sumsq, sum, w, h, params->sgr.s1);
BF(dav1d_boxsum3_sgf_v, lasx)(dst, tmp, sumsq, sum, w, h);
BF(dav1d_sgr_3x3_finish, lsx)(p, p_stride, dst, params->sgr.w1, w, h);
}
void BF(dav1d_boxsum5_h, lsx)(int32_t *sumsq, int16_t *sum,
const uint8_t *const src,
const int w, const int h);
+3164 -1777
View File
File diff suppressed because it is too large Load Diff
+14 -36
View File
@@ -43,16 +43,12 @@ decl_mask_fn(BF(dav1d_mask, lsx));
decl_warp8x8_fn(BF(dav1d_warp_affine_8x8, lsx));
decl_warp8x8t_fn(BF(dav1d_warp_affine_8x8t, lsx));
decl_w_mask_fn(BF(dav1d_w_mask_420, lsx));
decl_blend_fn(BF(dav1d_blend, lsx));
decl_blend_dir_fn(BF(dav1d_blend_v, lsx));
decl_blend_dir_fn(BF(dav1d_blend_h, lsx));
decl_emu_edge_fn(BF(dav1d_emu_edge, lsx));
decl_mc_fn(BF(dav1d_put_8tap_regular, lsx));
decl_mc_fn(BF(dav1d_put_8tap_regular_smooth, lsx));
decl_mc_fn(BF(dav1d_put_8tap_regular_sharp, lsx));
decl_mc_fn(BF(dav1d_put_8tap_smooth, lsx));
decl_mc_fn(BF(dav1d_put_8tap_smooth_regular, lsx));
decl_mc_fn(BF(dav1d_put_8tap_smooth_sharp, lsx));
decl_mc_fn(BF(dav1d_put_8tap_sharp, lsx));
decl_mc_fn(BF(dav1d_put_8tap_sharp_regular, lsx));
decl_mc_fn(BF(dav1d_put_8tap_sharp_smooth, lsx));
decl_8tap_fns(lsx);
decl_avg_fn(BF(dav1d_avg, lasx));
decl_w_avg_fn(BF(dav1d_w_avg, lasx));
@@ -60,16 +56,9 @@ decl_mask_fn(BF(dav1d_mask, lasx));
decl_warp8x8_fn(BF(dav1d_warp_affine_8x8, lasx));
decl_warp8x8t_fn(BF(dav1d_warp_affine_8x8t, lasx));
decl_w_mask_fn(BF(dav1d_w_mask_420, lasx));
decl_blend_dir_fn(BF(dav1d_blend_h, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_regular, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_regular_smooth, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_regular_sharp, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_smooth, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_smooth_regular, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_smooth_sharp, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_sharp, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_sharp_regular, lasx));
decl_mct_fn(BF(dav1d_prep_8tap_sharp_smooth, lasx));
decl_8tap_gen(mct, prep, lasx);
static ALWAYS_INLINE void mc_dsp_init_loongarch(Dav1dMCDSPContext *const c) {
#if BITDEPTH == 8
@@ -83,16 +72,12 @@ static ALWAYS_INLINE void mc_dsp_init_loongarch(Dav1dMCDSPContext *const c) {
c->warp8x8 = BF(dav1d_warp_affine_8x8, lsx);
c->warp8x8t = BF(dav1d_warp_affine_8x8t, lsx);
c->w_mask[2] = BF(dav1d_w_mask_420, lsx);
c->blend = BF(dav1d_blend, lsx);
c->blend_v = BF(dav1d_blend_v, lsx);
c->blend_h = BF(dav1d_blend_h, lsx);
c->emu_edge = BF(dav1d_emu_edge, lsx);
init_mc_fn(FILTER_2D_8TAP_REGULAR, 8tap_regular, lsx);
init_mc_fn(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth, lsx);
init_mc_fn(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp, lsx);
init_mc_fn(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular, lsx);
init_mc_fn(FILTER_2D_8TAP_SMOOTH, 8tap_smooth, lsx);
init_mc_fn(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp, lsx);
init_mc_fn(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular, lsx);
init_mc_fn(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth, lsx);
init_mc_fn(FILTER_2D_8TAP_SHARP, 8tap_sharp, lsx);
init_8tap_fns(lsx);
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LASX)) return;
@@ -102,16 +87,9 @@ static ALWAYS_INLINE void mc_dsp_init_loongarch(Dav1dMCDSPContext *const c) {
c->warp8x8 = BF(dav1d_warp_affine_8x8, lasx);
c->warp8x8t = BF(dav1d_warp_affine_8x8t, lasx);
c->w_mask[2] = BF(dav1d_w_mask_420, lasx);
c->blend_h = BF(dav1d_blend_h, lasx);
init_mct_fn(FILTER_2D_8TAP_REGULAR, 8tap_regular, lasx);
init_mct_fn(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth, lasx);
init_mct_fn(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp, lasx);
init_mct_fn(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular, lasx);
init_mct_fn(FILTER_2D_8TAP_SMOOTH, 8tap_smooth, lasx);
init_mct_fn(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp, lasx);
init_mct_fn(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular, lasx);
init_mct_fn(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth, lasx);
init_mct_fn(FILTER_2D_8TAP_SHARP, 8tap_sharp, lasx);
init_8tap_gen(mct, lasx);
#endif
}
+262 -26
View File
@@ -31,28 +31,29 @@ const min_prob
.short 60, 56, 52, 48, 44, 40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0
endconst
const ph_0xff00
.rept 8
.short 0xff00
.endr
endconst
.macro decode_symbol_adapt w
addi.d sp, sp, -48
addi.d a4, a0, 24
vldrepl.h vr0, a4, 0 //rng
vldrepl.h vr0, a0, 24 //rng
fst.s f0, sp, 0 //val==0
vld vr1, a1, 0 //cdf
.if \w == 16
li.w t4, 16
vldx vr11, a1, t4
vld vr11, a1, 16
.endif
addi.d a6, a0, 16
vldrepl.d vr2, a6, 0 //dif
addi.d t0, a0, 32
ld.w t1, t0, 0 //allow_update_cdf
vldrepl.d vr2, a0, 16 //dif
ld.w t1, a0, 32 //allow_update_cdf
la.local t2, min_prob
addi.d t2, t2, 32
addi.w t3, a2, 1
slli.w t3, t3, 1
addi.d t2, t2, 30
slli.w t3, a2, 1
sub.d t2, t2, t3
vld vr3, t2, 0 //min_prob
.if \w == 16
vldx vr13, t2, t4
vld vr13, t2, 16
.endif
vsrli.h vr4, vr0, 8 //r = s->rng >> 8
vslli.h vr4, vr4, 8 //r << 8
@@ -68,17 +69,15 @@ endconst
vmuh.hu vr15, vr4, vr15
vadd.h vr15, vr15, vr13
.endif
addi.d t8, sp, 4
addi.d t8, sp, 2
vst vr5, t8, 0 //store v
.if \w == 16
vstx vr15, t8, t4
vst vr15, t8, 16
.endif
vreplvei.h vr20, vr2, 3 //c
vssub.hu vr6, vr5, vr20 //c >=v
vseqi.h vr6, vr6, 0
vsle.hu vr6, vr5, vr20
.if \w == 16
vssub.hu vr16, vr15, vr20 //c >=v
vseqi.h vr16, vr16, 0
vsle.hu vr16, vr15, vr20
vpickev.b vr21, vr16, vr6
.endif
.if \w <= 8
@@ -92,10 +91,14 @@ endconst
alsl.d t1, a2, a1, 1
ld.h t2, t1, 0 //count
srli.w t3, t2, 4 //count >> 4
.if \w == 16
addi.w t3, t3, 5 //rate
.else
addi.w t3, t3, 4
li.w t5, 2
sltu t5, t5, a2
add.w t3, t3, t5 //rate
.endif
sltui t5, t2, 32
add.w t2, t2, t5 //count + (count < 32)
vreplgr2vr.h vr9, t3
@@ -118,7 +121,7 @@ endconst
.if \w == 16
vsra.h vr15, vr15, vr9
vadd.h vr18, vr18, vr15
vstx vr18, a1, t4
vst vr18, a1, 16
.endif
st.h t2, t1, 0
@@ -127,8 +130,7 @@ endconst
ctz.w a7, t3 // ret
alsl.d t3, a7, t8, 1
ld.hu t4, t3, 0 // v
addi.d t3, t3, -2
ld.hu t5, t3, 0 // u
ld.hu t5, t3, -2 // u
sub.w t5, t5, t4 // rng
slli.d t4, t4, 48
vpickve2gr.d t6, vr2, 0
@@ -136,11 +138,10 @@ endconst
clz.w t4, t5 // d
xori t4, t4, 16 // d
sll.d t6, t6, t4
addi.d a5, a0, 28 // cnt
ld.w t0, a5, 0
ld.w t0, a0, 28 //cnt
sll.w t5, t5, t4
sub.w t7, t0, t4 // cnt-d
st.w t5, a4, 0 // store rng
st.w t5, a0, 24 // store rng
bgeu t0, t4, 9f
// refill
@@ -186,8 +187,8 @@ endconst
4:
or t6, t6, t3 // dif |= next_bits
9:
st.w t7, a5, 0 // store cnt
st.d t6, a6, 0 // store dif
st.w t7, a0, 28 // store cnt
st.d t6, a0, 16 // store dif
move a0, a7
addi.d sp, sp, 48
.endm
@@ -281,6 +282,82 @@ function msac_decode_bool_lsx
move a0, t8
endfunc
function msac_decode_bool_equi_lsx
ld.w t0, a0, 24 // rng
ld.d t1, a0, 16 // dif
ld.w a5, a0, 28 // cnt
srli.w t2, t0, 8 // r >> 8
slli.w t2, t2, 7
addi.w t2, t2, 4 // v
slli.d t3, t2, 48 // vw
sltu t4, t1, t3
move t8, t4 // ret
xori t4, t4, 1
maskeqz t6, t3, t4 // if (ret) vw
sub.d t6, t1, t6 // dif
slli.w t5, t2, 1
sub.w t5, t0, t5 // r - 2v
maskeqz t7, t5, t4 // if (ret) r - 2v
add.w t5, t2, t7 // v(rng)
// renorm
clz.w t4, t5 // d
xori t4, t4, 16 // d
sll.d t6, t6, t4
sll.w t5, t5, t4
sub.w t7, a5, t4 // cnt-d
st.w t5, a0, 24 // store rng
bgeu a5, t4, 9f
// refill
ld.d t0, a0, 0 // buf_pos
ld.d t1, a0, 8 // buf_end
addi.d t2, t0, 8
bltu t1, t2, 2f
ld.d t3, t0, 0 // next_bits
addi.w t1, t7, -48 // shift_bits = cnt + 16 (- 64)
nor t3, t3, t3
sub.w t2, zero, t1
revb.d t3, t3 // next_bits = bswap(next_bits)
srli.w t2, t2, 3 // num_bytes_read
srl.d t3, t3, t1 // next_bits >>= (shift_bits & 63)
b 3f
1:
addi.w t3, t7, -48
srl.d t3, t3, t3 // pad with ones
b 4f
2:
bgeu t0, t1, 1b
ld.d t3, t1, -8 // next_bits
sub.w t2, t2, t1
sub.w t1, t1, t0 // num_bytes_left
slli.w t2, t2, 3
srl.d t3, t3, t2
addi.w t2, t7, -48
nor t3, t3, t3
sub.w t4, zero, t2
revb.d t3, t3
srli.w t4, t4, 3
srl.d t3, t3, t2
sltu t2, t1, t4
maskeqz t1, t1, t2
masknez t2, t4, t2
or t2, t2, t1 // num_bytes_read
3:
slli.w t1, t2, 3
add.d t0, t0, t2
add.w t7, t7, t1 // cnt += num_bits_read
st.d t0, a0, 0
4:
or t6, t6, t3 // dif |= next_bits
9:
st.w t7, a0, 28 // store cnt
st.d t6, a0, 16 // store dif
move a0, t8
endfunc
function msac_decode_bool_adapt_lsx
ld.hu a3, a1, 0 // cdf[0] /f
ld.w t0, a0, 24 // rng
@@ -374,3 +451,162 @@ function msac_decode_bool_adapt_lsx
st.d t6, a0, 16 // store dif
move a0, t8
endfunc
.macro HI_TOK allow_update_cdf
.\allow_update_cdf\()_hi_tok_lsx_start:
.if \allow_update_cdf == 1
ld.hu a4, a1, 0x06 // cdf[3]
.endif
vor.v vr1, vr0, vr0
vsrli.h vr1, vr1, 0x06 // cdf[val] >> EC_PROB_SHIFT
vstelm.h vr2, sp, 0, 0 // -0x1a
vand.v vr2, vr2, vr4 // (8 x rng) & 0xff00
vslli.h vr1, vr1, 0x07
vmuh.hu vr1, vr1, vr2
vadd.h vr1, vr1, vr5 // v += EC_MIN_PROB/* 4 */ * ((unsigned)n_symbols/* 3 */ - val);
vst vr1, sp, 0x02 // -0x18
vssub.hu vr1, vr1, vr3 // v - c
vseqi.h vr1, vr1, 0
.if \allow_update_cdf == 1
addi.d t4, a4, 0x50
srli.d t4, t4, 0x04
sltui t7, a4, 32
add.w a4, a4, t7
vreplgr2vr.h vr7, t4
vavgr.hu vr9, vr8, vr1
vsub.h vr9, vr9, vr0
vsub.h vr0, vr0, vr1
vsra.h vr9, vr9, vr7
vadd.h vr0, vr0, vr9
vstelm.d vr0, a1, 0, 0
st.h a4, a1, 0x06
.endif
vmsknz.b vr7, vr1
movfr2gr.s t4, f7
ctz.w t4, t4 // loop_times * 2
addi.d t7, t4, 2
ldx.hu t6, sp, t4 // u
ldx.hu t5, sp, t7 // v
addi.w t3, t3, 0x05
addi.w t4, t4, -0x05 // if t4 == 3, continue
sub.w t6, t6, t5 // u - v , rng for ctx_norm
slli.d t5, t5, 0x30 // (ec_win)v << (EC_WIN_SIZE - 16)
sub.d t1, t1, t5 // s->dif - ((ec_win)v << (EC_WIN_SIZE - 16))
// Init ctx_norm param
clz.w t7, t6
xori t7, t7, 0x1f
xori t7, t7, 0x0f // d = 15 ^ (31 ^ clz(rng));
sll.d t1, t1, t7 // dif << d
sll.d t6, t6, t7 // rng << d
// update vr2 8 x rng
vreplgr2vr.h vr2, t6
vreplvei.h vr2, vr2, 0
st.w t6, a0, 0x18 // store rng
move t0, t2
sub.w t2, t2, t7 // cnt - d
bgeu t0, t7, .\allow_update_cdf\()_hi_tok_lsx_ctx_norm_end // if ((unsigned)cnt < (unsigned)d) goto ctx_norm_end
// Step into ctx_fill
ld.d t5, a0, 0x00 // buf_pos
ld.d t6, a0, 0x08 // end_pos
addi.d t7, t5, 0x08 // buf_pos + 8
sub.d t7, t7, t6 // (buf_pos + 8) - end_pos
blt zero, t7, .\allow_update_cdf\()_hi_tok_lsx_ctx_refill_eob
// (end_pos - buf_pos) >= 8
ld.d t6, t5, 0x00 // load buf_pos[0]~buf_pos[7]
addi.w t7, t2, -0x30 // cnt - 0x30
nor t6, t6, t6 // not buf data
revb.d t6, t6 // Byte reversal
srl.d t6, t6, t7 // Replace left shift with right shift
sub.w t7, zero, t7 // neg
srli.w t7, t7, 0x03 // Loop times
or t1, t1, t6 // dif |= (ec_win)(*buf_pos++ ^ 0xff) << c
b .\allow_update_cdf\()_hi_tok_lsx_ctx_refill_end
.\allow_update_cdf\()_hi_tok_lsx_ctx_refill_eob:
bge t5, t6, .\allow_update_cdf\()_hi_tok_lsx_ctx_refill_one
// end_pos - buf_pos < 8 && buf_pos < end_pos
ld.d t0, t6, -0x08
slli.d t7, t7, 0x03
srl.d t6, t0, t7 // Retrieve the buf data and remove the excess data
addi.w t7, t2, -0x30 // cnt - 0x30
nor t6, t6, t6 // not
revb.d t6, t6 // Byte reversal
srl.d t6, t6, t7 // Replace left shift with right shift
sub.w t7, zero, t7 // neg
or t1, t1, t6 // dif |= (ec_win)(*buf_pos++ ^ 0xff) << c
ld.d t6, a0, 0x08 // end_pos
srli.w t7, t7, 0x03 // Loop times
sub.d t6, t6, t5 // end_pos - buf_pos
slt t0, t6, t7
maskeqz a3, t6, t0 // min(loop_times, end_pos - buf_pos)
masknez t0, t7, t0
or t7, a3, t0
b .\allow_update_cdf\()_hi_tok_lsx_ctx_refill_end
.\allow_update_cdf\()_hi_tok_lsx_ctx_refill_one:
// buf_pos >= end_pos
addi.w t7, t2, -0x10
andi t7, t7, 0xf
nor t0, zero, zero
srl.d t0, t0, t7
or t1, t1, t0 // dif |= ~(~(ec_win)0xff << c);
b .\allow_update_cdf\()_hi_tok_lsx_ctx_norm_end
.\allow_update_cdf\()_hi_tok_lsx_ctx_refill_end:
add.d t5, t5, t7 // buf_pos + Loop_times
st.d t5, a0, 0x00 // Store buf_pos
alsl.w t2, t7, t2, 0x03 // update cnt
.\allow_update_cdf\()_hi_tok_lsx_ctx_norm_end:
srli.d t7, t1, 0x30
vreplgr2vr.h vr3, t7 // broadcast the high 16 bits of dif
add.w t3, t4, t3 // update control parameter
beqz t3, .\allow_update_cdf\()_hi_tok_lsx_end // control loop for at most 4 times.
blt zero, t4, .\allow_update_cdf\()_hi_tok_lsx_start // tok_br == 3
.\allow_update_cdf\()_hi_tok_lsx_end:
addi.d t3, t3, 0x1e
st.d t1, a0, 0x10 // store dif
st.w t2, a0, 0x1c // store cnt
srli.w a0, t3, 0x01 // tok
addi.d sp, sp, 0x1a
.endm
/**
* @param unsigned dav1d_msac_decode_hi_tok_c(MsacContext *const s, uint16_t *const cdf)
* * Reg Alloction
* * vr0: cdf;
* * vr1: temp;
* * vr2: rng;
* * vr3: dif;
* * vr4: const 0xff00ff00...ff00ff00;
* * vr5: const 0x0004080c;
* * vr6: const 0;
* * t0: allow_update_cdf, tmp;
* * t1: dif;
* * t2: cnt;
* * t3: 0xffffffe8, outermost control parameter;
* * t4: loop time
* * t5: v, buf_pos, temp;
* * t6: u, rng, end_pos, buf, temp;
* * t7: temp;
*/
function msac_decode_hi_tok_lsx
fld.d f0, a1, 0 // Load cdf[0]~cdf[3]
vldrepl.h vr2, a0, 0x18 // 8 x rng, assert(rng <= 65535U), only the lower 16 bits are valid
vldrepl.h vr3, a0, 0x16 // broadcast the high 16 bits of dif, c = s->dif >> (EC_WIN_SIZE - 16)
ld.w t0, a0, 0x20 // allow_update_cdf
la.local t7, ph_0xff00
vld vr4, t7, 0x00 // 0xff00ff00...ff00ff00
la.local t7, min_prob
vld vr5, t7, 12 * 2 // 0x0004080c
vxor.v vr6, vr6, vr6 // const 0
ld.d t1, a0, 0x10 // dif
ld.w t2, a0, 0x1c // cnt
orn t3, t3, t3
srli.d t3, t3, 32
addi.d t3, t3, -0x17 // 0xffffffe8
vseq.h vr8, vr8, vr8
addi.d sp, sp, -0x1a // alloc stack
beqz t0, .hi_tok_lsx_no_update_cdf
HI_TOK 1
jirl zero, ra, 0x0
.hi_tok_lsx_no_update_cdf:
HI_TOK 0
endfunc
+4
View File
@@ -36,11 +36,15 @@ unsigned dav1d_msac_decode_symbol_adapt16_lsx(MsacContext *s, uint16_t *cdf,
size_t n_symbols);
unsigned dav1d_msac_decode_bool_adapt_lsx(MsacContext *s, uint16_t *cdf);
unsigned dav1d_msac_decode_bool_lsx(MsacContext *s, unsigned f);
unsigned dav1d_msac_decode_bool_equi_lsx(MsacContext *s);
unsigned dav1d_msac_decode_hi_tok_lsx(MsacContext *s, uint16_t *cdf);
#define dav1d_msac_decode_symbol_adapt4 dav1d_msac_decode_symbol_adapt4_lsx
#define dav1d_msac_decode_symbol_adapt8 dav1d_msac_decode_symbol_adapt8_lsx
#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt16_lsx
#define dav1d_msac_decode_bool_adapt dav1d_msac_decode_bool_adapt_lsx
#define dav1d_msac_decode_bool dav1d_msac_decode_bool_lsx
#define dav1d_msac_decode_bool_equi dav1d_msac_decode_bool_equi_lsx
#define dav1d_msac_decode_hi_tok dav1d_msac_decode_hi_tok_lsx
#endif /* DAV1D_SRC_LOONGARCH_MSAC_H */
+549
View File
@@ -150,3 +150,552 @@ function splat_mv_lsx
.splat_end:
endfunc
const la_div_mult
.short 0, 16384, 8192, 5461, 4096, 3276, 2730, 2340
.short 2048, 1820, 1638, 1489, 1365, 1260, 1170, 1092
.short 1024, 963, 910, 862, 819, 780, 744, 712
.short 682, 655, 630, 606, 585, 564, 546, 528
endconst
/*
* temp reg: a6 a7
*/
.macro LOAD_SET_LOOP is_odd
slli.d a6, t6, 2
add.d a6, a6, t6 // col_w * 5
0:
addi.d a7, zero, 0 // x
.if \is_odd
stx.w t7, t3, a7
addi.d a7, a7, 5
bge a7, a6, 2f
.endif
1:
stx.w t7, t3, a7
addi.d a7, a7, 5
stx.w t7, t3, a7
addi.d a7, a7, 5
blt a7, a6, 1b
2:
add.d t3, t3, t2
addi.d t5, t5, 1
blt t5, a5, 0b
.endm
/*
* static void load_tmvs_c(const refmvs_frame *const rf, int tile_row_idx,
* const int col_start8, const int col_end8,
* const int row_start8, int row_end8)
*/
function load_tmvs_lsx
addi.d sp, sp, -80
st.d s0, sp, 0
st.d s1, sp, 8
st.d s2, sp, 16
st.d s3, sp, 24
st.d s4, sp, 32
st.d s5, sp, 40
st.d s6, sp, 48
st.d s7, sp, 56
st.d s8, sp, 64
vld vr16, a0, 16
vld vr0, a0, 48 // rf->mfmv_ref, rf->mfmv_ref2cur
ld.w s8, a0, 80 // [0] - rf->n_mfmvs
vld vr17, a0, 96 // [0] - rp_ref| [1]- rp_proj
ld.d t1, a0, 112 // stride
ld.w t0, a0, 128
addi.w t0, t0, -1
bnez t0, 1f
addi.w a1, zero, 0
1:
addi.d t0, a3, 8
vinsgr2vr.w vr1, t0, 0
vinsgr2vr.w vr1, a5, 1
vmin.w vr1, vr1, vr16 // [0] col_end8i [1] row_end8
addi.d t0, a2, -8
bge t0, zero, 2f
addi.w t0, zero, 0 // t0 col_start8i
2:
vpickve2gr.d t4, vr17, 1 // rf->rp_proj
slli.d t2, t1, 2
add.d t2, t2, t1 // stride * 5
slli.d a1, a1, 4 // tile_row_idx * 16
andi t3, a4, 0xf
add.d t3, t3, a1 // tile_row_idx * 16 + row_start8 & 15
mul.w t3, t3, t2
mul.w t8, a1, t2
vpickve2gr.w a5, vr1, 1
addi.d t5, a4, 0
sub.d t6, a3, a2 // col_end8 - col_start8
li.w t7, 0x80008000
slli.d a7, a2, 2
add.d t3, t3, a2
add.d t3, t3, a7
add.d t3, t3, t4 // rp_proj
andi a6, t6, 1
bnez a6, 3f
LOAD_SET_LOOP 0
b 4f
3:
LOAD_SET_LOOP 1
4:
addi.d a6, zero, 0 // n
bge a6, s8, .end_load
add.d t3, t8, t4 // rp_proj
mul.w t6, a4, t2
addi.d s7, zero, 40
vpickve2gr.w t1, vr1, 0 // col_end8i
addi.d t5, a0, 58 // rf->mfmv_ref2ref - 1
la.local t8, la_div_mult
vld vr6, t8, 0
vld vr7, t8, 16
vld vr8, t8, 32
vld vr9, t8, 48
li.w t8, 0x3fff
vreplgr2vr.h vr21, t8
vxor.v vr18, vr18, vr18 // zero
vsub.h vr20, vr18, vr21
vpickev.b vr12, vr7, vr6
vpickod.b vr13, vr7, vr6
vpickev.b vr14, vr9, vr8
vpickod.b vr15, vr9, vr8
vpickve2gr.d s6, vr17, 0 // rf->rp_ref
5:
vld vr10, t5, 0 // ref2ref [1...7]
vpickve2gr.b t8, vr0, 8 // ref2cur
vbsrl.v vr0, vr0, 1
addi.w t4, t8, 32
beqz t4, 8f // INVALID_REF2CUR
vreplgr2vr.h vr23, t8
vshuf.b vr6, vr14, vr12, vr10
vshuf.b vr7, vr15, vr13, vr10
vilvl.b vr8, vr7, vr6
vmulwev.w.h vr6, vr8, vr23
vmulwod.w.h vr7, vr8, vr23
vpickve2gr.b s0, vr0, 4 // ref
slli.d t8, s0, 3
ldx.d s1, s6, t8 // rf->rp_ref[ref]
addi.d s0, s0, -4 // ref_sign
vreplgr2vr.h vr19, s0
add.d s1, s1, t6 // &rf->rp_ref[ref][row_start8 * stride]
addi.d s2, a4, 0 // y
vilvl.w vr8, vr7, vr6
vilvh.w vr9, vr7, vr6
6: // for (int y = row_start8;
andi s3, s2, 0xff8
addi.d s4, s3, 8
blt a4, s3, 0f
addi.d s3, a4, 0 // y_proj_start
0:
blt s4, a5, 0f
addi.d s4, a5, 0 // y_proj_end
0:
addi.d s5, t0, 0 // x
7: // for (int x = col_start8i;
slli.d a7, s5, 2
add.d a7, a7, s5
add.d a7, s1, a7 // rb
vld vr3, a7, 0 // [rb]
vpickve2gr.b t4, vr3, 4 // b_ref
beqz t4, .end_x
vreplve.b vr11, vr10, t4
vpickve2gr.b t7, vr11, 4 // ref2ref
beqz t7, .end_x
vsllwil.w.h vr4, vr3, 0
vreplgr2vr.w vr6, t4
vshuf.w vr6, vr9, vr8 // frac
vmul.w vr5, vr6, vr4
vsrai.w vr4, vr5, 31
vadd.w vr4, vr4, vr5
vssrarni.h.w vr4, vr4, 14
vclip.h vr4, vr4, vr20, vr21 // offset
vxor.v vr5, vr4, vr19 // offset.x ^ ref_sign
vori.b vr5, vr5, 0x1 // offset.x ^ ref_sign
vabsd.h vr4, vr4, vr18
vsrli.h vr4, vr4, 6 // abs(offset.x) >> 6
vsigncov.h vr4, vr5, vr4 // apply_sign
vpickve2gr.h s0, vr4, 0
add.d s0, s2, s0 // pos_y
blt s0, s3, .n_posy
bge s0, s4, .n_posy
andi s0, s0, 0xf
mul.w s0, s0, t2 // pos
vpickve2gr.h t7, vr4, 1
add.d t7, t7, s5 // pos_x
add.d s0, t3, s0 // rp_proj + pos
.loop_posx:
andi t4, s5, 0xff8 // x_sb_align
blt t7, a2, .n_posx
addi.d t8, t4, -8
blt t7, t8, .n_posx
bge t7, a3, .n_posx
addi.d t4, t4, 16
bge t7, t4, .n_posx
slli.d t4, t7, 2
add.d t4, t4, t7 // pos_x * 5
add.d t4, s0, t4 // rp_proj[pos + pos_x]
vstelm.w vr3, t4, 0, 0
vstelm.b vr11, t4, 4, 4
.n_posx:
addi.d s5, s5, 1 // x + 1
bge s5, t1, .ret_posx
addi.d a7, a7, 5 // rb + 1
vld vr4, a7, 0 // [rb]
vseq.b vr5, vr4, vr3
vpickve2gr.d t8, vr5, 0
cto.d t8, t8
blt t8, s7, 7b
addi.d t7, t7, 1 // pos_x + 1
/* Core computing loop expansion(sencond) */
andi t4, s5, 0xff8 // x_sb_align
blt t7, a2, .n_posx
addi.d t8, t4, -8
blt t7, t8, .n_posx
bge t7, a3, .n_posx
addi.d t4, t4, 16
bge t7, t4, .n_posx
slli.d t4, t7, 2
add.d t4, t4, t7 // pos_x * 5
add.d t4, s0, t4 // rp_proj[pos + pos_x]
vstelm.w vr3, t4, 0, 0
vstelm.b vr11, t4, 4, 4
addi.d s5, s5, 1 // x + 1
bge s5, t1, .ret_posx
addi.d a7, a7, 5 // rb + 1
vld vr4, a7, 0 // [rb]
vseq.b vr5, vr4, vr3
vpickve2gr.d t8, vr5, 0
cto.d t8, t8
blt t8, s7, 7b
addi.d t7, t7, 1 // pos_x + 1
/* Core computing loop expansion(third) */
andi t4, s5, 0xff8 // x_sb_align
blt t7, a2, .n_posx
addi.d t8, t4, -8
blt t7, t8, .n_posx
bge t7, a3, .n_posx
addi.d t4, t4, 16
bge t7, t4, .n_posx
slli.d t4, t7, 2
add.d t4, t4, t7 // pos_x * 5
add.d t4, s0, t4 // rp_proj[pos + pos_x]
vstelm.w vr3, t4, 0, 0
vstelm.b vr11, t4, 4, 4
addi.d s5, s5, 1 // x + 1
bge s5, t1, .ret_posx
addi.d a7, a7, 5 // rb + 1
vld vr4, a7, 0 // [rb]
vseq.b vr5, vr4, vr3
vpickve2gr.d t8, vr5, 0
cto.d t8, t8
blt t8, s7, 7b
addi.d t7, t7, 1 // pos_x + 1
b .loop_posx
.n_posy:
addi.d s5, s5, 1 // x + 1
bge s5, t1, .ret_posx
addi.d a7, a7, 5 // rb + 1
vld vr4, a7, 0 // [rb]
vseq.b vr5, vr4, vr3
vpickve2gr.d t8, vr5, 0
cto.d t8, t8
blt t8, s7, 7b
addi.d s5, s5, 1 // x + 1
bge s5, t1, .ret_posx
addi.d a7, a7, 5 // rb + 1
vld vr4, a7, 0 // [rb]
vseq.b vr5, vr4, vr3
vpickve2gr.d t8, vr5, 0
cto.d t8, t8
blt t8, s7, 7b
b .n_posy
.end_x:
addi.d s5, s5, 1 // x + 1
blt s5, t1, 7b
.ret_posx:
add.d s1, s1, t2 // r + stride
addi.d s2, s2, 1 // y + 1
blt s2, a5, 6b
8:
addi.d a6, a6, 1 // n + 1
addi.d t5, t5, 7 // mfmv_ref2ref(offset) + 7
blt a6, s8, 5b
.end_load:
ld.d s0, sp, 0
ld.d s1, sp, 8
ld.d s2, sp, 16
ld.d s3, sp, 24
ld.d s4, sp, 32
ld.d s5, sp, 40
ld.d s6, sp, 48
ld.d s7, sp, 56
ld.d s8, sp, 64
addi.d sp, sp, 80
endfunc
const mv_tbls
.byte 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
.byte 0, 1, 2, 3, 8, 0, 1, 2, 3, 8, 0, 1, 2, 3, 8, 0
.byte 4, 5, 6, 7, 9, 4, 5, 6, 7, 9, 4, 5, 6, 7, 9, 4
.byte 4, 5, 6, 7, 9, 4, 5, 6, 7, 9, 4, 5, 6, 7, 9, 4
endconst
const mask_mult
.byte 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0
endconst
const mask_mv0
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
endconst
const mask_mv1
.byte 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
endconst
// void dav1d_save_tmvs_lsx(refmvs_temporal_block *rp, ptrdiff_t stride,
// refmvs_block **rr, const uint8_t *ref_sign,
// int col_end8, int row_end8,
// int col_start8, int row_start8)
function save_tmvs_lsx
addi.d sp, sp, -0x28
st.d s0, sp, 0x00
st.d s1, sp, 0x08
st.d s2, sp, 0x10
st.d s3, sp, 0x18
st.d s4, sp, 0x20
move t0, ra
vxor.v vr10, vr10, vr10
vld vr11, a3, 0 // Load ref_sign[0] ~ Load ref_sign[7]
la.local t2, .save_tevs_tbl
la.local s1, mask_mult
la.local t7, mv_tbls
vld vr9, s1, 0 // Load mask_mult
vslli.d vr11, vr11, 8 // 0, ref_sign[0], ... ,ref_sign[6]
la.local s3, mask_mv0
vld vr8, s3, 0 // Load mask_mv0
la.local s4, mask_mv1
vld vr7, s4, 0 // Load mask_mv1
li.d s0, 5
li.d t8, 12 * 2
mul.d a1, a1, s0 // stride *= 5
sub.d a5, a5, a7 // h = row_end8 - row_start8
slli.d a7, a7, 1 // row_start8 <<= 1
1:
li.d s0, 5
andi t3, a7, 30 // (y & 15) * 2
slli.d s4, t3, 3
ldx.d t3, a2, s4 // b = rr[(y & 15) * 2]
addi.d t3, t3, 12 // &b[... + 1]
mul.d s4, a4, t8
add.d t4, s4, t3 // end_cand_b = &b[col_end8*2 + 1]
mul.d s3, a6, t8
add.d t3, s3, t3 // cand_b = &b[x*2 + 1]
mul.d s4, a6, s0
add.d a3, s4, a0 // &rp[x]
2:
/* First cand_b */
ld.b t5, t3, 10 // cand_b->bs
vld vr0, t3, 0 // cand_b->mv and ref
alsl.d t5, t5, t2, 2 // bt2 index
ld.h s3, t3, 8 // cand_b->ref
ld.h t6, t5, 0 // bt2
move s0, t2
alsl.d t3, t6, t3, 1 // Next cand_b += bt2 * 2
vor.v vr2, vr0, vr0
vinsgr2vr.h vr1, s3, 0
move t1 , t3
bge t3, t4, 3f
/* Next cand_b */
ld.b s0, t3, 10 // cand_b->bs
vld vr4, t3, 0 // cand_b->mv and ref
alsl.d s0, s0, t2, 2 // bt2 index
ld.h s4, t3, 8 // cand_b->ref
ld.h t6, s0, 0 // bt2
alsl.d t3, t6, t3, 1 // Next cand_b += bt2*2
vpackev.d vr2, vr4, vr0 // a0.mv[0] a0.mv[1] a1.mv[0], a1.mv[1]
vinsgr2vr.h vr1, s4, 1 // a0.ref[0] a0.ref[1], a1.ref[0], a1.ref[1]
3:
vabsd.h vr2, vr2, vr10 // abs(mv[].xy)
vsle.b vr16, vr10, vr1
vand.v vr1, vr16, vr1
vshuf.b vr1, vr11, vr11, vr1 // ref_sign[ref]
vsrli.h vr2, vr2, 12 // abs(mv[].xy) >> 12
vilvl.b vr1, vr1, vr1
vmulwev.h.bu vr1, vr1, vr9 // ef_sign[ref] * {1, 2}
vseqi.w vr2, vr2, 0 // abs(mv[].xy) <= 4096
vpickev.h vr2, vr2, vr2 // abs() condition to 16 bit
vand.v vr1, vr2, vr1 // h[0-3] contains conditions for mv[0-1]
vhaddw.wu.hu vr1, vr1, vr1 // Combine condition for [1] and [0]
vpickve2gr.wu s1, vr1, 0 // Extract case for first block
vpickve2gr.wu s2, vr1, 1
ld.hu t5, t5, 2 // Fetch jump table entry
ld.hu s0, s0, 2
alsl.d s3, s1, t7, 4 // Load permutation table base on case
vld vr1, s3, 0
alsl.d s4, s2, t7, 4
vld vr5, s4, 0
sub.d t5, t2, t5 // Find jump table target
sub.d s0, t2, s0
vshuf.b vr0, vr0, vr0, vr1 // Permute cand_b to output refmvs_temporal_block
vshuf.b vr4, vr4, vr4, vr5
vsle.b vr16, vr10, vr1
vand.v vr0, vr16, vr0
vsle.b vr17, vr10, vr5
vand.v vr4, vr17, vr4
// v1 follows on v0, with another 3 full repetitions of the pattern.
vshuf.b vr1, vr0, vr0, vr8 // 1, 2, 3, ... , 15, 16
vshuf.b vr5, vr4, vr4, vr8 // 1, 2, 3, ... , 15, 16
// v2 ends with 3 complete repetitions of the pattern.
vshuf.b vr2, vr1, vr0, vr7
vshuf.b vr6, vr5, vr4, vr7 // 4, 5, 6, 7, ... , 12, 13, 14, 15, 16, 17, 18, 19
jirl ra, t5, 0
bge t1 , t4, 4f // if (cand_b >= end)
vor.v vr0, vr4, vr4
vor.v vr1, vr5, vr5
vor.v vr2, vr6, vr6
jirl ra, s0, 0
blt t3, t4, 2b // if (cand_b < end)
4:
addi.d a5, a5, -1 // h--
addi.d a7, a7, 2 // y += 2
add.d a0, a0, a1 // rp += stride
blt zero, a5, 1b
ld.d s0, sp, 0x00
ld.d s1, sp, 0x08
ld.d s2, sp, 0x10
ld.d s3, sp, 0x18
ld.d s4, sp, 0x20
addi.d sp, sp, 0x28
move ra, t0
jirl zero, ra, 0x00
10:
addi.d s1, a3, 4
vstelm.w vr0, a3, 0, 0 // .mv
vstelm.b vr0, s1, 0, 4 // .ref
addi.d a3, a3, 5
jirl zero, ra, 0x00
20:
addi.d s1, a3, 8
vstelm.d vr0, a3, 0, 0 // .mv
vstelm.h vr0, s1, 0, 4 // .ref
addi.d a3, a3, 2 * 5
jirl zero, ra, 0x00
40:
vst vr0, a3, 0
vstelm.w vr1, a3, 0x10, 0
addi.d a3, a3, 4 * 5
jirl zero, ra, 0x00
80:
vst vr0, a3, 0
vst vr1, a3, 0x10 // This writes 6 full entries plus 2 extra bytes
vst vr2, a3, 5 * 8 - 16 // Write the last few, overlapping with the first write.
addi.d a3, a3, 8 * 5
jirl zero, ra, 0x00
160:
addi.d s1, a3, 6 * 5
addi.d s2, a3, 12 * 5
vst vr0, a3, 0
vst vr1, a3, 0x10 // This writes 6 full entries plus 2 extra bytes
vst vr0, a3, 6 * 5
vst vr1, a3, 6 * 5 + 16 // Write another 6 full entries, slightly overlapping with the first set
vstelm.d vr0, s2, 0, 0 // Write 8 bytes (one full entry) after the first 12
vst vr2, a3, 5 * 16 - 16 // Write the last 3 entries
addi.d a3, a3, 16 * 5
jirl zero, ra, 0x00
.save_tevs_tbl:
.hword 16 * 12 // bt2 * 12, 12 is sizeof(refmvs_block)
.hword .save_tevs_tbl - 160b
.hword 16 * 12
.hword .save_tevs_tbl - 160b
.hword 8 * 12
.hword .save_tevs_tbl - 80b
.hword 8 * 12
.hword .save_tevs_tbl - 80b
.hword 8 * 12
.hword .save_tevs_tbl - 80b
.hword 8 * 12
.hword .save_tevs_tbl - 80b
.hword 4 * 12
.hword .save_tevs_tbl - 40b
.hword 4 * 12
.hword .save_tevs_tbl - 40b
.hword 4 * 12
.hword .save_tevs_tbl - 40b
.hword 4 * 12
.hword .save_tevs_tbl - 40b
.hword 2 * 12
.hword .save_tevs_tbl - 20b
.hword 2 * 12
.hword .save_tevs_tbl - 20b
.hword 2 * 12
.hword .save_tevs_tbl - 20b
.hword 2 * 12
.hword .save_tevs_tbl - 20b
.hword 2 * 12
.hword .save_tevs_tbl - 20b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
.hword 1 * 12
.hword .save_tevs_tbl - 10b
endfunc
+4
View File
@@ -32,6 +32,8 @@
#include "src/refmvs.h"
decl_splat_mv_fn(dav1d_splat_mv_lsx);
decl_load_tmvs_fn(dav1d_load_tmvs_lsx);
decl_save_tmvs_fn(dav1d_save_tmvs_lsx);
static ALWAYS_INLINE void refmvs_dsp_init_loongarch(Dav1dRefmvsDSPContext *const c) {
const unsigned flags = dav1d_get_cpu_flags();
@@ -39,6 +41,8 @@ static ALWAYS_INLINE void refmvs_dsp_init_loongarch(Dav1dRefmvsDSPContext *const
if (!(flags & DAV1D_LOONGARCH_CPU_FLAG_LSX)) return;
c->splat_mv = dav1d_splat_mv_lsx;
c->load_tmvs = dav1d_load_tmvs_lsx;
c->save_tmvs = dav1d_save_tmvs_lsx;
}
#endif /* DAV1D_SRC_LOONGARCH_REFMVS_H */
+1252 -426
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More