]> git.sesse.net Git - x264/blob - common/arm/asm.S
GSOC merge part 7: ARM NEON deblock assembly functions (partial)
[x264] / common / arm / asm.S
1 /*
2  * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "config.h"
22
23         .macro require8, val=1
24         .eabi_attribute 24, \val
25         .endm
26
27         .macro preserve8, val=1
28         .eabi_attribute 25, \val
29         .endm
30
31         .macro function name, export=0
32 .if \export
33         .global \name
34 .endif
35         .type   \name, %function
36         .func   \name
37 \name:
38         .endm
39
40         .macro movrel rd, val
41 #if defined(HAVE_ARMV6T2) && !defined(PIC)
42         movw            \rd, #:lower16:\val
43         movt            \rd, #:upper16:\val
44 #else
45         ldr             \rd, =\val
46 #endif
47         .endm
48
49 #define FENC_STRIDE 16
50 #define FDEC_STRIDE 32
51
52 .macro HORIZ_ADD dest, a, b
53 .ifnb \b
54     vadd.u16    \a, \a, \b
55 .endif
56     vpaddl.u16  \a, \a
57     vpaddl.u32  \dest, \a
58 .endm
59
60 .macro SUMSUB_AB sum, diff, a, b
61     vadd.s16    \sum,  \a, \b
62     vsub.s16    \diff, \a, \b
63 .endm
64
65 .macro SUMSUB_ABCD s1, d1, s2, d2, a, b, c, d
66     SUMSUB_AB   \s1, \d1, \a, \b
67     SUMSUB_AB   \s2, \d2, \c, \d
68 .endm
69
70 .macro ABS2 a b
71     vabs.s16 \a, \a
72     vabs.s16 \b, \b
73 .endm
74
75 // dist = distance in elements (0 for vertical pass, 1/2 for horizontal passes)
76 // op = sumsub/amax (sum and diff / maximum of absolutes)
77 // d1/2 = destination registers
78 // s1/2 = source registers
79 .macro HADAMARD dist, op, d1, d2, s1, s2
80 .if \dist == 1
81     vtrn.16     \s1, \s2
82 .else
83     vtrn.32     \s1, \s2
84 .endif
85 .ifc \op, sumsub
86     SUMSUB_AB   \d1, \d2, \s1, \s2
87 .else
88     vabs.s16    \s1, \s1
89     vabs.s16    \s2, \s2
90     vmax.s16    \d1, \s1, \s2
91 .endif
92 .endm
93
94 .macro TRANSPOSE8x8 r0 r1 r2 r3 r4 r5 r6 r7
95     vtrn.32         \r0, \r4
96     vtrn.32         \r1, \r5
97     vtrn.32         \r2, \r6
98     vtrn.32         \r3, \r7
99     vtrn.16         \r0, \r2
100     vtrn.16         \r1, \r3
101     vtrn.16         \r4, \r6
102     vtrn.16         \r5, \r7
103     vtrn.8          \r0, \r1
104     vtrn.8          \r2, \r3
105     vtrn.8          \r4, \r5
106     vtrn.8          \r6, \r7
107 .endm
108
109 .macro TRANSPOSE4x4 r0 r1 r2 r3
110     vtrn.16         \r0, \r2
111     vtrn.16         \r1, \r3
112     vtrn.8          \r0, \r1
113     vtrn.8          \r2, \r3
114 .endm
115
116 .macro TRANSPOSE4x4_16  d0 d1 d2 d3
117     vtrn.32     \d0, \d2
118     vtrn.32     \d1, \d3
119     vtrn.16     \d0, \d1
120     vtrn.16     \d2, \d3
121 .endm