summaryrefslogtreecommitdiff
path: root/libavcodec/ppc
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-02-03 10:09:45 -0800
committerDiego Biurrun <diego@biurrun.de>2014-07-07 12:28:45 -0700
commita9aee08d900f686e966c64afec5d88a7d9d130a3 (patch)
tree92335216bc97235507f805401693ed534a8f5fc9 /libavcodec/ppc
parent1e9a93bfca2c2f43a07e01f2ef9fd5cbafe6c22d (diff)
dsputil: Split off FDCT bits into their own context
Diffstat (limited to 'libavcodec/ppc')
-rw-r--r--libavcodec/ppc/Makefile2
-rw-r--r--libavcodec/ppc/dsputil_altivec.h2
-rw-r--r--libavcodec/ppc/dsputil_ppc.c9
-rw-r--r--libavcodec/ppc/fdctdsp.c (renamed from libavcodec/ppc/fdct_altivec.c)27
-rw-r--r--libavcodec/ppc/fdctdsp.h26
5 files changed, 52 insertions, 14 deletions
diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile
index 256c081dc1..5118b9e6c4 100644
--- a/libavcodec/ppc/Makefile
+++ b/libavcodec/ppc/Makefile
@@ -9,6 +9,7 @@ OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o
OBJS-$(CONFIG_H264QPEL) += ppc/h264qpel.o
OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o
OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o
+OBJS-$(CONFIG_FDCTDSP) += ppc/fdctdsp.o
OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp.o
OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o
OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \
@@ -25,7 +26,6 @@ OBJS-$(CONFIG_VP7_DECODER) += ppc/vp8dsp_altivec.o
OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
ALTIVEC-OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o \
- ppc/fdct_altivec.o \
FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o
ALTIVEC-OBJS-$(CONFIG_FFT) += $(FFT-OBJS-yes)
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h
index be5fd58669..bbf9a9d5b7 100644
--- a/libavcodec/ppc/dsputil_altivec.h
+++ b/libavcodec/ppc/dsputil_altivec.h
@@ -27,8 +27,6 @@
#include "libavcodec/dsputil.h"
-void ff_fdct_altivec(int16_t *block);
-
void ff_dsputil_init_altivec(DSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth);
diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c
index b54111310e..890157fc1c 100644
--- a/libavcodec/ppc/dsputil_ppc.c
+++ b/libavcodec/ppc/dsputil_ppc.c
@@ -34,14 +34,5 @@ av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx,
{
if (PPC_ALTIVEC(av_get_cpu_flags())) {
ff_dsputil_init_altivec(c, avctx, high_bit_depth);
-
- if (!high_bit_depth) {
-#if CONFIG_ENCODERS
- if (avctx->dct_algo == FF_DCT_AUTO ||
- avctx->dct_algo == FF_DCT_ALTIVEC) {
- c->fdct = ff_fdct_altivec;
- }
-#endif //CONFIG_ENCODERS
- }
}
}
diff --git a/libavcodec/ppc/fdct_altivec.c b/libavcodec/ppc/fdctdsp.c
index 8914d9bf9b..d7b5b7ab7c 100644
--- a/libavcodec/ppc/fdct_altivec.c
+++ b/libavcodec/ppc/fdctdsp.c
@@ -23,8 +23,13 @@
#include <altivec.h>
#endif
-#include "libavutil/common.h"
-#include "dsputil_altivec.h"
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/ppc/cpu.h"
+#include "libavcodec/fdctdsp.h"
+#include "fdctdsp.h"
+
+#if HAVE_ALTIVEC
#define vs16(v) ((vector signed short) (v))
#define vs32(v) ((vector signed int) (v))
@@ -454,3 +459,21 @@ void ff_fdct_altivec(int16_t *block)
#undef CTS
/* }}} */
}
+
+#endif /* HAVE_ALTIVEC */
+
+av_cold void ff_fdctdsp_init_ppc(FDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth)
+{
+#if HAVE_ALTIVEC
+ if (!PPC_ALTIVEC(av_get_cpu_flags()))
+ return;
+
+ if (!high_bit_depth) {
+ if (avctx->dct_algo == FF_DCT_AUTO ||
+ avctx->dct_algo == FF_DCT_ALTIVEC) {
+ c->fdct = ff_fdct_altivec;
+ }
+ }
+#endif /* HAVE_ALTIVEC */
+}
diff --git a/libavcodec/ppc/fdctdsp.h b/libavcodec/ppc/fdctdsp.h
new file mode 100644
index 0000000000..845b4fe554
--- /dev/null
+++ b/libavcodec/ppc/fdctdsp.h
@@ -0,0 +1,26 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_PPC_FDCTDSP_H
+#define AVCODEC_PPC_FDCTDSP_H
+
+#include <stdint.h>
+
+void ff_fdct_altivec(int16_t *block);
+
+#endif /* AVCODEC_PPC_FDCTDSP_H */