summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2011-12-08 01:19:03 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-12-08 01:19:03 +0000
commitfb6d09055ae90979682fa4b1c6ee4f4abdaafd8f (patch)
tree3215796950bfe6630098dff0d3897996ba8882ab
parentf096b8a8d81239e22477f222d774f8c48a03b06e (diff)
parent91bbfbd819f6a347be114ee280dd5bb5b0ab1385 (diff)
downloadgstreamer-plugins-base-fb6d09055ae90979682fa4b1c6ee4f4abdaafd8f.tar.gz
Merge remote-tracking branch 'origin/master' into 0.11
Conflicts: ext/alsa/gstalsadeviceprobe.c ext/alsa/gstalsamixer.c ext/pango/gsttextoverlay.c ext/pango/gsttextoverlay.h gst-libs/gst/audio/gstaudiobasesink.c gst-libs/gst/audio/gstaudioringbuffer.c gst-libs/gst/audio/gstaudiosrc.c gst-libs/gst/video/Makefile.am gst-libs/gst/video/video.c gst/encoding/gststreamcombiner.c gst/encoding/gststreamsplitter.c gst/playback/gstplaybasebin.c gst/playback/gststreamsynchronizer.c gst/playback/gstsubtitleoverlay.c gst/playback/gsturidecodebin.c sys/xvimage/xvimagesink.c tests/examples/Makefile.am win32/common/libgstvideo.def Video overlay composition disabled for now, needs porting to buffer meta.
-rw-r--r--configure.ac31
-rw-r--r--docs/libs/gst-plugins-base-libs-docs.sgml1
-rw-r--r--docs/libs/gst-plugins-base-libs-sections.txt50
-rw-r--r--ext/alsa/gstalsamixer.c105
-rw-r--r--ext/alsa/gstalsamixer.h16
-rw-r--r--ext/alsa/gstalsasink.c1
-rw-r--r--ext/alsa/gstalsasrc.c1
-rw-r--r--ext/ogg/gstoggdemux.c7
-rw-r--r--gst-libs/gst/Makefile.am2
-rw-r--r--gst-libs/gst/app/gstappsink.c2
-rw-r--r--gst-libs/gst/app/gstappsrc.c2
-rw-r--r--gst-libs/gst/audio/gstaudiobasesink.c3
-rw-r--r--gst-libs/gst/audio/gstaudiodecoder.c4
-rw-r--r--gst-libs/gst/audio/gstaudioencoder.c4
-rw-r--r--gst-libs/gst/audio/gstaudioringbuffer.c2
-rw-r--r--gst-libs/gst/audio/gstaudiosink.c9
-rw-r--r--gst-libs/gst/audio/gstaudiosrc.c11
-rw-r--r--gst-libs/gst/glib-compat-private.h120
-rw-r--r--gst-libs/gst/pbutils/gstdiscoverer.c2
-rw-r--r--gst-libs/gst/rtsp/gstrtspconnection.c2
-rw-r--r--gst-libs/gst/tag/xmpwriter.c60
-rw-r--r--gst-libs/gst/video/.gitignore1
-rw-r--r--gst-libs/gst/video/convertframe.c2
-rw-r--r--gst-libs/gst/video/video-blend.c1423
-rw-r--r--gst-libs/gst/video/video-blend.h73
-rw-r--r--gst-libs/gst/video/video-overlay-composition.c1019
-rw-r--r--gst-libs/gst/video/video-overlay-composition.h235
-rw-r--r--gst-libs/gst/video/videoblendorc-dist.c6118
-rw-r--r--gst-libs/gst/video/videoblendorc-dist.h107
-rw-r--r--gst-libs/gst/video/videoblendorc.orc498
-rw-r--r--gst-libs/gst/video/videooverlay.c5
-rw-r--r--gst/playback/gstdecodebin.c5
-rw-r--r--gst/playback/gstdecodebin2.c6
-rw-r--r--gst/playback/gstplaybin2.c6
-rw-r--r--gst/playback/gstplaysink.c4
-rw-r--r--gst/playback/gstplaysinkconvertbin.c1
-rw-r--r--gst/playback/gststreamsynchronizer.c5
-rw-r--r--gst/playback/gstsubtitleoverlay.c310
-rw-r--r--gst/playback/gsturidecodebin.c2
-rw-r--r--gst/tcp/gstmultifdsink.c11
-rw-r--r--gst/videorate/gstvideorate.c9
-rw-r--r--sys/ximage/ximagesink.c7
-rw-r--r--sys/xvimage/xvimagesink.c7
-rw-r--r--tests/check/libs/video.c149
-rw-r--r--tests/examples/Makefile.am5
-rw-r--r--tests/examples/encoding/encoding.c2
-rw-r--r--tests/examples/fft/.gitignore2
-rw-r--r--tests/examples/fft/Makefile.am8
-rw-r--r--tests/examples/fft/fftrange.c184
-rw-r--r--tests/examples/overlay/gtk-videooverlay.c2
-rw-r--r--tests/examples/overlay/qt-videooverlay.cpp2
-rw-r--r--tests/examples/seek/jsseek.c2
-rw-r--r--tests/examples/seek/scrubby.c2
-rw-r--r--tests/examples/seek/seek.c2
-rw-r--r--tests/icles/stress-playbin.c2
-rw-r--r--tests/icles/test-colorkey.c2
-rw-r--r--tests/icles/test-videooverlay.c2
-rw-r--r--tools/gst-discoverer.c2
58 files changed, 10447 insertions, 210 deletions
diff --git a/configure.ac b/configure.ac
index a34546282..0f1ec1a42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,7 +185,7 @@ CPPFLAGS="$ac_cppflags_save"
AM_CONDITIONAL(HAVE_LIBXML_HTML, test "x$HAVE_LIBXML_HTML" = "xyes")
dnl used in gst/tcp
-AC_CHECK_HEADERS([sys/socket.h],
+AC_CHECK_HEADERS([sys/socket.h],
HAVE_SYS_SOCKET_H="yes", HAVE_SYS_SOCKET_H="no")
AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes")
@@ -537,7 +537,7 @@ AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
CFLAGS="$ac_cflags_save"
CPPFLAGS="$ac_cppflags_save"
])
-
+
dnl Check for Xv extension
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
@@ -549,24 +549,24 @@ dnl check for X Shm
translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
AG_GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], , [
if test x$HAVE_X = xyes; then
- AC_CHECK_LIB(Xext, XShmAttach,
+ AC_CHECK_LIB(Xext, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
- $X_LIBS)
+ $X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext"
else
dnl On AIX, it is in XextSam instead, but we still need -lXext
- AC_CHECK_LIB(XextSam, XShmAttach,
+ AC_CHECK_LIB(XextSam, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
- $X_LIBS)
+ $X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext -lXextSam"
fi
fi
fi
-], , [
- AC_SUBST(HAVE_XSHM)
- AC_SUBST(XSHM_LIBS)
+], , [
+ AC_SUBST(HAVE_XSHM)
+ AC_SUBST(XSHM_LIBS)
])
dnl *** ext plug-ins ***
@@ -597,17 +597,17 @@ AG_GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
PKG_CHECK_MODULES(CDPARANOIA, cdparanoia-3 >= 10.2, [
HAVE_CDPARANOIA="yes"
], [
- AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
- cdda_open, -lm,
- cdda_interface.h,
+ AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
+ cdda_open, -lm,
+ cdda_interface.h,
CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
HEADER_DIR="no"
FOUND_CDPARANOIA="yes")
if test "x$FOUND_CDPARANOIA" != "xyes";
then
- AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
- cdda_open, -lm,
- cdda/cdda_interface.h,
+ AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
+ cdda_open, -lm,
+ cdda/cdda_interface.h,
CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
HEADER_DIR="yes"
FOUND_CDPARANOIA="yes")
@@ -934,6 +934,7 @@ tests/examples/app/Makefile
tests/examples/audio/Makefile
tests/examples/dynamic/Makefile
tests/examples/encoding/Makefile
+tests/examples/fft/Makefile
tests/examples/gio/Makefile
tests/examples/overlay/Makefile
tests/examples/seek/Makefile
diff --git a/docs/libs/gst-plugins-base-libs-docs.sgml b/docs/libs/gst-plugins-base-libs-docs.sgml
index 6244b6628..049b6291a 100644
--- a/docs/libs/gst-plugins-base-libs-docs.sgml
+++ b/docs/libs/gst-plugins-base-libs-docs.sgml
@@ -195,6 +195,7 @@
<filename>-lgstvideo-&GST_MAJORMINOR;</filename> to the library flags.
</para>
<xi:include href="xml/gstvideo.xml" />
+ <xi:include href="xml/gstvideooverlaycomposition.xml" />
<xi:include href="xml/gstvideofilter.xml" />
<xi:include href="xml/gstvideosink.xml" />
</chapter>
diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt
index 9ac2022dd..51075d67b 100644
--- a/docs/libs/gst-plugins-base-libs-sections.txt
+++ b/docs/libs/gst-plugins-base-libs-sections.txt
@@ -2118,6 +2118,56 @@ GST_TYPE_VIDEO_FORMAT
</SECTION>
<SECTION>
+<FILE>gstvideooverlaycomposition</FILE>
+<INCLUDE>gst/video/video-overlay-composition.h</INCLUDE>
+<SUBSECTION composition>
+GstVideoOverlayComposition
+GstVideoOverlayCompositionClass
+gst_video_overlay_composition_new
+gst_video_overlay_composition_ref
+gst_video_overlay_composition_unref
+gst_video_overlay_composition_add_rectangle
+gst_video_overlay_composition_n_rectangles
+gst_video_overlay_composition_get_rectangle
+gst_video_overlay_composition_get_seqnum
+gst_video_overlay_composition_copy
+gst_video_overlay_composition_make_writable
+gst_video_overlay_composition_blend
+<SUBSECTION composition-set-get>
+gst_video_buffer_get_overlay_composition
+gst_video_buffer_set_overlay_composition
+<SUBSECTION rectangle>
+GstVideoOverlayFormatFlags
+GstVideoOverlayRectangle
+GstVideoOverlayRectangleClass
+gst_video_overlay_rectangle_new_argb
+gst_video_overlay_rectangle_ref
+gst_video_overlay_rectangle_unref
+gst_video_overlay_rectangle_get_pixels_argb
+gst_video_overlay_rectangle_get_pixels_unscaled_argb
+gst_video_overlay_rectangle_get_render_rectangle
+gst_video_overlay_rectangle_get_seqnum
+gst_video_overlay_rectangle_set_render_rectangle
+gst_video_overlay_rectangle_copy
+<SUBSECTION Standard>
+GST_TYPE_VIDEO_OVERLAY_COMPOSITION
+GST_VIDEO_OVERLAY_COMPOSITION
+GST_VIDEO_OVERLAY_COMPOSITION_CLASS
+GST_VIDEO_OVERLAY_COMPOSITION_GET_CLASS
+GST_IS_VIDEO_OVERLAY_COMPOSITION
+GST_IS_VIDEO_VIDEO_OVERLAY_COMPOSITION_CLASS
+gst_video_overlay_composition_get_type
+
+GST_TYPE_VIDEO_OVERLAY_RECTANGLE
+GST_VIDEO_OVERLAY_RECTANGLE
+GST_VIDEO_OVERLAY_RECTANGLE_CLASS
+GST_VIDEO_OVERLAY_RECTANGLE_GET_CLASS
+GST_IS_VIDEO_OVERLAY_RECTANGLE
+GST_IS_VIDEO_VIDEO_OVERLAY_RECTANGLE_CLASS
+gst_video_overlay_rectangle_get_type
+</SECTION>
+
+<SECTION>
<FILE>gstvideofilter</FILE>
<INCLUDE>gst/video/gstvideofilter.h</INCLUDE>
GstVideoFilter
diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c
index 5f2bf71bd..9bf54204f 100644
--- a/ext/alsa/gstalsamixer.c
+++ b/ext/alsa/gstalsamixer.c
@@ -34,7 +34,12 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gstalsamixer.h"
+#include "gst/glib-compat-private.h"
#include <errno.h>
static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
@@ -130,14 +135,14 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
count = snd_mixer_get_count (handle);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
/* Check if we have a playback mixer labelled as 'Master' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -148,7 +153,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -159,7 +164,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -170,7 +175,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Speaker") == 0) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -183,7 +188,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element) &&
!snd_mixer_selem_is_playback_mono (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -194,7 +199,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@@ -204,13 +209,13 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
/* Looks like we're out of luck ... */
return NULL;
}
@@ -222,7 +227,7 @@ gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
g_return_if_fail (mixer != NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
for (item = mixer->tracklist; item != NULL; item = item->next) {
if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
@@ -238,7 +243,7 @@ gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
}
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
static int
@@ -287,7 +292,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
if (mixer->tracklist)
return;
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
master = gst_alsa_mixer_find_master_mixer (mixer, mixer->handle);
@@ -409,7 +414,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
snd_mixer_elem_set_callback_private (temp, mixer);
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
static void
@@ -421,13 +426,13 @@ task_monitor_alsa (gpointer data)
GstAlsaMixer *mixer = (GstAlsaMixer *) data;
gint ret;
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
nfds = snd_mixer_poll_descriptors_count (mixer->handle);
if (nfds <= 0) {
GST_ERROR ("snd_mixer_poll_descriptors_count <= 0: %d", nfds);
/* FIXME: sleep ? stop monitoring ? */
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@@ -439,7 +444,7 @@ task_monitor_alsa (gpointer data)
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), ("alsa error: %s",
snd_strerror (rnfds)));
gst_task_pause (mixer->task);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@@ -447,7 +452,7 @@ task_monitor_alsa (gpointer data)
pfds[rnfds].events = POLLIN | POLLPRI | POLLHUP | POLLERR;
pfds[rnfds].revents = 0;
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
GST_LOG ("task loop");
ret = poll (pfds, rnfds + 1, -1);
@@ -458,7 +463,7 @@ task_monitor_alsa (gpointer data)
return;
}
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
ret =
snd_mixer_poll_descriptors_revents (mixer->handle, pfds, nfds, &revents);
@@ -474,7 +479,7 @@ task_monitor_alsa (gpointer data)
gst_task_pause (mixer->task);
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
/* API */
@@ -491,14 +496,15 @@ gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir)
if (pipe (ret->pfd) == -1)
goto error;
- ret->rec_mutex = g_new (GStaticRecMutex, 1);
- g_static_rec_mutex_init (ret->rec_mutex);
-
- ret->task_mutex = g_new (GStaticRecMutex, 1);
- g_static_rec_mutex_init (ret->task_mutex);
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ g_static_rec_mutex_init (&ret->rec_mutex);
+#else
+ g_rec_mutex_init (&ret->rec_mutex);
+#endif
+ g_static_rec_mutex_init (&ret->task_mutex);
ret->task = gst_task_new (task_monitor_alsa, ret);
- gst_task_set_lock (ret->task, ret->task_mutex);
+ gst_task_set_lock (ret->task, &ret->task_mutex);
ret->device = g_strdup (device);
ret->dir = dir;
@@ -540,9 +546,7 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer)
mixer->task = NULL;
}
- g_static_rec_mutex_free (mixer->task_mutex);
- g_free (mixer->task_mutex);
- mixer->task_mutex = NULL;
+ g_static_rec_mutex_free (&mixer->task_mutex);
if (mixer->pfd[0] > 0) {
close (mixer->pfd[0]);
@@ -579,10 +583,11 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer)
snd_mixer_close (mixer->handle);
mixer->handle = NULL;
}
-
- g_static_rec_mutex_free (mixer->rec_mutex);
- g_free (mixer->rec_mutex);
- mixer->rec_mutex = NULL;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ g_static_rec_mutex_free (&mixer->rec_mutex);
+#else
+ g_rec_mutex_clear (&mixer->rec_mutex);
+#endif
g_free (mixer);
}
@@ -606,7 +611,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
@@ -642,7 +647,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
volumes[i] = alsa_track->volumes[i];
}
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
static gboolean
@@ -670,7 +675,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
@@ -718,7 +723,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
alsa_track->volumes[i] = volumes[i];
}
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@@ -729,12 +734,12 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(mute) == ! !(track->flags & GST_MIXER_TRACK_MUTE)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
if (mute) {
@@ -765,12 +770,12 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) {
long vol =
- mute ? ((GstMixerTrack *) ctrl_track)->
- min_volume : ctrl_track->volumes[i];
+ mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track->
+ volumes[i];
snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
}
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@@ -781,12 +786,12 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
g_return_if_fail (mixer->handle != NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(record) == ! !(track->flags & GST_MIXER_TRACK_RECORD)) {
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@@ -826,7 +831,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
}
}
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@@ -848,9 +853,9 @@ gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
if (idx == -1)
return;
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
}
const gchar *
@@ -861,9 +866,9 @@ gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
g_return_val_if_fail (mixer->handle != NULL, NULL);
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0)
return g_list_nth_data (opts->values, idx);
else
@@ -890,9 +895,9 @@ gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
GST_WARNING ("Cannot send update notifications, no GstMixer * given");
return;
}
- g_static_rec_mutex_lock (mixer->rec_mutex);
+ GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
- g_static_rec_mutex_unlock (mixer->rec_mutex);
+ GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0) {
option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx);
gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts),
diff --git a/ext/alsa/gstalsamixer.h b/ext/alsa/gstalsamixer.h
index 03118f129..a58459a00 100644
--- a/ext/alsa/gstalsamixer.h
+++ b/ext/alsa/gstalsamixer.h
@@ -53,8 +53,13 @@ struct _GstAlsaMixer
snd_mixer_t * handle;
GstTask * task;
- GStaticRecMutex * task_mutex;
- GStaticRecMutex * rec_mutex;
+ GStaticRecMutex task_mutex;
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ GStaticRecMutex rec_mutex;
+#else
+ GRecMutex rec_mutex;
+#endif
int pfd[2];
@@ -65,6 +70,13 @@ struct _GstAlsaMixer
GstAlsaMixerDirection dir;
};
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+#define GST_ALSA_MIXER_LOCK(mixer) g_static_rec_mutex_lock (&mixer->rec_mutex)
+#define GST_ALSA_MIXER_UNLOCK(mixer) g_static_rec_mutex_unlock (&mixer->rec_mutex)
+#else
+#define GST_ALSA_MIXER_LOCK(mixer) g_rec_mutex_lock (&mixer->rec_mutex)
+#define GST_ALSA_MIXER_UNLOCK(mixer) g_rec_mutex_unlock (&mixer->rec_mutex)
+#endif
GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
GstAlsaMixerDirection dir);
diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c
index e9295e1a9..754b64455 100644
--- a/ext/alsa/gstalsasink.c
+++ b/ext/alsa/gstalsasink.c
@@ -52,6 +52,7 @@
#include "gstalsadeviceprobe.h"
#include <gst/gst-i18n-plugin.h>
+#include "gst/glib-compat-private.h"
#define DEFAULT_DEVICE "default"
#define DEFAULT_DEVICE_NAME ""
diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c
index c93ca6a72..82615e141 100644
--- a/ext/alsa/gstalsasrc.c
+++ b/ext/alsa/gstalsasrc.c
@@ -48,6 +48,7 @@
#include "gstalsasrc.h"
#include "gstalsadeviceprobe.h"
+#include "gst/glib-compat-private.h"
#include <gst/gst-i18n-plugin.h>
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c
index c0ec67ec8..c026d8cca 100644
--- a/ext/ogg/gstoggdemux.c
+++ b/ext/ogg/gstoggdemux.c
@@ -39,12 +39,19 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <string.h>
#include <gst/gst-i18n-plugin.h>
#include <gst/tag/tag.h>
#include "gstoggdemux.h"
+#include "gst/glib-compat-private.h"
+
#define CHUNKSIZE (8500) /* this is out of vorbisfile */
/* we hope we get a granpos within this many bytes off the end */
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
index bcdb71e5c..959dbd434 100644
--- a/gst-libs/gst/Makefile.am
+++ b/gst-libs/gst/Makefile.am
@@ -14,7 +14,7 @@ SUBDIRS = \
riff \
app
-noinst_HEADERS = gettext.h gst-i18n-plugin.h
+noinst_HEADERS = gettext.h gst-i18n-plugin.h glib-compat-private.h
# dependencies:
audio: interfaces tag
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c
index 31f363035..1c987d742 100644
--- a/gst-libs/gst/app/gstappsink.c
+++ b/gst-libs/gst/app/gstappsink.c
@@ -76,6 +76,8 @@
#include "gstapp-marshal.h"
#include "gstappsink.h"
+#include "gst/glib-compat-private.h"
+
struct _GstAppSinkPrivate
{
GstCaps *caps;
diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c
index 38a731fde..56e2e12f1 100644
--- a/gst-libs/gst/app/gstappsrc.c
+++ b/gst-libs/gst/app/gstappsrc.c
@@ -102,6 +102,8 @@
#include "gstapp-marshal.h"
#include "gstappsrc.h"
+#include "gst/glib-compat-private.h"
+
struct _GstAppSrcPrivate
{
GCond *cond;
diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c
index 6efe9261d..b4fc89d79 100644
--- a/gst-libs/gst/audio/gstaudiobasesink.c
+++ b/gst-libs/gst/audio/gstaudiobasesink.c
@@ -34,6 +34,9 @@
#include <string.h>
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstaudiobasesink.h"
GST_DEBUG_CATEGORY_STATIC (gst_audio_base_sink_debug);
diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c
index 4a0974033..eec58b9cc 100644
--- a/gst-libs/gst/audio/gstaudiodecoder.c
+++ b/gst-libs/gst/audio/gstaudiodecoder.c
@@ -149,6 +149,10 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gstaudiodecoder.h"
#include <gst/pbutils/descriptions.h>
diff --git a/gst-libs/gst/audio/gstaudioencoder.c b/gst-libs/gst/audio/gstaudioencoder.c
index 8e92e319c..50143dd25 100644
--- a/gst-libs/gst/audio/gstaudioencoder.c
+++ b/gst-libs/gst/audio/gstaudioencoder.c
@@ -151,6 +151,10 @@
# include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gstaudioencoder.h"
#include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>
diff --git a/gst-libs/gst/audio/gstaudioringbuffer.c b/gst-libs/gst/audio/gstaudioringbuffer.c
index c6b561d6e..db62b4acc 100644
--- a/gst-libs/gst/audio/gstaudioringbuffer.c
+++ b/gst-libs/gst/audio/gstaudioringbuffer.c
@@ -43,6 +43,8 @@
#include "gstaudioringbuffer.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_audio_ring_buffer_debug);
#define GST_CAT_DEFAULT gst_audio_ring_buffer_debug
diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c
index 7bb2d16f7..835dc4b9b 100644
--- a/gst-libs/gst/audio/gstaudiosink.c
+++ b/gst-libs/gst/audio/gstaudiosink.c
@@ -71,6 +71,8 @@
#include "gstaudiosink.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
#define GST_CAT_DEFAULT gst_audio_sink_debug
@@ -435,9 +437,16 @@ gst_audio_sink_ring_buffer_activate (GstAudioRingBuffer * buf, gboolean active)
abuf->running = TRUE;
GST_DEBUG_OBJECT (sink, "starting thread");
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
sink->thread =
g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
&error);
+#else
+ sink->thread = g_thread_try_new ("audiosink-ringbuffer",
+ (GThreadFunc) audioringbuffer_thread_func, buf, &error);
+#endif
+
if (!sink->thread || error != NULL)
goto thread_failed;
diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c
index c0c592042..8be7fa3ef 100644
--- a/gst-libs/gst/audio/gstaudiosrc.c
+++ b/gst-libs/gst/audio/gstaudiosrc.c
@@ -71,6 +71,8 @@
#include "gstaudiosrc.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_audio_src_debug);
#define GST_CAT_DEFAULT gst_audio_src_debug
@@ -395,10 +397,17 @@ gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf,
abuf = GST_AUDIO_SRC_RING_BUFFER (buf);
abuf->running = TRUE;
+ /* FIXME: handle thread creation failure */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
src->thread =
g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
NULL);
- GST_AUDIO_SRC_RING_BUFFER_WAIT (buf);
+#else
+ src->thread = g_thread_try_new ("audiosrc-ringbuffer",
+ (GThreadFunc) audioringbuffer_thread_func, buf, NULL);
+#endif
+
+ GST_AUDIO_RING_BUFFER_WAIT (buf);
return result;
diff --git a/gst-libs/gst/glib-compat-private.h b/gst-libs/gst/glib-compat-private.h
new file mode 100644
index 000000000..d143d3257
--- /dev/null
+++ b/gst-libs/gst/glib-compat-private.h
@@ -0,0 +1,120 @@
+/*
+ * glib-compat.c
+ * Functions copied from glib 2.10
+ *
+ * Copyright 2005 David Schleef <ds@schleef.org>
+ */
+
+#ifndef __GLIB_COMPAT_PRIVATE_H__
+#define __GLIB_COMPAT_PRIVATE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if !GLIB_CHECK_VERSION(2,25,0)
+
+#if defined (_MSC_VER) && !defined(_WIN64)
+typedef struct _stat32 GStatBuf;
+#else
+typedef struct stat GStatBuf;
+#endif
+
+#endif
+
+#if GLIB_CHECK_VERSION(2,26,0)
+#define GLIB_HAS_GDATETIME
+#endif
+
+/* See bug #651514 */
+#if GLIB_CHECK_VERSION(2,29,5)
+#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
+ g_atomic_pointer_compare_and_exchange ((a),(b),(c))
+#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
+ g_atomic_int_compare_and_exchange ((a),(b),(c))
+#else
+#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
+ g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c))
+#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
+ g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c))
+#endif
+
+/* See bug #651514 */
+#if GLIB_CHECK_VERSION(2,29,5)
+#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b))
+#else
+#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b))
+#endif
+
+/* copies */
+
+#if GLIB_CHECK_VERSION (2, 31, 0)
+#define g_mutex_new gst_g_mutex_new
+static inline GMutex *
+gst_g_mutex_new (void)
+{
+ GMutex *mutex = g_slice_new (GMutex);
+ g_mutex_init (mutex);
+ return mutex;
+}
+#define g_mutex_free gst_g_mutex_free
+static inline void
+gst_g_mutex_free (GMutex *mutex)
+{
+ g_mutex_clear (mutex);
+ g_slice_free (GMutex, mutex);
+}
+#define g_static_rec_mutex_init gst_g_static_rec_mutex_init
+static inline void
+gst_g_static_rec_mutex_init (GStaticRecMutex *mutex)
+{
+ static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
+
+ *mutex = init_mutex;
+}
+#define g_cond_new gst_g_cond_new
+static inline GCond *
+gst_g_cond_new (void)
+{
+ GCond *cond = g_slice_new (GCond);
+ g_cond_init (cond);
+ return cond;
+}
+#define g_cond_free gst_g_cond_free
+static inline void
+gst_g_cond_free (GCond *cond)
+{
+ g_cond_clear (cond);
+ g_slice_free (GCond, cond);
+}
+#define g_cond_timed_wait gst_g_cond_timed_wait
+static inline gboolean
+gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
+{
+ gint64 end_time;
+
+ if (abs_time == NULL) {
+ g_cond_wait (cond, mutex);
+ return TRUE;
+ }
+
+ end_time = abs_time->tv_sec;
+ end_time *= 1000000;
+ end_time += abs_time->tv_usec;
+
+ /* would be nice if we had clock_rtoffset, but that didn't seem to
+ * make it into the kernel yet...
+ */
+ /* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
+ * g_get_real_time() are returning the same clock and we'd add ~0
+ */
+ end_time += g_get_monotonic_time () - g_get_real_time ();
+ return g_cond_wait_until (cond, mutex, end_time);
+}
+#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
+
+/* adaptations */
+
+G_END_DECLS
+
+#endif
diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c
index 2aa15465a..a21b6e940 100644
--- a/gst-libs/gst/pbutils/gstdiscoverer.c
+++ b/gst-libs/gst/pbutils/gstdiscoverer.c
@@ -50,6 +50,8 @@
#include "pbutils-marshal.h"
#include "pbutils-private.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (discoverer_debug);
#define GST_CAT_DEFAULT discoverer_debug
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
index d1b86a936..2839a4ee3 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -92,6 +92,8 @@
#include "gstrtspconnection.h"
+#include "gst/glib-compat-private.h"
+
union gst_sockaddr
{
struct sockaddr sa;
diff --git a/gst-libs/gst/tag/xmpwriter.c b/gst-libs/gst/tag/xmpwriter.c
index 842f89758..10bf1f953 100644
--- a/gst-libs/gst/tag/xmpwriter.c
+++ b/gst-libs/gst/tag/xmpwriter.c
@@ -47,9 +47,21 @@ static GQuark tag_xmp_writer_key;
typedef struct
{
GSList *schemas;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
GStaticMutex lock;
+#else
+ GMutex lock;
+#endif
} GstTagXmpWriterData;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_static_mutex_lock(&data->lock)
+#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_static_mutex_unlock(&data->lock)
+#else
+#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_mutex_lock(&data->lock)
+#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
+#endif
+
GType
gst_tag_xmp_writer_get_type (void)
{
@@ -116,8 +128,11 @@ gst_tag_xmp_writer_data_free (gpointer p)
}
g_slist_free (data->schemas);
}
-
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_free (&data->lock);
+#else
+ g_mutex_clear (&data->lock);
+#endif
g_slice_free (GstTagXmpWriterData, data);
}
@@ -129,22 +144,37 @@ gst_tag_xmp_writer_get_data (GstTagXmpWriter * xmpconfig)
data = g_object_get_qdata (G_OBJECT (xmpconfig), tag_xmp_writer_key);
if (!data) {
+ /* make sure no other thread is creating a GstTagData at the same time */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
static GStaticMutex create_mutex = G_STATIC_MUTEX_INIT;
- /* make sure no other thread is creating a GstTagXmpWriterData at the same time */
g_static_mutex_lock (&create_mutex);
+#else
+ static GMutex create_mutex; /* no initialisation required */
+
+ g_mutex_lock (&create_mutex);
+#endif
+
data = g_object_get_qdata (G_OBJECT (xmpconfig), tag_xmp_writer_key);
if (!data) {
data = g_slice_new (GstTagXmpWriterData);
- g_static_mutex_init (&data->lock);
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ g_static_mutex_init (&data->lock);
+#else
+ g_mutex_init (&data->lock);
+#endif
data->schemas = NULL;
gst_tag_xmp_writer_data_add_all_schemas_unlocked (data);
g_object_set_qdata_full (G_OBJECT (xmpconfig), tag_xmp_writer_key, data,
gst_tag_xmp_writer_data_free);
}
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_unlock (&create_mutex);
+#else
+ g_mutex_unlock (&create_mutex);
+#endif
}
return data;
@@ -168,9 +198,9 @@ gst_tag_xmp_writer_add_all_schemas (GstTagXmpWriter * config)
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
gst_tag_xmp_writer_data_add_all_schemas_unlocked (data);
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@@ -191,9 +221,9 @@ gst_tag_xmp_writer_add_schema (GstTagXmpWriter * config, const gchar * schema)
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
gst_tag_xmp_writer_data_add_schema_unlocked (data, schema);
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@@ -217,14 +247,14 @@ gst_tag_xmp_writer_has_schema (GstTagXmpWriter * config, const gchar * schema)
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
if (strcmp ((const gchar *) iter->data, schema) == 0) {
ret = TRUE;
break;
}
}
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
return ret;
}
@@ -250,7 +280,7 @@ gst_tag_xmp_writer_remove_schema (GstTagXmpWriter * config,
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
if (strcmp ((const gchar *) iter->data, schema) == 0) {
g_free (iter->data);
@@ -258,7 +288,7 @@ gst_tag_xmp_writer_remove_schema (GstTagXmpWriter * config,
break;
}
}
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@@ -280,7 +310,7 @@ gst_tag_xmp_writer_remove_all_schemas (GstTagXmpWriter * config)
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
if (data->schemas) {
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
g_free (iter->data);
@@ -288,7 +318,7 @@ gst_tag_xmp_writer_remove_all_schemas (GstTagXmpWriter * config)
g_slist_free (data->schemas);
}
data->schemas = NULL;
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
GstBuffer *
@@ -304,7 +334,7 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
data = gst_tag_xmp_writer_get_data (config);
- g_static_mutex_lock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_LOCK (data);
if (data->schemas) {
gchar **array = g_new0 (gchar *, g_slist_length (data->schemas) + 1);
if (array) {
@@ -316,7 +346,7 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
g_free (array);
}
}
- g_static_mutex_unlock (&data->lock);
+ GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
return buf;
}
diff --git a/gst-libs/gst/video/.gitignore b/gst-libs/gst/video/.gitignore
index 42df1ec5a..750405b61 100644
--- a/gst-libs/gst/video/.gitignore
+++ b/gst-libs/gst/video/.gitignore
@@ -1,2 +1,3 @@
video-enumtypes.c
video-enumtypes.h
+videoblendorc.h
diff --git a/gst-libs/gst/video/convertframe.c b/gst-libs/gst/video/convertframe.c
index 73dcfb1fc..068b90c9e 100644
--- a/gst-libs/gst/video/convertframe.c
+++ b/gst-libs/gst/video/convertframe.c
@@ -22,6 +22,8 @@
#include <string.h>
#include "video.h"
+#include "gst/glib-compat-private.h"
+
static gboolean
caps_are_raw (const GstCaps * caps)
{
diff --git a/gst-libs/gst/video/video-blend.c b/gst-libs/gst/video/video-blend.c
new file mode 100644
index 000000000..745d540ee
--- /dev/null
+++ b/gst-libs/gst/video/video-blend.c
@@ -0,0 +1,1423 @@
+/* Gstreamer video blending utility functions
+ *
+ * Copied/pasted from gst/videoconvert/videoconvert.c
+ * Copyright (C) 2010 David Schleef <ds@schleef.org>
+ * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "video-blend.h"
+#include "videoblendorc.h"
+
+#include <string.h>
+
+#ifndef GST_DISABLE_GST_DEBUG
+
+#define GST_CAT_DEFAULT ensure_debug_category()
+
+static GstDebugCategory *
+ensure_debug_category (void)
+{
+ static gsize cat_gonce = 0;
+
+ if (g_once_init_enter (&cat_gonce)) {
+ gsize cat_done;
+
+ cat_done = (gsize) _gst_debug_category_new ("video-blending", 0,
+ "video blending");
+
+ g_once_init_leave (&cat_gonce, cat_done);
+ }
+
+ return (GstDebugCategory *) cat_gonce;
+}
+
+#else
+
+#define ensure_debug_category() /* NOOP */
+
+#endif /* GST_DISABLE_GST_DEBUG */
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+# define ARGB_A 3
+# define ARGB_R 2
+# define ARGB_G 1
+# define ARGB_B 0
+#else
+# define ARGB_A 0
+# define ARGB_R 1
+# define ARGB_G 2
+# define ARGB_B 3
+#endif
+
+/* Copy/pasted from 0.11 video.c */
+static int
+fill_planes (GstBlendVideoFormatInfo * info)
+{
+ gint width, height;
+
+ width = info->width;
+ height = info->height;
+
+ switch (info->fmt) {
+ case GST_VIDEO_FORMAT_YUY2:
+ case GST_VIDEO_FORMAT_YVYU:
+ case GST_VIDEO_FORMAT_UYVY:
+ info->stride[0] = GST_ROUND_UP_4 (width * 2);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_AYUV:
+ case GST_VIDEO_FORMAT_RGBx:
+ case GST_VIDEO_FORMAT_RGBA:
+ case GST_VIDEO_FORMAT_BGRx:
+ case GST_VIDEO_FORMAT_BGRA:
+ case GST_VIDEO_FORMAT_xRGB:
+ case GST_VIDEO_FORMAT_ARGB:
+ case GST_VIDEO_FORMAT_xBGR:
+ case GST_VIDEO_FORMAT_ABGR:
+ case GST_VIDEO_FORMAT_r210:
+ info->stride[0] = width * 4;
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_RGB16:
+ case GST_VIDEO_FORMAT_BGR16:
+ case GST_VIDEO_FORMAT_RGB15:
+ case GST_VIDEO_FORMAT_BGR15:
+ info->stride[0] = GST_ROUND_UP_4 (width * 2);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_RGB:
+ case GST_VIDEO_FORMAT_BGR:
+ case GST_VIDEO_FORMAT_v308:
+ info->stride[0] = GST_ROUND_UP_4 (width * 3);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_v210:
+ info->stride[0] = ((width + 47) / 48) * 128;
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_v216:
+ info->stride[0] = GST_ROUND_UP_8 (width * 4);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_GRAY8:
+ case GST_VIDEO_FORMAT_Y800:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_GRAY16_BE:
+ case GST_VIDEO_FORMAT_GRAY16_LE:
+ case GST_VIDEO_FORMAT_Y16:
+ info->stride[0] = GST_ROUND_UP_4 (width * 2);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_UYVP:
+ info->stride[0] = GST_ROUND_UP_4 ((width * 2 * 5 + 3) / 4);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_RGB8_PALETTED:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_IYU1:
+ info->stride[0] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) +
+ GST_ROUND_UP_4 (width) / 2);
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_ARGB64:
+ case GST_VIDEO_FORMAT_AYUV64:
+ info->stride[0] = width * 8;
+ info->offset[0] = 0;
+ break;
+ case GST_VIDEO_FORMAT_I420:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+ info->offset[2] = info->offset[1] +
+ info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+ break;
+ case GST_VIDEO_FORMAT_YV12: /* same as I420, but plane 1+2 swapped */
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[2] = info->stride[0] * GST_ROUND_UP_2 (height);
+ info->offset[1] = info->offset[2] +
+ info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+ break;
+ case GST_VIDEO_FORMAT_Y41B:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_16 (width) / 4;
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * height;
+ info->offset[2] = info->offset[1] + info->stride[1] * height;
+ /* simplification of ROUNDUP4(w)*h + 2*((ROUNDUP16(w)/4)*h */
+ break;
+ case GST_VIDEO_FORMAT_Y42B:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_8 (width) / 2;
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * height;
+ info->offset[2] = info->offset[1] + info->stride[1] * height;
+ /* simplification of ROUNDUP4(w)*h + 2*(ROUNDUP8(w)/2)*h */
+ break;
+ case GST_VIDEO_FORMAT_Y444:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = info->stride[0];
+ info->stride[2] = info->stride[0];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * height;
+ info->offset[2] = info->offset[1] * 2;
+ break;
+ case GST_VIDEO_FORMAT_NV12:
+ case GST_VIDEO_FORMAT_NV21:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = info->stride[0];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+ break;
+ case GST_VIDEO_FORMAT_A420:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
+ info->stride[2] = info->stride[1];
+ info->stride[3] = info->stride[0];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
+ info->offset[2] = info->offset[1] +
+ info->stride[1] * (GST_ROUND_UP_2 (height) / 2);
+ info->offset[3] = info->offset[2] +
+ info->stride[2] * (GST_ROUND_UP_2 (height) / 2);
+ break;
+ case GST_VIDEO_FORMAT_YUV9:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4);
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[1] = info->stride[0] * height;
+ info->offset[2] = info->offset[1] +
+ info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
+ break;
+ case GST_VIDEO_FORMAT_YVU9:
+ info->stride[0] = GST_ROUND_UP_4 (width);
+ info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4);
+ info->stride[2] = info->stride[1];
+ info->offset[0] = 0;
+ info->offset[2] = info->stride[0] * height;
+ info->offset[1] = info->offset[2] +
+ info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
+ break;
+ case GST_VIDEO_FORMAT_UNKNOWN:
+ GST_ERROR ("invalid format");
+ g_warning ("invalid format");
+ break;
+ }
+ return 0;
+}
+
+typedef struct
+{
+ GstVideoFormat format;
+ void (*getline) (guint8 * dest, const GstBlendVideoFormatInfo * src,
+ guint xoff, int j);
+ void (*putline) (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff,
+ int j);
+ void (*matrix) (guint8 * tmpline, guint width);
+} GetPutLine;
+
+
+#define GET_LINE(info, comp, line) \
+ (info)->pixels + info->offset[(comp)] + ((info)->stride[(comp)] * (line))
+
+/* Line conversion to AYUV */
+
+/* Supports YV12 as well */
+static void
+getline_I420 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_I420 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (src, 2, j >> 1) + GST_ROUND_UP_2 (xoff / 2), src->width);
+}
+
+/* Supports YV12 as well */
+static void
+putline_I420 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_I420 (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (dest, 2, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ line, srcinfo->width / 2);
+}
+
+static void
+getline_YUY2 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_YUY2 (dest, GET_LINE (src, 0, j) +
+ (GST_ROUND_UP_2 (xoff * 4) / 2), src->width / 2);
+}
+
+static void
+putline_YUY2 (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_YUY2 (GET_LINE (dest, 0,
+ j) + (GST_ROUND_UP_2 (xoff * 4) / 2), line, srcinfo->width / 2);
+}
+
+
+static void
+getline_AYUV (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ memcpy (dest, GET_LINE (src, 0, j) + (xoff * 4), (src->width - xoff) * 4);
+}
+
+static void
+putline_AYUV (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ memcpy (GET_LINE (dest, 0, j) + (xoff * 4), line, srcinfo->width * 4);
+}
+
+static void
+getline_UYVY (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_UYVY (dest, GET_LINE (src, 0, j) + xoff * 2, src->width / 2);
+}
+
+static void
+putline_UYVY (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_UYVY (GET_LINE (dest, 0, j) +
+ (GST_ROUND_UP_2 (xoff * 4) / 2), line, srcinfo->width / 2);
+}
+
+static void
+getline_v308 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j) + GST_ROUND_UP_2 (xoff * 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = srcline[i * 3 + 0];
+ dest[i * 4 + 2] = srcline[i * 3 + 1];
+ dest[i * 4 + 3] = srcline[i * 3 + 2];
+ }
+}
+
+static void
+putline_v308 (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + GST_ROUND_UP_2 (xoff * 3);
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i * 3 + 0] = line[i * 4 + 1];
+ destline[i * 3 + 1] = line[i * 4 + 2];
+ destline[i * 3 + 2] = line[i * 4 + 3];
+ }
+}
+
+static void
+getline_v210 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j) + GST_ROUND_UP_2 (xoff * 4) / 5;
+
+ for (i = 0; i < src->width; i += 6) {
+ guint32 a0, a1, a2, a3;
+ guint16 y0, y1, y2, y3, y4, y5;
+ guint16 u0, u2, u4;
+ guint16 v0, v2, v4;
+
+ a0 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 0);
+ a1 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 4);
+ a2 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 8);
+ a3 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 12);
+
+ u0 = ((a0 >> 0) & 0x3ff) >> 2;
+ y0 = ((a0 >> 10) & 0x3ff) >> 2;
+ v0 = ((a0 >> 20) & 0x3ff) >> 2;
+ y1 = ((a1 >> 0) & 0x3ff) >> 2;
+
+ u2 = ((a1 >> 10) & 0x3ff) >> 2;
+ y2 = ((a1 >> 20) & 0x3ff) >> 2;
+ v2 = ((a2 >> 0) & 0x3ff) >> 2;
+ y3 = ((a2 >> 10) & 0x3ff) >> 2;
+
+ u4 = ((a2 >> 20) & 0x3ff) >> 2;
+ y4 = ((a3 >> 0) & 0x3ff) >> 2;
+ v4 = ((a3 >> 10) & 0x3ff) >> 2;
+ y5 = ((a3 >> 20) & 0x3ff) >> 2;
+
+ dest[4 * (i + 0) + 0] = 0xff;
+ dest[4 * (i + 0) + 1] = y0;
+ dest[4 * (i + 0) + 2] = u0;
+ dest[4 * (i + 0) + 3] = v0;
+
+ dest[4 * (i + 1) + 0] = 0xff;
+ dest[4 * (i + 1) + 1] = y1;
+ dest[4 * (i + 1) + 2] = u0;
+ dest[4 * (i + 1) + 3] = v0;
+
+ dest[4 * (i + 2) + 0] = 0xff;
+ dest[4 * (i + 2) + 1] = y2;
+ dest[4 * (i + 2) + 2] = u2;
+ dest[4 * (i + 2) + 3] = v2;
+
+ dest[4 * (i + 3) + 0] = 0xff;
+ dest[4 * (i + 3) + 1] = y3;
+ dest[4 * (i + 3) + 2] = u2;
+ dest[4 * (i + 3) + 3] = v2;
+
+ dest[4 * (i + 4) + 0] = 0xff;
+ dest[4 * (i + 4) + 1] = y4;
+ dest[4 * (i + 4) + 2] = u4;
+ dest[4 * (i + 4) + 3] = v4;
+
+ dest[4 * (i + 5) + 0] = 0xff;
+ dest[4 * (i + 5) + 1] = y5;
+ dest[4 * (i + 5) + 2] = u4;
+ dest[4 * (i + 5) + 3] = v4;
+
+ }
+
+}
+
+static void
+putline_v210 (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + GST_ROUND_UP_2 (xoff * 4) / 5;
+
+
+ for (i = 0; i < srcinfo->width + 5; i += 6) {
+ guint32 a0, a1, a2, a3;
+ guint16 y0, y1, y2, y3, y4, y5;
+ guint16 u0, u1, u2;
+ guint16 v0, v1, v2;
+
+ y0 = line[4 * (i + 0) + 1] << 2;
+ y1 = line[4 * (i + 1) + 1] << 2;
+ y2 = line[4 * (i + 2) + 1] << 2;
+ y3 = line[4 * (i + 3) + 1] << 2;
+ y4 = line[4 * (i + 4) + 1] << 2;
+ y5 = line[4 * (i + 5) + 1] << 2;
+
+ u0 = (line[4 * (i + 0) + 2] + line[4 * (i + 1) + 2]) << 1;
+ u1 = (line[4 * (i + 2) + 2] + line[4 * (i + 3) + 2]) << 1;
+ u2 = (line[4 * (i + 4) + 2] + line[4 * (i + 5) + 2]) << 1;
+
+ v0 = (line[4 * (i + 0) + 3] + line[4 * (i + 1) + 3]) << 1;
+ v1 = (line[4 * (i + 2) + 3] + line[4 * (i + 3) + 3]) << 1;
+ v2 = (line[4 * (i + 4) + 3] + line[4 * (i + 5) + 3]) << 1;
+
+ a0 = u0 | (y0 << 10) | (v0 << 20);
+ a1 = y1 | (u1 << 10) | (y2 << 20);
+ a2 = v1 | (y3 << 10) | (u2 << 20);
+ a3 = y4 | (v2 << 10) | (y5 << 20);
+
+ GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 0, a0);
+ GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 4, a1);
+ GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 8, a2);
+ GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 12, a3);
+ }
+}
+
+static void
+getline_v216 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j) + GST_ROUND_UP_2 (xoff + 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2) >> 8;
+ dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0) >> 8;
+ dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4) >> 8;
+ }
+}
+
+static void
+putline_v216 (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + GST_ROUND_UP_2 (xoff + 3);
+
+ for (i = 0; i < srcinfo->width / 2; i++) {
+ GST_WRITE_UINT16_LE (destline + i * 8 + 0, line[(i * 2 + 0) * 4 + 2] << 8);
+ GST_WRITE_UINT16_LE (destline + i * 8 + 2, line[(i * 2 + 0) * 4 + 1] << 8);
+ GST_WRITE_UINT16_LE (destline + i * 8 + 4, line[(i * 2 + 1) * 4 + 3] << 8);
+ GST_WRITE_UINT16_LE (destline + i * 8 + 8, line[(i * 2 + 0) * 4 + 1] << 8);
+ }
+}
+
+static void
+getline_Y41B (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_YUV9 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j) + (xoff / 4), GET_LINE (src, 2, j) + (xoff / 4),
+ src->width / 2);
+}
+
+static void
+putline_Y41B (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destlineY = GET_LINE (dest, 0, j) + xoff;
+ guint8 *destlineU = GET_LINE (dest, 1, j) + (xoff / 4);
+ guint8 *destlineV = GET_LINE (dest, 2, j) + (xoff / 4);
+
+ for (i = 0; i < srcinfo->width - 3; i += 4) {
+ destlineY[i] = line[i * 4 + 1];
+ destlineY[i + 1] = line[i * 4 + 5];
+ destlineY[i + 2] = line[i * 4 + 9];
+ destlineY[i + 3] = line[i * 4 + 13];
+
+ destlineU[i >> 2] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10] + line[i * 4 +
+ 14] + 2) >> 2;
+ destlineV[i >> 2] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11] + line[i * 4 +
+ 15] + 2) >> 2;
+ }
+
+ if (i == srcinfo->width - 3) {
+ destlineY[i] = line[i * 4 + 1];
+ destlineY[i + 1] = line[i * 4 + 5];
+ destlineY[i + 2] = line[i * 4 + 9];
+
+ destlineU[i >> 2] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10] + 1) / 3;
+ destlineV[i >> 2] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11] + 1) / 3;
+ } else if (i == srcinfo->width - 2) {
+ destlineY[i] = line[i * 4 + 1];
+ destlineY[i + 1] = line[i * 4 + 5];
+
+ destlineU[i >> 2] = (line[i * 4 + 2] + line[i * 4 + 6] + 1) >> 1;
+ destlineV[i >> 2] = (line[i * 4 + 3] + line[i * 4 + 7] + 1) >> 1;
+ } else if (i == srcinfo->width - 1) {
+ destlineY[i + 1] = line[i * 4 + 5];
+
+ destlineU[i >> 2] = line[i * 4 + 2];
+ destlineV[i >> 2] = line[i * 4 + 3];
+ }
+}
+
+static void
+getline_Y42B (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_Y42B (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (src, 2, j) + GST_ROUND_UP_2 (xoff / 2), src->width / 2);
+}
+
+static void
+putline_Y42B (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_Y42B (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (dest, 2, j) + GST_ROUND_UP_2 (xoff / 2), line,
+ srcinfo->width / 2);
+}
+
+static void
+getline_Y444 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_Y444 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j) + xoff, GET_LINE (src, 2, j) + xoff, src->width);
+}
+
+static void
+putline_Y444 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_Y444 (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j) + xoff,
+ GET_LINE (dest, 2, j) + xoff, line, srcinfo->width);
+}
+
+static void
+getline_Y800 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_Y800 (dest, GET_LINE (src, 0, j) + xoff, src->width);
+}
+
+static void
+putline_Y800 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_Y800 (GET_LINE (dest, 0, j) + xoff, line, srcinfo->width);
+}
+
+static void
+getline_Y16 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_Y16 (dest, GET_LINE (src, 0, j) + xoff * 2, src->width);
+}
+
+static void
+putline_Y16 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_Y16 (GET_LINE (dest, 0, j) + xoff * 2, line, srcinfo->width);
+}
+
+static void
+getline_NV12 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_NV12 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j >> 1) + xoff, src->width / 2);
+}
+
+static void
+putline_NV12 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_NV12 (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j >> 1) + xoff, line, srcinfo->width / 2);
+}
+
+static void
+getline_NV21 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_NV21 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j >> 1) + xoff, src->width / 2);
+}
+
+static void
+putline_NV21 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_NV21 (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j >> 1) + xoff, line, srcinfo->width / 2);
+}
+
+static void
+getline_UYVP (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j)
+ + xoff * 3;
+
+ for (i = 0; i < src->width; i += 2) {
+ guint16 y0, y1;
+ guint16 u0;
+ guint16 v0;
+
+ u0 = (srcline[(i / 2) * 5 + 0] << 2) | (srcline[(i / 2) * 5 + 1] >> 6);
+
+ y0 = ((srcline[(i / 2) * 5 + 1] & 0x3f) << 4) |
+ (srcline[(i / 2) * 5 + 2] >> 4);
+
+ v0 = ((srcline[(i / 2) * 5 + 2] & 0x0f) << 6) |
+ (srcline[(i / 2) * 5 + 3] >> 2);
+
+ y1 = ((srcline[(i / 2) * 5 + 3] & 0x03) << 8) | srcline[(i / 2) * 5 + 4];
+
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = y0 >> 2;
+ dest[i * 4 + 2] = u0 >> 2;
+ dest[i * 4 + 3] = v0 >> 2;
+ dest[i * 4 + 4] = 0xff;
+ dest[i * 4 + 5] = y1 >> 2;
+ dest[i * 4 + 6] = u0 >> 2;
+ dest[i * 4 + 7] = v0 >> 2;
+ }
+}
+
+static void
+putline_UYVP (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + xoff * 3;
+
+ for (i = 0; i < srcinfo->width; i += 2) {
+ guint16 y0, y1;
+ guint16 u0;
+ guint16 v0;
+
+ y0 = line[4 * (i + 0) + 1];
+ y1 = line[4 * (i + 1) + 1];
+ u0 = (line[4 * (i + 0) + 2] + line[4 * (i + 1) + 2] + 1) >> 1;
+ v0 = (line[4 * (i + 0) + 3] + line[4 * (i + 1) + 3] + 1) >> 1;
+
+ destline[(i / 2) * 5 + 0] = u0;
+ destline[(i / 2) * 5 + 1] = y0 >> 2;
+ destline[(i / 2) * 5 + 2] = (y0 << 6) | (v0 >> 4);
+ destline[(i / 2) * 5 + 3] = (v0 << 4) | (y1 >> 2);
+ destline[(i / 2) * 5 + 4] = (y1 << 2);
+ }
+}
+
+static void
+getline_A420 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_A420 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (src, 2, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (src, 3, j) + GST_ROUND_UP_2 (xoff / 2), src->width);
+}
+
+static void
+putline_A420 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_A420 (GET_LINE (dest, 0, j) + xoff,
+ GET_LINE (dest, 1, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (dest, 2, j >> 1) + GST_ROUND_UP_2 (xoff / 2),
+ GET_LINE (dest, 3, j) + GST_ROUND_UP_2 (xoff / 2), line,
+ srcinfo->width / 2);
+}
+
+static void
+getline_YUV9 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_YUV9 (dest,
+ GET_LINE (src, 0, j) + xoff,
+ GET_LINE (src, 1, j >> 2) + GST_ROUND_UP_4 (xoff / 4),
+ GET_LINE (src, 2, j >> 2) + GST_ROUND_UP_4 (xoff / 4), src->width / 2);
+}
+
+static void
+putline_YUV9 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destY = GET_LINE (dest, 0, j) + xoff;
+ guint8 *destU = GET_LINE (dest, 1, j >> 2) + GST_ROUND_UP_4 (xoff / 4);
+ guint8 *destV = GET_LINE (dest, 2, j >> 2) + GST_ROUND_UP_4 (xoff / 4);
+ guint width = srcinfo->width;
+
+ for (i = 0; i < width - 3; i += 4) {
+ destY[i] = line[i * 4 + 1];
+ destY[i + 1] = line[i * 4 + 5];
+ destY[i + 2] = line[i * 4 + 9];
+ destY[i + 3] = line[i * 4 + 13];
+ if (j % 4 == 0) {
+ destU[i >> 2] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10] + line[i * 4 +
+ 14]) >> 2;
+ destV[i >> 2] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11] + line[i * 4 +
+ 15]) >> 2;
+ }
+ }
+
+ if (i == width - 3) {
+ destY[i] = line[i * 4 + 1];
+ destY[i + 1] = line[i * 4 + 5];
+ destY[i + 2] = line[i * 4 + 9];
+ if (j % 4 == 0) {
+ destU[i >> 2] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10]) / 3;
+ destV[i >> 2] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11]) / 3;
+ }
+ } else if (i == width - 2) {
+ destY[i] = line[i * 4 + 1];
+ destY[i + 1] = line[i * 4 + 5];
+ if (j % 4 == 0) {
+ destU[i >> 2] = (line[i * 4 + 2] + line[i * 4 + 6]) >> 1;
+ destV[i >> 2] = (line[i * 4 + 3] + line[i * 4 + 7]) >> 1;
+ }
+ } else if (i == width - 1) {
+ destY[i] = line[i * 4 + 1];
+ destU[i >> 2] = line[i * 4 + 2];
+ destV[i >> 2] = line[i * 4 + 3];
+ }
+}
+
+static void
+getline_IYU1 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline =
+ GET_LINE (src, 0, j) + GST_ROUND_UP_2 ((xoff * 3) / 2);
+ guint width = src->width;
+
+ for (i = 0; i < width - 3; i += 4) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 4] = 0xff;
+ dest[i * 4 + 8] = 0xff;
+ dest[i * 4 + 12] = 0xff;
+ dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+ dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+ dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
+ dest[i * 4 + 13] = srcline[(i >> 2) * 6 + 5];
+ dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] = dest[i * 4 + 14] =
+ srcline[(i >> 2) * 6 + 0];
+ dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] = dest[i * 4 + 15] =
+ srcline[(i >> 2) * 6 + 3];
+ }
+
+ if (i == width - 3) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 4] = 0xff;
+ dest[i * 4 + 8] = 0xff;
+ dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+ dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+ dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
+ dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] =
+ srcline[(i >> 2) * 6 + 0];
+ dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] =
+ srcline[(i >> 2) * 6 + 3];
+ } else if (i == width - 2) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 4] = 0xff;
+ dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+ dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
+ dest[i * 4 + 2] = dest[i * 4 + 6] = srcline[(i >> 2) * 6 + 0];
+ dest[i * 4 + 3] = dest[i * 4 + 7] = srcline[(i >> 2) * 6 + 3];
+ } else if (i == width - 1) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
+ dest[i * 4 + 2] = srcline[(i >> 2) * 6 + 0];
+ dest[i * 4 + 3] = srcline[(i >> 2) * 6 + 3];
+ }
+}
+
+static void
+putline_IYU1 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + GST_ROUND_UP_2 ((xoff * 3) / 2);
+ guint width = srcinfo->width;
+
+ for (i = 0; i < width - 3; i += 4) {
+ destline[(i >> 2) * 6 + 1] = line[i * 4 + 1];
+ destline[(i >> 2) * 6 + 2] = line[i * 4 + 5];
+ destline[(i >> 2) * 6 + 4] = line[i * 4 + 9];
+ destline[(i >> 2) * 6 + 5] = line[i * 4 + 13];
+ destline[(i >> 2) * 6 + 0] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10] + line[i * 4 +
+ 14]) >> 2;
+ destline[(i >> 2) * 6 + 3] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11] + line[i * 4 +
+ 15]) >> 2;
+ }
+
+ if (i == width - 3) {
+ destline[(i >> 2) * 6 + 1] = line[i * 4 + 1];
+ destline[(i >> 2) * 6 + 2] = line[i * 4 + 5];
+ destline[(i >> 2) * 6 + 4] = line[i * 4 + 9];
+ destline[(i >> 2) * 6 + 0] =
+ (line[i * 4 + 2] + line[i * 4 + 6] + line[i * 4 + 10]) / 3;
+ destline[(i >> 2) * 6 + 3] =
+ (line[i * 4 + 3] + line[i * 4 + 7] + line[i * 4 + 11]) / 3;
+ } else if (i == width - 2) {
+ destline[(i >> 2) * 6 + 1] = line[i * 4 + 1];
+ destline[(i >> 2) * 6 + 2] = line[i * 4 + 5];
+ destline[(i >> 2) * 6 + 0] = (line[i * 4 + 2] + line[i * 4 + 6]) >> 1;
+ destline[(i >> 2) * 6 + 3] = (line[i * 4 + 3] + line[i * 4 + 7]) >> 1;
+ } else if (i == width - 1) {
+ destline[(i >> 2) * 6 + 1] = line[i * 4 + 1];
+ destline[(i >> 2) * 6 + 0] = line[i * 4 + 2];
+ destline[(i >> 2) * 6 + 3] = line[i * 4 + 3];
+ }
+}
+
+
+/* Line conversion to ARGB */
+static void
+getline_RGB (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j) + xoff * 3;
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = srcline[i * 3 + 0];
+ dest[i * 4 + 2] = srcline[i * 3 + 1];
+ dest[i * 4 + 3] = srcline[i * 3 + 2];
+ }
+}
+
+static void
+putline_RGB (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + xoff * 3;
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i * 3 + 0] = line[i * 4 + 1];
+ destline[i * 3 + 1] = line[i * 4 + 2];
+ destline[i * 3 + 2] = line[i * 4 + 3];
+ }
+}
+
+static void
+getline_BGR (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint8 *srcline = GET_LINE (src, 0, j) + xoff * 3;
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = srcline[i * 3 + 2];
+ dest[i * 4 + 2] = srcline[i * 3 + 1];
+ dest[i * 4 + 3] = srcline[i * 3 + 0];
+ }
+}
+
+static void
+putline_BGR (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint8 *destline = GET_LINE (dest, 0, j) + xoff * 3;
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i * 3 + 0] = line[i * 4 + 3];
+ destline[i * 3 + 1] = line[i * 4 + 2];
+ destline[i * 3 + 2] = line[i * 4 + 1];
+ }
+}
+
+static void
+getline_RGBA (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_RGBA (dest, GET_LINE (src, 0, j) + (4 * xoff), src->width);
+}
+
+static void
+putline_RGBA (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_RGBA (GET_LINE (dest, 0, j) + (4 * xoff),
+ line, srcinfo->width);
+}
+
+static void
+getline_ARGB (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+
+ memcpy (dest, GET_LINE (src, 0, j), (src->width - xoff) * 4);
+}
+
+static void
+putline_ARGB (GstBlendVideoFormatInfo * dest, GstBlendVideoFormatInfo * srcinfo,
+ const guint8 * line, guint xoff, int j)
+{
+ memcpy (GET_LINE (dest, 0, j) + (xoff * 4), line, srcinfo->width * 4);
+}
+
+static void
+getline_RGB16 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint16 *srcline = (const guint16 *) GET_LINE (src, 0, j)
+ + (xoff * 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = ((srcline[i] >> 11) & 0x1f) << 3;
+ dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
+ dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
+ }
+}
+
+static void
+putline_RGB16 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint16 *destline = (guint16 *) GET_LINE (dest, 0, j) + (xoff * 3);
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i] = ((line[i * 4 + 1] >> 3) << 11) | ((line[i * 4 +
+ 2] >> 2) << 5) | (line[i * 4 + 3] >> 3);
+ }
+}
+
+static void
+getline_RGB15 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint16 *srcline = (const guint16 *) GET_LINE (src, 0, j)
+ + (xoff * 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 1] = ((srcline[i] >> 10) & 0x1f) << 3;
+ dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+ dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
+ }
+}
+
+static void
+putline_RGB15 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint16 *destline = (guint16 *) GET_LINE (dest, 0, j) + (xoff * 3);
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i] = ((line[i * 4 + 1] >> 3) << 10) | ((line[i * 4 +
+ 2] >> 3) << 5) | (line[i * 4 + 3] >> 3);
+ }
+}
+
+static void
+getline_BGR15 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint16 *srcline = (const guint16 *) GET_LINE (src, 0, j)
+ + (xoff * 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 3] = ((srcline[i] >> 10) & 0x1f) << 3;
+ dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
+ dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
+ }
+}
+
+static void
+putline_BGR15 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint16 *destline = (guint16 *) GET_LINE (dest, 0, j) + (xoff * 3);
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i] = ((line[i * 4 + 3] >> 3) << 10) | ((line[i * 4 +
+ 2] >> 3) << 5) | (line[i * 4 + 1] >> 3);
+ }
+}
+
+static void
+getline_BGR16 (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ int i;
+ const guint16 *srcline = (const guint16 *) GET_LINE (src, 0, j)
+ + (xoff * 3);
+
+ for (i = 0; i < src->width; i++) {
+ dest[i * 4 + 0] = 0xff;
+ dest[i * 4 + 3] = ((srcline[i] >> 11) & 0x1f) << 3;
+ dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
+ dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
+ }
+}
+
+static void
+putline_BGR16 (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ int i;
+ guint16 *destline = (guint16 *) GET_LINE (dest, 0, j) + (xoff * 3);
+
+ for (i = 0; i < srcinfo->width; i++) {
+ destline[i] = ((line[i * 4 + 3] >> 3) << 11) | ((line[i * 4 +
+ 2] >> 2) << 5) | (line[i * 4 + 1] >> 3);
+ }
+}
+
+static void
+getline_BGRA (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_BGRA (dest, GET_LINE (src, 0, j) + xoff * 4, src->width);
+}
+
+static void
+putline_BGRA (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_BGRA (GET_LINE (dest, 0, j) + xoff * 4, line, srcinfo->width);
+}
+
+static void
+getline_ABGR (guint8 * dest, const GstBlendVideoFormatInfo * src, guint xoff,
+ int j)
+{
+ cogorc_getline_ABGR (dest, GET_LINE (src, 0, j) + (xoff * 4), src->width);
+}
+
+static void
+putline_ABGR (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * srcinfo, const guint8 * line, guint xoff, int j)
+{
+ cogorc_putline_ABGR (GET_LINE (dest, 0, j) + (xoff * 4),
+ line, srcinfo->width);
+}
+
+static const GetPutLine lines[] = {
+ /* YUV lines conversion */
+ {GST_VIDEO_FORMAT_I420, getline_I420, putline_I420},
+ {GST_VIDEO_FORMAT_YV12, getline_I420, putline_I420},
+ {GST_VIDEO_FORMAT_AYUV, getline_AYUV, putline_AYUV},
+ {GST_VIDEO_FORMAT_YUY2, getline_YUY2, putline_YUY2},
+ {GST_VIDEO_FORMAT_UYVY, getline_UYVY, putline_UYVY},
+ {GST_VIDEO_FORMAT_v308, getline_v308, putline_v308},
+ {GST_VIDEO_FORMAT_v210, getline_v210, putline_v210},
+ {GST_VIDEO_FORMAT_v216, getline_v216, putline_v216},
+ {GST_VIDEO_FORMAT_Y41B, getline_Y41B, putline_Y41B},
+ {GST_VIDEO_FORMAT_Y42B, getline_Y42B, putline_Y42B},
+ {GST_VIDEO_FORMAT_Y444, getline_Y444, putline_Y444},
+ {GST_VIDEO_FORMAT_Y800, getline_Y800, putline_Y800},
+ {GST_VIDEO_FORMAT_Y16, getline_Y16, putline_Y16},
+ {GST_VIDEO_FORMAT_NV12, getline_NV12, putline_NV12},
+ {GST_VIDEO_FORMAT_NV21, getline_NV21, putline_NV21},
+ {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
+ {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420},
+ {GST_VIDEO_FORMAT_YUV9, getline_YUV9, putline_YUV9},
+ {GST_VIDEO_FORMAT_IYU1, getline_IYU1, putline_IYU1},
+
+ /* ARGB lines conversion */
+ {GST_VIDEO_FORMAT_RGB, getline_RGB, putline_RGB},
+ {GST_VIDEO_FORMAT_BGR, getline_BGR, putline_BGR},
+ {GST_VIDEO_FORMAT_RGBx, getline_RGBA, putline_RGBA},
+ {GST_VIDEO_FORMAT_RGBA, getline_RGBA, putline_RGBA},
+ {GST_VIDEO_FORMAT_ARGB, getline_ARGB, putline_ARGB},
+ {GST_VIDEO_FORMAT_RGB16, getline_RGB16, putline_RGB16},
+ {GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16},
+ {GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
+ {GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15},
+ {GST_VIDEO_FORMAT_BGRA, getline_BGRA, putline_BGRA},
+ {GST_VIDEO_FORMAT_ABGR, getline_ABGR, putline_ABGR},
+ {GST_VIDEO_FORMAT_BGRx, getline_BGRA, putline_BGRA}
+};
+
+static void
+matrix_identity (guint8 * tmpline, guint width)
+{
+}
+
+static void
+matrix_rgb_to_yuv (guint8 * tmpline, guint width)
+{
+ int i;
+ int r, g, b;
+ int y, u, v;
+
+ for (i = 0; i < width; i++) {
+ r = tmpline[i * 4 + 1];
+ g = tmpline[i * 4 + 2];
+ b = tmpline[i * 4 + 3];
+
+ y = (47 * r + 157 * g + 16 * b + 4096) >> 8;
+ u = (-26 * r - 87 * g + 112 * b + 32768) >> 8;
+ v = (112 * r - 102 * g - 10 * b + 32768) >> 8;
+
+ tmpline[i * 4 + 1] = CLAMP (y, 0, 255);
+ tmpline[i * 4 + 2] = CLAMP (u, 0, 255);
+ tmpline[i * 4 + 3] = CLAMP (v, 0, 255);
+ }
+}
+
+static void
+matrix_yuv_to_rgb (guint8 * tmpline, guint width)
+{
+ int i;
+ int r, g, b;
+ int y, u, v;
+
+ for (i = 0; i < width; i++) {
+ y = tmpline[i * 4 + 1];
+ u = tmpline[i * 4 + 2];
+ v = tmpline[i * 4 + 3];
+
+ r = (298 * y + 459 * v - 63514) >> 8;
+ g = (298 * y - 55 * u - 136 * v + 19681) >> 8;
+ b = (298 * y + 541 * u - 73988) >> 8;
+
+ tmpline[i * 4 + ARGB_R] = CLAMP (r, 0, 255);
+ tmpline[i * 4 + ARGB_G] = CLAMP (g, 0, 255);
+ tmpline[i * 4 + ARGB_B] = CLAMP (b, 0, 255);
+ }
+}
+
+static gboolean
+lookup_getput (GetPutLine * getput, GstVideoFormat fmt)
+{
+ int i;
+
+ getput->getline = NULL;
+ getput->putline = NULL;
+ getput->matrix = matrix_identity;
+
+ for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) {
+ if (lines[i].format == fmt) {
+ getput->getline = lines[i].getline;
+ getput->putline = lines[i].putline;
+
+ return TRUE;
+ }
+ }
+ GST_WARNING ("Conversion from %i not supported", fmt);
+
+ return FALSE;
+}
+
+#define BLEND(ret, alpha, v0, v1) \
+{ \
+ ret = (v0 * alpha + v1 * (255 - alpha)) / 255; \
+}
+
+void
+video_blend_scale_linear_RGBA (GstBlendVideoFormatInfo * src,
+ gint dest_height, gint dest_width)
+{
+ int acc;
+ int y_increment;
+ int x_increment;
+ int y1;
+ int i;
+ int j;
+ int x;
+ int dest_size;
+ guint dest_stride = dest_width * 4;
+ guint src_stride = src->width * 4;
+
+ guint8 *tmpbuf = g_malloc (dest_width * 8 * 4);
+ guint8 *dest_pixels =
+ g_malloc (gst_video_format_get_size (src->fmt, dest_height,
+ dest_width));
+
+ if (dest_height == 1)
+ y_increment = 0;
+ else
+ y_increment = ((src->height - 1) << 16) / (dest_height - 1) - 1;
+
+ if (dest_width == 1)
+ x_increment = 0;
+ else
+ x_increment = ((src->width - 1) << 16) / (dest_width - 1) - 1;
+
+ dest_size = dest_width * 4;
+
+#define LINE(x) ((tmpbuf) + (dest_size)*((x)&1))
+
+ acc = 0;
+ orc_resample_bilinear_u32 (LINE (0), src->pixels, 0, x_increment, dest_width);
+ y1 = 0;
+ for (i = 0; i < dest_height; i++) {
+ j = acc >> 16;
+ x = acc & 0xffff;
+
+ if (x == 0) {
+ memcpy (dest_pixels + i * dest_stride, LINE (j), dest_size);
+ } else {
+ if (j > y1) {
+ orc_resample_bilinear_u32 (LINE (j),
+ src->pixels + j * src_stride, 0, x_increment, dest_width);
+ y1++;
+ }
+ if (j >= y1) {
+ orc_resample_bilinear_u32 (LINE (j + 1),
+ src->pixels + (j + 1) * src_stride, 0, x_increment, dest_width);
+ y1++;
+ }
+ orc_merge_linear_u8 (dest_pixels + i * dest_stride,
+ LINE (j), LINE (j + 1), (x >> 8), dest_width * 4);
+ }
+
+ acc += y_increment;
+ }
+
+ /* Update src, our reference to the old src->pixels is lost */
+ video_blend_format_info_init (src, dest_pixels, dest_height, dest_width,
+ src->fmt);
+
+ g_free (tmpbuf);
+}
+
+/* video_blend:
+ * @dest: The #GstBlendVideoFormatInfo where to blend @src in
+ * @src: the #GstBlendVideoFormatInfo that we want to blend into
+ * @dest
+ * @x: The x offset in pixel where the @src image should be blended
+ * @y: the y offset in pixel where the @src image should be blended
+ *
+ * Lets you blend the @src image into the @dest image
+ */
+gboolean
+video_blend (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * src, guint x, guint y)
+{
+ guint i, j;
+ guint8 alpha;
+ GetPutLine getputdest, getputsrc;
+
+ gint src_stride = src->width * 4;
+ guint8 *tmpdestline = g_malloc (sizeof (guint8) * (dest->width + 8) * 4);
+ guint8 *tmpsrcline = g_malloc (sizeof (guint8) * (dest->width + 8) * 4);
+
+ ensure_debug_category ();
+
+
+ if (!lookup_getput (&getputdest, dest->fmt))
+ goto failed;
+
+ if (!lookup_getput (&getputsrc, src->fmt))
+ goto failed;
+
+ if (gst_video_format_is_rgb (src->fmt) != gst_video_format_is_rgb (dest->fmt))
+ getputsrc.matrix = gst_video_format_is_rgb (src->fmt) ?
+ matrix_rgb_to_yuv : matrix_yuv_to_rgb;
+
+ /* adjust src pointers for negative sizes */
+ if (x < 0) {
+ src += -x * 4;
+ src->width -= -x;
+ x = 0;
+ }
+
+ if (y < 0) {
+ src += -y * src_stride;
+ src->height -= -y;
+ y = 0;
+ }
+
+ /* adjust width/height if the src is bigger than dest */
+ if (x + src->width > dest->width)
+ src->width = dest->width - x;
+
+ if (y + src->height > dest->height)
+ src->height = dest->height - y;
+
+ /* Mainloop doing the needed conversions, and blending */
+ for (i = y; i < y + src->height; i++) {
+
+ getputdest.getline (tmpdestline, dest, x, i);
+ getputsrc.getline (tmpsrcline, src, 0, (i - y));
+
+ getputsrc.matrix (tmpsrcline, src->width);
+
+ /* Here dest and src are both either in AYUV or ARGB
+ * TODO: Make the orc version working properly*/
+ for (j = 0; j < src->width * 4; j += 4) {
+ alpha = tmpsrcline[j];
+
+ BLEND (tmpdestline[j + 1], alpha, tmpsrcline[j + 1], tmpdestline[j + 1]);
+ BLEND (tmpdestline[j + 2], alpha, tmpsrcline[j + 2], tmpdestline[j + 2]);
+ BLEND (tmpdestline[j + 3], alpha, tmpsrcline[j + 3], tmpdestline[j + 3]);
+ }
+
+ /* FIXME
+ * #if G_BYTE_ORDER == LITTLE_ENDIAN
+ * orc_blend_little (tmpdestline, tmpsrcline, dest->width);
+ * #else
+ * orc_blend_big (tmpdestline, tmpsrcline, src->width);
+ * #endif
+ */
+
+ getputdest.putline (dest, src, tmpdestline, x, i);
+
+ }
+
+ g_free (tmpdestline);
+ g_free (tmpsrcline);
+
+ return TRUE;
+
+failed:
+ GST_WARNING ("Could not do the blending");
+ g_free (tmpdestline);
+ g_free (tmpsrcline);
+
+ return FALSE;
+}
+
+/* video_blend_format_info_init:
+ * @info: The #GstBlendVideoFormatInfo to initialize
+ * @pixels: The pixels data in @fmt format
+ * @height: The height of the image
+ * @width: the width of the image
+ * @fmt: The #GstVideoFormat of the image
+ *
+ * Initializes a GstBlendVideoFormatInfo.
+ * This function can be called on already initialized instances.
+ */
+void
+video_blend_format_info_init (GstBlendVideoFormatInfo * info,
+ guint8 * pixels, guint height, guint width, GstVideoFormat fmt)
+{
+ guint nb_component = gst_video_format_has_alpha (fmt) ? 4 : 3;
+
+ ensure_debug_category ();
+
+ GST_DEBUG
+ ("Initializing video bleding info, height %i, width %i, fmt %i nb_component %i",
+ height, width, fmt, nb_component);
+
+ info->width = width;
+ info->height = height;
+ info->pixels = pixels;
+ info->fmt = fmt;
+ info->size = gst_video_format_get_size (fmt, height, width);
+
+ fill_planes (info);
+}
diff --git a/gst-libs/gst/video/video-blend.h b/gst-libs/gst/video/video-blend.h
new file mode 100644
index 000000000..3f5e0cd69
--- /dev/null
+++ b/gst-libs/gst/video/video-blend.h
@@ -0,0 +1,73 @@
+/* Gstreamer video blending utility functions
+ *
+ * Copyright (C) <2011> Intel Corporation
+ * Copyright (C) <2011> Collabora Ltd.
+ * Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_VIDEO_BLEND__
+#define __GST_VIDEO_BLEND__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+#define MAX_VIDEO_PLANES 4
+
+typedef struct _GstBlendVideoFormatInfo GstBlendVideoFormatInfo;
+
+/* GstBlendVideoFormatInfo:
+ * @fmt: The #GstVideoFormat describing the video format
+ * @width: The width of the video
+ * @height: The height of the video
+ * @pixels: The buffer containing the pixels of the video
+ * @size: The size in byte of @pixels
+ * @offset: The offsets of the different component of the video
+ * @stride: The stride of the different component of the video
+ *
+ * Information describing image properties containing necessary
+ * fields to do video blending.
+ */
+struct _GstBlendVideoFormatInfo
+{
+ GstVideoFormat fmt;
+
+ gint width;
+ gint height;
+
+ guint8 * pixels;
+ gsize size;
+
+ /* YUV components: Y=0, U=1, V=2, A=3
+ * RGB components: R=0, G=1, B=2, A=3 */
+ gint offset[MAX_VIDEO_PLANES];
+ gint stride[MAX_VIDEO_PLANES];
+};
+
+void video_blend_format_info_init (GstBlendVideoFormatInfo * info,
+ guint8 *pixels, guint height,
+ guint width, GstVideoFormat fmt);
+
+void video_blend_scale_linear_RGBA (GstBlendVideoFormatInfo * src,
+ gint dest_height, gint dest_width);
+
+gboolean video_blend (GstBlendVideoFormatInfo * dest,
+ GstBlendVideoFormatInfo * src,
+ guint x, guint y);
+
+#endif
diff --git a/gst-libs/gst/video/video-overlay-composition.c b/gst-libs/gst/video/video-overlay-composition.c
new file mode 100644
index 000000000..3bfbad1bb
--- /dev/null
+++ b/gst-libs/gst/video/video-overlay-composition.c
@@ -0,0 +1,1019 @@
+/* GStreamer Video Overlay Composition
+ * Copyright (C) 2011 Intel Corporation
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gstvideooverlaycomposition
+ * @short_description: Video Buffer Overlay Compositions (Subtitles, Logos)
+ *
+ * <refsect2>
+ * <para>
+ * Functions to create and handle overlay compositions on video buffers.
+ * </para>
+ * <para>
+ * An overlay composition describes one or more overlay rectangles to be
+ * blended on top of a video buffer.
+ * </para>
+ * <para>
+ * This API serves two main purposes:
+ * <itemizedlist>
+ * <listitem>
+ * it can be used to attach overlay information (subtitles or logos)
+ * to non-raw video buffers such as GL/VAAPI/VDPAU surfaces. The actual
+ * blending of the overlay can then be done by e.g. the video sink that
+ * processes these non-raw buffers.
+ * </listitem>
+ * <listitem>
+ * it can also be used to blend overlay rectangles on top of raw video
+ * buffers, thus consolidating blending functionality for raw video in
+ * one place.
+ * </listitem>
+ * Together, this allows existing overlay elements to easily handle raw
+ * and non-raw video as input in without major changes (once the overlays
+ * have been put into a #GstOverlayComposition object anyway) - for raw
+ * video the overlay can just use the blending function to blend the data
+ * on top of the video, and for surface buffers it can just attach them to
+ * the buffer and let the sink render the overlays.
+ * </itemizedlist>
+ * </para>
+ * </refsect2>
+ *
+ * Since: 0.10.36
+ */
+
+/* TODO:
+ * - provide accessors for seq_num and other fields (as needed)
+ * - allow overlay to set/get original pango markup string on/from rectangle
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "video-overlay-composition.h"
+#include "video-blend.h"
+
+struct _GstVideoOverlayComposition
+{
+ GstMiniObject parent;
+
+ guint num_rectangles;
+ GstVideoOverlayRectangle **rectangles;
+
+ /* lowest rectangle sequence number still used by the upstream
+ * overlay element. This way a renderer maintaining some kind of
+ * rectangles <-> surface cache can know when to free cached
+ * surfaces/rectangles. */
+ guint min_seq_num_used;
+
+ /* sequence number for the composition (same series as rectangles) */
+ guint seq_num;
+};
+
+struct _GstVideoOverlayCompositionClass
+{
+ GstMiniObjectClass parent_class;
+};
+
+struct _GstVideoOverlayRectangle
+{
+ GstMiniObject parent;
+
+ /* Position on video frame and dimension of output rectangle in
+ * output frame terms (already adjusted for the PAR of the output
+ * frame). x/y can be negative (overlay will be clipped then) */
+ gint x, y;
+ guint render_width, render_height;
+
+ /* Dimensions of overlay pixels */
+ guint width, height, stride;
+
+ /* The format of the data in pixels */
+ GstVideoFormat format;
+
+ /* Refcounted blob of memory, no caps or timestamps */
+ GstBuffer *pixels;
+
+ /* FIXME: how to express source like text or pango markup?
+ * (just add source type enum + source buffer with data)
+ *
+ * FOR 0.10: always send pixel blobs, but attach source data in
+ * addition (reason: if downstream changes, we can't renegotiate
+ * that properly, if we just do a query of supported formats from
+ * the start). Sink will just ignore pixels and use pango markup
+ * from source data if it supports that.
+ *
+ * FOR 0.11: overlay should query formats (pango markup, pixels)
+ * supported by downstream and then only send that. We can
+ * renegotiate via the reconfigure event.
+ */
+
+ /* sequence number: useful for backends/renderers/sinks that want
+ * to maintain a cache of rectangles <-> surfaces. The value of
+ * the min_seq_num_used in the composition tells the renderer which
+ * rectangles have expired. */
+ guint seq_num;
+
+ /* FIXME: we may also need a (private) way to cache converted/scaled
+ * pixel blobs */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ GStaticMutex lock;
+#else
+ GMutex lock;
+#endif
+
+ GList *scaled_rectangles;
+};
+
+struct _GstVideoOverlayRectangleClass
+{
+ GstMiniObjectClass parent_class;
+};
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+#define GST_RECTANGLE_LOCK(rect) g_static_mutex_lock(&rect->lock)
+#define GST_RECTANGLE_UNLOCK(rect) g_static_mutex_unlock(&rect->lock)
+#else
+#define GST_RECTANGLE_LOCK(rect) g_mutex_lock(&rect->lock)
+#define GST_RECTANGLE_UNLOCK(rect) g_mutex_unlock(&rect->lock)
+#endif
+
+static void gst_video_overlay_composition_class_init (GstMiniObjectClass * k);
+static void gst_video_overlay_composition_finalize (GstMiniObject * comp);
+static void gst_video_overlay_rectangle_class_init (GstMiniObjectClass * klass);
+static void gst_video_overlay_rectangle_finalize (GstMiniObject * rect);
+
+/* --------------------------- utility functions --------------------------- */
+
+#ifndef GST_DISABLE_GST_DEBUG
+
+#define GST_CAT_DEFAULT ensure_debug_category()
+
+static GstDebugCategory *
+ensure_debug_category (void)
+{
+ static gsize cat_gonce = 0;
+
+ if (g_once_init_enter (&cat_gonce)) {
+ gsize cat_done;
+
+ cat_done = (gsize) _gst_debug_category_new ("video-composition", 0,
+ "video overlay composition");
+
+ g_once_init_leave (&cat_gonce, cat_done);
+ }
+
+ return (GstDebugCategory *) cat_gonce;
+}
+
+#else
+
+#define ensure_debug_category() /* NOOP */
+
+#endif /* GST_DISABLE_GST_DEBUG */
+
+static guint
+gst_video_overlay_get_seqnum (void)
+{
+ static gint seqnum; /* 0 */
+
+#if GLIB_CHECK_VERSION(2,29,5)
+ return (guint) g_atomic_int_add (&seqnum, 1);
+#else
+ return (guint) g_atomic_int_exchange_and_add (&seqnum, 1);
+#endif
+}
+
+#define GST_OVERLAY_COMPOSITION_QUARK gst_overlay_composition_quark_get()
+static GQuark
+gst_overlay_composition_quark_get (void)
+{
+ static gsize quark_gonce = 0;
+
+ if (g_once_init_enter (&quark_gonce)) {
+ gsize quark;
+
+ quark = (gsize) g_quark_from_static_string ("GstVideoOverlayComposition");
+
+ g_once_init_leave (&quark_gonce, quark);
+ }
+
+ return (GQuark) quark_gonce;
+}
+
+#define COMPOSITION_QUARK composition_quark_get()
+static GQuark
+composition_quark_get (void)
+{
+ static gsize quark_gonce = 0;
+
+ if (g_once_init_enter (&quark_gonce)) {
+ gsize quark;
+
+ quark = (gsize) g_quark_from_static_string ("composition");
+
+ g_once_init_leave (&quark_gonce, quark);
+ }
+
+ return (GQuark) quark_gonce;
+}
+
+/**
+ * gst_video_buffer_set_overlay_composition:
+ * @buf: a #GstBuffer
+ * @comp: (allow-none): a #GstVideoOverlayComposition, or NULL to clear a
+ * previously-set composition
+ *
+ * Sets an overlay composition on a buffer. The buffer will obtain its own
+ * reference to the composition, meaning this function does not take ownership
+ * of @comp.
+ *
+ * Since: 0.10.36
+ */
+void
+gst_video_buffer_set_overlay_composition (GstBuffer * buf,
+ GstVideoOverlayComposition * comp)
+{
+ gst_buffer_set_qdata (buf, GST_OVERLAY_COMPOSITION_QUARK,
+ gst_structure_id_new (GST_OVERLAY_COMPOSITION_QUARK,
+ COMPOSITION_QUARK, GST_TYPE_VIDEO_OVERLAY_COMPOSITION, comp, NULL));
+}
+
+/**
+ * gst_video_buffer_get_overlay_composition:
+ * @buf: a #GstBuffer
+ *
+ * Get the overlay composition that has previously been attached to a buffer
+ * with gst_video_buffer_get_overlay_composition(), usually by another element
+ * upstream.
+ *
+ * Returns: (transfer none): the #GstVideoOverlayComposition attached to
+ * this buffer, or NULL. Does not return a reference to the composition,
+ * caller must obtain her own ref via gst_video_overlay_composition_ref()
+ * if needed.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayComposition *
+gst_video_buffer_get_overlay_composition (GstBuffer * buf)
+{
+ const GstStructure *s;
+ const GValue *val;
+
+ s = gst_buffer_get_qdata (buf, GST_OVERLAY_COMPOSITION_QUARK);
+ if (s == NULL)
+ return NULL;
+
+ val = gst_structure_id_get_value (s, COMPOSITION_QUARK);
+ if (val == NULL)
+ return NULL;
+
+ return GST_VIDEO_OVERLAY_COMPOSITION (gst_value_get_mini_object (val));
+}
+
+/* ------------------------------ composition ------------------------------ */
+
+#define RECTANGLE_ARRAY_STEP 4 /* premature optimization */
+
+GType
+gst_video_overlay_composition_get_type (void)
+{
+ static volatile gsize type_id = 0;
+
+ if (g_once_init_enter (&type_id)) {
+ GType new_type_id = g_type_register_static_simple (GST_TYPE_MINI_OBJECT,
+ g_intern_static_string ("GstVideoOverlayComposition"),
+ sizeof (GstVideoOverlayCompositionClass),
+ (GClassInitFunc) gst_video_overlay_composition_class_init,
+ sizeof (GstVideoOverlayComposition),
+ NULL,
+ (GTypeFlags) 0);
+
+ g_once_init_leave (&type_id, new_type_id);
+ }
+
+ return type_id;
+}
+
+static void
+gst_video_overlay_composition_finalize (GstMiniObject * mini_obj)
+{
+ GstVideoOverlayComposition *comp = (GstVideoOverlayComposition *) mini_obj;
+ guint num;
+
+ num = comp->num_rectangles;
+
+ while (num > 0) {
+ gst_video_overlay_rectangle_unref (comp->rectangles[num - 1]);
+ --num;
+ }
+
+ g_free (comp->rectangles);
+ comp->rectangles = NULL;
+ comp->num_rectangles = 0;
+
+ /* not chaining up to GstMiniObject's finalize for now, we know it's empty */
+}
+
+static void
+gst_video_overlay_composition_class_init (GstMiniObjectClass * klass)
+{
+ klass->finalize = gst_video_overlay_composition_finalize;
+ klass->copy = (GstMiniObjectCopyFunction) gst_video_overlay_composition_copy;
+}
+
+/**
+ * gst_video_overlay_composition_new:
+ * @rectangle: (transfer none): a #GstVideoOverlayRectangle to add to the
+ * composition
+ *
+ * Creates a new video overlay composition object to hold one or more
+ * overlay rectangles.
+ *
+ * Returns: (transfer full): a new #GstVideoOverlayComposition. Unref with
+ * gst_video_overlay_composition_unref() when no longer needed.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayComposition *
+gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle)
+{
+ GstVideoOverlayComposition *comp;
+
+
+ /* FIXME: should we allow empty compositions? Could also be expressed as
+ * buffer without a composition on it. Maybe there are cases where doing
+ * an empty new + _add() in a loop is easier? */
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
+
+ comp = (GstVideoOverlayComposition *)
+ gst_mini_object_new (GST_TYPE_VIDEO_OVERLAY_COMPOSITION);
+
+ comp->rectangles = g_new0 (GstVideoOverlayRectangle *, RECTANGLE_ARRAY_STEP);
+ comp->rectangles[0] = gst_video_overlay_rectangle_ref (rectangle);
+ comp->num_rectangles = 1;
+
+ comp->seq_num = gst_video_overlay_get_seqnum ();
+
+ /* since the rectangle was created earlier, its seqnum is smaller than ours */
+ comp->min_seq_num_used = rectangle->seq_num;
+
+ GST_LOG ("new composition %p: seq_num %u with rectangle %p", comp,
+ comp->seq_num, rectangle);
+
+ return comp;
+}
+
+/**
+ * gst_video_overlay_composition_add_rectangle:
+ * @comp: a #GstVideoOverlayComposition
+ * @rectangle: (transfer none): a #GstVideoOverlayRectangle to add to the
+ * composition
+ *
+ * Adds an overlay rectangle to an existing overlay composition object. This
+ * must be done right after creating the overlay composition.
+ *
+ * Since: 0.10.36
+ */
+void
+gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition * comp,
+ GstVideoOverlayRectangle * rectangle)
+{
+ g_return_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp));
+ g_return_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle));
+ g_return_if_fail (GST_MINI_OBJECT_REFCOUNT_VALUE (comp) == 1);
+
+ if (comp->num_rectangles % RECTANGLE_ARRAY_STEP == 0) {
+ comp->rectangles =
+ g_renew (GstVideoOverlayRectangle *, comp->rectangles,
+ comp->num_rectangles + RECTANGLE_ARRAY_STEP);
+ }
+
+ comp->rectangles[comp->num_rectangles] =
+ gst_video_overlay_rectangle_ref (rectangle);
+ comp->num_rectangles += 1;
+
+ comp->min_seq_num_used = MIN (comp->min_seq_num_used, rectangle->seq_num);
+
+ GST_LOG ("composition %p: added rectangle %p", comp, rectangle);
+}
+
+/**
+ * gst_video_overlay_composition_n_rectangles:
+ * @comp: a #GstVideoOverlayComposition
+ *
+ * Returns the number of #GstVideoOverlayRectangle<!-- -->s contained in @comp.
+ *
+ * Returns: the number of rectangles
+ *
+ * Since: 0.10.36
+ */
+guint
+gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition * comp)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), 0);
+
+ return comp->num_rectangles;
+}
+
+/**
+ * gst_video_overlay_composition_get_rectangle:
+ * @comp: a #GstVideoOverlayComposition
+ * @n: number of the rectangle to get
+ *
+ * Returns the @n-th #GstVideoOverlayRectangle contained in @comp.
+ *
+ * Returns: (transfer none): the @n-th rectangle, or NULL if @n is out of
+ * bounds. Will not return a new reference, the caller will need to
+ * obtain her own reference using gst_video_overlay_rectangle_ref()
+ * if needed.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayRectangle *
+gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp,
+ guint n)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), NULL);
+
+ if (n >= comp->num_rectangles)
+ return NULL;
+
+ return comp->rectangles[n];
+}
+
+static gboolean
+gst_video_overlay_rectangle_needs_scaling (GstVideoOverlayRectangle * r)
+{
+ return (r->width != r->render_width || r->height != r->render_height);
+}
+
+/**
+ * gst_video_overlay_composition_blend:
+ * @comp: a #GstVideoOverlayComposition
+ * @video_buf: a #GstBuffer containing raw video data in a supported format
+ *
+ * Blends the overlay rectangles in @comp on top of the raw video data
+ * contained in @video_buf. The data in @video_buf must be writable. If
+ * needed, use gst_buffer_make_writable() before calling this function to
+ * ensure a buffer is writable. @video_buf must also have valid raw video
+ * caps set on it.
+ *
+ * Since: 0.10.36
+ */
+gboolean
+gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
+ GstBuffer * video_buf)
+{
+ GstBlendVideoFormatInfo video_info, rectangle_info;
+ GstVideoFormat fmt;
+ gboolean ret = TRUE;
+ guint n, num;
+ int w, h;
+
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), FALSE);
+ g_return_val_if_fail (GST_IS_BUFFER (video_buf), FALSE);
+ g_return_val_if_fail (gst_buffer_is_writable (video_buf), FALSE);
+ g_return_val_if_fail (GST_BUFFER_CAPS (video_buf) != NULL, FALSE);
+
+ if (!gst_video_format_parse_caps (GST_BUFFER_CAPS (video_buf), &fmt, &w, &h)) {
+ gchar *str = gst_caps_to_string (GST_BUFFER_CAPS (video_buf));
+ g_warning ("%s: could not parse video buffer caps '%s'", GST_FUNCTION, str);
+ g_free (str);
+ return FALSE;
+ }
+
+ video_blend_format_info_init (&video_info, GST_BUFFER_DATA (video_buf),
+ h, w, fmt);
+
+ num = comp->num_rectangles;
+ GST_LOG ("Blending composition %p with %u rectangles onto video buffer %p "
+ "(%ux%u, format %u)", comp, num, video_buf, w, h, fmt);
+
+ for (n = 0; n < num; ++n) {
+ GstVideoOverlayRectangle *rect;
+ gboolean needs_scaling;
+
+ rect = comp->rectangles[n];
+
+ GST_LOG (" rectangle %u %p: %ux%u, format %u", n, rect, rect->height,
+ rect->width, rect->format);
+
+ video_blend_format_info_init (&rectangle_info,
+ GST_BUFFER_DATA (rect->pixels), rect->height, rect->width,
+ rect->format);
+
+ needs_scaling = gst_video_overlay_rectangle_needs_scaling (rect);
+ if (needs_scaling) {
+ video_blend_scale_linear_RGBA (&rectangle_info, rect->render_height,
+ rect->render_width);
+ }
+
+ ret = video_blend (&video_info, &rectangle_info, rect->x, rect->y);
+ if (!ret) {
+ GST_WARNING ("Could not blend overlay rectangle onto video buffer");
+ }
+
+ /* FIXME: should cache scaled pixels in the rectangle struct */
+ if (needs_scaling)
+ g_free (rectangle_info.pixels);
+ }
+
+ return ret;
+}
+
+/**
+ * gst_video_overlay_composition_copy:
+ * @comp: (transfer none): a #GstVideoOverlayComposition to copy
+ *
+ * Makes a copy of @comp and all contained rectangles, so that it is possible
+ * to modify the composition and contained rectangles (e.g. add additional
+ * rectangles or change the render co-ordinates or render dimension). The
+ * actual overlay pixel data buffers contained in the rectangles are not
+ * copied.
+ *
+ * Returns: (transfer full): a new #GstVideoOverlayComposition equivalent
+ * to @comp.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayComposition *
+gst_video_overlay_composition_copy (GstVideoOverlayComposition * comp)
+{
+ GstVideoOverlayComposition *copy;
+ GstVideoOverlayRectangle *rect;
+ guint n;
+
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), NULL);
+
+ if (G_LIKELY (comp->num_rectangles == 0))
+ return gst_video_overlay_composition_new (NULL);
+
+ rect = gst_video_overlay_rectangle_copy (comp->rectangles[0]);
+ copy = gst_video_overlay_composition_new (rect);
+ gst_video_overlay_rectangle_unref (rect);
+
+ for (n = 1; n < comp->num_rectangles; ++n) {
+ rect = gst_video_overlay_rectangle_copy (comp->rectangles[n]);
+ gst_video_overlay_composition_add_rectangle (copy, rect);
+ gst_video_overlay_rectangle_unref (rect);
+ }
+
+ return copy;
+}
+
+/**
+ * gst_video_overlay_composition_make_writable:
+ * @comp: (transfer full): a #GstVideoOverlayComposition to copy
+ *
+ * Takes ownership of @comp and returns a version of @comp that is writable
+ * (i.e. can be modified). Will either return @comp right away, or create a
+ * new writable copy of @comp and unref @comp itself. All the contained
+ * rectangles will also be copied, but the actual overlay pixel data buffers
+ * contained in the rectangles are not copied.
+ *
+ * Returns: (transfer full): a writable #GstVideoOverlayComposition
+ * equivalent to @comp.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayComposition *
+gst_video_overlay_composition_make_writable (GstVideoOverlayComposition * comp)
+{
+ GstVideoOverlayComposition *writable_comp;
+
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), NULL);
+
+ if (GST_MINI_OBJECT_REFCOUNT_VALUE (comp) == 1) {
+ guint n;
+
+ for (n = 0; n < comp->num_rectangles; ++n) {
+ if (GST_MINI_OBJECT_REFCOUNT_VALUE (comp->rectangles[n]) != 1)
+ goto copy;
+ }
+ return comp;
+ }
+
+copy:
+
+ writable_comp = gst_video_overlay_composition_copy (comp);
+ gst_video_overlay_composition_unref (comp);
+
+ return writable_comp;
+}
+
+/**
+ * gst_video_overlay_composition_get_seqnum:
+ * @comp: a #GstVideoOverlayComposition
+ *
+ * Returns the sequence number of this composition. Sequence numbers are
+ * monotonically increasing and unique for overlay compositions and rectangles
+ * (meaning there will never be a rectangle with the same sequence number as
+ * a composition).
+ *
+ * Returns: the sequence number of @comp
+ *
+ * Since: 0.10.36
+ */
+guint
+gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_COMPOSITION (comp), 0);
+
+ return comp->seq_num;
+}
+
+/* ------------------------------ rectangles ------------------------------ -*/
+
+static void gst_video_overlay_rectangle_instance_init (GstMiniObject * miniobj);
+
+GType
+gst_video_overlay_rectangle_get_type (void)
+{
+ static volatile gsize type_id = 0;
+
+ if (g_once_init_enter (&type_id)) {
+ GType new_type_id = g_type_register_static_simple (GST_TYPE_MINI_OBJECT,
+ g_intern_static_string ("GstVideoOverlayRectangle"),
+ sizeof (GstVideoOverlayRectangleClass),
+ (GClassInitFunc) gst_video_overlay_rectangle_class_init,
+ sizeof (GstVideoOverlayRectangle),
+ (GInstanceInitFunc) gst_video_overlay_rectangle_instance_init,
+ (GTypeFlags) 0);
+
+ g_once_init_leave (&type_id, new_type_id);
+ }
+
+ return type_id;
+}
+
+static void
+gst_video_overlay_rectangle_finalize (GstMiniObject * mini_obj)
+{
+ GstVideoOverlayRectangle *rect = (GstVideoOverlayRectangle *) mini_obj;
+
+ gst_buffer_replace (&rect->pixels, NULL);
+
+ while (rect->scaled_rectangles != NULL) {
+ GstVideoOverlayRectangle *scaled_rect = rect->scaled_rectangles->data;
+
+ gst_video_overlay_rectangle_unref (scaled_rect);
+
+ rect->scaled_rectangles =
+ g_list_delete_link (rect->scaled_rectangles, rect->scaled_rectangles);
+ }
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ g_static_mutex_free (&rect->lock);
+#else
+ g_mutex_clear (&rect->lock);
+#endif
+ /* not chaining up to GstMiniObject's finalize for now, we know it's empty */
+}
+
+static void
+gst_video_overlay_rectangle_class_init (GstMiniObjectClass * klass)
+{
+ klass->finalize = gst_video_overlay_rectangle_finalize;
+ klass->copy = (GstMiniObjectCopyFunction) gst_video_overlay_rectangle_copy;
+}
+
+static void
+gst_video_overlay_rectangle_instance_init (GstMiniObject * mini_obj)
+{
+ GstVideoOverlayRectangle *rect = (GstVideoOverlayRectangle *) mini_obj;
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+ g_static_mutex_init (&rect->lock);
+#else
+ g_mutex_init (&rect->lock);
+#endif
+}
+
+/**
+ * gst_video_overlay_rectangle_new_argb:
+ * @pixels: (transfer none): a #GstBuffer pointing to the pixel memory
+ * @width: the width of the rectangle in @pixels
+ * @height: the height of the rectangle in @pixels
+ * @stride: the stride of the rectangle in @pixels in bytes (&gt;= 4*width)
+ * @x: the X co-ordinate on the video where the top-left corner of this
+ * overlay rectangle should be rendered to
+ * @y: the Y co-ordinate on the video where the top-left corner of this
+ * overlay rectangle should be rendered to
+ * @render_width: the render width of this rectangle on the video
+ * @render_height: the render height of this rectangle on the video
+ * @flags: flags (currently unused)
+ *
+ * Creates a new video overlay rectangle with ARGB pixel data. The layout
+ * of the components in memory is B-G-R-A on little-endian platforms
+ * (corresponding to #GST_VIDEO_FORMAT_BGRA) and A-R-G-B on big-endian
+ * platforms (corresponding to #GST_VIDEO_FORMAT_ARGB). In other words,
+ * pixels are treated as 32-bit words and the lowest 8 bits then contain
+ * the blue component value and the highest 8 bits contain the alpha
+ * component value. The RGB values are non-premultiplied. This is the
+ * format that is used by most hardware, and also many rendering libraries
+ * such as Cairo, for example.
+ *
+ * Returns: (transfer full): a new #GstVideoOverlayRectangle. Unref with
+ * gst_video_overlay_rectangle_unref() when no longer needed.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayRectangle *
+gst_video_overlay_rectangle_new_argb (GstBuffer * pixels,
+ guint width, guint height, guint stride, gint render_x, gint render_y,
+ guint render_width, guint render_height, GstVideoOverlayFormatFlags flags)
+{
+ GstVideoOverlayRectangle *rect;
+
+ g_return_val_if_fail (GST_IS_BUFFER (pixels), NULL);
+ /* technically ((height-1)*stride)+width might be okay too */
+ g_return_val_if_fail (GST_BUFFER_SIZE (pixels) >= height * stride, NULL);
+ g_return_val_if_fail (stride >= (4 * width), NULL);
+ g_return_val_if_fail (height > 0 && width > 0, NULL);
+ g_return_val_if_fail (render_height > 0 && render_width > 0, NULL);
+ g_return_val_if_fail (flags == 0, NULL);
+
+ rect = (GstVideoOverlayRectangle *)
+ gst_mini_object_new (GST_TYPE_VIDEO_OVERLAY_RECTANGLE);
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ rect->format = GST_VIDEO_FORMAT_BGRA;
+#else
+ rect->format = GST_VIDEO_FORMAT_ARGB;
+#endif
+ rect->pixels = gst_buffer_ref (pixels);
+
+ rect->width = width;
+ rect->height = height;
+ rect->stride = stride;
+
+ rect->x = render_x;
+ rect->y = render_y;
+ rect->render_width = render_width;
+ rect->render_height = render_height;
+
+ rect->seq_num = gst_video_overlay_get_seqnum ();
+
+ GST_LOG ("new rectangle %p: %ux%u => %ux%u @ %u,%u, seq_num %u, format %u, "
+ "pixels %p", rect, width, height, render_width, render_height, render_x,
+ render_y, rect->seq_num, rect->format, pixels);
+
+ return rect;
+}
+
+/**
+ * gst_video_overlay_rectangle_get_render_rectangle:
+ * @rectangle: a #GstVideoOverlayRectangle
+ * @render_x: (out) (allow-none): address where to store the X render offset
+ * @render_y: (out) (allow-none): address where to store the Y render offset
+ * @render_width: (out) (allow-none): address where to store the render width
+ * @render_height: (out) (allow-none): address where to store the render height
+ *
+ * Retrieves the render position and render dimension of the overlay
+ * rectangle on the video.
+ *
+ * Returns: TRUE if valid render dimensions were retrieved.
+ *
+ * Since: 0.10.36
+ */
+gboolean
+gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle *
+ rectangle, gint * render_x, gint * render_y, guint * render_width,
+ guint * render_height)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), FALSE);
+
+ if (render_x)
+ *render_x = rectangle->x;
+ if (render_y)
+ *render_y = rectangle->y;
+ if (render_width)
+ *render_width = rectangle->render_width;
+ if (render_height)
+ *render_height = rectangle->render_height;
+
+ return TRUE;
+}
+
+/**
+ * gst_video_overlay_rectangle_set_render_rectangle:
+ * @rectangle: a #GstVideoOverlayRectangle
+ * @render_x: render X position of rectangle on video
+ * @render_y: render Y position of rectangle on video
+ * @render_width: render width of rectangle
+ * @render_height: render height of rectangle
+ *
+ * Sets the render position and dimensions of the rectangle on the video.
+ * This function is mainly for elements that modify the size of the video
+ * in some way (e.g. through scaling or cropping) and need to adjust the
+ * details of any overlays to match the operation that changed the size.
+ *
+ * @rectangle must be writable, meaning its refcount must be 1. You can
+ * make the rectangles inside a #GstVideoOverlayComposition writable using
+ * gst_video_overlay_composition_make_writable() or
+ * gst_video_overlay_composition_copy().
+ *
+ * Since: 0.10.36
+ */
+void
+gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle *
+ rectangle, gint render_x, gint render_y, guint render_width,
+ guint render_height)
+{
+ g_return_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle));
+ g_return_if_fail (GST_MINI_OBJECT_REFCOUNT_VALUE (rectangle) == 1);
+
+ rectangle->x = render_x;
+ rectangle->y = render_y;
+ rectangle->render_width = render_width;
+ rectangle->render_height = render_height;
+}
+
+/**
+ * gst_video_overlay_rectangle_get_pixels_argb:
+ * @rectangle: a #GstVideoOverlayRectangle
+ * @stride: (out) (allow-none): address of guint variable where to store the
+ * row stride of the ARGB pixel data in the buffer
+ * @flags: flags (unused)
+ *
+ * Returns: (transfer none): a #GstBuffer holding the ARGB pixel data with
+ * row stride @stride and width and height of the render dimensions as per
+ * gst_video_overlay_rectangle_get_render_rectangle(). This function does
+ * not return a reference, the caller should obtain a reference of her own
+ * with gst_buffer_ref() if needed.
+ *
+ * Since: 0.10.36
+ */
+GstBuffer *
+gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle *
+ rectangle, guint * stride, GstVideoOverlayFormatFlags flags)
+{
+ GstVideoOverlayRectangle *scaled_rect = NULL;
+ GstBlendVideoFormatInfo info;
+ GstBuffer *buf;
+ GList *l;
+
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
+ g_return_val_if_fail (flags == 0, NULL);
+ g_return_val_if_fail (stride != NULL, NULL);
+
+ /* This assumes we don't need to adjust the format */
+ if (rectangle->render_width == rectangle->width &&
+ rectangle->render_height == rectangle->height) {
+ *stride = rectangle->stride;
+ return rectangle->pixels;
+ }
+
+ /* see if we've got one cached already */
+ GST_RECTANGLE_LOCK (rectangle);
+ for (l = rectangle->scaled_rectangles; l != NULL; l = l->next) {
+ GstVideoOverlayRectangle *r = l->data;
+
+ if (r->width == rectangle->render_width &&
+ r->height == rectangle->render_height) {
+ /* we'll keep these rectangles around until finalize, so it's ok not
+ * to take our own ref here */
+ scaled_rect = r;
+ break;
+ }
+ }
+ GST_RECTANGLE_UNLOCK (rectangle);
+
+ if (scaled_rect != NULL)
+ goto done;
+
+ /* not cached yet, do the scaling and put the result into our cache */
+ video_blend_format_info_init (&info, GST_BUFFER_DATA (rectangle->pixels),
+ rectangle->height, rectangle->width, rectangle->format);
+
+ video_blend_scale_linear_RGBA (&info, rectangle->render_height,
+ rectangle->render_width);
+
+ buf = gst_buffer_new ();
+ GST_BUFFER_DATA (buf) = info.pixels;
+ GST_BUFFER_MALLOCDATA (buf) = info.pixels;
+ GST_BUFFER_SIZE (buf) = info.size;
+
+ scaled_rect = gst_video_overlay_rectangle_new_argb (buf,
+ rectangle->render_width, rectangle->render_height, info.stride[0],
+ 0, 0, rectangle->render_width, rectangle->render_height, 0);
+
+ gst_buffer_unref (buf);
+
+ GST_RECTANGLE_LOCK (rectangle);
+ rectangle->scaled_rectangles =
+ g_list_prepend (rectangle->scaled_rectangles, scaled_rect);
+ GST_RECTANGLE_UNLOCK (rectangle);
+
+done:
+
+ *stride = scaled_rect->stride;
+ return scaled_rect->pixels;
+}
+
+/**
+ * gst_video_overlay_rectangle_get_pixels_unscaled_argb:
+ * @rectangle: a #GstVideoOverlayRectangle
+ * @width: (out): address where to store the width of the unscaled
+ * rectangle in pixels
+ * @width: (out): address where to store the height of the unscaled
+ * rectangle in pixels
+ * @stride: (out): address of guint variable where to store the row
+ * stride of the ARGB pixel data in the buffer
+ * @flags: flags for future use (unused)
+ *
+ * Retrieves the pixel data as it is. This is useful if the caller can
+ * do the scaling itself when handling the overlaying. The rectangle will
+ * need to be scaled to the render dimensions, which can be retrieved using
+ * gst_video_overlay_rectangle_get_render_rectangle().
+ *
+ * Returns: (transfer none): a #GstBuffer holding the ARGB pixel data with
+ * row stride @stride. This function does not return a reference, the caller
+ * should obtain a reference of her own with gst_buffer_ref() if needed.
+ *
+ * Since: 0.10.36
+ */
+GstBuffer *
+gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle *
+ rectangle, guint * width, guint * height, guint * stride,
+ GstVideoOverlayFormatFlags flags)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
+ g_return_val_if_fail (width != NULL, NULL);
+ g_return_val_if_fail (height != NULL, NULL);
+ g_return_val_if_fail (stride != NULL, NULL);
+ g_return_val_if_fail (flags == 0, NULL);
+
+ *width = rectangle->width;
+ *height = rectangle->height;
+ *stride = rectangle->stride;
+
+ return rectangle->pixels;
+}
+
+/**
+ * gst_video_overlay_rectangle_copy:
+ * @rectangle: (transfer none): a #GstVideoOverlayRectangle to copy
+ *
+ * Makes a copy of @rectangle, so that it is possible to modify it
+ * (e.g. to change the render co-ordinates or render dimension). The
+ * actual overlay pixel data buffers contained in the rectangle are not
+ * copied.
+ *
+ * Returns: (transfer full): a new #GstVideoOverlayRectangle equivalent
+ * to @rectangle.
+ *
+ * Since: 0.10.36
+ */
+GstVideoOverlayRectangle *
+gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle)
+{
+ GstVideoOverlayRectangle *copy;
+
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
+
+ copy = gst_video_overlay_rectangle_new_argb (rectangle->pixels,
+ rectangle->width, rectangle->height, rectangle->stride,
+ rectangle->x, rectangle->y,
+ rectangle->render_width, rectangle->render_height, 0);
+
+ return copy;
+}
+
+/**
+ * gst_video_overlay_rectangle_get_seqnum:
+ * @rectangle: a #GstVideoOverlayRectangle
+ *
+ * Returns the sequence number of this rectangle. Sequence numbers are
+ * monotonically increasing and unique for overlay compositions and rectangles
+ * (meaning there will never be a rectangle with the same sequence number as
+ * a composition).
+ *
+ * Returns: the sequence number of @rectangle
+ *
+ * Since: 0.10.36
+ */
+guint
+gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle)
+{
+ g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), 0);
+
+ return rectangle->seq_num;
+}
diff --git a/gst-libs/gst/video/video-overlay-composition.h b/gst-libs/gst/video/video-overlay-composition.h
new file mode 100644
index 000000000..5ff7ce36c
--- /dev/null
+++ b/gst-libs/gst/video/video-overlay-composition.h
@@ -0,0 +1,235 @@
+/* GStreamer Video Overlay Composition
+ * Copyright (C) 2011 Intel Corporation
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VIDEO_OVERLAY_COMPOSITION_H__
+#define __GST_VIDEO_OVERLAY_COMPOSITION_H__
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVideoOverlayRectangle:
+ *
+ * An opaque video overlay rectangle object. A rectangle contains a single
+ * overlay rectangle which can be added to a composition.
+ *
+ * Since: 0.10.36
+ */
+#define GST_TYPE_VIDEO_OVERLAY_RECTANGLE \
+ (gst_video_overlay_rectangle_get_type ())
+#define GST_VIDEO_OVERLAY_RECTANGLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_OVERLAY_RECTANGLE, GstVideoOverlayRectangle))
+#define GST_IS_VIDEO_OVERLAY_RECTANGLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_OVERLAY_RECTANGLE))
+
+typedef struct _GstVideoOverlayRectangle GstVideoOverlayRectangle;
+typedef struct _GstVideoOverlayRectangleClass GstVideoOverlayRectangleClass;
+
+/**
+ * gst_video_overlay_rectangle_ref:
+ * @comp: a a #GstVideoOverlayRectangle.
+ *
+ * Increases the refcount of the given rectangle by one.
+ *
+ * Note that the refcount affects the writeability
+ * of @comp, use gst_video_overlay_rectangle_copy() to ensure a rectangle can
+ * be modified (there is no gst_video_overlay_rectangle_make_writable() because
+ * it is unlikely that someone will hold the single reference to the rectangle
+ * and not know that that's the case).
+ *
+ * Returns: (transfer full): @comp
+ *
+ * Since: 0.10.36
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC GstVideoOverlayRectangle *
+gst_video_overlay_rectangle_ref (GstVideoOverlayRectangle * comp);
+#endif
+
+static inline GstVideoOverlayRectangle *
+gst_video_overlay_rectangle_ref (GstVideoOverlayRectangle * comp)
+{
+ return (GstVideoOverlayRectangle *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * gst_video_overlay_rectangle_unref:
+ * @comp: (transfer full): a #GstVideoOverlayRectangle.
+ *
+ * Decreases the refcount of the rectangle. If the refcount reaches 0, the
+ * rectangle will be freed.
+ *
+ * Since: 0.10.36
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC void
+gst_video_overlay_rectangle_unref (GstVideoOverlayRectangle * comp);
+#endif
+
+static inline void
+gst_video_overlay_rectangle_unref (GstVideoOverlayRectangle * comp)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * GstVideoOverlayFormatFlags:
+ * @GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE: no flags
+ *
+ * Overlay format flags.
+ *
+ * Since: 0.10.36
+ */
+typedef enum {
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE = 0
+} GstVideoOverlayFormatFlags;
+
+GType gst_video_overlay_rectangle_get_type (void);
+
+GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer * pixels,
+ guint width, guint height, guint stride,
+ gint render_x, gint render_y,
+ guint render_width, guint render_height,
+ GstVideoOverlayFormatFlags flags);
+
+GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle);
+
+guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle);
+
+void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle,
+ gint render_x,
+ gint render_y,
+ guint render_width,
+ guint render_height);
+
+gboolean gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle * rectangle,
+ gint * render_x,
+ gint * render_y,
+ guint * render_width,
+ guint * render_height);
+
+GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * rectangle,
+ guint * stride,
+ GstVideoOverlayFormatFlags flags);
+
+GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle * rectangle,
+ guint * width,
+ guint * height,
+ guint * stride,
+ GstVideoOverlayFormatFlags flags);
+
+/**
+ * GstVideoOverlayComposition:
+ *
+ * An opaque video overlay composition object. A composition contains
+ * multiple overlay rectangles.
+ *
+ * Since: 0.10.36
+ */
+#define GST_TYPE_VIDEO_OVERLAY_COMPOSITION \
+ (gst_video_overlay_composition_get_type ())
+#define GST_VIDEO_OVERLAY_COMPOSITION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_OVERLAY_COMPOSITION, GstVideoOverlayComposition))
+#define GST_IS_VIDEO_OVERLAY_COMPOSITION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_OVERLAY_COMPOSITION))
+
+typedef struct _GstVideoOverlayComposition GstVideoOverlayComposition;
+typedef struct _GstVideoOverlayCompositionClass GstVideoOverlayCompositionClass;
+
+/**
+ * gst_video_overlay_composition_ref:
+ * @comp: a a #GstVideoOverlayComposition.
+ *
+ * Increases the refcount of the given composition by one.
+ *
+ * Note that the refcount affects the writeability
+ * of @comp, use gst_video_overlay_composition_make_writable() to ensure
+ * a composition and its rectangles can be modified.
+ *
+ * Returns: (transfer full): @comp
+ *
+ * Since: 0.10.36
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC GstVideoOverlayComposition *
+gst_video_overlay_composition_ref (GstVideoOverlayComposition * comp);
+#endif
+
+static inline GstVideoOverlayComposition *
+gst_video_overlay_composition_ref (GstVideoOverlayComposition * comp)
+{
+ return (GstVideoOverlayComposition *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
+}
+
+/**
+ * gst_video_overlay_composition_unref:
+ * @comp: (transfer full): a #GstVideoOverlayComposition.
+ *
+ * Decreases the refcount of the composition. If the refcount reaches 0, the
+ * composition will be freed.
+ *
+ * Since: 0.10.36
+ */
+#ifdef _FOOL_GTK_DOC_
+G_INLINE_FUNC void
+gst_video_overlay_composition_unref (GstVideoOverlayComposition * comp);
+#endif
+
+static inline void
+gst_video_overlay_composition_unref (GstVideoOverlayComposition * comp)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
+}
+
+GType gst_video_overlay_composition_get_type (void);
+
+GstVideoOverlayComposition * gst_video_overlay_composition_copy (GstVideoOverlayComposition * comp);
+
+GstVideoOverlayComposition * gst_video_overlay_composition_make_writable (GstVideoOverlayComposition * comp);
+
+GstVideoOverlayComposition * gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle);
+
+void gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition * comp,
+ GstVideoOverlayRectangle * rectangle);
+
+guint gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition * comp);
+
+GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp, guint n);
+
+guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp);
+
+/* blend composition onto raw video buffer */
+
+gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
+ GstBuffer * video_buf);
+
+/* attach/retrieve composition from buffers */
+
+void gst_video_buffer_set_overlay_composition (GstBuffer * buf,
+ GstVideoOverlayComposition * comp);
+
+GstVideoOverlayComposition * gst_video_buffer_get_overlay_composition (GstBuffer * buf);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEO_OVERLAY_COMPOSITION_H__ */
diff --git a/gst-libs/gst/video/videoblendorc-dist.c b/gst-libs/gst/video/videoblendorc-dist.c
new file mode 100644
index 000000000..01b73f11b
--- /dev/null
+++ b/gst-libs/gst/video/videoblendorc-dist.c
@@ -0,0 +1,6118 @@
+
+/* autogenerated from videoblendorc.orc */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <glib.h>
+
+#ifndef _ORC_INTEGER_TYPEDEFS_
+#define _ORC_INTEGER_TYPEDEFS_
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+typedef int8_t orc_int8;
+typedef int16_t orc_int16;
+typedef int32_t orc_int32;
+typedef int64_t orc_int64;
+typedef uint8_t orc_uint8;
+typedef uint16_t orc_uint16;
+typedef uint32_t orc_uint32;
+typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
+#elif defined(_MSC_VER)
+typedef signed __int8 orc_int8;
+typedef signed __int16 orc_int16;
+typedef signed __int32 orc_int32;
+typedef signed __int64 orc_int64;
+typedef unsigned __int8 orc_uint8;
+typedef unsigned __int16 orc_uint16;
+typedef unsigned __int32 orc_uint32;
+typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
+#define inline __inline
+#else
+#include <limits.h>
+typedef signed char orc_int8;
+typedef short orc_int16;
+typedef int orc_int32;
+typedef unsigned char orc_uint8;
+typedef unsigned short orc_uint16;
+typedef unsigned int orc_uint32;
+#if INT_MAX == LONG_MAX
+typedef long long orc_int64;
+typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
+#else
+typedef long orc_int64;
+typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
+#endif
+#endif
+typedef union
+{
+ orc_int16 i;
+ orc_int8 x2[2];
+} orc_union16;
+typedef union
+{
+ orc_int32 i;
+ float f;
+ orc_int16 x2[2];
+ orc_int8 x4[4];
+} orc_union32;
+typedef union
+{
+ orc_int64 i;
+ double f;
+ orc_int32 x2[2];
+ float x2f[2];
+ orc_int16 x4[4];
+} orc_union64;
+#endif
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+
+#ifndef DISABLE_ORC
+#include <orc/orc.h>
+#endif
+void orc_blend_little (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n);
+void orc_blend_big (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n);
+void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+ const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+ const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+ const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+ const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
+ const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+ const guint8 * ORC_RESTRICT s1, int n);
+void orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
+void orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1,
+ const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
+ int p1, int n);
+
+
+/* begin Orc C target preamble */
+#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
+#define ORC_ABS(a) ((a)<0 ? -(a) : (a))
+#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))
+#define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))
+#define ORC_SB_MAX 127
+#define ORC_SB_MIN (-1-ORC_SB_MAX)
+#define ORC_UB_MAX 255
+#define ORC_UB_MIN 0
+#define ORC_SW_MAX 32767
+#define ORC_SW_MIN (-1-ORC_SW_MAX)
+#define ORC_UW_MAX 65535
+#define ORC_UW_MIN 0
+#define ORC_SL_MAX 2147483647
+#define ORC_SL_MIN (-1-ORC_SL_MAX)
+#define ORC_UL_MAX 4294967295U
+#define ORC_UL_MIN 0
+#define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)
+#define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)
+#define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)
+#define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)
+#define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)
+#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
+#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
+#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24))
+#define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))
+#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
+#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
+#define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
+#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff)))
+#define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0))
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+/* end Orc C target preamble */
+
+
+
+/* orc_blend_little */
+#ifdef DISABLE_ORC
+void
+orc_blend_little (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_int8 var42;
+ orc_union32 var43;
+ orc_union64 var44;
+ orc_union64 var45;
+ orc_union64 var46;
+ orc_union32 var47;
+ orc_union64 var48;
+ orc_union64 var49;
+ orc_union64 var50;
+ orc_union64 var51;
+ orc_union64 var52;
+ orc_union32 var53;
+ orc_union32 var54;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+ /* 14: loadpl */
+ var39.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: convlw */
+ var41.i = var40.i;
+ /* 2: convwb */
+ var42 = var41.i;
+ /* 3: splatbl */
+ var43.i =
+ ((var42 & 0xff) << 24) | ((var42 & 0xff) << 16) | ((var42 & 0xff) << 8)
+ | (var42 & 0xff);
+ /* 4: convubw */
+ var44.x4[0] = (orc_uint8) var43.x4[0];
+ var44.x4[1] = (orc_uint8) var43.x4[1];
+ var44.x4[2] = (orc_uint8) var43.x4[2];
+ var44.x4[3] = (orc_uint8) var43.x4[3];
+ /* 5: shruw */
+ var45.x4[0] = ((orc_uint16) var44.x4[0]) >> 8;
+ var45.x4[1] = ((orc_uint16) var44.x4[1]) >> 8;
+ var45.x4[2] = ((orc_uint16) var44.x4[2]) >> 8;
+ var45.x4[3] = ((orc_uint16) var44.x4[3]) >> 8;
+ /* 6: convubw */
+ var46.x4[0] = (orc_uint8) var40.x4[0];
+ var46.x4[1] = (orc_uint8) var40.x4[1];
+ var46.x4[2] = (orc_uint8) var40.x4[2];
+ var46.x4[3] = (orc_uint8) var40.x4[3];
+ /* 7: loadl */
+ var47 = ptr0[i];
+ /* 8: convubw */
+ var48.x4[0] = (orc_uint8) var47.x4[0];
+ var48.x4[1] = (orc_uint8) var47.x4[1];
+ var48.x4[2] = (orc_uint8) var47.x4[2];
+ var48.x4[3] = (orc_uint8) var47.x4[3];
+ /* 9: subw */
+ var49.x4[0] = var46.x4[0] - var48.x4[0];
+ var49.x4[1] = var46.x4[1] - var48.x4[1];
+ var49.x4[2] = var46.x4[2] - var48.x4[2];
+ var49.x4[3] = var46.x4[3] - var48.x4[3];
+ /* 10: mullw */
+ var50.x4[0] = (var49.x4[0] * var45.x4[0]) & 0xffff;
+ var50.x4[1] = (var49.x4[1] * var45.x4[1]) & 0xffff;
+ var50.x4[2] = (var49.x4[2] * var45.x4[2]) & 0xffff;
+ var50.x4[3] = (var49.x4[3] * var45.x4[3]) & 0xffff;
+ /* 11: div255w */
+ var51.x4[0] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[0] + 128)) +
+ (((orc_uint16) (var50.x4[0] + 128)) >> 8))) >> 8;
+ var51.x4[1] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[1] + 128)) +
+ (((orc_uint16) (var50.x4[1] + 128)) >> 8))) >> 8;
+ var51.x4[2] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[2] + 128)) +
+ (((orc_uint16) (var50.x4[2] + 128)) >> 8))) >> 8;
+ var51.x4[3] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[3] + 128)) +
+ (((orc_uint16) (var50.x4[3] + 128)) >> 8))) >> 8;
+ /* 12: addw */
+ var52.x4[0] = var48.x4[0] + var51.x4[0];
+ var52.x4[1] = var48.x4[1] + var51.x4[1];
+ var52.x4[2] = var48.x4[2] + var51.x4[2];
+ var52.x4[3] = var48.x4[3] + var51.x4[3];
+ /* 13: convwb */
+ var53.x4[0] = var52.x4[0];
+ var53.x4[1] = var52.x4[1];
+ var53.x4[2] = var52.x4[2];
+ var53.x4[3] = var52.x4[3];
+ /* 15: orl */
+ var54.i = var53.i | var39.i;
+ /* 16: storel */
+ ptr0[i] = var54;
+ }
+
+}
+
+#else
+static void
+_backup_orc_blend_little (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_int8 var42;
+ orc_union32 var43;
+ orc_union64 var44;
+ orc_union64 var45;
+ orc_union64 var46;
+ orc_union32 var47;
+ orc_union64 var48;
+ orc_union64 var49;
+ orc_union64 var50;
+ orc_union64 var51;
+ orc_union64 var52;
+ orc_union32 var53;
+ orc_union32 var54;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+ /* 14: loadpl */
+ var39.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: convlw */
+ var41.i = var40.i;
+ /* 2: convwb */
+ var42 = var41.i;
+ /* 3: splatbl */
+ var43.i =
+ ((var42 & 0xff) << 24) | ((var42 & 0xff) << 16) | ((var42 & 0xff) << 8)
+ | (var42 & 0xff);
+ /* 4: convubw */
+ var44.x4[0] = (orc_uint8) var43.x4[0];
+ var44.x4[1] = (orc_uint8) var43.x4[1];
+ var44.x4[2] = (orc_uint8) var43.x4[2];
+ var44.x4[3] = (orc_uint8) var43.x4[3];
+ /* 5: shruw */
+ var45.x4[0] = ((orc_uint16) var44.x4[0]) >> 8;
+ var45.x4[1] = ((orc_uint16) var44.x4[1]) >> 8;
+ var45.x4[2] = ((orc_uint16) var44.x4[2]) >> 8;
+ var45.x4[3] = ((orc_uint16) var44.x4[3]) >> 8;
+ /* 6: convubw */
+ var46.x4[0] = (orc_uint8) var40.x4[0];
+ var46.x4[1] = (orc_uint8) var40.x4[1];
+ var46.x4[2] = (orc_uint8) var40.x4[2];
+ var46.x4[3] = (orc_uint8) var40.x4[3];
+ /* 7: loadl */
+ var47 = ptr0[i];
+ /* 8: convubw */
+ var48.x4[0] = (orc_uint8) var47.x4[0];
+ var48.x4[1] = (orc_uint8) var47.x4[1];
+ var48.x4[2] = (orc_uint8) var47.x4[2];
+ var48.x4[3] = (orc_uint8) var47.x4[3];
+ /* 9: subw */
+ var49.x4[0] = var46.x4[0] - var48.x4[0];
+ var49.x4[1] = var46.x4[1] - var48.x4[1];
+ var49.x4[2] = var46.x4[2] - var48.x4[2];
+ var49.x4[3] = var46.x4[3] - var48.x4[3];
+ /* 10: mullw */
+ var50.x4[0] = (var49.x4[0] * var45.x4[0]) & 0xffff;
+ var50.x4[1] = (var49.x4[1] * var45.x4[1]) & 0xffff;
+ var50.x4[2] = (var49.x4[2] * var45.x4[2]) & 0xffff;
+ var50.x4[3] = (var49.x4[3] * var45.x4[3]) & 0xffff;
+ /* 11: div255w */
+ var51.x4[0] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[0] + 128)) +
+ (((orc_uint16) (var50.x4[0] + 128)) >> 8))) >> 8;
+ var51.x4[1] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[1] + 128)) +
+ (((orc_uint16) (var50.x4[1] + 128)) >> 8))) >> 8;
+ var51.x4[2] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[2] + 128)) +
+ (((orc_uint16) (var50.x4[2] + 128)) >> 8))) >> 8;
+ var51.x4[3] =
+ ((orc_uint16) (((orc_uint16) (var50.x4[3] + 128)) +
+ (((orc_uint16) (var50.x4[3] + 128)) >> 8))) >> 8;
+ /* 12: addw */
+ var52.x4[0] = var48.x4[0] + var51.x4[0];
+ var52.x4[1] = var48.x4[1] + var51.x4[1];
+ var52.x4[2] = var48.x4[2] + var51.x4[2];
+ var52.x4[3] = var48.x4[3] + var51.x4[3];
+ /* 13: convwb */
+ var53.x4[0] = var52.x4[0];
+ var53.x4[1] = var52.x4[1];
+ var53.x4[2] = var52.x4[2];
+ var53.x4[3] = var52.x4[3];
+ /* 15: orl */
+ var54.i = var53.i | var39.i;
+ /* 16: storel */
+ ptr0[i] = var54;
+ }
+
+}
+
+void
+orc_blend_little (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "orc_blend_little");
+ orc_program_set_backup_function (p, _backup_orc_blend_little);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_constant (p, 4, 0x000000ff, "c1");
+ orc_program_add_constant (p, 4, 0x00000008, "c2");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+ orc_program_add_temporary (p, 8, "t5");
+ orc_program_add_temporary (p, 8, "t6");
+ orc_program_add_temporary (p, 8, "t7");
+
+ orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splatbl", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "shruw", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_C2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T5, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "subw", 2, ORC_VAR_T6, ORC_VAR_T6, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mullw", 2, ORC_VAR_T6, ORC_VAR_T6, ORC_VAR_T7,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "div255w", 2, ORC_VAR_T6, ORC_VAR_T6, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "addw", 2, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convwb", 2, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "orl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "storel", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* orc_blend_big */
+#ifdef DISABLE_ORC
+void
+orc_blend_big (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_union32 var45;
+ orc_union64 var46;
+ orc_union64 var47;
+ orc_union64 var48;
+ orc_union32 var49;
+ orc_union64 var50;
+ orc_union64 var51;
+ orc_union64 var52;
+ orc_union64 var53;
+ orc_union64 var54;
+ orc_union32 var55;
+ orc_union32 var56;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+ /* 15: loadpl */
+ var40.i = (int) 0xff000000; /* -16777216 or 2.11371e-314f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var41 = ptr4[i];
+ /* 1: shrul */
+ var42.i = ((orc_uint32) var41.i) >> 24;
+ /* 2: convlw */
+ var43.i = var42.i;
+ /* 3: convwb */
+ var44 = var43.i;
+ /* 4: splatbl */
+ var45.i =
+ ((var44 & 0xff) << 24) | ((var44 & 0xff) << 16) | ((var44 & 0xff) << 8)
+ | (var44 & 0xff);
+ /* 5: convubw */
+ var46.x4[0] = (orc_uint8) var45.x4[0];
+ var46.x4[1] = (orc_uint8) var45.x4[1];
+ var46.x4[2] = (orc_uint8) var45.x4[2];
+ var46.x4[3] = (orc_uint8) var45.x4[3];
+ /* 6: shruw */
+ var47.x4[0] = ((orc_uint16) var46.x4[0]) >> 8;
+ var47.x4[1] = ((orc_uint16) var46.x4[1]) >> 8;
+ var47.x4[2] = ((orc_uint16) var46.x4[2]) >> 8;
+ var47.x4[3] = ((orc_uint16) var46.x4[3]) >> 8;
+ /* 7: convubw */
+ var48.x4[0] = (orc_uint8) var41.x4[0];
+ var48.x4[1] = (orc_uint8) var41.x4[1];
+ var48.x4[2] = (orc_uint8) var41.x4[2];
+ var48.x4[3] = (orc_uint8) var41.x4[3];
+ /* 8: loadl */
+ var49 = ptr0[i];
+ /* 9: convubw */
+ var50.x4[0] = (orc_uint8) var49.x4[0];
+ var50.x4[1] = (orc_uint8) var49.x4[1];
+ var50.x4[2] = (orc_uint8) var49.x4[2];
+ var50.x4[3] = (orc_uint8) var49.x4[3];
+ /* 10: subw */
+ var51.x4[0] = var48.x4[0] - var50.x4[0];
+ var51.x4[1] = var48.x4[1] - var50.x4[1];
+ var51.x4[2] = var48.x4[2] - var50.x4[2];
+ var51.x4[3] = var48.x4[3] - var50.x4[3];
+ /* 11: mullw */
+ var52.x4[0] = (var51.x4[0] * var47.x4[0]) & 0xffff;
+ var52.x4[1] = (var51.x4[1] * var47.x4[1]) & 0xffff;
+ var52.x4[2] = (var51.x4[2] * var47.x4[2]) & 0xffff;
+ var52.x4[3] = (var51.x4[3] * var47.x4[3]) & 0xffff;
+ /* 12: div255w */
+ var53.x4[0] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[0] + 128)) +
+ (((orc_uint16) (var52.x4[0] + 128)) >> 8))) >> 8;
+ var53.x4[1] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[1] + 128)) +
+ (((orc_uint16) (var52.x4[1] + 128)) >> 8))) >> 8;
+ var53.x4[2] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[2] + 128)) +
+ (((orc_uint16) (var52.x4[2] + 128)) >> 8))) >> 8;
+ var53.x4[3] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[3] + 128)) +
+ (((orc_uint16) (var52.x4[3] + 128)) >> 8))) >> 8;
+ /* 13: addw */
+ var54.x4[0] = var50.x4[0] + var53.x4[0];
+ var54.x4[1] = var50.x4[1] + var53.x4[1];
+ var54.x4[2] = var50.x4[2] + var53.x4[2];
+ var54.x4[3] = var50.x4[3] + var53.x4[3];
+ /* 14: convwb */
+ var55.x4[0] = var54.x4[0];
+ var55.x4[1] = var54.x4[1];
+ var55.x4[2] = var54.x4[2];
+ var55.x4[3] = var54.x4[3];
+ /* 16: orl */
+ var56.i = var55.i | var40.i;
+ /* 17: storel */
+ ptr0[i] = var56;
+ }
+
+}
+
+#else
+static void
+_backup_orc_blend_big (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_union32 var45;
+ orc_union64 var46;
+ orc_union64 var47;
+ orc_union64 var48;
+ orc_union32 var49;
+ orc_union64 var50;
+ orc_union64 var51;
+ orc_union64 var52;
+ orc_union64 var53;
+ orc_union64 var54;
+ orc_union32 var55;
+ orc_union32 var56;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+ /* 15: loadpl */
+ var40.i = (int) 0xff000000; /* -16777216 or 2.11371e-314f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var41 = ptr4[i];
+ /* 1: shrul */
+ var42.i = ((orc_uint32) var41.i) >> 24;
+ /* 2: convlw */
+ var43.i = var42.i;
+ /* 3: convwb */
+ var44 = var43.i;
+ /* 4: splatbl */
+ var45.i =
+ ((var44 & 0xff) << 24) | ((var44 & 0xff) << 16) | ((var44 & 0xff) << 8)
+ | (var44 & 0xff);
+ /* 5: convubw */
+ var46.x4[0] = (orc_uint8) var45.x4[0];
+ var46.x4[1] = (orc_uint8) var45.x4[1];
+ var46.x4[2] = (orc_uint8) var45.x4[2];
+ var46.x4[3] = (orc_uint8) var45.x4[3];
+ /* 6: shruw */
+ var47.x4[0] = ((orc_uint16) var46.x4[0]) >> 8;
+ var47.x4[1] = ((orc_uint16) var46.x4[1]) >> 8;
+ var47.x4[2] = ((orc_uint16) var46.x4[2]) >> 8;
+ var47.x4[3] = ((orc_uint16) var46.x4[3]) >> 8;
+ /* 7: convubw */
+ var48.x4[0] = (orc_uint8) var41.x4[0];
+ var48.x4[1] = (orc_uint8) var41.x4[1];
+ var48.x4[2] = (orc_uint8) var41.x4[2];
+ var48.x4[3] = (orc_uint8) var41.x4[3];
+ /* 8: loadl */
+ var49 = ptr0[i];
+ /* 9: convubw */
+ var50.x4[0] = (orc_uint8) var49.x4[0];
+ var50.x4[1] = (orc_uint8) var49.x4[1];
+ var50.x4[2] = (orc_uint8) var49.x4[2];
+ var50.x4[3] = (orc_uint8) var49.x4[3];
+ /* 10: subw */
+ var51.x4[0] = var48.x4[0] - var50.x4[0];
+ var51.x4[1] = var48.x4[1] - var50.x4[1];
+ var51.x4[2] = var48.x4[2] - var50.x4[2];
+ var51.x4[3] = var48.x4[3] - var50.x4[3];
+ /* 11: mullw */
+ var52.x4[0] = (var51.x4[0] * var47.x4[0]) & 0xffff;
+ var52.x4[1] = (var51.x4[1] * var47.x4[1]) & 0xffff;
+ var52.x4[2] = (var51.x4[2] * var47.x4[2]) & 0xffff;
+ var52.x4[3] = (var51.x4[3] * var47.x4[3]) & 0xffff;
+ /* 12: div255w */
+ var53.x4[0] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[0] + 128)) +
+ (((orc_uint16) (var52.x4[0] + 128)) >> 8))) >> 8;
+ var53.x4[1] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[1] + 128)) +
+ (((orc_uint16) (var52.x4[1] + 128)) >> 8))) >> 8;
+ var53.x4[2] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[2] + 128)) +
+ (((orc_uint16) (var52.x4[2] + 128)) >> 8))) >> 8;
+ var53.x4[3] =
+ ((orc_uint16) (((orc_uint16) (var52.x4[3] + 128)) +
+ (((orc_uint16) (var52.x4[3] + 128)) >> 8))) >> 8;
+ /* 13: addw */
+ var54.x4[0] = var50.x4[0] + var53.x4[0];
+ var54.x4[1] = var50.x4[1] + var53.x4[1];
+ var54.x4[2] = var50.x4[2] + var53.x4[2];
+ var54.x4[3] = var50.x4[3] + var53.x4[3];
+ /* 14: convwb */
+ var55.x4[0] = var54.x4[0];
+ var55.x4[1] = var54.x4[1];
+ var55.x4[2] = var54.x4[2];
+ var55.x4[3] = var54.x4[3];
+ /* 16: orl */
+ var56.i = var55.i | var40.i;
+ /* 17: storel */
+ ptr0[i] = var56;
+ }
+
+}
+
+void
+orc_blend_big (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "orc_blend_big");
+ orc_program_set_backup_function (p, _backup_orc_blend_big);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_constant (p, 4, 0xff000000, "c1");
+ orc_program_add_constant (p, 4, 0x00000018, "c2");
+ orc_program_add_constant (p, 4, 0x00000008, "c3");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 4, "t5");
+ orc_program_add_temporary (p, 8, "t6");
+ orc_program_add_temporary (p, 8, "t7");
+ orc_program_add_temporary (p, 8, "t8");
+
+ orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "shrul", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_C2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convlw", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splatbl", 0, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "shruw", 2, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_C3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "loadl", 0, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 2, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "subw", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mullw", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T8,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "div255w", 2, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "addw", 2, ORC_VAR_T6, ORC_VAR_T6, ORC_VAR_T7,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convwb", 2, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "orl", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "storel", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_int8 var39;
+ orc_int8 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_int8 *) s1;
+ ptr5 = (orc_int8 *) s2;
+ ptr6 = (orc_int8 *) s3;
+
+ /* 3: loadpb */
+ var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var39 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var40 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var39;
+ _dest.x2[1] = var40;
+ var41.i = _dest.i;
+ }
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var42.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var41.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_int8 var39;
+ orc_int8 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_int8 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+ ptr6 = (orc_int8 *) ex->arrays[6];
+
+ /* 3: loadpb */
+ var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var39 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var40 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var39;
+ _dest.x2[1] = var40;
+ var41.i = _dest.i;
+ }
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var42.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var41.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_I420");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_I420);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 1, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_source (p, 1, "s3");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T3, ORC_VAR_S2,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S3,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_I420 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union32 var42;
+ orc_union32 var43;
+ orc_union16 var44;
+ orc_union16 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_int8 var48;
+ orc_int8 var49;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr1 = (orc_int8 *) d2;
+ ptr2 = (orc_int8 *) d3;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var38 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[0];
+ var42.x2[0] = _src.x2[1];
+ var43.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[1];
+ var42.x2[1] = _src.x2[1];
+ var43.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var39;
+ /* 4: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.x2[0];
+ var44.x2[0] = _src.x2[1];
+ var45.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var42.x2[1];
+ var44.x2[1] = _src.x2[1];
+ var45.x2[1] = _src.x2[0];
+ }
+ /* 5: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var45.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 6: avgub */
+ var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1;
+ /* 7: storeb */
+ ptr1[i] = var40;
+ /* 8: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var44.i;
+ var48 = _src.x2[1];
+ var49 = _src.x2[0];
+ }
+ /* 9: avgub */
+ var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1;
+ /* 10: storeb */
+ ptr2[i] = var41;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_I420 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union32 var42;
+ orc_union32 var43;
+ orc_union16 var44;
+ orc_union16 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_int8 var48;
+ orc_int8 var49;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr1 = (orc_int8 *) ex->arrays[1];
+ ptr2 = (orc_int8 *) ex->arrays[2];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var38 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[0];
+ var42.x2[0] = _src.x2[1];
+ var43.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[1];
+ var42.x2[1] = _src.x2[1];
+ var43.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var39;
+ /* 4: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.x2[0];
+ var44.x2[0] = _src.x2[1];
+ var45.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var42.x2[1];
+ var44.x2[1] = _src.x2[1];
+ var45.x2[1] = _src.x2[0];
+ }
+ /* 5: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var45.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 6: avgub */
+ var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1;
+ /* 7: storeb */
+ ptr1[i] = var40;
+ /* 8: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var44.i;
+ var48 = _src.x2[1];
+ var49 = _src.x2[0];
+ }
+ /* 9: avgub */
+ var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1;
+ /* 10: storeb */
+ ptr2[i] = var41;
+ }
+
+}
+
+void
+cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_I420");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_I420);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_destination (p, 1, "d2");
+ orc_program_add_destination (p, 1, "d3");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 2, "t4");
+ orc_program_add_temporary (p, 1, "t5");
+ orc_program_add_temporary (p, 1, "t6");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_D3] = d3;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+ /* 2: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var36 = ptr4[i];
+ /* 1: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var40.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var40.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var39.i;
+ var42.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var42.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var42.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+ /* 2: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var36 = ptr4[i];
+ /* 1: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var40.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var40.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var39.i;
+ var42.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var42.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var42.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_YUY2");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_YUY2);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_constant (p, 2, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 4, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+
+ orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_YUY2 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union32 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 4: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var44.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var44.x2[1] = _src.x2[1];
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_YUY2 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union32 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 4: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var44.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var44.x2[1] = _src.x2[1];
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_YUY2");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_YUY2);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+ orc_program_add_temporary (p, 4, "t5");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union32 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 4: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var44.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var44.x2[1] = _src.x2[1];
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var43.x2[0];
+ _dest.x2[1] = var44.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var43.x2[1];
+ _dest.x2[1] = var44.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union32 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 4: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var44.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var44.x2[1] = _src.x2[1];
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var43.x2[0];
+ _dest.x2[1] = var44.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var43.x2[1];
+ _dest.x2[1] = var44.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_UYVY");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_UYVY);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+ orc_program_add_temporary (p, 4, "t5");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 1, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_T1, ORC_VAR_T4,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_UYVY */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+ /* 2: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var36 = ptr4[i];
+ /* 1: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.i;
+ _dest.x2[1] = var40.i;
+ var42.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var42.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var42.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_UYVY (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_union32 var41;
+ orc_union32 var42;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+ /* 2: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var36 = ptr4[i];
+ /* 1: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.i;
+ _dest.x2[1] = var40.i;
+ var42.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var42.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var42.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 6: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_UYVY");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_UYVY);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_constant (p, 2, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 4, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+
+ orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_YUV9 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_union16 var37;
+ orc_union16 var38;
+ orc_union64 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union16 var42;
+ orc_union32 var43;
+ orc_union32 var44;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union16 *) s1;
+ ptr5 = (orc_int8 *) s2;
+ ptr6 = (orc_int8 *) s3;
+
+ /* 4: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var40 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var41 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var40;
+ _dest.x2[1] = var41;
+ var42.i = _dest.i;
+ }
+ /* 3: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var42.i;
+ var43.i = _dest.i;
+ }
+ /* 5: loadw */
+ var38 = ptr4[i];
+ /* 6: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var38.x2[0];
+ var44.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var38.x2[1];
+ var44.x2[1] = _dest.i;
+ }
+ /* 7: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var44.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var39.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var44.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var39.x2[1] = _dest.i;
+ }
+ /* 8: storeq */
+ ptr0[i] = var39;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_YUV9 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_union16 var37;
+ orc_union16 var38;
+ orc_union64 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union16 var42;
+ orc_union32 var43;
+ orc_union32 var44;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union16 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+ ptr6 = (orc_int8 *) ex->arrays[6];
+
+ /* 4: loadpb */
+ var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var40 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var41 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var40;
+ _dest.x2[1] = var41;
+ var42.i = _dest.i;
+ }
+ /* 3: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var42.i;
+ var43.i = _dest.i;
+ }
+ /* 5: loadw */
+ var38 = ptr4[i];
+ /* 6: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[0];
+ _dest.x2[1] = var38.x2[0];
+ var44.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var37.x2[1];
+ _dest.x2[1] = var38.x2[1];
+ var44.x2[1] = _dest.i;
+ }
+ /* 7: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var44.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var39.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var44.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var39.x2[1] = _dest.i;
+ }
+ /* 8: storeq */
+ ptr0[i] = var39;
+ }
+
+}
+
+void
+cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_YUV9");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_YUV9);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 2, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_source (p, 1, "s3");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 4, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 1, "t5");
+
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S2,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T5, ORC_VAR_S3,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_union64 var40;
+ orc_union16 var41;
+ orc_union32 var42;
+ orc_union32 var43;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union16 *) s1;
+ ptr5 = (orc_int8 *) s2;
+ ptr6 = (orc_int8 *) s3;
+
+ /* 3: loadpb */
+ var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var36 = ptr5[i];
+ /* 1: loadb */
+ var37 = ptr6[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var41.i = _dest.i;
+ }
+ /* 4: loadw */
+ var39 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var38.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var42.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var38.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var42.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.i;
+ _dest.x2[1] = var41.i;
+ var43.i = _dest.i;
+ }
+ /* 7: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var40.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var40.x2[1] = _dest.i;
+ }
+ /* 8: storeq */
+ ptr0[i] = var40;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_union64 var40;
+ orc_union16 var41;
+ orc_union32 var42;
+ orc_union32 var43;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union16 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+ ptr6 = (orc_int8 *) ex->arrays[6];
+
+ /* 3: loadpb */
+ var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var36 = ptr5[i];
+ /* 1: loadb */
+ var37 = ptr6[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var41.i = _dest.i;
+ }
+ /* 4: loadw */
+ var39 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var38.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var42.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var38.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var42.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.i;
+ _dest.x2[1] = var41.i;
+ var43.i = _dest.i;
+ }
+ /* 7: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.x2[0];
+ _dest.x2[1] = var43.x2[0];
+ var40.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.x2[1];
+ _dest.x2[1] = var43.x2[1];
+ var40.x2[1] = _dest.i;
+ }
+ /* 8: storeq */
+ ptr0[i] = var40;
+ }
+
+}
+
+void
+cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_Y42B");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_Y42B);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 2, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_source (p, 1, "s3");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 4, "t3");
+ orc_program_add_temporary (p, 4, "t4");
+
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T4, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y42B */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var36;
+ orc_int8 var37;
+ orc_int8 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr1 = (orc_int8 *) d2;
+ ptr2 = (orc_int8 *) d3;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var36 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[0];
+ var40.x2[0] = _src.x2[1];
+ var41.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[1];
+ var40.x2[1] = _src.x2[1];
+ var41.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+ var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+ /* 4: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var44.i;
+ var37 = _src.x2[1];
+ var38 = _src.x2[0];
+ }
+ /* 5: storeb */
+ ptr2[i] = var37;
+ /* 6: storeb */
+ ptr1[i] = var38;
+ /* 7: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 8: storew */
+ ptr0[i] = var39;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y42B (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var36;
+ orc_int8 var37;
+ orc_int8 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr1 = (orc_int8 *) ex->arrays[1];
+ ptr2 = (orc_int8 *) ex->arrays[2];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var36 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[0];
+ var40.x2[0] = _src.x2[1];
+ var41.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[1];
+ var40.x2[1] = _src.x2[1];
+ var41.x2[1] = _src.x2[0];
+ }
+ /* 2: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 3: avgub */
+ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+ var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+ /* 4: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var44.i;
+ var37 = _src.x2[1];
+ var38 = _src.x2[0];
+ }
+ /* 5: storeb */
+ ptr2[i] = var37;
+ /* 6: storeb */
+ ptr1[i] = var38;
+ /* 7: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 8: storew */
+ ptr0[i] = var39;
+ }
+
+}
+
+void
+cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_Y42B");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_Y42B);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_destination (p, 1, "d2");
+ orc_program_add_destination (p, 1, "d3");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 2, "t4");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_D3] = d3;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var34;
+ orc_int8 var35;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_int8 *) s1;
+ ptr5 = (orc_int8 *) s2;
+ ptr6 = (orc_int8 *) s3;
+
+ /* 3: loadpb */
+ var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var34 = ptr5[i];
+ /* 1: loadb */
+ var35 = ptr6[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var34;
+ _dest.x2[1] = var35;
+ var39.i = _dest.i;
+ }
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var40.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.i;
+ _dest.x2[1] = var39.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ orc_int8 var34;
+ orc_int8 var35;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_int8 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+ ptr6 = (orc_int8 *) ex->arrays[6];
+
+ /* 3: loadpb */
+ var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var34 = ptr5[i];
+ /* 1: loadb */
+ var35 = ptr6[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var34;
+ _dest.x2[1] = var35;
+ var39.i = _dest.i;
+ }
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var40.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.i;
+ _dest.x2[1] = var39.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_Y444");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_Y444);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 1, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_source (p, 1, "s3");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_S3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->arrays[ORC_VAR_S3] = (void *) s3;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y444 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_int8 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var34;
+ orc_int8 var35;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+
+ ptr0 = (orc_int8 *) d1;
+ ptr1 = (orc_int8 *) d2;
+ ptr2 = (orc_int8 *) d3;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var34 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var34.i;
+ var38.i = _src.x2[1];
+ var39.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var38.i;
+ var35 = _src.x2[1];
+ var36 = _src.x2[0];
+ }
+ /* 3: storeb */
+ ptr2[i] = var35;
+ /* 4: storeb */
+ ptr1[i] = var36;
+ /* 5: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var39.i;
+ var37 = _src.x2[1];
+ }
+ /* 6: storeb */
+ ptr0[i] = var37;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y444 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_int8 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var34;
+ orc_int8 var35;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+
+ ptr0 = (orc_int8 *) ex->arrays[0];
+ ptr1 = (orc_int8 *) ex->arrays[1];
+ ptr2 = (orc_int8 *) ex->arrays[2];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var34 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var34.i;
+ var38.i = _src.x2[1];
+ var39.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var38.i;
+ var35 = _src.x2[1];
+ var36 = _src.x2[0];
+ }
+ /* 3: storeb */
+ ptr2[i] = var35;
+ /* 4: storeb */
+ ptr1[i] = var36;
+ /* 5: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var39.i;
+ var37 = _src.x2[1];
+ }
+ /* 6: storeb */
+ ptr0[i] = var37;
+ }
+
+}
+
+void
+cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_Y444");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_Y444);
+ orc_program_add_destination (p, 1, "d1");
+ orc_program_add_destination (p, 1, "d2");
+ orc_program_add_destination (p, 1, "d3");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_D3] = d3;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y800 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ orc_int8 var33;
+ orc_int8 var34;
+ orc_union16 var35;
+ orc_union32 var36;
+ orc_union16 var37;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_int8 *) s1;
+
+ /* 0: loadpb */
+ var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ /* 3: loadpw */
+ var35.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */
+
+ for (i = 0; i < n; i++) {
+ /* 1: loadb */
+ var34 = ptr4[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var33;
+ _dest.x2[1] = var34;
+ var37.i = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var37.i;
+ _dest.x2[1] = var35.i;
+ var36.i = _dest.i;
+ }
+ /* 5: storel */
+ ptr0[i] = var36;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y800 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ orc_int8 var33;
+ orc_int8 var34;
+ orc_union16 var35;
+ orc_union32 var36;
+ orc_union16 var37;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_int8 *) ex->arrays[4];
+
+ /* 0: loadpb */
+ var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ /* 3: loadpw */
+ var35.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */
+
+ for (i = 0; i < n; i++) {
+ /* 1: loadb */
+ var34 = ptr4[i];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var33;
+ _dest.x2[1] = var34;
+ var37.i = _dest.i;
+ }
+ /* 4: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var37.i;
+ _dest.x2[1] = var35.i;
+ var36.i = _dest.i;
+ }
+ /* 5: storel */
+ ptr0[i] = var36;
+ }
+
+}
+
+void
+cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_Y800");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_Y800);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 1, "s1");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_constant (p, 2, 0x00008080, "c2");
+ orc_program_add_temporary (p, 2, "t1");
+
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y800 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_int8 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var33;
+ orc_int8 var34;
+ orc_union16 var35;
+
+ ptr0 = (orc_int8 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var33 = ptr4[i];
+ /* 1: select0lw */
+ {
+ orc_union32 _src;
+ _src.i = var33.i;
+ var35.i = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var35.i;
+ var34 = _src.x2[1];
+ }
+ /* 3: storeb */
+ ptr0[i] = var34;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y800 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_int8 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var33;
+ orc_int8 var34;
+ orc_union16 var35;
+
+ ptr0 = (orc_int8 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var33 = ptr4[i];
+ /* 1: select0lw */
+ {
+ orc_union32 _src;
+ _src.i = var33.i;
+ var35.i = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var35.i;
+ var34 = _src.x2[1];
+ }
+ /* 3: storeb */
+ ptr0[i] = var34;
+ }
+
+}
+
+void
+cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_Y800");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_Y800);
+ orc_program_add_destination (p, 1, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 2, "t1");
+
+ orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_Y16 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var34;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var34 = ptr4[i];
+ /* 1: select0lw */
+ {
+ orc_union32 _src;
+ _src.i = var34.i;
+ var36.i = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var36.i;
+ var37 = _src.x2[1];
+ }
+ /* 3: convubw */
+ var38.i = (orc_uint8) var37;
+ /* 4: shlw */
+ var35.i = var38.i << 8;
+ /* 5: storew */
+ ptr0[i] = var35;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_Y16 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var34;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var34 = ptr4[i];
+ /* 1: select0lw */
+ {
+ orc_union32 _src;
+ _src.i = var34.i;
+ var36.i = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var36.i;
+ var37 = _src.x2[1];
+ }
+ /* 3: convubw */
+ var38.i = (orc_uint8) var37;
+ /* 4: shlw */
+ var35.i = var38.i << 8;
+ /* 5: storew */
+ ptr0[i] = var35;
+ }
+
+}
+
+void
+cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_Y16");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_Y16);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_constant (p, 4, 0x00000008, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+
+ orc_program_append_2 (p, "select0lw", 0, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "shlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_Y16 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ orc_union16 var34;
+ orc_int8 var35;
+ orc_union16 var36;
+ orc_union32 var37;
+ orc_int8 var38;
+ orc_union16 var39;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union16 *) s1;
+
+ /* 2: loadpb */
+ var35 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ /* 4: loadpw */
+ var36.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var34 = ptr4[i];
+ /* 1: convhwb */
+ var38 = ((orc_uint16) var34.i) >> 8;
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var35;
+ _dest.x2[1] = var38;
+ var39.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var36.i;
+ var37.i = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var37;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_Y16 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ orc_union16 var34;
+ orc_int8 var35;
+ orc_union16 var36;
+ orc_union32 var37;
+ orc_int8 var38;
+ orc_union16 var39;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union16 *) ex->arrays[4];
+
+ /* 2: loadpb */
+ var35 = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ /* 4: loadpw */
+ var36.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var34 = ptr4[i];
+ /* 1: convhwb */
+ var38 = ((orc_uint16) var34.i) >> 8;
+ /* 3: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var35;
+ _dest.x2[1] = var38;
+ var39.i = _dest.i;
+ }
+ /* 5: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var36.i;
+ var37.i = _dest.i;
+ }
+ /* 6: storel */
+ ptr0[i] = var37;
+ }
+
+}
+
+void
+cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_Y16");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_Y16);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 2, "s1");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_constant (p, 2, 0x00008080, "c2");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+
+ orc_program_append_2 (p, "convhwb", 0, ORC_VAR_T2, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+ orc_union32 var33;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var32 = ptr4[i];
+ /* 1: swapl */
+ var33.i = ORC_SWAP_L (var32.i);
+ /* 2: storel */
+ ptr0[i] = var33;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+ orc_union32 var33;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var32 = ptr4[i];
+ /* 1: swapl */
+ var33.i = ORC_SWAP_L (var32.i);
+ /* 2: storel */
+ ptr0[i] = var33;
+ }
+
+}
+
+void
+cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_BGRA");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_BGRA);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+
+ orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_BGRA */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+ orc_union32 var33;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var32 = ptr4[i];
+ /* 1: swapl */
+ var33.i = ORC_SWAP_L (var32.i);
+ /* 2: storel */
+ ptr0[i] = var33;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_BGRA (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+ orc_union32 var33;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var32 = ptr4[i];
+ /* 1: swapl */
+ var33.i = ORC_SWAP_L (var32.i);
+ /* 2: storel */
+ ptr0[i] = var33;
+ }
+
+}
+
+void
+cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_BGRA");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_BGRA);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+
+ orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_RGBA */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44;
+ _dest.x2[1] = var47;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var46;
+ _dest.x2[1] = var45;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var49.i;
+ _dest.x2[1] = var48.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_RGBA (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44;
+ _dest.x2[1] = var47;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var46;
+ _dest.x2[1] = var45;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var49.i;
+ _dest.x2[1] = var48.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+void
+cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_RGBA");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_RGBA);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 1, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 2, "t5");
+ orc_program_add_temporary (p, 2, "t6");
+ orc_program_add_temporary (p, 2, "t7");
+ orc_program_add_temporary (p, 2, "t8");
+
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T8,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T7,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T6, ORC_VAR_T4, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_RGBA */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var46;
+ _dest.x2[1] = var45;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44;
+ _dest.x2[1] = var47;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_RGBA (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var46;
+ _dest.x2[1] = var45;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var44;
+ _dest.x2[1] = var47;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+void
+cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_RGBA");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_RGBA);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 1, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 2, "t5");
+ orc_program_add_temporary (p, 2, "t6");
+ orc_program_add_temporary (p, 2, "t7");
+ orc_program_add_temporary (p, 2, "t8");
+
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_ABGR */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var47;
+ _dest.x2[1] = var44;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var45;
+ _dest.x2[1] = var46;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_ABGR (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var47;
+ _dest.x2[1] = var44;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var45;
+ _dest.x2[1] = var46;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+void
+cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_ABGR");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_ABGR);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 1, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 2, "t5");
+ orc_program_add_temporary (p, 2, "t6");
+ orc_program_add_temporary (p, 2, "t7");
+ orc_program_add_temporary (p, 2, "t8");
+
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T5,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T7, ORC_VAR_T1, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T8, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_ABGR */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var47;
+ _dest.x2[1] = var44;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var45;
+ _dest.x2[1] = var46;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_ABGR (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_int8 var44;
+ orc_int8 var45;
+ orc_int8 var46;
+ orc_int8 var47;
+ orc_union16 var48;
+ orc_union16 var49;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadl */
+ var40 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 2: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var42.i;
+ var44 = _src.x2[1];
+ var45 = _src.x2[0];
+ }
+ /* 3: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.i;
+ var46 = _src.x2[1];
+ var47 = _src.x2[0];
+ }
+ /* 4: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var47;
+ _dest.x2[1] = var44;
+ var48.i = _dest.i;
+ }
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var45;
+ _dest.x2[1] = var46;
+ var49.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var48.i;
+ _dest.x2[1] = var49.i;
+ var41.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var41;
+ }
+
+}
+
+void
+cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_ABGR");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_ABGR);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_temporary (p, 1, "t1");
+ orc_program_add_temporary (p, 1, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+ orc_program_add_temporary (p, 2, "t5");
+ orc_program_add_temporary (p, 2, "t6");
+ orc_program_add_temporary (p, 2, "t7");
+ orc_program_add_temporary (p, 2, "t8");
+
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T8, ORC_VAR_T7, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T8,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_T7,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T6, ORC_VAR_T1, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T6, ORC_VAR_T5,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_NV12 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_union16 *ORC_RESTRICT ptr5;
+ orc_union16 var34;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union16 *) s1;
+ ptr5 = (orc_union16 *) s2;
+
+ /* 3: loadpb */
+ var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var34 = ptr5[i];
+ /* 1: loadw */
+ var35 = ptr5[i];
+ /* 2: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var34.i;
+ _dest.x2[1] = var35.i;
+ var39.i = _dest.i;
+ }
+ /* 4: loadw */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[0];
+ _dest.x2[1] = var37.x2[0];
+ var40.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[1];
+ _dest.x2[1] = var37.x2[1];
+ var40.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 7: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_NV12 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_union16 *ORC_RESTRICT ptr5;
+ orc_union16 var34;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union16 *) ex->arrays[4];
+ ptr5 = (orc_union16 *) ex->arrays[5];
+
+ /* 3: loadpb */
+ var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var34 = ptr5[i];
+ /* 1: loadw */
+ var35 = ptr5[i];
+ /* 2: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var34.i;
+ _dest.x2[1] = var35.i;
+ var39.i = _dest.i;
+ }
+ /* 4: loadw */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[0];
+ _dest.x2[1] = var37.x2[0];
+ var40.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[1];
+ _dest.x2[1] = var37.x2[1];
+ var40.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.x2[0];
+ _dest.x2[1] = var39.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var40.x2[1];
+ _dest.x2[1] = var39.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 7: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_NV12");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_NV12);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 2, "s1");
+ orc_program_add_source (p, 2, "s2");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_NV12 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_union16 *ORC_RESTRICT ptr1;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var36;
+ orc_union16 var37;
+ orc_union16 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr1 = (orc_union16 *) d2;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var36 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var37.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var37.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var37;
+ /* 4: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 5: avgub */
+ var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 6: storew */
+ ptr1[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_NV12 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_union16 *ORC_RESTRICT ptr1;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var36;
+ orc_union16 var37;
+ orc_union16 var38;
+ orc_union32 var39;
+ orc_union32 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr1 = (orc_union16 *) ex->arrays[1];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var36 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[0];
+ var39.x2[0] = _src.x2[1];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var36.x2[1];
+ var39.x2[1] = _src.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[0];
+ var37.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var40.x2[1];
+ var37.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var37;
+ /* 4: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var39.i;
+ var41.i = _src.x2[1];
+ var42.i = _src.x2[0];
+ }
+ /* 5: avgub */
+ var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1;
+ var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1;
+ /* 6: storew */
+ ptr1[i] = var38;
+ }
+
+}
+
+void
+cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_NV12");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_NV12);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_destination (p, 2, "d2");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 2, "t4");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 1, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_NV21 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, int n)
+{
+ int i;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_union16 *ORC_RESTRICT ptr5;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+
+ ptr0 = (orc_union64 *) d1;
+ ptr4 = (orc_union16 *) s1;
+ ptr5 = (orc_union16 *) s2;
+
+ /* 3: loadpb */
+ var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var35 = ptr5[i];
+ /* 1: swapw */
+ var39.i = ORC_SWAP_W (var35.i);
+ /* 2: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var39.i;
+ var40.i = _dest.i;
+ }
+ /* 4: loadw */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[0];
+ _dest.x2[1] = var37.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[1];
+ _dest.x2[1] = var37.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var40.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var40.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 7: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_NV21 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union64 *ORC_RESTRICT ptr0;
+ const orc_union16 *ORC_RESTRICT ptr4;
+ const orc_union16 *ORC_RESTRICT ptr5;
+ orc_union16 var35;
+ orc_union16 var36;
+ orc_union16 var37;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+
+ ptr0 = (orc_union64 *) ex->arrays[0];
+ ptr4 = (orc_union16 *) ex->arrays[4];
+ ptr5 = (orc_union16 *) ex->arrays[5];
+
+ /* 3: loadpb */
+ var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+ var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadw */
+ var35 = ptr5[i];
+ /* 1: swapw */
+ var39.i = ORC_SWAP_W (var35.i);
+ /* 2: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var39.i;
+ _dest.x2[1] = var39.i;
+ var40.i = _dest.i;
+ }
+ /* 4: loadw */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[0];
+ _dest.x2[1] = var37.x2[0];
+ var41.x2[0] = _dest.i;
+ }
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36.x2[1];
+ _dest.x2[1] = var37.x2[1];
+ var41.x2[1] = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[0];
+ _dest.x2[1] = var40.x2[0];
+ var38.x2[0] = _dest.i;
+ }
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var41.x2[1];
+ _dest.x2[1] = var40.x2[1];
+ var38.x2[1] = _dest.i;
+ }
+ /* 7: storeq */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_NV21");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_NV21);
+ orc_program_add_destination (p, 8, "d1");
+ orc_program_add_source (p, 2, "s1");
+ orc_program_add_source (p, 2, "s2");
+ orc_program_add_constant (p, 1, 0x000000ff, "c1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 4, "t3");
+
+ orc_program_append_2 (p, "swapw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_NV21 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_union16 *ORC_RESTRICT ptr1;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr1 = (orc_union16 *) d2;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var40.x2[0] = _src.x2[1];
+ var41.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var40.x2[1] = _src.x2[1];
+ var41.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[0];
+ var38.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[1];
+ var38.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var38;
+ /* 4: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 5: avgub */
+ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+ var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+ /* 6: swapw */
+ var39.i = ORC_SWAP_W (var44.i);
+ /* 7: storew */
+ ptr1[i] = var39;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_NV21 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_union16 *ORC_RESTRICT ptr1;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_union32 var40;
+ orc_union32 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr1 = (orc_union16 *) ex->arrays[1];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var37 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[0];
+ var40.x2[0] = _src.x2[1];
+ var41.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var37.x2[1];
+ var40.x2[1] = _src.x2[1];
+ var41.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[0];
+ var38.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var41.x2[1];
+ var38.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var38;
+ /* 4: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var40.i;
+ var42.i = _src.x2[1];
+ var43.i = _src.x2[0];
+ }
+ /* 5: avgub */
+ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1;
+ var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1;
+ /* 6: swapw */
+ var39.i = ORC_SWAP_W (var44.i);
+ /* 7: storew */
+ ptr1[i] = var39;
+ }
+
+}
+
+void
+cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_NV21");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_NV21);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_destination (p, 2, "d2");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 2, "t4");
+ orc_program_add_temporary (p, 2, "t5");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 1, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "swapw", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_D1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_getline_A420 */
+#ifdef DISABLE_ORC
+void
+cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+ const guint8 * ORC_RESTRICT s4, int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ const orc_int8 *ORC_RESTRICT ptr7;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_int8 var39;
+ orc_int8 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_int8 *) s1;
+ ptr5 = (orc_int8 *) s2;
+ ptr6 = (orc_int8 *) s3;
+ ptr7 = (orc_int8 *) s4;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var39 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var40 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var39;
+ _dest.x2[1] = var40;
+ var41.i = _dest.i;
+ }
+ /* 3: loadb */
+ var36 = ptr7[i];
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var42.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var41.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_getline_A420 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ const orc_int8 *ORC_RESTRICT ptr6;
+ const orc_int8 *ORC_RESTRICT ptr7;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union32 var38;
+ orc_int8 var39;
+ orc_int8 var40;
+ orc_union16 var41;
+ orc_union16 var42;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_int8 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+ ptr6 = (orc_int8 *) ex->arrays[6];
+ ptr7 = (orc_int8 *) ex->arrays[7];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadupdb */
+ var39 = ptr5[i >> 1];
+ /* 1: loadupdb */
+ var40 = ptr6[i >> 1];
+ /* 2: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var39;
+ _dest.x2[1] = var40;
+ var41.i = _dest.i;
+ }
+ /* 3: loadb */
+ var36 = ptr7[i];
+ /* 4: loadb */
+ var37 = ptr4[i];
+ /* 5: mergebw */
+ {
+ orc_union16 _dest;
+ _dest.x2[0] = var36;
+ _dest.x2[1] = var37;
+ var42.i = _dest.i;
+ }
+ /* 6: mergewl */
+ {
+ orc_union32 _dest;
+ _dest.x2[0] = var42.i;
+ _dest.x2[1] = var41.i;
+ var38.i = _dest.i;
+ }
+ /* 7: storel */
+ ptr0[i] = var38;
+ }
+
+}
+
+void
+cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1,
+ const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3,
+ const guint8 * ORC_RESTRICT s4, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_getline_A420");
+ orc_program_set_backup_function (p, _backup_cogorc_getline_A420);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 1, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_source (p, 1, "s3");
+ orc_program_add_source (p, 1, "s4");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T3, ORC_VAR_S2,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S3,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S4, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->arrays[ORC_VAR_S3] = (void *) s3;
+ ex->arrays[ORC_VAR_S4] = (void *) s4;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* cogorc_putline_A420 */
+#ifdef DISABLE_ORC
+void
+cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ int i;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ orc_union16 *ORC_RESTRICT ptr3;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_int8 var41;
+ orc_int8 var42;
+ orc_union32 var43;
+ orc_union32 var44;
+ orc_union16 var45;
+ orc_union16 var46;
+ orc_int8 var47;
+ orc_int8 var48;
+ orc_int8 var49;
+ orc_int8 var50;
+
+ ptr0 = (orc_union16 *) d1;
+ ptr1 = (orc_int8 *) d2;
+ ptr2 = (orc_int8 *) d3;
+ ptr3 = (orc_union16 *) d4;
+ ptr4 = (orc_union64 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var38 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[0];
+ var43.x2[0] = _src.x2[1];
+ var44.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[1];
+ var43.x2[1] = _src.x2[1];
+ var44.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var39;
+ /* 4: select0wb */
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[0];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 5: storew */
+ ptr3[i] = var40;
+ /* 6: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[0];
+ var45.x2[0] = _src.x2[1];
+ var46.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[1];
+ var45.x2[1] = _src.x2[1];
+ var46.x2[1] = _src.x2[0];
+ }
+ /* 7: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var46.i;
+ var47 = _src.x2[1];
+ var48 = _src.x2[0];
+ }
+ /* 8: avgub */
+ var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1;
+ /* 9: storeb */
+ ptr1[i] = var41;
+ /* 10: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var45.i;
+ var49 = _src.x2[1];
+ var50 = _src.x2[0];
+ }
+ /* 11: avgub */
+ var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1;
+ /* 12: storeb */
+ ptr2[i] = var42;
+ }
+
+}
+
+#else
+static void
+_backup_cogorc_putline_A420 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union16 *ORC_RESTRICT ptr0;
+ orc_int8 *ORC_RESTRICT ptr1;
+ orc_int8 *ORC_RESTRICT ptr2;
+ orc_union16 *ORC_RESTRICT ptr3;
+ const orc_union64 *ORC_RESTRICT ptr4;
+ orc_union64 var38;
+ orc_union16 var39;
+ orc_union16 var40;
+ orc_int8 var41;
+ orc_int8 var42;
+ orc_union32 var43;
+ orc_union32 var44;
+ orc_union16 var45;
+ orc_union16 var46;
+ orc_int8 var47;
+ orc_int8 var48;
+ orc_int8 var49;
+ orc_int8 var50;
+
+ ptr0 = (orc_union16 *) ex->arrays[0];
+ ptr1 = (orc_int8 *) ex->arrays[1];
+ ptr2 = (orc_int8 *) ex->arrays[2];
+ ptr3 = (orc_union16 *) ex->arrays[3];
+ ptr4 = (orc_union64 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadq */
+ var38 = ptr4[i];
+ /* 1: splitlw */
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[0];
+ var43.x2[0] = _src.x2[1];
+ var44.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union32 _src;
+ _src.i = var38.x2[1];
+ var43.x2[1] = _src.x2[1];
+ var44.x2[1] = _src.x2[0];
+ }
+ /* 2: select1wb */
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[0];
+ var39.x2[0] = _src.x2[1];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[1];
+ var39.x2[1] = _src.x2[1];
+ }
+ /* 3: storew */
+ ptr0[i] = var39;
+ /* 4: select0wb */
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[0];
+ var40.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var44.x2[1];
+ var40.x2[1] = _src.x2[0];
+ }
+ /* 5: storew */
+ ptr3[i] = var40;
+ /* 6: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[0];
+ var45.x2[0] = _src.x2[1];
+ var46.x2[0] = _src.x2[0];
+ }
+ {
+ orc_union16 _src;
+ _src.i = var43.x2[1];
+ var45.x2[1] = _src.x2[1];
+ var46.x2[1] = _src.x2[0];
+ }
+ /* 7: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var46.i;
+ var47 = _src.x2[1];
+ var48 = _src.x2[0];
+ }
+ /* 8: avgub */
+ var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1;
+ /* 9: storeb */
+ ptr1[i] = var41;
+ /* 10: splitwb */
+ {
+ orc_union16 _src;
+ _src.i = var45.i;
+ var49 = _src.x2[1];
+ var50 = _src.x2[0];
+ }
+ /* 11: avgub */
+ var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1;
+ /* 12: storeb */
+ ptr2[i] = var42;
+ }
+
+}
+
+void
+cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
+ guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4,
+ const guint8 * ORC_RESTRICT s1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "cogorc_putline_A420");
+ orc_program_set_backup_function (p, _backup_cogorc_putline_A420);
+ orc_program_add_destination (p, 2, "d1");
+ orc_program_add_destination (p, 1, "d2");
+ orc_program_add_destination (p, 1, "d3");
+ orc_program_add_destination (p, 2, "d4");
+ orc_program_add_source (p, 8, "s1");
+ orc_program_add_temporary (p, 4, "t1");
+ orc_program_add_temporary (p, 4, "t2");
+ orc_program_add_temporary (p, 2, "t3");
+ orc_program_add_temporary (p, 2, "t4");
+ orc_program_add_temporary (p, 1, "t5");
+ orc_program_add_temporary (p, 1, "t6");
+
+ orc_program_append_2 (p, "splitlw", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "select0wb", 1, ORC_VAR_D4, ORC_VAR_T1,
+ ORC_VAR_D1, ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T3,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_T4,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_D2] = d2;
+ ex->arrays[ORC_VAR_D3] = d3;
+ ex->arrays[ORC_VAR_D4] = d4;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* orc_resample_bilinear_u32 */
+#ifdef DISABLE_ORC
+void
+orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int p1, int p2, int n)
+{
+ int i;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+
+ ptr0 = (orc_union32 *) d1;
+ ptr4 = (orc_union32 *) s1;
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: ldreslinl */
+ {
+ int tmp = p1 + i * p2;
+ orc_union32 a = ptr4[tmp >> 16];
+ orc_union32 b = ptr4[(tmp >> 16) + 1];
+ var32.x4[0] =
+ ((orc_uint8) a.x4[0] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[0] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[1] =
+ ((orc_uint8) a.x4[1] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[1] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[2] =
+ ((orc_uint8) a.x4[2] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[2] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[3] =
+ ((orc_uint8) a.x4[3] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[3] * ((tmp >> 8) & 0xff)) >> 8;
+ }
+ /* 1: storel */
+ ptr0[i] = var32;
+ }
+
+}
+
+#else
+static void
+_backup_orc_resample_bilinear_u32 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_union32 *ORC_RESTRICT ptr0;
+ const orc_union32 *ORC_RESTRICT ptr4;
+ orc_union32 var32;
+
+ ptr0 = (orc_union32 *) ex->arrays[0];
+ ptr4 = (orc_union32 *) ex->arrays[4];
+
+
+ for (i = 0; i < n; i++) {
+ /* 0: ldreslinl */
+ {
+ int tmp = ex->params[24] + i * ex->params[25];
+ orc_union32 a = ptr4[tmp >> 16];
+ orc_union32 b = ptr4[(tmp >> 16) + 1];
+ var32.x4[0] =
+ ((orc_uint8) a.x4[0] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[0] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[1] =
+ ((orc_uint8) a.x4[1] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[1] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[2] =
+ ((orc_uint8) a.x4[2] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[2] * ((tmp >> 8) & 0xff)) >> 8;
+ var32.x4[3] =
+ ((orc_uint8) a.x4[3] * (256 - ((tmp >> 8) & 0xff)) +
+ (orc_uint8) b.x4[3] * ((tmp >> 8) & 0xff)) >> 8;
+ }
+ /* 1: storel */
+ ptr0[i] = var32;
+ }
+
+}
+
+void
+orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1,
+ const guint8 * ORC_RESTRICT s1, int p1, int p2, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "orc_resample_bilinear_u32");
+ orc_program_set_backup_function (p, _backup_orc_resample_bilinear_u32);
+ orc_program_add_destination (p, 4, "d1");
+ orc_program_add_source (p, 4, "s1");
+ orc_program_add_parameter (p, 4, "p1");
+ orc_program_add_parameter (p, 4, "p2");
+
+ orc_program_append_2 (p, "ldreslinl", 0, ORC_VAR_D1, ORC_VAR_S1,
+ ORC_VAR_P1, ORC_VAR_P2);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->params[ORC_VAR_P1] = p1;
+ ex->params[ORC_VAR_P2] = p2;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
+
+
+/* orc_merge_linear_u8 */
+#ifdef DISABLE_ORC
+void
+orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1,
+ const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
+ int p1, int n)
+{
+ int i;
+ orc_int8 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+ orc_union16 var45;
+ orc_union16 var46;
+ orc_int8 var47;
+
+ ptr0 = (orc_int8 *) d1;
+ ptr4 = (orc_int8 *) s1;
+ ptr5 = (orc_int8 *) s2;
+
+ /* 6: loadpw */
+ var38.i = p1;
+ /* 8: loadpw */
+ var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var41 = ptr4[i];
+ /* 1: loadb */
+ var36 = ptr4[i];
+ /* 2: convubw */
+ var42.i = (orc_uint8) var36;
+ /* 3: loadb */
+ var37 = ptr5[i];
+ /* 4: convubw */
+ var43.i = (orc_uint8) var37;
+ /* 5: subw */
+ var44.i = var43.i - var42.i;
+ /* 7: mullw */
+ var45.i = (var44.i * var38.i) & 0xffff;
+ /* 9: addw */
+ var46.i = var45.i + var39.i;
+ /* 10: convhwb */
+ var47 = ((orc_uint16) var46.i) >> 8;
+ /* 11: addb */
+ var40 = var47 + var41;
+ /* 12: storeb */
+ ptr0[i] = var40;
+ }
+
+}
+
+#else
+static void
+_backup_orc_merge_linear_u8 (OrcExecutor * ORC_RESTRICT ex)
+{
+ int i;
+ int n = ex->n;
+ orc_int8 *ORC_RESTRICT ptr0;
+ const orc_int8 *ORC_RESTRICT ptr4;
+ const orc_int8 *ORC_RESTRICT ptr5;
+ orc_int8 var36;
+ orc_int8 var37;
+ orc_union16 var38;
+ orc_union16 var39;
+ orc_int8 var40;
+ orc_int8 var41;
+ orc_union16 var42;
+ orc_union16 var43;
+ orc_union16 var44;
+ orc_union16 var45;
+ orc_union16 var46;
+ orc_int8 var47;
+
+ ptr0 = (orc_int8 *) ex->arrays[0];
+ ptr4 = (orc_int8 *) ex->arrays[4];
+ ptr5 = (orc_int8 *) ex->arrays[5];
+
+ /* 6: loadpw */
+ var38.i = ex->params[24];
+ /* 8: loadpw */
+ var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */
+
+ for (i = 0; i < n; i++) {
+ /* 0: loadb */
+ var41 = ptr4[i];
+ /* 1: loadb */
+ var36 = ptr4[i];
+ /* 2: convubw */
+ var42.i = (orc_uint8) var36;
+ /* 3: loadb */
+ var37 = ptr5[i];
+ /* 4: convubw */
+ var43.i = (orc_uint8) var37;
+ /* 5: subw */
+ var44.i = var43.i - var42.i;
+ /* 7: mullw */
+ var45.i = (var44.i * var38.i) & 0xffff;
+ /* 9: addw */
+ var46.i = var45.i + var39.i;
+ /* 10: convhwb */
+ var47 = ((orc_uint16) var46.i) >> 8;
+ /* 11: addb */
+ var40 = var47 + var41;
+ /* 12: storeb */
+ ptr0[i] = var40;
+ }
+
+}
+
+void
+orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1,
+ const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2,
+ int p1, int n)
+{
+ OrcExecutor _ex, *ex = &_ex;
+ static volatile int p_inited = 0;
+ static OrcProgram *p = 0;
+ void (*func) (OrcExecutor *);
+
+ if (!p_inited) {
+ orc_once_mutex_lock ();
+ if (!p_inited) {
+
+ p = orc_program_new ();
+ orc_program_set_name (p, "orc_merge_linear_u8");
+ orc_program_set_backup_function (p, _backup_orc_merge_linear_u8);
+ orc_program_add_destination (p, 1, "d1");
+ orc_program_add_source (p, 1, "s1");
+ orc_program_add_source (p, 1, "s2");
+ orc_program_add_constant (p, 4, 0x00000080, "c1");
+ orc_program_add_parameter (p, 1, "p1");
+ orc_program_add_temporary (p, 2, "t1");
+ orc_program_add_temporary (p, 2, "t2");
+ orc_program_add_temporary (p, 1, "t3");
+ orc_program_add_temporary (p, 1, "t4");
+
+ orc_program_append_2 (p, "loadb", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "convhwb", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_D1,
+ ORC_VAR_D1);
+ orc_program_append_2 (p, "addb", 0, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3,
+ ORC_VAR_D1);
+
+ orc_program_compile (p);
+ }
+ p_inited = TRUE;
+ orc_once_mutex_unlock ();
+ }
+ ex->program = p;
+
+ ex->n = n;
+ ex->arrays[ORC_VAR_D1] = d1;
+ ex->arrays[ORC_VAR_S1] = (void *) s1;
+ ex->arrays[ORC_VAR_S2] = (void *) s2;
+ ex->params[ORC_VAR_P1] = p1;
+
+ func = p->code_exec;
+ func (ex);
+}
+#endif
diff --git a/gst-libs/gst/video/videoblendorc-dist.h b/gst-libs/gst/video/videoblendorc-dist.h
new file mode 100644
index 000000000..ce7caabfa
--- /dev/null
+++ b/gst-libs/gst/video/videoblendorc-dist.h
@@ -0,0 +1,107 @@
+
+/* autogenerated from videoblendorc.orc */
+
+#ifndef _VIDEOBLENDORC_H_
+#define _VIDEOBLENDORC_H_
+
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifndef _ORC_INTEGER_TYPEDEFS_
+#define _ORC_INTEGER_TYPEDEFS_
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <stdint.h>
+typedef int8_t orc_int8;
+typedef int16_t orc_int16;
+typedef int32_t orc_int32;
+typedef int64_t orc_int64;
+typedef uint8_t orc_uint8;
+typedef uint16_t orc_uint16;
+typedef uint32_t orc_uint32;
+typedef uint64_t orc_uint64;
+#define ORC_UINT64_C(x) UINT64_C(x)
+#elif defined(_MSC_VER)
+typedef signed __int8 orc_int8;
+typedef signed __int16 orc_int16;
+typedef signed __int32 orc_int32;
+typedef signed __int64 orc_int64;
+typedef unsigned __int8 orc_uint8;
+typedef unsigned __int16 orc_uint16;
+typedef unsigned __int32 orc_uint32;
+typedef unsigned __int64 orc_uint64;
+#define ORC_UINT64_C(x) (x##Ui64)
+#define inline __inline
+#else
+#include <limits.h>
+typedef signed char orc_int8;
+typedef short orc_int16;
+typedef int orc_int32;
+typedef unsigned char orc_uint8;
+typedef unsigned short orc_uint16;
+typedef unsigned int orc_uint32;
+#if INT_MAX == LONG_MAX
+typedef long long orc_int64;
+typedef unsigned long long orc_uint64;
+#define ORC_UINT64_C(x) (x##ULL)
+#else
+typedef long orc_int64;
+typedef unsigned long orc_uint64;
+#define ORC_UINT64_C(x) (x##UL)
+#endif
+#endif
+typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
+typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
+typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
+#endif
+#ifndef ORC_RESTRICT
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define ORC_RESTRICT restrict
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define ORC_RESTRICT __restrict__
+#else
+#define ORC_RESTRICT
+#endif
+#endif
+void orc_blend_little (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void orc_blend_big (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
+void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
+void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
+void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
+void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n);
+void orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
+void orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/gst-libs/gst/video/videoblendorc.orc b/gst-libs/gst/video/videoblendorc.orc
new file mode 100644
index 000000000..2bdae9009
--- /dev/null
+++ b/gst-libs/gst/video/videoblendorc.orc
@@ -0,0 +1,498 @@
+.function orc_blend_little
+.flags 1d
+.dest 4 d guint8
+.source 4 s guint8
+.temp 4 t
+.temp 2 tw
+.temp 1 tb
+.temp 4 a
+.temp 8 d_wide
+.temp 8 s_wide
+.temp 8 a_wide
+.const 4 a_alpha 0x000000ff
+
+loadl t, s
+convlw tw, t
+convwb tb, tw
+splatbl a, tb
+x4 convubw a_wide, a
+x4 shruw a_wide, a_wide, 8
+x4 convubw s_wide, t
+loadl t, d
+x4 convubw d_wide, t
+x4 subw s_wide, s_wide, d_wide
+x4 mullw s_wide, s_wide, a_wide
+x4 div255w s_wide, s_wide
+x4 addw d_wide, d_wide, s_wide
+x4 convwb t, d_wide
+orl t, t, a_alpha
+storel d, t
+
+.function orc_blend_big
+.flags 1d
+.dest 4 d guint8
+.source 4 s guint8
+.temp 4 t
+.temp 4 t2
+.temp 2 tw
+.temp 1 tb
+.temp 4 a
+.temp 8 d_wide
+.temp 8 s_wide
+.temp 8 a_wide
+.const 4 a_alpha 0xff000000
+
+loadl t, s
+shrul t2, t, 24
+convlw tw, t2
+convwb tb, tw
+splatbl a, tb
+x4 convubw a_wide, a
+x4 shruw a_wide, a_wide, 8
+x4 convubw s_wide, t
+loadl t, d
+x4 convubw d_wide, t
+x4 subw s_wide, s_wide, d_wide
+x4 mullw s_wide, s_wide, a_wide
+x4 div255w s_wide, s_wide
+x4 addw d_wide, d_wide, s_wide
+x4 convwb t, d_wide
+orl t, t, a_alpha
+storel d, t
+
+.function cogorc_getline_I420
+.dest 4 d guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw uv, tu, tv
+mergebw ay, c255, y
+mergewl d, ay, uv
+
+
+.function cogorc_putline_I420
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uv
+.temp 2 uu
+.temp 2 vv
+.temp 1 t1
+.temp 1 t2
+
+x2 splitlw uv, ay, ayuv
+x2 select1wb y, ay
+x2 splitwb vv, uu, uv
+splitwb t1, t2, uu
+avgub u, t1, t2
+splitwb t1, t2, vv
+avgub v, t1, t2
+
+.function cogorc_getline_YUY2
+.dest 8 ayuv guint8
+.source 4 yuy2 guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb uv, yy, yuy2
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_putline_YUY2
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, yy, uv1
+
+
+.function cogorc_putline_UYVY
+.dest 4 yuy2 guint8
+.source 8 ayuv guint8
+.temp 2 yy
+.temp 2 uv1
+.temp 2 uv2
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+x2 select1wb yy, ayay
+x2 mergebw yuy2, uv1, yy
+
+
+.function cogorc_getline_UYVY
+.dest 8 ayuv guint8
+.source 4 uyvy guint8
+.const 2 c255 0xff
+.temp 2 yy
+.temp 2 uv
+.temp 4 ayay
+.temp 4 uvuv
+
+x2 splitwb yy, uv, uyvy
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+
+.function cogorc_getline_YUV9
+.dest 8 d guint8
+.source 2 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 tuv
+.temp 4 ay
+.temp 4 uv
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw tuv, tu, tv
+mergewl uv, tuv, tuv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uv
+
+
+.function cogorc_getline_Y42B
+.dest 8 ayuv guint8
+.source 2 yy guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+.temp 4 uvuv
+.temp 4 ayay
+
+mergebw uv, u, v
+x2 mergebw ayay, c255, yy
+mergewl uvuv, uv, uv
+x2 mergewl ayuv, ayay, uvuv
+
+.function cogorc_putline_Y42B
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 8 ayuv guint8
+.temp 4 ayay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 splitlw uvuv, ayay, ayuv
+splitlw uv1, uv2, uvuv
+x2 avgub uv1, uv1, uv2
+splitwb v, u, uv1
+x2 select1wb y, ayay
+
+
+.function cogorc_getline_Y444
+.dest 4 ayuv guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 2 ay
+
+mergebw uv, u, v
+mergebw ay, c255, y
+mergewl ayuv, ay, uv
+
+
+.function cogorc_putline_Y444
+.dest 1 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.source 4 ayuv guint8
+.temp 2 ay
+.temp 2 uv
+
+splitlw uv, ay, ayuv
+splitwb v, u, uv
+select1wb y, ay
+
+.function cogorc_getline_Y800
+.dest 4 ayuv guint8
+.source 1 y guint8
+.const 1 c255 255
+.const 2 c0x8080 0x8080
+.temp 2 ay
+
+mergebw ay, c255, y
+mergewl ayuv, ay, c0x8080
+
+
+.function cogorc_putline_Y800
+.dest 1 y guint8
+.source 4 ayuv guint8
+.temp 2 ay
+
+select0lw ay, ayuv
+select1wb y, ay
+
+
+.function cogorc_putline_Y16
+.dest 2 y guint8
+.source 4 ayuv guint8
+.temp 2 ay
+.temp 1 yb
+
+select0lw ay, ayuv
+select1wb yb, ay
+convubw ay, yb
+shlw y, ay, 8
+
+
+.function cogorc_getline_Y16
+.dest 4 ayuv guint8
+.source 2 y guint8
+.const 1 c255 255
+.const 2 c0x8080 0x8080
+.temp 2 ay
+.temp 1 yb
+
+convhwb yb, y
+mergebw ay, c255, yb
+mergewl ayuv, ay, c0x8080
+
+.function cogorc_getline_BGRA
+.dest 4 argb guint8
+.source 4 bgra guint8
+
+swapl argb, bgra
+
+.function cogorc_putline_BGRA
+.dest 4 bgra guint8
+.source 4 argb guint8
+
+swapl bgra, argb
+
+.function cogorc_putline_RGBA
+.dest 4 rgba guint8
+.source 4 argb guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 rg
+.temp 2 ba
+.temp 2 ar
+.temp 2 gb
+
+splitlw gb, ar, argb
+splitwb b, g, gb
+splitwb r, a, ar
+mergebw ba, b, a
+mergebw rg, r, g
+mergewl rgba, rg, ba
+
+.function cogorc_getline_RGBA
+.dest 4 argb guint8
+.source 4 rgba guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 rg
+.temp 2 ba
+.temp 2 ar
+.temp 2 gb
+
+splitlw ba, rg, rgba
+splitwb g, r, rg
+splitwb a, b, ba
+mergebw ar, a, r
+mergebw gb, g, b
+mergewl argb, ar, gb
+
+
+.function cogorc_getline_ABGR
+.dest 4 argb guint8
+.source 4 abgr guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 gr
+.temp 2 ab
+.temp 2 ar
+.temp 2 gb
+
+splitlw gr, ab, abgr
+splitwb r, g, gr
+splitwb b, a, ab
+mergebw ar, a, r
+mergebw gb, g, b
+mergewl argb, ar, gb
+
+
+.function cogorc_putline_ABGR
+.dest 4 abgr guint8
+.source 4 argb guint8
+.temp 1 a
+.temp 1 r
+.temp 1 g
+.temp 1 b
+.temp 2 gr
+.temp 2 ab
+.temp 2 ar
+.temp 2 gb
+
+splitlw gb, ar, argb
+splitwb b, g, gb
+splitwb r, a, ar
+mergebw ab, a, b
+mergebw gr, g, r
+mergewl abgr, ab, gr
+
+.function cogorc_getline_NV12
+.dest 8 d guint8
+.source 2 y guint8
+.source 2 uv guint8
+.const 1 c255 255
+.temp 4 ay
+.temp 4 uvuv
+
+mergewl uvuv, uv, uv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uvuv
+
+.function cogorc_putline_NV12
+.dest 2 y guint8
+.dest 2 uv guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+
+x2 splitlw uvuv, ay, ayuv
+x2 select1wb y, ay
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+
+.function cogorc_getline_NV21
+.dest 8 d guint8
+.source 2 y guint8
+.source 2 vu guint8
+.const 1 c255 255
+.temp 2 uv
+.temp 4 ay
+.temp 4 uvuv
+
+swapw uv, vu
+mergewl uvuv, uv, uv
+x2 mergebw ay, c255, y
+x2 mergewl d, ay, uvuv
+
+
+.function cogorc_putline_NV21
+.dest 2 y guint8
+.dest 2 vu guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uvuv
+.temp 2 uv1
+.temp 2 uv2
+.temp 2 uv
+
+x2 splitlw uvuv, ay, ayuv
+x2 select1wb y, ay
+splitlw uv1, uv2, uvuv
+x2 avgub uv, uv1, uv2
+swapw vu, uv
+
+
+.function cogorc_getline_A420
+.dest 4 d guint8
+.source 1 y guint8
+.source 1 u guint8
+.source 1 v guint8
+.source 1 a guint8
+.temp 2 uv
+.temp 2 ay
+.temp 1 tu
+.temp 1 tv
+
+loadupdb tu, u
+loadupdb tv, v
+mergebw uv, tu, tv
+mergebw ay, a, y
+mergewl d, ay, uv
+
+.function cogorc_putline_A420
+.dest 2 y guint8
+.dest 1 u guint8
+.dest 1 v guint8
+.dest 2 a guint8
+.source 8 ayuv guint8
+.temp 4 ay
+.temp 4 uv
+.temp 2 uu
+.temp 2 vv
+.temp 1 t1
+.temp 1 t2
+
+x2 splitlw uv, ay, ayuv
+x2 select1wb y, ay
+x2 select0wb a, ay
+x2 splitwb vv, uu, uv
+splitwb t1, t2, uu
+avgub u, t1, t2
+splitwb t1, t2, vv
+avgub v, t1, t2
+
+.function orc_resample_bilinear_u32
+.dest 4 d1 guint8
+.source 4 s1 guint8
+.param 4 p1
+.param 4 p2
+
+ldreslinl d1, s1, p1, p2
+
+.function orc_merge_linear_u8
+.dest 1 d1
+.source 1 s1
+.source 1 s2
+.param 1 p1
+.temp 2 t1
+.temp 2 t2
+.temp 1 a
+.temp 1 t
+
+loadb a, s1
+convubw t1, s1
+convubw t2, s2
+subw t2, t2, t1
+mullw t2, t2, p1
+addw t2, t2, 128
+convhwb t, t2
+addb d1, t, a
diff --git a/gst-libs/gst/video/videooverlay.c b/gst-libs/gst/video/videooverlay.c
index e4d808990..172d2c5ca 100644
--- a/gst-libs/gst/video/videooverlay.c
+++ b/gst-libs/gst/video/videooverlay.c
@@ -140,6 +140,7 @@
* <title>GstVideoOverlay and Gtk+</title>
* <para>
* |[
+ * #include &lt;gst/interfaces/xoverlay.h&gt;
* #include &lt;gtk/gtk.h&gt;
* #ifdef GDK_WINDOWING_X11
* #include &lt;gdk/gdkx.h&gt; // for GDK_WINDOW_XID
@@ -179,7 +180,7 @@
* #endif
*
* #ifdef GDK_WINDOWING_X11
- * video_window_xid = GDK_WINDOW_XID (video_window->window);
+ * video_window_xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window));
* #endif
* }
* ...
@@ -207,7 +208,7 @@
* // realize window now so that the video window gets created and we can
* // obtain its XID before the pipeline is started up and the videosink
* // asks for the XID of the window to render onto
- * gtk_widget_realize (window);
+ * gtk_widget_realize (video_window);
*
* // we should have the XID now
* g_assert (video_window_xid != 0);
diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c
index f4e5ba2d6..bdae732d1 100644
--- a/gst/playback/gstdecodebin.c
+++ b/gst/playback/gstdecodebin.c
@@ -40,11 +40,16 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <gst/gst-i18n-plugin.h>
#include <string.h>
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
+#include "gst/glib-compat-private.h"
#include "gstplay-marshal.h"
diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c
index 137d27df0..ef2aefbd9 100644
--- a/gst/playback/gstdecodebin2.c
+++ b/gst/playback/gstdecodebin2.c
@@ -85,6 +85,10 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <gst/gst-i18n-plugin.h>
#include <string.h>
@@ -96,6 +100,8 @@
#include "gstplayback.h"
#include "gstrawcaps.h"
+#include "gst/glib-compat-private.h"
+
/* generic templates */
static GstStaticPadTemplate decoder_bin_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
index 4347e6a06..e7ce0aa5e 100644
--- a/gst/playback/gstplaybin2.c
+++ b/gst/playback/gstplaybin2.c
@@ -217,6 +217,10 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <string.h>
#include <gst/gst.h>
@@ -230,6 +234,8 @@
#include "gstplaysink.h"
#include "gstsubtitleoverlay.h"
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
#define GST_CAT_DEFAULT gst_play_bin_debug
diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c
index 972c32383..abad05070 100644
--- a/gst/playback/gstplaysink.c
+++ b/gst/playback/gstplaysink.c
@@ -22,6 +22,10 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <string.h>
#include <gst/gst.h>
diff --git a/gst/playback/gstplaysinkconvertbin.c b/gst/playback/gstplaysinkconvertbin.c
index 974b5ab6e..572623e03 100644
--- a/gst/playback/gstplaysinkconvertbin.c
+++ b/gst/playback/gstplaysinkconvertbin.c
@@ -26,6 +26,7 @@
#include <gst/pbutils/pbutils.h>
#include <gst/gst-i18n-plugin.h>
+#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_play_sink_convert_bin_debug);
#define GST_CAT_DEFAULT gst_play_sink_convert_bin_debug
diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
index 5dca2820d..de6b35eb9 100644
--- a/gst/playback/gststreamsynchronizer.c
+++ b/gst/playback/gststreamsynchronizer.c
@@ -21,7 +21,12 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gststreamsynchronizer.h"
+#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (stream_synchronizer_debug);
#define GST_CAT_DEFAULT stream_synchronizer_debug
diff --git a/gst/playback/gstsubtitleoverlay.c b/gst/playback/gstsubtitleoverlay.c
index 03dea41cc..3ff5107ed 100644
--- a/gst/playback/gstsubtitleoverlay.c
+++ b/gst/playback/gstsubtitleoverlay.c
@@ -44,6 +44,8 @@
#include <gst/video/video.h>
#include <string.h>
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_STATIC (subtitle_overlay_debug);
#define GST_CAT_DEFAULT subtitle_overlay_debug
@@ -236,16 +238,32 @@ _is_raw_video (GstStructure * s)
}
static gboolean
-_is_raw_video_pad (GstPad * pad)
+_is_video_pad (GstPad * pad, gboolean * hw_accelerated)
{
GstCaps *caps = gst_pad_get_current_caps (pad);
- gboolean raw;
+ gboolean ret;
+ const gchar *name;
- raw = _is_raw_video (gst_caps_get_structure (caps, 0));
+ name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
+ if (g_str_has_prefix (name, "video/x-raw-")) {
+ ret = TRUE;
+ if (hw_accelerated)
+ *hw_accelerated = FALSE;
+
+ } else if (g_str_has_prefix (name, "video/x-surface")) {
+ ret = TRUE;
+ if (hw_accelerated)
+ *hw_accelerated = TRUE;
+ } else {
+
+ ret = FALSE;
+ if (hw_accelerated)
+ *hw_accelerated = FALSE;
+ }
gst_caps_unref (caps);
- return raw;
+ return ret;
}
static GstCaps *
@@ -856,7 +874,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
for (l = factories; l; l = l->next) {
GstElementFactory *factory = l->data;
- gboolean is_renderer = _is_renderer (factory);
+ gboolean is_video, is_hw, is_renderer = _is_renderer (factory);
GstElement *element;
GstPad *sink, *src;
@@ -887,6 +905,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
element = is_renderer ? self->renderer : self->parser;
+ is_video = _is_video_pad (self->video_sinkpad, &is_hw);
/* If this is a parser, create textoverlay and link video and the parser to it
* Else link the renderer to the output colorspace */
if (!is_renderer) {
@@ -967,84 +986,113 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
gst_object_unref (sink);
gst_object_unref (src);
- if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
- COLORSPACE, NULL, "post-colorspace", FALSE))) {
- continue;
- }
+ /* If we are working with video/x-surface, we do not add
+ * colorspace conversion elements */
+ if (is_video && !is_hw) {
+ if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
+ COLORSPACE, NULL, "post-colorspace", FALSE))) {
+ continue;
+ }
- src = gst_element_get_static_pad (overlay, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from overlay");
- continue;
- }
+ src = gst_element_get_static_pad (overlay, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from overlay");
+ continue;
+ }
- sink = gst_element_get_static_pad (self->post_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
- gst_object_unref (src);
- continue;
- }
+ sink = gst_element_get_static_pad (self->post_colorspace, "sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
+ gst_object_unref (src);
+ continue;
+ }
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link overlay with " COLORSPACE);
+ if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
+ GST_WARNING_OBJECT (self, "Can't link overlay with " COLORSPACE);
+ gst_object_unref (src);
+ gst_object_unref (sink);
+ continue;
+ }
gst_object_unref (src);
gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
- if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
- COLORSPACE, NULL, "pre-colorspace", FALSE))) {
- continue;
- }
+ if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
+ "identity", NULL, "pre-colorspace", FALSE))) {
+ continue;
+ }
- sink = gst_element_get_static_pad (overlay, "video_sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get video sink from textoverlay");
- continue;
- }
+ sink = gst_element_get_static_pad (overlay, "video_sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get video sink from textoverlay");
+ continue;
+ }
- src = gst_element_get_static_pad (self->pre_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
- gst_object_unref (sink);
- continue;
- }
+ src = gst_element_get_static_pad (self->pre_colorspace, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
+ gst_object_unref (sink);
+ continue;
+ }
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to textoverlay");
+ if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
+ GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to textoverlay");
+ gst_object_unref (src);
+ gst_object_unref (sink);
+ continue;
+ }
gst_object_unref (src);
gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
- /* Set src ghostpad target */
- src = gst_element_get_static_pad (self->post_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
- continue;
- }
+ /* Set src ghostpad target */
+ src = gst_element_get_static_pad (self->post_colorspace, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
+ continue;
+ }
- if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
- (self->srcpad), src))) {
- GST_WARNING_OBJECT (self, "Can't set srcpad target");
+ if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
+ (self->srcpad), src))) {
+ GST_WARNING_OBJECT (self, "Can't set srcpad target");
+ gst_object_unref (src);
+ continue;
+ }
+ gst_object_unref (src);
+ } else if (is_hw) {
+ GST_DEBUG_OBJECT (self,
+ "Is Hardware, not adding colorspace converters, ");
+ /* Set src ghostpad target */
+ src = gst_element_get_static_pad (self->overlay, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from textoverlay");
+ continue;
+ }
+
+ if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
+ (self->srcpad), src))) {
+ GST_WARNING_OBJECT (self, "Can't set srcpad target");
+ gst_object_unref (src);
+ continue;
+ }
gst_object_unref (src);
- continue;
}
- gst_object_unref (src);
/* Send segments to the parser/overlay if necessary. These are not sent
* outside this element because of the proxy pad event function */
if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
GstEvent *event1;
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
- continue;
+ if (is_video) {
+ sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
+ continue;
+ }
+ } else {
+ sink = gst_element_get_static_pad (self->overlay, "video_sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from textoverlay");
+ continue;
+ }
}
_generate_update_segment_event (&self->video_segment, &event1);
@@ -1073,10 +1121,19 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
}
/* Set the sink ghostpad targets */
- sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
- continue;
+ if (is_video && !is_hw) {
+ sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
+ continue;
+ }
+ } else if (is_video && is_hw) {
+ GST_DEBUG_OBJECT (self, "Setting ghostpad to overlay video sink");
+ sink = gst_element_get_static_pad (self->overlay, "video_sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from overlay");
+ continue;
+ }
}
if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
@@ -1104,7 +1161,6 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
} else {
const gchar *name =
gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST (factory));
- gboolean is_raw_video = _is_raw_video_pad (self->video_sinkpad);
if (strcmp (name, "textoverlay") == 0) {
/* Set some textoverlay specific properties */
@@ -1124,82 +1180,96 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
g_object_set (self->renderer, "font-desc", self->font_desc, NULL);
}
- if (is_raw_video) {
- /* First check that renderer also supports raw video */
+ if (is_video) {
+ gboolean render_is_hw;
+
+ /* First check that renderer also supports the video format */
sink = _get_video_pad (element);
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
continue;
}
- if (G_UNLIKELY (!_is_raw_video_pad (sink))) {
- GST_DEBUG_OBJECT (self, "Renderer doesn't support raw video");
+ if (is_video != _is_video_pad (sink, &render_is_hw) ||
+ is_hw != render_is_hw) {
+ GST_DEBUG_OBJECT (self, "Renderer doesn't support %s video",
+ is_hw ? "surface" : "raw");
gst_object_unref (sink);
continue;
}
gst_object_unref (sink);
- /* First link everything internally */
- if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
- COLORSPACE, NULL, "post-colorspace", FALSE))) {
- continue;
- }
- src = gst_element_get_static_pad (element, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
- continue;
- }
+ if (!is_hw) {
+ /* First link everything internally */
+ if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
+ COLORSPACE, NULL, "post-colorspace", FALSE))) {
+ continue;
+ }
+ src = gst_element_get_static_pad (element, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
+ continue;
+ }
- sink = gst_element_get_static_pad (self->post_colorspace, "sink");
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
- gst_object_unref (src);
- continue;
- }
+ sink = gst_element_get_static_pad (self->post_colorspace, "sink");
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
+ gst_object_unref (src);
+ continue;
+ }
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link renderer with " COLORSPACE);
+ if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
+ GST_WARNING_OBJECT (self, "Can't link renderer with " COLORSPACE);
+ gst_object_unref (src);
+ gst_object_unref (sink);
+ continue;
+ }
gst_object_unref (src);
gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
- if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
- COLORSPACE, NULL, "pre-colorspace", FALSE))) {
- continue;
- }
+ if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
+ COLORSPACE, NULL, "pre-colorspace", FALSE))) {
+ continue;
+ }
- sink = _get_video_pad (element);
- if (G_UNLIKELY (!sink)) {
- GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
- continue;
- }
+ sink = _get_video_pad (element);
+ if (G_UNLIKELY (!sink)) {
+ GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
+ continue;
+ }
- src = gst_element_get_static_pad (self->pre_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
- gst_object_unref (sink);
- continue;
- }
+ src = gst_element_get_static_pad (self->pre_colorspace, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
+ gst_object_unref (sink);
+ continue;
+ }
- if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
- GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to renderer");
+ if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
+ GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to renderer");
+ gst_object_unref (src);
+ gst_object_unref (sink);
+ continue;
+ }
gst_object_unref (src);
gst_object_unref (sink);
- continue;
- }
- gst_object_unref (src);
- gst_object_unref (sink);
- /* Set src ghostpad target */
- src = gst_element_get_static_pad (self->post_colorspace, "src");
- if (G_UNLIKELY (!src)) {
- GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
- continue;
+ /* Set src ghostpad target */
+ src = gst_element_get_static_pad (self->post_colorspace, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
+ continue;
+ }
+ } else {
+ /* Set src ghostpad target in the harware accelerated case */
+
+ src = gst_element_get_static_pad (self->renderer, "src");
+ if (G_UNLIKELY (!src)) {
+ GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
+ continue;
+ }
}
- } else { /* No raw video pad */
+ } else { /* No video pad */
GstCaps *allowed_caps, *video_caps = NULL;
GstPad *video_peer;
gboolean can_intersect = FALSE;
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c
index 5fc319e5f..4138d388d 100644
--- a/gst/playback/gsturidecodebin.c
+++ b/gst/playback/gsturidecodebin.c
@@ -39,6 +39,8 @@
#include "gstrawcaps.h"
#include "gstplayback.h"
+#include "gst/glib-compat-private.h"
+
#define GST_TYPE_URI_DECODE_BIN \
(gst_uri_decode_bin_get_type())
#define GST_URI_DECODE_BIN(obj) \
diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c
index 5a5d29219..6c0e6b777 100644
--- a/gst/tcp/gstmultifdsink.c
+++ b/gst/tcp/gstmultifdsink.c
@@ -101,6 +101,11 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <gst/gst-i18n-plugin.h>
#include <sys/ioctl.h>
@@ -2762,8 +2767,14 @@ gst_multi_fd_sink_start (GstBaseSink * bsink)
}
this->running = TRUE;
+
+#if !GLIB_CHECK_VERSION (2, 31, 0)
this->thread = g_thread_create ((GThreadFunc) gst_multi_fd_sink_thread,
this, TRUE, NULL);
+#else
+ this->thread = g_thread_new ("multifdsink",
+ (GThreadFunc) gst_multi_fd_sink_thread, this);
+#endif
GST_OBJECT_FLAG_SET (this, GST_MULTI_FD_SINK_OPEN);
diff --git a/gst/videorate/gstvideorate.c b/gst/videorate/gstvideorate.c
index 8313eb69d..57d5071e6 100644
--- a/gst/videorate/gstvideorate.c
+++ b/gst/videorate/gstvideorate.c
@@ -139,6 +139,7 @@ static GstFlowReturn gst_video_rate_transform_ip (GstBaseTransform * trans,
GstBuffer * buf);
static gboolean gst_video_rate_start (GstBaseTransform * trans);
+static gboolean gst_video_rate_stop (GstBaseTransform * trans);
static void gst_video_rate_set_property (GObject * object,
@@ -168,6 +169,7 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
base_class->transform_ip = GST_DEBUG_FUNCPTR (gst_video_rate_transform_ip);
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_video_rate_sink_event);
base_class->start = GST_DEBUG_FUNCPTR (gst_video_rate_start);
+ base_class->stop = GST_DEBUG_FUNCPTR (gst_video_rate_stop);
base_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_rate_fixate_caps);
base_class->query = GST_DEBUG_FUNCPTR (gst_video_rate_query);
@@ -1114,6 +1116,13 @@ gst_video_rate_start (GstBaseTransform * trans)
return TRUE;
}
+static gboolean
+gst_video_rate_stop (GstBaseTransform * trans)
+{
+ gst_video_rate_reset (GST_VIDEO_RATE (trans));
+ return TRUE;
+}
+
static void
gst_video_rate_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
index a220b8fb8..248dec3f3 100644
--- a/sys/ximage/ximagesink.c
+++ b/sys/ximage/ximagesink.c
@@ -115,6 +115,8 @@
/* Debugging category */
#include <gst/gstinfo.h>
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_ximagesink
@@ -738,8 +740,13 @@ gst_ximagesink_manage_event_thread (GstXImageSink * ximagesink)
GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
ximagesink->handle_expose, ximagesink->handle_events);
ximagesink->running = TRUE;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
ximagesink->event_thread = g_thread_create (
(GThreadFunc) gst_ximagesink_event_thread, ximagesink, TRUE, NULL);
+#else
+ ximagesink->event_thread = g_thread_try_new ("ximagesink-events",
+ (GThreadFunc) gst_ximagesink_event_thread, ximagesink, NULL);
+#endif
}
} else {
if (ximagesink->event_thread) {
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index f5a6be0ce..a54e18f6e 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -127,6 +127,8 @@
/* Debugging category */
#include <gst/gstinfo.h>
+#include "gst/glib-compat-private.h"
+
GST_DEBUG_CATEGORY_EXTERN (gst_debug_xvimagesink);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_xvimagesink
@@ -1175,8 +1177,13 @@ gst_xvimagesink_manage_event_thread (GstXvImageSink * xvimagesink)
GST_DEBUG_OBJECT (xvimagesink, "run xevent thread, expose %d, events %d",
xvimagesink->handle_expose, xvimagesink->handle_events);
xvimagesink->running = TRUE;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
xvimagesink->event_thread = g_thread_create (
(GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, TRUE, NULL);
+#else
+ xvimagesink->event_thread = g_thread_try_new ("xvimagesink-events",
+ (GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, NULL);
+#endif
}
} else {
if (xvimagesink->event_thread) {
diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c
index 1d826f064..2abd7cdfd 100644
--- a/tests/check/libs/video.c
+++ b/tests/check/libs/video.c
@@ -2,7 +2,7 @@
*
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
* Copyright (C) <2006> Jan Schmidt <thaytan@mad.scientist.com>
- * Copyright (C) <2008> Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) <2008,2011> Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -29,6 +29,7 @@
#include <gst/check/gstcheck.h>
#include <gst/video/video.h>
+#include <gst/video/video-overlay-composition.h>
#include <string.h>
/* These are from the current/old videotestsrc; we check our new public API
@@ -845,6 +846,151 @@ GST_START_TEST (test_video_size_from_caps)
GST_END_TEST;
+#undef ASSERT_CRITICAL
+#define ASSERT_CRITICAL(code) while(0){} /* nothing */
+
+GST_START_TEST (test_overlay_composition)
+{
+ GstVideoOverlayComposition *comp1, *comp2;
+ GstVideoOverlayRectangle *rect1, *rect2;
+ GstBuffer *pix1, *pix2, *buf;
+ guint seq1, seq2;
+ guint w, h, stride;
+ gint x, y;
+
+ pix1 = gst_buffer_new_and_alloc (200 * sizeof (guint32) * 50);
+ memset (GST_BUFFER_DATA (pix1), 0, GST_BUFFER_SIZE (pix1));
+
+ rect1 = gst_video_overlay_rectangle_new_argb (pix1, 200, 50, 200 * 4,
+ 600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+
+ gst_buffer_unref (pix1);
+ pix1 = NULL;
+
+ comp1 = gst_video_overlay_composition_new (rect1);
+ fail_unless (gst_video_overlay_composition_n_rectangles (comp1) == 1);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 0) == rect1);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 1) == NULL);
+
+ /* rectangle was created first, sequence number should be smaller */
+ seq1 = gst_video_overlay_rectangle_get_seqnum (rect1);
+ seq2 = gst_video_overlay_composition_get_seqnum (comp1);
+ fail_unless (seq1 < seq2);
+
+ /* composition took own ref, so refcount is 2 now, so this should fail */
+ ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 50,
+ 600, 300, 50));
+
+ /* drop our ref, so refcount is 1 (we know it will continue to be valid) */
+ gst_video_overlay_rectangle_unref (rect1);
+ gst_video_overlay_rectangle_set_render_rectangle (rect1, 50, 600, 300, 50);
+
+ comp2 = gst_video_overlay_composition_new (rect1);
+ fail_unless (gst_video_overlay_composition_n_rectangles (comp2) == 1);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect1);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
+
+ fail_unless (seq1 < gst_video_overlay_composition_get_seqnum (comp2));
+ fail_unless (seq2 < gst_video_overlay_composition_get_seqnum (comp2));
+
+ /* now refcount is 2 again because comp2 has also taken a ref, so must fail */
+ ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 0,
+ 0, 1, 1));
+
+ /* this should make a copy of the rectangles so drop the original
+ * second ref on rect1 */
+ comp2 = gst_video_overlay_composition_make_writable (comp2);
+ gst_video_overlay_rectangle_set_render_rectangle (rect1, 51, 601, 301, 51);
+
+ rect2 = gst_video_overlay_composition_get_rectangle (comp2, 0);
+ fail_unless (gst_video_overlay_composition_n_rectangles (comp2) == 1);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect2);
+ fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
+ fail_unless (rect1 != rect2);
+
+ gst_video_overlay_composition_add_rectangle (comp1, rect2);
+ gst_video_overlay_composition_ref (comp1);
+ ASSERT_CRITICAL (gst_video_overlay_composition_add_rectangle (comp1, rect2));
+ gst_video_overlay_composition_unref (comp1);
+
+ /* make sure the copy really worked */
+ gst_video_overlay_rectangle_get_render_rectangle (rect1, &x, &y, &w, &h);
+ fail_unless_equals_int (x, 51);
+ fail_unless_equals_int (y, 601);
+ fail_unless_equals_int (w, 301);
+ fail_unless_equals_int (h, 51);
+
+ /* get scaled pixbuf and touch last byte */
+ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1),
+ "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
+ ((h - 1) * stride + (w * 4) - 1));
+ fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride +
+ (w * 4) - 1)), 0);
+
+ gst_video_overlay_rectangle_get_render_rectangle (rect2, &x, &y, &w, &h);
+ fail_unless_equals_int (x, 50);
+ fail_unless_equals_int (y, 600);
+ fail_unless_equals_int (w, 300);
+ fail_unless_equals_int (h, 50);
+
+ /* get scaled pixbuf and touch last byte */
+ pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ fail_unless (GST_BUFFER_SIZE (pix2) > ((h - 1) * stride + (w * 4) - 1),
+ "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
+ ((h - 1) * stride + (w * 4) - 1));
+ fail_unless_equals_int (*(GST_BUFFER_DATA (pix2) + ((h - 1) * stride +
+ (w * 4) - 1)), 0);
+
+ /* get scaled pixbuf again, should be the same buffer as before (caching) */
+ pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
+ GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ fail_unless (pix1 == pix2);
+
+ /* now compare the original unscaled ones */
+ pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
+ &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+ pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect2, &w, &h,
+ &stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
+
+ /* the original pixel buffers should be identical */
+ fail_unless (pix1 == pix2);
+ fail_unless_equals_int (w, 200);
+ fail_unless_equals_int (h, 50);
+
+ /* touch last byte */
+ fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1),
+ "size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
+ ((h - 1) * stride + (w * 4) - 1));
+ fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride +
+ (w * 4) - 1)), 0);
+
+ /* test attaching and retrieving of compositions to/from buffers */
+ buf = gst_buffer_new ();
+ fail_unless (gst_video_buffer_get_overlay_composition (buf) == NULL);
+
+ gst_buffer_ref (buf);
+ ASSERT_CRITICAL (gst_video_buffer_set_overlay_composition (buf, comp1));
+ gst_buffer_unref (buf);
+ gst_video_buffer_set_overlay_composition (buf, comp1);
+ fail_unless (gst_video_buffer_get_overlay_composition (buf) == comp1);
+ gst_video_buffer_set_overlay_composition (buf, comp2);
+ fail_unless (gst_video_buffer_get_overlay_composition (buf) == comp2);
+ gst_video_buffer_set_overlay_composition (buf, NULL);
+ fail_unless (gst_video_buffer_get_overlay_composition (buf) == NULL);
+
+ /* make sure the buffer cleans up its composition ref when unreffed */
+ gst_video_buffer_set_overlay_composition (buf, comp2);
+ gst_buffer_unref (buf);
+
+ gst_video_overlay_composition_unref (comp2);
+ gst_video_overlay_composition_unref (comp1);
+}
+
+GST_END_TEST;
+
static Suite *
video_suite (void)
{
@@ -861,6 +1007,7 @@ video_suite (void)
tcase_add_test (tc_chain, test_convert_frame);
tcase_add_test (tc_chain, test_convert_frame_async);
tcase_add_test (tc_chain, test_video_size_from_caps);
+ tcase_add_test (tc_chain, test_overlay_composition);
return s;
}
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
index 5025dc82c..a994b384e 100644
--- a/tests/examples/Makefile.am
+++ b/tests/examples/Makefile.am
@@ -8,9 +8,8 @@ if USE_GIO
GIO_SUBDIRS = gio
endif
-SUBDIRS = app audio dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec encoding
-
-DIST_SUBDIRS = app audio dynamic gio overlay seek snapshot playrec encoding
+SUBDIRS = app audio dynamic fft $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec encoding
+DIST_SUBDIRS = app audio dynamic fft gio overlay seek snapshot playrec encoding
include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/tests/examples/encoding/encoding.c b/tests/examples/encoding/encoding.c
index dc65d1e8b..bb0072a86 100644
--- a/tests/examples/encoding/encoding.c
+++ b/tests/examples/encoding/encoding.c
@@ -395,8 +395,10 @@ main (int argc, char **argv)
GstEncodingProfile *prof;
gchar *inputuri;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("- encode URIs with GstProfile and encodebin");
g_option_context_add_main_entries (ctx, options, NULL);
diff --git a/tests/examples/fft/.gitignore b/tests/examples/fft/.gitignore
new file mode 100644
index 000000000..74f063698
--- /dev/null
+++ b/tests/examples/fft/.gitignore
@@ -0,0 +1,2 @@
+fftrange
+
diff --git a/tests/examples/fft/Makefile.am b/tests/examples/fft/Makefile.am
new file mode 100644
index 000000000..c5a2d96fa
--- /dev/null
+++ b/tests/examples/fft/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_PROGRAMS = fftrange
+fftrange_SOURCES = fftrange.c
+fftrange_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
+fftrange_LDADD = \
+ $(top_builddir)/gst-libs/gst/fft/libgstfft-$(GST_MAJORMINOR).la \
+ $(GST_LIBS)
+
diff --git a/tests/examples/fft/fftrange.c b/tests/examples/fft/fftrange.c
new file mode 100644
index 000000000..956f4a352
--- /dev/null
+++ b/tests/examples/fft/fftrange.c
@@ -0,0 +1,184 @@
+/* GStreamer
+ * (c) 2011 Stefan Kost <ensonic@users.sf.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <gst/fft/gstffts16.h>
+#include <gst/fft/gstffts32.h>
+#include <gst/fft/gstfftf32.h>
+#include <gst/fft/gstfftf64.h>
+
+/* effectively max range seems to be 1/4 of what it should be */
+
+#define MAKE_I_TEST(_g_,_G_,_t_,_T_,_f_) \
+static void \
+test_##_t_ (const gchar *test_name, gint num_freq, gint window) \
+{ \
+ GstFFT ##_T_ *ctx; \
+ GstFFT ##_T_ ##Complex *fdata; \
+ _g_ *adata; \
+ _g_ maxfr = 0, maxfi = 0; \
+ gint num_samples = num_freq * 2 - 2; \
+ gint s, f; \
+ \
+ ctx = gst_fft_ ##_t_ ##_new (num_samples, FALSE); \
+ fdata = g_new (GstFFT ##_T_ ##Complex, num_freq); \
+ adata = g_new (_g_, num_samples); \
+ \
+ for (s = 0; s < num_samples;) { \
+ adata[s++]=G_MIN##_G_; \
+ adata[s++]=G_MAX##_G_; \
+ } \
+ \
+ gst_fft_ ##_t_ ##_window (ctx, adata, window); \
+ gst_fft_ ##_t_ ##_fft (ctx, adata, fdata); \
+ \
+ for (f = 0; f < num_freq; f++) { \
+ if (fdata[1+f].r > maxfr) \
+ maxfr = fdata[1+f].r; \
+ if (fdata[1+f].i > maxfi) \
+ maxfi = fdata[1+f].i; \
+ } \
+ \
+ printf (#_t_" %-15s: maxfr: %"_f_" %10.5f maxfi: %"_f_" %10.5f\n",\
+ test_name, \
+ maxfr, (gfloat)G_MAX##_G_/maxfr, \
+ maxfi, (gfloat)G_MAX##_G_/maxfi); \
+ \
+ gst_fft_ ##_t_ ##_free (ctx); \
+ g_free (fdata); \
+ g_free (adata); \
+}
+
+MAKE_I_TEST (gint16, INT16, s16, S16, "6d");
+MAKE_I_TEST (gint32, INT32, s32, S32, "9d");
+
+#define MAKE_F_TEST(_g_,_G_,_t_,_T_,_f_) \
+static void \
+test_##_t_ (const gchar *test_name, gint num_freq, gint window) \
+{ \
+ GstFFT ##_T_ *ctx; \
+ GstFFT ##_T_ ##Complex *fdata; \
+ _g_ *adata; \
+ _g_ maxfr = 0, maxfi = 0; \
+ gint num_samples = num_freq * 2 - 2; \
+ gint s, f; \
+ \
+ ctx = gst_fft_ ##_t_ ##_new (num_samples, FALSE); \
+ fdata = g_new (GstFFT ##_T_ ##Complex, num_freq); \
+ adata = g_new (_g_, num_samples); \
+ \
+ for (s = 0; s < num_samples;) { \
+ adata[s++]=-1.0; \
+ adata[s++]=+1.0; \
+ } \
+ \
+ gst_fft_ ##_t_ ##_window (ctx, adata, window); \
+ gst_fft_ ##_t_ ##_fft (ctx, adata, fdata); \
+ \
+ for (f = 0; f < num_freq; f++) { \
+ if (fdata[1+f].r > maxfr) \
+ maxfr = fdata[1+f].r; \
+ if (fdata[1+f].i > maxfi) \
+ maxfi = fdata[1+f].i; \
+ } \
+ \
+ printf (#_t_" %-15s: maxfr: %"_f_" %10.5f maxfi: %"_f_" %10.5f\n",\
+ test_name, \
+ maxfr, (gfloat)1.0/maxfr, \
+ maxfi, (gfloat)1.0/maxfi); \
+ \
+ gst_fft_ ##_t_ ##_free (ctx); \
+ g_free (fdata); \
+ g_free (adata); \
+}
+
+MAKE_F_TEST (gfloat, FLOAT, f32, F32, "10.5f");
+MAKE_F_TEST (gdouble, DOUBLE, f64, F64, "10.5f");
+
+gint
+main (gint argc, gchar * argv[])
+{
+ gint num_bands;
+
+ gst_init (&argc, &argv);
+
+ num_bands = 200;
+ test_s16 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_s16 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_s16 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_s16 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_s16 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("");
+
+ num_bands = 300;
+ test_s16 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_s16 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_s16 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_s16 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_s16 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("\n");
+
+ num_bands = 200;
+ test_s32 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_s32 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_s32 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_s32 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_s32 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("");
+
+ num_bands = 300;
+ test_s32 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_s32 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_s32 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_s32 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_s32 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("\n");
+
+ num_bands = 200;
+ test_f32 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_f32 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_f32 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_f32 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_f32 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("");
+
+ num_bands = 300;
+ test_f32 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_f32 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_f32 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_f32 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_f32 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("\n");
+
+ num_bands = 200;
+ test_f64 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_f64 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_f64 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_f64 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_f64 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("");
+
+ num_bands = 300;
+ test_f64 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
+ test_f64 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
+ test_f64 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
+ test_f64 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
+ test_f64 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
+ puts ("\n");
+}
diff --git a/tests/examples/overlay/gtk-videooverlay.c b/tests/examples/overlay/gtk-videooverlay.c
index e722bfeaa..f09c89545 100644
--- a/tests/examples/overlay/gtk-videooverlay.c
+++ b/tests/examples/overlay/gtk-videooverlay.c
@@ -98,8 +98,10 @@ main (int argc, char **argv)
gulong embed_xid;
GstStateChangeReturn sret;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
diff --git a/tests/examples/overlay/qt-videooverlay.cpp b/tests/examples/overlay/qt-videooverlay.cpp
index d33c51dc1..451d22cfd 100644
--- a/tests/examples/overlay/qt-videooverlay.cpp
+++ b/tests/examples/overlay/qt-videooverlay.cpp
@@ -80,8 +80,10 @@ find_video_sink (void)
int main(int argc, char *argv[])
{
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
gst_init (&argc, &argv);
QApplication app(argc, argv);
diff --git a/tests/examples/seek/jsseek.c b/tests/examples/seek/jsseek.c
index 3a7fde041..d13a53389 100644
--- a/tests/examples/seek/jsseek.c
+++ b/tests/examples/seek/jsseek.c
@@ -2676,8 +2676,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);
diff --git a/tests/examples/seek/scrubby.c b/tests/examples/seek/scrubby.c
index f399cb47a..47b062ca2 100644
--- a/tests/examples/seek/scrubby.c
+++ b/tests/examples/seek/scrubby.c
@@ -458,8 +458,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("seek");
g_option_context_add_main_entries (ctx, options, NULL);
diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c
index 86d766359..6c439e76c 100644
--- a/tests/examples/seek/seek.c
+++ b/tests/examples/seek/seek.c
@@ -1809,8 +1809,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);
diff --git a/tests/icles/stress-playbin.c b/tests/icles/stress-playbin.c
index 3b9071033..30970ce0d 100644
--- a/tests/icles/stress-playbin.c
+++ b/tests/icles/stress-playbin.c
@@ -100,8 +100,10 @@ main (int argc, char **argv)
};
GTimer *timer;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx = g_option_context_new ("FILES OR DIRECTORIES WITH AUDIO FILES");
g_option_context_add_main_entries (ctx, options, NULL);
diff --git a/tests/icles/test-colorkey.c b/tests/icles/test-colorkey.c
index d79834ab2..13634d088 100644
--- a/tests/icles/test-colorkey.c
+++ b/tests/icles/test-colorkey.c
@@ -172,8 +172,10 @@ main (int argc, char **argv)
GstPropertyProbe *probe;
GValueArray *arr;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
diff --git a/tests/icles/test-videooverlay.c b/tests/icles/test-videooverlay.c
index a3bb25bc0..176d91f2f 100644
--- a/tests/icles/test-videooverlay.c
+++ b/tests/icles/test-videooverlay.c
@@ -144,8 +144,10 @@ main (gint argc, gchar ** argv)
gulong embed_xid = 0;
gboolean force_aspect = FALSE, draw_borders = FALSE;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c
index 5b2a74be4..c29045d80 100644
--- a/tools/gst-discoverer.c
+++ b/tools/gst-discoverer.c
@@ -499,8 +499,10 @@ main (int argc, char **argv)
};
GOptionContext *ctx;
+#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
+#endif
ctx =
g_option_context_new