openbsd-ports/graphics/ffmpeg/patches/patch-libswscale_utils_c

30 lines
1.1 KiB
Plaintext

$OpenBSD: patch-libswscale_utils_c,v 1.2 2011/06/22 13:10:57 dcoppa Exp $
Fix a runtime CPU detection bug in libswscale that affected thumbnails
creation on amd64 (git commit 93c28a55fd84280d97c3c0dd7b0d546043242c34)
--- libswscale/utils.c.orig Tue Mar 29 01:23:17 2011
+++ libswscale/utils.c Tue Jun 21 14:17:21 2011
@@ -41,6 +41,7 @@
#include "rgb2rgb.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/x86_cpu.h"
+#include "libavutil/cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/bswap.h"
#include "libavutil/opt.h"
@@ -740,6 +741,13 @@ static int update_flags_cpu(int flags)
|SWS_CPU_CAPS_ALTIVEC
|SWS_CPU_CAPS_BFIN);
flags |= ff_hardcodedcpuflags();
+#else /* !CONFIG_RUNTIME_CPUDETECT */
+ int cpuflags = av_get_cpu_flags();
+
+ flags |= (cpuflags & AV_CPU_FLAG_SSE2 ? SWS_CPU_CAPS_SSE2 : 0);
+ flags |= (cpuflags & AV_CPU_FLAG_MMX ? SWS_CPU_CAPS_MMX : 0);
+ flags |= (cpuflags & AV_CPU_FLAG_MMX2 ? SWS_CPU_CAPS_MMX2 : 0);
+ flags |= (cpuflags & AV_CPU_FLAG_3DNOW ? SWS_CPU_CAPS_3DNOW : 0);
#endif /* CONFIG_RUNTIME_CPUDETECT */
return flags;
}