1From b4ad8b2a18be134c2963371f4da1d80aff8ab433 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
3Date: Sat, 31 Mar 2018 21:54:32 +0300
4Subject: [PATCH 3/5] arm: swscale: Only compile the rgb2yuv asm if .dn aliases
5 are supported
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Vanilla clang supports altmacro since clang 5.0, and thus doesn't
11require gas-preprocessor for building the arm assembly any longer.
12
13However, the built-in assembler doesn't support .dn directives.
14
15This readds checks that were removed in d7320ca3ed10f0d, when
16the last usage of .dn directives within libav were removed.
17
18Alternatively, the assembly could be rewritten to not use the
19.dn directive, making it available to clang users.
20
21Signed-off-by: Martin Storsjö <martin@martin.st>
22---
23 configure                         | 5 +++++
24 libswscale/arm/rgb2yuv_neon_16.S  | 3 +++
25 libswscale/arm/rgb2yuv_neon_32.S  | 3 +++
26 libswscale/arm/swscale_unscaled.c | 6 ++++++
27 4 files changed, 17 insertions(+)
28
29diff --git a/configure b/configure
30index d5bbb5b..20c5565 100755
31--- a/configure
32+++ b/configure
33@@ -2063,6 +2063,7 @@ SYSTEM_LIBRARIES="
34
35 TOOLCHAIN_FEATURES="
36     as_arch_directive
37+    as_dn_directive
38     as_fpu_directive
39     as_func
40     as_object_arch
41@@ -5397,6 +5398,10 @@ EOF
42     check_as <<EOF && enable as_arch_directive
43 .arch armv7-a
44 EOF
45+    check_as <<EOF && enable as_dn_directive
46+ra .dn d0.i16
47+.unreq ra
48+EOF
49     check_as <<EOF && enable as_fpu_directive
50 .fpu neon
51 EOF
52diff --git a/libswscale/arm/rgb2yuv_neon_16.S b/libswscale/arm/rgb2yuv_neon_16.S
53index 601bc9a..ad7e679 100644
54--- a/libswscale/arm/rgb2yuv_neon_16.S
55+++ b/libswscale/arm/rgb2yuv_neon_16.S
56@@ -18,6 +18,8 @@
57  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
58  */
59
60+#include "config.h"
61+#if HAVE_AS_DN_DIRECTIVE
62 #include "rgb2yuv_neon_common.S"
63
64 /* downsampled R16G16B16 x8 */
65@@ -78,3 +80,4 @@ alias_qw    c8x8x2, q10
66 .endm
67
68     loop_420sp  rgbx, nv12, init, kernel_420_16x2, 16
69+#endif
70diff --git a/libswscale/arm/rgb2yuv_neon_32.S b/libswscale/arm/rgb2yuv_neon_32.S
71index f51a5f1..4fd0f64 100644
72--- a/libswscale/arm/rgb2yuv_neon_32.S
73+++ b/libswscale/arm/rgb2yuv_neon_32.S
74@@ -18,6 +18,8 @@
75  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
76  */
77
78+#include "config.h"
79+#if HAVE_AS_DN_DIRECTIVE
80 #include "rgb2yuv_neon_common.S"
81
82 /* downsampled R16G16B16 x8 */
83@@ -117,3 +119,4 @@ alias_qw    c8x8x2, q10
84
85
86     loop_420sp  rgbx, nv12, init, kernel_420_16x2, 32
87+#endif
88diff --git a/libswscale/arm/swscale_unscaled.c b/libswscale/arm/swscale_unscaled.c
89index e1597ab..e41f294 100644
90--- a/libswscale/arm/swscale_unscaled.c
91+++ b/libswscale/arm/swscale_unscaled.c
92@@ -23,6 +23,7 @@
93 #include "libswscale/swscale_internal.h"
94 #include "libavutil/arm/cpu.h"
95
96+#if HAVE_AS_DN_DIRECTIVE
97 extern void rgbx_to_nv12_neon_32(const uint8_t *src, uint8_t *y, uint8_t *chroma,
98                 int width, int height,
99                 int y_stride, int c_stride, int src_stride,
100@@ -178,3 +179,8 @@ void ff_get_unscaled_swscale_arm(SwsContext *c)
101     if (have_neon(cpu_flags))
102         get_unscaled_swscale_neon(c);
103 }
104+#else
105+void ff_get_unscaled_swscale_arm(SwsContext *c)
106+{
107+}
108+#endif
109--
1102.7.4
111
112