From: Rodeo Date: Wed, 24 Apr 2013 19:11:35 +0000 (+0000) Subject: Disable Libav's AVX and FMA4 optimizations under Windows x86_64. X-Git-Tag: 0.9.9~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fdb72a84658bd4aa48b2a46a11f0935c23c76d3;p=handbrake Disable Libav's AVX and FMA4 optimizations under Windows x86_64. They cause crashes in avresample. SSE* optimizations are still enabled, so the performance hit should be pretty minimal. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5409 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/libhb/hb.c b/libhb/hb.c index a7df7a220..35e341b8a 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -102,8 +102,16 @@ static int ff_lockmgr_cb(void **mutex, enum AVLockOp op) void hb_avcodec_init() { - av_lockmgr_register( ff_lockmgr_cb ); + av_lockmgr_register(ff_lockmgr_cb); av_register_all(); +#ifdef _WIN64 + // avresample's assembly optimizations can cause crashes under Win x86_64 + // (see http://bugzilla.libav.org/show_bug.cgi?id=496) + // disable AVX and FMA4 as a workaround + hb_deep_log(2, "hb_avcodec_init: Windows x86_64, disabling AVX and FMA4"); + int cpu_flags = av_get_cpu_flags() & ~AV_CPU_FLAG_AVX & ~AV_CPU_FLAG_FMA4; + av_set_cpu_flags_mask(cpu_flags); +#endif } int hb_avcodec_open(AVCodecContext *avctx, AVCodec *codec,