Browse Source

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.
tags/n1.0
Diego Biurrun 12 years ago
parent
commit
ec36aa6944
3 changed files with 25 additions and 10 deletions
  1. +2
    -0
      libavcodec/x86/mpegaudiodec.c
  2. +20
    -10
      libavcodec/x86/mpegvideoenc.c
  3. +3
    -0
      libavcodec/x86/rv40dsp_init.c

+ 2
- 0
libavcodec/x86/mpegaudiodec.c View File

@@ -182,6 +182,7 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out,


#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */


#if HAVE_YASM
#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \ #define DECL_IMDCT_BLOCKS(CPU1, CPU2) \
static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \ static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \
int count, int switch_point, int block_type) \ 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(sse3,sse)
DECL_IMDCT_BLOCKS(ssse3,sse) DECL_IMDCT_BLOCKS(ssse3,sse)
DECL_IMDCT_BLOCKS(avx,avx) DECL_IMDCT_BLOCKS(avx,avx)
#endif /* HAVE_YASM */


void ff_mpadsp_init_mmx(MPADSPContext *s) void ff_mpadsp_init_mmx(MPADSPContext *s)
{ {


+ 20
- 10
libavcodec/x86/mpegvideoenc.c View File

@@ -30,13 +30,16 @@


extern uint16_t ff_inv_zigzag_direct16[64]; extern uint16_t ff_inv_zigzag_direct16[64];


#if HAVE_MMX
#define COMPILE_TEMPLATE_MMXEXT 0 #define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_SSE2 0 #define COMPILE_TEMPLATE_SSE2 0
#define COMPILE_TEMPLATE_SSSE3 0 #define COMPILE_TEMPLATE_SSSE3 0
#define RENAME(a) a ## _MMX #define RENAME(a) a ## _MMX
#define RENAMEl(a) a ## _mmx #define RENAMEl(a) a ## _mmx
#include "mpegvideoenc_template.c" #include "mpegvideoenc_template.c"
#endif /* HAVE_MMX */


#if HAVE_MMXEXT
#undef COMPILE_TEMPLATE_SSSE3 #undef COMPILE_TEMPLATE_SSSE3
#undef COMPILE_TEMPLATE_SSE2 #undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT #undef COMPILE_TEMPLATE_MMXEXT
@@ -48,7 +51,9 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _MMX2 #define RENAME(a) a ## _MMX2
#define RENAMEl(a) a ## _mmx2 #define RENAMEl(a) a ## _mmx2
#include "mpegvideoenc_template.c" #include "mpegvideoenc_template.c"
#endif /* HAVE_MMXEXT */


#if HAVE_SSE2
#undef COMPILE_TEMPLATE_MMXEXT #undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2 #undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_SSSE3 #undef COMPILE_TEMPLATE_SSSE3
@@ -60,6 +65,7 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSE2 #define RENAME(a) a ## _SSE2
#define RENAMEl(a) a ## _sse2 #define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c" #include "mpegvideoenc_template.c"
#endif /* HAVE_SSE2 */


#if HAVE_SSSE3 #if HAVE_SSSE3
#undef COMPILE_TEMPLATE_MMXEXT #undef COMPILE_TEMPLATE_MMXEXT
@@ -73,7 +79,7 @@ extern uint16_t ff_inv_zigzag_direct16[64];
#define RENAME(a) a ## _SSSE3 #define RENAME(a) a ## _SSSE3
#define RENAMEl(a) a ## _sse2 #define RENAMEl(a) a ## _sse2
#include "mpegvideoenc_template.c" #include "mpegvideoenc_template.c"
#endif
#endif /* HAVE_SSSE3 */


#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */


@@ -84,18 +90,22 @@ void ff_MPV_encode_init_x86(MpegEncContext *s)
const int dct_algo = s->avctx->dct_algo; const int dct_algo = s->avctx->dct_algo;


if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) { if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_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 HAVE_SSSE3
if (mm_flags & AV_CPU_FLAG_SSSE3) {
if (mm_flags & AV_CPU_FLAG_SSSE3)
s->dct_quantize = dct_quantize_SSSE3; s->dct_quantize = dct_quantize_SSSE3;
} else
#endif #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) {
s->dct_quantize = dct_quantize_MMX;
}
} }
#endif /* HAVE_INLINE_ASM */ #endif /* HAVE_INLINE_ASM */
} }

+ 3
- 0
libavcodec/x86/rv40dsp_init.c View File

@@ -30,6 +30,7 @@
#include "libavutil/mem.h" #include "libavutil/mem.h"
#include "dsputil_mmx.h" #include "dsputil_mmx.h"


#if HAVE_YASM
void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src, void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y); int stride, int h, int x, int y);
void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src, 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) QPEL_FUNCS_SET (OP, 3, 2, OPT)
/** @} */ /** @} */


#endif /* HAVE_YASM */

void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp) void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
{ {
#if HAVE_YASM #if HAVE_YASM


Loading…
Cancel
Save