summaryrefslogtreecommitdiff
path: root/libavfilter/x86/vf_v360_init.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-09-03 18:54:44 +0200
committerPaul B Mahol <onemda@gmail.com>2019-09-06 14:10:37 +0200
commit058bbf48c6ba74eddecc4fd684ce45a50d49366f (patch)
treef4c42bbd5eaa30bfeadbf95ec71ccfdf0813c44b /libavfilter/x86/vf_v360_init.c
parentf0d8005ec5bedb99f40e3f48312c55e89ef88d95 (diff)
avfilter/vf_v360: x86 SIMD for interpolations
Diffstat (limited to 'libavfilter/x86/vf_v360_init.c')
-rw-r--r--libavfilter/x86/vf_v360_init.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/libavfilter/x86/vf_v360_init.c b/libavfilter/x86/vf_v360_init.c
new file mode 100644
index 0000000000..5dfd0d1a42
--- /dev/null
+++ b/libavfilter/x86/vf_v360_init.c
@@ -0,0 +1,50 @@
+/*
+ * 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/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavfilter/v360.h"
+
+void ff_remap1_8bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, ptrdiff_t in_linesize,
+ const uint16_t *u, const uint16_t *v, const int16_t *ker);
+
+void ff_remap2_8bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, ptrdiff_t in_linesize,
+ const uint16_t *u, const uint16_t *v, const int16_t *ker);
+
+void ff_remap4_8bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, ptrdiff_t in_linesize,
+ const uint16_t *u, const uint16_t *v, const int16_t *ker);
+
+av_cold void ff_v360_init_x86(V360Context *s, int depth)
+{
+#if ARCH_X86_64
+ int cpu_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == NEAREST && depth <= 8)
+ s->remap_line = ff_remap1_8bit_line_avx2;
+
+ if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == BILINEAR && depth <= 8)
+ s->remap_line = ff_remap2_8bit_line_avx2;
+
+ if (EXTERNAL_AVX2_FAST(cpu_flags) && (s->interp == BICUBIC ||
+ s->interp == LANCZOS) && depth <= 8)
+ s->remap_line = ff_remap4_8bit_line_avx2;
+#endif
+}