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
6969 movi v0.2d, #0
7070 movi v1.2d, #0
7171 movi v2.2d, #0
72− movi v3.2d, #0
7372 1: ld1 {v4.2s}, [x1], #8
7473 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
8174 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
8278 b.gt 1b
8379 addp d0, v0.2d
8480 addp d1, v1.2d
8581 addp d2, v2.2d
86− addp d3, v3.2d
82+ 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
8786 st1 {v0.1d-v3.1d}, [x0]
8887 ret
8988 endfunc

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