aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/x86
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2015-01-09 16:51:13 -0300
committerJames Almer <jamrial@gmail.com>2015-01-09 20:02:27 -0300
commitda02ee127a21d029763011d99f7eb4e66d3f49b3 (patch)
tree431a303b20046194c0dbb4cfdaac5459c06c510f /libavfilter/x86
parentf95cd5a235bae89510cfe4320f2189c9cfbcc457 (diff)
downloadffmpeg-da02ee127a21d029763011d99f7eb4e66d3f49b3.tar.gz
x86/vf_pp7: port dctB_mmx to yasm
Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/x86')
-rw-r--r--libavfilter/x86/Makefile3
-rw-r--r--libavfilter/x86/vf_pp7.asm57
-rw-r--r--libavfilter/x86/vf_pp7.c68
-rw-r--r--libavfilter/x86/vf_pp7_init.c34
4 files changed, 93 insertions, 69 deletions
diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
index a472a72b11..27de5a50c4 100644
--- a/libavfilter/x86/Makefile
+++ b/libavfilter/x86/Makefile
@@ -4,7 +4,7 @@ OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o
OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet_init.o
OBJS-$(CONFIG_INTERLACE_FILTER) += x86/vf_interlace_init.o
OBJS-$(CONFIG_NOISE_FILTER) += x86/vf_noise.o
-OBJS-$(CONFIG_PP7_FILTER) += x86/vf_pp7.o
+OBJS-$(CONFIG_PP7_FILTER) += x86/vf_pp7_init.o
OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup_init.o
OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o
OBJS-$(CONFIG_TINTERLACE_FILTER) += x86/vf_tinterlace_init.o
@@ -16,6 +16,7 @@ YASM-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o
YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d.o
YASM-OBJS-$(CONFIG_IDET_FILTER) += x86/vf_idet.o
YASM-OBJS-$(CONFIG_INTERLACE_FILTER) += x86/vf_interlace.o
+YASM-OBJS-$(CONFIG_PP7_FILTER) += x86/vf_pp7.o
YASM-OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup.o
YASM-OBJS-$(CONFIG_TINTERLACE_FILTER) += x86/vf_interlace.o
YASM-OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume.o
diff --git a/libavfilter/x86/vf_pp7.asm b/libavfilter/x86/vf_pp7.asm
new file mode 100644
index 0000000000..7b3e5cf5e3
--- /dev/null
+++ b/libavfilter/x86/vf_pp7.asm
@@ -0,0 +1,57 @@
+;*****************************************************************************
+;* x86-optimized functions for pp7 filter
+;*
+;* Copyright (c) 2005 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 General Public License as published by
+;* the Free Software Foundation; either version 2 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 General Public License for more details.
+;*
+;* You should have received a copy of the GNU 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/x86/x86util.asm"
+
+SECTION .text
+
+INIT_MMX mmx
+
+;void ff_pp7_dctB_mmx(int16_t *dst, int16_t *src)
+cglobal pp7_dctB, 2, 2, 0, dst, src
+ movq m0, [srcq]
+ movq m1, [srcq+mmsize*1]
+ paddw m0, [srcq+mmsize*6]
+ paddw m1, [srcq+mmsize*5]
+ movq m2, [srcq+mmsize*2]
+ movq m3, [srcq+mmsize*3]
+ paddw m2, [srcq+mmsize*4]
+ paddw m3, m3
+ movq m4, m3
+ psubw m3, m0
+ paddw m4, m0
+ movq m0, m2
+ psubw m2, m1
+ paddw m0, m1
+ movq m1, m4
+ psubw m4, m0
+ paddw m1, m0
+ movq m0, m3
+ psubw m3, m2
+ psubw m3, m2
+ paddw m2, m0
+ paddw m2, m0
+ movq [dstq], m1
+ movq [dstq+mmsize*2], m4
+ movq [dstq+mmsize*1], m2
+ movq [dstq+mmsize*3], m3
+ RET
diff --git a/libavfilter/x86/vf_pp7.c b/libavfilter/x86/vf_pp7.c
deleted file mode 100644
index 64c8618019..0000000000
--- a/libavfilter/x86/vf_pp7.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2005 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 General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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/x86/asm.h"
-#include "libavfilter/vf_pp7.h"
-
-static void dctB_mmx(int16_t *dst, int16_t *src)
-{
-#if HAVE_MMX_INLINE
- __asm__ volatile (
- "movq (%0), %%mm0 \n\t"
- "movq 1*4*2(%0), %%mm1 \n\t"
- "paddw 6*4*2(%0), %%mm0 \n\t"
- "paddw 5*4*2(%0), %%mm1 \n\t"
- "movq 2*4*2(%0), %%mm2 \n\t"
- "movq 3*4*2(%0), %%mm3 \n\t"
- "paddw 4*4*2(%0), %%mm2 \n\t"
- "paddw %%mm3, %%mm3 \n\t" //s
- "movq %%mm3, %%mm4 \n\t" //s
- "psubw %%mm0, %%mm3 \n\t" //s-s0
- "paddw %%mm0, %%mm4 \n\t" //s+s0
- "movq %%mm2, %%mm0 \n\t" //s2
- "psubw %%mm1, %%mm2 \n\t" //s2-s1
- "paddw %%mm1, %%mm0 \n\t" //s2+s1
- "movq %%mm4, %%mm1 \n\t" //s0'
- "psubw %%mm0, %%mm4 \n\t" //s0'-s'
- "paddw %%mm0, %%mm1 \n\t" //s0'+s'
- "movq %%mm3, %%mm0 \n\t" //s3'
- "psubw %%mm2, %%mm3 \n\t"
- "psubw %%mm2, %%mm3 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "movq %%mm1, (%1) \n\t"
- "movq %%mm4, 2*4*2(%1) \n\t"
- "movq %%mm2, 1*4*2(%1) \n\t"
- "movq %%mm3, 3*4*2(%1) \n\t"
- :: "r" (src), "r"(dst)
- );
-#endif
-}
-
-av_cold void ff_pp7_init_x86(PP7Context *p)
-{
- int cpu_flags = av_get_cpu_flags();
-
- if (HAVE_MMX_INLINE && cpu_flags & AV_CPU_FLAG_MMX)
- p->dctB = dctB_mmx;
-}
diff --git a/libavfilter/x86/vf_pp7_init.c b/libavfilter/x86/vf_pp7_init.c
new file mode 100644
index 0000000000..165b0dd5d0
--- /dev/null
+++ b/libavfilter/x86/vf_pp7_init.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2005 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 General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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/x86/cpu.h"
+#include "libavfilter/vf_pp7.h"
+
+void ff_pp7_dctB_mmx(int16_t *dst, int16_t *src);
+
+av_cold void ff_pp7_init_x86(PP7Context *p)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_MMX(cpu_flags))
+ p->dctB = ff_pp7_dctB_mmx;
+}