This is required with oldish nasm versions still shipped with some systems. Without this patch, the code still builds but due to a bug[1] crashes at runtime even if avx is not used.
[1] http://repo.or.cz/w/nasm.git/commitdiff/3cb0e8c052a672424eaf59a021f0dbfb6ef205b8 Signed-off-by: Mans Rullgard <[email protected]> --- libavcodec/x86/h264_deblock.asm | 10 ++++++++++ libavcodec/x86/h264_deblock_10bit.asm | 14 ++++++++++++++ libavcodec/x86/h264dsp_mmx.c | 2 +- libavcodec/x86/imdct36_sse.asm | 4 ++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm index 940a8f7..cea02da 100644 --- a/libavcodec/x86/h264_deblock.asm +++ b/libavcodec/x86/h264_deblock.asm @@ -390,8 +390,11 @@ cglobal deblock_h_luma_8, 5,9 INIT_XMM sse2 DEBLOCK_LUMA + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA +%endif %else @@ -509,8 +512,11 @@ INIT_MMX mmx2 DEBLOCK_LUMA v8, 8 INIT_XMM sse2 DEBLOCK_LUMA v, 16 + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA v, 16 +%endif %endif ; ARCH @@ -781,8 +787,12 @@ cglobal deblock_h_luma_intra_8, 2,4 INIT_XMM sse2 DEBLOCK_LUMA_INTRA v + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA_INTRA v +%endif + %if ARCH_X86_64 == 0 INIT_MMX mmx2 DEBLOCK_LUMA_INTRA v8 diff --git a/libavcodec/x86/h264_deblock_10bit.asm b/libavcodec/x86/h264_deblock_10bit.asm index 7b9316d..56f46e0 100644 --- a/libavcodec/x86/h264_deblock_10bit.asm +++ b/libavcodec/x86/h264_deblock_10bit.asm @@ -418,10 +418,14 @@ cglobal deblock_h_luma_10, 5,7,15 INIT_XMM sse2 DEBLOCK_LUMA_64 + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA_64 %endif +%endif + %macro SWAPMOVA 2 %ifid %1 SWAP %1, %2 @@ -713,8 +717,11 @@ cglobal deblock_h_luma_intra_10, 4,7,16 INIT_XMM sse2 DEBLOCK_LUMA_INTRA_64 + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA_INTRA_64 +%endif %endif @@ -798,11 +805,15 @@ DEBLOCK_LUMA_INTRA INIT_XMM sse2 DEBLOCK_LUMA DEBLOCK_LUMA_INTRA + +%if HAVE_AVX INIT_XMM avx DEBLOCK_LUMA DEBLOCK_LUMA_INTRA %endif +%endif + ; in: %1=p0, %2=q0, %3=p1, %4=q1, %5=mask, %6=tmp, %7=tmp ; out: %1=p0', %2=q0' %macro CHROMA_DEBLOCK_P0_Q0_INTRA 7 @@ -912,5 +923,8 @@ DEBLOCK_CHROMA %endif INIT_XMM sse2 DEBLOCK_CHROMA + +%if HAVE_AVX INIT_XMM avx DEBLOCK_CHROMA +%endif diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c index 0612ffb..130308d 100644 --- a/libavcodec/x86/h264dsp_mmx.c +++ b/libavcodec/x86/h264dsp_mmx.c @@ -292,7 +292,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_ssse3; c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_ssse3; } - if (mm_flags & AV_CPU_FLAG_AVX) { + if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) { #if HAVE_ALIGNED_STACK c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx; c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx; diff --git a/libavcodec/x86/imdct36_sse.asm b/libavcodec/x86/imdct36_sse.asm index 937a2cc..336e9f0 100644 --- a/libavcodec/x86/imdct36_sse.asm +++ b/libavcodec/x86/imdct36_sse.asm @@ -371,8 +371,10 @@ DEFINE_IMDCT INIT_XMM ssse3 DEFINE_IMDCT +%if HAVE_AVX INIT_XMM avx DEFINE_IMDCT +%endif INIT_XMM sse @@ -717,5 +719,7 @@ cglobal four_imdct36_float, 5,5,16, out, buf, in, win, tmp INIT_XMM sse DEFINE_FOUR_IMDCT +%if HAVE_AVX INIT_XMM avx DEFINE_FOUR_IMDCT +%endif -- 1.7.11.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
