summaryrefslogtreecommitdiff
path: root/libavcodec/x86
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-24 14:22:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-24 14:30:40 +0200
commitbec180e1127f6753b5af1e6e5242020e0de12366 (patch)
treeb27493eb57b5a484bde3cbc5740d9e60f06f9776 /libavcodec/x86
parent6b72615c32d7f3bc53a6d6075042aee626d07412 (diff)
parenta1bcc76e6036e78f25cbb7323c145056cfca9d93 (diff)
Merge commit 'a1bcc76e6036e78f25cbb7323c145056cfca9d93'
* commit 'a1bcc76e6036e78f25cbb7323c145056cfca9d93': (21 commits) cmdutils: fix a memleak when specifying an option twice. x86: mpegvideo: more sensible names for optimization file and init function x86: mpegvideoenc: Split optimizations off into a separate file dnxhdenc: x86: more sensible names for optimization file and init function svq1/svq3: Move common code out of SVQ1 decoder-specific file dirac: add Comments and references to the standard lavr: x86: optimized 6-channel flt to fltp conversion lavr: x86: optimized 2-channel flt to fltp conversion lavr: x86: optimized 6-channel flt to s16p conversion lavr: x86: optimized 2-channel flt to s16p conversion lavr: x86: optimized 6-channel s16 to fltp conversion lavr: x86: optimized 2-channel s16 to fltp conversion lavr: x86: optimized 6-channel s16 to s16p conversion lavr: x86: optimized 2-channel s16 to s16p conversion lavr: x86: optimized 2-channel fltp to flt conversion lavr: x86: optimized 6-channel fltp to s16 conversion lavr: x86: optimized 2-channel fltp to s16 conversion lavr: x86: optimized 6-channel s16p to flt conversion lavr: x86: optimized 2-channel s16p to flt conversion lavr: x86: optimized 6-channel s16p to s16 conversion ... Conflicts: libavcodec/dirac.c libavcodec/mpegvideo.h libavcodec/x86/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86')
-rw-r--r--libavcodec/x86/Makefile5
-rw-r--r--libavcodec/x86/dnxhdenc.c (renamed from libavcodec/x86/dnxhd_mmx.c)2
-rw-r--r--libavcodec/x86/mpegvideo.c (renamed from libavcodec/x86/mpegvideo_mmx.c)65
-rw-r--r--libavcodec/x86/mpegvideoenc.c96
-rw-r--r--libavcodec/x86/mpegvideoenc_template.c (renamed from libavcodec/x86/mpegvideo_mmx_template.c)0
5 files changed, 101 insertions, 67 deletions
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 73a6a6032c..f90f12e877 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -14,7 +14,7 @@ MMX-OBJS += x86/dsputil_mmx.o \
MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o
-MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o
+MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \
x86/dwt.o
MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o
@@ -24,7 +24,8 @@ MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o
MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o
MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o
-MMX-OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo_mmx.o
+MMX-OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o
+MMX-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o
MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o
MMX-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp_init.o
MMX-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp_init.o
diff --git a/libavcodec/x86/dnxhd_mmx.c b/libavcodec/x86/dnxhdenc.c
index ccd1575545..8b0c2ad225 100644
--- a/libavcodec/x86/dnxhd_mmx.c
+++ b/libavcodec/x86/dnxhdenc.c
@@ -54,7 +54,7 @@ static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int l
#endif /* HAVE_INLINE_ASM */
-void ff_dnxhd_init_mmx(DNXHDEncContext *ctx)
+void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
{
#if HAVE_INLINE_ASM
if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
diff --git a/libavcodec/x86/mpegvideo_mmx.c b/libavcodec/x86/mpegvideo.c
index f3927f0eae..2d475abe01 100644
--- a/libavcodec/x86/mpegvideo_mmx.c
+++ b/libavcodec/x86/mpegvideo.c
@@ -1,7 +1,4 @@
/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
* Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru>
* h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni@gmx.at>
*
@@ -31,9 +28,6 @@
#if HAVE_INLINE_ASM
-extern uint16_t ff_inv_zigzag_direct16[64];
-
-
static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{
@@ -588,56 +582,14 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
);
}
-#if HAVE_SSSE3
-#define HAVE_SSSE3_BAK
-#endif
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 0
-
-#undef HAVE_SSE2
-#undef HAVE_MMXEXT
-#define HAVE_SSE2 0
-#define HAVE_MMXEXT 0
-#define RENAME(a) a ## _MMX
-#define RENAMEl(a) a ## _mmx
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_MMXEXT
-#define HAVE_MMXEXT 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _MMX2
-#define RENAMEl(a) a ## _mmx2
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_SSE2
-#define HAVE_SSE2 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSE2
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-
-#ifdef HAVE_SSSE3_BAK
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSSE3
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-#endif
-
#endif /* HAVE_INLINE_ASM */
-void ff_MPV_common_init_mmx(MpegEncContext *s)
+void ff_MPV_common_init_x86(MpegEncContext *s)
{
#if HAVE_INLINE_ASM
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX) {
- const int dct_algo = s->avctx->dct_algo;
-
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
@@ -651,21 +603,6 @@ void ff_MPV_common_init_mmx(MpegEncContext *s)
} else {
s->denoise_dct= denoise_dct_mmx;
}
-
- if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
-#if HAVE_SSSE3
- if(mm_flags & AV_CPU_FLAG_SSSE3){
- s->dct_quantize= dct_quantize_SSSE3;
- } else
-#endif
- if(mm_flags & AV_CPU_FLAG_SSE2){
- s->dct_quantize= dct_quantize_SSE2;
- } else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
- s->dct_quantize= dct_quantize_MMX2;
- } else {
- s->dct_quantize= dct_quantize_MMX;
- }
- }
}
#endif /* HAVE_INLINE_ASM */
}
diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
new file mode 100644
index 0000000000..2d190f979f
--- /dev/null
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -0,0 +1,96 @@
+/*
+ * The simplest mpeg encoder (well, it was the simplest!)
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ *
+ * 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/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/mpegvideo.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_INLINE_ASM
+
+extern uint16_t ff_inv_zigzag_direct16[64];
+
+#if HAVE_SSSE3
+#define HAVE_SSSE3_BAK
+#endif
+#undef HAVE_SSSE3
+#define HAVE_SSSE3 0
+
+#undef HAVE_SSE2
+#undef HAVE_MMXEXT
+#define HAVE_SSE2 0
+#define HAVE_MMXEXT 0
+#define RENAME(a) a ## _MMX
+#define RENAMEl(a) a ## _mmx
+#include "mpegvideoenc_template.c"
+
+#undef HAVE_MMXEXT
+#define HAVE_MMXEXT 1
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _MMX2
+#define RENAMEl(a) a ## _mmx2
+#include "mpegvideoenc_template.c"
+
+#undef HAVE_SSE2
+#define HAVE_SSE2 1
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _SSE2
+#define RENAMEl(a) a ## _sse2
+#include "mpegvideoenc_template.c"
+
+#ifdef HAVE_SSSE3_BAK
+#undef HAVE_SSSE3
+#define HAVE_SSSE3 1
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _SSSE3
+#define RENAMEl(a) a ## _sse2
+#include "mpegvideoenc_template.c"
+#endif
+
+#endif /* HAVE_INLINE_ASM */
+
+void ff_MPV_encode_init_x86(MpegEncContext *s)
+{
+#if HAVE_INLINE_ASM
+ int mm_flags = av_get_cpu_flags();
+ const int dct_algo = s->avctx->dct_algo;
+
+ if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
+#if HAVE_SSSE3
+ if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ s->dct_quantize = dct_quantize_SSSE3;
+ } else
+#endif
+ if (mm_flags & AV_CPU_FLAG_SSE2) {
+ s->dct_quantize = dct_quantize_SSE2;
+ } else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ s->dct_quantize = dct_quantize_MMX2;
+ } else {
+ s->dct_quantize = dct_quantize_MMX;
+ }
+ }
+#endif /* HAVE_INLINE_ASM */
+}
diff --git a/libavcodec/x86/mpegvideo_mmx_template.c b/libavcodec/x86/mpegvideoenc_template.c
index d538a39919..d538a39919 100644
--- a/libavcodec/x86/mpegvideo_mmx_template.c
+++ b/libavcodec/x86/mpegvideoenc_template.c