summaryrefslogtreecommitdiff
path: root/libavcodec/x86
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/x86
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/x86')
-rw-r--r--libavcodec/x86/Makefile1
-rw-r--r--libavcodec/x86/dsputil_mmx.c35
-rw-r--r--libavcodec/x86/vp3dsp.asm4
-rw-r--r--libavcodec/x86/vp3dsp_init.c65
4 files changed, 66 insertions, 39 deletions
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 1949074c58..1d2635749f 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -1,5 +1,6 @@
OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o
OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o
+OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
MMX-OBJS += x86/dsputil_mmx.o \
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index b695bd28ec..c1d158e166 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2476,20 +2476,6 @@ static void vector_clipf_sse(float *dst, const float *src,
);
}
-void ff_vp3_idct_mmx(int16_t *input_data);
-void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-
-void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size,
- const DCTELEM *block);
-
-void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-
-void ff_vp3_idct_sse2(int16_t *input_data);
-void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-
int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2,
int order);
int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
@@ -2681,14 +2667,7 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx,
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
}
-
- if (CONFIG_VP3_DECODER && HAVE_YASM) {
- c->vp3_v_loop_filter = ff_vp3_v_loop_filter_mmx2;
- c->vp3_h_loop_filter = ff_vp3_h_loop_filter_mmx2;
- }
}
- if (CONFIG_VP3_DECODER && HAVE_YASM)
- c->vp3_idct_dc_add = ff_vp3_idct_dc_add_mmx2;
if (CONFIG_VP3_DECODER && (avctx->codec_id == CODEC_ID_VP3 ||
avctx->codec_id == CODEC_ID_THEORA)) {
@@ -3064,20 +3043,6 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
}
c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
#endif
- } else if ((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER ||
- CONFIG_VP6_DECODER) &&
- idct_algo == FF_IDCT_VP3 && HAVE_YASM) {
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- c->idct_put = ff_vp3_idct_put_sse2;
- c->idct_add = ff_vp3_idct_add_sse2;
- c->idct = ff_vp3_idct_sse2;
- c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
- } else {
- c->idct_put = ff_vp3_idct_put_mmx;
- c->idct_add = ff_vp3_idct_add_mmx;
- c->idct = ff_vp3_idct_mmx;
- c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM;
- }
} else if (idct_algo == FF_IDCT_CAVS) {
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
} else if (idct_algo == FF_IDCT_XVIDMMX) {
diff --git a/libavcodec/x86/vp3dsp.asm b/libavcodec/x86/vp3dsp.asm
index 791cc8ec35..58fa1f7b27 100644
--- a/libavcodec/x86/vp3dsp.asm
+++ b/libavcodec/x86/vp3dsp.asm
@@ -524,10 +524,6 @@ cglobal vp3_h_loop_filter_mmx2, 3, 4
%endmacro
%macro vp3_idct_funcs 3
-cglobal vp3_idct_%1, 1, 1, %2
- VP3_IDCT_%1 r0
- RET
-
cglobal vp3_idct_put_%1, 3, %3, %2
VP3_IDCT_%1 r2
%if ARCH_X86_64
diff --git a/libavcodec/x86/vp3dsp_init.c b/libavcodec/x86/vp3dsp_init.c
new file mode 100644
index 0000000000..cd8e206a2c
--- /dev/null
+++ b/libavcodec/x86/vp3dsp_init.c
@@ -0,0 +1,65 @@
+/*
+ * 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 "libavcodec/avcodec.h"
+#include "libavcodec/vp3dsp.h"
+#include "config.h"
+
+void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
+
+void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
+
+void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size,
+ const DCTELEM *block);
+
+void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
+void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
+
+av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
+{
+#if HAVE_YASM
+ int cpuflags = av_get_cpu_flags();
+
+ if (HAVE_MMX && cpuflags & AV_CPU_FLAG_MMX) {
+ c->idct_put = ff_vp3_idct_put_mmx;
+ c->idct_add = ff_vp3_idct_add_mmx;
+ c->idct_perm = FF_PARTTRANS_IDCT_PERM;
+ }
+
+ if (HAVE_MMX2 && cpuflags & AV_CPU_FLAG_MMX2) {
+ c->idct_dc_add = ff_vp3_idct_dc_add_mmx2;
+
+ if (!(flags & CODEC_FLAG_BITEXACT)) {
+ c->v_loop_filter = ff_vp3_v_loop_filter_mmx2;
+ c->h_loop_filter = ff_vp3_h_loop_filter_mmx2;
+ }
+ }
+
+ if (cpuflags & AV_CPU_FLAG_SSE2) {
+ c->idct_put = ff_vp3_idct_put_sse2;
+ c->idct_add = ff_vp3_idct_add_sse2;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+ }
+#endif
+}