x86: Fix linking with some or all of yasm, mmx, optimizations disabled

Some optimized template functions reference optimized symbols, so they
must be explicitly disabled when those symbols are unavailable.
This commit is contained in:
Diego Biurrun 2012-08-29 11:14:17 +02:00
parent 50cd43f2cd
commit ec36aa6944
3 changed files with 27 additions and 12 deletions

View File

@ -182,6 +182,7 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out,
#endif /* HAVE_INLINE_ASM */
#if HAVE_YASM
#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \
static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \
int count, int switch_point, int block_type) \
@ -219,6 +220,7 @@ DECL_IMDCT_BLOCKS(sse2,sse)
DECL_IMDCT_BLOCKS(sse3,sse)
DECL_IMDCT_BLOCKS(ssse3,sse)
DECL_IMDCT_BLOCKS(avx,avx)
#endif /* HAVE_YASM */
void ff_mpadsp_init_mmx(MPADSPContext *s)
{

View File

@ -30,13 +30,16 @@
extern uint16_t ff_inv_zigzag_direct16[64];
#if HAVE_MMX
#define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_SSE2 0
#define COMPILE_TEMPLATE_SSSE3 0
#define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx
#include "mpegvideoenc_template.c"
#endif /* HAVE_MMX */
#if HAVE_MMXEXT
#undef COMPILE_TEMPLATE_SSSE3
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT
@ -48,7 +51,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2
#include "mpegvideoenc_template.c"
#endif /* HAVE_MMXEXT */
#if HAVE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3
@ -60,6 +65,7 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif /* HAVE_SSE2 */
#if HAVE_SSSE3
#undef COMPILE_TEMPLATE_MMXEXT
@ -73,7 +79,7 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c"
#endif
#endif /* HAVE_SSSE3 */
#endif /* HAVE_INLINE_ASM */
@ -84,18 +90,22 @@ void ff_MPV_encode_init_x86(MpegEncContext *s)
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 && HAVE_SSE) {
s->dct_quantize = dct_quantize_SSE2;
} else if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
s->dct_quantize = dct_quantize_MMX2;
} else if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
#if HAVE_MMX
if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
s->dct_quantize = dct_quantize_MMX;
}
#endif
#if HAVE_MMXEXT
if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
s->dct_quantize = dct_quantize_MMX2;
#endif
#if HAVE_SSE2
if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
s->dct_quantize = dct_quantize_SSE2;
#endif
#if HAVE_SSSE3
if (mm_flags & AV_CPU_FLAG_SSSE3)
s->dct_quantize = dct_quantize_SSSE3;
#endif
}
#endif /* HAVE_INLINE_ASM */
}

View File

@ -30,6 +30,7 @@
#include "libavutil/mem.h"
#include "dsputil_mmx.h"
#if HAVE_YASM
void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y);
void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src,
@ -183,6 +184,8 @@ QPEL_FUNCS_SET (OP, 3, 1, OPT) \
QPEL_FUNCS_SET (OP, 3, 2, OPT)
/** @} */
#endif /* HAVE_YASM */
void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
{
#if HAVE_YASM