aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2013-04-20 22:03:19 +0200
committerDiego Biurrun <diego@biurrun.de>2013-04-22 10:42:50 +0200
commit78fa0bd0f7067868943c0899907e313414492426 (patch)
tree966d5f8712fb8b24b152023b6609940de9b3fe7a /libavcodec
parent311a592dfcfc20b601a592472b36593351cf32c3 (diff)
downloadffmpeg-78fa0bd0f7067868943c0899907e313414492426.tar.gz
x86: cavs: Put mmx-specific code into its own init function
Before, this code was labeled as mmxext and enabled both for the 3dnow and the mmxext case.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/x86/cavsdsp.c30
-rw-r--r--libavcodec/x86/dsputil_mmx.c8
-rw-r--r--libavcodec/x86/dsputil_mmx.h8
3 files changed, 31 insertions, 15 deletions
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index 8574588929..c1506e00f1 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -31,7 +31,7 @@
#include "dsputil_mmx.h"
#include "config.h"
-#if (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE)
+#if HAVE_MMX_INLINE
/* in/out: mma=mma+mmb, mmb=mmb-mma */
#define SUMSUB_BA( a, b ) \
@@ -187,6 +187,10 @@ static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
ff_add_pixels_clamped_mmx(b2, dst, stride);
}
+#endif /* HAVE_MMX_INLINE */
+
+#if (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE)
+
/*****************************************************************************
*
* motion compensation
@@ -441,6 +445,20 @@ static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, ui
#endif /* (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE) */
+#if HAVE_MMX_INLINE
+static av_cold void cavsdsp_init_mmx(CAVSDSPContext *c,
+ AVCodecContext *avctx)
+{
+ c->put_cavs_qpel_pixels_tab[0][0] = ff_put_cavs_qpel16_mc00_mmx;
+ c->put_cavs_qpel_pixels_tab[1][0] = ff_put_cavs_qpel8_mc00_mmx;
+ c->avg_cavs_qpel_pixels_tab[0][0] = ff_avg_cavs_qpel16_mc00_mmx;
+ c->avg_cavs_qpel_pixels_tab[1][0] = ff_avg_cavs_qpel8_mc00_mmx;
+
+ c->cavs_idct8_add = cavs_idct8_add_mmx;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+}
+#endif /* HAVE_MMX_INLINE */
+
#if HAVE_MMXEXT_INLINE
QPEL_CAVS(put_, PUT_OP, mmxext)
QPEL_CAVS(avg_, AVG_MMXEXT_OP, mmxext)
@@ -454,7 +472,6 @@ static av_cold void ff_cavsdsp_init_mmxext(CAVSDSPContext *c,
AVCodecContext *avctx)
{
#define dspfunc(PFX, IDX, NUM) \
- c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmxext; \
c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmxext; \
c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_mmxext; \
c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_mmxext; \
@@ -465,8 +482,6 @@ static av_cold void ff_cavsdsp_init_mmxext(CAVSDSPContext *c,
dspfunc(avg_cavs_qpel, 0, 16);
dspfunc(avg_cavs_qpel, 1, 8);
#undef dspfunc
- c->cavs_idct8_add = cavs_idct8_add_mmx;
- c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
}
#endif /* HAVE_MMXEXT_INLINE */
@@ -483,7 +498,6 @@ static av_cold void ff_cavsdsp_init_3dnow(CAVSDSPContext *c,
AVCodecContext *avctx)
{
#define dspfunc(PFX, IDX, NUM) \
- c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmxext; \
c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \
c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_3dnow; \
c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_3dnow; \
@@ -494,15 +508,17 @@ static av_cold void ff_cavsdsp_init_3dnow(CAVSDSPContext *c,
dspfunc(avg_cavs_qpel, 0, 16);
dspfunc(avg_cavs_qpel, 1, 8);
#undef dspfunc
- c->cavs_idct8_add = cavs_idct8_add_mmx;
- c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
}
#endif /* HAVE_AMD3DNOW_INLINE */
av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
{
+#if HAVE_MMX_INLINE
int mm_flags = av_get_cpu_flags();
+ if (mm_flags & AV_CPU_FLAG_MMX)
+ cavsdsp_init_mmx(c, avctx);
+#endif /* HAVE_MMX_INLINE */
#if HAVE_MMXEXT_INLINE
if (mm_flags & AV_CPU_FLAG_MMXEXT) ff_cavsdsp_init_mmxext(c, avctx);
#endif /* HAVE_MMXEXT_INLINE */
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 63f935dc63..d3bc72c791 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -1143,22 +1143,22 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src,
}
/* CAVS-specific */
-void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_put_cavs_qpel8_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
{
put_pixels8_mmx(dst, src, stride, 8);
}
-void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_avg_cavs_qpel8_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
{
avg_pixels8_mmx(dst, src, stride, 8);
}
-void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_put_cavs_qpel16_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
{
put_pixels16_mmx(dst, src, stride, 16);
}
-void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_avg_cavs_qpel16_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
{
avg_pixels16_mmx(dst, src, stride, 16);
}
diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h
index 9614e6cab9..c3e42c2ad8 100644
--- a/libavcodec/x86/dsputil_mmx.h
+++ b/libavcodec/x86/dsputil_mmx.h
@@ -88,10 +88,10 @@ void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
ptrdiff_t line_size, int h);
-void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
-void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
-void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
-void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
+void ff_put_cavs_qpel8_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
+void ff_avg_cavs_qpel8_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
+void ff_put_cavs_qpel16_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
+void ff_avg_cavs_qpel16_mc00_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride);
void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int rnd);