summaryrefslogtreecommitdiff
path: root/libavcodec/ppc/vp3dsp_altivec.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-07-17 16:47:43 +0100
committerMans Rullgard <mans@mansr.com>2012-07-18 10:32:19 +0100
commit28f9ab7029bd1a02f659995919f899f84ee7361b (patch)
treecc5544768e088acef9f18e0c8038f72bd1a91b9d /libavcodec/ppc/vp3dsp_altivec.c
parentab9f9876615fd856184912cf3863a80cf3a721b6 (diff)
vp3: move idct and loop filter pointers to new vp3dsp context
This moves all VP3-specific function pointers from dsputil to a new vp3dsp context. There is no reason to ever use the VP3 IDCT where an MPEG2 IDCT is expected or vice versa. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/ppc/vp3dsp_altivec.c')
-rw-r--r--libavcodec/ppc/vp3dsp_altivec.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/libavcodec/ppc/vp3dsp_altivec.c b/libavcodec/ppc/vp3dsp_altivec.c
index 938502e8bd..0c493e98cd 100644
--- a/libavcodec/ppc/vp3dsp_altivec.c
+++ b/libavcodec/ppc/vp3dsp_altivec.c
@@ -18,6 +18,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/vp3dsp.h"
+
+#if HAVE_ALTIVEC
+
#include "libavutil/ppc/types_altivec.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
@@ -107,25 +114,7 @@ static inline vec_s16 M16(vec_s16 a, vec_s16 C)
#define ADD8(a) vec_add(a, eight)
#define SHIFT4(a) vec_sra(a, four)
-void ff_vp3_idct_altivec(DCTELEM block[64])
-{
- IDCT_START
-
- IDCT_1D(NOP, NOP)
- TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
- IDCT_1D(ADD8, SHIFT4)
-
- vec_st(b0, 0x00, block);
- vec_st(b1, 0x10, block);
- vec_st(b2, 0x20, block);
- vec_st(b3, 0x30, block);
- vec_st(b4, 0x40, block);
- vec_st(b5, 0x50, block);
- vec_st(b6, 0x60, block);
- vec_st(b7, 0x70, block);
-}
-
-void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
+static void vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
{
vec_u8 t;
IDCT_START
@@ -153,7 +142,7 @@ void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
PUT(b7)
}
-void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
+static void vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
{
LOAD_ZERO;
vec_u8 t, vdst;
@@ -183,3 +172,14 @@ void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
ADD(b6) dst += stride;
ADD(b7)
}
+
+#endif /* HAVE_ALTIVEC */
+
+av_cold void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags)
+{
+ if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
+ c->idct_put = vp3_idct_put_altivec;
+ c->idct_add = vp3_idct_add_altivec;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+ }
+}