summaryrefslogtreecommitdiff
path: root/ext/libswscale
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-06-14 14:38:44 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-06-14 14:38:44 +0200
commit899d2f0cecddf458b194b7492b4561d3ac296021 (patch)
treec6361f3b8801088fe2c4ed721622c627666870e7 /ext/libswscale
parent24ec624c7727fa8770487dab7c2b15b49c7a3df5 (diff)
Use orc instead of liboil for CPU feature detection
Diffstat (limited to 'ext/libswscale')
-rw-r--r--ext/libswscale/Makefile.am4
-rw-r--r--ext/libswscale/gstffmpegscale.c29
2 files changed, 22 insertions, 11 deletions
diff --git a/ext/libswscale/Makefile.am b/ext/libswscale/Makefile.am
index d7204cc..9363a33 100644
--- a/ext/libswscale/Makefile.am
+++ b/ext/libswscale/Makefile.am
@@ -4,10 +4,10 @@ libgstffmpegscale_la_SOURCES = gstffmpegscale.c
libgstffmpegscale_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
- $(LIBOIL_CFLAGS) $(SWSCALE_CFLAGS)
+ $(ORC_CFLAGS) $(SWSCALE_CFLAGS)
libgstffmpegscale_la_LIBADD = $(SWSCALE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
- $(GST_BASE_LIBS) $(LIBOIL_LIBS) $(LIBM) -lz
+ $(GST_BASE_LIBS) $(ORC_LIBS) $(LIBM) -lz
libgstffmpegscale_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(DARWIN_LDFLAGS)
libgstffmpegscale_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/ext/libswscale/gstffmpegscale.c b/ext/libswscale/gstffmpegscale.c
index 6521de8..0a52e00 100644
--- a/ext/libswscale/gstffmpegscale.c
+++ b/ext/libswscale/gstffmpegscale.c
@@ -32,9 +32,10 @@
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
-#include <liboil/liboil.h>
-#include <liboil/liboilcpu.h>
-#include <liboil/liboilfunction.h>
+
+#if HAVE_ORC
+#include <orc/orc.h>
+#endif
#include <string.h>
@@ -595,7 +596,8 @@ gst_ffmpegscale_set_caps (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps)
{
GstFFMpegScale *scale = GST_FFMPEGSCALE (trans);
- gint flags, swsflags;
+ guint mmx_flags, altivec_flags;
+ gint swsflags;
GstVideoFormat in_format, out_format;
gboolean ok;
@@ -629,11 +631,20 @@ gst_ffmpegscale_set_caps (GstBaseTransform * trans, GstCaps * incaps,
gst_ffmpegscale_fill_info (scale, out_format, scale->out_width,
scale->out_height, scale->out_stride, scale->out_offset);
- flags = oil_cpu_get_flags ();
- swsflags = (flags & OIL_IMPL_FLAG_MMX ? SWS_CPU_CAPS_MMX : 0)
- | (flags & OIL_IMPL_FLAG_MMXEXT ? SWS_CPU_CAPS_MMX2 : 0)
- | (flags & OIL_IMPL_FLAG_3DNOW ? SWS_CPU_CAPS_3DNOW : 0)
- | (flags & OIL_IMPL_FLAG_ALTIVEC ? SWS_CPU_CAPS_ALTIVEC : 0);
+#ifdef HAVE_ORC
+ mmx_flags = orc_target_get_default_flags (orc_target_get_by_name ("mmx"));
+ altivec_flags =
+ orc_target_get_default_flags (orc_target_get_by_name ("altivec"));
+#else
+ mmx_flags = 0;
+ altivec_flags = 0;
+#endif
+
+ swsflags = (mmx_flags & ORC_TARGET_MMX_MMX ? SWS_CPU_CAPS_MMX : 0)
+ | (mmx_flags & ORC_TARGET_MMX_MMXEXT ? SWS_CPU_CAPS_MMX2 : 0)
+ | (mmx_flags & ORC_TARGET_MMX_3DNOW ? SWS_CPU_CAPS_3DNOW : 0)
+ | (altivec_flags & ORC_TARGET_ALTIVEC_ALTIVEC ? SWS_CPU_CAPS_ALTIVEC : 0);
+
scale->ctx = sws_getContext (scale->in_width, scale->in_height,
scale->in_pixfmt, scale->out_width, scale->out_height, scale->out_pixfmt,
swsflags | gst_ffmpegscale_method_flags[scale->method], NULL, NULL, NULL);