History

avcodec/aarch64/ac3dsp_neon.S: Optimize ac3_sum_square_butterfly_int32_neon

Instead of calculating a^2, b^2, (a+b)^2 and (a-b)^2, calculate only a^2, b^2 and 2*a*b in each iteration and derive the latter parts from these three at the end. Before and after: A78 ac3_sum_square_bufferfly_int32_neon: 484.8 ( 2.00x) ac3_sum_square_bufferfly_int32_neon: 468.2 ( 2.08x) A72 ac3_sum_square_bufferfly_int32_neon: 793.6 ( 1.26x) ac3_sum_square_bufferfly_int32_neon: 527.3 ( 1.92x)

Krzysztof Pyrkosz committed 1 year ago

Commit e8d4c551 parent 38929b81 file · +7 −8Browse files

Unified · Split

libavcodec/aarch64/ac3dsp_neon.S+7−8
@@ -69,21 +69,20 @@ function ff_ac3_sum_square_butterfly_int32_neon, export=1 · 68 unmodified lines
69 movi v0.2d, #069 movi v0.2d, #0
70 movi v1.2d, #070 movi v1.2d, #0
71 movi v2.2d, #071 movi v2.2d, #0
72 movi v3.2d, #0
731: ld1 {v4.2s}, [x1], #8721: ld1 {v4.2s}, [x1], #8
74 ld1 {v5.2s}, [x2], #873 ld1 {v5.2s}, [x2], #8
75 add v6.2s, v4.2s, v5.2s
76 sub v7.2s, v4.2s, v5.2s
77 smlal v0.2d, v4.2s, v4.2s
78 smlal v1.2d, v5.2s, v5.2s
79 smlal v2.2d, v6.2s, v6.2s
80 smlal v3.2d, v7.2s, v7.2s
81 subs w3, w3, #274 subs w3, w3, #2
75 smlal v0.2d, v4.2s, v4.2s // sum of a^2
76 smlal v1.2d, v5.2s, v5.2s // sum of b^2
77 sqdmlal v2.2d, v4.2s, v5.2s // sum of 2ab
82 b.gt 1b78 b.gt 1b
83 addp d0, v0.2d79 addp d0, v0.2d
84 addp d1, v1.2d80 addp d1, v1.2d
85 addp d2, v2.2d81 addp d2, v2.2d
86 addp d3, v3.2d82 sub d3, d0, d2 // a^2 + b^2 - 2ab
83 add d2, d0, d2
84 add d3, d3, d1 // a^2 + b^2 + 2ab
85 add d2, d2, d1
87 st1 {v0.1d-v3.1d}, [x0]86 st1 {v0.1d-v3.1d}, [x0]
88 ret87 ret
89endfunc88endfunc

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