diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-06-15 16:32:03 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-06-15 16:32:03 +0200 |
commit | af6d20d90a26664a04cf7827b5272053caad81ff (patch) | |
tree | c078bdc7e469a5cbf890624bc1e63fcbddc117ea | |
parent | a2b7a672b8826d9fb75f0889741c05ca76ce085f (diff) |
Moved 'colorspace' from -bad to -basemoving-colorspace
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | gst/colorspace/Makefile.am | 35 | ||||
-rw-r--r-- | gst/colorspace/colorspace.c | 2399 | ||||
-rw-r--r-- | gst/colorspace/colorspace.h | 97 | ||||
-rw-r--r-- | gst/colorspace/colorspace.vcproj | 154 | ||||
-rw-r--r-- | gst/colorspace/gstcolorspace.c | 593 | ||||
-rw-r--r-- | gst/colorspace/gstcolorspace.h | 69 | ||||
-rw-r--r-- | gst/colorspace/gstcolorspaceorc-dist.c | 19395 | ||||
-rw-r--r-- | gst/colorspace/gstcolorspaceorc-dist.h | 168 | ||||
-rw-r--r-- | gst/colorspace/gstcolorspaceorc.orc | 1757 |
10 files changed, 0 insertions, 24669 deletions
diff --git a/configure.ac b/configure.ac index 202657a2a..1c4c7d401 100644 --- a/configure.ac +++ b/configure.ac @@ -304,7 +304,6 @@ AG_GST_CHECK_PLUGIN(camerabin) AG_GST_CHECK_PLUGIN(camerabin2) AG_GST_CHECK_PLUGIN(cdxaparse) AG_GST_CHECK_PLUGIN(coloreffects) -AG_GST_CHECK_PLUGIN(colorspace) AG_GST_CHECK_PLUGIN(dataurisrc) AG_GST_CHECK_PLUGIN(dccp) AG_GST_CHECK_PLUGIN(debugutils) @@ -1854,7 +1853,6 @@ gst/bayer/Makefile gst/camerabin/Makefile gst/camerabin2/Makefile gst/cdxaparse/Makefile -gst/colorspace/Makefile gst/coloreffects/Makefile gst/dataurisrc/Makefile gst/dccp/Makefile diff --git a/gst/colorspace/Makefile.am b/gst/colorspace/Makefile.am deleted file mode 100644 index c5f5bd4cb..000000000 --- a/gst/colorspace/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -plugin_LTLIBRARIES = libgstcolorspace.la - -ORC_SOURCE=gstcolorspaceorc -include $(top_srcdir)/common/orc.mak - -libgstcolorspace_la_SOURCES = gstcolorspace.c colorspace.c -nodist_libgstcolorspace_la_SOURCES = $(ORC_NODIST_SOURCES) -libgstcolorspace_la_CFLAGS = \ - $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_CFLAGS) \ - $(ORC_CFLAGS) -libgstcolorspace_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ - $(GST_BASE_LIBS) \ - $(GST_LIBS) \ - $(ORC_LIBS) -libgstcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstcolorspace_la_LIBTOOLFLAGS = --tag=disable-static - -noinst_HEADERS = gstcolorspace.h colorspace.h - -Android.mk: Makefile.am $(BUILT_SOURCES) - androgenizer \ - -:PROJECT libgstcolorspace -:SHARED libgstcolorspace \ - -:TAGS eng debug \ - -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ - -:SOURCES $(libgstcolorspace_la_SOURCES) \ - $(nodist_libgstcolorspace_la_SOURCES) \ - -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcolorspace_la_CFLAGS) \ - -:LDFLAGS $(libgstcolorspace_la_LDFLAGS) \ - $(libgstcolorspace_la_LIBADD) \ - -ldl \ - -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ - LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ - > $@ diff --git a/gst/colorspace/colorspace.c b/gst/colorspace/colorspace.c deleted file mode 100644 index 8bcd2c429..000000000 --- a/gst/colorspace/colorspace.c +++ /dev/null @@ -1,2399 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 David Schleef <ds@schleef.org> - * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk> - * - * 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 "colorspace.h" -#include <glib.h> -#include <string.h> -#include "gstcolorspaceorc.h" - - -static void colorspace_convert_generic (ColorspaceConvert * convert, - guint8 * dest, const guint8 * src); -static void colorspace_convert_lookup_fastpath (ColorspaceConvert * convert); -static void colorspace_convert_lookup_getput (ColorspaceConvert * convert); -static void colorspace_dither_none (ColorspaceConvert * convert, int j); -static void colorspace_dither_verterr (ColorspaceConvert * convert, int j); -static void colorspace_dither_halftone (ColorspaceConvert * convert, int j); - - -ColorspaceConvert * -colorspace_convert_new (GstVideoFormat to_format, ColorSpaceColorSpec to_spec, - GstVideoFormat from_format, ColorSpaceColorSpec from_spec, - int width, int height) -{ - ColorspaceConvert *convert; - int i; - - g_return_val_if_fail (!gst_video_format_is_rgb (to_format) - || to_spec == COLOR_SPEC_RGB, NULL); - g_return_val_if_fail (!gst_video_format_is_yuv (to_format) - || to_spec == COLOR_SPEC_YUV_BT709 - || to_spec == COLOR_SPEC_YUV_BT470_6, NULL); - g_return_val_if_fail (gst_video_format_is_rgb (to_format) - || gst_video_format_is_yuv (to_format) - || (gst_video_format_is_gray (to_format) && - to_spec == COLOR_SPEC_GRAY), NULL); - - g_return_val_if_fail (!gst_video_format_is_rgb (from_format) - || from_spec == COLOR_SPEC_RGB, NULL); - g_return_val_if_fail (!gst_video_format_is_yuv (from_format) - || from_spec == COLOR_SPEC_YUV_BT709 - || from_spec == COLOR_SPEC_YUV_BT470_6, NULL); - g_return_val_if_fail (gst_video_format_is_rgb (from_format) - || gst_video_format_is_yuv (from_format) - || (gst_video_format_is_gray (from_format) && - from_spec == COLOR_SPEC_GRAY), NULL); - - convert = g_malloc (sizeof (ColorspaceConvert)); - memset (convert, 0, sizeof (ColorspaceConvert)); - - convert->to_format = to_format; - convert->to_spec = to_spec; - convert->from_format = from_format; - convert->from_spec = from_spec; - convert->height = height; - convert->width = width; - convert->convert = colorspace_convert_generic; - convert->dither16 = colorspace_dither_none; - - if (gst_video_format_get_component_depth (to_format, 0) > 8 || - gst_video_format_get_component_depth (from_format, 0) > 8) { - convert->use_16bit = TRUE; - } else { - convert->use_16bit = FALSE; - } - - for (i = 0; i < 4; i++) { - convert->dest_stride[i] = gst_video_format_get_row_stride (to_format, i, - width); - convert->dest_offset[i] = gst_video_format_get_component_offset (to_format, - i, width, height); - if (i == 0) - convert->dest_offset[i] = 0; - - convert->src_stride[i] = gst_video_format_get_row_stride (from_format, i, - width); - convert->src_offset[i] = gst_video_format_get_component_offset (from_format, - i, width, height); - if (i == 0) - convert->src_offset[i] = 0; - - GST_DEBUG ("%d: dest %d %d src %d %d", i, - convert->dest_stride[i], convert->dest_offset[i], - convert->src_stride[i], convert->src_offset[i]); - } - - colorspace_convert_lookup_fastpath (convert); - colorspace_convert_lookup_getput (convert); - - convert->tmpline = g_malloc (sizeof (guint8) * (width + 8) * 4); - convert->tmpline16 = g_malloc (sizeof (guint16) * (width + 8) * 4); - convert->errline = g_malloc (sizeof (guint16) * width * 4); - - if (to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) { - /* build poor man's palette, taken from ffmpegcolorspace */ - static const guint8 pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff }; - guint32 *palette; - gint r, g, b; - - convert->palette = palette = g_new (guint32, 256); - i = 0; - for (r = 0; r < 6; r++) { - for (g = 0; g < 6; g++) { - for (b = 0; b < 6; b++) { - palette[i++] = - (0xffU << 24) | (pal_value[r] << 16) | (pal_value[g] << 8) | - pal_value[b]; - } - } - } - palette[i++] = 0; /* 100% transparent, i == 6*6*6 */ - while (i < 256) - palette[i++] = 0xff000000; - } - - return convert; -} - -void -colorspace_convert_free (ColorspaceConvert * convert) -{ - g_free (convert->palette); - g_free (convert->tmpline); - g_free (convert->tmpline16); - g_free (convert->errline); - - g_free (convert); -} - -void -colorspace_convert_set_interlaced (ColorspaceConvert * convert, - gboolean interlaced) -{ - convert->interlaced = interlaced; -} - -void -colorspace_convert_set_dither (ColorspaceConvert * convert, int type) -{ - switch (type) { - case 0: - default: - convert->dither16 = colorspace_dither_none; - break; - case 1: - convert->dither16 = colorspace_dither_verterr; - break; - case 2: - convert->dither16 = colorspace_dither_halftone; - break; - } -} - -void -colorspace_convert_set_palette (ColorspaceConvert * convert, - const guint32 * palette) -{ - if (convert->palette == NULL) { - convert->palette = g_malloc (sizeof (guint32) * 256); - } - memcpy (convert->palette, palette, sizeof (guint32) * 256); -} - -const guint32 * -colorspace_convert_get_palette (ColorspaceConvert * convert) -{ - return convert->palette; -} - -void -colorspace_convert_convert (ColorspaceConvert * convert, - guint8 * dest, const guint8 * src) -{ - convert->convert (convert, dest, src); -} - -/* Line conversion to AYUV */ - -#define FRAME_GET_LINE(dir, comp, line) \ - ((dir) + convert-> dir ## _offset[(comp)] + convert-> dir ## _stride[(comp)] * (line)) - -static void -getline_I420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_I420 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j >> 1), - FRAME_GET_LINE (src, 2, j >> 1), convert->width); -} - -static void -putline_I420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_I420 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j >> 1), - FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2); -} - -static void -getline_YV12 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_I420 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j >> 1), - FRAME_GET_LINE (src, 2, j >> 1), convert->width); -} - -static void -putline_YV12 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_I420 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j >> 1), - FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2); -} - -static void -getline_YUY2 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_YUY2 (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2); -} - -static void -putline_YUY2 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_YUY2 (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2); -} - -static void -getline_UYVY (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_UYVY (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2); -} - -static void -putline_UYVY (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_UYVY (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2); -} - -static void -getline_YVYU (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_YVYU (dest, FRAME_GET_LINE (src, 0, j), convert->width / 2); -} - -static void -putline_YVYU (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_YVYU (FRAME_GET_LINE (dest, 0, j), src, convert->width / 2); -} - -static void -getline_v308 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i * 3 + 0] = src[i * 4 + 1]; - destline[i * 3 + 1] = src[i * 4 + 2]; - destline[i * 3 + 2] = src[i * 4 + 3]; - } -} - -static void -getline_AYUV (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - memcpy (dest, FRAME_GET_LINE (src, 0, j), convert->width * 4); -} - -static void -putline_AYUV (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - memcpy (FRAME_GET_LINE (dest, 0, j), src, convert->width * 4); -} - -#if 0 -static void -getline_v410 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width; i++) { - dest[i * 4 + 0] = GST_READ_UINT16_LE (srcline + i * 8 + 0); - dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 8 + 2); - dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + i * 8 + 4); - dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + i * 8 + 6); - } -} -#endif - -static void -getline_v210 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - - for (i = 0; i < convert->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 = src[4 * (i + 0) + 1] << 2; - y1 = src[4 * (i + 1) + 1] << 2; - y2 = src[4 * (i + 2) + 1] << 2; - y3 = src[4 * (i + 3) + 1] << 2; - y4 = src[4 * (i + 4) + 1] << 2; - y5 = src[4 * (i + 5) + 1] << 2; - - u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2]) << 1; - u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2]) << 1; - u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2]) << 1; - - v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3]) << 1; - v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3]) << 1; - v2 = (src[4 * (i + 4) + 3] + src[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 -getline16_v210 (ColorspaceConvert * convert, guint16 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - - for (i = 0; i < convert->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) << 6; - y0 = ((a0 >> 10) & 0x3ff) << 6; - v0 = ((a0 >> 20) & 0x3ff) << 6; - y1 = ((a1 >> 0) & 0x3ff) << 6; - - u2 = ((a1 >> 10) & 0x3ff) << 6; - y2 = ((a1 >> 20) & 0x3ff) << 6; - v2 = ((a2 >> 0) & 0x3ff) << 6; - y3 = ((a2 >> 10) & 0x3ff) << 6; - - u4 = ((a2 >> 20) & 0x3ff) << 6; - y4 = ((a3 >> 0) & 0x3ff) << 6; - v4 = ((a3 >> 10) & 0x3ff) << 6; - y5 = ((a3 >> 20) & 0x3ff) << 6; - - dest[4 * (i + 0) + 0] = 0xffff; - dest[4 * (i + 0) + 1] = y0; - dest[4 * (i + 0) + 2] = u0; - dest[4 * (i + 0) + 3] = v0; - - dest[4 * (i + 1) + 0] = 0xffff; - dest[4 * (i + 1) + 1] = y1; - dest[4 * (i + 1) + 2] = u0; - dest[4 * (i + 1) + 3] = v0; - - dest[4 * (i + 2) + 0] = 0xffff; - dest[4 * (i + 2) + 1] = y2; - dest[4 * (i + 2) + 2] = u2; - dest[4 * (i + 2) + 3] = v2; - - dest[4 * (i + 3) + 0] = 0xffff; - dest[4 * (i + 3) + 1] = y3; - dest[4 * (i + 3) + 2] = u2; - dest[4 * (i + 3) + 3] = v2; - - dest[4 * (i + 4) + 0] = 0xffff; - dest[4 * (i + 4) + 1] = y4; - dest[4 * (i + 4) + 2] = u4; - dest[4 * (i + 4) + 3] = v4; - - dest[4 * (i + 5) + 0] = 0xffff; - dest[4 * (i + 5) + 1] = y5; - dest[4 * (i + 5) + 2] = u4; - dest[4 * (i + 5) + 3] = v4; - - } -} - -static void -putline16_v210 (ColorspaceConvert * convert, guint8 * dest, const guint16 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - - for (i = 0; i < convert->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 = src[4 * (i + 0) + 1] >> 6; - y1 = src[4 * (i + 1) + 1] >> 6; - y2 = src[4 * (i + 2) + 1] >> 6; - y3 = src[4 * (i + 3) + 1] >> 6; - y4 = src[4 * (i + 4) + 1] >> 6; - y5 = src[4 * (i + 5) + 1] >> 6; - - u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 7; - u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2] + 1) >> 7; - u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2] + 1) >> 7; - - v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 7; - v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3] + 1) >> 7; - v2 = (src[4 * (i + 4) + 3] + src[4 * (i + 5) + 3] + 1) >> 7; - - 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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width / 2; i++) { - GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2] << 8); - GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1] << 8); - GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 1) * 4 + 3] << 8); - GST_WRITE_UINT16_LE (destline + i * 8 + 8, src[(i * 2 + 0) * 4 + 1] << 8); - } -} - -static void -getline16_v216 (ColorspaceConvert * convert, guint16 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width; i++) { - dest[i * 4 + 0] = 0xffff; - dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2); - dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0); - dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4); - } -} - -static void -putline16_v216 (ColorspaceConvert * convert, guint8 * dest, const guint16 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width / 2; i++) { - GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2]); - GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1]); - GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 1) * 4 + 3]); - GST_WRITE_UINT16_LE (destline + i * 8 + 8, src[(i * 2 + 0) * 4 + 1]); - } -} - -static void -getline_Y41B (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_YUV9 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j), FRAME_GET_LINE (src, 2, j), - convert->width / 2); -} - -static void -putline_Y41B (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destlineY = FRAME_GET_LINE (dest, 0, j); - guint8 *destlineU = FRAME_GET_LINE (dest, 1, j); - guint8 *destlineV = FRAME_GET_LINE (dest, 2, j); - - for (i = 0; i < convert->width - 3; i += 4) { - destlineY[i] = src[i * 4 + 1]; - destlineY[i + 1] = src[i * 4 + 5]; - destlineY[i + 2] = src[i * 4 + 9]; - destlineY[i + 3] = src[i * 4 + 13]; - - destlineU[i >> 2] = - (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 + 14] + - 2) >> 2; - destlineV[i >> 2] = - (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 + 15] + - 2) >> 2; - } - - if (i == convert->width - 3) { - destlineY[i] = src[i * 4 + 1]; - destlineY[i + 1] = src[i * 4 + 5]; - destlineY[i + 2] = src[i * 4 + 9]; - - destlineU[i >> 2] = - (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + 1) / 3; - destlineV[i >> 2] = - (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + 1) / 3; - } else if (i == convert->width - 2) { - destlineY[i] = src[i * 4 + 1]; - destlineY[i + 1] = src[i * 4 + 5]; - - destlineU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1; - destlineV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1; - } else if (i == convert->width - 1) { - destlineY[i + 1] = src[i * 4 + 5]; - - destlineU[i >> 2] = src[i * 4 + 2]; - destlineV[i >> 2] = src[i * 4 + 3]; - } -} - -static void -getline_Y42B (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_Y42B (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j), - FRAME_GET_LINE (src, 2, j), convert->width / 2); -} - -static void -putline_Y42B (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_Y42B (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j), - FRAME_GET_LINE (dest, 2, j), src, convert->width / 2); -} - -static void -getline_Y444 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_Y444 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j), FRAME_GET_LINE (src, 2, j), convert->width); -} - -static void -putline_Y444 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_Y444 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j), - FRAME_GET_LINE (dest, 2, j), src, convert->width); -} - -static void -getline_Y800 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_Y800 (dest, FRAME_GET_LINE (src, 0, j), convert->width); -} - -static void -putline_Y800 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_Y800 (FRAME_GET_LINE (dest, 0, j), src, convert->width); -} - -static void -getline_Y16 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_Y16 (dest, FRAME_GET_LINE (src, 0, j), convert->width); -} - -static void -putline_Y16 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_Y16 (FRAME_GET_LINE (dest, 0, j), src, convert->width); -} - -static void -getline_RGB16 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i] = - ((src[i * 4 + 1] >> 3) << 11) | ((src[i * 4 + - 2] >> 2) << 5) | (src[i * 4 + 3] >> 3); - } -} - -static void -getline_BGR16 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i] = - ((src[i * 4 + 3] >> 3) << 11) | ((src[i * 4 + - 2] >> 2) << 5) | (src[i * 4 + 1] >> 3); - } -} - -static void -getline_RGB15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i] = - ((src[i * 4 + 1] >> 3) << 10) | ((src[i * 4 + - 2] >> 3) << 5) | (src[i * 4 + 3] >> 3); - } -} - -static void -getline_BGR15 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i] = - ((src[i * 4 + 3] >> 3) << 10) | ((src[i * 4 + - 2] >> 3) << 5) | (src[i * 4 + 1] >> 3); - } -} - -static void -getline_BGRA (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_BGRA (dest, FRAME_GET_LINE (src, 0, j), convert->width); -} - -static void -putline_BGRA (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_BGRA (FRAME_GET_LINE (dest, 0, j), src, convert->width); -} - -static void -getline_ABGR (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_ABGR (dest, FRAME_GET_LINE (src, 0, j), convert->width); -} - -static void -putline_ABGR (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_ABGR (FRAME_GET_LINE (dest, 0, j), src, convert->width); -} - -static void -getline_RGBA (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_RGBA (dest, FRAME_GET_LINE (src, 0, j), convert->width); -} - -static void -putline_RGBA (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_RGBA (FRAME_GET_LINE (dest, 0, j), src, convert->width); -} - -static void -getline_RGB (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i * 3 + 0] = src[i * 4 + 1]; - destline[i * 3 + 1] = src[i * 4 + 2]; - destline[i * 3 + 2] = src[i * 4 + 3]; - } -} - -static void -getline_BGR (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width; i++) { - destline[i * 3 + 0] = src[i * 4 + 3]; - destline[i * 3 + 1] = src[i * 4 + 2]; - destline[i * 3 + 2] = src[i * 4 + 1]; - } -} - -static void -getline_NV12 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_NV12 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j >> 1), convert->width / 2); -} - -static void -putline_NV12 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_NV12 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j >> 1), src, convert->width / 2); -} - -static void -getline_NV21 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_NV21 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 2, j >> 1), convert->width / 2); -} - -static void -putline_NV21 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_NV21 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 2, j >> 1), src, convert->width / 2); -} - -static void -getline_UYVP (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - - for (i = 0; i < convert->width; i += 2) { - guint16 y0, y1; - guint16 u0; - guint16 v0; - - u0 = (src[(i / 2) * 5 + 0] << 2) | (src[(i / 2) * 5 + 1] >> 6); - y0 = ((src[(i / 2) * 5 + 1] & 0x3f) << 4) | (src[(i / 2) * 5 + 2] >> 4); - v0 = ((src[(i / 2) * 5 + 2] & 0x0f) << 6) | (src[(i / 2) * 5 + 3] >> 2); - y1 = ((src[(i / 2) * 5 + 3] & 0x03) << 8) | src[(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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - - for (i = 0; i < convert->width; i += 2) { - guint16 y0, y1; - guint16 u0; - guint16 v0; - - y0 = src[4 * (i + 0) + 1]; - y1 = src[4 * (i + 1) + 1]; - u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 1; - v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 1; - - dest[(i / 2) * 5 + 0] = u0; - dest[(i / 2) * 5 + 1] = y0 >> 2; - dest[(i / 2) * 5 + 2] = (y0 << 6) | (v0 >> 4); - dest[(i / 2) * 5 + 3] = (v0 << 4) | (y1 >> 2); - dest[(i / 2) * 5 + 4] = (y1 << 2); - } -} - -static void -getline_A420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_A420 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j >> 1), - FRAME_GET_LINE (src, 2, j >> 1), - FRAME_GET_LINE (src, 3, j), convert->width); -} - -static void -putline_A420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_putline_A420 (FRAME_GET_LINE (dest, 0, j), - FRAME_GET_LINE (dest, 1, j >> 1), - FRAME_GET_LINE (dest, 2, j >> 1), - FRAME_GET_LINE (dest, 3, j), src, convert->width / 2); -} - -static void -getline_RGB8P (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width; i++) { - guint32 v = convert->palette[srcline[i]]; - dest[i * 4 + 0] = (v >> 24) & 0xff; - dest[i * 4 + 1] = (v >> 16) & 0xff; - dest[i * 4 + 2] = (v >> 8) & 0xff; - dest[i * 4 + 3] = (v) & 0xff; - } -} - -static void -putline_RGB8P (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - /* Use our poor man's palette, taken from ffmpegcolorspace too */ - for (i = 0; i < convert->width; i++) { - /* crude approximation for alpha ! */ - if (src[i * 4 + 0] < 0x80) - destline[i] = 6 * 6 * 6; - else - destline[i] = - ((((src[i * 4 + 1]) / 47) % 6) * 6 * 6 + (((src[i * 4 + - 2]) / 47) % 6) * 6 + (((src[i * 4 + 3]) / 47) % 6)); - } -} - - -static void -getline_YUV9 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - cogorc_getline_YUV9 (dest, - FRAME_GET_LINE (src, 0, j), - FRAME_GET_LINE (src, 1, j >> 2), - FRAME_GET_LINE (src, 2, j >> 2), convert->width / 2); -} - -static void -putline_YUV9 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destY = FRAME_GET_LINE (dest, 0, j); - guint8 *destU = FRAME_GET_LINE (dest, 1, j >> 2); - guint8 *destV = FRAME_GET_LINE (dest, 2, j >> 2); - - for (i = 0; i < convert->width - 3; i += 4) { - destY[i] = src[i * 4 + 1]; - destY[i + 1] = src[i * 4 + 5]; - destY[i + 2] = src[i * 4 + 9]; - destY[i + 3] = src[i * 4 + 13]; - if (j % 4 == 0) { - destU[i >> 2] = - (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 + - 14]) >> 2; - destV[i >> 2] = - (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 + - 15]) >> 2; - } - } - - if (i == convert->width - 3) { - destY[i] = src[i * 4 + 1]; - destY[i + 1] = src[i * 4 + 5]; - destY[i + 2] = src[i * 4 + 9]; - if (j % 4 == 0) { - destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3; - destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3; - } - } else if (i == convert->width - 2) { - destY[i] = src[i * 4 + 1]; - destY[i + 1] = src[i * 4 + 5]; - if (j % 4 == 0) { - destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1; - destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1; - } - } else if (i == convert->width - 1) { - destY[i] = src[i * 4 + 1]; - destU[i >> 2] = src[i * 4 + 2]; - destV[i >> 2] = src[i * 4 + 3]; - } -} - -static void -getline_IYU1 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - - for (i = 0; i < convert->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 == convert->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 == convert->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 == convert->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 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - - for (i = 0; i < convert->width - 3; i += 4) { - destline[(i >> 2) * 6 + 1] = src[i * 4 + 1]; - destline[(i >> 2) * 6 + 2] = src[i * 4 + 5]; - destline[(i >> 2) * 6 + 4] = src[i * 4 + 9]; - destline[(i >> 2) * 6 + 5] = src[i * 4 + 13]; - destline[(i >> 2) * 6 + 0] = - (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 + - 14]) >> 2; - destline[(i >> 2) * 6 + 3] = - (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 + - 15]) >> 2; - } - - if (i == convert->width - 3) { - destline[(i >> 2) * 6 + 1] = src[i * 4 + 1]; - destline[(i >> 2) * 6 + 2] = src[i * 4 + 5]; - destline[(i >> 2) * 6 + 4] = src[i * 4 + 9]; - destline[(i >> 2) * 6 + 0] = - (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3; - destline[(i >> 2) * 6 + 3] = - (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3; - } else if (i == convert->width - 2) { - destline[(i >> 2) * 6 + 1] = src[i * 4 + 1]; - destline[(i >> 2) * 6 + 2] = src[i * 4 + 5]; - destline[(i >> 2) * 6 + 0] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1; - destline[(i >> 2) * 6 + 3] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1; - } else if (i == convert->width - 1) { - destline[(i >> 2) * 6 + 1] = src[i * 4 + 1]; - destline[(i >> 2) * 6 + 0] = src[i * 4 + 2]; - destline[(i >> 2) * 6 + 3] = src[i * 4 + 3]; - } -} - -static void -getline_AY64 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint16 *srcline = (const guint16 *) FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width * 4; i++) { - dest[i] = srcline[i] >> 8; - } -} - -static void -putline_AY64 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint16 *destline = (guint16 *) FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width * 4; i++) { - destline[i] = src[i] << 8; - } -} - -static void -getline16_AY64 (ColorspaceConvert * convert, guint16 * dest, const guint8 * src, - int j) -{ - memcpy (dest, FRAME_GET_LINE (src, 0, j), convert->width * 8); -} - -static void -putline16_AY64 (ColorspaceConvert * convert, guint8 * dest, const guint16 * src, - int j) -{ - memcpy (FRAME_GET_LINE (dest, 0, j), src, convert->width * 8); -} - -static void -getline_r210 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width; i++) { - guint8 x; - dest[i * 4 + 0] = 0xff; - x = GST_READ_UINT32_BE (srcline + i * 4); - dest[i * 4 + 1] = (x >> 22) & 0xff; - dest[i * 4 + 2] = (x >> 12) & 0xff; - dest[i * 4 + 3] = (x >> 2) & 0xff; - } -} - -static void -putline_r210 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width / 2; i++) { - guint32 x = 0; - x |= src[i * 4 + 1] << 22; - x |= (src[i * 4 + 1] & 0xc0) << 14; - x |= src[i * 4 + 2] << 12; - x |= (src[i * 4 + 2] & 0xc0) << 10; - x |= src[i * 4 + 3] << 2; - x |= (src[i * 4 + 3] & 0xc0) >> 6; - GST_WRITE_UINT32_BE (destline + i * 4, x); - } -} - -static void -getline16_r210 (ColorspaceConvert * convert, guint16 * dest, const guint8 * src, - int j) -{ - int i; - const guint8 *srcline = FRAME_GET_LINE (src, 0, j); - for (i = 0; i < convert->width; i++) { - guint32 x; - dest[i * 4 + 0] = 0xffff; - x = GST_READ_UINT32_BE (srcline + i * 4); - dest[i * 4 + 1] = ((x >> 14) & 0xffc0) | (x >> 24); - dest[i * 4 + 2] = ((x >> 4) & 0xffc0) | ((x >> 14) & 0x3f); - dest[i * 4 + 3] = ((x << 6) & 0xffc0) | ((x >> 4) & 0x3f); - } -} - -static void -putline16_r210 (ColorspaceConvert * convert, guint8 * dest, const guint16 * src, - int j) -{ - int i; - guint8 *destline = FRAME_GET_LINE (dest, 0, j); - for (i = 0; i < convert->width / 2; i++) { - guint32 x = 0; - x |= (src[i * 4 + 1] & 0xffc0) << 14; - x |= (src[i * 4 + 2] & 0xffc0) << 4; - x |= (src[i * 4 + 3] & 0xffc0) >> 6; - GST_WRITE_UINT32_BE (destline + i * 4, x); - } -} - -static void -getline16_convert (ColorspaceConvert * convert, guint16 * dest, - const guint8 * src, int j) -{ - int i; - convert->getline (convert, convert->tmpline, src, j); - for (i = 0; i < convert->width * 4; i++) { - dest[i] = convert->tmpline[i] << 8; - } -} - -static void -putline16_convert (ColorspaceConvert * convert, guint8 * dest, - const guint16 * src, int j) -{ - int i; - for (i = 0; i < convert->width * 4; i++) { - convert->tmpline[i] = src[i] >> 8; - } - convert->putline (convert, dest, convert->tmpline, j); -} - -typedef struct -{ - GstVideoFormat format; - void (*getline) (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src, int j); - void (*putline) (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src, int j); - void (*getline16) (ColorspaceConvert * convert, guint16 * dest, - const guint8 * src, int j); - void (*putline16) (ColorspaceConvert * convert, guint8 * dest, - const guint16 * src, int j); -} ColorspaceLine; -static const ColorspaceLine lines[] = { - {GST_VIDEO_FORMAT_I420, getline_I420, putline_I420}, - {GST_VIDEO_FORMAT_YV12, getline_YV12, putline_YV12}, - {GST_VIDEO_FORMAT_YUY2, getline_YUY2, putline_YUY2}, - {GST_VIDEO_FORMAT_UYVY, getline_UYVY, putline_UYVY}, - {GST_VIDEO_FORMAT_AYUV, getline_AYUV, putline_AYUV}, - {GST_VIDEO_FORMAT_RGBx, getline_RGBA, putline_RGBA}, - {GST_VIDEO_FORMAT_BGRx, getline_BGRA, putline_BGRA}, - {GST_VIDEO_FORMAT_xRGB, getline_AYUV, putline_AYUV}, - {GST_VIDEO_FORMAT_xBGR, getline_ABGR, putline_ABGR}, - {GST_VIDEO_FORMAT_RGBA, getline_RGBA, putline_RGBA}, - {GST_VIDEO_FORMAT_BGRA, getline_BGRA, putline_BGRA}, - {GST_VIDEO_FORMAT_ARGB, getline_AYUV, putline_AYUV}, - {GST_VIDEO_FORMAT_ABGR, getline_ABGR, putline_ABGR}, - {GST_VIDEO_FORMAT_RGB, getline_RGB, putline_RGB}, - {GST_VIDEO_FORMAT_BGR, getline_BGR, putline_BGR}, - {GST_VIDEO_FORMAT_Y41B, getline_Y41B, putline_Y41B}, - {GST_VIDEO_FORMAT_Y42B, getline_Y42B, putline_Y42B}, - {GST_VIDEO_FORMAT_YVYU, getline_YVYU, putline_YVYU}, - {GST_VIDEO_FORMAT_Y444, getline_Y444, putline_Y444}, - {GST_VIDEO_FORMAT_v210, getline_v210, putline_v210, - getline16_v210, putline16_v210}, - {GST_VIDEO_FORMAT_v216, getline_v216, putline_v216, - getline16_v216, putline16_v216}, - {GST_VIDEO_FORMAT_NV12, getline_NV12, putline_NV12}, - {GST_VIDEO_FORMAT_NV21, getline_NV21, putline_NV21}, - //{GST_VIDEO_FORMAT_GRAY8, getline_GRAY8, putline_GRAY8}, - //{GST_VIDEO_FORMAT_GRAY16_BE, getline_GRAY16_BE, putline_GRAY16_BE}, - //{GST_VIDEO_FORMAT_GRAY16_LE, getline_GRAY16_LE, putline_GRAY16_LE}, - {GST_VIDEO_FORMAT_v308, getline_v308, putline_v308}, - {GST_VIDEO_FORMAT_Y800, getline_Y800, putline_Y800}, - {GST_VIDEO_FORMAT_Y16, getline_Y16, putline_Y16}, - {GST_VIDEO_FORMAT_RGB16, getline_RGB16, putline_RGB16}, - {GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16}, - {GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15}, - {GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15}, - {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP}, - {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420} - , {GST_VIDEO_FORMAT_RGB8_PALETTED, getline_RGB8P, putline_RGB8P}, - {GST_VIDEO_FORMAT_YUV9, getline_YUV9, putline_YUV9}, - {GST_VIDEO_FORMAT_YVU9, getline_YUV9, putline_YUV9}, /* alias */ - {GST_VIDEO_FORMAT_IYU1, getline_IYU1, putline_IYU1}, - {GST_VIDEO_FORMAT_ARGB64, getline_AY64, putline_AY64, getline16_AY64, - putline16_AY64}, - {GST_VIDEO_FORMAT_AYUV64, getline_AY64, putline_AY64, getline16_AY64, - putline16_AY64}, - {GST_VIDEO_FORMAT_r210, getline_r210, putline_r210, getline16_r210, - putline16_r210} -}; - -static void -matrix_rgb_to_yuv_bt470_6 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->width; i++) { - r = tmpline[i * 4 + 1]; - g = tmpline[i * 4 + 2]; - b = tmpline[i * 4 + 3]; - - y = (66 * r + 129 * g + 25 * b + 4096) >> 8; - u = (-38 * r - 74 * g + 112 * b + 32768) >> 8; - v = (112 * r - 94 * g - 18 * 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_rgb_to_yuv_bt709 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->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_bt470_6_to_rgb (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (298 * y + 409 * v - 57068) >> 8; - g = (298 * y - 100 * u - 208 * v + 34707) >> 8; - b = (298 * y + 516 * u - 70870) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 255); - tmpline[i * 4 + 2] = CLAMP (g, 0, 255); - tmpline[i * 4 + 3] = CLAMP (b, 0, 255); - } -} - -static void -matrix_yuv_bt709_to_rgb (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->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 + 1] = CLAMP (r, 0, 255); - tmpline[i * 4 + 2] = CLAMP (g, 0, 255); - tmpline[i * 4 + 3] = CLAMP (b, 0, 255); - } -} - -static void -matrix_yuv_bt709_to_yuv_bt470_6 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (256 * y + 25 * u + 49 * v - 9536) >> 8; - g = (253 * u - 28 * v + 3958) >> 8; - b = (-19 * u + 252 * v + 2918) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 255); - tmpline[i * 4 + 2] = CLAMP (g, 0, 255); - tmpline[i * 4 + 3] = CLAMP (b, 0, 255); - } -} - -static void -matrix_yuv_bt470_6_to_yuv_bt709 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint8 *tmpline = convert->tmpline; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (256 * y - 30 * u - 53 * v + 10600) >> 8; - g = (261 * u + 29 * v - 4367) >> 8; - b = (19 * u + 262 * v - 3289) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 255); - tmpline[i * 4 + 2] = CLAMP (g, 0, 255); - tmpline[i * 4 + 3] = CLAMP (b, 0, 255); - } -} - -static void -matrix_identity (ColorspaceConvert * convert) -{ - /* do nothing */ -} - -static void -matrix16_rgb_to_yuv_bt470_6 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->width; i++) { - r = tmpline[i * 4 + 1]; - g = tmpline[i * 4 + 2]; - b = tmpline[i * 4 + 3]; - - y = (66 * r + 129 * g + 25 * b + 4096 * 256) >> 8; - u = (-38 * r - 74 * g + 112 * b + 32768 * 256) >> 8; - v = (112 * r - 94 * g - 18 * b + 32768 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (y, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (u, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (v, 0, 65535); - } -} - -static void -matrix16_rgb_to_yuv_bt709 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->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 * 256) >> 8; - u = (-26 * r - 87 * g + 112 * b + 32768 * 256) >> 8; - v = (112 * r - 102 * g - 10 * b + 32768 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (y, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (u, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (v, 0, 65535); - } -} - -static void -matrix16_yuv_bt470_6_to_rgb (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (298 * y + 409 * v - 57068 * 256) >> 8; - g = (298 * y - 100 * u - 208 * v + 34707 * 256) >> 8; - b = (298 * y + 516 * u - 70870 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (g, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (b, 0, 65535); - } -} - -static void -matrix16_yuv_bt709_to_rgb (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (298 * y + 459 * v - 63514 * 256) >> 8; - g = (298 * y - 55 * u - 136 * v + 19681 * 256) >> 8; - b = (298 * y + 541 * u - 73988 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (g, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (b, 0, 65535); - } -} - -static void -matrix16_yuv_bt709_to_yuv_bt470_6 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (256 * y + 25 * u + 49 * v - 9536 * 256) >> 8; - g = (253 * u - 28 * v + 3958 * 256) >> 8; - b = (-19 * u + 252 * v + 2918 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (g, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (b, 0, 65535); - } -} - -static void -matrix16_yuv_bt470_6_to_yuv_bt709 (ColorspaceConvert * convert) -{ - int i; - int r, g, b; - int y, u, v; - guint16 *tmpline = convert->tmpline16; - - for (i = 0; i < convert->width; i++) { - y = tmpline[i * 4 + 1]; - u = tmpline[i * 4 + 2]; - v = tmpline[i * 4 + 3]; - - r = (256 * y - 30 * u - 53 * v + 10600 * 256) >> 8; - g = (261 * u + 29 * v - 4367 * 256) >> 8; - b = (19 * u + 262 * v - 3289 * 256) >> 8; - - tmpline[i * 4 + 1] = CLAMP (r, 0, 65535); - tmpline[i * 4 + 2] = CLAMP (g, 0, 65535); - tmpline[i * 4 + 3] = CLAMP (b, 0, 65535); - } -} - -static void -matrix16_identity (ColorspaceConvert * convert) -{ - /* do nothing */ -} - - - -static void -colorspace_convert_lookup_getput (ColorspaceConvert * convert) -{ - int i; - - convert->getline = NULL; - convert->getline16 = NULL; - for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) { - if (lines[i].format == convert->from_format) { - convert->getline = lines[i].getline; - convert->getline16 = lines[i].getline16; - break; - } - } - convert->putline = NULL; - convert->putline16 = NULL; - for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) { - if (lines[i].format == convert->to_format) { - convert->putline = lines[i].putline; - convert->putline16 = lines[i].putline16; - break; - } - } - GST_DEBUG ("get %p put %p", convert->getline, convert->putline); - - if (convert->getline16 == NULL) { - convert->getline16 = getline16_convert; - } - if (convert->putline16 == NULL) { - convert->putline16 = putline16_convert; - } - - if (convert->from_spec == convert->to_spec) { - convert->matrix = matrix_identity; - convert->matrix16 = matrix16_identity; - } else if (convert->from_spec == COLOR_SPEC_RGB - && convert->to_spec == COLOR_SPEC_YUV_BT470_6) { - convert->matrix = matrix_rgb_to_yuv_bt470_6; - convert->matrix16 = matrix16_rgb_to_yuv_bt470_6; - } else if (convert->from_spec == COLOR_SPEC_RGB - && convert->to_spec == COLOR_SPEC_YUV_BT709) { - convert->matrix = matrix_rgb_to_yuv_bt709; - convert->matrix16 = matrix16_rgb_to_yuv_bt709; - } else if (convert->from_spec == COLOR_SPEC_YUV_BT470_6 - && convert->to_spec == COLOR_SPEC_RGB) { - convert->matrix = matrix_yuv_bt470_6_to_rgb; - convert->matrix16 = matrix16_yuv_bt470_6_to_rgb; - } else if (convert->from_spec == COLOR_SPEC_YUV_BT709 - && convert->to_spec == COLOR_SPEC_RGB) { - convert->matrix = matrix_yuv_bt709_to_rgb; - convert->matrix16 = matrix16_yuv_bt709_to_rgb; - } else if (convert->from_spec == COLOR_SPEC_YUV_BT709 - && convert->to_spec == COLOR_SPEC_YUV_BT470_6) { - convert->matrix = matrix_yuv_bt709_to_yuv_bt470_6; - convert->matrix16 = matrix16_yuv_bt709_to_yuv_bt470_6; - } else if (convert->from_spec == COLOR_SPEC_YUV_BT470_6 - && convert->to_spec == COLOR_SPEC_YUV_BT709) { - convert->matrix = matrix_yuv_bt470_6_to_yuv_bt709; - convert->matrix16 = matrix16_yuv_bt470_6_to_yuv_bt709; - } -} - -static void -colorspace_convert_generic (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int j; - - if (convert->getline == NULL) { - GST_ERROR ("no getline"); - return; - } - - if (convert->putline == NULL) { - GST_ERROR ("no putline"); - return; - } - - if (convert->use_16bit) { - for (j = 0; j < convert->height; j++) { - convert->getline16 (convert, convert->tmpline16, src, j); - convert->matrix16 (convert); - convert->dither16 (convert, j); - convert->putline16 (convert, dest, convert->tmpline16, j); - } - } else { - for (j = 0; j < convert->height; j++) { - convert->getline (convert, convert->tmpline, src, j); - convert->matrix (convert); - convert->putline (convert, dest, convert->tmpline, j); - } - } -} - -static void -colorspace_dither_none (ColorspaceConvert * convert, int j) -{ -} - -static void -colorspace_dither_verterr (ColorspaceConvert * convert, int j) -{ - int i; - guint16 *tmpline = convert->tmpline16; - guint16 *errline = convert->errline; - - for (i = 0; i < 4 * convert->width; i++) { - tmpline[i] += errline[i]; - errline[i] = tmpline[i] & 0xff; - } -} - -static void -colorspace_dither_halftone (ColorspaceConvert * convert, int j) -{ - int i; - guint16 *tmpline = convert->tmpline16; - static guint16 halftone[8][8] = { - {0, 128, 32, 160, 8, 136, 40, 168}, - {192, 64, 224, 96, 200, 72, 232, 104}, - {48, 176, 16, 144, 56, 184, 24, 152}, - {240, 112, 208, 80, 248, 120, 216, 88}, - {12, 240, 44, 172, 4, 132, 36, 164}, - {204, 76, 236, 108, 196, 68, 228, 100}, - {60, 188, 28, 156, 52, 180, 20, 148}, - {252, 142, 220, 92, 244, 116, 212, 84} - }; - - for (i = 0; i < convert->width * 4; i++) { - tmpline[i] += halftone[(i >> 2) & 7][j & 7]; - } -} - -/* Fast paths */ - -static void -convert_I420_YUY2 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - - for (i = 0; i < convert->height; i += 2) { - cogorc_convert_I420_YUY2 (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (dest, 0, i + 1), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 0, i + 1), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 2, i >> 1), (convert->width + 1) / 2); - } -} - -static void -convert_I420_UYVY (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - - for (i = 0; i < convert->height; i += 2) { - cogorc_convert_I420_UYVY (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (dest, 0, i + 1), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 0, i + 1), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 2, i >> 1), (convert->width + 1) / 2); - } -} - -static void -convert_I420_AYUV (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - - for (i = 0; i < convert->height; i += 2) { - cogorc_convert_I420_AYUV (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (dest, 0, i + 1), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 0, i + 1), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 2, i >> 1), convert->width); - } -} - -static void -convert_I420_Y42B (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_420_422 (FRAME_GET_LINE (dest, 1, 0), - 2 * convert->dest_stride[1], FRAME_GET_LINE (dest, 1, 1), - 2 * convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], (convert->width + 1) / 2, convert->height / 2); - - cogorc_planar_chroma_420_422 (FRAME_GET_LINE (dest, 2, 0), - 2 * convert->dest_stride[2], FRAME_GET_LINE (dest, 2, 1), - 2 * convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height / 2); -} - -static void -convert_I420_Y444 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_420_444 (FRAME_GET_LINE (dest, 1, 0), - 2 * convert->dest_stride[1], FRAME_GET_LINE (dest, 1, 1), - 2 * convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], (convert->width + 1) / 2, - (convert->height + 1) / 2); - - cogorc_planar_chroma_420_444 (FRAME_GET_LINE (dest, 2, 0), - 2 * convert->dest_stride[2], FRAME_GET_LINE (dest, 2, 1), - 2 * convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, - (convert->height + 1) / 2); -} - -static void -convert_YUY2_I420 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - - for (i = 0; i < convert->height; i += 2) { - cogorc_convert_YUY2_I420 (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (dest, 0, i + 1), - FRAME_GET_LINE (dest, 1, i >> 1), - FRAME_GET_LINE (dest, 2, i >> 1), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 0, i + 1), (convert->width + 1) / 2); - } -} - -static void -convert_YUY2_AYUV (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_YUY2_Y42B (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_YUY2_Y42B (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_YUY2_Y444 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_YUY2_Y444 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - - -static void -convert_UYVY_I420 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - - for (i = 0; i < convert->height; i += 2) { - cogorc_convert_UYVY_I420 (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (dest, 0, i + 1), - FRAME_GET_LINE (dest, 1, i >> 1), - FRAME_GET_LINE (dest, 2, i >> 1), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 0, i + 1), (convert->width + 1) / 2); - } -} - -static void -convert_UYVY_AYUV (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_UYVY_YUY2 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_UYVY_Y42B (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_UYVY_Y42B (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_UYVY_Y444 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_UYVY_Y444 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_AYUV_I420 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_I420 (FRAME_GET_LINE (dest, 0, 0), - 2 * convert->dest_stride[0], FRAME_GET_LINE (dest, 0, 1), - 2 * convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - 2 * convert->src_stride[0], FRAME_GET_LINE (src, 0, 1), - 2 * convert->src_stride[0], convert->width / 2, convert->height / 2); -} - -static void -convert_AYUV_YUY2 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width / 2, convert->height); -} - -static void -convert_AYUV_UYVY (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width / 2, convert->height); -} - -static void -convert_AYUV_Y42B (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_Y42B (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], (convert->width + 1) / 2, convert->height); -} - -static void -convert_AYUV_Y444 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_Y444 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width, convert->height); -} - -static void -convert_Y42B_I420 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_422_420 (FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - 2 * convert->src_stride[1], FRAME_GET_LINE (src, 1, 1), - 2 * convert->src_stride[1], (convert->width + 1) / 2, - (convert->height + 1) / 2); - - cogorc_planar_chroma_422_420 (FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - 2 * convert->src_stride[2], FRAME_GET_LINE (src, 2, 1), - 2 * convert->src_stride[2], (convert->width + 1) / 2, - (convert->height + 1) / 2); -} - -static void -convert_Y42B_Y444 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_422_444 (FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], (convert->width + 1) / 2, convert->height); - - cogorc_planar_chroma_422_444 (FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y42B_YUY2 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y42B_UYVY (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y42B_AYUV (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width) / 2, convert->height); -} - -static void -convert_Y444_I420 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_444_420 (FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - 2 * convert->src_stride[1], FRAME_GET_LINE (src, 1, 1), - 2 * convert->src_stride[1], (convert->width + 1) / 2, - (convert->height + 1) / 2); - - cogorc_planar_chroma_444_420 (FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - 2 * convert->src_stride[2], FRAME_GET_LINE (src, 2, 1), - 2 * convert->src_stride[2], (convert->width + 1) / 2, - (convert->height + 1) / 2); -} - -static void -convert_Y444_Y42B (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_memcpy_2d (FRAME_GET_LINE (dest, 0, 0), convert->dest_stride[0], - FRAME_GET_LINE (src, 0, 0), convert->src_stride[0], - convert->width, convert->height); - - cogorc_planar_chroma_444_422 (FRAME_GET_LINE (dest, 1, 0), - convert->dest_stride[1], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], (convert->width + 1) / 2, convert->height); - - cogorc_planar_chroma_444_422 (FRAME_GET_LINE (dest, 2, 0), - convert->dest_stride[2], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y444_YUY2 (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y444_UYVY (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], (convert->width + 1) / 2, convert->height); -} - -static void -convert_Y444_AYUV (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], FRAME_GET_LINE (src, 1, 0), - convert->src_stride[1], FRAME_GET_LINE (src, 2, 0), - convert->src_stride[2], convert->width, convert->height); -} - -#if G_BYTE_ORDER == G_LITTLE_ENDIAN -static void -convert_AYUV_ARGB (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width, convert->height); -} - -static void -convert_AYUV_BGRA (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width, convert->height); -} - -static void -convert_AYUV_ABGR (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width, convert->height); -} - -static void -convert_AYUV_RGBA (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - cogorc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0, 0), - convert->dest_stride[0], FRAME_GET_LINE (src, 0, 0), - convert->src_stride[0], convert->width, convert->height); -} - -static void -convert_I420_BGRA (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src) -{ - int i; - int quality = 0; - - if (quality > 3) { - for (i = 0; i < convert->height; i++) { - if (i & 1) { - cogorc_convert_I420_BGRA_avg (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 1, (i >> 1) + 1), - FRAME_GET_LINE (src, 2, i >> 1), - FRAME_GET_LINE (src, 2, (i >> 1) + 1), convert->width); - } else { - cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 2, i >> 1), convert->width); - } - } - } else { - for (i = 0; i < convert->height; i++) { - cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, 0, i), - FRAME_GET_LINE (src, 0, i), - FRAME_GET_LINE (src, 1, i >> 1), - FRAME_GET_LINE (src, 2, i >> 1), convert->width); - } - } -} -#endif - - - -/* Fast paths */ - -typedef struct -{ - GstVideoFormat from_format; - ColorSpaceColorSpec from_spec; - GstVideoFormat to_format; - ColorSpaceColorSpec to_spec; - gboolean keeps_color_spec; - void (*convert) (ColorspaceConvert * convert, guint8 * dest, - const guint8 * src); -} ColorspaceTransform; -static const ColorspaceTransform transforms[] = { - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2, - COLOR_SPEC_NONE, TRUE, convert_I420_YUY2}, - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, - COLOR_SPEC_NONE, TRUE, convert_I420_UYVY}, - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV, - COLOR_SPEC_NONE, TRUE, convert_I420_AYUV}, - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B, - COLOR_SPEC_NONE, TRUE, convert_I420_Y42B}, - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444, - COLOR_SPEC_NONE, TRUE, convert_I420_Y444}, - - {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420, - COLOR_SPEC_NONE, TRUE, convert_YUY2_I420}, - {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, TRUE, convert_UYVY_YUY2}, /* alias */ - {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV, - COLOR_SPEC_NONE, TRUE, convert_YUY2_AYUV}, - {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B, - COLOR_SPEC_NONE, TRUE, convert_YUY2_Y42B}, - {GST_VIDEO_FORMAT_YUY2, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444, - COLOR_SPEC_NONE, TRUE, convert_YUY2_Y444}, - - {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420, - COLOR_SPEC_NONE, TRUE, convert_UYVY_I420}, - {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2, - COLOR_SPEC_NONE, TRUE, convert_UYVY_YUY2}, - {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV, - COLOR_SPEC_NONE, TRUE, convert_UYVY_AYUV}, - {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B, - COLOR_SPEC_NONE, TRUE, convert_UYVY_Y42B}, - {GST_VIDEO_FORMAT_UYVY, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444, - COLOR_SPEC_NONE, TRUE, convert_UYVY_Y444}, - - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420, - COLOR_SPEC_NONE, TRUE, convert_AYUV_I420}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2, - COLOR_SPEC_NONE, TRUE, convert_AYUV_YUY2}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, - COLOR_SPEC_NONE, TRUE, convert_AYUV_UYVY}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B, - COLOR_SPEC_NONE, TRUE, convert_AYUV_Y42B}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444, - COLOR_SPEC_NONE, TRUE, convert_AYUV_Y444}, - - {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420, - COLOR_SPEC_NONE, TRUE, convert_Y42B_I420}, - {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2, - COLOR_SPEC_NONE, TRUE, convert_Y42B_YUY2}, - {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, - COLOR_SPEC_NONE, TRUE, convert_Y42B_UYVY}, - {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV, - COLOR_SPEC_NONE, TRUE, convert_Y42B_AYUV}, - {GST_VIDEO_FORMAT_Y42B, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y444, - COLOR_SPEC_NONE, TRUE, convert_Y42B_Y444}, - - {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_I420, - COLOR_SPEC_NONE, TRUE, convert_Y444_I420}, - {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_YUY2, - COLOR_SPEC_NONE, TRUE, convert_Y444_YUY2}, - {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_UYVY, - COLOR_SPEC_NONE, TRUE, convert_Y444_UYVY}, - {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_AYUV, - COLOR_SPEC_NONE, TRUE, convert_Y444_AYUV}, - {GST_VIDEO_FORMAT_Y444, COLOR_SPEC_NONE, GST_VIDEO_FORMAT_Y42B, - COLOR_SPEC_NONE, TRUE, convert_Y444_Y42B}, - -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_ARGB, - COLOR_SPEC_RGB, FALSE, convert_AYUV_ARGB}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRA, - COLOR_SPEC_RGB, FALSE, convert_AYUV_BGRA}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_xRGB, COLOR_SPEC_RGB, FALSE, convert_AYUV_ARGB}, /* alias */ - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRx, COLOR_SPEC_RGB, FALSE, convert_AYUV_BGRA}, /* alias */ - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_ABGR, - COLOR_SPEC_RGB, FALSE, convert_AYUV_ABGR}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_RGBA, - COLOR_SPEC_RGB, FALSE, convert_AYUV_RGBA}, - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_xBGR, COLOR_SPEC_RGB, FALSE, convert_AYUV_ABGR}, /* alias */ - {GST_VIDEO_FORMAT_AYUV, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_RGBx, COLOR_SPEC_RGB, FALSE, convert_AYUV_RGBA}, /* alias */ - - {GST_VIDEO_FORMAT_I420, COLOR_SPEC_YUV_BT470_6, GST_VIDEO_FORMAT_BGRA, - COLOR_SPEC_RGB, FALSE, convert_I420_BGRA}, -#endif -}; - -static void -colorspace_convert_lookup_fastpath (ColorspaceConvert * convert) -{ - int i; - - for (i = 0; i < sizeof (transforms) / sizeof (transforms[0]); i++) { - if (transforms[i].to_format == convert->to_format && - transforms[i].from_format == convert->from_format && - (transforms[i].keeps_color_spec || - (transforms[i].from_spec == convert->from_spec && - transforms[i].to_spec == convert->to_spec))) { - convert->convert = transforms[i].convert; - return; - } - } -} diff --git a/gst/colorspace/colorspace.h b/gst/colorspace/colorspace.h deleted file mode 100644 index 05bcc1867..000000000 --- a/gst/colorspace/colorspace.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Colorspace conversion functions - * Copyright (C) 2010 David Schleef <ds@schleef.org> - * - * 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 __COLORSPACE_H__ -#define __COLORSPACE_H__ - -#include <gst/video/video.h> - -G_BEGIN_DECLS - -typedef struct _ColorspaceConvert ColorspaceConvert; -typedef struct _ColorspaceFrame ColorspaceComponent; - -typedef enum { - COLOR_SPEC_NONE = 0, - COLOR_SPEC_RGB, - COLOR_SPEC_GRAY, - COLOR_SPEC_YUV_BT470_6, - COLOR_SPEC_YUV_BT709 -} ColorSpaceColorSpec; - -typedef enum { - DITHER_NONE, - DITHER_VERTERR, - DITHER_HALFTONE -} ColorSpaceDitherMethod; - -struct _ColorspaceComponent { - int offset; - int stride; -}; - -struct _ColorspaceConvert { - gint width, height; - gboolean interlaced; - gboolean use_16bit; - gboolean dither; - - GstVideoFormat from_format; - ColorSpaceColorSpec from_spec; - GstVideoFormat to_format; - ColorSpaceColorSpec to_spec; - guint32 *palette; - - guint8 *tmpline; - guint16 *tmpline16; - guint16 *errline; - - int dest_offset[4]; - int dest_stride[4]; - int src_offset[4]; - int src_stride[4]; - - void (*convert) (ColorspaceConvert *convert, guint8 *dest, const guint8 *src); - void (*getline) (ColorspaceConvert *convert, guint8 *dest, const guint8 *src, int j); - void (*putline) (ColorspaceConvert *convert, guint8 *dest, const guint8 *src, int j); - void (*matrix) (ColorspaceConvert *convert); - - void (*getline16) (ColorspaceConvert *convert, guint16 *dest, const guint8 *src, int j); - void (*putline16) (ColorspaceConvert *convert, guint8 *dest, const guint16 *src, int j); - void (*matrix16) (ColorspaceConvert *convert); - void (*dither16) (ColorspaceConvert *convert, int j); -}; - -ColorspaceConvert * colorspace_convert_new (GstVideoFormat to_format, - ColorSpaceColorSpec from_spec, GstVideoFormat from_format, - ColorSpaceColorSpec to_spec, int width, int height); -void colorspace_convert_set_dither (ColorspaceConvert * convert, int type); -void colorspace_convert_set_interlaced (ColorspaceConvert *convert, - gboolean interlaced); -void colorspace_convert_set_palette (ColorspaceConvert *convert, - const guint32 *palette); -const guint32 * colorspace_convert_get_palette (ColorspaceConvert *convert); -void colorspace_convert_free (ColorspaceConvert * convert); -void colorspace_convert_convert (ColorspaceConvert * convert, - guint8 *dest, const guint8 *src); - - -G_END_DECLS - -#endif /* __GST_COLORSPACE_H__ */ diff --git a/gst/colorspace/colorspace.vcproj b/gst/colorspace/colorspace.vcproj deleted file mode 100644 index f6ca6ceb9..000000000 --- a/gst/colorspace/colorspace.vcproj +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="colorspace" - ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678AB}" - Keyword="Win32Proj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="../../win32/Debug" - IntermediateDirectory="../../win32/Debug" - ConfigurationType="2" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;"../../gst-libs";../../../popt/include;../../../libxml2/include/libxml2" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;colorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES" - MinimalRebuild="TRUE" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib" - OutputFile="$(OutDir)/gstcolorspace.dll" - LinkIncremental="2" - AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib" - ModuleDefinitionFile="" - GenerateDebugInformation="TRUE" - ProgramDatabaseFile="$(OutDir)/colorspace.pdb" - SubSystem="2" - OptimizeReferences="2" - ImportLibrary="$(OutDir)/gstcolorspace.lib" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="../../win32/Release" - IntermediateDirectory="../../win32/Release" - ConfigurationType="2" - CharacterSet="2"> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;"../../gst-libs";../../../popt/include;../../../libxml2/include/libxml2" - PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;colorspace_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib" - OutputFile="$(OutDir)/gstcolorspace.dll" - LinkIncremental="1" - AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib" - ModuleDefinitionFile="" - GenerateDebugInformation="TRUE" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - ImportLibrary="$(OutDir)/gstcolorspace.lib" - TargetMachine="1"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool" - CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - <File - RelativePath=".\gstcolorspace.c"> - </File> - <File - RelativePath=".\yuv2rgb.c"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> - <File - RelativePath=".\gstcolorspace.h"> - </File> - <File - RelativePath=".\yuv2rgb.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/gst/colorspace/gstcolorspace.c b/gst/colorspace/gstcolorspace.c deleted file mode 100644 index 6b512b5b2..000000000 --- a/gst/colorspace/gstcolorspace.c +++ /dev/null @@ -1,593 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * This file: - * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net> - * Copyright (C) 2010 David Schleef <ds@schleef.org> - * - * 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:element-colorspace - * - * Convert video frames between a great variety of colorspace formats. - * - * <refsect2> - * <title>Example launch line</title> - * |[ - * gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! colorspace ! ximagesink - * ]| - * </refsect2> - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gstcolorspace.h" -#include <gst/video/video.h> - -#include <string.h> - -GST_DEBUG_CATEGORY (colorspace_debug); -#define GST_CAT_DEFAULT colorspace_debug -GST_DEBUG_CATEGORY (colorspace_performance); - -enum -{ - PROP_0, - PROP_DITHER -}; - -#define CSP_VIDEO_CAPS \ - "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \ - "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ - "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, v210, v216, A420, AY64 } ;" \ - GST_VIDEO_CAPS_RGB";" \ - GST_VIDEO_CAPS_BGR";" \ - GST_VIDEO_CAPS_RGBx";" \ - GST_VIDEO_CAPS_xRGB";" \ - GST_VIDEO_CAPS_BGRx";" \ - GST_VIDEO_CAPS_xBGR";" \ - GST_VIDEO_CAPS_RGBA";" \ - GST_VIDEO_CAPS_ARGB";" \ - GST_VIDEO_CAPS_BGRA";" \ - GST_VIDEO_CAPS_ABGR";" \ - GST_VIDEO_CAPS_RGB_16";" \ - GST_VIDEO_CAPS_BGR_16";" \ - GST_VIDEO_CAPS_RGB_15";" \ - GST_VIDEO_CAPS_BGR_15";" \ - GST_VIDEO_CAPS_RGB8_PALETTED "; " \ - GST_VIDEO_CAPS_GRAY8";" \ - GST_VIDEO_CAPS_GRAY16("BIG_ENDIAN")";" \ - GST_VIDEO_CAPS_GRAY16("LITTLE_ENDIAN")";" \ - GST_VIDEO_CAPS_r210";" \ - GST_VIDEO_CAPS_ARGB_64 - -static GstStaticPadTemplate gst_csp_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (CSP_VIDEO_CAPS) - ); - -static GstStaticPadTemplate gst_csp_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (CSP_VIDEO_CAPS) - ); - -GType gst_csp_get_type (void); - -static void gst_csp_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_csp_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); -static void gst_csp_dispose (GObject * object); - -static gboolean gst_csp_set_caps (GstBaseTransform * btrans, - GstCaps * incaps, GstCaps * outcaps); -static gboolean gst_csp_get_unit_size (GstBaseTransform * btrans, - GstCaps * caps, guint * size); -static GstFlowReturn gst_csp_transform (GstBaseTransform * btrans, - GstBuffer * inbuf, GstBuffer * outbuf); - -static GQuark _QRAWRGB; /* "video/x-raw-rgb" */ -static GQuark _QRAWYUV; /* "video/x-raw-yuv" */ -static GQuark _QALPHAMASK; /* "alpha_mask" */ - - -static GType -dither_method_get_type (void) -{ - static GType gtype = 0; - - if (gtype == 0) { - static const GEnumValue values[] = { - {DITHER_NONE, "No dithering (default)", "none"}, - {DITHER_VERTERR, "Vertical error propogation", "verterr"}, - {DITHER_HALFTONE, "Half-tone", "halftone"}, - {0, NULL, NULL} - }; - - gtype = g_enum_register_static ("GstColorspaceDitherMethod", values); - } - return gtype; -} - -/* copies the given caps */ -static GstCaps * -gst_csp_caps_remove_format_info (GstCaps * caps) -{ - GstStructure *yuvst, *rgbst, *grayst; - - /* We know there's only one structure since we're given simple caps */ - caps = gst_caps_copy (caps); - - yuvst = gst_caps_get_structure (caps, 0); - - gst_structure_set_name (yuvst, "video/x-raw-yuv"); - gst_structure_remove_fields (yuvst, "format", "endianness", "depth", - "bpp", "red_mask", "green_mask", "blue_mask", "alpha_mask", - "palette_data", "color-matrix", NULL); - - rgbst = gst_structure_copy (yuvst); - gst_structure_set_name (rgbst, "video/x-raw-rgb"); - gst_structure_remove_fields (rgbst, "color-matrix", "chroma-site", NULL); - - grayst = gst_structure_copy (rgbst); - gst_structure_set_name (grayst, "video/x-raw-gray"); - - gst_caps_append_structure (caps, rgbst); - gst_caps_append_structure (caps, grayst); - - return caps; -} - - -static gboolean -gst_csp_structure_is_alpha (GstStructure * s) -{ - GQuark name; - - name = gst_structure_get_name_id (s); - - if (name == _QRAWRGB) { - return gst_structure_id_has_field (s, _QALPHAMASK); - } else if (name == _QRAWYUV) { - guint32 fourcc; - - if (!gst_structure_get_fourcc (s, "format", &fourcc)) - return FALSE; - - return (fourcc == GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')); - } - - return FALSE; -} - -/* The caps can be transformed into any other caps with format info removed. - * However, we should prefer passthrough, so if passthrough is possible, - * put it first in the list. */ -static GstCaps * -gst_csp_transform_caps (GstBaseTransform * btrans, - GstPadDirection direction, GstCaps * caps) -{ - GstCaps *template; - GstCaps *tmp, *tmp2; - GstCaps *result; - GstStructure *s; - GstCaps *alpha, *non_alpha; - - template = gst_static_pad_template_get_caps (&gst_csp_src_template); - result = gst_caps_copy (caps); - - /* Get all possible caps that we can transform to */ - tmp = gst_csp_caps_remove_format_info (caps); - tmp2 = gst_caps_intersect (tmp, template); - gst_caps_unref (tmp); - tmp = tmp2; - - /* Now move alpha formats to the beginning if caps is an alpha format - * or at the end if caps is no alpha format */ - alpha = gst_caps_new_empty (); - non_alpha = gst_caps_new_empty (); - - while ((s = gst_caps_steal_structure (tmp, 0))) { - if (gst_csp_structure_is_alpha (s)) - gst_caps_append_structure (alpha, s); - else - gst_caps_append_structure (non_alpha, s); - } - - s = gst_caps_get_structure (caps, 0); - gst_caps_unref (tmp); - - if (gst_csp_structure_is_alpha (s)) { - gst_caps_append (alpha, non_alpha); - tmp = alpha; - } else { - gst_caps_append (non_alpha, alpha); - tmp = non_alpha; - } - - gst_caps_append (result, tmp); - - GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %" - GST_PTR_FORMAT, caps, result); - - return result; -} - -static gboolean -gst_csp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, - GstCaps * outcaps) -{ - GstCsp *space; - GstVideoFormat in_format; - GstVideoFormat out_format; - gint in_height, in_width; - gint out_height, out_width; - gint in_fps_n, in_fps_d, in_par_n, in_par_d; - gint out_fps_n, out_fps_d, out_par_n, out_par_d; - gboolean have_in_par, have_out_par; - gboolean have_in_interlaced, have_out_interlaced; - gboolean in_interlaced, out_interlaced; - gboolean ret; - ColorSpaceColorSpec in_spec, out_spec; - - space = GST_CSP (btrans); - - if (space->convert) { - colorspace_convert_free (space->convert); - } - - /* input caps */ - - ret = gst_video_format_parse_caps (incaps, &in_format, &in_width, &in_height); - if (!ret) - goto no_width_height; - - ret = gst_video_parse_caps_framerate (incaps, &in_fps_n, &in_fps_d); - if (!ret) - goto no_framerate; - - have_in_par = gst_video_parse_caps_pixel_aspect_ratio (incaps, - &in_par_n, &in_par_d); - have_in_interlaced = gst_video_format_parse_caps_interlaced (incaps, - &in_interlaced); - - if (gst_video_format_is_rgb (in_format)) { - in_spec = COLOR_SPEC_RGB; - } else if (gst_video_format_is_yuv (in_format)) { - const gchar *matrix = gst_video_parse_caps_color_matrix (incaps); - - if (matrix && g_str_equal (matrix, "hdtv")) - in_spec = COLOR_SPEC_YUV_BT709; - else - in_spec = COLOR_SPEC_YUV_BT470_6; - } else { - in_spec = COLOR_SPEC_GRAY; - } - - /* output caps */ - - ret = - gst_video_format_parse_caps (outcaps, &out_format, &out_width, - &out_height); - if (!ret) - goto no_width_height; - - ret = gst_video_parse_caps_framerate (outcaps, &out_fps_n, &out_fps_d); - if (!ret) - goto no_framerate; - - have_out_par = gst_video_parse_caps_pixel_aspect_ratio (outcaps, - &out_par_n, &out_par_d); - have_out_interlaced = gst_video_format_parse_caps_interlaced (incaps, - &out_interlaced); - - if (gst_video_format_is_rgb (out_format)) { - out_spec = COLOR_SPEC_RGB; - } else if (gst_video_format_is_yuv (out_format)) { - const gchar *matrix = gst_video_parse_caps_color_matrix (outcaps); - - if (matrix && g_str_equal (matrix, "hdtv")) - out_spec = COLOR_SPEC_YUV_BT709; - else - out_spec = COLOR_SPEC_YUV_BT470_6; - } else { - out_spec = COLOR_SPEC_GRAY; - } - - /* these must match */ - if (in_width != out_width || in_height != out_height || - in_fps_n != out_fps_n || in_fps_d != out_fps_d) - goto format_mismatch; - - /* if present, these must match too */ - if (have_in_par && have_out_par && - (in_par_n != out_par_n || in_par_d != out_par_d)) - goto format_mismatch; - - /* if present, these must match too */ - if (have_in_interlaced && have_out_interlaced && - in_interlaced != out_interlaced) - goto format_mismatch; - - space->from_format = in_format; - space->from_spec = in_spec; - space->to_format = out_format; - space->to_spec = out_spec; - space->width = in_width; - space->height = in_height; - space->interlaced = in_interlaced; - - space->convert = colorspace_convert_new (out_format, out_spec, in_format, - in_spec, in_width, in_height); - if (space->convert) { - colorspace_convert_set_interlaced (space->convert, in_interlaced); - } - /* palette, only for from data */ - if (space->from_format == GST_VIDEO_FORMAT_RGB8_PALETTED && - space->to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) { - goto format_mismatch; - } else if (space->from_format == GST_VIDEO_FORMAT_RGB8_PALETTED) { - GstBuffer *palette; - - palette = gst_video_parse_caps_palette (incaps); - - if (!palette || GST_BUFFER_SIZE (palette) < 256 * 4) { - if (palette) - gst_buffer_unref (palette); - goto invalid_palette; - } - colorspace_convert_set_palette (space->convert, - (const guint32 *) GST_BUFFER_DATA (palette)); - gst_buffer_unref (palette); - } else if (space->to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) { - const guint32 *palette; - GstBuffer *p_buf; - - palette = colorspace_convert_get_palette (space->convert); - p_buf = gst_buffer_new_and_alloc (256 * 4); - memcpy (GST_BUFFER_DATA (p_buf), palette, 256 * 4); - gst_caps_set_simple (outcaps, "palette_data", GST_TYPE_BUFFER, p_buf, NULL); - gst_buffer_unref (p_buf); - } - - GST_DEBUG ("reconfigured %d %d", space->from_format, space->to_format); - - return TRUE; - - /* ERRORS */ -no_width_height: - { - GST_ERROR_OBJECT (space, "did not specify width or height"); - space->from_format = GST_VIDEO_FORMAT_UNKNOWN; - space->to_format = GST_VIDEO_FORMAT_UNKNOWN; - return FALSE; - } -no_framerate: - { - GST_ERROR_OBJECT (space, "did not specify framerate"); - space->from_format = GST_VIDEO_FORMAT_UNKNOWN; - space->to_format = GST_VIDEO_FORMAT_UNKNOWN; - return FALSE; - } -format_mismatch: - { - GST_ERROR_OBJECT (space, "input and output formats do not match"); - space->from_format = GST_VIDEO_FORMAT_UNKNOWN; - space->to_format = GST_VIDEO_FORMAT_UNKNOWN; - return FALSE; - } -invalid_palette: - { - GST_ERROR_OBJECT (space, "invalid palette"); - space->from_format = GST_VIDEO_FORMAT_UNKNOWN; - space->to_format = GST_VIDEO_FORMAT_UNKNOWN; - return FALSE; - } -} - -GST_BOILERPLATE (GstCsp, gst_csp, GstVideoFilter, GST_TYPE_VIDEO_FILTER); - -static void -gst_csp_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_csp_src_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_csp_sink_template)); - - gst_element_class_set_details_simple (element_class, - " Colorspace converter", "Filter/Converter/Video", - "Converts video from one colorspace to another", - "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>"); - - _QRAWRGB = g_quark_from_string ("video/x-raw-rgb"); - _QRAWYUV = g_quark_from_string ("video/x-raw-yuv"); - _QALPHAMASK = g_quark_from_string ("alpha_mask"); -} - -void -gst_csp_dispose (GObject * object) -{ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gst_csp_finalize (GObject * obj) -{ - GstCsp *space = GST_CSP (obj); - - if (space->convert) { - colorspace_convert_free (space->convert); - } - - G_OBJECT_CLASS (parent_class)->finalize (obj); - -} - -static void -gst_csp_class_init (GstCspClass * klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - GstBaseTransformClass *gstbasetransform_class = - (GstBaseTransformClass *) klass; - - gobject_class->set_property = gst_csp_set_property; - gobject_class->get_property = gst_csp_get_property; - gobject_class->dispose = gst_csp_dispose; - gobject_class->finalize = gst_csp_finalize; - - gstbasetransform_class->transform_caps = - GST_DEBUG_FUNCPTR (gst_csp_transform_caps); - gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_csp_set_caps); - gstbasetransform_class->get_unit_size = - GST_DEBUG_FUNCPTR (gst_csp_get_unit_size); - gstbasetransform_class->transform = GST_DEBUG_FUNCPTR (gst_csp_transform); - - gstbasetransform_class->passthrough_on_same_caps = TRUE; - - g_object_class_install_property (gobject_class, PROP_DITHER, - g_param_spec_enum ("dither", "Dither", "Apply dithering while converting", - dither_method_get_type (), DITHER_NONE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - -} - -static void -gst_csp_init (GstCsp * space, GstCspClass * klass) -{ - space->from_format = GST_VIDEO_FORMAT_UNKNOWN; - space->to_format = GST_VIDEO_FORMAT_UNKNOWN; -} - -void -gst_csp_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - GstCsp *csp; - - g_return_if_fail (GST_IS_CSP (object)); - csp = GST_CSP (object); - - switch (property_id) { - case PROP_DITHER: - csp->dither = g_value_get_enum (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_csp_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - GstCsp *csp; - - g_return_if_fail (GST_IS_CSP (object)); - csp = GST_CSP (object); - - switch (property_id) { - case PROP_DITHER: - g_value_set_enum (value, csp->dither); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static gboolean -gst_csp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, guint * size) -{ - gboolean ret = TRUE; - GstVideoFormat format; - gint width, height; - - g_assert (size); - - ret = gst_video_format_parse_caps (caps, &format, &width, &height); - if (ret) { - *size = gst_video_format_get_size (format, width, height); - } - - return ret; -} - -static GstFlowReturn -gst_csp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, - GstBuffer * outbuf) -{ - GstCsp *space; - - space = GST_CSP (btrans); - - GST_DEBUG ("from %d -> to %d", space->from_format, space->to_format); - - if (G_UNLIKELY (space->from_format == GST_VIDEO_FORMAT_UNKNOWN || - space->to_format == GST_VIDEO_FORMAT_UNKNOWN)) - goto unknown_format; - - colorspace_convert_set_dither (space->convert, space->dither); - - colorspace_convert_convert (space->convert, GST_BUFFER_DATA (outbuf), - GST_BUFFER_DATA (inbuf)); - - /* baseclass copies timestamps */ - GST_DEBUG ("from %d -> to %d done", space->from_format, space->to_format); - - return GST_FLOW_OK; - - /* ERRORS */ -unknown_format: - { - GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL), - ("attempting to convert colorspaces between unknown formats")); - return GST_FLOW_NOT_NEGOTIATED; - } -#if 0 -not_supported: - { - GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL), - ("cannot convert between formats")); - return GST_FLOW_NOT_SUPPORTED; - } -#endif -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (colorspace_debug, "colorspace", 0, - "Colorspace Converter"); - GST_DEBUG_CATEGORY_GET (colorspace_performance, "GST_PERFORMANCE"); - - return gst_element_register (plugin, "colorspace", - GST_RANK_NONE, GST_TYPE_CSP); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "colorspace", "Colorspace conversion", plugin_init, VERSION, "LGPL", "", "") diff --git a/gst/colorspace/gstcolorspace.h b/gst/colorspace/gstcolorspace.h deleted file mode 100644 index 71245b831..000000000 --- a/gst/colorspace/gstcolorspace.h +++ /dev/null @@ -1,69 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * This file: - * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.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_COLORSPACE_H__ -#define __GST_COLORSPACE_H__ - -#include <gst/gst.h> -#include <gst/video/video.h> -#include <gst/video/gstvideofilter.h> -#include "colorspace.h" - -G_BEGIN_DECLS - -#define GST_TYPE_CSP (gst_csp_get_type()) -#define GST_CSP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CSP,GstCsp)) -#define GST_CSP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CSP,GstCspClass)) -#define GST_IS_CSP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CSP)) -#define GST_IS_CSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CSP)) - -typedef struct _GstCsp GstCsp; -typedef struct _GstCspClass GstCspClass; - -/** - * GstCsp: - * - * Opaque object data structure. - */ -struct _GstCsp { - GstVideoFilter element; - - gint width, height; - gboolean interlaced; - gfloat fps; - - GstVideoFormat from_format; - ColorSpaceColorSpec from_spec; - GstVideoFormat to_format; - ColorSpaceColorSpec to_spec; - - ColorspaceConvert *convert; - gboolean dither; -}; - -struct _GstCspClass -{ - GstVideoFilterClass parent_class; -}; - -G_END_DECLS - -#endif /* __GST_COLORSPACE_H__ */ diff --git a/gst/colorspace/gstcolorspaceorc-dist.c b/gst/colorspace/gstcolorspaceorc-dist.c deleted file mode 100644 index 06d75b242..000000000 --- a/gst/colorspace/gstcolorspaceorc-dist.c +++ /dev/null @@ -1,19395 +0,0 @@ - -/* autogenerated from gstcolorspaceorc.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 cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int n); -void cogorc_downsample_vert_halfsite_4tap (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_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, - int p2, int n); -void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, - int p2, int n); -void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, - int n); -void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, - int n); -void orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int n); -void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int n); -void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, - int p2, int n); -void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, - guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, - const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, - guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, - const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, - guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, - const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, - guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, - guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int n); -void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, - guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, - guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int n); -void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int n); -void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, - const guint8 * ORC_RESTRICT s5, 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_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_YUY2 (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_YVYU (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, 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_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_getline_Y800 (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_getline_ABGR (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_NV12 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, 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_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, 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_YVYU (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_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, 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_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_putline_BGRA (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_putline_RGBA (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n); -void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - const guint8 * ORC_RESTRICT s1, int n); -void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - const guint8 * ORC_RESTRICT s1, 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); - - -/* 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 */ - - - -/* cogorc_memcpy_2d */ -#ifdef DISABLE_ORC -void -cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var32; - orc_int8 var33; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: copyb */ - var33 = var32; - /* 2: storeb */ - ptr0[i] = var33; - } - } - -} - -#else -static void -_backup_cogorc_memcpy_2d (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var32; - orc_int8 var33; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: copyb */ - var33 = var32; - /* 2: storeb */ - ptr0[i] = var33; - } - } - -} - -void -cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_memcpy_2d"); - orc_program_set_backup_function (p, _backup_cogorc_memcpy_2d); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 1, "s1"); - - orc_program_append_2 (p, "copyb", 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_downsample_horiz_cosite_1tap */ -#ifdef DISABLE_ORC -void -cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_union16 *) s1; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select0wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[0]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -#else -static void -_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select0wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[0]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -void -cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_downsample_horiz_cosite_1tap"); - orc_program_set_backup_function (p, - _backup_cogorc_downsample_horiz_cosite_1tap); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - - orc_program_append_2 (p, "select0wb", 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_downsample_horiz_cosite_3tap */ -#ifdef DISABLE_ORC -void -cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_int8 var42; - orc_union16 var43; - orc_int8 var44; - orc_int8 var45; - orc_int8 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_union16 *) s2; - - /* 9: loadpw */ - var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - /* 13: loadpw */ - var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var38 = ptr4[i]; - /* 1: copyw */ - var43.i = var38.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var43.i; - var44 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var43.i; - var45 = _src.x2[1]; - } - /* 4: loadw */ - var39 = ptr5[i]; - /* 5: select0wb */ - { - orc_union16 _src; - _src.i = var39.i; - var46 = _src.x2[0]; - } - /* 6: convubw */ - var47.i = (orc_uint8) var44; - /* 7: convubw */ - var48.i = (orc_uint8) var45; - /* 8: convubw */ - var49.i = (orc_uint8) var46; - /* 10: mullw */ - var50.i = (var48.i * var40.i) & 0xffff; - /* 11: addw */ - var51.i = var47.i + var49.i; - /* 12: addw */ - var52.i = var51.i + var50.i; - /* 14: addw */ - var53.i = var52.i + var41.i; - /* 15: shrsw */ - var54.i = var53.i >> 2; - /* 16: convsuswb */ - var42 = ORC_CLAMP_UB (var54.i); - /* 17: storeb */ - ptr0[i] = var42; - } - -} - -#else -static void -_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_int8 var42; - orc_union16 var43; - orc_int8 var44; - orc_int8 var45; - orc_int8 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_union16 *) ex->arrays[5]; - - /* 9: loadpw */ - var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - /* 13: loadpw */ - var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var38 = ptr4[i]; - /* 1: copyw */ - var43.i = var38.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var43.i; - var44 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var43.i; - var45 = _src.x2[1]; - } - /* 4: loadw */ - var39 = ptr5[i]; - /* 5: select0wb */ - { - orc_union16 _src; - _src.i = var39.i; - var46 = _src.x2[0]; - } - /* 6: convubw */ - var47.i = (orc_uint8) var44; - /* 7: convubw */ - var48.i = (orc_uint8) var45; - /* 8: convubw */ - var49.i = (orc_uint8) var46; - /* 10: mullw */ - var50.i = (var48.i * var40.i) & 0xffff; - /* 11: addw */ - var51.i = var47.i + var49.i; - /* 12: addw */ - var52.i = var51.i + var50.i; - /* 14: addw */ - var53.i = var52.i + var41.i; - /* 15: shrsw */ - var54.i = var53.i >> 2; - /* 16: convsuswb */ - var42 = ORC_CLAMP_UB (var54.i); - /* 17: storeb */ - ptr0[i] = var42; - } - -} - -void -cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_downsample_horiz_cosite_3tap"); - orc_program_set_backup_function (p, - _backup_cogorc_downsample_horiz_cosite_3tap); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_constant (p, 4, 0x00000002, "c1"); - 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, 2, "t4"); - orc_program_add_temporary (p, 2, "t5"); - orc_program_add_temporary (p, 2, "t6"); - - orc_program_append_2 (p, "copyw", 0, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T4, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T4, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T3, ORC_VAR_S2, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T4, ORC_VAR_T1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T5, ORC_VAR_T2, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T6, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T4, - 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_downsample_420_jpeg */ -#ifdef DISABLE_ORC -void -cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_int8 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_int8 var45; - orc_int8 var46; - orc_int8 var47; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_union16 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var40.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var40.i; - var41 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var40.i; - var42 = _src.x2[1]; - } - /* 4: avgub */ - var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; - /* 5: loadw */ - var38 = ptr5[i]; - /* 6: copyw */ - var44.i = var38.i; - /* 7: select0wb */ - { - orc_union16 _src; - _src.i = var44.i; - var45 = _src.x2[0]; - } - /* 8: select1wb */ - { - orc_union16 _src; - _src.i = var44.i; - var46 = _src.x2[1]; - } - /* 9: avgub */ - var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; - /* 10: avgub */ - var39 = ((orc_uint8) var43 + (orc_uint8) var47 + 1) >> 1; - /* 11: storeb */ - ptr0[i] = var39; - } - -} - -#else -static void -_backup_cogorc_downsample_420_jpeg (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_int8 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_int8 var45; - orc_int8 var46; - orc_int8 var47; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_union16 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var40.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var40.i; - var41 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var40.i; - var42 = _src.x2[1]; - } - /* 4: avgub */ - var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; - /* 5: loadw */ - var38 = ptr5[i]; - /* 6: copyw */ - var44.i = var38.i; - /* 7: select0wb */ - { - orc_union16 _src; - _src.i = var44.i; - var45 = _src.x2[0]; - } - /* 8: select1wb */ - { - orc_union16 _src; - _src.i = var44.i; - var46 = _src.x2[1]; - } - /* 9: avgub */ - var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; - /* 10: avgub */ - var39 = ((orc_uint8) var43 + (orc_uint8) var47 + 1) >> 1; - /* 11: storeb */ - ptr0[i] = var39; - } - -} - -void -cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_downsample_420_jpeg"); - orc_program_set_backup_function (p, _backup_cogorc_downsample_420_jpeg); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_temporary (p, 2, "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, 1, "t5"); - - orc_program_append_2 (p, "copyw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T2, ORC_VAR_T1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T3, ORC_VAR_T1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3, - ORC_VAR_D1); - orc_program_append_2 (p, "copyw", 0, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T4, ORC_VAR_T1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_downsample_vert_halfsite_2tap */ -#ifdef DISABLE_ORC -void -cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_cogorc_downsample_vert_halfsite_2tap (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 var32; - orc_int8 var33; - orc_int8 var34; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -void -cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_downsample_vert_halfsite_2tap"); - orc_program_set_backup_function (p, - _backup_cogorc_downsample_vert_halfsite_2tap); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_source (p, 1, "s2"); - - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, - 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_downsample_vert_cosite_3tap */ -#ifdef DISABLE_ORC -void -cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_int8 var36; - orc_int8 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 6: loadpw */ - var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - /* 10: loadpw */ - var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var41.i = (orc_uint8) var35; - /* 2: loadb */ - var36 = ptr5[i]; - /* 3: convubw */ - var42.i = (orc_uint8) var36; - /* 4: loadb */ - var37 = ptr6[i]; - /* 5: convubw */ - var43.i = (orc_uint8) var37; - /* 7: mullw */ - var44.i = (var42.i * var38.i) & 0xffff; - /* 8: addw */ - var45.i = var41.i + var43.i; - /* 9: addw */ - var46.i = var45.i + var44.i; - /* 11: addw */ - var47.i = var46.i + var39.i; - /* 12: shrsw */ - var48.i = var47.i >> 2; - /* 13: convsuswb */ - var40 = ORC_CLAMP_UB (var48.i); - /* 14: storeb */ - ptr0[i] = var40; - } - -} - -#else -static void -_backup_cogorc_downsample_vert_cosite_3tap (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; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_int8 var36; - orc_int8 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 6: loadpw */ - var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - /* 10: loadpw */ - var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var41.i = (orc_uint8) var35; - /* 2: loadb */ - var36 = ptr5[i]; - /* 3: convubw */ - var42.i = (orc_uint8) var36; - /* 4: loadb */ - var37 = ptr6[i]; - /* 5: convubw */ - var43.i = (orc_uint8) var37; - /* 7: mullw */ - var44.i = (var42.i * var38.i) & 0xffff; - /* 8: addw */ - var45.i = var41.i + var43.i; - /* 9: addw */ - var46.i = var45.i + var44.i; - /* 11: addw */ - var47.i = var46.i + var39.i; - /* 12: shrsw */ - var48.i = var47.i >> 2; - /* 13: convsuswb */ - var40 = ORC_CLAMP_UB (var48.i); - /* 14: storeb */ - ptr0[i] = var40; - } - -} - -void -cogorc_downsample_vert_cosite_3tap (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 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_downsample_vert_cosite_3tap"); - orc_program_set_backup_function (p, - _backup_cogorc_downsample_vert_cosite_3tap); - orc_program_add_destination (p, 1, "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, 4, 0x00000002, "c1"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - orc_program_add_temporary (p, 2, "t3"); - - 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, "convubw", 0, ORC_VAR_T3, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_downsample_vert_halfsite_4tap */ -#ifdef DISABLE_ORC -void -cogorc_downsample_vert_halfsite_4tap (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_int8 *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_int8 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - ptr7 = (orc_int8 *) s4; - - /* 9: loadpw */ - var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ - /* 12: loadpw */ - var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ - /* 15: loadpw */ - var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 2: loadb */ - var37 = ptr5[i]; - /* 3: convubw */ - var45.i = (orc_uint8) var37; - /* 4: loadb */ - var38 = ptr6[i]; - /* 5: convubw */ - var46.i = (orc_uint8) var38; - /* 6: loadb */ - var39 = ptr7[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 8: addw */ - var48.i = var45.i + var46.i; - /* 10: mullw */ - var49.i = (var48.i * var40.i) & 0xffff; - /* 11: addw */ - var50.i = var44.i + var47.i; - /* 13: mullw */ - var51.i = (var50.i * var41.i) & 0xffff; - /* 14: addw */ - var52.i = var49.i + var51.i; - /* 16: addw */ - var53.i = var52.i + var42.i; - /* 17: shrsw */ - var54.i = var53.i >> 6; - /* 18: convsuswb */ - var43 = ORC_CLAMP_UB (var54.i); - /* 19: storeb */ - ptr0[i] = var43; - } - -} - -#else -static void -_backup_cogorc_downsample_vert_halfsite_4tap (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; - const orc_int8 *ORC_RESTRICT ptr6; - const orc_int8 *ORC_RESTRICT ptr7; - orc_int8 var36; - orc_int8 var37; - orc_int8 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) 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]; - - /* 9: loadpw */ - var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ - /* 12: loadpw */ - var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ - /* 15: loadpw */ - var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 2: loadb */ - var37 = ptr5[i]; - /* 3: convubw */ - var45.i = (orc_uint8) var37; - /* 4: loadb */ - var38 = ptr6[i]; - /* 5: convubw */ - var46.i = (orc_uint8) var38; - /* 6: loadb */ - var39 = ptr7[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 8: addw */ - var48.i = var45.i + var46.i; - /* 10: mullw */ - var49.i = (var48.i * var40.i) & 0xffff; - /* 11: addw */ - var50.i = var44.i + var47.i; - /* 13: mullw */ - var51.i = (var50.i * var41.i) & 0xffff; - /* 14: addw */ - var52.i = var49.i + var51.i; - /* 16: addw */ - var53.i = var52.i + var42.i; - /* 17: shrsw */ - var54.i = var53.i >> 6; - /* 18: convsuswb */ - var43 = ORC_CLAMP_UB (var54.i); - /* 19: storeb */ - ptr0[i] = var43; - } - -} - -void -cogorc_downsample_vert_halfsite_4tap (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 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_downsample_vert_halfsite_4tap"); - orc_program_set_backup_function (p, - _backup_cogorc_downsample_vert_halfsite_4tap); - orc_program_add_destination (p, 1, "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_constant (p, 4, 0x0000001a, "c1"); - orc_program_add_constant (p, 4, 0x00000006, "c2"); - orc_program_add_constant (p, 4, 0x00000020, "c3"); - 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, 2, "t4"); - - 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, "convubw", 0, ORC_VAR_T3, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T4, ORC_VAR_S4, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T3, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T2, - 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; - 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_upsample_horiz_cosite_1tap */ -#ifdef DISABLE_ORC -void -cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n) -{ - int i; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - orc_int8 var35; - - ptr0 = (orc_union16 *) d1; - ptr4 = (orc_int8 *) s1; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: copyb */ - var35 = var33; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35; - _dest.x2[1] = var35; - var34.i = _dest.i; - } - /* 3: storew */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - orc_int8 var35; - - ptr0 = (orc_union16 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: copyb */ - var35 = var33; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35; - _dest.x2[1] = var35; - var34.i = _dest.i; - } - /* 3: storew */ - ptr0[i] = var34; - } - -} - -void -cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_upsample_horiz_cosite_1tap"); - orc_program_set_backup_function (p, - _backup_cogorc_upsample_horiz_cosite_1tap); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_temporary (p, 1, "t1"); - - orc_program_append_2 (p, "copyb", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, 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_upsample_horiz_cosite */ -#ifdef DISABLE_ORC -void -cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var34; - orc_int8 var35; - orc_union16 var36; - orc_int8 var37; - orc_int8 var38; - - ptr0 = (orc_union16 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: copyb */ - var37 = var34; - /* 2: loadb */ - var35 = ptr5[i]; - /* 3: avgub */ - var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37; - _dest.x2[1] = var38; - var36.i = _dest.i; - } - /* 5: storew */ - ptr0[i] = var36; - } - -} - -#else -static void -_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var34; - orc_int8 var35; - orc_union16 var36; - orc_int8 var37; - orc_int8 var38; - - ptr0 = (orc_union16 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: copyb */ - var37 = var34; - /* 2: loadb */ - var35 = ptr5[i]; - /* 3: avgub */ - var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37; - _dest.x2[1] = var38; - var36.i = _dest.i; - } - /* 5: storew */ - ptr0[i] = var36; - } - -} - -void -cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_upsample_horiz_cosite"); - orc_program_set_backup_function (p, _backup_cogorc_upsample_horiz_cosite); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_source (p, 1, "s2"); - orc_program_add_temporary (p, 1, "t1"); - orc_program_add_temporary (p, 1, "t2"); - - orc_program_append_2 (p, "copyb", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, 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_upsample_vert_avgub */ -#ifdef DISABLE_ORC -void -cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_cogorc_upsample_vert_avgub (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 var32; - orc_int8 var33; - orc_int8 var34; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -void -cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_upsample_vert_avgub"); - orc_program_set_backup_function (p, _backup_cogorc_upsample_vert_avgub); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_source (p, 1, "s2"); - - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, - 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 - - -/* orc_unpack_yuyv_y */ -#ifdef DISABLE_ORC -void -orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_union16 *) s1; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select0wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[0]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -#else -static void -_backup_orc_unpack_yuyv_y (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select0wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[0]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -void -orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_yuyv_y"); - orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_y); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - - orc_program_append_2 (p, "select0wb", 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 - - -/* orc_unpack_yuyv_u */ -#ifdef DISABLE_ORC -void -orc_unpack_yuyv_u (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_orc_unpack_yuyv_u (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 -orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_yuyv_u"); - orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_u); - 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 - - -/* orc_unpack_yuyv_v */ -#ifdef DISABLE_ORC -void -orc_unpack_yuyv_v (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: select1lw */ - { - orc_union32 _src; - _src.i = var33.i; - var35.i = _src.x2[1]; - } - /* 2: select1wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[1]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_orc_unpack_yuyv_v (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: select1lw */ - { - orc_union32 _src; - _src.i = var33.i; - var35.i = _src.x2[1]; - } - /* 2: select1wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[1]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -void -orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_yuyv_v"); - orc_program_set_backup_function (p, _backup_orc_unpack_yuyv_v); - 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, "select1lw", 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 - - -/* orc_pack_yuyv */ -#ifdef DISABLE_ORC -void -orc_pack_yuyv (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_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_union16 var37; - orc_int8 var38; - orc_int8 var39; - orc_union32 var40; - orc_union16 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - - ptr0 = (orc_union32 *) d1; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var41.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var41.i; - var42 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var41.i; - var43 = _src.x2[1]; - } - /* 4: loadb */ - var38 = ptr5[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var42; - _dest.x2[1] = var38; - var44.i = _dest.i; - } - /* 6: loadb */ - var39 = ptr6[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var43; - _dest.x2[1] = var39; - var45.i = _dest.i; - } - /* 8: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var44.i; - _dest.x2[1] = var45.i; - var40.i = _dest.i; - } - /* 9: storel */ - ptr0[i] = var40; - } - -} - -#else -static void -_backup_orc_pack_yuyv (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union32 *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_int8 var38; - orc_int8 var39; - orc_union32 var40; - orc_union16 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var41.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var41.i; - var42 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var41.i; - var43 = _src.x2[1]; - } - /* 4: loadb */ - var38 = ptr5[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var42; - _dest.x2[1] = var38; - var44.i = _dest.i; - } - /* 6: loadb */ - var39 = ptr6[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var43; - _dest.x2[1] = var39; - var45.i = _dest.i; - } - /* 8: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var44.i; - _dest.x2[1] = var45.i; - var40.i = _dest.i; - } - /* 9: storel */ - ptr0[i] = var40; - } - -} - -void -orc_pack_yuyv (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 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_pack_yuyv"); - orc_program_set_backup_function (p, _backup_orc_pack_yuyv); - orc_program_add_destination (p, 4, "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_temporary (p, 1, "t1"); - orc_program_add_temporary (p, 1, "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, "copyw", 0, ORC_VAR_T5, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T5, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T5, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_S3, - ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_unpack_uyvy_y */ -#ifdef DISABLE_ORC -void -orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_union16 *) s1; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select1wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[1]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -#else -static void -_backup_orc_unpack_uyvy_y (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var32; - orc_int8 var33; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var32 = ptr4[i]; - /* 1: select1wb */ - { - orc_union16 _src; - _src.i = var32.i; - var33 = _src.x2[1]; - } - /* 2: storeb */ - ptr0[i] = var33; - } - -} - -void -orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_uyvy_y"); - orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_y); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - - orc_program_append_2 (p, "select1wb", 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 - - -/* orc_unpack_uyvy_u */ -#ifdef DISABLE_ORC -void -orc_unpack_uyvy_u (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: select0wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[0]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_orc_unpack_uyvy_u (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: select0wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[0]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -void -orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_uyvy_u"); - orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_u); - 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, "select0wb", 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_unpack_uyvy_v */ -#ifdef DISABLE_ORC -void -orc_unpack_uyvy_v (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: select1lw */ - { - orc_union32 _src; - _src.i = var33.i; - var35.i = _src.x2[1]; - } - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[0]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -#else -static void -_backup_orc_unpack_uyvy_v (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: select1lw */ - { - orc_union32 _src; - _src.i = var33.i; - var35.i = _src.x2[1]; - } - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var35.i; - var34 = _src.x2[0]; - } - /* 3: storeb */ - ptr0[i] = var34; - } - -} - -void -orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_unpack_uyvy_v"); - orc_program_set_backup_function (p, _backup_orc_unpack_uyvy_v); - 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, "select1lw", 0, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 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_pack_uyvy */ -#ifdef DISABLE_ORC -void -orc_pack_uyvy (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_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_union16 var37; - orc_int8 var38; - orc_int8 var39; - orc_union32 var40; - orc_union16 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - - ptr0 = (orc_union32 *) d1; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var41.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var41.i; - var42 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var41.i; - var43 = _src.x2[1]; - } - /* 4: loadb */ - var38 = ptr5[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var38; - _dest.x2[1] = var42; - var44.i = _dest.i; - } - /* 6: loadb */ - var39 = ptr6[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39; - _dest.x2[1] = var43; - var45.i = _dest.i; - } - /* 8: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var44.i; - _dest.x2[1] = var45.i; - var40.i = _dest.i; - } - /* 9: storel */ - ptr0[i] = var40; - } - -} - -#else -static void -_backup_orc_pack_uyvy (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union32 *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_int8 var38; - orc_int8 var39; - orc_union32 var40; - orc_union16 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var37 = ptr4[i]; - /* 1: copyw */ - var41.i = var37.i; - /* 2: select0wb */ - { - orc_union16 _src; - _src.i = var41.i; - var42 = _src.x2[0]; - } - /* 3: select1wb */ - { - orc_union16 _src; - _src.i = var41.i; - var43 = _src.x2[1]; - } - /* 4: loadb */ - var38 = ptr5[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var38; - _dest.x2[1] = var42; - var44.i = _dest.i; - } - /* 6: loadb */ - var39 = ptr6[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39; - _dest.x2[1] = var43; - var45.i = _dest.i; - } - /* 8: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var44.i; - _dest.x2[1] = var45.i; - var40.i = _dest.i; - } - /* 9: storel */ - ptr0[i] = var40; - } - -} - -void -orc_pack_uyvy (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 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_pack_uyvy"); - orc_program_set_backup_function (p, _backup_orc_pack_uyvy); - orc_program_add_destination (p, 4, "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_temporary (p, 1, "t1"); - orc_program_add_temporary (p, 1, "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, "copyw", 0, ORC_VAR_T5, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T1, ORC_VAR_T5, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T5, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T4, ORC_VAR_S3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix2_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - /* 2: loadpw */ - var35.i = p1; - /* 6: loadpw */ - var37.i = p2; - /* 9: loadpw */ - var38.i = p3; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var40.i = (orc_uint8) var34; - /* 3: mullw */ - var41.i = (var40.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var42.i = (orc_uint8) var36; - /* 7: mullw */ - var43.i = (var42.i * var37.i) & 0xffff; - /* 8: addw */ - var44.i = var41.i + var43.i; - /* 10: addw */ - var45.i = var44.i + var38.i; - /* 11: shrsw */ - var46.i = var45.i >> 6; - /* 12: convsuswb */ - var39 = ORC_CLAMP_UB (var46.i); - /* 13: storeb */ - ptr0[i] = var39; - } - -} - -#else -static void -_backup_orc_matrix2_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 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - /* 2: loadpw */ - var35.i = ex->params[24]; - /* 6: loadpw */ - var37.i = ex->params[25]; - /* 9: loadpw */ - var38.i = ex->params[26]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var40.i = (orc_uint8) var34; - /* 3: mullw */ - var41.i = (var40.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var42.i = (orc_uint8) var36; - /* 7: mullw */ - var43.i = (var42.i * var37.i) & 0xffff; - /* 8: addw */ - var44.i = var41.i + var43.i; - /* 10: addw */ - var45.i = var44.i + var38.i; - /* 11: shrsw */ - var46.i = var45.i >> 6; - /* 12: convsuswb */ - var39 = ORC_CLAMP_UB (var46.i); - /* 13: storeb */ - ptr0[i] = var39; - } - -} - -void -orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix2_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix2_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, 0x00000006, "c1"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_parameter (p, 2, "p3"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1, - 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, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - ex->params[ORC_VAR_P3] = p3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix2_11_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, 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_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - /* 2: loadpw */ - var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var38.i = p1; - /* 8: loadpw */ - var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var41.i = p2; - /* 13: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 3: subw */ - var45.i = var44.i - var37.i; - /* 5: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 6: loadb */ - var39 = ptr5[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 9: subw */ - var48.i = var47.i - var40.i; - /* 11: mullw */ - var49.i = (var48.i * var41.i) & 0xffff; - /* 12: addw */ - var50.i = var46.i + var49.i; - /* 14: addw */ - var51.i = var50.i + var42.i; - /* 15: shrsw */ - var52.i = var51.i >> 8; - /* 16: addw */ - var53.i = var52.i + var45.i; - /* 17: addw */ - var54.i = var53.i + var48.i; - /* 18: convsuswb */ - var43 = ORC_CLAMP_UB (var54.i); - /* 19: storeb */ - ptr0[i] = var43; - } - -} - -#else -static void -_backup_orc_matrix2_11_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_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - /* 2: loadpw */ - var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var38.i = ex->params[24]; - /* 8: loadpw */ - var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var41.i = ex->params[25]; - /* 13: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 3: subw */ - var45.i = var44.i - var37.i; - /* 5: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 6: loadb */ - var39 = ptr5[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 9: subw */ - var48.i = var47.i - var40.i; - /* 11: mullw */ - var49.i = (var48.i * var41.i) & 0xffff; - /* 12: addw */ - var50.i = var46.i + var49.i; - /* 14: addw */ - var51.i = var50.i + var42.i; - /* 15: shrsw */ - var52.i = var51.i >> 8; - /* 16: addw */ - var53.i = var52.i + var45.i; - /* 17: addw */ - var54.i = var53.i + var48.i; - /* 18: convsuswb */ - var43 = ORC_CLAMP_UB (var54.i); - /* 19: storeb */ - ptr0[i] = var43; - } - -} - -void -orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix2_11_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix2_11_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, 0x00000010, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x00000008, "c3"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - 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, 2, "t4"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1, - 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_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, - 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix2_12_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, 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_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union16 var55; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - /* 2: loadpw */ - var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var38.i = p1; - /* 8: loadpw */ - var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var41.i = p2; - /* 13: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 3: subw */ - var45.i = var44.i - var37.i; - /* 5: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 6: loadb */ - var39 = ptr5[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 9: subw */ - var48.i = var47.i - var40.i; - /* 11: mullw */ - var49.i = (var48.i * var41.i) & 0xffff; - /* 12: addw */ - var50.i = var46.i + var49.i; - /* 14: addw */ - var51.i = var50.i + var42.i; - /* 15: shrsw */ - var52.i = var51.i >> 8; - /* 16: addw */ - var53.i = var52.i + var45.i; - /* 17: addw */ - var54.i = var53.i + var48.i; - /* 18: addw */ - var55.i = var54.i + var48.i; - /* 19: convsuswb */ - var43 = ORC_CLAMP_UB (var55.i); - /* 20: storeb */ - ptr0[i] = var43; - } - -} - -#else -static void -_backup_orc_matrix2_12_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_union16 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union16 var55; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - /* 2: loadpw */ - var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var38.i = ex->params[24]; - /* 8: loadpw */ - var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var41.i = ex->params[25]; - /* 13: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var36 = ptr4[i]; - /* 1: convubw */ - var44.i = (orc_uint8) var36; - /* 3: subw */ - var45.i = var44.i - var37.i; - /* 5: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 6: loadb */ - var39 = ptr5[i]; - /* 7: convubw */ - var47.i = (orc_uint8) var39; - /* 9: subw */ - var48.i = var47.i - var40.i; - /* 11: mullw */ - var49.i = (var48.i * var41.i) & 0xffff; - /* 12: addw */ - var50.i = var46.i + var49.i; - /* 14: addw */ - var51.i = var50.i + var42.i; - /* 15: shrsw */ - var52.i = var51.i >> 8; - /* 16: addw */ - var53.i = var52.i + var45.i; - /* 17: addw */ - var54.i = var53.i + var48.i; - /* 18: addw */ - var55.i = var54.i + var48.i; - /* 19: convsuswb */ - var43 = ORC_CLAMP_UB (var55.i); - /* 20: storeb */ - ptr0[i] = var43; - } - -} - -void -orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix2_12_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix2_12_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, 0x00000010, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x00000008, "c3"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - 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, 2, "t4"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1, - 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_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, - 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix3_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int p4, int n) -{ - int i; - orc_int8 *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_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 2: loadpw */ - var35.i = p1; - /* 6: loadpw */ - var37.i = p2; - /* 11: loadpw */ - var39.i = p3; - /* 14: loadpw */ - var40.i = p4; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var42.i = (orc_uint8) var34; - /* 3: mullw */ - var43.i = (var42.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var44.i = (orc_uint8) var36; - /* 7: mullw */ - var45.i = (var44.i * var37.i) & 0xffff; - /* 8: addw */ - var46.i = var43.i + var45.i; - /* 9: loadb */ - var38 = ptr6[i]; - /* 10: convubw */ - var47.i = (orc_uint8) var38; - /* 12: mullw */ - var48.i = (var47.i * var39.i) & 0xffff; - /* 13: addw */ - var49.i = var46.i + var48.i; - /* 15: addw */ - var50.i = var49.i + var40.i; - /* 16: shrsw */ - var51.i = var50.i >> 6; - /* 17: convsuswb */ - var41 = ORC_CLAMP_UB (var51.i); - /* 18: storeb */ - ptr0[i] = var41; - } - -} - -#else -static void -_backup_orc_matrix3_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; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 2: loadpw */ - var35.i = ex->params[24]; - /* 6: loadpw */ - var37.i = ex->params[25]; - /* 11: loadpw */ - var39.i = ex->params[26]; - /* 14: loadpw */ - var40.i = ex->params[27]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var42.i = (orc_uint8) var34; - /* 3: mullw */ - var43.i = (var42.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var44.i = (orc_uint8) var36; - /* 7: mullw */ - var45.i = (var44.i * var37.i) & 0xffff; - /* 8: addw */ - var46.i = var43.i + var45.i; - /* 9: loadb */ - var38 = ptr6[i]; - /* 10: convubw */ - var47.i = (orc_uint8) var38; - /* 12: mullw */ - var48.i = (var47.i * var39.i) & 0xffff; - /* 13: addw */ - var49.i = var46.i + var48.i; - /* 15: addw */ - var50.i = var49.i + var40.i; - /* 16: shrsw */ - var51.i = var50.i >> 6; - /* 17: convsuswb */ - var41 = ORC_CLAMP_UB (var51.i); - /* 18: storeb */ - ptr0[i] = var41; - } - -} - -void -orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int p4, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix3_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix3_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_source (p, 1, "s3"); - orc_program_add_constant (p, 4, 0x00000006, "c1"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_parameter (p, 2, "p3"); - orc_program_add_parameter (p, 2, "p4"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1, - 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, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - ex->params[ORC_VAR_P3] = p3; - ex->params[ORC_VAR_P4] = p4; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix3_100_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_union16 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_int8 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union16 var55; - orc_union16 var56; - orc_union16 var57; - orc_union16 var58; - orc_union16 var59; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 2: loadpw */ - var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var37.i = p1; - /* 8: loadpw */ - var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var40.i = p2; - /* 15: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 17: loadpw */ - var43.i = p3; - /* 20: loadpw */ - var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var46.i = (orc_uint8) var35; - /* 3: subw */ - var47.i = var46.i - var36.i; - /* 5: mullw */ - var48.i = (var47.i * var37.i) & 0xffff; - /* 6: loadb */ - var38 = ptr5[i]; - /* 7: convubw */ - var49.i = (orc_uint8) var38; - /* 9: subw */ - var50.i = var49.i - var39.i; - /* 11: mullw */ - var51.i = (var50.i * var40.i) & 0xffff; - /* 12: addw */ - var52.i = var48.i + var51.i; - /* 13: loadb */ - var41 = ptr6[i]; - /* 14: convubw */ - var53.i = (orc_uint8) var41; - /* 16: subw */ - var54.i = var53.i - var42.i; - /* 18: mullw */ - var55.i = (var54.i * var43.i) & 0xffff; - /* 19: addw */ - var56.i = var52.i + var55.i; - /* 21: addw */ - var57.i = var56.i + var44.i; - /* 22: shrsw */ - var58.i = var57.i >> 8; - /* 23: addw */ - var59.i = var58.i + var47.i; - /* 24: convsuswb */ - var45 = ORC_CLAMP_UB (var59.i); - /* 25: storeb */ - ptr0[i] = var45; - } - -} - -#else -static void -_backup_orc_matrix3_100_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; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_union16 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_int8 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union16 var55; - orc_union16 var56; - orc_union16 var57; - orc_union16 var58; - orc_union16 var59; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 2: loadpw */ - var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ - /* 4: loadpw */ - var37.i = ex->params[24]; - /* 8: loadpw */ - var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 10: loadpw */ - var40.i = ex->params[25]; - /* 15: loadpw */ - var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 17: loadpw */ - var43.i = ex->params[26]; - /* 20: loadpw */ - var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var46.i = (orc_uint8) var35; - /* 3: subw */ - var47.i = var46.i - var36.i; - /* 5: mullw */ - var48.i = (var47.i * var37.i) & 0xffff; - /* 6: loadb */ - var38 = ptr5[i]; - /* 7: convubw */ - var49.i = (orc_uint8) var38; - /* 9: subw */ - var50.i = var49.i - var39.i; - /* 11: mullw */ - var51.i = (var50.i * var40.i) & 0xffff; - /* 12: addw */ - var52.i = var48.i + var51.i; - /* 13: loadb */ - var41 = ptr6[i]; - /* 14: convubw */ - var53.i = (orc_uint8) var41; - /* 16: subw */ - var54.i = var53.i - var42.i; - /* 18: mullw */ - var55.i = (var54.i * var43.i) & 0xffff; - /* 19: addw */ - var56.i = var52.i + var55.i; - /* 21: addw */ - var57.i = var56.i + var44.i; - /* 22: shrsw */ - var58.i = var57.i >> 8; - /* 23: addw */ - var59.i = var58.i + var47.i; - /* 24: convsuswb */ - var45 = ORC_CLAMP_UB (var59.i); - /* 25: storeb */ - ptr0[i] = var45; - } - -} - -void -orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix3_100_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix3_100_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_source (p, 1, "s3"); - orc_program_add_constant (p, 4, 0x00000010, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x00000008, "c3"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_parameter (p, 2, "p3"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - orc_program_add_temporary (p, 2, "t3"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "subw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_P1, - 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_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "subw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, - 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - ex->params[ORC_VAR_P3] = p3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix3_100_offset_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, - int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_union16 var36; - orc_int8 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_int8 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 2: loadpw */ - var36.i = p1; - /* 6: loadpw */ - var38.i = p2; - /* 11: loadpw */ - var40.i = p3; - /* 14: loadpw */ - var41.i = p4; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var43.i = (orc_uint8) var35; - /* 3: mullw */ - var44.i = (var43.i * var36.i) & 0xffff; - /* 4: loadb */ - var37 = ptr5[i]; - /* 5: convubw */ - var45.i = (orc_uint8) var37; - /* 7: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 8: addw */ - var47.i = var44.i + var46.i; - /* 9: loadb */ - var39 = ptr6[i]; - /* 10: convubw */ - var48.i = (orc_uint8) var39; - /* 12: mullw */ - var49.i = (var48.i * var40.i) & 0xffff; - /* 13: addw */ - var50.i = var47.i + var49.i; - /* 15: addw */ - var51.i = var50.i + var41.i; - /* 16: shrsw */ - var52.i = var51.i >> p5; - /* 17: addw */ - var53.i = var52.i + var43.i; - /* 18: convsuswb */ - var42 = ORC_CLAMP_UB (var53.i); - /* 19: storeb */ - ptr0[i] = var42; - } - -} - -#else -static void -_backup_orc_matrix3_100_offset_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; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var35; - orc_union16 var36; - orc_int8 var37; - orc_union16 var38; - orc_int8 var39; - orc_union16 var40; - orc_union16 var41; - orc_int8 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 2: loadpw */ - var36.i = ex->params[24]; - /* 6: loadpw */ - var38.i = ex->params[25]; - /* 11: loadpw */ - var40.i = ex->params[26]; - /* 14: loadpw */ - var41.i = ex->params[27]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var35 = ptr4[i]; - /* 1: convubw */ - var43.i = (orc_uint8) var35; - /* 3: mullw */ - var44.i = (var43.i * var36.i) & 0xffff; - /* 4: loadb */ - var37 = ptr5[i]; - /* 5: convubw */ - var45.i = (orc_uint8) var37; - /* 7: mullw */ - var46.i = (var45.i * var38.i) & 0xffff; - /* 8: addw */ - var47.i = var44.i + var46.i; - /* 9: loadb */ - var39 = ptr6[i]; - /* 10: convubw */ - var48.i = (orc_uint8) var39; - /* 12: mullw */ - var49.i = (var48.i * var40.i) & 0xffff; - /* 13: addw */ - var50.i = var47.i + var49.i; - /* 15: addw */ - var51.i = var50.i + var41.i; - /* 16: shrsw */ - var52.i = var51.i >> ex->params[28]; - /* 17: addw */ - var53.i = var52.i + var43.i; - /* 18: convsuswb */ - var42 = ORC_CLAMP_UB (var53.i); - /* 19: storeb */ - ptr0[i] = var42; - } - -} - -void -orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix3_100_offset_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix3_100_offset_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_source (p, 1, "s3"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_parameter (p, 2, "p3"); - orc_program_add_parameter (p, 2, "p4"); - orc_program_add_parameter (p, 2, "p5"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - orc_program_add_temporary (p, 2, "t3"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_P1, - 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, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P5, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T3, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - ex->params[ORC_VAR_P3] = p3; - ex->params[ORC_VAR_P4] = p4; - ex->params[ORC_VAR_P5] = p5; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_matrix3_000_u8 */ -#ifdef DISABLE_ORC -void -orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int p4, int p5, int n) -{ - int i; - orc_int8 *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_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 2: loadpw */ - var35.i = p1; - /* 6: loadpw */ - var37.i = p2; - /* 11: loadpw */ - var39.i = p3; - /* 14: loadpw */ - var40.i = p4; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var42.i = (orc_uint8) var34; - /* 3: mullw */ - var43.i = (var42.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var44.i = (orc_uint8) var36; - /* 7: mullw */ - var45.i = (var44.i * var37.i) & 0xffff; - /* 8: addw */ - var46.i = var43.i + var45.i; - /* 9: loadb */ - var38 = ptr6[i]; - /* 10: convubw */ - var47.i = (orc_uint8) var38; - /* 12: mullw */ - var48.i = (var47.i * var39.i) & 0xffff; - /* 13: addw */ - var49.i = var46.i + var48.i; - /* 15: addw */ - var50.i = var49.i + var40.i; - /* 16: shrsw */ - var51.i = var50.i >> p5; - /* 17: convwb */ - var41 = var51.i; - /* 18: storeb */ - ptr0[i] = var41; - } - -} - -#else -static void -_backup_orc_matrix3_000_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; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_int8 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - orc_union16 var47; - orc_union16 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 2: loadpw */ - var35.i = ex->params[24]; - /* 6: loadpw */ - var37.i = ex->params[25]; - /* 11: loadpw */ - var39.i = ex->params[26]; - /* 14: loadpw */ - var40.i = ex->params[27]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var42.i = (orc_uint8) var34; - /* 3: mullw */ - var43.i = (var42.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var44.i = (orc_uint8) var36; - /* 7: mullw */ - var45.i = (var44.i * var37.i) & 0xffff; - /* 8: addw */ - var46.i = var43.i + var45.i; - /* 9: loadb */ - var38 = ptr6[i]; - /* 10: convubw */ - var47.i = (orc_uint8) var38; - /* 12: mullw */ - var48.i = (var47.i * var39.i) & 0xffff; - /* 13: addw */ - var49.i = var46.i + var48.i; - /* 15: addw */ - var50.i = var49.i + var40.i; - /* 16: shrsw */ - var51.i = var50.i >> ex->params[28]; - /* 17: convwb */ - var41 = var51.i; - /* 18: storeb */ - ptr0[i] = var41; - } - -} - -void -orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int p2, int p3, int p4, int p5, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_matrix3_000_u8"); - orc_program_set_backup_function (p, _backup_orc_matrix3_000_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_source (p, 1, "s3"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_parameter (p, 2, "p3"); - orc_program_add_parameter (p, 2, "p4"); - orc_program_add_parameter (p, 2, "p5"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1, - 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, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P3, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P5, - ORC_VAR_D1); - orc_program_append_2 (p, "convwb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - ex->params[ORC_VAR_P3] = p3; - ex->params[ORC_VAR_P4] = p4; - ex->params[ORC_VAR_P5] = p5; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_pack_123x */ -#ifdef DISABLE_ORC -void -orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - 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; - - /* 4: loadpb */ - var37 = p1; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: loadb */ - var35 = ptr5[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var34; - _dest.x2[1] = var35; - var39.i = _dest.i; - } - /* 3: loadb */ - var36 = ptr6[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] = var39.i; - _dest.x2[1] = var40.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -#else -static void -_backup_orc_pack_123x (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]; - - /* 4: loadpb */ - var37 = ex->params[24]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: loadb */ - var35 = ptr5[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var34; - _dest.x2[1] = var35; - var39.i = _dest.i; - } - /* 3: loadb */ - var36 = ptr6[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] = var39.i; - _dest.x2[1] = var40.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -void -orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_pack_123x"); - orc_program_set_backup_function (p, _backup_orc_pack_123x); - 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_parameter (p, 1, "p1"); - 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_S1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_P1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 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; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - - func = p->code_exec; - func (ex); -} -#endif - - -/* orc_pack_x123 */ -#ifdef DISABLE_ORC -void -orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - 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; - - /* 0: loadpb */ - var34 = p1; - - for (i = 0; i < n; i++) { - /* 1: loadb */ - var35 = ptr4[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var34; - _dest.x2[1] = var35; - var39.i = _dest.i; - } - /* 3: loadb */ - var36 = ptr5[i]; - /* 4: loadb */ - var37 = ptr6[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] = var39.i; - _dest.x2[1] = var40.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -#else -static void -_backup_orc_pack_x123 (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]; - - /* 0: loadpb */ - var34 = ex->params[24]; - - for (i = 0; i < n; i++) { - /* 1: loadb */ - var35 = ptr4[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var34; - _dest.x2[1] = var35; - var39.i = _dest.i; - } - /* 3: loadb */ - var36 = ptr5[i]; - /* 4: loadb */ - var37 = ptr6[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] = var39.i; - _dest.x2[1] = var40.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -void -orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_pack_x123"); - orc_program_set_backup_function (p, _backup_orc_pack_x123); - 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_parameter (p, 1, "p1"); - 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_P1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3, - ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 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; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_P1] = p1; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_combine2_u8 */ -#ifdef DISABLE_ORC -void -cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) -{ - int i; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - - ptr0 = (orc_int8 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - - /* 2: loadpw */ - var35.i = p1; - /* 6: loadpw */ - var37.i = p2; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var39.i = (orc_uint8) var34; - /* 3: mullw */ - var40.i = (var39.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var41.i = (orc_uint8) var36; - /* 7: mullw */ - var42.i = (var41.i * var37.i) & 0xffff; - /* 8: addw */ - var43.i = var40.i + var42.i; - /* 9: shruw */ - var44.i = ((orc_uint16) var43.i) >> 8; - /* 10: convsuswb */ - var38 = ORC_CLAMP_UB (var44.i); - /* 11: storeb */ - ptr0[i] = var38; - } - -} - -#else -static void -_backup_cogorc_combine2_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 var34; - orc_union16 var35; - orc_int8 var36; - orc_union16 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - orc_union16 var44; - - ptr0 = (orc_int8 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - - /* 2: loadpw */ - var35.i = ex->params[24]; - /* 6: loadpw */ - var37.i = ex->params[25]; - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var34 = ptr4[i]; - /* 1: convubw */ - var39.i = (orc_uint8) var34; - /* 3: mullw */ - var40.i = (var39.i * var35.i) & 0xffff; - /* 4: loadb */ - var36 = ptr5[i]; - /* 5: convubw */ - var41.i = (orc_uint8) var36; - /* 7: mullw */ - var42.i = (var41.i * var37.i) & 0xffff; - /* 8: addw */ - var43.i = var40.i + var42.i; - /* 9: shruw */ - var44.i = ((orc_uint16) var43.i) >> 8; - /* 10: convsuswb */ - var38 = ORC_CLAMP_UB (var44.i); - /* 11: storeb */ - ptr0[i] = var38; - } - -} - -void -cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_combine2_u8"); - orc_program_set_backup_function (p, _backup_cogorc_combine2_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, 0x00000008, "c1"); - orc_program_add_parameter (p, 2, "p1"); - orc_program_add_parameter (p, 2, "p2"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - - orc_program_append_2 (p, "convubw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_P1, - 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, "mullw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_P2, - ORC_VAR_D1); - orc_program_append_2 (p, "addw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "shruw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsuswb", 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_P1] = p1; - ex->params[ORC_VAR_P2] = p2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_I420_UYVY */ -#ifdef DISABLE_ORC -void -cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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; - orc_union32 *ORC_RESTRICT ptr1; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - const orc_int8 *ORC_RESTRICT ptr7; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - orc_union32 var38; - orc_union16 var39; - - ptr0 = (orc_union32 *) d1; - ptr1 = (orc_union32 *) d2; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_union16 *) s2; - ptr6 = (orc_int8 *) s3; - ptr7 = (orc_int8 *) s4; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr6[i]; - /* 1: loadb */ - var34 = ptr7[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var39.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[0]; - _dest.x2[1] = var35.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[1]; - _dest.x2[1] = var35.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - /* 6: loadw */ - var37 = ptr5[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[0]; - _dest.x2[1] = var37.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[1]; - _dest.x2[1] = var37.x2[1]; - var38.x2[1] = _dest.i; - } - /* 8: storel */ - ptr1[i] = var38; - } - -} - -#else -static void -_backup_cogorc_convert_I420_UYVY (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union32 *ORC_RESTRICT ptr0; - orc_union32 *ORC_RESTRICT ptr1; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - const orc_int8 *ORC_RESTRICT ptr7; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - orc_union32 var38; - orc_union16 var39; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr1 = (orc_union32 *) ex->arrays[1]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_union16 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - ptr7 = (orc_int8 *) ex->arrays[7]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr6[i]; - /* 1: loadb */ - var34 = ptr7[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var39.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[0]; - _dest.x2[1] = var35.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[1]; - _dest.x2[1] = var35.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - /* 6: loadw */ - var37 = ptr5[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[0]; - _dest.x2[1] = var37.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var39.x2[1]; - _dest.x2[1] = var37.x2[1]; - var38.x2[1] = _dest.i; - } - /* 8: storel */ - ptr1[i] = var38; - } - -} - -void -cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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 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_convert_I420_UYVY"); - orc_program_set_backup_function (p, _backup_cogorc_convert_I420_UYVY); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_destination (p, 4, "d2"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_source (p, 1, "s3"); - orc_program_add_source (p, 1, "s4"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_S2, - 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; - 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_convert_I420_YUY2 */ -#ifdef DISABLE_ORC -void -cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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; - orc_union32 *ORC_RESTRICT ptr1; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - const orc_int8 *ORC_RESTRICT ptr7; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - orc_union32 var38; - orc_union16 var39; - - ptr0 = (orc_union32 *) d1; - ptr1 = (orc_union32 *) d2; - ptr4 = (orc_union16 *) s1; - ptr5 = (orc_union16 *) s2; - ptr6 = (orc_int8 *) s3; - ptr7 = (orc_int8 *) s4; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr6[i]; - /* 1: loadb */ - var34 = ptr7[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var39.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[0]; - _dest.x2[1] = var39.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[1]; - _dest.x2[1] = var39.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - /* 6: loadw */ - var37 = ptr5[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var39.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var39.x2[1]; - var38.x2[1] = _dest.i; - } - /* 8: storel */ - ptr1[i] = var38; - } - -} - -#else -static void -_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union32 *ORC_RESTRICT ptr0; - orc_union32 *ORC_RESTRICT ptr1; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - const orc_int8 *ORC_RESTRICT ptr7; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - orc_union32 var38; - orc_union16 var39; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr1 = (orc_union32 *) ex->arrays[1]; - ptr4 = (orc_union16 *) ex->arrays[4]; - ptr5 = (orc_union16 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - ptr7 = (orc_int8 *) ex->arrays[7]; - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr6[i]; - /* 1: loadb */ - var34 = ptr7[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var39.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[0]; - _dest.x2[1] = var39.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[1]; - _dest.x2[1] = var39.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - /* 6: loadw */ - var37 = ptr5[i]; - /* 7: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var39.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var39.x2[1]; - var38.x2[1] = _dest.i; - } - /* 8: storel */ - ptr1[i] = var38; - } - -} - -void -cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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 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_convert_I420_YUY2"); - orc_program_set_backup_function (p, _backup_cogorc_convert_I420_YUY2); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_destination (p, 4, "d2"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_source (p, 1, "s3"); - orc_program_add_source (p, 1, "s4"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_S3, ORC_VAR_S4, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_S2, 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_D2] = d2; - 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_convert_I420_AYUV */ -#ifdef DISABLE_ORC -void -cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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; - orc_union32 *ORC_RESTRICT ptr1; - 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_union32 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - - ptr0 = (orc_union32 *) d1; - ptr1 = (orc_union32 *) d2; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - ptr7 = (orc_int8 *) s4; - - /* 3: loadpb */ - var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 8: loadpb */ - var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - - for (i = 0; i < n; i++) { - /* 0: loadupdb */ - var42 = ptr6[i >> 1]; - /* 1: loadupdb */ - var43 = ptr7[i >> 1]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var42; - _dest.x2[1] = var43; - var44.i = _dest.i; - } - /* 4: loadb */ - var37 = ptr4[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var36; - _dest.x2[1] = var37; - var45.i = _dest.i; - } - /* 6: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var45.i; - _dest.x2[1] = var44.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - /* 9: loadb */ - var40 = ptr5[i]; - /* 10: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39; - _dest.x2[1] = var40; - var46.i = _dest.i; - } - /* 11: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var46.i; - _dest.x2[1] = var44.i; - var41.i = _dest.i; - } - /* 12: storel */ - ptr1[i] = var41; - } - -} - -#else -static void -_backup_cogorc_convert_I420_AYUV (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union32 *ORC_RESTRICT ptr0; - orc_union32 *ORC_RESTRICT ptr1; - 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_union32 var41; - orc_int8 var42; - orc_int8 var43; - orc_union16 var44; - orc_union16 var45; - orc_union16 var46; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr1 = (orc_union32 *) ex->arrays[1]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - ptr7 = (orc_int8 *) ex->arrays[7]; - - /* 3: loadpb */ - var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 8: loadpb */ - var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - - for (i = 0; i < n; i++) { - /* 0: loadupdb */ - var42 = ptr6[i >> 1]; - /* 1: loadupdb */ - var43 = ptr7[i >> 1]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var42; - _dest.x2[1] = var43; - var44.i = _dest.i; - } - /* 4: loadb */ - var37 = ptr4[i]; - /* 5: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var36; - _dest.x2[1] = var37; - var45.i = _dest.i; - } - /* 6: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var45.i; - _dest.x2[1] = var44.i; - var38.i = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - /* 9: loadb */ - var40 = ptr5[i]; - /* 10: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var39; - _dest.x2[1] = var40; - var46.i = _dest.i; - } - /* 11: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var46.i; - _dest.x2[1] = var44.i; - var41.i = _dest.i; - } - /* 12: storel */ - ptr1[i] = var41; - } - -} - -void -cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - 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 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_convert_I420_AYUV"); - orc_program_set_backup_function (p, _backup_cogorc_convert_I420_AYUV); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_destination (p, 4, "d2"); - 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_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_S3, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "loadupdb", 0, ORC_VAR_T4, ORC_VAR_S4, - 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_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_C1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D2, 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_D2] = d2; - 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_convert_YUY2_I420 */ -#ifdef DISABLE_ORC -void -cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union32 *ORC_RESTRICT ptr4; - const orc_union32 *ORC_RESTRICT ptr5; - orc_union32 var35; - orc_union32 var36; - orc_int8 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - ptr0 = (orc_union16 *) d1; - ptr1 = (orc_union16 *) d2; - ptr2 = (orc_int8 *) d3; - ptr3 = (orc_int8 *) d4; - ptr4 = (orc_union32 *) s1; - ptr5 = (orc_union32 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var40.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var40.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var40; - /* 3: loadl */ - var36 = ptr5[i]; - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var36.x2[0]; - var41.x2[0] = _src.x2[1]; - var42.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var36.x2[1]; - var41.x2[1] = _src.x2[1]; - var42.x2[1] = _src.x2[0]; - } - /* 5: storew */ - ptr1[i] = var42; - /* 6: avgub */ - var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; - var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; - /* 7: splitwb */ - { - orc_union16 _src; - _src.i = var43.i; - var37 = _src.x2[1]; - var38 = _src.x2[0]; - } - /* 8: storeb */ - ptr3[i] = var37; - /* 9: storeb */ - ptr2[i] = var38; - } - -} - -#else -static void -_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union32 *ORC_RESTRICT ptr4; - const orc_union32 *ORC_RESTRICT ptr5; - orc_union32 var35; - orc_union32 var36; - orc_int8 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - ptr0 = (orc_union16 *) ex->arrays[0]; - ptr1 = (orc_union16 *) ex->arrays[1]; - ptr2 = (orc_int8 *) ex->arrays[2]; - ptr3 = (orc_int8 *) ex->arrays[3]; - ptr4 = (orc_union32 *) ex->arrays[4]; - ptr5 = (orc_union32 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var40.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var40.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var40; - /* 3: loadl */ - var36 = ptr5[i]; - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var36.x2[0]; - var41.x2[0] = _src.x2[1]; - var42.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var36.x2[1]; - var41.x2[1] = _src.x2[1]; - var42.x2[1] = _src.x2[0]; - } - /* 5: storew */ - ptr1[i] = var42; - /* 6: avgub */ - var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; - var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; - /* 7: splitwb */ - { - orc_union16 _src; - _src.i = var43.i; - var37 = _src.x2[1]; - var38 = _src.x2[0]; - } - /* 8: storeb */ - ptr3[i] = var37; - /* 9: storeb */ - ptr2[i] = var38; - } - -} - -void -cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_convert_YUY2_I420"); - orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_I420); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_destination (p, 1, "d3"); - orc_program_add_destination (p, 1, "d4"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_source (p, 4, "s2"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - orc_program_add_temporary (p, 2, "t3"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, 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_D2] = d2; - ex->arrays[ORC_VAR_D3] = d3; - ex->arrays[ORC_VAR_D4] = d4; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->arrays[ORC_VAR_S2] = (void *) s2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_UYVY_YUY2 */ -#ifdef DISABLE_ORC -void -cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var32; - orc_union32 var33; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var32 = ptr4[i]; - /* 1: swapw */ - var33.x2[0] = ORC_SWAP_W (var32.x2[0]); - var33.x2[1] = ORC_SWAP_W (var32.x2[1]); - /* 2: storel */ - ptr0[i] = var33; - } - } - -} - -#else -static void -_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var32; - orc_union32 var33; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var32 = ptr4[i]; - /* 1: swapw */ - var33.x2[0] = ORC_SWAP_W (var32.x2[0]); - var33.x2[1] = ORC_SWAP_W (var32.x2[1]); - /* 2: storel */ - ptr0[i] = var33; - } - } - -} - -void -cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_UYVY_YUY2"); - orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_YUY2); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 4, "s1"); - - orc_program_append_2 (p, "swapw", 1, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_420_422 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m) -{ - int i; - int j; - orc_int8 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - orc_int8 var35; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: copyb */ - var33 = var32; - /* 2: storeb */ - ptr0[i] = var33; - /* 3: loadb */ - var34 = ptr4[i]; - /* 4: copyb */ - var35 = var34; - /* 5: storeb */ - ptr1[i] = var35; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_int8 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - orc_int8 var35; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: copyb */ - var33 = var32; - /* 2: storeb */ - ptr0[i] = var33; - /* 3: loadb */ - var34 = ptr4[i]; - /* 4: copyb */ - var35 = var34; - /* 5: storeb */ - ptr1[i] = var35; - } - } - -} - -void -cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_420_422"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_420_422); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_destination (p, 1, "d2"); - orc_program_add_source (p, 1, "s1"); - - orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "copyb", 0, ORC_VAR_D2, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_420_444 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: splatbw */ - var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff); - /* 2: storew */ - ptr0[i] = var34; - /* 3: storew */ - ptr1[i] = var34; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: splatbw */ - var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff); - /* 2: storew */ - ptr0[i] = var34; - /* 3: storew */ - ptr1[i] = var34; - } - } - -} - -void -cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, - int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_420_444"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_420_444); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_422_444 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: splatbw */ - var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff); - /* 2: storew */ - ptr0[i] = var34; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - orc_int8 var33; - orc_union16 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr4[i]; - /* 1: splatbw */ - var34.i = ((var33 & 0xff) << 8) | (var33 & 0xff); - /* 2: storew */ - ptr0[i] = var34; - } - } - -} - -void -cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_422_444"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_422_444); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_444_422 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_int8 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var34 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var34.i; - var36 = _src.x2[1]; - var37 = _src.x2[0]; - } - /* 2: avgub */ - var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var35; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_int8 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var34 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var34.i; - var36 = _src.x2[1]; - var37 = _src.x2[0]; - } - /* 2: avgub */ - var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var35; - } - } - -} - -void -cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_444_422"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_444_422); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_temporary (p, 1, "t1"); - orc_program_add_temporary (p, 1, "t2"); - - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_444_420 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - int i; - int j; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var35; - orc_union16 var36; - orc_int8 var37; - orc_union16 var38; - orc_int8 var39; - orc_int8 var40; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var35 = ptr4[i]; - /* 1: loadw */ - var36 = ptr5[i]; - /* 2: avgub */ - var38.x2[0] = - ((orc_uint8) var35.x2[0] + (orc_uint8) var36.x2[0] + 1) >> 1; - var38.x2[1] = - ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var38.i; - var39 = _src.x2[1]; - var40 = _src.x2[0]; - } - /* 4: avgub */ - var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; - /* 5: storeb */ - ptr0[i] = var37; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_int8 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - orc_union16 var35; - orc_union16 var36; - orc_int8 var37; - orc_union16 var38; - orc_int8 var39; - orc_int8 var40; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var35 = ptr4[i]; - /* 1: loadw */ - var36 = ptr5[i]; - /* 2: avgub */ - var38.x2[0] = - ((orc_uint8) var35.x2[0] + (orc_uint8) var36.x2[0] + 1) >> 1; - var38.x2[1] = - ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var38.i; - var39 = _src.x2[1]; - var40 = _src.x2[0]; - } - /* 4: avgub */ - var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; - /* 5: storeb */ - ptr0[i] = var37; - } - } - -} - -void -cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_444_420"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_444_420); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 1, "t2"); - orc_program_add_temporary (p, 1, "t3"); - - orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_planar_chroma_422_420 */ -#ifdef DISABLE_ORC -void -cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - int i; - int j; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - } - -} - -#else -static void -_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_int8 *ORC_RESTRICT ptr0; - const orc_int8 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - orc_int8 var32; - orc_int8 var33; - orc_int8 var34; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var32 = ptr4[i]; - /* 1: loadb */ - var33 = ptr5[i]; - /* 2: avgub */ - var34 = ((orc_uint8) var32 + (orc_uint8) var33 + 1) >> 1; - /* 3: storeb */ - ptr0[i] = var34; - } - } - -} - -void -cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_planar_chroma_422_420"); - orc_program_set_backup_function (p, _backup_cogorc_planar_chroma_422_420); - orc_program_add_destination (p, 1, "d1"); - orc_program_add_source (p, 1, "s1"); - orc_program_add_source (p, 1, "s2"); - - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_YUY2_AYUV */ -#ifdef DISABLE_ORC -void -cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 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_convert_YUY2_AYUV (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 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_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_YUY2_AYUV"); - orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_AYUV); - 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_UYVY_AYUV */ -#ifdef DISABLE_ORC -void -cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 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_convert_UYVY_AYUV (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 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_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_UYVY_AYUV"); - orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_AYUV); - 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_YUY2_Y42B */ -#ifdef DISABLE_ORC -void -cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var33; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var33 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var33.x2[0]; - var37.x2[0] = _src.x2[1]; - var34.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var33.x2[1]; - var37.x2[1] = _src.x2[1]; - var34.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var34; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var37.i; - var35 = _src.x2[1]; - var36 = _src.x2[0]; - } - /* 4: storeb */ - ptr2[i] = var35; - /* 5: storeb */ - ptr1[i] = var36; - } - } - -} - -#else -static void -_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var33; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var33 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var33.x2[0]; - var37.x2[0] = _src.x2[1]; - var34.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var33.x2[1]; - var37.x2[1] = _src.x2[1]; - var34.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var34; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var37.i; - var35 = _src.x2[1]; - var36 = _src.x2[0]; - } - /* 4: storeb */ - ptr2[i] = var35; - /* 5: storeb */ - ptr1[i] = var36; - } - } - -} - -void -cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_YUY2_Y42B"); - orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_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, 4, "s1"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_UYVY_Y42B */ -#ifdef DISABLE_ORC -void -cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var33; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var33 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var33.x2[0]; - var34.x2[0] = _src.x2[1]; - var37.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var33.x2[1]; - var34.x2[1] = _src.x2[1]; - var37.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var34; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var37.i; - var35 = _src.x2[1]; - var36 = _src.x2[0]; - } - /* 4: storeb */ - ptr2[i] = var35; - /* 5: storeb */ - ptr1[i] = var36; - } - } - -} - -#else -static void -_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_int8 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var33; - orc_union16 var34; - orc_int8 var35; - orc_int8 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var33 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var33.x2[0]; - var34.x2[0] = _src.x2[1]; - var37.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var33.x2[1]; - var34.x2[1] = _src.x2[1]; - var37.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var34; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var37.i; - var35 = _src.x2[1]; - var36 = _src.x2[0]; - } - /* 4: storeb */ - ptr2[i] = var35; - /* 5: storeb */ - ptr1[i] = var36; - } - } - -} - -void -cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_UYVY_Y42B"); - orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_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, 4, "s1"); - orc_program_add_temporary (p, 2, "t1"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_YUY2_Y444 */ -#ifdef DISABLE_ORC -void -cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_union16 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var35; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_int8 var41; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var36.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var36.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var36; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var39.i; - var40 = _src.x2[1]; - var41 = _src.x2[0]; - } - /* 4: splatbw */ - var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); - /* 5: storew */ - ptr1[i] = var37; - /* 6: splatbw */ - var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff); - /* 7: storew */ - ptr2[i] = var38; - } - } - -} - -#else -static void -_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_union16 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var35; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_int8 var41; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var36.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var36.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var36; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var39.i; - var40 = _src.x2[1]; - var41 = _src.x2[0]; - } - /* 4: splatbw */ - var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); - /* 5: storew */ - ptr1[i] = var37; - /* 6: splatbw */ - var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff); - /* 7: storew */ - ptr2[i] = var38; - } - } - -} - -void -cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_YUY2_Y444"); - orc_program_set_backup_function (p, _backup_cogorc_convert_YUY2_Y444); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_destination (p, 2, "d3"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 1, "t2"); - orc_program_add_temporary (p, 1, "t3"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_UYVY_Y444 */ -#ifdef DISABLE_ORC -void -cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_union16 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var35; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_int8 var41; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var36.x2[0] = _src.x2[1]; - var39.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var36.x2[1] = _src.x2[1]; - var39.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var36; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var39.i; - var40 = _src.x2[1]; - var41 = _src.x2[0]; - } - /* 4: splatbw */ - var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); - /* 5: storew */ - ptr1[i] = var37; - /* 6: splatbw */ - var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff); - /* 7: storew */ - ptr2[i] = var38; - } - } - -} - -#else -static void -_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_union16 *ORC_RESTRICT ptr2; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var35; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union16 var39; - orc_int8 var40; - orc_int8 var41; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var36.x2[0] = _src.x2[1]; - var39.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var36.x2[1] = _src.x2[1]; - var39.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var36; - /* 3: splitwb */ - { - orc_union16 _src; - _src.i = var39.i; - var40 = _src.x2[1]; - var41 = _src.x2[0]; - } - /* 4: splatbw */ - var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); - /* 5: storew */ - ptr1[i] = var37; - /* 6: splatbw */ - var38.i = ((var40 & 0xff) << 8) | (var40 & 0xff); - /* 7: storew */ - ptr2[i] = var38; - } - } - -} - -void -cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_UYVY_Y444"); - orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_Y444); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_destination (p, 2, "d3"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 1, "t2"); - orc_program_add_temporary (p, 1, "t3"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_UYVY_I420 */ -#ifdef DISABLE_ORC -void -cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - int i; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union32 *ORC_RESTRICT ptr4; - const orc_union32 *ORC_RESTRICT ptr5; - orc_union32 var35; - orc_union32 var36; - orc_int8 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - ptr0 = (orc_union16 *) d1; - ptr1 = (orc_union16 *) d2; - ptr2 = (orc_int8 *) d3; - ptr3 = (orc_int8 *) d4; - ptr4 = (orc_union32 *) s1; - ptr5 = (orc_union32 *) s2; - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var40.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var40.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var39; - /* 3: loadl */ - var36 = ptr5[i]; - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var36.x2[0]; - var41.x2[0] = _src.x2[1]; - var42.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var36.x2[1]; - var41.x2[1] = _src.x2[1]; - var42.x2[1] = _src.x2[0]; - } - /* 5: storew */ - ptr1[i] = var41; - /* 6: avgub */ - var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; - var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; - /* 7: splitwb */ - { - orc_union16 _src; - _src.i = var43.i; - var37 = _src.x2[1]; - var38 = _src.x2[0]; - } - /* 8: storeb */ - ptr3[i] = var37; - /* 9: storeb */ - ptr2[i] = var38; - } - -} - -#else -static void -_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int n = ex->n; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union32 *ORC_RESTRICT ptr4; - const orc_union32 *ORC_RESTRICT ptr5; - orc_union32 var35; - orc_union32 var36; - orc_int8 var37; - orc_int8 var38; - orc_union16 var39; - orc_union16 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - ptr0 = (orc_union16 *) ex->arrays[0]; - ptr1 = (orc_union16 *) ex->arrays[1]; - ptr2 = (orc_int8 *) ex->arrays[2]; - ptr3 = (orc_int8 *) ex->arrays[3]; - ptr4 = (orc_union32 *) ex->arrays[4]; - ptr5 = (orc_union32 *) ex->arrays[5]; - - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var35 = ptr4[i]; - /* 1: splitwb */ - { - orc_union16 _src; - _src.i = var35.x2[0]; - var39.x2[0] = _src.x2[1]; - var40.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var35.x2[1]; - var39.x2[1] = _src.x2[1]; - var40.x2[1] = _src.x2[0]; - } - /* 2: storew */ - ptr0[i] = var39; - /* 3: loadl */ - var36 = ptr5[i]; - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var36.x2[0]; - var41.x2[0] = _src.x2[1]; - var42.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var36.x2[1]; - var41.x2[1] = _src.x2[1]; - var42.x2[1] = _src.x2[0]; - } - /* 5: storew */ - ptr1[i] = var41; - /* 6: avgub */ - var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; - var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; - /* 7: splitwb */ - { - orc_union16 _src; - _src.i = var43.i; - var37 = _src.x2[1]; - var38 = _src.x2[0]; - } - /* 8: storeb */ - ptr3[i] = var37; - /* 9: storeb */ - ptr2[i] = var38; - } - -} - -void -cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, - guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_convert_UYVY_I420"); - orc_program_set_backup_function (p, _backup_cogorc_convert_UYVY_I420); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_destination (p, 1, "d3"); - orc_program_add_destination (p, 1, "d4"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_source (p, 4, "s2"); - orc_program_add_temporary (p, 2, "t1"); - orc_program_add_temporary (p, 2, "t2"); - orc_program_add_temporary (p, 2, "t3"); - - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, 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_D2] = d2; - ex->arrays[ORC_VAR_D3] = d3; - ex->arrays[ORC_VAR_D4] = d4; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->arrays[ORC_VAR_S2] = (void *) s2; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_I420 */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - int i; - int j; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union64 *ORC_RESTRICT ptr4; - const orc_union64 *ORC_RESTRICT ptr5; - orc_union64 var40; - orc_union16 var41; - orc_union64 var42; - orc_union16 var43; - orc_int8 var44; - orc_int8 var45; - orc_union32 var46; - orc_union32 var47; - orc_union32 var48; - orc_union32 var49; - orc_union32 var50; - orc_union16 var51; - orc_union16 var52; - orc_int8 var53; - orc_int8 var54; - orc_int8 var55; - orc_int8 var56; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr3 = ORC_PTR_OFFSET (d4, d4_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadq */ - var40 = ptr4[i]; - /* 1: splitlw */ - { - orc_union32 _src; - _src.i = var40.x2[0]; - var46.x2[0] = _src.x2[1]; - var47.x2[0] = _src.x2[0]; - } - { - orc_union32 _src; - _src.i = var40.x2[1]; - var46.x2[1] = _src.x2[1]; - var47.x2[1] = _src.x2[0]; - } - /* 2: select1wb */ - { - orc_union16 _src; - _src.i = var47.x2[0]; - var41.x2[0] = _src.x2[1]; - } - { - orc_union16 _src; - _src.i = var47.x2[1]; - var41.x2[1] = _src.x2[1]; - } - /* 3: storew */ - ptr0[i] = var41; - /* 4: loadq */ - var42 = ptr5[i]; - /* 5: splitlw */ - { - orc_union32 _src; - _src.i = var42.x2[0]; - var48.x2[0] = _src.x2[1]; - var49.x2[0] = _src.x2[0]; - } - { - orc_union32 _src; - _src.i = var42.x2[1]; - var48.x2[1] = _src.x2[1]; - var49.x2[1] = _src.x2[0]; - } - /* 6: select1wb */ - { - orc_union16 _src; - _src.i = var49.x2[0]; - var43.x2[0] = _src.x2[1]; - } - { - orc_union16 _src; - _src.i = var49.x2[1]; - var43.x2[1] = _src.x2[1]; - } - /* 7: storew */ - ptr1[i] = var43; - /* 8: avgub */ - var50.x4[0] = - ((orc_uint8) var46.x4[0] + (orc_uint8) var48.x4[0] + 1) >> 1; - var50.x4[1] = - ((orc_uint8) var46.x4[1] + (orc_uint8) var48.x4[1] + 1) >> 1; - var50.x4[2] = - ((orc_uint8) var46.x4[2] + (orc_uint8) var48.x4[2] + 1) >> 1; - var50.x4[3] = - ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; - /* 9: splitwb */ - { - orc_union16 _src; - _src.i = var50.x2[0]; - var51.x2[0] = _src.x2[1]; - var52.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var50.x2[1]; - var51.x2[1] = _src.x2[1]; - var52.x2[1] = _src.x2[0]; - } - /* 10: splitwb */ - { - orc_union16 _src; - _src.i = var52.i; - var53 = _src.x2[1]; - var54 = _src.x2[0]; - } - /* 11: avgub */ - var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; - /* 12: storeb */ - ptr2[i] = var44; - /* 13: splitwb */ - { - orc_union16 _src; - _src.i = var51.i; - var55 = _src.x2[1]; - var56 = _src.x2[0]; - } - /* 14: avgub */ - var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; - /* 15: storeb */ - ptr3[i] = var45; - } - } - -} - -#else -static void -_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union16 *ORC_RESTRICT ptr0; - orc_union16 *ORC_RESTRICT ptr1; - orc_int8 *ORC_RESTRICT ptr2; - orc_int8 *ORC_RESTRICT ptr3; - const orc_union64 *ORC_RESTRICT ptr4; - const orc_union64 *ORC_RESTRICT ptr5; - orc_union64 var40; - orc_union16 var41; - orc_union64 var42; - orc_union16 var43; - orc_int8 var44; - orc_int8 var45; - orc_union32 var46; - orc_union32 var47; - orc_union32 var48; - orc_union32 var49; - orc_union32 var50; - orc_union16 var51; - orc_union16 var52; - orc_int8 var53; - orc_int8 var54; - orc_int8 var55; - orc_int8 var56; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr3 = ORC_PTR_OFFSET (ex->arrays[3], ex->params[3] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadq */ - var40 = ptr4[i]; - /* 1: splitlw */ - { - orc_union32 _src; - _src.i = var40.x2[0]; - var46.x2[0] = _src.x2[1]; - var47.x2[0] = _src.x2[0]; - } - { - orc_union32 _src; - _src.i = var40.x2[1]; - var46.x2[1] = _src.x2[1]; - var47.x2[1] = _src.x2[0]; - } - /* 2: select1wb */ - { - orc_union16 _src; - _src.i = var47.x2[0]; - var41.x2[0] = _src.x2[1]; - } - { - orc_union16 _src; - _src.i = var47.x2[1]; - var41.x2[1] = _src.x2[1]; - } - /* 3: storew */ - ptr0[i] = var41; - /* 4: loadq */ - var42 = ptr5[i]; - /* 5: splitlw */ - { - orc_union32 _src; - _src.i = var42.x2[0]; - var48.x2[0] = _src.x2[1]; - var49.x2[0] = _src.x2[0]; - } - { - orc_union32 _src; - _src.i = var42.x2[1]; - var48.x2[1] = _src.x2[1]; - var49.x2[1] = _src.x2[0]; - } - /* 6: select1wb */ - { - orc_union16 _src; - _src.i = var49.x2[0]; - var43.x2[0] = _src.x2[1]; - } - { - orc_union16 _src; - _src.i = var49.x2[1]; - var43.x2[1] = _src.x2[1]; - } - /* 7: storew */ - ptr1[i] = var43; - /* 8: avgub */ - var50.x4[0] = - ((orc_uint8) var46.x4[0] + (orc_uint8) var48.x4[0] + 1) >> 1; - var50.x4[1] = - ((orc_uint8) var46.x4[1] + (orc_uint8) var48.x4[1] + 1) >> 1; - var50.x4[2] = - ((orc_uint8) var46.x4[2] + (orc_uint8) var48.x4[2] + 1) >> 1; - var50.x4[3] = - ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; - /* 9: splitwb */ - { - orc_union16 _src; - _src.i = var50.x2[0]; - var51.x2[0] = _src.x2[1]; - var52.x2[0] = _src.x2[0]; - } - { - orc_union16 _src; - _src.i = var50.x2[1]; - var51.x2[1] = _src.x2[1]; - var52.x2[1] = _src.x2[0]; - } - /* 10: splitwb */ - { - orc_union16 _src; - _src.i = var52.i; - var53 = _src.x2[1]; - var54 = _src.x2[0]; - } - /* 11: avgub */ - var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; - /* 12: storeb */ - ptr2[i] = var44; - /* 13: splitwb */ - { - orc_union16 _src; - _src.i = var51.i; - var55 = _src.x2[1]; - var56 = _src.x2[0]; - } - /* 14: avgub */ - var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; - /* 15: storeb */ - ptr3[i] = var45; - } - } - -} - -void -cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_I420"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_I420); - orc_program_add_destination (p, 2, "d1"); - orc_program_add_destination (p, 2, "d2"); - orc_program_add_destination (p, 1, "d3"); - orc_program_add_destination (p, 1, "d4"); - orc_program_add_source (p, 8, "s1"); - orc_program_add_source (p, 8, "s2"); - orc_program_add_temporary (p, 4, "t1"); - orc_program_add_temporary (p, 4, "t2"); - orc_program_add_temporary (p, 4, "t3"); - orc_program_add_temporary (p, 4, "t4"); - orc_program_add_temporary (p, 2, "t5"); - orc_program_add_temporary (p, 2, "t6"); - orc_program_add_temporary (p, 1, "t7"); - orc_program_add_temporary (p, 1, "t8"); - - 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", 1, ORC_VAR_T3, ORC_VAR_T1, ORC_VAR_S2, - ORC_VAR_D1); - orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D2, ORC_VAR_T1, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 2, ORC_VAR_T4, ORC_VAR_T2, ORC_VAR_T3, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_T5, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T7, ORC_VAR_T8, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_T6, - ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_D4, 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_D4] = d4; - ex->params[ORC_VAR_D4] = d4_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_YUY2 */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - 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_convert_AYUV_YUY2 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - 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_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_YUY2"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_UYVY */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - 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_convert_AYUV_UYVY (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - 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_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_UYVY"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_Y42B */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - 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_convert_AYUV_Y42B (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - 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_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_Y42B"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_Y444 */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr1 = ORC_PTR_OFFSET (d2, d2_stride * j); - ptr2 = ORC_PTR_OFFSET (d3, d3_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - - 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_convert_AYUV_Y444 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr1 = ORC_PTR_OFFSET (ex->arrays[1], ex->params[1] * j); - ptr2 = ORC_PTR_OFFSET (ex->arrays[2], ex->params[2] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - - 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_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, - guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, - int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_Y444"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_D2] = d2; - ex->params[ORC_VAR_D2] = d2_stride; - ex->arrays[ORC_VAR_D3] = d3; - ex->params[ORC_VAR_D3] = d3_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y42B_YUY2 */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr5[i]; - /* 1: loadb */ - var34 = ptr6[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var37.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[0]; - _dest.x2[1] = var37.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[1]; - _dest.x2[1] = var37.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - } - } - -} - -#else -static void -_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr5[i]; - /* 1: loadb */ - var34 = ptr6[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var37.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[0]; - _dest.x2[1] = var37.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var35.x2[1]; - _dest.x2[1] = var37.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - } - } - -} - -void -cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y42B_YUY2"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_YUY2); - orc_program_add_destination (p, 4, "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_temporary (p, 2, "t1"); - - 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_D1, ORC_VAR_S1, ORC_VAR_T1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y42B_UYVY */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr5[i]; - /* 1: loadb */ - var34 = ptr6[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var37.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var35.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var35.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - } - } - -} - -#else -static void -_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_int8 *ORC_RESTRICT ptr5; - const orc_int8 *ORC_RESTRICT ptr6; - orc_int8 var33; - orc_int8 var34; - orc_union16 var35; - orc_union32 var36; - orc_union16 var37; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var33 = ptr5[i]; - /* 1: loadb */ - var34 = ptr6[i]; - /* 2: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var33; - _dest.x2[1] = var34; - var37.i = _dest.i; - } - /* 3: loadw */ - var35 = ptr4[i]; - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var35.x2[0]; - var36.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var35.x2[1]; - var36.x2[1] = _dest.i; - } - /* 5: storel */ - ptr0[i] = var36; - } - } - -} - -void -cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y42B_UYVY"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_UYVY); - orc_program_add_destination (p, 4, "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_temporary (p, 2, "t1"); - - 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_D1, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y42B_AYUV */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - /* 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_convert_Y42B_AYUV (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - /* 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_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y42B_AYUV"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y42B_AYUV); - 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y444_YUY2 */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_union16 *ORC_RESTRICT ptr6; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union32 var39; - orc_union32 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var36 = ptr5[i]; - /* 1: loadw */ - var37 = ptr6[i]; - /* 2: 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; - } - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var40.i; - var41.i = _src.x2[1]; - var42.i = _src.x2[0]; - } - /* 4: 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; - /* 5: loadw */ - var38 = ptr4[i]; - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var38.x2[0]; - _dest.x2[1] = var43.x2[0]; - var39.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var38.x2[1]; - _dest.x2[1] = var43.x2[1]; - var39.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var39; - } - } - -} - -#else -static void -_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_union16 *ORC_RESTRICT ptr6; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union32 var39; - orc_union32 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var36 = ptr5[i]; - /* 1: loadw */ - var37 = ptr6[i]; - /* 2: 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; - } - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var40.i; - var41.i = _src.x2[1]; - var42.i = _src.x2[0]; - } - /* 4: 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; - /* 5: loadw */ - var38 = ptr4[i]; - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var38.x2[0]; - _dest.x2[1] = var43.x2[0]; - var39.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var38.x2[1]; - _dest.x2[1] = var43.x2[1]; - var39.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var39; - } - } - -} - -void -cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y444_YUY2"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_YUY2); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_source (p, 2, "s3"); - orc_program_add_temporary (p, 2, "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, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3, - 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_T1, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y444_UYVY */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_union16 *ORC_RESTRICT ptr6; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union32 var39; - orc_union32 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var36 = ptr5[i]; - /* 1: loadw */ - var37 = ptr6[i]; - /* 2: 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; - } - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var40.i; - var41.i = _src.x2[1]; - var42.i = _src.x2[0]; - } - /* 4: 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; - /* 5: loadw */ - var38 = ptr4[i]; - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var43.x2[0]; - _dest.x2[1] = var38.x2[0]; - var39.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var43.x2[1]; - _dest.x2[1] = var38.x2[1]; - var39.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var39; - } - } - -} - -#else -static void -_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union16 *ORC_RESTRICT ptr4; - const orc_union16 *ORC_RESTRICT ptr5; - const orc_union16 *ORC_RESTRICT ptr6; - orc_union16 var36; - orc_union16 var37; - orc_union16 var38; - orc_union32 var39; - orc_union32 var40; - orc_union16 var41; - orc_union16 var42; - orc_union16 var43; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - - for (i = 0; i < n; i++) { - /* 0: loadw */ - var36 = ptr5[i]; - /* 1: loadw */ - var37 = ptr6[i]; - /* 2: 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; - } - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var40.i; - var41.i = _src.x2[1]; - var42.i = _src.x2[0]; - } - /* 4: 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; - /* 5: loadw */ - var38 = ptr4[i]; - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var43.x2[0]; - _dest.x2[1] = var38.x2[0]; - var39.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var43.x2[1]; - _dest.x2[1] = var38.x2[1]; - var39.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var39; - } - } - -} - -void -cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y444_UYVY"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_UYVY); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 2, "s1"); - orc_program_add_source (p, 2, "s2"); - orc_program_add_source (p, 2, "s3"); - orc_program_add_temporary (p, 2, "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, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S2, ORC_VAR_S3, - 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_T1, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_Y444_AYUV */ -#ifdef DISABLE_ORC -void -cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - int i; - int j; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - ptr5 = ORC_PTR_OFFSET (s2, s2_stride * j); - ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); - - /* 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_convert_Y444_AYUV (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - 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; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - ptr5 = ORC_PTR_OFFSET (ex->arrays[5], ex->params[5] * j); - ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); - - /* 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_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, - const guint8 * ORC_RESTRICT s2, int s2_stride, - const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_Y444_AYUV"); - orc_program_set_backup_function (p, _backup_cogorc_convert_Y444_AYUV); - 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; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->params[ORC_VAR_S2] = s2_stride; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->params[ORC_VAR_S3] = s3_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_ARGB */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var61; - _dest.x2[1] = var87; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var88; - _dest.x2[1] = var89; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -#else -static void -_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var61; - _dest.x2[1] = var87; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var88; - _dest.x2[1] = var89; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -void -cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_ARGB"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_ARGB); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_constant (p, 1, 0x00000008, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - 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_add_temporary (p, 1, "t5"); - orc_program_add_temporary (p, 1, "t6"); - orc_program_add_temporary (p, 2, "t7"); - orc_program_add_temporary (p, 2, "t8"); - orc_program_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 2, "t10"); - orc_program_add_temporary (p, 2, "t11"); - orc_program_add_temporary (p, 2, "t12"); - orc_program_add_temporary (p, 1, "t13"); - orc_program_add_temporary (p, 1, "t14"); - orc_program_add_temporary (p, 1, "t15"); - orc_program_add_temporary (p, 4, "t16"); - - orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T9, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T8, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, - ORC_VAR_T13, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T14, - ORC_VAR_T15, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_BGRA */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var89; - _dest.x2[1] = var88; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var61; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -#else -static void -_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var89; - _dest.x2[1] = var88; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var61; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -void -cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_BGRA"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_BGRA); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_constant (p, 1, 0x00000008, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - 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_add_temporary (p, 1, "t5"); - orc_program_add_temporary (p, 1, "t6"); - orc_program_add_temporary (p, 2, "t7"); - orc_program_add_temporary (p, 2, "t8"); - orc_program_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 2, "t10"); - orc_program_add_temporary (p, 2, "t11"); - orc_program_add_temporary (p, 2, "t12"); - orc_program_add_temporary (p, 1, "t13"); - orc_program_add_temporary (p, 1, "t14"); - orc_program_add_temporary (p, 1, "t15"); - orc_program_add_temporary (p, 4, "t16"); - - orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T9, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T8, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T15, - ORC_VAR_T14, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T13, - ORC_VAR_T3, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_ABGR */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var61; - _dest.x2[1] = var89; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var88; - _dest.x2[1] = var87; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -#else -static void -_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var61; - _dest.x2[1] = var89; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var88; - _dest.x2[1] = var87; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -void -cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_ABGR"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_ABGR); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_constant (p, 1, 0x00000008, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - 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_add_temporary (p, 1, "t5"); - orc_program_add_temporary (p, 1, "t6"); - orc_program_add_temporary (p, 2, "t7"); - orc_program_add_temporary (p, 2, "t8"); - orc_program_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 2, "t10"); - orc_program_add_temporary (p, 2, "t11"); - orc_program_add_temporary (p, 2, "t12"); - orc_program_add_temporary (p, 1, "t13"); - orc_program_add_temporary (p, 1, "t14"); - orc_program_add_temporary (p, 1, "t15"); - orc_program_add_temporary (p, 4, "t16"); - - orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T9, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T8, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T3, - ORC_VAR_T15, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T14, - ORC_VAR_T13, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_AYUV_RGBA */ -#ifdef DISABLE_ORC -void -cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - int i; - int j; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (d1, d1_stride * j); - ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var88; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var89; - _dest.x2[1] = var61; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -#else -static void -_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ORC_RESTRICT ex) -{ - int i; - int j; - int n = ex->n; - int m = ex->params[ORC_VAR_A1]; - orc_union32 *ORC_RESTRICT ptr0; - const orc_union32 *ORC_RESTRICT ptr4; - orc_union32 var48; - orc_union32 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_union32 var55; - orc_union32 var56; - orc_union32 var57; - orc_union16 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_int8 var87; - orc_int8 var88; - orc_int8 var89; - orc_union16 var90; - orc_union16 var91; - orc_union32 var92; - - for (j = 0; j < m; j++) { - ptr0 = ORC_PTR_OFFSET (ex->arrays[0], ex->params[0] * j); - ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); - - /* 1: loadpb */ - var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 14: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 21: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 25: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 29: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 40: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadl */ - var48 = ptr4[i]; - /* 2: subb */ - var57.x4[0] = var48.x4[0] - var49.x4[0]; - var57.x4[1] = var48.x4[1] - var49.x4[1]; - var57.x4[2] = var48.x4[2] - var49.x4[2]; - var57.x4[3] = var48.x4[3] - var49.x4[3]; - /* 3: splitlw */ - { - orc_union32 _src; - _src.i = var57.i; - var58.i = _src.x2[1]; - var59.i = _src.x2[0]; - } - /* 4: splitwb */ - { - orc_union16 _src; - _src.i = var59.i; - var60 = _src.x2[1]; - var61 = _src.x2[0]; - } - /* 5: splitwb */ - { - orc_union16 _src; - _src.i = var58.i; - var62 = _src.x2[1]; - var63 = _src.x2[0]; - } - /* 6: convsbw */ - var64.i = var60; - /* 7: convsbw */ - var65.i = var63; - /* 8: convsbw */ - var66.i = var62; - /* 10: mullw */ - var67.i = (var64.i * var50.i) & 0xffff; - /* 11: shrsw */ - var68.i = var67.i >> 8; - /* 12: addssw */ - var69.i = ORC_CLAMP_SW (var64.i + var68.i); - /* 13: addssw */ - var70.i = ORC_CLAMP_SW (var69.i + var66.i); - /* 15: mullw */ - var71.i = (var66.i * var51.i) & 0xffff; - /* 16: shrsw */ - var72.i = var71.i >> 8; - /* 17: subssw */ - var73.i = ORC_CLAMP_SW (var70.i - var72.i); - /* 18: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var66.i); - /* 19: addssw */ - var75.i = ORC_CLAMP_SW (var69.i + var65.i); - /* 20: addssw */ - var76.i = ORC_CLAMP_SW (var75.i + var65.i); - /* 22: mullw */ - var77.i = (var65.i * var52.i) & 0xffff; - /* 23: shrsw */ - var78.i = var77.i >> 8; - /* 24: addssw */ - var79.i = ORC_CLAMP_SW (var76.i + var78.i); - /* 26: mullw */ - var80.i = (var65.i * var53.i) & 0xffff; - /* 27: shrsw */ - var81.i = var80.i >> 8; - /* 28: subssw */ - var82.i = ORC_CLAMP_SW (var69.i - var81.i); - /* 30: mullw */ - var83.i = (var66.i * var54.i) & 0xffff; - /* 31: shrsw */ - var84.i = var83.i >> 8; - /* 32: subssw */ - var85.i = ORC_CLAMP_SW (var82.i - var84.i); - /* 33: subssw */ - var86.i = ORC_CLAMP_SW (var85.i - var84.i); - /* 34: convssswb */ - var87 = ORC_CLAMP_SB (var74.i); - /* 35: convssswb */ - var88 = ORC_CLAMP_SB (var86.i); - /* 36: convssswb */ - var89 = ORC_CLAMP_SB (var79.i); - /* 37: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var88; - var90.i = _dest.i; - } - /* 38: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var89; - _dest.x2[1] = var61; - var91.i = _dest.i; - } - /* 39: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var90.i; - _dest.x2[1] = var91.i; - var92.i = _dest.i; - } - /* 41: addb */ - var56.x4[0] = var92.x4[0] + var55.x4[0]; - var56.x4[1] = var92.x4[1] + var55.x4[1]; - var56.x4[2] = var92.x4[2] + var55.x4[2]; - var56.x4[3] = var92.x4[3] + var55.x4[3]; - /* 42: storel */ - ptr0[i] = var56; - } - } - -} - -void -cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, - const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_2d (p); - orc_program_set_name (p, "cogorc_convert_AYUV_RGBA"); - orc_program_set_backup_function (p, _backup_cogorc_convert_AYUV_RGBA); - orc_program_add_destination (p, 4, "d1"); - orc_program_add_source (p, 4, "s1"); - orc_program_add_constant (p, 1, 0x00000008, "c1"); - orc_program_add_constant (p, 4, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - 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_add_temporary (p, 1, "t5"); - orc_program_add_temporary (p, 1, "t6"); - orc_program_add_temporary (p, 2, "t7"); - orc_program_add_temporary (p, 2, "t8"); - orc_program_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 2, "t10"); - orc_program_add_temporary (p, 2, "t11"); - orc_program_add_temporary (p, 2, "t12"); - orc_program_add_temporary (p, 1, "t13"); - orc_program_add_temporary (p, 1, "t14"); - orc_program_add_temporary (p, 1, "t15"); - orc_program_add_temporary (p, 4, "t16"); - - orc_program_append_2 (p, "subb", 2, 47, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitlw", 0, ORC_VAR_T1, ORC_VAR_T2, 47, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T9, ORC_VAR_T6, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T7, ORC_VAR_T9, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T9, ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T7, ORC_VAR_T8, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T8, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T12, ORC_VAR_T12, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T8, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T9, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T11, ORC_VAR_T11, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T14, ORC_VAR_T11, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T15, ORC_VAR_T12, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T13, - ORC_VAR_T14, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T15, - ORC_VAR_T3, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, 47, ORC_VAR_T1, ORC_VAR_T2, - ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, - ORC_VAR_D1); - - orc_program_compile (p); - } - p_inited = TRUE; - orc_once_mutex_unlock (); - } - ex->program = p; - - ex->n = n; - ORC_EXECUTOR_M (ex) = m; - ex->arrays[ORC_VAR_D1] = d1; - ex->params[ORC_VAR_D1] = d1_stride; - ex->arrays[ORC_VAR_S1] = (void *) s1; - ex->params[ORC_VAR_S1] = s1_stride; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_I420_BGRA */ -#ifdef DISABLE_ORC -void -cogorc_convert_I420_BGRA (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 var45; - orc_int8 var46; - orc_int8 var47; - orc_int8 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_int8 var54; - orc_union32 var55; - orc_union32 var56; - orc_int8 var57; - orc_union16 var58; - orc_int8 var59; - orc_int8 var60; - orc_union16 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_int8 var85; - orc_int8 var86; - orc_int8 var87; - orc_union16 var88; - orc_union16 var89; - orc_union32 var90; - - ptr0 = (orc_union32 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - - /* 1: loadpb */ - var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 5: loadpb */ - var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpb */ - var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 12: loadpw */ - var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 17: loadpw */ - var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 24: loadpw */ - var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 28: loadpw */ - var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 32: loadpw */ - var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 41: loadpb */ - var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 44: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var45 = ptr4[i]; - /* 2: subb */ - var57 = var45 - var46; - /* 3: convsbw */ - var58.i = var57; - /* 4: loadupib */ - var59 = - (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] + - 1) >> 1 : ptr5[i >> 1]; - /* 6: subb */ - var60 = var59 - var47; - /* 7: convsbw */ - var61.i = var60; - /* 8: loadupib */ - var62 = - (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] + - 1) >> 1 : ptr6[i >> 1]; - /* 10: subb */ - var63 = var62 - var48; - /* 11: convsbw */ - var64.i = var63; - /* 13: mullw */ - var65.i = (var58.i * var49.i) & 0xffff; - /* 14: shrsw */ - var66.i = var65.i >> 8; - /* 15: addssw */ - var67.i = ORC_CLAMP_SW (var58.i + var66.i); - /* 16: addssw */ - var68.i = ORC_CLAMP_SW (var67.i + var64.i); - /* 18: mullw */ - var69.i = (var64.i * var50.i) & 0xffff; - /* 19: shrsw */ - var70.i = var69.i >> 8; - /* 20: subssw */ - var71.i = ORC_CLAMP_SW (var68.i - var70.i); - /* 21: addssw */ - var72.i = ORC_CLAMP_SW (var71.i + var64.i); - /* 22: addssw */ - var73.i = ORC_CLAMP_SW (var67.i + var61.i); - /* 23: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var61.i); - /* 25: mullw */ - var75.i = (var61.i * var51.i) & 0xffff; - /* 26: shrsw */ - var76.i = var75.i >> 8; - /* 27: addssw */ - var77.i = ORC_CLAMP_SW (var74.i + var76.i); - /* 29: mullw */ - var78.i = (var61.i * var52.i) & 0xffff; - /* 30: shrsw */ - var79.i = var78.i >> 8; - /* 31: subssw */ - var80.i = ORC_CLAMP_SW (var67.i - var79.i); - /* 33: mullw */ - var81.i = (var64.i * var53.i) & 0xffff; - /* 34: shrsw */ - var82.i = var81.i >> 8; - /* 35: subssw */ - var83.i = ORC_CLAMP_SW (var80.i - var82.i); - /* 36: subssw */ - var84.i = ORC_CLAMP_SW (var83.i - var82.i); - /* 37: convssswb */ - var85 = ORC_CLAMP_SB (var72.i); - /* 38: convssswb */ - var86 = ORC_CLAMP_SB (var84.i); - /* 39: convssswb */ - var87 = ORC_CLAMP_SB (var77.i); - /* 40: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var86; - var88.i = _dest.i; - } - /* 42: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var85; - _dest.x2[1] = var54; - var89.i = _dest.i; - } - /* 43: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var88.i; - _dest.x2[1] = var89.i; - var90.i = _dest.i; - } - /* 45: addb */ - var56.x4[0] = var90.x4[0] + var55.x4[0]; - var56.x4[1] = var90.x4[1] + var55.x4[1]; - var56.x4[2] = var90.x4[2] + var55.x4[2]; - var56.x4[3] = var90.x4[3] + var55.x4[3]; - /* 46: storel */ - ptr0[i] = var56; - } - -} - -#else -static void -_backup_cogorc_convert_I420_BGRA (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 var45; - orc_int8 var46; - orc_int8 var47; - orc_int8 var48; - orc_union16 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_int8 var54; - orc_union32 var55; - orc_union32 var56; - orc_int8 var57; - orc_union16 var58; - orc_int8 var59; - orc_int8 var60; - orc_union16 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_union16 var65; - orc_union16 var66; - orc_union16 var67; - orc_union16 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_int8 var85; - orc_int8 var86; - orc_int8 var87; - orc_union16 var88; - orc_union16 var89; - orc_union32 var90; - - ptr0 = (orc_union32 *) ex->arrays[0]; - ptr4 = (orc_int8 *) ex->arrays[4]; - ptr5 = (orc_int8 *) ex->arrays[5]; - ptr6 = (orc_int8 *) ex->arrays[6]; - - /* 1: loadpb */ - var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 5: loadpb */ - var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 9: loadpb */ - var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 12: loadpw */ - var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 17: loadpw */ - var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 24: loadpw */ - var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 28: loadpw */ - var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 32: loadpw */ - var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 41: loadpb */ - var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 44: loadpb */ - var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var45 = ptr4[i]; - /* 2: subb */ - var57 = var45 - var46; - /* 3: convsbw */ - var58.i = var57; - /* 4: loadupib */ - var59 = - (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] + - 1) >> 1 : ptr5[i >> 1]; - /* 6: subb */ - var60 = var59 - var47; - /* 7: convsbw */ - var61.i = var60; - /* 8: loadupib */ - var62 = - (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] + - 1) >> 1 : ptr6[i >> 1]; - /* 10: subb */ - var63 = var62 - var48; - /* 11: convsbw */ - var64.i = var63; - /* 13: mullw */ - var65.i = (var58.i * var49.i) & 0xffff; - /* 14: shrsw */ - var66.i = var65.i >> 8; - /* 15: addssw */ - var67.i = ORC_CLAMP_SW (var58.i + var66.i); - /* 16: addssw */ - var68.i = ORC_CLAMP_SW (var67.i + var64.i); - /* 18: mullw */ - var69.i = (var64.i * var50.i) & 0xffff; - /* 19: shrsw */ - var70.i = var69.i >> 8; - /* 20: subssw */ - var71.i = ORC_CLAMP_SW (var68.i - var70.i); - /* 21: addssw */ - var72.i = ORC_CLAMP_SW (var71.i + var64.i); - /* 22: addssw */ - var73.i = ORC_CLAMP_SW (var67.i + var61.i); - /* 23: addssw */ - var74.i = ORC_CLAMP_SW (var73.i + var61.i); - /* 25: mullw */ - var75.i = (var61.i * var51.i) & 0xffff; - /* 26: shrsw */ - var76.i = var75.i >> 8; - /* 27: addssw */ - var77.i = ORC_CLAMP_SW (var74.i + var76.i); - /* 29: mullw */ - var78.i = (var61.i * var52.i) & 0xffff; - /* 30: shrsw */ - var79.i = var78.i >> 8; - /* 31: subssw */ - var80.i = ORC_CLAMP_SW (var67.i - var79.i); - /* 33: mullw */ - var81.i = (var64.i * var53.i) & 0xffff; - /* 34: shrsw */ - var82.i = var81.i >> 8; - /* 35: subssw */ - var83.i = ORC_CLAMP_SW (var80.i - var82.i); - /* 36: subssw */ - var84.i = ORC_CLAMP_SW (var83.i - var82.i); - /* 37: convssswb */ - var85 = ORC_CLAMP_SB (var72.i); - /* 38: convssswb */ - var86 = ORC_CLAMP_SB (var84.i); - /* 39: convssswb */ - var87 = ORC_CLAMP_SB (var77.i); - /* 40: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var87; - _dest.x2[1] = var86; - var88.i = _dest.i; - } - /* 42: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var85; - _dest.x2[1] = var54; - var89.i = _dest.i; - } - /* 43: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var88.i; - _dest.x2[1] = var89.i; - var90.i = _dest.i; - } - /* 45: addb */ - var56.x4[0] = var90.x4[0] + var55.x4[0]; - var56.x4[1] = var90.x4[1] + var55.x4[1]; - var56.x4[2] = var90.x4[2] + var55.x4[2]; - var56.x4[3] = var90.x4[3] + var55.x4[3]; - /* 46: storel */ - ptr0[i] = var56; - } - -} - -void -cogorc_convert_I420_BGRA (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 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_convert_I420_BGRA"); - orc_program_set_backup_function (p, _backup_cogorc_convert_I420_BGRA); - 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, 0x00000008, "c1"); - orc_program_add_constant (p, 1, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - orc_program_add_constant (p, 4, 0x000000ff, "c8"); - 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, 2, "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_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 1, "t10"); - orc_program_add_temporary (p, 1, "t11"); - orc_program_add_temporary (p, 1, "t12"); - orc_program_add_temporary (p, 4, "t13"); - - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S2, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S3, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T4, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T4, ORC_VAR_T6, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T7, ORC_VAR_T7, ORC_VAR_T6, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T4, ORC_VAR_T5, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T5, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T4, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T10, ORC_VAR_T7, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T11, ORC_VAR_T8, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T12, ORC_VAR_T9, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T12, - ORC_VAR_T11, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T10, - ORC_VAR_C8, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T13, ORC_VAR_T1, - ORC_VAR_T2, ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T13, 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - - func = p->code_exec; - func (ex); -} -#endif - - -/* cogorc_convert_I420_BGRA_avg */ -#ifdef DISABLE_ORC -void -cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, - const guint8 * ORC_RESTRICT s5, 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; - const orc_int8 *ORC_RESTRICT ptr8; - orc_int8 var46; - orc_int8 var47; - orc_int8 var48; - orc_int8 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_int8 var55; - orc_union32 var56; - orc_union32 var57; - orc_int8 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_int8 var65; - orc_int8 var66; - orc_int8 var67; - orc_int8 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_union16 var87; - orc_union16 var88; - orc_union16 var89; - orc_int8 var90; - orc_int8 var91; - orc_int8 var92; - orc_union16 var93; - orc_union16 var94; - orc_union32 var95; - - ptr0 = (orc_union32 *) d1; - ptr4 = (orc_int8 *) s1; - ptr5 = (orc_int8 *) s2; - ptr6 = (orc_int8 *) s3; - ptr7 = (orc_int8 *) s4; - ptr8 = (orc_int8 *) s5; - - /* 1: loadpb */ - var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 7: loadpb */ - var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 13: loadpb */ - var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 16: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 21: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 28: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 32: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 36: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 45: loadpb */ - var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 48: loadpb */ - var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var46 = ptr4[i]; - /* 2: subb */ - var58 = var46 - var47; - /* 3: convsbw */ - var59.i = var58; - /* 4: loadupib */ - var60 = - (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] + - 1) >> 1 : ptr5[i >> 1]; - /* 5: loadupib */ - var61 = - (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] + - 1) >> 1 : ptr6[i >> 1]; - /* 6: avgub */ - var62 = ((orc_uint8) var60 + (orc_uint8) var61 + 1) >> 1; - /* 8: subb */ - var63 = var62 - var48; - /* 9: convsbw */ - var64.i = var63; - /* 10: loadupib */ - var65 = - (i & 1) ? ((orc_uint8) ptr7[i >> 1] + (orc_uint8) ptr7[(i >> 1) + 1] + - 1) >> 1 : ptr7[i >> 1]; - /* 11: loadupib */ - var66 = - (i & 1) ? ((orc_uint8) ptr8[i >> 1] + (orc_uint8) ptr8[(i >> 1) + 1] + - 1) >> 1 : ptr8[i >> 1]; - /* 12: avgub */ - var67 = ((orc_uint8) var65 + (orc_uint8) var66 + 1) >> 1; - /* 14: subb */ - var68 = var67 - var49; - /* 15: convsbw */ - var69.i = var68; - /* 17: mullw */ - var70.i = (var59.i * var50.i) & 0xffff; - /* 18: shrsw */ - var71.i = var70.i >> 8; - /* 19: addssw */ - var72.i = ORC_CLAMP_SW (var59.i + var71.i); - /* 20: addssw */ - var73.i = ORC_CLAMP_SW (var72.i + var69.i); - /* 22: mullw */ - var74.i = (var69.i * var51.i) & 0xffff; - /* 23: shrsw */ - var75.i = var74.i >> 8; - /* 24: subssw */ - var76.i = ORC_CLAMP_SW (var73.i - var75.i); - /* 25: addssw */ - var77.i = ORC_CLAMP_SW (var76.i + var69.i); - /* 26: addssw */ - var78.i = ORC_CLAMP_SW (var72.i + var64.i); - /* 27: addssw */ - var79.i = ORC_CLAMP_SW (var78.i + var64.i); - /* 29: mullw */ - var80.i = (var64.i * var52.i) & 0xffff; - /* 30: shrsw */ - var81.i = var80.i >> 8; - /* 31: addssw */ - var82.i = ORC_CLAMP_SW (var79.i + var81.i); - /* 33: mullw */ - var83.i = (var64.i * var53.i) & 0xffff; - /* 34: shrsw */ - var84.i = var83.i >> 8; - /* 35: subssw */ - var85.i = ORC_CLAMP_SW (var72.i - var84.i); - /* 37: mullw */ - var86.i = (var69.i * var54.i) & 0xffff; - /* 38: shrsw */ - var87.i = var86.i >> 8; - /* 39: subssw */ - var88.i = ORC_CLAMP_SW (var85.i - var87.i); - /* 40: subssw */ - var89.i = ORC_CLAMP_SW (var88.i - var87.i); - /* 41: convssswb */ - var90 = ORC_CLAMP_SB (var77.i); - /* 42: convssswb */ - var91 = ORC_CLAMP_SB (var89.i); - /* 43: convssswb */ - var92 = ORC_CLAMP_SB (var82.i); - /* 44: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var92; - _dest.x2[1] = var91; - var93.i = _dest.i; - } - /* 46: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var90; - _dest.x2[1] = var55; - var94.i = _dest.i; - } - /* 47: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var93.i; - _dest.x2[1] = var94.i; - var95.i = _dest.i; - } - /* 49: addb */ - var57.x4[0] = var95.x4[0] + var56.x4[0]; - var57.x4[1] = var95.x4[1] + var56.x4[1]; - var57.x4[2] = var95.x4[2] + var56.x4[2]; - var57.x4[3] = var95.x4[3] + var56.x4[3]; - /* 50: storel */ - ptr0[i] = var57; - } - -} - -#else -static void -_backup_cogorc_convert_I420_BGRA_avg (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; - const orc_int8 *ORC_RESTRICT ptr8; - orc_int8 var46; - orc_int8 var47; - orc_int8 var48; - orc_int8 var49; - orc_union16 var50; - orc_union16 var51; - orc_union16 var52; - orc_union16 var53; - orc_union16 var54; - orc_int8 var55; - orc_union32 var56; - orc_union32 var57; - orc_int8 var58; - orc_union16 var59; - orc_int8 var60; - orc_int8 var61; - orc_int8 var62; - orc_int8 var63; - orc_union16 var64; - orc_int8 var65; - orc_int8 var66; - orc_int8 var67; - orc_int8 var68; - orc_union16 var69; - orc_union16 var70; - orc_union16 var71; - orc_union16 var72; - orc_union16 var73; - orc_union16 var74; - orc_union16 var75; - orc_union16 var76; - orc_union16 var77; - orc_union16 var78; - orc_union16 var79; - orc_union16 var80; - orc_union16 var81; - orc_union16 var82; - orc_union16 var83; - orc_union16 var84; - orc_union16 var85; - orc_union16 var86; - orc_union16 var87; - orc_union16 var88; - orc_union16 var89; - orc_int8 var90; - orc_int8 var91; - orc_int8 var92; - orc_union16 var93; - orc_union16 var94; - orc_union32 var95; - - 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]; - ptr8 = (orc_int8 *) ex->arrays[8]; - - /* 1: loadpb */ - var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 7: loadpb */ - var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 13: loadpb */ - var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ - /* 16: loadpw */ - var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ - /* 21: loadpw */ - var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ - /* 28: loadpw */ - var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ - /* 32: loadpw */ - var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ - /* 36: loadpw */ - var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ - /* 45: loadpb */ - var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ - /* 48: loadpb */ - var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ - - for (i = 0; i < n; i++) { - /* 0: loadb */ - var46 = ptr4[i]; - /* 2: subb */ - var58 = var46 - var47; - /* 3: convsbw */ - var59.i = var58; - /* 4: loadupib */ - var60 = - (i & 1) ? ((orc_uint8) ptr5[i >> 1] + (orc_uint8) ptr5[(i >> 1) + 1] + - 1) >> 1 : ptr5[i >> 1]; - /* 5: loadupib */ - var61 = - (i & 1) ? ((orc_uint8) ptr6[i >> 1] + (orc_uint8) ptr6[(i >> 1) + 1] + - 1) >> 1 : ptr6[i >> 1]; - /* 6: avgub */ - var62 = ((orc_uint8) var60 + (orc_uint8) var61 + 1) >> 1; - /* 8: subb */ - var63 = var62 - var48; - /* 9: convsbw */ - var64.i = var63; - /* 10: loadupib */ - var65 = - (i & 1) ? ((orc_uint8) ptr7[i >> 1] + (orc_uint8) ptr7[(i >> 1) + 1] + - 1) >> 1 : ptr7[i >> 1]; - /* 11: loadupib */ - var66 = - (i & 1) ? ((orc_uint8) ptr8[i >> 1] + (orc_uint8) ptr8[(i >> 1) + 1] + - 1) >> 1 : ptr8[i >> 1]; - /* 12: avgub */ - var67 = ((orc_uint8) var65 + (orc_uint8) var66 + 1) >> 1; - /* 14: subb */ - var68 = var67 - var49; - /* 15: convsbw */ - var69.i = var68; - /* 17: mullw */ - var70.i = (var59.i * var50.i) & 0xffff; - /* 18: shrsw */ - var71.i = var70.i >> 8; - /* 19: addssw */ - var72.i = ORC_CLAMP_SW (var59.i + var71.i); - /* 20: addssw */ - var73.i = ORC_CLAMP_SW (var72.i + var69.i); - /* 22: mullw */ - var74.i = (var69.i * var51.i) & 0xffff; - /* 23: shrsw */ - var75.i = var74.i >> 8; - /* 24: subssw */ - var76.i = ORC_CLAMP_SW (var73.i - var75.i); - /* 25: addssw */ - var77.i = ORC_CLAMP_SW (var76.i + var69.i); - /* 26: addssw */ - var78.i = ORC_CLAMP_SW (var72.i + var64.i); - /* 27: addssw */ - var79.i = ORC_CLAMP_SW (var78.i + var64.i); - /* 29: mullw */ - var80.i = (var64.i * var52.i) & 0xffff; - /* 30: shrsw */ - var81.i = var80.i >> 8; - /* 31: addssw */ - var82.i = ORC_CLAMP_SW (var79.i + var81.i); - /* 33: mullw */ - var83.i = (var64.i * var53.i) & 0xffff; - /* 34: shrsw */ - var84.i = var83.i >> 8; - /* 35: subssw */ - var85.i = ORC_CLAMP_SW (var72.i - var84.i); - /* 37: mullw */ - var86.i = (var69.i * var54.i) & 0xffff; - /* 38: shrsw */ - var87.i = var86.i >> 8; - /* 39: subssw */ - var88.i = ORC_CLAMP_SW (var85.i - var87.i); - /* 40: subssw */ - var89.i = ORC_CLAMP_SW (var88.i - var87.i); - /* 41: convssswb */ - var90 = ORC_CLAMP_SB (var77.i); - /* 42: convssswb */ - var91 = ORC_CLAMP_SB (var89.i); - /* 43: convssswb */ - var92 = ORC_CLAMP_SB (var82.i); - /* 44: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var92; - _dest.x2[1] = var91; - var93.i = _dest.i; - } - /* 46: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var90; - _dest.x2[1] = var55; - var94.i = _dest.i; - } - /* 47: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var93.i; - _dest.x2[1] = var94.i; - var95.i = _dest.i; - } - /* 49: addb */ - var57.x4[0] = var95.x4[0] + var56.x4[0]; - var57.x4[1] = var95.x4[1] + var56.x4[1]; - var57.x4[2] = var95.x4[2] + var56.x4[2]; - var57.x4[3] = var95.x4[3] + var56.x4[3]; - /* 50: storel */ - ptr0[i] = var57; - } - -} - -void -cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, - const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, - const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, - const guint8 * ORC_RESTRICT s5, int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_convert_I420_BGRA_avg"); - orc_program_set_backup_function (p, _backup_cogorc_convert_I420_BGRA_avg); - 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_source (p, 1, "s5"); - orc_program_add_constant (p, 1, 0x00000008, "c1"); - orc_program_add_constant (p, 1, 0x00000080, "c2"); - orc_program_add_constant (p, 4, 0x0000002a, "c3"); - orc_program_add_constant (p, 4, 0x00000067, "c4"); - orc_program_add_constant (p, 4, 0x00000004, "c5"); - orc_program_add_constant (p, 4, 0x00000064, "c6"); - orc_program_add_constant (p, 4, 0x00000068, "c7"); - orc_program_add_constant (p, 4, 0x000000ff, "c8"); - 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_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_add_temporary (p, 2, "t9"); - orc_program_add_temporary (p, 2, "t10"); - orc_program_add_temporary (p, 1, "t11"); - orc_program_add_temporary (p, 1, "t12"); - orc_program_add_temporary (p, 1, "t13"); - orc_program_add_temporary (p, 4, "t14"); - - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S2, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T4, ORC_VAR_S3, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T6, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T3, ORC_VAR_S4, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "loadupib", 0, ORC_VAR_T4, ORC_VAR_S5, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "avgub", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T4, - ORC_VAR_D1); - orc_program_append_2 (p, "subb", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_C2, - ORC_VAR_D1); - orc_program_append_2 (p, "convsbw", 0, ORC_VAR_T7, ORC_VAR_T3, ORC_VAR_D1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T5, ORC_VAR_C3, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T5, ORC_VAR_T7, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C4, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T8, ORC_VAR_T8, ORC_VAR_T7, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T5, ORC_VAR_T6, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T6, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C5, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "addssw", 0, ORC_VAR_T10, ORC_VAR_T10, - ORC_VAR_T1, ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T6, ORC_VAR_C6, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T5, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "mullw", 0, ORC_VAR_T1, ORC_VAR_T7, ORC_VAR_C7, - ORC_VAR_D1); - orc_program_append_2 (p, "shrsw", 0, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_C1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "subssw", 0, ORC_VAR_T9, ORC_VAR_T9, ORC_VAR_T1, - ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T11, ORC_VAR_T8, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T12, ORC_VAR_T9, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "convssswb", 0, ORC_VAR_T13, ORC_VAR_T10, - ORC_VAR_D1, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T1, ORC_VAR_T13, - ORC_VAR_T12, ORC_VAR_D1); - orc_program_append_2 (p, "mergebw", 0, ORC_VAR_T2, ORC_VAR_T11, - ORC_VAR_C8, ORC_VAR_D1); - orc_program_append_2 (p, "mergewl", 0, ORC_VAR_T14, ORC_VAR_T1, - ORC_VAR_T2, ORC_VAR_D1); - orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, 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; - ex->arrays[ORC_VAR_S2] = (void *) s2; - ex->arrays[ORC_VAR_S3] = (void *) s3; - ex->arrays[ORC_VAR_S4] = (void *) s4; - ex->arrays[ORC_VAR_S5] = (void *) s5; - - 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 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_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 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_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 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_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 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_YVYU */ -#ifdef DISABLE_ORC -void -cogorc_getline_YVYU (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_union16 var41; - orc_union32 var42; - orc_union32 var43; - - ptr0 = (orc_union64 *) d1; - ptr4 = (orc_union32 *) s1; - - /* 3: 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]; - } - /* 2: swapw */ - var41.i = ORC_SWAP_W (var39.i); - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var40.x2[0]; - var42.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var40.x2[1]; - var42.x2[1] = _dest.i; - } - /* 5: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var41.i; - _dest.x2[1] = var41.i; - var43.i = _dest.i; - } - /* 6: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var42.x2[0]; - _dest.x2[1] = var43.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union32 _dest; - _dest.x2[0] = var42.x2[1]; - _dest.x2[1] = var43.x2[1]; - var38.x2[1] = _dest.i; - } - /* 7: storeq */ - ptr0[i] = var38; - } - -} - -#else -static void -_backup_cogorc_getline_YVYU (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_union16 var41; - orc_union32 var42; - orc_union32 var43; - - ptr0 = (orc_union64 *) ex->arrays[0]; - ptr4 = (orc_union32 *) ex->arrays[4]; - - /* 3: 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]; - } - /* 2: swapw */ - var41.i = ORC_SWAP_W (var39.i); - /* 4: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[0]; - _dest.x2[1] = var40.x2[0]; - var42.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var37.x2[1]; - _dest.x2[1] = var40.x2[1]; - var42.x2[1] = _dest.i; - } - /* 5: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var41.i; - _dest.x2[1] = var41.i; - var43.i = _dest.i; - } - /* 6: mergewl */ - { - orc_union32 _dest; - _dest.x2[0] = var42.x2[0]; - _dest.x2[1] = var43.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union32 _dest; - _dest.x2[0] = var42.x2[1]; - _dest.x2[1] = var43.x2[1]; - var38.x2[1] = _dest.i; - } - /* 7: storeq */ - ptr0[i] = var38; - } - -} - -void -cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_YVYU"); - orc_program_set_backup_function (p, _backup_cogorc_getline_YVYU); - 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, "swapw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_D1, - 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_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 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_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 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_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 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_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 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 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_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 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_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 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_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 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_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 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_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 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_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 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_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 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_YVYU */ -#ifdef DISABLE_ORC -void -cogorc_putline_YVYU (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; - orc_union16 var45; - - 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: swapw */ - var45.i = ORC_SWAP_W (var43.i); - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var44.x2[0]; - _dest.x2[1] = var45.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var44.x2[1]; - _dest.x2[1] = var45.x2[1]; - var38.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -#else -static void -_backup_cogorc_putline_YVYU (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; - orc_union16 var45; - - 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: swapw */ - var45.i = ORC_SWAP_W (var43.i); - /* 6: mergebw */ - { - orc_union16 _dest; - _dest.x2[0] = var44.x2[0]; - _dest.x2[1] = var45.x2[0]; - var38.x2[0] = _dest.i; - } - { - orc_union16 _dest; - _dest.x2[0] = var44.x2[1]; - _dest.x2[1] = var45.x2[1]; - var38.x2[1] = _dest.i; - } - /* 7: storel */ - ptr0[i] = var38; - } - -} - -void -cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, - int n) -{ - OrcExecutor _ex, *ex = &_ex; - static 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_YVYU"); - orc_program_set_backup_function (p, _backup_cogorc_putline_YVYU); - 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, "swapw", 0, ORC_VAR_T2, ORC_VAR_T2, 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 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_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 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_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 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_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 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 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_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 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_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 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_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 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_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 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_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 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_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 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 diff --git a/gst/colorspace/gstcolorspaceorc-dist.h b/gst/colorspace/gstcolorspaceorc-dist.h deleted file mode 100644 index 2384b522d..000000000 --- a/gst/colorspace/gstcolorspaceorc-dist.h +++ /dev/null @@ -1,168 +0,0 @@ - -/* autogenerated from gstcolorspaceorc.orc */ - -#ifndef _GSTCOLORSPACEORC_H_ -#define _GSTCOLORSPACEORC_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 cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void cogorc_downsample_vert_halfsite_4tap (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_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); -void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); -void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); -void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); -void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); -void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); -void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); -void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); -void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, 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_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_YUY2 (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_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, 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_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_getline_Y800 (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_getline_ABGR (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_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); -void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, 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_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, 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_YVYU (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_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, 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_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_putline_BGRA (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_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); -void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); -void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, 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); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/gst/colorspace/gstcolorspaceorc.orc b/gst/colorspace/gstcolorspaceorc.orc deleted file mode 100644 index 086990e15..000000000 --- a/gst/colorspace/gstcolorspaceorc.orc +++ /dev/null @@ -1,1757 +0,0 @@ - -.function cogorc_memcpy_2d -.flags 2d -.dest 1 d1 guint8 -.source 1 s1 guint8 - -copyb d1, s1 - - -.function cogorc_downsample_horiz_cosite_1tap -.dest 1 d1 guint8 -.source 2 s1 guint8 - -select0wb d1, s1 - - -.function cogorc_downsample_horiz_cosite_3tap -.dest 1 d1 guint8 -.source 2 s1 guint8 -.source 2 s2 guint8 -.temp 1 t1 -.temp 1 t2 -.temp 1 t3 -.temp 2 t4 -.temp 2 t5 -.temp 2 t6 - -copyw t4, s1 -select0wb t1, t4 -select1wb t2, t4 -select0wb t3, s2 -convubw t4, t1 -convubw t5, t2 -convubw t6, t3 -mullw t5, t5, 2 -addw t4, t4, t6 -addw t4, t4, t5 -addw t4, t4, 2 -shrsw t4, t4, 2 -convsuswb d1, t4 - - -.function cogorc_downsample_420_jpeg -.dest 1 d1 guint8 -.source 2 s1 guint8 -.source 2 s2 guint8 -.temp 2 t1 -.temp 1 t2 -.temp 1 t3 -.temp 1 t4 -.temp 1 t5 - -copyw t1, s1 -select0wb t2, t1 -select1wb t3, t1 -avgub t2, t2, t3 -copyw t1, s2 -select0wb t4, t1 -select1wb t5, t1 -avgub t4, t4, t5 -avgub d1, t2, t4 - - -.function cogorc_downsample_vert_halfsite_2tap -.dest 1 d1 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 - -avgub d1, s1, s2 - - -.function cogorc_downsample_vert_cosite_3tap -.dest 1 d1 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 - -convubw t1, s1 -convubw t2, s2 -convubw t3, s3 -mullw t2, t2, 2 -addw t1, t1, t3 -addw t1, t1, t2 -addw t1, t1, 2 -shrsw t1, t1, 2 -convsuswb d1, t1 - - - -.function cogorc_downsample_vert_halfsite_4tap -.dest 1 d1 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.source 1 s4 guint8 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 -.temp 2 t4 - -convubw t1, s1 -convubw t2, s2 -convubw t3, s3 -convubw t4, s4 -addw t2, t2, t3 -mullw t2, t2, 26 -addw t1, t1, t4 -mullw t1, t1, 6 -addw t2, t2, t1 -addw t2, t2, 32 -shrsw t2, t2, 6 -convsuswb d1, t2 - - -.function cogorc_upsample_horiz_cosite_1tap -.dest 2 d1 guint8 guint8 -.source 1 s1 guint8 -.temp 1 t1 - -copyb t1, s1 -mergebw d1, t1, t1 - - -.function cogorc_upsample_horiz_cosite -.dest 2 d1 guint8 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.temp 1 t1 -.temp 1 t2 - -copyb t1, s1 -avgub t2, t1, s2 -mergebw d1, t1, t2 - - -.function cogorc_upsample_vert_avgub -.dest 1 d1 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 - -avgub d1, s1, s2 - - - - -.function orc_unpack_yuyv_y -.dest 1 d1 guint8 -.source 2 s1 guint8 - -select0wb d1, s1 - - -.function orc_unpack_yuyv_u -.dest 1 d1 guint8 -.source 4 s1 guint8 -.temp 2 t1 - -select0lw t1, s1 -select1wb d1, t1 - - -.function orc_unpack_yuyv_v -.dest 1 d1 guint8 -.source 4 s1 guint8 -.temp 2 t1 - -select1lw t1, s1 -select1wb d1, t1 - - -.function orc_pack_yuyv -.dest 4 d1 guint8 -.source 2 s1 guint8 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.temp 1 t1 -.temp 1 t2 -.temp 2 t3 -.temp 2 t4 -.temp 2 t5 - -copyw t5, s1 -select0wb t1, t5 -select1wb t2, t5 -mergebw t3, t1, s2 -mergebw t4, t2, s3 -mergewl d1, t3, t4 - - -.function orc_unpack_uyvy_y -.dest 1 d1 guint8 -.source 2 s1 guint8 - -select1wb d1, s1 - - -.function orc_unpack_uyvy_u -.dest 1 d1 guint8 -.source 4 s1 guint8 -.temp 2 t1 - -select0lw t1, s1 -select0wb d1, t1 - - -.function orc_unpack_uyvy_v -.dest 1 d1 guint8 -.source 4 s1 guint8 -.temp 2 t1 - -select1lw t1, s1 -select0wb d1, t1 - - -.function orc_pack_uyvy -.dest 4 d1 guint8 -.source 2 s1 guint8 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.temp 1 t1 -.temp 1 t2 -.temp 2 t3 -.temp 2 t4 -.temp 2 t5 - -copyw t5, s1 -select0wb t1, t5 -select1wb t2, t5 -mergebw t3, s2, t1 -mergebw t4, s3, t2 -mergewl d1, t3, t4 - - -.function orc_matrix2_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.param 2 p1 -.param 2 p2 -.param 2 p3 -.temp 2 t1 -.temp 2 t2 - -convubw t1, s1 -mullw t1, t1, p1 -convubw t2, s2 -mullw t2, t2, p2 -addw t1, t1, t2 -addw t1, t1, p3 -shrsw t1, t1, 6 -convsuswb d1, t1 - - -.function orc_matrix2_11_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.param 2 p1 -.param 2 p2 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 -.temp 2 t4 - -convubw t1, s1 -subw t1, t1, 16 -mullw t3, t1, p1 -convubw t2, s2 -subw t2, t2, 128 -mullw t4, t2, p2 -addw t3, t3, t4 -addw t3, t3, 128 -shrsw t3, t3, 8 -addw t3, t3, t1 -addw t3, t3, t2 -convsuswb d1, t3 - - -.function orc_matrix2_12_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.param 2 p1 -.param 2 p2 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 -.temp 2 t4 - -convubw t1, s1 -subw t1, t1, 16 -mullw t3, t1, p1 -convubw t2, s2 -subw t2, t2, 128 -mullw t4, t2, p2 -addw t3, t3, t4 -addw t3, t3, 128 -shrsw t3, t3, 8 -addw t3, t3, t1 -addw t3, t3, t2 -addw t3, t3, t2 -convsuswb d1, t3 - - -.function orc_matrix3_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.source 1 s3 guint8 guint8 -.param 2 p1 -.param 2 p2 -.param 2 p3 -.param 2 p4 -.temp 2 t1 -.temp 2 t2 - -convubw t1, s1 -mullw t1, t1, p1 -convubw t2, s2 -mullw t2, t2, p2 -addw t1, t1, t2 -convubw t2, s3 -mullw t2, t2, p3 -addw t1, t1, t2 -addw t1, t1, p4 -shrsw t1, t1, 6 -convsuswb d1, t1 - - -.function orc_matrix3_100_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.source 1 s3 guint8 guint8 -.param 2 p1 -.param 2 p2 -.param 2 p3 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 -#.temp 2 t4 - -convubw t1, s1 -subw t1, t1, 16 -mullw t3, t1, p1 -convubw t2, s2 -subw t2, t2, 128 -mullw t2, t2, p2 -addw t3, t3, t2 -convubw t2, s3 -subw t2, t2, 128 -mullw t2, t2, p3 -addw t3, t3, t2 -addw t3, t3, 128 -shrsw t3, t3, 8 -addw t3, t3, t1 -convsuswb d1, t3 - - -.function orc_matrix3_100_offset_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.source 1 s3 guint8 guint8 -.param 2 p1 -.param 2 p2 -.param 2 p3 -.param 2 p4 -.param 2 p5 -#.param 2 p6 -.temp 2 t1 -.temp 2 t2 -.temp 2 t3 -#.temp 2 t3 -#.temp 2 t4 - -convubw t3, s1 -mullw t1, t3, p1 -convubw t2, s2 -mullw t2, t2, p2 -addw t1, t1, t2 -convubw t2, s3 -mullw t2, t2, p3 -addw t1, t1, t2 -addw t1, t1, p4 -shrsw t1, t1, p5 -#addw t1, t1, p6 -addw t1, t1, t3 -convsuswb d1, t1 - - - -.function orc_matrix3_000_u8 -.dest 1 d1 guint8 guint8 -.source 1 s1 guint8 guint8 -.source 1 s2 guint8 guint8 -.source 1 s3 guint8 guint8 -.param 2 p1 -.param 2 p2 -.param 2 p3 -.param 2 p4 -.param 2 p5 -#.param 2 p6 -.temp 2 t1 -.temp 2 t2 -#.temp 2 t3 -#.temp 2 t4 - -convubw t1, s1 -mullw t1, t1, p1 -convubw t2, s2 -mullw t2, t2, p2 -addw t1, t1, t2 -convubw t2, s3 -mullw t2, t2, p3 -addw t1, t1, t2 -addw t1, t1, p4 -shrsw t1, t1, p5 -#addw t1, t1, p6 -convwb d1, t1 - - - -.function orc_pack_123x -.dest 4 d1 guint32 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.param 1 p1 -.temp 2 t1 -.temp 2 t2 - -mergebw t1, s1, s2 -mergebw t2, s3, p1 -mergewl d1, t1, t2 - - -.function orc_pack_x123 -.dest 4 d1 guint32 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.source 1 s3 guint8 -.param 1 p1 -.temp 2 t1 -.temp 2 t2 - -mergebw t1, p1, s1 -mergebw t2, s2, s3 -mergewl d1, t1, t2 - - -.function cogorc_combine2_u8 -.dest 1 d1 guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 -.param 2 p1 -.param 2 p2 -.temp 2 t1 -.temp 2 t2 - -convubw t1, s1 -mullw t1, t1, p1 -convubw t2, s2 -mullw t2, t2, p2 -addw t1, t1, t2 -shruw t1, t1, 8 -convsuswb d1, t1 - - -.function cogorc_convert_I420_UYVY -.dest 4 d1 guint8 -.dest 4 d2 guint8 -.source 2 y1 guint8 -.source 2 y2 guint8 -.source 1 u guint8 -.source 1 v guint8 -.temp 2 uv - -mergebw uv, u, v -x2 mergebw d1, uv, y1 -x2 mergebw d2, uv, y2 - - -.function cogorc_convert_I420_YUY2 -.dest 4 d1 guint8 -.dest 4 d2 guint8 -.source 2 y1 guint8 -.source 2 y2 guint8 -.source 1 u guint8 -.source 1 v guint8 -.temp 2 uv - -mergebw uv, u, v -x2 mergebw d1, y1, uv -x2 mergebw d2, y2, uv - - - -.function cogorc_convert_I420_AYUV -.dest 4 d1 guint8 -.dest 4 d2 guint8 -.source 1 y1 guint8 -.source 1 y2 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, y1 -mergewl d1, ay, uv -mergebw ay, c255, y2 -mergewl d2, ay, uv - - -.function cogorc_convert_YUY2_I420 -.dest 2 y1 guint8 -.dest 2 y2 guint8 -.dest 1 u guint8 -.dest 1 v guint8 -.source 4 yuv1 guint8 -.source 4 yuv2 guint8 -.temp 2 t1 -.temp 2 t2 -.temp 2 ty - -x2 splitwb t1, ty, yuv1 -storew y1, ty -x2 splitwb t2, ty, yuv2 -storew y2, ty -x2 avgub t1, t1, t2 -splitwb v, u, t1 - - -.function cogorc_convert_UYVY_YUY2 -.flags 2d -.dest 4 yuy2 guint8 -.source 4 uyvy guint8 - -x2 swapw yuy2, uyvy - - -.function cogorc_planar_chroma_420_422 -.flags 2d -.dest 1 d1 guint8 -.dest 1 d2 guint8 -.source 1 s guint8 - -copyb d1, s -copyb d2, s - - -.function cogorc_planar_chroma_420_444 -.flags 2d -.dest 2 d1 guint8 -.dest 2 d2 guint8 -.source 1 s guint8 -.temp 2 t - -splatbw t, s -storew d1, t -storew d2, t - - -.function cogorc_planar_chroma_422_444 -.flags 2d -.dest 2 d1 guint8 -.source 1 s guint8 -.temp 2 t - -splatbw t, s -storew d1, t - - -.function cogorc_planar_chroma_444_422 -.flags 2d -.dest 1 d guint8 -.source 2 s guint8 -.temp 1 t1 -.temp 1 t2 - -splitwb t1, t2, s -avgub d, t1, t2 - - -.function cogorc_planar_chroma_444_420 -.flags 2d -.dest 1 d guint8 -.source 2 s1 guint8 -.source 2 s2 guint8 -.temp 2 t -.temp 1 t1 -.temp 1 t2 - -x2 avgub t, s1, s2 -splitwb t1, t2, t -avgub d, t1, t2 - - -.function cogorc_planar_chroma_422_420 -.flags 2d -.dest 1 d guint8 -.source 1 s1 guint8 -.source 1 s2 guint8 - -avgub d, s1, s2 - - -.function cogorc_convert_YUY2_AYUV -.flags 2d -.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_convert_UYVY_AYUV -.flags 2d -.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_convert_YUY2_Y42B -.flags 2d -.dest 2 y guint8 -.dest 1 u guint8 -.dest 1 v guint8 -.source 4 yuy2 guint8 -.temp 2 uv - -x2 splitwb uv, y, yuy2 -splitwb v, u, uv - - -.function cogorc_convert_UYVY_Y42B -.flags 2d -.dest 2 y guint8 -.dest 1 u guint8 -.dest 1 v guint8 -.source 4 uyvy guint8 -.temp 2 uv - -x2 splitwb y, uv, uyvy -splitwb v, u, uv - - -.function cogorc_convert_YUY2_Y444 -.flags 2d -.dest 2 y guint8 -.dest 2 uu guint8 -.dest 2 vv guint8 -.source 4 yuy2 guint8 -.temp 2 uv -.temp 1 u -.temp 1 v - -x2 splitwb uv, y, yuy2 -splitwb v, u, uv -splatbw uu, u -splatbw vv, v - - -.function cogorc_convert_UYVY_Y444 -.flags 2d -.dest 2 y guint8 -.dest 2 uu guint8 -.dest 2 vv guint8 -.source 4 uyvy guint8 -.temp 2 uv -.temp 1 u -.temp 1 v - -x2 splitwb y, uv, uyvy -splitwb v, u, uv -splatbw uu, u -splatbw vv, v - - -.function cogorc_convert_UYVY_I420 -.dest 2 y1 guint8 -.dest 2 y2 guint8 -.dest 1 u guint8 -.dest 1 v guint8 -.source 4 yuv1 guint8 -.source 4 yuv2 guint8 -.temp 2 t1 -.temp 2 t2 -.temp 2 ty - -x2 splitwb ty, t1, yuv1 -storew y1, ty -x2 splitwb ty, t2, yuv2 -storew y2, ty -x2 avgub t1, t1, t2 -splitwb v, u, t1 - - - -.function cogorc_convert_AYUV_I420 -.flags 2d -.dest 2 y1 guint8 -.dest 2 y2 guint8 -.dest 1 u guint8 -.dest 1 v guint8 -.source 8 ayuv1 guint8 -.source 8 ayuv2 guint8 -.temp 4 ay -.temp 4 uv1 -.temp 4 uv2 -.temp 4 uv -.temp 2 uu -.temp 2 vv -.temp 1 t1 -.temp 1 t2 - -x2 splitlw uv1, ay, ayuv1 -x2 select1wb y1, ay -x2 splitlw uv2, ay, ayuv2 -x2 select1wb y2, ay -x4 avgub uv, uv1, uv2 -x2 splitwb vv, uu, uv -splitwb t1, t2, uu -avgub u, t1, t2 -splitwb t1, t2, vv -avgub v, t1, t2 - - - -.function cogorc_convert_AYUV_YUY2 -.flags 2d -.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_convert_AYUV_UYVY -.flags 2d -.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_convert_AYUV_Y42B -.flags 2d -.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_convert_AYUV_Y444 -.flags 2d -.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_convert_Y42B_YUY2 -.flags 2d -.dest 4 yuy2 guint8 -.source 2 y guint8 -.source 1 u guint8 -.source 1 v guint8 -.temp 2 uv - -mergebw uv, u, v -x2 mergebw yuy2, y, uv - - -.function cogorc_convert_Y42B_UYVY -.flags 2d -.dest 4 uyvy guint8 -.source 2 y guint8 -.source 1 u guint8 -.source 1 v guint8 -.temp 2 uv - -mergebw uv, u, v -x2 mergebw uyvy, uv, y - - -.function cogorc_convert_Y42B_AYUV -.flags 2d -.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_convert_Y444_YUY2 -.flags 2d -.dest 4 yuy2 guint8 -.source 2 y guint8 -.source 2 u guint8 -.source 2 v guint8 -.temp 2 uv -.temp 4 uvuv -.temp 2 uv1 -.temp 2 uv2 - -x2 mergebw uvuv, u, v -splitlw uv1, uv2, uvuv -x2 avgub uv, uv1, uv2 -x2 mergebw yuy2, y, uv - - -.function cogorc_convert_Y444_UYVY -.flags 2d -.dest 4 uyvy guint8 -.source 2 y guint8 -.source 2 u guint8 -.source 2 v guint8 -.temp 2 uv -.temp 4 uvuv -.temp 2 uv1 -.temp 2 uv2 - -x2 mergebw uvuv, u, v -splitlw uv1, uv2, uvuv -x2 avgub uv, uv1, uv2 -x2 mergebw uyvy, uv, y - - -.function cogorc_convert_Y444_AYUV -.flags 2d -.dest 4 ayuv guint8 -.source 1 yy 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, yy -mergewl ayuv, ay, uv - - - -.function cogorc_convert_AYUV_ARGB -.flags 2d -.dest 4 argb guint8 -.source 4 ayuv guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 a -.temp 1 y -.temp 1 u -.temp 1 v -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 - -x4 subb x, ayuv, 128 -splitlw t1, t2, x -splitwb y, a, t2 -splitwb v, u, t1 -convsbw wy, y -convsbw wu, u -convsbw wv, v - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, a, r -mergebw t2, g, b -mergewl x, t1, t2 -x4 addb argb, x, 128 - - - -.function cogorc_convert_AYUV_BGRA -.flags 2d -.dest 4 argb guint8 -.source 4 ayuv guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 a -.temp 1 y -.temp 1 u -.temp 1 v -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 - -x4 subb x, ayuv, 128 -splitlw t1, t2, x -splitwb y, a, t2 -splitwb v, u, t1 -convsbw wy, y -convsbw wu, u -convsbw wv, v - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, b, g -mergebw t2, r, a -mergewl x, t1, t2 -x4 addb argb, x, 128 - - - - -.function cogorc_convert_AYUV_ABGR -.flags 2d -.dest 4 argb guint8 -.source 4 ayuv guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 a -.temp 1 y -.temp 1 u -.temp 1 v -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 - -x4 subb x, ayuv, 128 -splitlw t1, t2, x -splitwb y, a, t2 -splitwb v, u, t1 -convsbw wy, y -convsbw wu, u -convsbw wv, v - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, a, b -mergebw t2, g, r -mergewl x, t1, t2 -x4 addb argb, x, 128 - - - -.function cogorc_convert_AYUV_RGBA -.flags 2d -.dest 4 argb guint8 -.source 4 ayuv guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 a -.temp 1 y -.temp 1 u -.temp 1 v -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 - -x4 subb x, ayuv, 128 -splitlw t1, t2, x -splitwb y, a, t2 -splitwb v, u, t1 -convsbw wy, y -convsbw wu, u -convsbw wv, v - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, r, g -mergebw t2, b, a -mergewl x, t1, t2 -x4 addb argb, x, 128 - - - -.function cogorc_convert_I420_BGRA -.dest 4 argb guint8 -.source 1 y guint8 -.source 1 u guint8 -.source 1 v guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 t3 -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 -.const 1 c128 128 - -subb t3, y, c128 -convsbw wy, t3 -loadupib t3, u -subb t3, t3, c128 -convsbw wu, t3 -loadupib t3, v -subb t3, t3, c128 -convsbw wv, t3 - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, b, g -mergebw t2, r, 255 -mergewl x, t1, t2 -x4 addb argb, x, c128 - - - -.function cogorc_convert_I420_BGRA_avg -.dest 4 argb guint8 -.source 1 y guint8 -.source 1 u1 guint8 -.source 1 u2 guint8 -.source 1 v1 guint8 -.source 1 v2 guint8 -.temp 2 t1 -.temp 2 t2 -.temp 1 t3 -.temp 1 t4 -.temp 2 wy -.temp 2 wu -.temp 2 wv -.temp 2 wr -.temp 2 wg -.temp 2 wb -.temp 1 r -.temp 1 g -.temp 1 b -.temp 4 x -.const 1 c8 8 -.const 1 c128 128 - -subb t3, y, c128 -convsbw wy, t3 -loadupib t3, u1 -loadupib t4, u2 -avgub t3, t3, t4 -subb t3, t3, c128 -convsbw wu, t3 -loadupib t3, v1 -loadupib t4, v2 -avgub t3, t3, t4 -subb t3, t3, c128 -convsbw wv, t3 - -mullw t1, wy, 42 -shrsw t1, t1, c8 -addssw wy, wy, t1 - -addssw wr, wy, wv -mullw t1, wv, 103 -shrsw t1, t1, c8 -subssw wr, wr, t1 -addssw wr, wr, wv - -addssw wb, wy, wu -addssw wb, wb, wu -mullw t1, wu, 4 -shrsw t1, t1, c8 -addssw wb, wb, t1 - -mullw t1, wu, 100 -shrsw t1, t1, c8 -subssw wg, wy, t1 -mullw t1, wv, 104 -shrsw t1, t1, c8 -subssw wg, wg, t1 -subssw wg, wg, t1 - -convssswb r, wr -convssswb g, wg -convssswb b, wb - -mergebw t1, b, g -mergebw t2, r, 255 -mergewl x, t1, t2 -x4 addb argb, x, c128 - - - -.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_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_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_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_YVYU -.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 uv, yy, uyvy -swapw uv, uv -x2 mergebw ayay, c255, yy -mergewl uvuv, uv, uv -x2 mergewl ayuv, ayay, uvuv - - -.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_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_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_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_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_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_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_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_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_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_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_YVYU -.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 -swapw uv1, uv1 -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_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_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_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_putline_BGRA -.dest 4 bgra guint8 -.source 4 argb guint8 - -swapl bgra, argb - - -.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_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_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_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_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 |