summaryrefslogtreecommitdiff
path: root/libavcodec/x86
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-02-13 17:57:05 +0100
committerDiego Biurrun <diego@biurrun.de>2014-06-22 18:22:31 -0700
commitc67b449bebbe0b35c73b203683e77a0a649bc765 (patch)
treefef2691cbb548198024dbc1461419dfdd9d3fea2 /libavcodec/x86
parent7b9ef8d701c319c26f7d0664fe977e176764c74e (diff)
dsputil: Split bswap*_buf() off into a separate context
Diffstat (limited to 'libavcodec/x86')
-rw-r--r--libavcodec/x86/Makefile3
-rw-r--r--libavcodec/x86/bswapdsp.asm (renamed from libavcodec/x86/dsputil.asm)2
-rw-r--r--libavcodec/x86/bswapdsp_init.c37
-rw-r--r--libavcodec/x86/dsputil_init.c18
4 files changed, 40 insertions, 20 deletions
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 483c850737..587ff39bf4 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -3,6 +3,7 @@ OBJS += x86/constants.o \
OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o
+OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp_init.o
OBJS-$(CONFIG_DCT) += x86/dct_init.o
OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_init.o
OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
@@ -64,9 +65,9 @@ YASM-OBJS += x86/deinterlace.o \
YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
YASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o
+YASM-OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp.o
YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o
YASM-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
-YASM-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil.o
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_H263DSP) += x86/h263_loopfilter.o
diff --git a/libavcodec/x86/dsputil.asm b/libavcodec/x86/bswapdsp.asm
index 8f5a14d5a9..17a6cb1be3 100644
--- a/libavcodec/x86/dsputil.asm
+++ b/libavcodec/x86/bswapdsp.asm
@@ -1,5 +1,5 @@
;******************************************************************************
-;* MMX optimized DSP utils
+;* optimized bswap buffer functions
;* Copyright (c) 2008 Loren Merritt
;*
;* This file is part of Libav.
diff --git a/libavcodec/x86/bswapdsp_init.c b/libavcodec/x86/bswapdsp_init.c
new file mode 100644
index 0000000000..ba40f2dbe1
--- /dev/null
+++ b/libavcodec/x86/bswapdsp_init.c
@@ -0,0 +1,37 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/bswapdsp.h"
+
+void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w);
+void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w);
+
+av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_SSE2(cpu_flags))
+ c->bswap_buf = ff_bswap32_buf_sse2;
+ if (EXTERNAL_SSSE3(cpu_flags))
+ c->bswap_buf = ff_bswap32_buf_ssse3;
+}
diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c
index 646435df11..e69db8e9f0 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -26,9 +26,6 @@
#include "dsputil_x86.h"
#include "idct_xvid.h"
-void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w);
-void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w);
-
static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
int cpu_flags, unsigned high_bit_depth)
{
@@ -83,18 +80,6 @@ static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
c->idct_permutation_type = FF_SSE2_IDCT_PERM;
}
#endif /* HAVE_SSE2_INLINE */
-
-#if HAVE_SSE2_EXTERNAL
- c->bswap_buf = ff_bswap32_buf_sse2;
-#endif /* HAVE_SSE2_EXTERNAL */
-}
-
-static av_cold void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
- int cpu_flags, unsigned high_bit_depth)
-{
-#if HAVE_SSSE3_EXTERNAL
- c->bswap_buf = ff_bswap32_buf_ssse3;
-#endif /* HAVE_SSSE3_EXTERNAL */
}
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
@@ -111,9 +96,6 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
if (X86_SSE2(cpu_flags))
dsputil_init_sse2(c, avctx, cpu_flags, high_bit_depth);
- if (EXTERNAL_SSSE3(cpu_flags))
- dsputil_init_ssse3(c, avctx, cpu_flags, high_bit_depth);
-
if (CONFIG_ENCODERS)
ff_dsputilenc_init_mmx(c, avctx, high_bit_depth);
}