Fix a runtime CPU detection bug in libswscale that was messing up

thumbnails creation on amd64 (thumbnails had purple and green bars
all over them).

From upstream git commit 93c28a55fd84280d97c3c0dd7b0d546043242c34

OK Brad (MAINTAINER)
This commit is contained in:
dcoppa 2011-06-22 08:10:26 +00:00
parent 6173fc2733
commit bd6484d8bf
4 changed files with 63 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.71 2011/06/04 09:20:36 sthen Exp $
# $OpenBSD: Makefile,v 1.72 2011/06/22 08:10:26 dcoppa Exp $
COMMENT= audio/video converter and streamer
V= 20110408
DISTNAME= ffmpeg-git-${V}
PKGNAME= ffmpeg-${V}
REVISION= 0
CATEGORIES= graphics multimedia
MASTER_SITES= http://comstyle.com/source/

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-libswscale_rgb2rgb_c,v 1.1 2011/06/22 08:10:26 dcoppa Exp $
--- libswscale/rgb2rgb.c.orig Tue Mar 29 01:23:17 2011
+++ libswscale/rgb2rgb.c Tue Jun 21 14:17:21 2011
@@ -201,7 +201,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x00000
void sws_rgb2rgb_init(int flags)
{
-#if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
+#if HAVE_SSE2 || HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
if (flags & SWS_CPU_CAPS_SSE2)
rgb2rgb_init_SSE2();
else if (flags & SWS_CPU_CAPS_MMX2)

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-libswscale_swscale_c,v 1.1 2011/06/22 08:10:26 dcoppa Exp $
--- libswscale/swscale.c.orig Wed Apr 6 01:28:59 2011
+++ libswscale/swscale.c Tue Jun 21 14:17:21 2011
@@ -62,7 +62,6 @@ untested special converters
#include "rgb2rgb.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/x86_cpu.h"
-#include "libavutil/cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/mathematics.h"
#include "libavutil/bswap.h"
@@ -1315,12 +1314,6 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
{
#if CONFIG_RUNTIME_CPUDETECT
int flags = c->flags;
-
- int cpuflags = av_get_cpu_flags();
-
- 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);
#if ARCH_X86
// ordered per speed fastest first

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-libswscale_utils_c,v 1.1 2011/06/22 08:10:26 dcoppa Exp $
--- 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;
}