History

lavc/aarch64: add clip N macro

J. Dekker committed 3 years ago

Commit 37cde571 parent 9413bdc2 files · +16 −14Browse files

Unified · Split

2 files
  1. libavcodec/aarch64/hevcdsp_idct_neon.S +5 −14
  2. libavcodec/aarch64/neon.S +11 −0
libavcodec/aarch64/hevcdsp_idct_neon.S+5−14
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 *
66 * Ported from arm/hevcdsp_idct_neon.S by
77 * Copyright (c) 2020 Reimar Döffinger
8− * Copyright (c) 2020 J. Dekker
8+ * Copyright (c) 2023 J. Dekker <jdek@itanimul.li>
99 *
1010 * This file is part of FFmpeg.
1111 *
@@ -38,13 +38,6 @@ const trans, align=4 · 26 unmodified lines
3838 .short 31, 22, 13, 4
3939 endconst
4040
41−.macro clip2 in1, in2, min, max
42− smax \in1, \in1, \min
43− smax \in2, \in2, \min
44− smin \in1, \in1, \max
45− smin \in2, \in2, \max
46−.endm
47−
4841 function ff_hevc_add_residual_4x4_8_neon, export=1
4942 ld1 {v0.8h-v1.8h}, [x1]
5043 ld1 {v2.s}[0], [x0], x2
@@ -182,7 +175,7 @@ function hevc_add_residual_4x4_16_neon, export=0 · 131 unmodified lines
182175 ld1 {v3.d}[1], [x12], x2
183176 movi v4.8h, #0
184177 sqadd v1.8h, v1.8h, v3.8h
185− clip2 v0.8h, v1.8h, v4.8h, v21.8h
178+ clip v4.8h, v21.8h, v0.8h, v1.8h
186179 st1 {v0.d}[0], [x0], x2
187180 st1 {v0.d}[1], [x0], x2
188181 st1 {v1.d}[0], [x0], x2
@@ -201,7 +194,7 @@ function hevc_add_residual_8x8_16_neon, export=0 · 12 unmodified lines
201194 sqadd v0.8h, v0.8h, v2.8h
202195 ld1 {v3.8h}, [x12]
203196 sqadd v1.8h, v1.8h, v3.8h
204− clip2 v0.8h, v1.8h, v4.8h, v21.8h
197+ clip v4.8h, v21.8h, v0.8h, v1.8h
205198 st1 {v0.8h}, [x0], x2
206199 st1 {v1.8h}, [x12], x2
207200 bne 1b
@@ -221,8 +214,7 @@ function hevc_add_residual_16x16_16_neon, export=0 · 13 unmodified lines
221214 sqadd v1.8h, v1.8h, v17.8h
222215 sqadd v2.8h, v2.8h, v18.8h
223216 sqadd v3.8h, v3.8h, v19.8h
224− clip2 v0.8h, v1.8h, v20.8h, v21.8h
225− clip2 v2.8h, v3.8h, v20.8h, v21.8h
217+ clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h
226218 st1 {v0.8h-v1.8h}, [x0], x2
227219 st1 {v2.8h-v3.8h}, [x12], x2
228220 bne 1b
@@ -239,8 +231,7 @@ function hevc_add_residual_32x32_16_neon, export=0 · 10 unmodified lines
239231 sqadd v1.8h, v1.8h, v17.8h
240232 sqadd v2.8h, v2.8h, v18.8h
241233 sqadd v3.8h, v3.8h, v19.8h
242− clip2 v0.8h, v1.8h, v20.8h, v21.8h
243− clip2 v2.8h, v3.8h, v20.8h, v21.8h
234+ clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h
244235 st1 {v0.8h-v3.8h}, [x0], x2
245236 bne 1b
246237 ret
libavcodec/aarch64/neon.S+11−0
@@ -1,6 +1,8 @@
11 /*
22 * This file is part of FFmpeg.
33 *
4+ * Copyright (c) 2023 J. Dekker <jdek@itanimul.li>
5+ *
46 * FFmpeg is free software; you can redistribute it and/or
57 * modify it under the terms of the GNU Lesser General Public
68 * License as published by the Free Software Foundation; either
@@ -16,6 +18,15 @@ · 9 unmodified lines
1618 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1719 */
1820
21+.macro clip min, max, regs:vararg
22+.irp x, \regs
23+ smax \x, \x, \min
24+.endr
25+.irp x, \regs
26+ smin \x, \x, \max
27+.endr
28+.endm
29+
1930 .macro transpose_8x8B r0, r1, r2, r3, r4, r5, r6, r7, r8, r9
2031 trn1 \r8\().8B, \r0\().8B, \r1\().8B
2132 trn2 \r9\().8B, \r0\().8B, \r1\().8B

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