diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 18:28:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 18:29:05 +0200 |
commit | f84e373797eb8ef7028b93f5ac9b0b7e1c5e0e78 (patch) | |
tree | b0ef90eb864df0a320f9c41d4eddd5d04a36b353 | |
parent | 6d7ec4fc2ef7ea0703f7cde7b2335bba2bc4db0f (diff) | |
parent | 78fa0bd0f7067868943c0899907e313414492426 (diff) | |
download | ffmpeg-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>
-rw-r--r-- | libavcodec/x86/cavsdsp.c | 30 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_mmx.c | 8 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_mmx.h | 8 |
3 files changed, 31 insertions, 15 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 */ diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 7e16592b6c..ca9d623448 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -1211,22 +1211,22 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, #endif /* 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 778ed67661..f3e32f38e3 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); |