aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86/cavsdsp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-22 18:28:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-22 18:29:05 +0200
commitf84e373797eb8ef7028b93f5ac9b0b7e1c5e0e78 (patch)
treeb0ef90eb864df0a320f9c41d4eddd5d04a36b353 /libavcodec/x86/cavsdsp.c
parent6d7ec4fc2ef7ea0703f7cde7b2335bba2bc4db0f (diff)
parent78fa0bd0f7067868943c0899907e313414492426 (diff)
downloadffmpeg-f84e373797eb8ef7028b93f5ac9b0b7e1c5e0e78.tar.gz
Merge commit '78fa0bd0f7067868943c0899907e313414492426'
* commit '78fa0bd0f7067868943c0899907e313414492426': x86: cavs: Put mmx-specific code into its own init function Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/cavsdsp.c')
-rw-r--r--libavcodec/x86/cavsdsp.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index deeb5cf055..c891234b42 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 */