Skip to content

Instantly share code, notes, and snippets.

@tmm1
Created December 23, 2015 23:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmm1/adb24a232c9cf9c1a47e to your computer and use it in GitHub Desktop.
Save tmm1/adb24a232c9cf9c1a47e to your computer and use it in GitHub Desktop.
diff --git a/libavfilter/aarch64/Makefile b/libavfilter/aarch64/Makefile
new file mode 100644
index 0000000..5d6f6d3
--- /dev/null
+++ b/libavfilter/aarch64/Makefile
@@ -0,0 +1,3 @@
+OBJS-$(CONFIG_YADIF_FILTER) += aarch64/vf_yadif_init.o
+
+NEON-OBJS-$(CONFIG_YADIF_FILTER) += aarch64/vf_yadif.o
diff --git a/libavfilter/aarch64/vf_yadif_init.c b/libavfilter/aarch64/vf_yadif_init.c
new file mode 100644
index 0000000..b37b72e
--- /dev/null
+++ b/libavfilter/aarch64/vf_yadif_init.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/mem.h"
+#include "libavutil/aarch64/cpu.h"
+#include "libavfilter/yadif.h"
+
+void ff_yadif_filter_line_neon(void *dst, void *prev, void *cur,
+ void *next, int w, int prefs,
+ int mrefs, int parity, int mode);
+
+void ff_yadif_filter_line_16bit_neon(void *dst, void *prev, void *cur,
+ void *next, int w, int prefs,
+ int mrefs, int parity, int mode);
+
+void ff_yadif_filter_line_10bit_neon(void *dst, void *prev, void *cur,
+ void *next, int w, int prefs,
+ int mrefs, int parity, int mode);
+
+av_cold void ff_yadif_init_aarch64(YADIFContext *yadif)
+{
+ int cpu_flags = av_get_cpu_flags();
+ int bit_depth = (!yadif->csp) ? 8
+ : yadif->csp->comp[0].depth_minus1 + 1;
+
+ if (bit_depth >= 15) {
+ if (have_neon(cpu_flags))
+ yadif->filter_line = ff_yadif_filter_line_16bit_neon;
+ } else if ( bit_depth >= 9 && bit_depth <= 14) {
+ if (have_neon(cpu_flags))
+ yadif->filter_line = ff_yadif_filter_line_10bit_neon;
+ } else {
+ if (have_neon(cpu_flags))
+ yadif->filter_line = ff_yadif_filter_line_neon;
+ }
+}
diff --git a/libavfilter/aarch64/vf_yadif_neon.S b/libavfilter/aarch64/vf_yadif_neon.S
new file mode 100644
index 0000000..1d675d3
--- /dev/null
+++ b/libavfilter/aarch64/vf_yadif_neon.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015 Aman Gupta <aman@tmm1.net>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "libavutil/aarch64/asm.S"
+
+function ff_yadif_filter_line_neon, export=1
+endfunc
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index b32f38b..10f72a0 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -496,6 +496,8 @@ static int config_props(AVFilterLink *link)
if (ARCH_X86)
ff_yadif_init_x86(s);
+ if (ARCH_AARCH64)
+ ff_yadif_init_aarch64(s);
return 0;
}
diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h
index d23d138..fed7ec0 100644
--- a/libavfilter/yadif.h
+++ b/libavfilter/yadif.h
@@ -70,5 +70,6 @@ typedef struct YADIFContext {
} YADIFContext;
void ff_yadif_init_x86(YADIFContext *yadif);
+void ff_yadif_init_aarch64(YADIFContext *yadif);
#endif /* AVFILTER_YADIF_H */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment