History

swscale/aarch64/range_convert: saturate output instead of limiting input

aarch64 A55: chrRangeFromJpeg8_1920_c: 28836.2 (1.00x) chrRangeFromJpeg8_1920_neon: 5312.6 (5.43x) 5313.9 (5.43x) chrRangeToJpeg8_1920_c: 44196.2 (1.00x) chrRangeToJpeg8_1920_neon: 6034.6 (7.32x) 5551.3 (7.96x) lumRangeFromJpeg8_1920_c: 15388.5 (1.00x) lumRangeFromJpeg8_1920_neon: 3150.7 (4.88x) 3152.3 (4.88x) lumRangeToJpeg8_1920_c: 23069.7 (1.00x) lumRangeToJpeg8_1920_neon: 3873.2 (5.96x) 3628.7 (6.36x) aarch64 A76: chrRangeFromJpeg8_1920_c: 6334.7 (1.00x) chrRangeFromJpeg8_1920_neon: 2264.5 (2.80x) 2344.5 (2.70x) chrRangeToJpeg8_1920_c: 11474.5 (1.00x) chrRangeToJpeg8_1920_neon: 2646.5 (4.34x) 2824.2 (4.06x) lumRangeFromJpeg8_1920_c: 4453.2 (1.00x) lumRangeFromJpeg8_1920_neon: 1104.8 (4.03x) 1104.5 (4.03x) lumRangeToJpeg8_1920_c: 6645.0 (1.00x) lumRangeToJpeg8_1920_neon: 1310.5 (5.07x) 1329.8 (5.00x)

Ramiro Polla committed 2 years ago

Commit 58bcdeb1 parent 2d1358a2 files · +18 −26Browse files

Unified · Split

2 files
  1. libswscale/aarch64/range_convert_neon.S +18 −21
  2. libswscale/aarch64/swscale.c +0 −5
libswscale/aarch64/range_convert_neon.S+18−21
@@ -20,12 +20,8 @@ · 19 unmodified lines
20 20
21#include "libavutil/aarch64/asm.S"21#include "libavutil/aarch64/asm.S"
22 22
23.macro lumConvertRange name, max, mult, offset, shift23.macro lumConvertRange name, fromto, mult, offset, shift
24function ff_\name, export=124function ff_\name, export=1
25.if \max != 0
26 mov w3, #\max
27 dup v24.8h, w3
28.endif
29 mov w3, #\mult25 mov w3, #\mult
30 dup v25.4s, w326 dup v25.4s, w3
31 movz w3, #(\offset & 0xffff)27 movz w3, #(\offset & 0xffff)
@@ -33,17 +29,19 @@ function ff_\name, export=1 · 1 unmodified line
33 dup v26.4s, w329 dup v26.4s, w3
341:301:
35 ld1 {v0.8h}, [x0]31 ld1 {v0.8h}, [x0]
36.if \max != 0
37 smin v0.8h, v0.8h, v24.8h
38.endif
39 mov v16.16b, v26.16b32 mov v16.16b, v26.16b
40 mov v18.16b, v26.16b33 mov v18.16b, v26.16b
41 sxtl v20.4s, v0.4h34 sxtl v20.4s, v0.4h
42 sxtl2 v22.4s, v0.8h35 sxtl2 v22.4s, v0.8h
43 mla v16.4s, v20.4s, v25.4s36 mla v16.4s, v20.4s, v25.4s
44 mla v18.4s, v22.4s, v25.4s37 mla v18.4s, v22.4s, v25.4s
38.ifc \fromto, To
39 sqshrn v0.4h, v16.4s, #\shift
40 sqshrn2 v0.8h, v18.4s, #\shift
41.else
45 shrn v0.4h, v16.4s, #\shift42 shrn v0.4h, v16.4s, #\shift
46 shrn2 v0.8h, v18.4s, #\shift43 shrn2 v0.8h, v18.4s, #\shift
44.endif
47 subs w1, w1, #845 subs w1, w1, #8
48 st1 {v0.8h}, [x0], #1646 st1 {v0.8h}, [x0], #16
49 b.gt 1b47 b.gt 1b
@@ -51,12 +49,8 @@ function ff_\name, export=1 · 1 unmodified line
51endfunc49endfunc
52.endm50.endm
53 51
54.macro chrConvertRange name, max, mult, offset, shift52.macro chrConvertRange name, fromto, mult, offset, shift
55function ff_\name, export=153function ff_\name, export=1
56.if \max != 0
57 mov w3, #\max
58 dup v24.8h, w3
59.endif
60 mov w3, #\mult54 mov w3, #\mult
61 dup v25.4s, w355 dup v25.4s, w3
62 movz w3, #(\offset & 0xffff)56 movz w3, #(\offset & 0xffff)
@@ -65,10 +59,6 @@ function ff_\name, export=1 · 2 unmodified lines
651:591:
66 ld1 {v0.8h}, [x0]60 ld1 {v0.8h}, [x0]
67 ld1 {v1.8h}, [x1]61 ld1 {v1.8h}, [x1]
68.if \max != 0
69 smin v0.8h, v0.8h, v24.8h
70 smin v1.8h, v1.8h, v24.8h
71.endif
72 mov v16.16b, v26.16b62 mov v16.16b, v26.16b
73 mov v17.16b, v26.16b63 mov v17.16b, v26.16b
74 mov v18.16b, v26.16b64 mov v18.16b, v26.16b
@@ -81,10 +71,17 @@ function ff_\name, export=1 · 6 unmodified lines
81 mla v17.4s, v21.4s, v25.4s71 mla v17.4s, v21.4s, v25.4s
82 mla v18.4s, v22.4s, v25.4s72 mla v18.4s, v22.4s, v25.4s
83 mla v19.4s, v23.4s, v25.4s73 mla v19.4s, v23.4s, v25.4s
74.ifc \fromto, To
75 sqshrn v0.4h, v16.4s, #\shift
76 sqshrn v1.4h, v17.4s, #\shift
77 sqshrn2 v0.8h, v18.4s, #\shift
78 sqshrn2 v1.8h, v19.4s, #\shift
79.else
84 shrn v0.4h, v16.4s, #\shift80 shrn v0.4h, v16.4s, #\shift
85 shrn v1.4h, v17.4s, #\shift81 shrn v1.4h, v17.4s, #\shift
86 shrn2 v0.8h, v18.4s, #\shift82 shrn2 v0.8h, v18.4s, #\shift
87 shrn2 v1.8h, v19.4s, #\shift83 shrn2 v1.8h, v19.4s, #\shift
84.endif
88 subs w2, w2, #885 subs w2, w2, #8
89 st1 {v0.8h}, [x0], #1686 st1 {v0.8h}, [x0], #16
90 st1 {v1.8h}, [x1], #1687 st1 {v1.8h}, [x1], #16
@@ -93,7 +90,7 @@ function ff_\name, export=1 · 2 unmodified lines
93endfunc90endfunc
94.endm91.endm
95 92
96lumConvertRange lumRangeToJpeg_neon, 30189, 19077, -39057361, 1493lumConvertRange lumRangeToJpeg_neon, To, 19077, -39057361, 14
97chrConvertRange chrRangeToJpeg_neon, 30775, 4663, -9289992, 1294chrConvertRange chrRangeToJpeg_neon, To, 4663, -9289992, 12
98lumConvertRange lumRangeFromJpeg_neon, 0, 14071, 33561947, 1495lumConvertRange lumRangeFromJpeg_neon, From, 14071, 33561947, 14
99chrConvertRange chrRangeFromJpeg_neon, 0, 1799, 4081085, 1196chrConvertRange chrRangeFromJpeg_neon, From, 1799, 4081085, 11
libswscale/aarch64/swscale.c+0−5
@@ -225,10 +225,6 @@ void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width); · 224 unmodified lines
225 225
226av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)226av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
227{227{
228 /* This code is currently disabled because of changes in the base
229 * implementation of these functions. This code should be enabled
230 * again once those changes are ported to this architecture. */
231#if 0
232 int cpu_flags = av_get_cpu_flags();228 int cpu_flags = av_get_cpu_flags();
233 229
234 if (have_neon(cpu_flags)) {230 if (have_neon(cpu_flags)) {
@@ -242,7 +238,6 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c) · 7 unmodified lines
242 }238 }
243 }239 }
244 }240 }
245#endif
246}241}
247 242
248av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)243av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t