summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-04-24 19:11:35 +0000
committerRodeo <[email protected]>2013-04-24 19:11:35 +0000
commit4fdb72a84658bd4aa48b2a46a11f0935c23c76d3 (patch)
tree7a10664cd86f2ec6e616d7c5d4f1a073fa245cb1
parente058e2ab3bb888732856ece57002f018ca37c621 (diff)
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
-rw-r--r--libhb/hb.c10
1 files changed, 9 insertions, 1 deletions
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,