History

swscale/aarch64/range_convert: update neon range_convert functions to new API

aarch64 A55: chrRangeFromJpeg8_1920_c: 28835.2 (1.00x) chrRangeFromJpeg8_1920_neon: 5313.9 (5.43x) 5308.4 (5.43x) chrRangeToJpeg8_1920_c: 23074.7 (1.00x) chrRangeToJpeg8_1920_neon: 5551.3 (4.16x) 5549.2 (4.16x) lumRangeFromJpeg8_1920_c: 15389.7 (1.00x) lumRangeFromJpeg8_1920_neon: 3152.3 (4.88x) 3147.7 (4.89x) lumRangeToJpeg8_1920_c: 19227.8 (1.00x) lumRangeToJpeg8_1920_neon: 3628.7 (5.30x) 3630.2 (5.30x) aarch64 A76: chrRangeFromJpeg8_1920_c: 6324.4 (1.00x) chrRangeFromJpeg8_1920_neon: 2344.5 (2.70x) 2304.2 (2.74x) chrRangeToJpeg8_1920_c: 9656.0 (1.00x) chrRangeToJpeg8_1920_neon: 2824.2 (3.42x) 2794.2 (3.46x) lumRangeFromJpeg8_1920_c: 4422.0 (1.00x) lumRangeFromJpeg8_1920_neon: 1104.5 (4.00x) 1106.2 (4.00x) lumRangeToJpeg8_1920_c: 5949.1 (1.00x) lumRangeToJpeg8_1920_neon: 1329.8 (4.47x) 1328.2 (4.48x)

Ramiro Polla committed 2 years ago

Commit 6fe4a4f1 parent be108eb2 files · +39 −37Browse files

Unified · Split

2 files
  1. libswscale/aarch64/range_convert_neon.S +31 −28
  2. libswscale/aarch64/swscale.c +8 −9
libswscale/aarch64/range_convert_neon.S+31−28
@@ -20,12 +20,13 @@ · 19 unmodified lines
2020
2121 #include "libavutil/aarch64/asm.S"
2222
23−.macro lumConvertRange name, fromto, mult, offset, shift
24−function ff_\name, export=1
25− mov w3, #\mult
26− dup v25.4s, w3
27− movz w3, #(\offset & 0xffff)
28− movk w3, #((\offset >> 16) & 0xffff), lsl #16
23+.macro lumConvertRange fromto
24+function ff_lumRange\fromto\()Jpeg_neon, export=1
25+// x0 int16_t *dst
26+// w1 int width
27+// w2 uint32_t coeff
28+// x3 int64_t offset
29+ dup v25.4s, w2
2930 dup v26.4s, w3
3031 1:
3132 ld1 {v0.8h}, [x0]
@@ -36,11 +37,11 @@ function ff_\name, export=1 · 4 unmodified lines
3637 mla v16.4s, v20.4s, v25.4s
3738 mla v18.4s, v22.4s, v25.4s
3839 .ifc \fromto, To
39− sqshrn v0.4h, v16.4s, #\shift
40− sqshrn2 v0.8h, v18.4s, #\shift
40+ sqshrn v0.4h, v16.4s, 14
41+ sqshrn2 v0.8h, v18.4s, 14
4142 .else
42− shrn v0.4h, v16.4s, #\shift
43− shrn2 v0.8h, v18.4s, #\shift
43+ shrn v0.4h, v16.4s, 14
44+ shrn2 v0.8h, v18.4s, 14
4445 .endif
4546 subs w1, w1, #8
4647 st1 {v0.8h}, [x0], #16
@@ -49,13 +50,15 @@ function ff_\name, export=1 · 2 unmodified lines
4950 endfunc
5051 .endm
5152
52−.macro chrConvertRange name, fromto, mult, offset, shift
53−function ff_\name, export=1
54− mov w3, #\mult
53+.macro chrConvertRange fromto
54+function ff_chrRange\fromto\()Jpeg_neon, export=1
55+// x0 int16_t *dstU
56+// x1 int16_t *dstV
57+// w2 int width
58+// w3 uint32_t coeff
59+// x4 int64_t offset
5560 dup v25.4s, w3
56− movz w3, #(\offset & 0xffff)
57− movk w3, #((\offset >> 16) & 0xffff), lsl #16
58− dup v26.4s, w3
61+ dup v26.4s, w4
5962 1:
6063 ld1 {v0.8h}, [x0]
6164 ld1 {v1.8h}, [x1]
@@ -72,15 +75,15 @@ function ff_\name, export=1 · 10 unmodified lines
7275 mla v18.4s, v22.4s, v25.4s
7376 mla v19.4s, v23.4s, v25.4s
7477 .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
78+ sqshrn v0.4h, v16.4s, 14
79+ sqshrn v1.4h, v17.4s, 14
80+ sqshrn2 v0.8h, v18.4s, 14
81+ sqshrn2 v1.8h, v19.4s, 14
7982 .else
80− shrn v0.4h, v16.4s, #\shift
81− shrn v1.4h, v17.4s, #\shift
82− shrn2 v0.8h, v18.4s, #\shift
83− shrn2 v1.8h, v19.4s, #\shift
83+ shrn v0.4h, v16.4s, 14
84+ shrn v1.4h, v17.4s, 14
85+ shrn2 v0.8h, v18.4s, 14
86+ shrn2 v1.8h, v19.4s, 14
8487 .endif
8588 subs w2, w2, #8
8689 st1 {v0.8h}, [x0], #16
@@ -90,7 +93,7 @@ function ff_\name, export=1 · 3 unmodified lines
9093 endfunc
9194 .endm
9295
93−lumConvertRange lumRangeToJpeg_neon, To, 19077, -39057361, 14
94−chrConvertRange chrRangeToJpeg_neon, To, 4663, -9289992, 12
95−lumConvertRange lumRangeFromJpeg_neon, From, 14071, 33561947, 14
96−chrConvertRange chrRangeFromJpeg_neon, From, 1799, 4081085, 11
96+lumConvertRange To
97+chrConvertRange To
98+lumConvertRange From
99+chrConvertRange From
libswscale/aarch64/swscale.c+8−9
@@ -218,17 +218,17 @@ NEON_INPUT(bgra32); · 217 unmodified lines
218218 NEON_INPUT(rgb24);
219219 NEON_INPUT(rgba32);
220220
221−void ff_lumRangeFromJpeg_neon(int16_t *dst, int width);
222−void ff_chrRangeFromJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
223−void ff_lumRangeToJpeg_neon(int16_t *dst, int width);
224−void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
221+void ff_lumRangeFromJpeg_neon(int16_t *dst, int width,
222+ uint32_t coeff, int64_t offset);
223+void ff_chrRangeFromJpeg_neon(int16_t *dstU, int16_t *dstV, int width,
224+ uint32_t coeff, int64_t offset);
225+void ff_lumRangeToJpeg_neon(int16_t *dst, int width,
226+ uint32_t coeff, int64_t offset);
227+void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width,
228+ uint32_t coeff, int64_t offset);
225229
226230 av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
227231 {
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
232232 int cpu_flags = av_get_cpu_flags();
233233
234234 if (have_neon(cpu_flags)) {
@@ -242,7 +242,6 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c) · 7 unmodified lines
242242 }
243243 }
244244 }
245−#endif
246245 }
247246
248247 av_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