-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathffmpeg_4.4.2-optimize-scale.patch
More file actions
1873 lines (1843 loc) · 85.5 KB
/
Copy pathffmpeg_4.4.2-optimize-scale.patch
File metadata and controls
1873 lines (1843 loc) · 85.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S
index af55ffe..f6a75bf 100644
--- a/libswscale/aarch64/hscale.S
+++ b/libswscale/aarch64/hscale.S
@@ -17,64 +17,1142 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
+.arch armv8.6-a+dotprod+sve
#include "libavutil/aarch64/asm.S"
-function ff_hscale_8_to_15_neon, export=1
- sbfiz x7, x6, #1, #32 // filterSize*2 (*2 because int16)
-1: ldr w8, [x5], #4 // filterPos[idx]
- ldr w0, [x5], #4 // filterPos[idx + 1]
- ldr w11, [x5], #4 // filterPos[idx + 2]
- ldr w9, [x5], #4 // filterPos[idx + 3]
- mov x16, x4 // filter0 = filter
- add x12, x16, x7 // filter1 = filter0 + filterSize*2
- add x13, x12, x7 // filter2 = filter1 + filterSize*2
- add x4, x13, x7 // filter3 = filter2 + filterSize*2
- movi v0.2D, #0 // val sum part 1 (for dst[0])
- movi v1.2D, #0 // val sum part 2 (for dst[1])
- movi v2.2D, #0 // val sum part 3 (for dst[2])
- movi v3.2D, #0 // val sum part 4 (for dst[3])
- add x17, x3, w8, UXTW // srcp + filterPos[0]
- add x8, x3, w0, UXTW // srcp + filterPos[1]
- add x0, x3, w11, UXTW // srcp + filterPos[2]
- add x11, x3, w9, UXTW // srcp + filterPos[3]
- mov w15, w6 // filterSize counter
-2: ld1 {v4.8B}, [x17], #8 // srcp[filterPos[0] + {0..7}]
- ld1 {v5.8H}, [x16], #16 // load 8x16-bit filter values, part 1
- ld1 {v6.8B}, [x8], #8 // srcp[filterPos[1] + {0..7}]
- ld1 {v7.8H}, [x12], #16 // load 8x16-bit at filter+filterSize
- uxtl v4.8H, v4.8B // unpack part 1 to 16-bit
- smlal v0.4S, v4.4H, v5.4H // v0 accumulates srcp[filterPos[0] + {0..3}] * filter[{0..3}]
- smlal2 v0.4S, v4.8H, v5.8H // v0 accumulates srcp[filterPos[0] + {4..7}] * filter[{4..7}]
- ld1 {v16.8B}, [x0], #8 // srcp[filterPos[2] + {0..7}]
- ld1 {v17.8H}, [x13], #16 // load 8x16-bit at filter+2*filterSize
- uxtl v6.8H, v6.8B // unpack part 2 to 16-bit
- smlal v1.4S, v6.4H, v7.4H // v1 accumulates srcp[filterPos[1] + {0..3}] * filter[{0..3}]
- uxtl v16.8H, v16.8B // unpack part 3 to 16-bit
- smlal v2.4S, v16.4H, v17.4H // v2 accumulates srcp[filterPos[2] + {0..3}] * filter[{0..3}]
- smlal2 v2.4S, v16.8H, v17.8H // v2 accumulates srcp[filterPos[2] + {4..7}] * filter[{4..7}]
- ld1 {v18.8B}, [x11], #8 // srcp[filterPos[3] + {0..7}]
- smlal2 v1.4S, v6.8H, v7.8H // v1 accumulates srcp[filterPos[1] + {4..7}] * filter[{4..7}]
- ld1 {v19.8H}, [x4], #16 // load 8x16-bit at filter+3*filterSize
- subs w15, w15, #8 // j -= 8: processed 8/filterSize
- uxtl v18.8H, v18.8B // unpack part 4 to 16-bit
- smlal v3.4S, v18.4H, v19.4H // v3 accumulates srcp[filterPos[3] + {0..3}] * filter[{0..3}]
- smlal2 v3.4S, v18.8H, v19.8H // v3 accumulates srcp[filterPos[3] + {4..7}] * filter[{4..7}]
- b.gt 2b // inner loop if filterSize not consumed completely
- addp v0.4S, v0.4S, v0.4S // part0 horizontal pair adding
- addp v1.4S, v1.4S, v1.4S // part1 horizontal pair adding
- addp v2.4S, v2.4S, v2.4S // part2 horizontal pair adding
- addp v3.4S, v3.4S, v3.4S // part3 horizontal pair adding
- addp v0.4S, v0.4S, v0.4S // part0 horizontal pair adding
- addp v1.4S, v1.4S, v1.4S // part1 horizontal pair adding
- addp v2.4S, v2.4S, v2.4S // part2 horizontal pair adding
- addp v3.4S, v3.4S, v3.4S // part3 horizontal pair adding
- zip1 v0.4S, v0.4S, v1.4S // part01 = zip values from part0 and part1
- zip1 v2.4S, v2.4S, v3.4S // part23 = zip values from part2 and part3
- mov v0.d[1], v2.d[0] // part0123 = zip values from part01 and part23
- subs w2, w2, #4 // dstW -= 4
- sqshrn v0.4H, v0.4S, #7 // shift and clip the 2x16-bit final values
- st1 {v0.4H}, [x1], #8 // write to destination part0123
- b.gt 1b // loop until end of line
+.p2align 6
+function ff_hscale8to15_X8_neon, export=1
+ sbfiz x7, x6, #1, #32 // filterSize*2 (*2 because int16)
+1: ldp w8, w0, [x5], #8
+ ldp w11, w9, [x5], #8 // filterPos[idx + 3]
+ mov x16, x4 // filter0 = filter
+ add x12, x16, x7 // filter1 = filter0 + filterSize*2
+ add x13, x12, x7 // filter2 = filter1 + filterSize*2
+ add x4, x13, x7 // filter3 = filter2 + filterSize*2
+ movi v0.16b, #0 // val sum part 1 (for dst[0])
+ movi v1.16b, #0 // val sum part 2 (for dst[1])
+ movi v2.16b, #0 // val sum part 3 (for dst[2])
+ movi v3.16b, #0 // val sum part 4 (for dst[3])
+ add x17, x3, w8, uxtw // srcp + filterPos[0]
+ add x8, x3, w0, uxtw // srcp + filterPos[1]
+ add x0, x3, w11, uxtw // srcp + filterPos[2]
+ add x11, x3, w9, uxtw // srcp + filterPos[3]
+ mov w15, w6 // filterSize counter
+
+2: ld1 {v4.8b}, [x17], #8 // srcp[filterPos[0] + {0..7}]
+ ld1 {v5.8h}, [x16], #16 // load 8x16-bit filter values, part 1
+ ld1 {v6.8b}, [x8], #8 // srcp[filterPos[1] + {0..7}]
+ ld1 {v7.8h}, [x12], #16 // load 8x16-bit at filter+filterSize
+ prfm pldl1strm, [x8, #64]
+ prfm pldl1strm, [x12, #64]
+ uxtl v4.8h, v4.8b // unpack part 1 to 16-bit
+ sdot z0.d, z4.h, z5.h
+ ld1 {v16.8b}, [x0], #8 // srcp[filterPos[2] + {0..7}]
+ ld1 {v17.8h}, [x13], #16 // load 8x16-bit at filter+2*filterSize
+ uxtl v6.8h, v6.8b // unpack part 2 to 16-bit
+ uxtl v16.8h, v16.8b // unpack part 3 to 16-bit
+ sdot z2.d, z16.h, z17.h
+ ld1 {v18.8b}, [x11], #8 // srcp[filterPos[3] + {0..7}]
+ sdot z1.d, z6.h, z7.h
+ ld1 {v19.8h}, [x4], #16 // load 8x16-bit at filter+3*filterSize
+ subs w15, w15, #8 // j -= 8: processed 8/filterSize
+ uxtl v18.8h, v18.8b // unpack part 4 to 16-bit
+
+ sdot z3.d, z18.h, z19.h
+ b.gt 2b // inner loop if filterSize not consumed completely
+ addp v0.2d, v0.2d, v1.2d // part01 horizontal pair adding
+ addp v2.2d, v2.2d, v3.2d // part23 horizontal pair adding
+ sqxtn v0.2s, v0.2d
+ sqxtn2 v0.4s, v2.2d
+ subs w2, w2, #4 // dstW -= 4
+ sqshrn v0.4h, v0.4s, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4h}, [x1], #8 // write to destination part0123
+ b.gt 1b // loop until end of line
+ ret
+endfunc
+
+.p2align 6
+function ff_hscale8to15_X4_neon, export=1
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// w2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const int32_t *filterPos
+// w6 int filterSize
+
+// This function for filter sizes that are 4 mod 8. In other words, anything that's 0 mod 4 but not
+// 0 mod 8. It also assumes that dstW is 0 mod 4.
+
+ lsl w7, w6, #1 // w7 = filterSize * 2
+1:
+ ldp w8, w9, [x5] // filterPos[idx + 0], [idx + 1]
+ ldp w10, w11, [x5, #8] // filterPos[idx + 2], [idx + 3]
+
+ movi v16.16b, #0 // initialize accumulator for idx + 0
+ movi v17.16b, #0 // initialize accumulator for idx + 1
+ movi v18.16b, #0 // initialize accumulator for idx + 2
+ movi v19.16b, #0 // initialize accumulator for idx + 3
+
+ mov x12, x4 // filter pointer for idx + 0
+ add x13, x4, x7 // filter pointer for idx + 1
+ add x8, x3, w8, uxtw // srcp + filterPos[idx + 0]
+ add x9, x3, w9, uxtw // srcp + filterPos[idx + 1]
+
+ add x14, x13, x7 // filter pointer for idx + 2
+ add x10, x3, w10, uxtw // srcp + filterPos[idx + 2]
+ add x11, x3, w11, uxtw // srcp + filterPos[idx + 3]
+
+ mov w0, w6 // copy filterSize to a temp register, w0
+ add x5, x5, #16 // advance the filterPos pointer
+ add x15, x14, x7 // filter pointer for idx + 3
+ mov x16, xzr // temp register for offsetting filter pointers
+2:
+ // This section loops over 8-wide chunks of filter size
+ ldr d4, [x8], #8 // load 8 bytes from srcp for idx + 0
+ ldr d5, [x9], #8 // load 8 bytes from srcp for idx + 1
+ ldr d6, [x10], #8 // load 8 bytes from srcp for idx + 2
+ ldr d7, [x11], #8 // load 8 bytes from srcp for idx + 3
+ uxtl v4.8h, v4.8b // unsigned extend long for idx + 0
+ uxtl v5.8h, v5.8b // unsigned extend long for idx + 1
+ uxtl v6.8h, v6.8b // unsigned extend long for idx + 2
+ uxtl v7.8h, v7.8b // unsigned extend long for idx + 3
+ ldr q0, [x12, x16] // load 8 values, 16 bytes from filter for idx + 0
+ ldr q1, [x13, x16] // load 8 values, 16 bytes from filter for idx + 1
+ ldr q2, [x14, x16] // load 8 values, 16 bytes from filter for idx + 2
+ ldr q3, [x15, x16] // load 8 values, 16 bytes from filter for idx + 3
+
+ sdot z16.d, z0.h, z4.h // dot product for idx + 0
+ sdot z17.d, z1.h, z5.h // dot product for idx + 1
+ sdot z18.d, z2.h, z6.h // dot product for idx + 2
+ sdot z19.d, z3.h, z7.h // dot product for idx + 3
+
+ sub w0, w0, #8 // decrement the remaining filterSize counter
+ cmp w0, #8 // are there at least 8 more elements in filter to consume?
+ add x16, x16, #16 // advance the offsetting register for filter values
+
+ b.ge 2b // branch back to inner loop
+ // complete the remaining 4 filter elements
+ sub x17, x7, #8 // calculate the offset of the filter pointer for the remaining 4 elements
+
+ ldr s4, [x8] // load 4 bytes from srcp for idx + 0
+ ldr d0, [x12, x17] // load 4 values, 8 bytes from filter for idx + 0
+ ldr s5, [x9] // load 4 bytes from srcp for idx + 1
+ ldr d1, [x13, x17] // load 4 values, 8 bytes from filter for idx + 1
+
+ uxtl v4.8h, v4.8b // unsigned extend long for idx + 0
+ uxtl v5.8h, v5.8b // unsigned extend long for idx + 1
+
+ ldr s6, [x10] // load 4 bytes from srcp for idx + 2
+ ldr d2, [x14, x17] // load 4 values, 8 bytes from filter for idx + 2
+ sdot z16.d, z0.h, z4.h // val += src[srcPos + j + 0..3] * filter[fs * i + j + 0..3], idx + 0
+ sdot z17.d, z1.h, z5.h // val += src[srcPos + j + 0..3] * filter[fs * i + j + 0..3], idx + 1
+ ldr s7, [x11] // load 4 bytes from srcp for idx + 3
+ ldr d3, [x15, x17] // load 4 values, 8 bytes from filter for idx + 3
+
+ uxtl v6.8h, v6.8b // unsigned extend long for idx + 2
+ uxtl v7.8h, v7.8b // unsigned extend long for idx + 3
+
+ sdot z18.d, z2.h, z6.h // val += src[srcPos + j + 0..3] * filter[fs * i + j + 0..3], idx + 2
+ sdot z19.d, z3.h, z7.h // val += src[srcPos + j + 0..3] * filter[fs * i + j + 0..3], idx + 3
+
+ addp v16.2d, v16.2d, v17.2d
+ addp v18.2d, v18.2d, v19.2d
+ sqxtn v16.2s, v16.2d
+ sqxtn2 v16.4s, v18.2d
+
+ subs w2, w2, #4 // dstW -= 4
+ sqshrn v0.4h, v16.4s, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4h}, [x1], #8 // write to destination idx 0..3
+ add x4, x4, x7, lsl #2 // filter += (filterSize*2) * 4
+ b.gt 1b // loop until end of line
+ ret
+endfunc
+
+.p2align 6
+function ff_hscale8to15_4_neon, export=1
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const int32_t *filterPos
+// x6 int filterSize
+// x8-x15 registers for gathering src data
+
+// v0 madd accumulator 4S
+// v1-v4 filter values (16 bit) 8H
+// v5 madd accumulator 4S
+// v16-v19 src values (8 bit) 8B
+
+// This implementation has 4 sections:
+// 1. Prefetch src data
+// 2. Interleaved prefetching src data and madd
+// 3. Complete madd
+// 4. Complete remaining iterations when dstW % 8 != 0
+
+ sub sp, sp, #32 // allocate 32 bytes on the stack
+ cmp w2, #16 // if dstW <16, skip to the last block used for wrapping up
+ b.lt 2f
+
+ // load 8 values from filterPos to be used as offsets into src
+ ldp w8, w9, [x5] // filterPos[idx + 0], [idx + 1]
+ ldp w10, w11, [x5, #8] // filterPos[idx + 2], [idx + 3]
+ ldp w12, w13, [x5, #16] // filterPos[idx + 4], [idx + 5]
+ ldp w14, w15, [x5, #24] // filterPos[idx + 6], [idx + 7]
+ add x5, x5, #32 // advance filterPos
+
+ // gather random access data from src into contiguous memory
+ ldr w8, [x3, w8, uxtw] // src[filterPos[idx + 0]][0..3]
+ ldr w9, [x3, w9, uxtw] // src[filterPos[idx + 1]][0..3]
+ ldr w10, [x3, w10, uxtw] // src[filterPos[idx + 2]][0..3]
+ ldr w11, [x3, w11, uxtw] // src[filterPos[idx + 3]][0..3]
+ ldr w12, [x3, w12, uxtw] // src[filterPos[idx + 4]][0..3]
+ ldr w13, [x3, w13, uxtw] // src[filterPos[idx + 5]][0..3]
+ ldr w14, [x3, w14, uxtw] // src[filterPos[idx + 6]][0..3]
+ ldr w15, [x3, w15, uxtw] // src[filterPos[idx + 7]][0..3]
+ stp w8, w9, [sp] // *scratch_mem = { src[filterPos[idx + 0]][0..3], src[filterPos[idx + 1]][0..3] }
+ stp w10, w11, [sp, #8] // *scratch_mem = { src[filterPos[idx + 2]][0..3], src[filterPos[idx + 3]][0..3] }
+ stp w12, w13, [sp, #16] // *scratch_mem = { src[filterPos[idx + 4]][0..3], src[filterPos[idx + 5]][0..3] }
+ stp w14, w15, [sp, #24] // *scratch_mem = { src[filterPos[idx + 6]][0..3], src[filterPos[idx + 7]][0..3] }
+
+1:
+ ld4 {v16.8b, v17.8b, v18.8b, v19.8b}, [sp] // transpose 8 bytes each from src into 4 registers
+
+ // load 8 values from filterPos to be used as offsets into src
+ ldp w8, w9, [x5] // filterPos[idx + 0][0..3], [idx + 1][0..3], next iteration
+ ldp w10, w11, [x5, #8] // filterPos[idx + 2][0..3], [idx + 3][0..3], next iteration
+ ldp w12, w13, [x5, #16] // filterPos[idx + 4][0..3], [idx + 5][0..3], next iteration
+ ldp w14, w15, [x5, #24] // filterPos[idx + 6][0..3], [idx + 7][0..3], next iteration
+
+ movi v0.16b, #0 // Clear madd accumulator for idx 0..3
+ movi v5.16b, #0 // Clear madd accumulator for idx 4..7
+
+ ld4 {v1.8h, v2.8h, v3.8h, v4.8h}, [x4], #64 // load filter idx + 0..7
+
+ add x5, x5, #32 // advance filterPos
+
+ // interleaved SIMD and prefetching intended to keep ld/st and vector pipelines busy
+ uxtl v16.8h, v16.8b // unsigned extend long, convert src data to 16-bit
+ uxtl v17.8h, v17.8b // unsigned extend long, convert src data to 16-bit
+ ldr w8, [x3, w8, uxtw] // src[filterPos[idx + 0]], next iteration
+ ldr w9, [x3, w9, uxtw] // src[filterPos[idx + 1]], next iteration
+ uxtl v18.8h, v18.8b // unsigned extend long, convert src data to 16-bit
+ uxtl v19.8h, v19.8b // unsigned extend long, convert src data to 16-bit
+ ldr w10, [x3, w10, uxtw] // src[filterPos[idx + 2]], next iteration
+ ldr w11, [x3, w11, uxtw] // src[filterPos[idx + 3]], next iteration
+
+ smlal v0.4s, v1.4h, v16.4h // multiply accumulate inner loop j = 0, idx = 0..3
+ smlal v0.4s, v2.4h, v17.4h // multiply accumulate inner loop j = 1, idx = 0..3
+ ldr w12, [x3, w12, uxtw] // src[filterPos[idx + 4]], next iteration
+ ldr w13, [x3, w13, uxtw] // src[filterPos[idx + 5]], next iteration
+ smlal v0.4s, v3.4h, v18.4h // multiply accumulate inner loop j = 2, idx = 0..3
+ smlal v0.4s, v4.4h, v19.4h // multiply accumulate inner loop j = 3, idx = 0..3
+ ldr w14, [x3, w14, uxtw] // src[filterPos[idx + 6]], next iteration
+ ldr w15, [x3, w15, uxtw] // src[filterPos[idx + 7]], next iteration
+
+ smlal2 v5.4s, v1.8h, v16.8h // multiply accumulate inner loop j = 0, idx = 4..7
+ smlal2 v5.4s, v2.8h, v17.8h // multiply accumulate inner loop j = 1, idx = 4..7
+ stp w8, w9, [sp] // *scratch_mem = { src[filterPos[idx + 0]][0..3], src[filterPos[idx + 1]][0..3] }
+ stp w10, w11, [sp, #8] // *scratch_mem = { src[filterPos[idx + 2]][0..3], src[filterPos[idx + 3]][0..3] }
+ smlal2 v5.4s, v3.8h, v18.8h // multiply accumulate inner loop j = 2, idx = 4..7
+ smlal2 v5.4s, v4.8h, v19.8h // multiply accumulate inner loop j = 3, idx = 4..7
+ stp w12, w13, [sp, #16] // *scratch_mem = { src[filterPos[idx + 4]][0..3], src[filterPos[idx + 5]][0..3] }
+ stp w14, w15, [sp, #24] // *scratch_mem = { src[filterPos[idx + 6]][0..3], src[filterPos[idx + 7]][0..3] }
+
+ sub w2, w2, #8 // dstW -= 8
+ sqshrn v0.4h, v0.4s, #7 // shift and clip the 2x16-bit final values
+ sqshrn v1.4h, v5.4s, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4h, v1.4h}, [x1], #16 // write to dst[idx + 0..7]
+ cmp w2, #16 // continue on main loop if there are at least 16 iterations left
+ b.ge 1b
+
+ // last full iteration
+ ld4 {v16.8b, v17.8b, v18.8b, v19.8b}, [sp]
+ ld4 {v1.8h, v2.8h, v3.8h, v4.8h}, [x4], #64 // load filter idx + 0..7
+
+ movi v0.16b, #0 // Clear madd accumulator for idx 0..3
+ movi v5.16b, #0 // Clear madd accumulator for idx 4..7
+
+ uxtl v16.8h, v16.8b // unsigned extend long, convert src data to 16-bit
+ uxtl v17.8h, v17.8b // unsigned extend long, convert src data to 16-bit
+ uxtl v18.8h, v18.8b // unsigned extend long, convert src data to 16-bit
+ uxtl v19.8h, v19.8b // unsigned extend long, convert src data to 16-bit
+
+ smlal v0.4s, v1.4h, v16.4h // multiply accumulate inner loop j = 0, idx = 0..3
+ smlal v0.4s, v2.4h, v17.4h // multiply accumulate inner loop j = 1, idx = 0..3
+ smlal v0.4s, v3.4h, v18.4h // multiply accumulate inner loop j = 2, idx = 0..3
+ smlal v0.4s, v4.4h, v19.4h // multiply accumulate inner loop j = 3, idx = 0..3
+
+ smlal2 v5.4s, v1.8h, v16.8h // multiply accumulate inner loop j = 0, idx = 4..7
+ smlal2 v5.4s, v2.8h, v17.8h // multiply accumulate inner loop j = 1, idx = 4..7
+ smlal2 v5.4s, v3.8h, v18.8h // multiply accumulate inner loop j = 2, idx = 4..7
+ smlal2 v5.4s, v4.8h, v19.8h // multiply accumulate inner loop j = 3, idx = 4..7
+
+ subs w2, w2, #8 // dstW -= 8
+ sqshrn v0.4h, v0.4s, #7 // shift and clip the 2x16-bit final values
+ sqshrn v1.4h, v5.4s, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4h, v1.4h}, [x1], #16 // write to dst[idx + 0..7]
+
+ cbnz w2, 2f // if >0 iterations remain, jump to the wrap up section
+
+ add sp, sp, #32 // clean up stack
+ ret
+
+ // finish up when dstW % 8 != 0 or dstW < 16
+2:
+ // load src
+ ldr w8, [x5], #4 // filterPos[i]
+ add x9, x3, w8, uxtw // calculate the address for src load
+ ld1 {v5.s}[0], [x9] // src[filterPos[i] + 0..3]
+ // load filter
+ ld1 {v6.4h}, [x4], #8 // filter[filterSize * i + 0..3]
+
+ uxtl v5.8h, v5.8b // unsigned extend long, convert src data to 16-bit
+ smull v0.4s, v5.4h, v6.4h // 4 iterations of src[...] * filter[...]
+ addv s0, v0.4s // add up products of src and filter values
+ sqshrn h0, s0, #7 // shift and clip the 2x16-bit final value
+ st1 {v0.h}[0], [x1], #2 // dst[i] = ...
+ sub w2, w2, #1 // dstW--
+ cbnz w2, 2b
+
+ add sp, sp, #32 // clean up stack
ret
endfunc
+
+.macro hscale_load_offset_8B
+ ldp w11, w12, [x5]
+ ldp w13, w14, [x5, #8]
+ ldp w15, w16, [x5, #16]
+ ldp w17, w9, [x5, #24]
+ add x5, x5, #32
+.endm
+
+.macro hscale8to15_4_procss_8bytes
+ add x3, x3, x11
+ ldr w19, [x3]
+ ldr w20, [x3, w12, uxtw]
+ ldr w21, [x3, w13, uxtw]
+ ldr w22, [x3, w14, uxtw]
+ ldr w23, [x3, w15, uxtw]
+ ldr w24, [x3, w16, uxtw]
+ ldr w25, [x3, w17, uxtw]
+ ldr w26, [x3, w9, uxtw]
+
+ add x3, x3, x9
+
+ stp w19, w20, [sp, #64]
+ stp w21, w22, [sp, #72]
+ stp w23, w24, [sp, #80]
+ stp w25, w26, [sp, #88]
+
+ ldp d1, d3, [sp, #64]
+ ldp d5, d7, [sp, #80]
+
+ uxtl v1.8h, v1.8b
+ uxtl v3.8h, v3.8b
+ uxtl v5.8h, v5.8b
+ uxtl v7.8h, v7.8b
+
+ movi v21.16b, #0
+ movi v22.16b, #0
+ movi v23.16b, #0
+ movi v24.16b, #0
+
+ add x10, x4, #32
+ ld1 {v10.8h, v11.8h}, [x4]
+ ld1 {v12.8h, v13.8h}, [x10]
+ add x4, x4, #64
+
+ prfm pldl1strm, [x3, #32]
+ prfm pldl1strm, [x4, #64]
+ sdot z21.d, z1.h, z10.h
+ sdot z22.d, z3.h, z11.h
+ sdot z23.d, z5.h, z12.h
+ sdot z24.d, z7.h, z13.h
+
+ sqxtn v9.2s, v21.2d
+ sqxtn2 v9.4s, v22.2d
+
+ sqxtn v30.2s, v23.2d
+ sqxtn2 v30.4s, v24.2d
+
+ sqshrn v9.4h, v9.4s, #7
+ sqshrn2 v9.8h, v30.4s, #7
+ st1 {v9.8h}, [x1], #16
+.endm
+
+.macro hscale8_4_process_left_bytes
+ ld1 {v6.4h}, [x4], #8
+ uxtl v5.8h, v5.8b
+ smull v0.4s, v5.4h, v6.4h
+ addv s0, v0.4s
+ sqshrn h0, s0, #7
+ st1 {v0.h}[0], [x1], #2
+.endm
+
+.p2align 6
+function ff_hscale8to15_4_opt, export=1 // bilinear filtersize = 4 的通用处理
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const uint8_t *srcpos_offset
+// x6 int filterSize
+ sub sp, sp, #128
+ stp x19, x20, [sp, #0]
+ stp x21, x22, [sp, #16]
+ stp x23, x24, [sp, #32]
+ stp x25, x26, [sp, #48]
+
+ and x7, x2, #~7
+ cbz x7, .hscale8to15_4_done
+ cmp x6, #1
+ b.eq .case_hscale8to15_4_1
+ cmp x6, #0
+ b.eq .case_hscale8to15_4_0
+
+.case_hscale8to15_4_0:
+hscale8to15_4_loop_8Byte_0:
+ hscale_load_offset_8B
+ hscale8to15_4_procss_8bytes
+ subs x7, x7, #8
+ b.ne hscale8to15_4_loop_8Byte_0
+ cbz x7, .hscale8to15_4_done
+
+.case_hscale8to15_4_1:
+ hscale_load_offset_8B
+ hscale8to15_4_procss_8bytes
+ hscale_load_offset_8B
+ hscale8to15_4_procss_8bytes
+ subs x7, x7, #24
+ add x5, x5, w7, uxtw #2
+hscale8to15_4_loop_8Byte_1:
+ hscale8to15_4_procss_8bytes
+ subs x7, x7, #8
+ b.ne hscale8to15_4_loop_8Byte_1
+ hscale_load_offset_8B
+ hscale8to15_4_procss_8bytes
+ cbz x7, .hscale8to15_4_done
+
+.hscale8to15_4_done:
+ and x2, x2, #7
+ cbz x2, .hscale8to15_4_finish
+
+ ldr w11, [x5]
+ add x3, x3, x11
+ add x5, x5, #4
+ ldr s5, [x3]
+ hscale8_4_process_left_bytes
+ subs x2, x2, #1
+ cbz x2, .hscale8to15_4_finish
+hscale8to15_4_left_bytes:
+ ldr w12, [x5]
+ add x5, x5, #4
+ ldr s5, [x3, w12, uxtw]
+ hscale8_4_process_left_bytes
+ subs x2, x2, #1
+ b.ne hscale8to15_4_left_bytes
+
+.hscale8to15_4_finish:
+ ldp x19, x20, [sp, #0]
+ ldp x21, x22, [sp, #16]
+ ldp x23, x24, [sp, #32]
+ ldp x25, x26, [sp, #48]
+ add sp, sp, #128
+ ret
+endfunc
+
+.macro hscale_8_process_8Byte
+ movi v22.16b, #0
+ movi v23.16b, #0
+ movi v24.16b, #0
+ movi v25.16b, #0
+ movi v26.16b, #0
+ movi v27.16b, #0
+ movi v28.16b, #0
+ movi v29.16b, #0
+
+ add x3, x3, x11
+ ldr d0, [x3]
+ ldr d2, [x3, w12, uxtw]
+ ldr d3, [x3, w13, uxtw]
+ ldr d4, [x3, w14, uxtw]
+ ldr d5, [x3, w15, uxtw]
+ ldr d6, [x3, w16, uxtw]
+ ldr d7, [x3, w17, uxtw]
+ ldr d8, [x3, w9, uxtw]
+ add x3, x3, x9
+
+ add x19, x4, #32
+ add x20, x4, #64
+ add x21, x4, #96
+ ld1 {v10.8h, v11.8h}, [x4]
+ ld1 {v12.8h, v13.8h}, [x19]
+ ld1 {v18.8h, v19.8h}, [x20]
+ ld1 {v20.8h, v21.8h}, [x21]
+ add x4, x4, #128
+ prfm pldl1strm, [x3, #32]
+ prfm pldl1strm, [x4, #128]
+ uxtl v0.8h, v0.8b
+ uxtl v2.8h, v2.8b
+ uxtl v3.8h, v3.8b
+ uxtl v4.8h, v4.8b
+ uxtl v5.8h, v5.8b
+ uxtl v6.8h, v6.8b
+ uxtl v7.8h, v7.8b
+ uxtl v8.8h, v8.8b
+
+ sdot z22.d, z0.h, z10.h
+ sdot z23.d, z2.h, z11.h
+ sdot z24.d, z3.h, z12.h
+ sdot z25.d, z4.h, z13.h
+
+ sdot z26.d, z5.h, z18.h
+ sdot z27.d, z6.h, z19.h
+ sdot z28.d, z7.h, z20.h
+ sdot z29.d, z8.h, z21.h
+
+ addp v14.2d, v22.2d, v23.2d
+ addp v15.2d, v24.2d, v25.2d
+
+ addp v16.2d, v26.2d, v27.2d
+ addp v17.2d, v28.2d, v29.2d
+
+ sqxtn v14.2s, v14.2d
+ sqxtn v16.2s, v16.2d
+ sqxtn2 v14.4s, v15.2d
+ sqxtn2 v16.4s, v17.2d
+ sqshrn v14.4h, v14.4s, #7
+ sqshrn v16.4h, v16.4s, #7
+ st1 {v14.4h}, [x1], #8
+ st1 {v16.4h}, [x1], #8
+.endm
+
+.macro hscale_8_process_left_bytes
+ movi v22.16b, #0
+ ld1 {v6.8h}, [x4], #16
+ uxtl v5.8h, v5.8b
+ sdot z22.d, z5.h, z6.h
+ sqxtn v22.2s, v22.2d
+ addv s0, v22.4s
+ sqshrn h0, s0, #7
+ st1 {v0.h}[0], [x1], #2
+.endm
+
+.p2align 6
+function ff_hscale8to15_8_opt, export=1 // bilinear filtersize = 4 的通用处理
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const uint8_t *srcpos_offset
+// x6 int filterSize
+ sub sp, sp, #128
+ stp x19, x20, [sp, #0]
+ stp x21, x22, [sp, #16]
+ stp x23, x24, [sp, #32]
+ stp x25, x26, [sp, #48]
+ and x7, x2, #~7
+ cbz x7, .hscale_8_done
+
+ cmp x6, #1
+ b.eq .case_hscale8to15_8_1
+ cmp x6, #0
+ b.eq .case_hscale8to15_8_0
+
+.case_hscale8to15_8_0:
+hscale_8_loop_8Byte_0:
+ hscale_load_offset_8B
+ hscale_8_process_8Byte
+ subs x7, x7, #8
+ b.ne hscale_8_loop_8Byte_0
+ cbz x7, .hscale_8_done
+
+.case_hscale8to15_8_1:
+ hscale_load_offset_8B
+ hscale_8_process_8Byte
+ hscale_load_offset_8B
+ hscale_8_process_8Byte
+ subs x7, x7, #24
+ add x5, x5, w7, uxtw #2
+hscale_8_loop_8Byte_1:
+ hscale_8_process_8Byte
+ subs x7, x7, #8
+ b.ne hscale_8_loop_8Byte_1
+ hscale_load_offset_8B
+ hscale_8_process_8Byte
+ cbz x7, .hscale_8_done
+
+.hscale_8_done:
+ and x2, x2, #7
+ cbz x2, .hscale_8_finish
+ ldr w11, [x5]
+ add x3, x3, x11
+ add x5, x5, #4
+ ldr d5, [x3]
+ hscale_8_process_left_bytes
+ subs x2, x2, #1
+ cbz x2, .hscale_8_finish
+hscale_8_loop_leftbytes:
+ ldr w12, [x5]
+ add x5, x5, #4
+ ldr d5, [x3, w12, uxtw]
+ hscale_8_process_left_bytes
+ subs x2, x2, #1
+ b.ne hscale_8_loop_leftbytes
+
+.hscale_8_finish:
+ ldp x19, x20, [sp, #0]
+ ldp x21, x22, [sp, #16]
+ ldp x23, x24, [sp, #32]
+ ldp x25, x26, [sp, #48]
+ add sp, sp, #128
+ ret
+endfunc
+
+.macro hscale_12_process_8Byte
+ add x3, x3, x11
+ ldr d0, [x3]
+ ldr d3, [x3, w13, uxtw]
+ ldr d5, [x3, w15, uxtw]
+ ldr d7, [x3, w17, uxtw]
+
+ add w20, w13, #8
+ add w21, w15, #8
+ add w22, w17, #8
+ ldr w6, [x3, #8]
+ ldr w7, [x3, w20, uxtw]
+ ldr w8, [x3, w21, uxtw]
+ ldr w10, [x3, w22, uxtw]
+
+ ldr w23, [x3, w12, uxtw]
+ ldr w24, [x3, w14, uxtw]
+ ldr w25, [x3, w16, uxtw]
+ ldr w26, [x3, w9, uxtw]
+
+ stp w6, w23, [sp, #64]
+ stp w7, w24, [sp, #72]
+ stp w8, w25, [sp, #80]
+ stp w10, w26, [sp, #88]
+
+ ldp d9, d10, [sp, #64]
+ ldp d11, d12, [sp, #80]
+
+ add w19, w12, #4
+ add w20, w14, #4
+ add w21, w16, #4
+ add w22, w9, #4
+ ldr d2, [x3, w19, uxtw]
+ ldr d4, [x3, w20, uxtw]
+ ldr d6, [x3, w21, uxtw]
+ ldr d8, [x3, w22, uxtw]
+ add x3, x3, x9
+
+ add x6, x4, #32
+ add x7, x4, #64
+ add x8, x4, #96
+ ld1 {v13.8h, v14.8h}, [x4]
+ ld1 {v15.8h, v16.8h}, [x6]
+ ld1 {v17.8h, v18.8h}, [x7]
+ ld1 {v30.8h, v31.8h}, [x8]
+
+ add x4, x4, #128
+
+ eor v22.16b, v22.16b, v22.16b
+ eor v23.16b, v23.16b, v23.16b
+ eor v24.16b, v24.16b, v24.16b
+ eor v25.16b, v25.16b, v25.16b
+ eor v26.16b, v26.16b, v26.16b
+ eor v27.16b, v27.16b, v27.16b
+ eor v1.16b, v1.16b, v1.16b
+ eor v21.16b, v21.16b, v21.16b
+
+ uxtl v0.8h, v0.8b
+ uxtl v9.8h, v9.8b
+ uxtl v2.8h, v2.8b
+ uxtl v3.8h, v3.8b
+ uxtl v10.8h, v10.8b
+ uxtl v4.8h, v4.8b
+ uxtl v5.8h, v5.8b
+ uxtl v11.8h, v11.8b
+ uxtl v6.8h, v6.8b
+ uxtl v7.8h, v7.8b
+ uxtl v12.8h, v12.8b
+ uxtl v8.8h, v8.8b
+
+ sdot z22.d, z0.h, z13.h
+ sdot z23.d, z2.h, z15.h
+ sdot z24.d, z3.h, z16.h
+ sdot z25.d, z4.h, z18.h
+
+ addp v19.2d, v22.2d, v23.2d
+ addp v20.2d, v24.2d, v25.2d
+
+ add x6, x4, #32
+ ld1 {v22.8h, v23.8h}, [x4]
+ ld1 {v15.8h, v16.8h}, [x6]
+ add x4, x4, #64
+
+ prfm pldl1strm, [x3, #32]
+ prfm pldl1strm, [x4, #192]
+
+ sdot z26.d, z5.h, z30.h
+ sdot z27.d, z6.h, z22.h
+ sdot z1.d, z7.h, z23.h
+ sdot z21.d, z8.h, z16.h
+
+ addp v28.2d, v26.2d, v27.2d
+ addp v29.2d, v1.2d, v21.2d
+
+ sdot z19.d, z9.h, z14.h
+ sdot z20.d, z10.h, z17.h
+ sdot z28.d, z11.h, z31.h
+ sdot z29.d, z12.h, z15.h
+
+ sqxtn v19.2s, v19.2d
+ sqxtn v28.2s, v28.2d
+ sqxtn2 v19.4s, v20.2d
+ sqxtn2 v28.4s, v29.2d
+
+ sqshrn v19.4h, v19.4s, #7
+ sqshrn v28.4h, v28.4s, #7
+ st1 {v19.4h}, [x1], #8
+ st1 {v28.4h}, [x1], #8
+.endm
+
+.macro hscale_12_process_leftbytes
+ movi v22.16b, #0
+ ld1 {v6.8h}, [x4], #16
+ ld1 {v8.4h}, [x4], #8
+ uxtl v5.8h, v5.8b
+ uxtl v7.8h, v7.8b
+ sdot z22.d, z5.h, z6.h
+ smull v0.4s, v7.4h, v8.4h
+ sqxtn v22.2s, v22.2d
+ add v0.4s, v0.4s, v22.4s
+ addv s0, v0.4s
+ sqshrn h0, s0, #7
+ st1 {v0.h}[0], [x1], #2
+.endm
+
+.p2align 6
+function ff_hscale8to15_12_opt, export=1 // filtersize = 12 的通用处理
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const uint8_t *srcpos_offset
+// x6 int filterSize
+ sub sp, sp, #128
+ stp x19, x20, [sp, #0]
+ stp x21, x22, [sp, #16]
+ stp x23, x24, [sp, #32]
+ stp x25, x26, [sp, #48]
+
+ and x0, x2, #~7
+ cbz x0, .hscale_12_done
+
+ cmp x6, #1
+ b.eq .case_hscale8to15_12_1
+ cmp x6, #0
+ b.eq .case_hscale8to15_12_0
+
+.case_hscale8to15_12_0:
+hscale_12_loop_8Byte_0:
+ hscale_load_offset_8B
+ hscale_12_process_8Byte
+ subs x0, x0, #8
+ b.ne hscale_12_loop_8Byte_0
+ cbz x0, .hscale_12_done
+
+.case_hscale8to15_12_1:
+ hscale_load_offset_8B
+ hscale_12_process_8Byte
+ hscale_load_offset_8B
+ hscale_12_process_8Byte
+ subs x0, x0, #24
+ add x5, x5, w0, uxtw #2
+hscale_12_loop_8Byte_1:
+ hscale_12_process_8Byte
+ subs x0, x0, #8
+ b.ne hscale_12_loop_8Byte_1
+ hscale_load_offset_8B
+ hscale_12_process_8Byte
+ cbz x0, .hscale_12_done
+
+.hscale_12_done:
+ and x2, x2, #7
+ cbz x2, .hscale_12_finish
+ ldr w11, [x5]
+ add x3, x3, x11
+ add x5, x5, #4
+ ldr d5, [x3]
+ ldr s7, [x3, #8]
+ hscale_12_process_leftbytes
+ subs x2, x2, #1
+ cbz x2, .hscale_12_finish
+
+hscale_12_loop_leftbytes:
+ ldr w12, [x5]
+ add x5, x5, #4
+ ldr d5, [x3, w12, uxtw]
+ add w12, w12, #8
+ ldr s7, [x3, w12, uxtw]
+ hscale_12_process_leftbytes
+ subs x2, x2, #1
+ b.ne hscale_12_loop_leftbytes
+
+.hscale_12_finish:
+ ldp x19, x20, [sp, #0]
+ ldp x21, x22, [sp, #16]
+ ldp x23, x24, [sp, #32]
+ ldp x25, x26, [sp, #48]
+ add sp, sp, #128
+ ret
+endfunc
+
+.macro hscale_16_process_8Byte
+ movi v22.16b, #0
+ movi v23.16b, #0
+ movi v24.16b, #0
+ movi v25.16b, #0
+ movi v26.16b, #0
+ movi v27.16b, #0
+ movi v28.16b, #0
+ movi v29.16b, #0
+
+ add x3, x3, x11
+ add x22, x3, x12
+ add x23, x3, x13
+ add x24, x3, x14
+ ldp d0, d1, [x3]
+ ldp d2, d3, [x22]
+ ldp d4, d5, [x23]
+ ldp d6, d7, [x24]
+
+ add x19, x4, #32
+ add x20, x4, #64
+ add x21, x4, #96
+ ld1 {v10.8h, v11.8h}, [x4]
+ ld1 {v12.8h, v13.8h}, [x19]
+ ld1 {v14.8h, v15.8h}, [x20]
+ ld1 {v16.8h, v17.8h}, [x21]
+ add x4, x4, #128
+
+ uxtl v0.8h, v0.8b
+ uxtl v1.8h, v1.8b
+ uxtl v2.8h, v2.8b
+ uxtl v3.8h, v3.8b
+ uxtl v4.8h, v4.8b
+ uxtl v5.8h, v5.8b
+ uxtl v6.8h, v6.8b
+ uxtl v7.8h, v7.8b
+
+ prfm pldl1strm, [x3, #32]
+ prfm pldl1strm, [x4, #128]
+
+ sdot z22.d, z0.h, z10.h
+ sdot z23.d, z2.h, z12.h
+ sdot z24.d, z4.h, z14.h
+ sdot z25.d, z6.h, z16.h
+
+ sdot z22.d, z1.h, z11.h
+ sdot z23.d, z3.h, z13.h
+ sdot z24.d, z5.h, z15.h
+ sdot z25.d, z7.h, z17.h
+
+ add x25, x3, x15
+ add x22, x3, x16
+ add x23, x3, x17
+ add x24, x3, x9
+
+ ldp d18, d19, [x25]
+ ldp d20, d21, [x22]
+ ldp d0, d1, [x23]
+ ldp d2, d3, [x24]
+ add x3, x3, x9
+
+ add x19, x4, #32
+ add x20, x4, #64
+ add x21, x4, #96
+ ld1 {v10.8h, v11.8h}, [x4]
+ ld1 {v12.8h, v13.8h}, [x19]
+ ld1 {v14.8h, v15.8h}, [x20]
+ ld1 {v16.8h, v17.8h}, [x21]
+ add x4, x4, #128
+
+ uxtl v18.8h, v18.8b
+ uxtl v19.8h, v19.8b
+ uxtl v20.8h, v20.8b
+ uxtl v21.8h, v21.8b
+ uxtl v0.8h, v0.8b
+ uxtl v1.8h, v1.8b
+ uxtl v2.8h, v2.8b
+ uxtl v3.8h, v3.8b
+
+ prfm pldl1strm, [x3, #32]
+ prfm pldl1strm, [x4, #128]
+
+ sdot z26.d, z18.h, z10.h
+ sdot z27.d, z20.h, z12.h
+ sdot z28.d, z0.h, z14.h
+ sdot z29.d, z2.h, z16.h
+
+ sdot z26.d, z19.h, z11.h
+ sdot z27.d, z21.h, z13.h
+ sdot z28.d, z1.h, z15.h
+ sdot z29.d, z3.h, z17.h
+
+ addp v8.2d, v22.2d, v23.2d
+ addp v9.2d, v24.2d, v25.2d
+
+ addp v30.2d, v26.2d, v27.2d
+ addp v31.2d, v28.2d, v29.2d
+
+ sqxtn v8.2s, v8.2d
+ sqxtn v30.2s, v30.2d
+ sqxtn2 v8.4s, v9.2d
+ sqxtn2 v30.4s, v31.2d
+ sqshrn v8.4h, v8.4s, #7
+ sqshrn v30.4h, v30.4s, #7
+ st1 {v8.4h}, [x1], #8
+ st1 {v30.4h}, [x1], #8
+.endm
+
+.macro hscale_16_process_leftbytes
+ movi v22.16b, #0
+ ld1 {v6.8h, v7.8h}, [x4], #32
+ uxtl v0.8h, v0.8b
+ uxtl v1.8h, v1.8b
+ sdot z22.d, z0.h, z6.h
+ sdot z22.d, z1.h, z7.h
+ sqxtn v22.2s, v22.2d
+ addv s0, v22.4s
+ sqshrn h0, s0, #7
+ st1 {v0.h}[0], [x1], #2
+.endm
+
+.p2align 6
+function ff_hscale8to15_16_opt, export=1 // bilinear filtersize = 16 的通用处理
+// x0 SwsInternal *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const uint8_t *srcpos_offset
+// x6 int filterSize
+ sub sp, sp, #128
+ stp x19, x20, [sp, #0]
+ stp x21, x22, [sp, #16]
+ stp x23, x24, [sp, #32]
+ stp x25, x26, [sp, #48]
+ and x7, x2, #~7
+ cbz x7, .hscale_16_done