summaryrefslogtreecommitdiff
path: root/ffmpeg/libavfilter/x86
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
commitf7813a5324be39d13ab536c245d15dfc602a7849 (patch)
treefad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavfilter/x86
parentb7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff)
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavfilter/x86')
-rw-r--r--ffmpeg/libavfilter/x86/Makefile7
-rw-r--r--ffmpeg/libavfilter/x86/af_volume_init.c13
-rw-r--r--ffmpeg/libavfilter/x86/vf_gradfun.c217
-rw-r--r--ffmpeg/libavfilter/x86/vf_hqdn3d_init.c22
-rw-r--r--ffmpeg/libavfilter/x86/vf_yadif_init.c100
5 files changed, 27 insertions, 332 deletions
diff --git a/ffmpeg/libavfilter/x86/Makefile b/ffmpeg/libavfilter/x86/Makefile
index cd97347..be4ad83 100644
--- a/ffmpeg/libavfilter/x86/Makefile
+++ b/ffmpeg/libavfilter/x86/Makefile
@@ -1,8 +1,11 @@
-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o
+OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun_init.o
OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d_init.o
+OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup_init.o
+OBJS-$(CONFIG_SPP_FILTER) += x86/vf_spp.o
OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume_init.o
-OBJS-$(CONFIG_YADIF_FILTER) += x86/vf_yadif_init.o
+YASM-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/vf_gradfun.o
YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/vf_hqdn3d.o
+YASM-OBJS-$(CONFIG_PULLUP_FILTER) += x86/vf_pullup.o
YASM-OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume.o
YASM-OBJS-$(CONFIG_YADIF_FILTER) += x86/vf_yadif.o x86/yadif-16.o x86/yadif-10.o
diff --git a/ffmpeg/libavfilter/x86/af_volume_init.c b/ffmpeg/libavfilter/x86/af_volume_init.c
index beee8ca..57c7eab 100644
--- a/ffmpeg/libavfilter/x86/af_volume_init.c
+++ b/ffmpeg/libavfilter/x86/af_volume_init.c
@@ -17,6 +17,7 @@
*/
#include "config.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/samplefmt.h"
#include "libavutil/x86/cpu.h"
@@ -32,26 +33,26 @@ void ff_scale_samples_s32_ssse3_atom(uint8_t *dst, const uint8_t *src, int len,
void ff_scale_samples_s32_avx(uint8_t *dst, const uint8_t *src, int len,
int volume);
-void ff_volume_init_x86(VolumeContext *vol)
+av_cold void ff_volume_init_x86(VolumeContext *vol)
{
- int mm_flags = av_get_cpu_flags();
+ int cpu_flags = av_get_cpu_flags();
enum AVSampleFormat sample_fmt = av_get_packed_sample_fmt(vol->sample_fmt);
if (sample_fmt == AV_SAMPLE_FMT_S16) {
- if (EXTERNAL_SSE2(mm_flags) && vol->volume_i < 32768) {
+ if (EXTERNAL_SSE2(cpu_flags) && vol->volume_i < 32768) {
vol->scale_samples = ff_scale_samples_s16_sse2;
vol->samples_align = 8;
}
} else if (sample_fmt == AV_SAMPLE_FMT_S32) {
- if (EXTERNAL_SSE2(mm_flags)) {
+ if (EXTERNAL_SSE2(cpu_flags)) {
vol->scale_samples = ff_scale_samples_s32_sse2;
vol->samples_align = 4;
}
- if (EXTERNAL_SSSE3(mm_flags) && mm_flags & AV_CPU_FLAG_ATOM) {
+ if (EXTERNAL_SSSE3(cpu_flags) && cpu_flags & AV_CPU_FLAG_ATOM) {
vol->scale_samples = ff_scale_samples_s32_ssse3_atom;
vol->samples_align = 4;
}
- if (EXTERNAL_AVX(mm_flags)) {
+ if (EXTERNAL_AVX(cpu_flags)) {
vol->scale_samples = ff_scale_samples_s32_avx;
vol->samples_align = 8;
}
diff --git a/ffmpeg/libavfilter/x86/vf_gradfun.c b/ffmpeg/libavfilter/x86/vf_gradfun.c
deleted file mode 100644
index 214e764..0000000
--- a/ffmpeg/libavfilter/x86/vf_gradfun.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2009 Loren Merritt <lorenm@u.washignton.edu>
- *
- * 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/x86/asm.h"
-#include "libavfilter/gradfun.h"
-
-#if HAVE_INLINE_ASM
-
-DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
-DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-#if HAVE_MMXEXT_INLINE
-static void gradfun_filter_line_mmxext(uint8_t *dst, const uint8_t *src, const uint16_t *dc,
- int width, int thresh,
- const uint16_t *dithers)
-{
- intptr_t x;
- if (width & 3) {
- x = width & ~3;
- ff_gradfun_filter_line_c(dst + x, src + x, dc + x / 2, width - x, thresh, dithers);
- width = x;
- }
- x = -width;
- __asm__ volatile(
- "movd %4, %%mm5 \n"
- "pxor %%mm7, %%mm7 \n"
- "pshufw $0, %%mm5, %%mm5 \n"
- "movq %6, %%mm6 \n"
- "movq (%5), %%mm3 \n"
- "movq 8(%5), %%mm4 \n"
-
- "1: \n"
- "movd (%2,%0), %%mm0 \n"
- "movd (%3,%0), %%mm1 \n"
- "punpcklbw %%mm7, %%mm0 \n"
- "punpcklwd %%mm1, %%mm1 \n"
- "psllw $7, %%mm0 \n"
- "pxor %%mm2, %%mm2 \n"
- "psubw %%mm0, %%mm1 \n" // delta = dc - pix
- "psubw %%mm1, %%mm2 \n"
- "pmaxsw %%mm1, %%mm2 \n"
- "pmulhuw %%mm5, %%mm2 \n" // m = abs(delta) * thresh >> 16
- "psubw %%mm6, %%mm2 \n"
- "pminsw %%mm7, %%mm2 \n" // m = -max(0, 127-m)
- "pmullw %%mm2, %%mm2 \n"
- "paddw %%mm3, %%mm0 \n" // pix += dither
- "psllw $2, %%mm1 \n" // m = m*m*delta >> 14
- "pmulhw %%mm2, %%mm1 \n"
- "paddw %%mm1, %%mm0 \n" // pix += m
- "psraw $7, %%mm0 \n"
- "packuswb %%mm0, %%mm0 \n"
- "movd %%mm0, (%1,%0) \n" // dst = clip(pix>>7)
- "add $4, %0 \n"
- "jnl 2f \n"
-
- "movd (%2,%0), %%mm0 \n"
- "movd (%3,%0), %%mm1 \n"
- "punpcklbw %%mm7, %%mm0 \n"
- "punpcklwd %%mm1, %%mm1 \n"
- "psllw $7, %%mm0 \n"
- "pxor %%mm2, %%mm2 \n"
- "psubw %%mm0, %%mm1 \n" // delta = dc - pix
- "psubw %%mm1, %%mm2 \n"
- "pmaxsw %%mm1, %%mm2 \n"
- "pmulhuw %%mm5, %%mm2 \n" // m = abs(delta) * thresh >> 16
- "psubw %%mm6, %%mm2 \n"
- "pminsw %%mm7, %%mm2 \n" // m = -max(0, 127-m)
- "pmullw %%mm2, %%mm2 \n"
- "paddw %%mm4, %%mm0 \n" // pix += dither
- "psllw $2, %%mm1 \n" // m = m*m*delta >> 14
- "pmulhw %%mm2, %%mm1 \n"
- "paddw %%mm1, %%mm0 \n" // pix += m
- "psraw $7, %%mm0 \n"
- "packuswb %%mm0, %%mm0 \n"
- "movd %%mm0, (%1,%0) \n" // dst = clip(pix>>7)
- "add $4, %0 \n"
- "jl 1b \n"
-
- "2: \n"
- "emms \n"
- :"+r"(x)
- :"r"(dst+width), "r"(src+width), "r"(dc+width/2),
- "rm"(thresh), "r"(dithers), "m"(*pw_7f)
- :"memory"
- );
-}
-#endif
-
-#if HAVE_SSSE3_INLINE
-static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
-{
- intptr_t x;
- if (width & 7) {
- // could be 10% faster if I somehow eliminated this
- x = width & ~7;
- ff_gradfun_filter_line_c(dst + x, src + x, dc + x / 2, width - x, thresh, dithers);
- width = x;
- }
- x = -width;
- __asm__ volatile(
- "movd %4, %%xmm5 \n"
- "pxor %%xmm7, %%xmm7 \n"
- "pshuflw $0,%%xmm5, %%xmm5 \n"
- "movdqa %6, %%xmm6 \n"
- "punpcklqdq %%xmm5, %%xmm5 \n"
- "movdqa %5, %%xmm4 \n"
- "1: \n"
- "movq (%2,%0), %%xmm0 \n"
- "movq (%3,%0), %%xmm1 \n"
- "punpcklbw %%xmm7, %%xmm0 \n"
- "punpcklwd %%xmm1, %%xmm1 \n"
- "psllw $7, %%xmm0 \n"
- "psubw %%xmm0, %%xmm1 \n" // delta = dc - pix
- "pabsw %%xmm1, %%xmm2 \n"
- "pmulhuw %%xmm5, %%xmm2 \n" // m = abs(delta) * thresh >> 16
- "psubw %%xmm6, %%xmm2 \n"
- "pminsw %%xmm7, %%xmm2 \n" // m = -max(0, 127-m)
- "pmullw %%xmm2, %%xmm2 \n"
- "psllw $2, %%xmm1 \n"
- "paddw %%xmm4, %%xmm0 \n" // pix += dither
- "pmulhw %%xmm2, %%xmm1 \n" // m = m*m*delta >> 14
- "paddw %%xmm1, %%xmm0 \n" // pix += m
- "psraw $7, %%xmm0 \n"
- "packuswb %%xmm0, %%xmm0 \n"
- "movq %%xmm0, (%1,%0) \n" // dst = clip(pix>>7)
- "add $8, %0 \n"
- "jl 1b \n"
- :"+&r"(x)
- :"r"(dst+width), "r"(src+width), "r"(dc+width/2),
- "rm"(thresh), "m"(*dithers), "m"(*pw_7f)
- :"memory"
- );
-}
-#endif /* HAVE_SSSE3_INLINE */
-
-#if HAVE_SSE2_INLINE
-static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width)
-{
-#define BLURV(load)\
- intptr_t x = -2*width;\
- __asm__ volatile(\
- "movdqa %6, %%xmm7 \n"\
- "1: \n"\
- load" (%4,%0), %%xmm0 \n"\
- load" (%5,%0), %%xmm1 \n"\
- "movdqa %%xmm0, %%xmm2 \n"\
- "movdqa %%xmm1, %%xmm3 \n"\
- "psrlw $8, %%xmm0 \n"\
- "psrlw $8, %%xmm1 \n"\
- "pand %%xmm7, %%xmm2 \n"\
- "pand %%xmm7, %%xmm3 \n"\
- "paddw %%xmm1, %%xmm0 \n"\
- "paddw %%xmm3, %%xmm2 \n"\
- "paddw %%xmm2, %%xmm0 \n"\
- "paddw (%2,%0), %%xmm0 \n"\
- "movdqa (%1,%0), %%xmm1 \n"\
- "movdqa %%xmm0, (%1,%0) \n"\
- "psubw %%xmm1, %%xmm0 \n"\
- "movdqa %%xmm0, (%3,%0) \n"\
- "add $16, %0 \n"\
- "jl 1b \n"\
- :"+&r"(x)\
- :"r"(buf+width),\
- "r"(buf1+width),\
- "r"(dc+width),\
- "r"(src+width*2),\
- "r"(src+width*2+src_linesize),\
- "m"(*pw_ff)\
- :"memory"\
- );
- if (((intptr_t) src | src_linesize) & 15) {
- BLURV("movdqu");
- } else {
- BLURV("movdqa");
- }
-}
-#endif /* HAVE_SSE2_INLINE */
-
-#endif /* HAVE_INLINE_ASM */
-
-av_cold void ff_gradfun_init_x86(GradFunContext *gf)
-{
- int cpu_flags = av_get_cpu_flags();
-
-#if HAVE_MMXEXT_INLINE
- if (cpu_flags & AV_CPU_FLAG_MMXEXT)
- gf->filter_line = gradfun_filter_line_mmxext;
-#endif
-#if HAVE_SSSE3_INLINE
- if (cpu_flags & AV_CPU_FLAG_SSSE3)
- gf->filter_line = gradfun_filter_line_ssse3;
-#endif
-#if HAVE_SSE2_INLINE
- if (cpu_flags & AV_CPU_FLAG_SSE2)
- gf->blur_line = gradfun_blur_line_sse2;
-#endif
-}
diff --git a/ffmpeg/libavfilter/x86/vf_hqdn3d_init.c b/ffmpeg/libavfilter/x86/vf_hqdn3d_init.c
index 4abb878..b63916b 100644
--- a/ffmpeg/libavfilter/x86/vf_hqdn3d_init.c
+++ b/ffmpeg/libavfilter/x86/vf_hqdn3d_init.c
@@ -25,17 +25,25 @@
#include "libavfilter/vf_hqdn3d.h"
#include "config.h"
-void ff_hqdn3d_row_8_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
-void ff_hqdn3d_row_9_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
-void ff_hqdn3d_row_10_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
-void ff_hqdn3d_row_16_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
+void ff_hqdn3d_row_8_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant,
+ uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial,
+ int16_t *temporal);
+void ff_hqdn3d_row_9_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant,
+ uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial,
+ int16_t *temporal);
+void ff_hqdn3d_row_10_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant,
+ uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial,
+ int16_t *temporal);
+void ff_hqdn3d_row_16_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant,
+ uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial,
+ int16_t *temporal);
av_cold void ff_hqdn3d_init_x86(HQDN3DContext *hqdn3d)
{
#if HAVE_YASM
- hqdn3d->denoise_row[ 8] = ff_hqdn3d_row_8_x86;
- hqdn3d->denoise_row[ 9] = ff_hqdn3d_row_9_x86;
+ hqdn3d->denoise_row[8] = ff_hqdn3d_row_8_x86;
+ hqdn3d->denoise_row[9] = ff_hqdn3d_row_9_x86;
hqdn3d->denoise_row[10] = ff_hqdn3d_row_10_x86;
hqdn3d->denoise_row[16] = ff_hqdn3d_row_16_x86;
-#endif
+#endif /* HAVE_YASM */
}
diff --git a/ffmpeg/libavfilter/x86/vf_yadif_init.c b/ffmpeg/libavfilter/x86/vf_yadif_init.c
deleted file mode 100644
index 58f2fc6..0000000
--- a/ffmpeg/libavfilter/x86/vf_yadif_init.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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 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 "libavutil/x86/cpu.h"
-#include "libavcodec/x86/dsputil_mmx.h"
-#include "libavfilter/yadif.h"
-
-void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-
-void ff_yadif_filter_line_16bit_mmxext(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_16bit_sse2(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_16bit_ssse3(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_16bit_sse4(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-
-void ff_yadif_filter_line_10bit_mmxext(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_10bit_sse2(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur,
- void *next, int w, int prefs,
- int mrefs, int parity, int mode);
-
-av_cold void ff_yadif_init_x86(YADIFContext *yadif)
-{
- int cpu_flags = av_get_cpu_flags();
- int bit_depth = (!yadif->csp) ? 8
- : yadif->csp->comp[0].depth_minus1 + 1;
-
-#if HAVE_YASM
- if (bit_depth >= 15) {
-#if ARCH_X86_32
- if (EXTERNAL_MMXEXT(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_16bit_mmxext;
-#endif /* ARCH_X86_32 */
- if (EXTERNAL_SSE2(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_16bit_sse2;
- if (EXTERNAL_SSSE3(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_16bit_ssse3;
- if (EXTERNAL_SSE4(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_16bit_sse4;
- } else if ( bit_depth >= 9 && bit_depth <= 14) {
-#if ARCH_X86_32
- if (EXTERNAL_MMXEXT(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_10bit_mmxext;
-#endif /* ARCH_X86_32 */
- if (EXTERNAL_SSE2(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_10bit_sse2;
- if (EXTERNAL_SSSE3(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_10bit_ssse3;
- } else {
-#if ARCH_X86_32
- if (EXTERNAL_MMXEXT(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_mmxext;
-#endif /* ARCH_X86_32 */
- if (EXTERNAL_SSE2(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_sse2;
- if (EXTERNAL_SSSE3(cpu_flags))
- yadif->filter_line = ff_yadif_filter_line_ssse3;
- }
-#endif /* HAVE_YASM */
-}